Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: Re: framechat

by tye (Cardinal)
on Mar 15, 2001 at 05:17 UTC ( #64583=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: framechat
in thread framechat

BTW, the suggestion on this that I made in the chatterbox was $ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp"
(with the possiblity of replacing "/tmp" with File::Spec->tmpdir() if you don't mind requiring Perl 5.6) and then dieing if the resulting directory did not exist.

        - tye (but my friends call me "Tye")


Comment on Re: Re: Re: Re: framechat
Select or Download Code
(tye)Re2: framechat
by tye (Cardinal) on Mar 15, 2001 at 20:35 UTC

    Here is one way to do the above while giving a decent error message:

    my $env; my $tmpdir= $ENV{$env="TMPDIR"} || $ENV{$env="TMP"} || $ENV{$env="TEMP"} || ($env="","/tmp"); if( ! -d $tmpdir ) { die "Invalid temporary directory ($tmpdir)", $env ? " (taken from \$ENV{$env})" : "(please set TMPDIR, TMP, or TEMP in your environment)", "\n"; }

            - tye (but my friends call me "Tye")
      Too much repeated code.
      my $tmpdir; for (qw(TMPDIR TMP TEMP)) { next unless $tmpdir = $ENV{$_}; last if -d $tmpdir; die "Invalid temporary directory $tmpdir from \$ENV{$_}\n"; } $tmpdir ||= "/tmp"; # if this is busted, you got troubles...

      -- Randal L. Schwartz, Perl hacker

        $tmpdir ||= "/tmp"; # if this is busted, you got troubles...

        I guess you've never heard of the existance of other operating systems, eh? (:

                - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2014-07-22 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (109 votes), past polls