It didn't catch my eye the first time, but don't trust $0. It's a bad shell scripting habit. use __FILE__ instead. Sure you can't embed it in string unless you use "@{[__FILE__]}" but it's just the same, it can't be changed, while $0 can.

Now, Pod::Usage's pod2usage function does look at $0 if you don't pass the -input option, but that's cause __FILE__ is local to each file, and it wouldn't work otherwise, and you can always say pod2usage( -input => __FILE__ );.

If you symlink a file as 'FOO', __FILE__ will contain that value, although i'm not sure how portable that is (i'm willing to venture a guess that it is).

Now to your new question, yes, the symlink design of the utility is bad IMHO. Either create 2 separate scripts, or just make each Sub an option (with Getopt)

And while i'm at it, you shouldn't exit from a subroutine. Subs should return. You shouldn't generally use exit to terminate your program normally.

update: oh, btw, each pod token should be surrounded by lone newlines, as in perl -e " print qq{die;\n\n=pod\n\nhi there\n\n=cut\n\n}; "

____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: Re: Re: Storable 2 Text - An editor for data files created by Storable.pm by PodMaster
in thread Storable 2 Text - An editor for data files created by Storable.pm by kingman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.