Pad::Tie

Tie an object to lexical contexts
Download

Pad::Tie Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Hans Dieter Pearcey
  • Publisher web site:
  • http://search.cpan.org/~hdp/

Pad::Tie Tags


Pad::Tie Description

Tie an object to lexical contexts Pad::Tie is a Perl module that lets you use your objects' methods as though they were lexical variables.Alternately, it lets you use lexical variables to refer to your bound object methods. It's all a matter of perspective.Creating a Pad::Tie object requires an object (the invocant) and a list of methods (with their personalities) that will be exposed to called subroutines.There are a number of different calling conventions for methods in Perl. In order to accommodate as many as possible, Pad::Tie lets plugins handle them. See Pad::Tie::Plugin for details on writing new method personalities.SYNOPSIS use Pad::Tie; my $obj = MyClass->new(...); my $pad_tie = Pad::Tie->new( $obj, , array_ref => , hash_ref => , 'self', ] ); $pad_tie->call(\&foo); my $code = $pad_tie->wrap(\&bar); $code->(1, 2, 3); sub foo { my $fooble; print $fooble; # $obj->fooble } sub bar { my $quux = 17; # $obj->quux(17); my %lookup; for my $key (keys %lookup) { # keys %{ $obj->lookup } $lookup{$key} ||= 1; # $obj->lookup->{$key} ||= 1 } my @numbers = @_; # $obj->numbers(); @_ is from above } Requirements: · Perl


Pad::Tie Related Software