Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Re: Re: framechat

by a (Friar)
on Mar 14, 2001 at 20:43 UTC ( [id://64422]=note: print w/replies, xml ) Need Help??

in reply to Re: Re: framechat
in thread framechat

Replies then: the idea was to handle a not filled in ENV TEMP. The || works fine here, e.g. try
use strict; $ENV{TEMP} = "goo go"; my $temp = $ENV{TEMP} || "/tmp"; print "t $temp\n";
what do you get when it doesn't work? I guess for max portability, you'd probably want a combo of your and my fix, I was just trying to avoid assuming ENV{TEMP} was valid (as mine wasn't ;-).

I understand $content is used in 3 places, but isn't it being filled in each time by makelinks? If one sub were filling it in (beside makelinks) and another needing access, global, but it appears its used 'locally' each time it has data in it. A style quibble, really, I just was trying to figure out the array bug and had to poke a bit deeper to see makelinks was filling in $content. It appears, w/ data, by 'magic' otherwise. is 2.29, I'll try upgrading things to see if that's the trouble. Huh. Perhaps this ver returns an array ref instead of a string?

Update: upgraded to Parser 2.30 - same stuff. Both the array ref and the XML as ref problem. I'll keep poking - perhaps a debug box where we could see the xml as it arrives?

Update 2:Hmm. If I turn off 'fatalsToBrowser' no complaints and it appears the complaint is from Expat doing an eval around:$ioref = *{$arg}{IO}; where $arg is the incoming xml. I gather its supposed to die ($@ is my error msg) but why this floats up to cgi::carp for me and not you ???


Replies are listed 'Best First'.
Re: Re: Re: Re: framechat
by tye (Sage) on Mar 15, 2001 at 05:17 UTC

    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")

      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

Re: Re: Re: Re: framechat
by epoptai (Curate) on Mar 15, 2001 at 13:52 UTC
    a's 4 liner works as expected from the command line, but from CGI in framechat, it doesn't find $ENV{TEMP} on my system, neither does tye's line. So, rather than gamble with the location of $temp it's been made a config variable that defaults to the script directory, so people with restrictive environments can easily set it.

    I see what you mean about the 'magic' $comment global. It's really just an artifact of the development process, it was needed at first but eventually coded out of relevance.


    (an obsolete patch that was here has been deleted)

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-05-25 12:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found