Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

geoff (2013)

  reversethis-{gro ... om} {ta} {ffoeg}

see [] for personal information, links to presentations, GPG key, and so on.

Journal of geoff (2013)

Friday April 02, 2004
10:52 AM

interesting perl problem

[ #18175 ]
so, someone asked me today if there was a way in perl to accomplish something bizarre. I didn't have a quick answer, yet the problem seemed sufficiently interesting that I thought I'd post it here...

say you have that defines package Foo. now, for complex legacy reasons, your stuck with this and need to call both from the command-line as well as

require "";

how do you create a chunk of code that only executes from the command-line and not when is loaded or imported?

I might be missing something obvious, but the only thing I could come up with was requiring some random command-line argument and checking @ARGV. apparently that's not an option.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.