R
RedGrittyBrick
An instance method in traditional Perl OO might be like this.
Package Foo;
...
sub bar {
my $self = shift;
my ($x, $y, $z) = @_;
...
}
I'd like to be able to invoke this either as a (static) class method
$result = Foo::bar(1,2,3);
or as an instance method
my $foo = Foo->new(Foo::INVERTED);
$result = $foo->bar(1,2,3);
What is the usual idiom for checking for the presence of the class ref?.
Package Foo;
...
sub bar {
my $self = shift;
my ($x, $y, $z) = @_;
...
}
I'd like to be able to invoke this either as a (static) class method
$result = Foo::bar(1,2,3);
or as an instance method
my $foo = Foo->new(Foo::INVERTED);
$result = $foo->bar(1,2,3);
What is the usual idiom for checking for the presence of the class ref?.