Driving a module (.pm)

Nigel Hamilton nigel at m1.turbo10.com
Thu Nov 17 11:07:35 GMT 2005


 	I'm trying to work out a good scheme for embedding a little 
driver in a Perl module (.pm).

 	I want a dual-use module format - in module context it behaves 
like a module but when I call directly it runs a little embedded driver 
(perl Foo.pm).

 	I'm considering adding something like this at the bottom of the 
Foo module:

# module driver at base of file
if (shift) {
 	# run the little driver


 	But it means I need to call it with: perl Foo.pm <something> .
 	There must be a better way .... any ideas?


More information about the london.pm mailing list