home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _c6e741595f34761dd6c036dec1b728ed < prev    next >
Text File  |  2004-06-01  |  451b  |  26 lines

  1. package Selfish;
  2.  
  3. sub TIESCALAR {
  4.     use Data::Dumper 'Dumper';
  5.     print Dumper [ \@_ ];
  6.     bless [ @_[1..$#_] ], $_[0];
  7. }
  8.  
  9. sub FETCH {
  10.     use Data::Dumper 'Dumper';
  11.     Dumper [ @{$_[0]} ];
  12. }
  13.  
  14. package main;
  15.  
  16. use Attribute::Handlers autotieref => { Selfish => Selfish };
  17.  
  18. my $next : Selfish("me");
  19. print "$next\n";
  20.  
  21. my $last : Selfish("you","them","who?");
  22. print "$last\n";
  23.  
  24. my $other : Selfish(["you","them","who?"]);
  25. print "$other\n";
  26.