This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
"static" call to UNIVERSAL::can
authorNick Ing-Simmons <Nick.Ing-Simmons@tiuk.ti.com>
Thu, 21 Nov 1996 15:47:46 +0000 (15:47 +0000)
committerChip Salzenberg <chip@atlantic.net>
Tue, 26 Nov 1996 08:48:00 +0000 (20:48 +1200)
commit6f08146e2c3ab87e9f70e612981a0771a8acb8fb
treeebe607293fe73cc1001db8c65af8e7c37e4299dd
parentbda0c67a7644b9c34d42b0e8ff4327d6d677133f
"static" call to UNIVERSAL::can

Is there some reason why 'can' does not allow a class name,
but (silently) insists on an instance?

I wanted to do this :

sub Construct
{
 my $class = (caller(0))[0];

 if ($class->can('Something'))
  {
   ...
  }
 else
  {
   ...
  }
}

can just returns undef in this case, even if class has method in
question.

Anyone object to a patch?

p5p-msgid: <199611211407.OAA14645@pluto>
private-msgid: <199611211547.PAA15878@pluto>
universal.c