in reply to Re^5: Getting methods existing in a Perl Object!
in thread Getting methods existing in a Perl Object!

# Fix the class name (eg. "Bah=HASH(0x192a324)" => "Bah")

Are you aware of blessed() in Scalar::Util?

Replies are listed 'Best First'.
Re^7: Getting methods existing in a Perl Object!
by liverpole (Monsignor) on Dec 31, 2006 at 14:41 UTC
    Yes, I am now ;-)

    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.


    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
      $class = $cname if defined( $cname );