iPerl

 view release on metacpan or  search on metacpan

cgi-bin/web-iPerl  view on Meta::CPAN


=item text/plain

All not found elsewhere, including C<txt>, C<ptxt>, C<txtp> and C<ptx>, C<txp>

=item text/plain; charset=UTF-8

C<utxt>, C<putxt>, C<utxtp> and C<put>, C<utp>

=item text/sgml

C<sgml>, C<psgml>, C<sgmlp> and C<psg>, C<sgp>

=item text/vnd.wap.wml

C<wml>, C<pwml>, C<wmlp> and C<pwm>, C<wmp>

=item text/xml

C<xml>, C<pxml>, C<xmlp> and C<pxm>, C<xmp>

=item application/postscript

C<ps>, C<pps>, C<psp>, C<eps>, C<peps>, C<epsp> and C<pep>, C<epp>

=item image/x-xbitmap

C<xbm>, C<pxbm>, C<xbmp> and C<pxb>, C<xbp>

=item image/x-xpixmap

C<xpm>, C<pxpm>, C<xpmp> and C<pxp>, C<xpp> (not understood by most browsers)

=back

=cut


my @autotype_by_name;

BEGIN {
    CGI::nph( 1 )
	  if $0 =~ m:^(.*/)*nph-[^/]*$:;

    @autotype_by_name =
	# allow p? optionally followed by .\w+ after each suffix
	grep { ref() ? $_ : $_ && $_ . 'p?(?:\.[\w.]+)?$' }
	    'ht(?:ml)?' =>	[],
	    'xml?' =>		[-type => 'text/xml'],
	    'css?' =>		[-type => 'text/css'],
	    'wml?' =>		[-type => 'text/vnd.wap.wml'],
	    'sgm?l?' =>		[-type => 'text/sgml'],
	    'utx?t?' =>		[-type => 'text/plain; charset=UTF-8'],
	    'ps' =>		[-type => 'application/postscript'],
	    'xbm?' =>		[-type => 'image/x-xbitmap'],
	    'xpm?' =>		[-type => 'image/x-xpixmap'],
	    '' =>		[-type => 'text/plain'];
}


my( $directory, $file ) = split m!/(?=[^/]*$)!, $ENV{PATH_TRANSLATED};

@type = (@{_case $file, @autotype_by_name},
	 -X_Powered_By => "Text::iPerl/$VERSION <http://beam.to/iPerl>");

$header = header @type;

local @autostyle_by_contents = @autostyle_by_contents;
local @autostyle_by_name = @autostyle_by_name;
local @include = @include;
local @opt_I = @opt_I;
local( %debug, %trace ) = ( %debug, %trace );
local( $defines, %defines ) = ( $defines, %defines );
local( $max_macro_growth, $max_macro_expansions ) =
    ( $max_macro_growth, $max_macro_expansions );
local( $cache, $comment_level, $joiner, $printfer ) =
    ( $cache, $comment_level, $joiner, $printfer );

chdir $directory;
include $file;

=pod

The first plain text flushed out by C<web-iPerl> is preceded by the value
C<$header>, which has been set for you.  This means that if your document
starts with a bit of Perl, the variable contains the HTTP-header and may be
modified.  Or you can unset it and write the header right after the Perl
section - B<no newline> in between though!  Inversely you should not C<print>
any output before the header has been printed.  Processing occurs in the
directory where the file was found.

If you call any system-commands (beware of passing uncontrolled arguments from
the query!) you should first turn on autoflushing (C<$| = 1>) to ensure that
output order is preserved.


=head1 VARIABLES

=over

=item $header

Normally the empty string.  Is output and reset every time iPerl wants to
output a bit of plain text.


=item @type

Holds the list of arguments to CGI function header.  This can help you change
the header more easily, by adding you own options.

  $header = header @type, ...;

=back


=head1 INSTALLATION

The file-suffixes are freely electable as listed above.  For Apache these are
attributed to an internal MIME-type, which is then correlated to the
C<web-iPerl> interpreter by the action module, which must be installed in



( run in 3.263 seconds using v1.01-cache-2.11-cpan-71847e10f99 )