ASP4

 view release on metacpan or  search on metacpan

lib/ASP4/StaticHandler.pm  view on Meta::CPAN

    or die "Cannot open '$file' for reading: $!";
  local $/;
  $Response->SetHeader('content-length' => (stat($file))[7] );
  
  my ($ext) = $file =~ m{\.([^\.]+)$};
  my %types = (
    swf   => 'application/x-shockwave-flash',
    xml   => 'text/xml',
    jpg   => 'image/jpeg',
    jpeg  => 'image/jpeg',
    png   => 'image/png',
    bmp   => 'image/bmp',
    gif   => 'image/gif',
    json  => 'application/x-json',
    css   => 'text/css',
    pdf   => 'application/x-pdf',
    js    => 'text/javascript',
    svg   => 'image/svg+xml',
    html  => 'text/html',
  );
  my $type = $types{lc($ext)} || 'application/octet-stream';



( run in 1.144 second using v1.01-cache-2.11-cpan-df04353d9ac )