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 information. 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 from the # file field form parameter. return undef unless $file[0]; . . . }