in reply to replace use HTTP::Lite to run a perl file that was on another server

Why not rewrite the script as a module ?

poj
  • Comment on Re: replace use HTTP::Lite to run a perl file that was on another server

Replies are listed 'Best First'.
Re^2: replace use HTTP::Lite to run a perl file that was on another server
by bNathan (Novice) on Feb 19, 2017 at 21:05 UTC
    Hello I need to run the copyorder_multiple.pl script from within another script to get the licesne data

      Hi

      This is what poj is talking about, three files, one module, and two cgi programs that use the module

      $ cat MyCopyOrder.pm package MyCopyOrder; sub cgi_run { my $q = CGI->new; my $refID = $q->param('refID'); my $data = MakeData( $refID ); print $q->header, $data; return; } sub MakeData { my( $id ) = @_; ... return $doc; } $ cat copyorders_multiple.pl #!/usr/bin/perl -- use strict; use warnings; use lib '/home/home/mylibs'; ## if needed use MyCopyOrder; MyCopyOrder::cgi_run( ); exit 0; $ cat used_to_call_copyorders_multiple.pl #!/usr/bin/perl -- use strict; use warnings; #~ use HTTP::Lite; #~ my $http = new HTTP::Lite; #~ my $req = $http->request("copyorders_multiple.pl?refID=".&trim($lic +ense)) or die "Unable to get document: $!"; #~ my $data = $http->body(); #~ if (length(&trim($data)) > 0) use lib '/home/home/mylibs'; ## if needed use MyCopyOrder; my $data = MyCopyOrder::MakeData( $license ); ...