Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Why isn't ->can() curried?

by broquaint (Abbot)
on Jan 20, 2003 at 17:17 UTC ( #228402=note: print w/replies, xml ) Need Help??


in reply to Why isn't ->can() curried?

Would the behaviour be something like this
use strict; use warnings; { my $old_can = *UNIVERSAL::can{CODE}; no warnings 'redefine'; *UNIVERSAL::can = sub { my($class,$method) = @_; my $ret = $old_can->($class, $method); return sub { warn "$class->$ret( @_ )\n"; $class->$ret( @_ ) }; }; } sub foo::bar { print "got: @_[1 .. $#_]\n"; } my $m = foo->can("bar"); $m->(qw(ichi ni san shi)); __output__ foo->CODE(0x81080f8)( ichi ni san shi ) got: ichi ni san shi
Or something else perhaps?
HTH

_________
broquaint

Replies are listed 'Best First'.
Re^2: Why isn't ->can() curried?
by diotalevi (Canon) on Jan 20, 2003 at 18:08 UTC
      It's far, far too late to make this the default behaviour. This'd be a matter for a new method in UNIVERSAL (which has its own issues) or a middle OO layer.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2021-03-04 18:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (107 votes). Check out past polls.

    Notices?