SPUG: code reference callback on a class method
Tom Legrady
legrady at earthlink.net
Fri May 31 16:08:04 CDT 2002
sub myFindFucntion { ... }
find( \&myFindFunction, .... )
works just fine. But the function is not a method of your class, it's a free function, so don't 'shift' your 'self'.
According to the POD,
"The wanted() function does whatever verifications you want.
$File::Find::dir contains the current directory name, and $_ the
current filename within that directory. $File::Find::name contains
the complete pathname to the file. You are chdir()'d to
$File::Find::dir when the function is called, unless no_chdir
was specified."
so you can just use the $_ default, as in :
sub myFindFunction {
-l && print "$File::Find::name is a link";
}
Tom Legrady
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list