- Timestamp:
- 06/27/08 15:49:57 (5 months ago)
- Location:
- dan/perl/Object-with/branches/yappo
- Files:
-
- 2 modified
-
lib/Object/with.pm (modified) (2 diffs)
-
test.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
dan/perl/Object-with/branches/yappo/lib/Object/with.pm
r14692 r14697 31 31 no strict 'refs'; 32 32 no warnings 'redefine'; 33 *{$name} = $code if $code && ref $code; 33 my($caller, $method) = $name =~ /^(.*)::(.*)$/; 34 if ($code && ref $code) { 35 *{$name} = $code; 36 } else { 37 *{$name} = sub{}; 38 } 34 39 delete $TMP_METHOD_CACHE{$name}; 35 40 } … … 47 52 no strict 'refs'; 48 53 no warnings 'redefine'; 49 50 54 $TMP_METHOD_CACHE{$name} = defined &{$name} ? \&{$name} : undef unless exists $TMP_METHOD_CACHE{$name}; 51 *{$name} = \&{"$class\::$method"};55 *{$name} = sub { unshift @_, $TMP_OBJ; goto &{"$class\::$method"} }; 52 56 } 53 57 -
dan/perl/Object-with/branches/yappo/test.pl
r14692 r14697 20 20 hello(); 21 21 }; 22 warn "----------------"; 23 hello(); 22 24 hello2(); 25 warn "----------------"; 23 26 24 27 sub hello2 { die 'end' }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)