in reply to Running Perl program using backquotes

<RANT> cgi isnt de facto perl and vice versa... I doubt your CGI script generates proper HTTP headers, and if it does... WHY??</RANT>

If you want to call CGI scripts from other CGI scripts, use LWP

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.
  • Comment on Re: Running Perl program using backquotes

Replies are listed 'Best First'.
Re: Re: Running Perl program using backquotes
by nysus (Parson) on Apr 18, 2001 at 14:11 UTC
    Maybe I will when I figure out how the LWP module works. Being new to this, I'm not so interested in the best or most correct solution as I am in getting the damn thing to work in the first place. :-)

    But thanks for the advice.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar;
    $nysus = $PM . $MCF;

      For plain GET calls, you can use LWP::Simple (if you dont need any specific referer, or cookie stuff)
      #!/usr/bin/perl -w use strict; use LWP::Simple; my $result = get(http://www.perlmonks.com/index.pl?node_id=131");
      With POST you'll need
      #!/usr/bin/perl -w use strict; use LWP::UserAgent; use URI::URL; my $WWWAgent = new LWP::UserAgent(); my $url=new URI::URL 'http://www.perlmonks.org/index.pl'; $url->query_form(node_id => "131"); my $WWWRequest = new HTTP::Request 'POST', $url->as_string() ; my $WWWResult = $WWWAgent->request($WWWRequest); die "Error logging in $WWWResult->code $WWWResult->message" if(!$WWWRe +sult->is_success); print $WWWResult->content;
      Greetz
      Beatnik
      ... Quidquid perl dictum sit, altum viditur.