in reply to cgi page calling another cgi when submitting form but does not returns error only to web server log and not to browser.

Don't "call" other cgi's from a cgi ... whatever you mean by "call"

using system or exec to call other cgis is a fudgy idea,

fudgy , unless you're clever enough to write your cgis to take @ARGs, but then if you did that you wouldn't call them cgis :) and you'd be clever enough to use Capture::Tiny to capture anything your cgi prints on STDERR or STDOUT

but if you wrote both programs, and the second is really just a part of the first, then yeah, it shouldn't exist, it should be part of your module ... yeah, your real cgi should be

#!/usr/bin/perl -- ... use MyModule; MyModuule::DoTheCgiDance();

If you still need the "other" then you can have that one too

#!/usr/bin/perl -- ... use MyModule; MyModuule::DoTheCgiDanceOTHER();

:)

  • Comment on Re: cgi page calling another cgi when submitting form but does not returns error only to web server log and not to browser.
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: cgi page calling another cgi when submitting form but does not returns error only to web server log and not to browser.
by chidori (Novice) on Jul 01, 2014 at 16:40 UTC

    If I have to pass the form data to this perl module , How should I be doing it.

    Should i pass the "param" from cgi to this module and split it using split function ?

        So for commandline version you might have
        ... use MyModuule; MyModuule::DoTheCLIDance( @ARGV ); exit( 0 );

        where

        sub MyModuule::DoTheCLIDance { my %args = GetOptMyArgsIWant(\@_); my $query = CGI->new( %args ); ## FORMDATA my( $headers, $body ) = DoTheDance( $query ); print $body; ## no headers on CLI :) }

        and the other cgi

        sub MyModuule::DoTheCgiDanceOTHER { my $query = CGI->new; my( $headers, $body ) = PutOnSomePants( $query ); print $headers, $body; } sub MyModuule::DoTheCLIDanceOTHER { ## no advanced getopt stuff ## just key value key value key value my $query = CGI->new( @_ ); my( $headers, $body ) = PutOnSomePants( $query ); print $body; }

        The idea is each .cgi or .pl, uses some modules and calls calls one subroutine to take care of everything