Talroot has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to convert a small tool to use PerlEx (on IIS) for performance however it seems like there is no way to access the HTTP headers from the client request in this mode. When using the CGI mode in IIS with perl.exe I see them fine, but they vanish when using PerlEx30.dll. I'm testing using curl to send a custom header that I want to grab on the server side. Here is the output from a test script against both server side methods.
D:\>curl https://localhost/debug.pl -H "Token: 3cc8bbeb" -X POST -F Te +st=Test $VAR1 = 'HTTP_ACCEPT'; $VAR2 = 'HTTP_USER_AGENT'; $VAR3 = 'HTTP_HOST'; $VAR4 = 'HTTP_CONTENT_TYPE'; $VAR5 = 'HTTP_TOKEN'; $VAR6 = 'HTTP_CONTENT_LENGTH'; $VAR7 = 'HTTP_EXPECT'; D:\>curl https://localhost/debug.plex -H "Token: 3cc8bbeb" -X POST -F +Test=Test $VAR1 = 'HTTP_USER_AGENT';
The simple script on the server side is the same in both files:
use CGI qw(:standard); use Data::Dumper; my $session = CGI->new(); print "HTTP/1.1 200 OK\n\n"; print Dumper($session->http());

Replies are listed 'Best First'.
Re: PerlEx and HTTP request headers
by marto (Cardinal) on Jan 15, 2020 at 07:46 UTC

    The last time I looked perlex had been discontinued years ago. If you are trying to write code that performs well don't use CGI (because reasons).

      How about some example code, from Perl's most popular distribution?
      #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Mojolicious::Lite; get '/' => sub { my $q = shift; $q->render( text => Dumper($q->req->headers), format => 'plain' ); }; app->start;

        Interesting stat, thanks.

Re: PerlEx and HTTP request headers (ActiveState ActivePerl discontinued)
by Anonymous Monk on Jan 15, 2020 at 06:18 UTC

    I'm trying to convert a small tool to use PerlEx (on IIS) for performance...

    Hi

    Which ActiveState ActivePerl are you trying to use? Where did you get PerlEx?

    ActivePerl-5.28.1 doesn't come with PerlEx

    I don't think PerlEx has been supported for a while, I think it has been discontinued

Re: PerlEx and HTTP request headers
by Anonymous Monk on Jan 15, 2020 at 08:11 UTC
    If you're gonna use CGI, it has a header method:
    use CGI qw(:standard); use Data::Dumper; my $session = CGI->new(); print $session->header('text/plain'); print Dumper($session->http());
      You forgot to remove qw(:standard); poser
      A reply falls below the community's threshold of quality. You may see it by logging in.