Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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"'


In reply to Re: CGI Re: Paths in Perl by rob_au
in thread Paths in Perl by tachyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (16)
    As of 2014-09-18 17:15 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (120 votes), past polls