CGI-Compile

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      $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 ($@) {

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.578 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )