Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: UNIVERSAL->cando , shortcut for testing and running methods?

by Rhandom (Curate)
on Mar 06, 2009 at 15:14 UTC ( [id://748884]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $meth = $self->can('home') || $self->can('house') || confess(q{Can'
    +t determine home});
    my $home = $self->$meth(1);
    
  2. or download this
    my $home = ($self->can('home') || $self->can('house') || confess(q{Can
    +'t determine home}))->($self, 1);
    
  3. or download this
    my $meth_name = (grep {$self->can($_)} qw(home house))[0] || confess(q
    +{Can't determine home});
    my $home = $self->$meth_name(1);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-19 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found