SPUG: Getting the name of the method I'm in
jeff saenz
jeff at planetoid.net
Mon Mar 26 15:33:33 CST 2001
try the caller routine. i think i saw an example of it in carp.pm
starfire wrote:
> I want to access the name of a method from inside the method, so I can
> write it to the Apache error log. For example:
>
> sub my_method() {
> my ($self, $r) = @_;
> my method_name = ??;
> $r->log_error(ref($self)
> . "::${method_name}: Can't open file $file: $!");
> }
>
> I don't like hard coding it, in case the code is copied and/or the method
> name is changed. $0 won't give me what I want.
>
> Any suggestions?
>
> --
> Richard Anderson, Ph.D. www.unixscripts.com
> Perl / Java / SQL / Unix Richard.Anderson at raycosoft.com
> Raycosoft, LLC Seattle, WA, USA
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> 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://www.halcyon.com/spug/
--
Perl/Linux/Java Development
Resume: http://resumes.yahoo.com/undertheash/perljavalinux
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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://www.halcyon.com/spug/
More information about the spug-list
mailing list