in reply to Re^6: Getting methods existing in a Perl Object!
in thread Getting methods existing in a Perl Object!
So it looks like a better (more standard) way to "Fix the class name" would be:
use Scalar::Util qw(blessed); # Near the top of the program # ... # Fix the class name (eg. "Bah=HASH(0x192a324)" => "Bah") # Brute force method: $class =~ s/=.*//; my $cname = blessed($class); $class = $cname if defined($cname); # was "if $cname;"
Thank you for the tip, ++chromatic!
Update: ... and ysth, whose change I've also incorporated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Getting methods existing in a Perl Object!
by ysth (Canon) on Dec 31, 2006 at 20:01 UTC |