passing command-line arguments to script ! 
Author Message
 passing command-line arguments to script !

Help help help,

I need to run a several scripts from within a script to carpture the
ouput and display it on screen.

when i run it like this

$test = 'perl  \\query\\query1.cgi';
$uitkomst = `$test "FileNaam=test.txt"`;

the FileNaam parameter is not filled.
When i try to do it the correct way :

$uitkomst=system("perl","\\query\\query1.cgi","FileNaam=test.txt);

also FileNaam is not filled.
Please help me.
It's working fine at the dos prompt and via a browser.

Any suggestions are welcome !



Fri, 18 Jan 2002 03:00:00 GMT  
 passing command-line arguments to script !
Hi Paul,

Quote:

> $test = 'perl  \\query\\query1.cgi';

you probably should use single backslashes here.

Quote:
> $uitkomst = `$test "FileNaam=test.txt"`;

> the FileNaam parameter is not filled.

Are you sure?

Quote:
> When i try to do it the correct way :
> $uitkomst=system("perl","\\query\\query1.cgi","FileNaam=test.txt);

Try using full path to the perl interpreter.

Regards
Alex

--
Ich studiere  Elektrotechnik (Technische  Informatik) an der RWTH Aachen
und bin ein guter Perl-Programmierer (arbeite seit 4 Jahren als Intranet-
Entwickler). Kann auch C, Java, SQL, JavaScript und HTML, CGI und TCP/IP.
Ich suche eine gut bezahlte  Diplomstelle in Aachen, Koeln oder Umgebung.



Fri, 18 Jan 2002 03:00:00 GMT  
 passing command-line arguments to script !
On Mon, 02 Aug 1999 15:12:10 +0200, Alex Farber

Quote:

>Hi Paul,


>> $test = 'perl  \\query\\query1.cgi';

>you probably should use single backslashes here.

>> $uitkomst = `$test "FileNaam=test.txt"`;

>> the FileNaam parameter is not filled.

>Are you sure?

>> When i try to do it the correct way :
>> $uitkomst=system("perl","\\query\\query1.cgi","FileNaam=test.txt);

>Try using full path to the perl interpreter.

Yep i'm sure. Note that i'm using Active Perl on WinNT.
The script query1.cgi is testing on the variable FileNaam. When it
isn't filled the script will generate an error ! So i'm sure that the
variable is not filled.


Fri, 18 Jan 2002 03:00:00 GMT  
 passing command-line arguments to script !

Quote:
>On Mon, 02 Aug 1999 15:12:10 +0200, Alex Farber

>>Hi Paul,


>>> $test = 'perl  \\query\\query1.cgi';

>>you probably should use single backslashes here.

>>> $uitkomst = `$test "FileNaam=test.txt"`;

>>> the FileNaam parameter is not filled.

>>Are you sure?

>>> When i try to do it the correct way :
>>> $uitkomst=system("perl","\\query\\query1.cgi","FileNaam=test.txt);

>>Try using full path to the perl interpreter.

>Yep i'm sure. Note that i'm using Active Perl on WinNT.
>The script query1.cgi is testing on the variable FileNaam. When it
>isn't filled the script will generate an error ! So i'm sure that the
>variable is not filled.

Apparently you mean you don't find the perl variable $FileNaam set
to 'text.txt'.  Well, why should it?  This isn't the way parameters
are handed down to a perl script.  What you *will* find is that
$ARGV[ 0] is set to 'FileNaam=test.txt'.  There are many ways to
retrieve the filename from that.  Here is one:

my $FileNaam = (split '=', $ARGV[ 0])[ 1];

Of course, this is not particularly robust.  The traditional way
is just to give the filename on the command line like

query1.cgi test.txt

This way you'd get the filename via

$FileNaam = $ARGV[ 0]

but you'd probably not even need to do that.  Just read from
the filehandle ARGV, it will be opened to your file.

Anno

Anno



Fri, 18 Jan 2002 03:00:00 GMT  
 passing command-line arguments to script !

Quote:


>>On Mon, 02 Aug 1999 15:12:10 +0200, Alex Farber

>>>Hi Paul,


>>>> $test = 'perl  \\query\\query1.cgi';

>>>you probably should use single backslashes here.

>>>> $uitkomst = `$test "FileNaam=test.txt"`;

>>>> the FileNaam parameter is not filled.

>>>Are you sure?

>>>> When i try to do it the correct way :
>>>> $uitkomst=system("perl","\\query\\query1.cgi","FileNaam=test.txt);

>>>Try using full path to the perl interpreter.

>$FileNaam = $ARGV[ 0]

>but you'd probably not even need to do that.  Just read from
>the filehandle ARGV, it will be opened to your file.

>Anno

>Anno

Excuses, i will resolve the variable $FileNaam in query1.cgi as
follows:

use CGI;
$FileNaam = param('FileNaam');
if (!$FileNaam)
{
        print "Not Filled";

- Show quoted text -

Quote:
}



Fri, 18 Jan 2002 03:00:00 GMT  
 passing command-line arguments to script !

<URL::">
|| Help help help,
||
|| I need to run a several scripts from within a script to carpture the
|| ouput and display it on screen.
||
|| when i run it like this
||
|| $test = 'perl  \\query\\query1.cgi';
                  ^^     ^^  Are you sure?
|| $uitkomst = `$test "FileNaam=test.txt"`;
||
|| the FileNaam parameter is not filled.
|| When i try to do it the correct way :
||
|| $uitkomst=system("perl","\\query\\query1.cgi","FileNaam=test.txt);
||
|| also FileNaam is not filled.

What do you mean by 'FileNaam is not filled'?

Are you sure this is a Perl question, and not a DOS one?

Abigail
--
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'

  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----



Fri, 18 Jan 2002 03:00:00 GMT  
 passing command-line arguments to script !

Quote:


>>$FileNaam = $ARGV[ 0]

>>but you'd probably not even need to do that.  Just read from
>>the filehandle ARGV, it will be opened to your file.

>>Anno

>Excuses, i will resolve the variable $FileNaam in query1.cgi as
>follows:

>use CGI;
>$FileNaam = param('FileNaam');
>if (!$FileNaam)
>{
>    print "Not Filled";
>}

Oh, you're using CGI.  You should have said so.  This may change
everything, or nothing, I don't know.

Anno



Fri, 18 Jan 2002 03:00:00 GMT  
 passing command-line arguments to script !

<URL::">
~~
~~ >>>> When i try to do it the correct way :
~~ >>>> $uitkomst=system("perl","\\query\\query1.cgi","FileNaam=test.txt);
~~
~~ Excuses, i will resolve the variable $FileNaam in query1.cgi as
~~ follows:
~~
~~ use CGI;
~~ $FileNaam = param('FileNaam');
~~ if (!$FileNaam)
~~ {
~~      print "Not Filled";
~~ }

Well, did you read the manpage of CGI.pm to see where it gets its
parameters from?

Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
^V
%$^U;$^V/=$^U}while$^V!=$^W'

  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----



Fri, 18 Jan 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Passing command line arguments to script

2. Passing form values back to a script as command line arguments

3. passing arguments on the command line to the script

4. Help passing argument to the command line

5. command line argument passing?

6. running perl at command line with arguments: script.cgi?text=text

7. Piping to script w/ command line arguments

8. running perl at command line with arguments: script.cgi?text=text

9. Getting command line arguments from cgi script (@ARGV)

10. too many filenames to pass on a command line to a perl script

11. Passing Args to script via web and command line

12. passing argument to system command

 

 
Powered by phpBB® Forum Software