1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- @mapping =
- (
-
- 'data', 'application/octet-stream',
- 'text', 'text/plain',
-
- '^Rich Text Format data', 'text/richtext',
- '^HTML document text', 'text/html',
- '^exported SGML document text', 'text/sgml',
- 'mail text', 'message/rfc822',
- 'news text', 'message/news',
- '^PostScript document text', 'application/postscript',
- '^BinHex binary text', 'application/mac-binhex40',
- '^Zip archive data', 'application/zip',
- '^Microsoft Word', 'application/msword',
- '^PGP key', 'application/pgp-keys',
- '^PGP encrypted', 'application/pgp-encrypted',
- '^PGP armored data signature', 'application/pgp-signature',
- '^JPEG image', 'image/jpeg',
- '^GIF image', 'image/gif',
- '^PNG image', 'image/png',
- '^TIFF image', 'image/tiff',
- 'Computer Graphics Metafile', 'image/cgf',
- '^Sun/NeXT audio data', 'audio/basic',
- '^MPEG', 'video/mpeg',
- '^Apple QuickTime movie', 'video/quicktime',
-
- '^bitmap', 'image/x-bitmap',
- '^PC bitmap data, Windows 3.x format', 'image/x-msw3bmp',
- '^FLI', 'video/x-fli',
- '^FLC', 'video/x-flc',
- 'AVI data', 'video/x-avi',
- 'WAVE', 'audio/x-wav',
- 'VOC', 'audio/x-voc',
- );
- local($mimetype,$index,$regexp);
- while (<>)
- {
- chop;
- $index = $#mapping - 1;
- while ($index > -1 && !defined($mimetype))
- {
- $mimetype = $mapping[$index + 1] if (/$mapping[$index]/);
- $index -= 2;
- }
- print "$mimetype\n";
- undef $mimetype;
- }
- 0;
|