X-Git-Url: https://git.deb.at/?p=deb%2Fpackages.git;a=blobdiff_plain;f=lib%2FPackages%2FCGI.pm;fp=lib%2FPackages%2FCGI.pm;h=34d7a5f341636414d0175e089561fd241c9c5823;hp=b09235273ab4d9e057321f2a9c494287bdf89e09;hb=e0996d1bc5a737ae3fbeb9d1598d106ad5496a6a;hpb=1f7a7225c79c1a6a1caa2f51d208e1dad14997d7 diff --git a/lib/Packages/CGI.pm b/lib/Packages/CGI.pm index b092352..34d7a5f 100644 --- a/lib/Packages/CGI.pm +++ b/lib/Packages/CGI.pm @@ -7,15 +7,25 @@ use Exporter; use Packages::Config; our @ISA = qw( Exporter ); -our @EXPORT = qw( DEBUG debug fatal_error ); +our @EXPORT = qw( DEBUG debug fatal_error get_mime ); our @EXPORT_OK = qw( error hint msg note get_all_messages make_url make_search_url ); - # define this to 0 in production mode use constant DEBUG => 1; our $debug = 0; +my %mime_types = ( + txt => 'text/plain', + 'txt.gz' => 'text/plain', + html => 'text/html', + rss => 'application/rss+xml', + ); + +sub get_mime { + return $mime_types{$_[0]} || $_[1] || 'text/html'; +} + our (@fatal_errors, @errors, @debug, @msgs, @hints, @notes); sub reset {