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"'
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|