CGI-Compile
    
    
  
  
  
view release on metacpan or search on metacpan
      $cgi_script or $$code compiled to coderef.
SCRIPT ENVIRONMENT
 ARGUMENTS
    Things like the query string and form data should generally be in the
    appropriate environment variables that things like CGI expect.
    You can also pass arguments to the generated coderef, they will be
    locally aliased to @_ and @ARGV.
 BEGIN and END blocks
    BEGIN blocks are called once when the script is compiled. END blocks
    are called when the Perl interpreter is unloaded.
    This may cause surprising effects. Suppose, for instance, a script that
    runs in a forking web server and is loaded in the parent process. END
    blocks will be called once for each worker process and another time for
    the parent process while BEGIN blocks are called only by the parent
    
  
  
  lib/CGI/Compile.pm view on Meta::CPAN
        'local ($0, $CGI::Compile::_dir, *DATA);',
        '{ my ($data, $path, $dir) = @_[1..3];',
        ($path ? '$0 = $path;' : ''),
        ($dir  ? '$CGI::Compile::_dir = File::pushd::pushd $dir;' : ''),
        q{open DATA, '<', \$data;},
        '}',
        # NOTE: this is a workaround to fix a problem in Perl 5.10
        q(local @SIG{keys %SIG} = do { no warnings 'uninitialized'; @{[]} = values %SIG };),
        "local \$^W = $warnings;",
        'my $rv = eval {',
        'local @ARGV = @{ $_[4] };', # args to @ARGV
        'local @_    = @{ $_[4] };', # args to @_ as well
        ($path ? "\n#line 1 $path\n" : ''),
        $code,
        "\n};",
        q{
        {
            no warnings qw(uninitialized numeric pack);
            my $self     = shift;
            my $exit_val = unpack('C', pack('C', sprintf('%.0f', $rv)));
            if ($@) {
    
  
  
  lib/CGI/Compile.pm view on Meta::CPAN
=back
=head1 SCRIPT ENVIRONMENT
=head2 ARGUMENTS
Things like the query string and form data should generally be in the
appropriate environment variables that things like L<CGI> expect.
You can also pass arguments to the generated coderef, they will be
locally aliased to C<@_> and C<@ARGV>.
=head2 C<BEGIN> and C<END> blocks
C<BEGIN> blocks are called once when the script is compiled.
C<END> blocks are called when the Perl interpreter is unloaded.
This may cause surprising effects. Suppose, for instance, a script that runs
in a forking web server and is loaded in the parent process. C<END>
blocks will be called once for each worker process and another time
for the parent process while C<BEGIN> blocks are called only by the
    
  
  
  
( run in 0.389 second using v1.01-cache-2.11-cpan-a1d94b6210f )