akwe-xavante has asked for the wisdom of the Perl Monks concerning the following question:

Hoping for a little help

I know what i'm wanting to achieve but don't know what the right questions are to find an answer to my problem

I have a perl script that calls another perl script successfully

system('perl calendar.cgi');

I'm wanting the script "calendar.cgi" to access a matrixarray for a specific year, 2019 for example or 2020

I can do this by placing an exec link in html

<!--#include virtual="/cgi-bin/calendar.cgi?year_required=2019"-->

This works a treat

Is it possible to achieve the same thing when calling this perl script from within a perl script?

So that it prints data to the browsers screen relevent for the year asked for

Forgive my simplistic explanation...... i'm wanting to export the value of year_required to another script and import it into the second script so that the script knows which matrix array "year" is needed to be printed to screen

Replies are listed 'Best First'.
Re: Script to Script
by holli (Abbot) on Jul 22, 2019 at 17:00 UTC
Re: Script to Script
by harangzsolt33 (Deacon) on Jul 22, 2019 at 21:08 UTC
    When arguments are passed to a cgi script following the "?" mark in the URL, then whatever follows the "?" mark is copied into an environment variable named "QUERY_STRING." I think, if your perl script creates an environment variable named QUERY_STRING and then pass the arguments thru that, then run the perl script, it will work. But I haven't tested it. I just think, it would work, because it makes sense. Lol

      perlsec Untaint incoming data from params hashes

      It does work.
      $ENV{QUERY_STRING} = 'year_required=2019'; system 'perl', 'calendar.cgi';
      Lol, You shouldn't talk about things you don't know about.