[Pdx-pm] Getopt::Modern usage model

Michael G Schwern schwern at pobox.com
Fri Jun 10 06:46:05 PDT 2005


On Thu, Jun 09, 2005 at 05:01:10PM -0700, Eric Wilhelm wrote:
> The trouble here is that you don't get shell interpolation for the stuff 
> after the equals:
> 
>   perl -e 'print join(" ", @ARGV), "\n"' -- --foo=~ --foo ~
> 
> Is there a good, secure, reliable, cross-platform way to do shell 
> expansion within Perl?   Otherwise it seems like a source of confusion 
> (not good since the point of this module is to avoid those.)

I'd let the program worry about that.  Most shell expansion works.

$ perl -wle 'print join " ", @ARGV' -- --foo={1,2}
--foo=1 --foo=2

Its only ~ expansion that doesn't and that's easy.

	$path =~ s/^~/$ENV{HOME}/ if defined $ENV{HOME};


-- 
Michael G Schwern     schwern at pobox.com     http://www.pobox.com/~schwern
You are wicked and wrong to have broken inside and peeked at the
implementation and then relied upon it.
	-- tchrist in <31832.969261130 at chthon>


More information about the Pdx-pm-list mailing list