Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: RFC: Perl Second-Best Practices

by chromatic (Archbishop)
on Dec 24, 2005 at 20:14 UTC ( [id://518928]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC: Perl Second-Best Practices
in thread RFC: Perl Second-Best Practices

sfink is right. Also, japhy noticed recently that disabling strict references at the top of the scope there disables them inside the anonymous subroutine. It's better to declare the subroutine and then disable strict references and assign to the typeglob:

{ my $sub = sub { ... }; no strict 'refs'; *{ "${class}::get_${name}" } = $sub; }

Replies are listed 'Best First'.
Re^3: RFC: Perl Second-Best Practices
by Aristotle (Chancellor) on Dec 26, 2005 at 12:26 UTC
    *{; do { no strict 'refs'; \*{ "${class}::get_${name}" } } } = sub { . +.. };

    Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://518928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found