Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: CGI Re: Paths in Perl

by rob_au (Abbot)
on Nov 16, 2002 at 01:36 UTC ( #213335=note: print w/ replies, xml ) Need Help??


in reply to CGI Re: Paths in Perl
in thread Paths in Perl

In the CGI::Upload module, the following code was used to parse the full pathname of the uploaded file - This code makes use of HTTP::BrowserDetect to detect the client operating system from the sent HTTP headers and set the parse behaviour of File::Basename accordingly.

The pertinent code in question ...

use CGI; use File::Basename; use HTTP::BrowserDetect; sub _handle_file { my ($self, $param) = @_; my $cgi = $self->query; # Determine and set the appropriate file system parsing routines + for the # uploaded path name based upon the HTTP client header informati +on. fileparse_set_fstype( sub { my $browser = HTTP::BrowserDetect->new; return 'MSWin32' if $browser->windows; return 'MacOS' if $browser->mac; $^O; } ); my @file = fileparse( $cgi->param($param), '\.[^\.]*' ); # Return an undefined value if the file name cannot be parsed fr +om the # file field form parameter. return undef unless $file[0]; . . . }

 

perl -e 'print+unpack("N",pack("B32","00000000000000000000000111100010")),"\n"'


Comment on Re: CGI Re: Paths in Perl
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-07 01:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls