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



Derek Martin wrote:
> I...have two implementations of a Perl module, and
> I want to compare them programmatically.

I would take the approach of running Perltidy[1] on both, followed by
diff or other text processing of your choice. (For example, once you
have methods formatted consistently, a simple grep can list all the
methods in a file.)

 dynamically generated methodsThis isn't perfect if your two modules
differ radically, as you can have , or an implementation that is spread
across multiple modules using inheritance.

1. http://perltidy.sourceforge.net/


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

I see you ran across how to dive into the symbol table.


> The namespace is polluted by members of other imported modules used
> within that one, a fact which I have very little control over.

Using an OO framework like Moose avoids this, but that doesn't help you
if the code you are analyzing doesn't use it.

OO in Perl 5 is "glued on" rather than native, unlike Perl 6, and this
becomes evident when you start introspecting objects.


> I was also reminded that I (still) hate Perl.

Perl makes easy stuff convenient, and hard stuff possible. What you were
looking to do is out of the realm of what's typical.

 -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org