On 03/01/2008, Andy Armstrong <[EMAIL PROTECTED]> wrote: > On 3 Jan 2008, at 17:20, Andy Armstrong wrote: > >> my $super = __PACKAGE__->can($sub) or die; > > > > Should that be __PACKAGE__->SUPER::can($sub) ? > > > Hmm. Does that do what I think it does? Maybe not.
Without looking at the code we dont know whether the call is from within a method call. And thinking about it more i think that was the whole point of the weird call, Im guessing here, but probably this code isnt in a method which means that he doesnt have access to SUPER so, he passes it into can() which does. The following one liner demonstrates what the author of Template::Timer was (correctly) doing. Note that it doesnt matter if you define B::foo or not. $ perl -le'@B::ISA=qw(A); sub A::foo {print "in A::foo"} package B; sub foo {print "in B::foo"} __PACKAGE__->can("SUPER::foo")->();' in A::foo So assuming this code was NOT inside a method (most likely as he said it was part of code that installs methods) it looks like the code that Ovid bumped into was in fact correct, and chromatic's UNIVERSAL::can is broken with regard to SUPER::. > And talking to yourself? What's all that about? Sometimes its hard to find decent conversation. :-) cheers, Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"