| Data::Visitor::Callback - A Data::Visitor with callbacks. |
Data::Visitor::Callback - A Data::Visitor with callbacks.
use Data::Visitor::Callback;
my $v = Data::Visitor::Callback->new(
value => sub { ... },
array => sub { ... },
);
$v->visit( $some_perl_value );
This is a the Data::Visitor manpage subclass that lets you invoke callbacks instead of needing to subclass yourself.
The options supported are:
This is useful when you want to modify $_ directly
Use these keys for the corresponding callbacks.
The callback is in the form:
sub {
my ( $visitor, $data ) = @_;
# or you can use $_, it's aliased
return $data; # or modified data
}
Within the callback $_ is aliased to the data, and this is also passed in the parameter list.
value, for references to regexes, globs and code.
value for non references.
Yuval Kogman <nothingmuch@woobling.org>
Copyright (c) 2006 Yuval Kogman. All rights reserved
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
| Data::Visitor::Callback - A Data::Visitor with callbacks. |