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

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.