-
-
01 Oct 2016 14:03:10 UTC
- Distribution: Tie-Scalar-Callback
- Module version: 0.07
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (560 / 0 / 0)
- Kwalitee
Bus factor: 1- 91.18% Coverage
- License: freebsd
- Perl: v5.10.0
- Activity
24 month- Tools
- Download (3.93KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Tie::Scalar::Callback - a tied scalar which executes a callback everytime it is used
VERSION
version 0.07
SYNOPSIS
use Tie::Scalar::Callback; # this coderef doubles the scalar's value everytime it's fetched my $coderef = sub { state $value = 1/2; state $factor = 2; $value *= $factor; } }; tie(my $doubler, 'Tie::Scalar::Callback', $coderef); print $doubler; 1 print $doubler; 2 print $doubler; 4
DESCRIPTION
Tie::Scalar::Callback
is a class for creating tied scalars which execute a callback everytime an event occurs on the scalar. The callback's return value becomes the scalar's apparent value.ACKNOWLEDGEMENTS
Thanks to brian d foy for coming up with the idea for this module.
SEE ALSO
AUTHOR
David Farrell <dfarrell@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2016 by David Farrell.
This is free software, licensed under:
The (two-clause) FreeBSD License
Module Install Instructions
To install Tie::Scalar::Callback, copy and paste the appropriate command in to your terminal.
cpanm Tie::Scalar::Callback
perl -MCPAN -e shell install Tie::Scalar::Callback
For more information on module installation, please visit the detailed CPAN module installation guide.