Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Perl OO question



I, for whatever reason, have two implementations of a Perl module, and
I want to compare them programmatically.  I thought it would be easy
enough to get the methods of the object with code similar to this:

my $o = MyObject->new();
foreach $method (sort(keys(%$o))){
    debug("method = $method\n");
    if (ref($o->{$method}) eq "CODE"){
      print("method $method found\n");
    }
}

But this does not work, as it only prints out the attributes (i.e. the
non-code members) of the object, even in the debug() call (which, if I
defined it here, would just be a subroutine that calls print with its
args and potentially some other info).

Is there a way to do this *in code* *in Perl*?

Thanks

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.




Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org