Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Can I do single-file, Object oriented perl?

by trammell (Priest)
on Jul 05, 2005 at 16:40 UTC ( [id://472516]=note: print w/replies, xml ) Need Help??


in reply to Can I do single-file, Object oriented perl?

One trick I learned here for making a module that you can "run":
package MyPackage; # if invoked from the command line, call run() with # command-line input __PACKAGE__->run( @ARGV ) unless caller();
I have tried creating a .pl file and the keyword "package" throws errors. I have tried creating a .pm file, then putting main code (even "print 'Hello World', before the "1;", and this throws different errors.
You'll have to be more specific; I do those things all the time without a hitch.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://472516]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2024-04-19 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found