__PACKAGE__ is only special when used as a constant; putting it in a string (or a regex) makes it not a constant. While you could do ... =~ quotemeta(__PACKAGE__), this is not the issue. If you want to see if the first argument to your function is an object, I would suggest:
sub something {
if (eval { $_[0]->isa(__PACKAGE__) }) {
# object call
}
else {
# function call
}
}
Jeff japhy Pinyan,
P.L., P.M., P.O.D, X.S.:
Perl,
regex,
and perlhacker How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart