X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FCGI%2FEx.pm;h=fa848bc2db1053bc78a00a5539ed9a2fe9e99e5a;hb=18123183bfb2737ea337306c9d705fca5b5e50d6;hp=772dcbd12306d69fb83f6cf66b91ec6590bdf6c5;hpb=8a1796477c5a835d8c124cfa8504909dc786d93b;p=chaz%2Fp5-CGI-Ex diff --git a/lib/CGI/Ex.pm b/lib/CGI/Ex.pm index 772dcbd..fa848bc 100644 --- a/lib/CGI/Ex.pm +++ b/lib/CGI/Ex.pm @@ -24,7 +24,7 @@ use vars qw($VERSION use base qw(Exporter); BEGIN { - $VERSION = '2.09'; + $VERSION = '2.18'; $PREFERRED_CGI_MODULE ||= 'CGI'; @EXPORT = (); @EXPORT_OK = qw(get_form @@ -249,7 +249,7 @@ sub content_type { &print_content_type } # print_content_type(); # print_content_type('text/plain); sub print_content_type { - my ($self, $type) = ($#_ >= 1) ? @_ : ref($_[0]) ? (shift, undef) : (undef, shift); + my ($self, $type, $charset) = (@_ && ref $_[0]) ? @_ : (undef, @_); $self = __PACKAGE__->new if ! $self; if ($type) { @@ -257,6 +257,7 @@ sub print_content_type { } else { $type = 'text/html'; } + $type .= "; charset=$charset" if $charset && $charset =~ m|^[\w\-\.\:\+]+$|; if (my $r = $self->apache_request) { return if $r->bytes_sent; @@ -920,6 +921,14 @@ else already printed content-type). Calling this sends the Content-type header. Trying to print -Econtent_type is an error. For clarity, the method -Eprint_content_type is available. + $cgix->print_content_type; + + # OR + $cgix->print_content_type('text/html'); + + # OR + $cgix->print_content_type('text/html', 'utf-8'); + =item C<-Eset_cookie> Arguments are the same as those to CGI->new->cookie({}). @@ -1038,12 +1047,12 @@ See also L. See also L. -=head1 AUTHOR - -Paul Seamons - =head1 LICENSE This module may be distributed under the same terms as Perl itself. +=head1 AUTHOR + +Paul Seamons + =cut