Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot, bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon

Links

XODOX
Impressum

#1: Using system() like an http "get"

Posted on 2007-10-11 19:02:12 by Bill H

I have a number of pages on a website that run perl scripts to create
different content. They are all basically accessed with an HREF such
as:

scriptname.pl?param1=1&param2=2 etc

The question I have is, an I use the same syntax in a system call from
another perl program, ie:

system("scriptname.pl?param1=1&param2=2");

Bill

Report this message

#2: Re: Using system() like an http "get"

Posted on 2007-10-11 19:06:06 by Paul Lalli

On Oct 11, 1:02 pm, Bill H <b...@ts1000.us> wrote:
> I have a number of pages on a website that run perl scripts to
> create different content. They are all basically accessed with
> an HREF such as:
>
> scriptname.pl?param1=1&param2=2 etc
>
> The question I have is, an I use the same syntax in a system
> call from another perl program, ie:
>
> system("scriptname.pl?param1=1&param2=2");

No. system() executes a program specified on the command line.
Unless "scriptname.pl?param1=1&param2=2" is a valid command you could
type at your console window, you can't use system() for it.

You want LWP::Simple, and it's "get" method:

use LWP::Simple;
my $content = get("http://www.example.com/scriptname.pl?
param1=1&param2=2");

Paul Lalli

Report this message

#3: Re: Using system() like an http "get"

Posted on 2007-10-11 19:15:41 by unknown

Post removed (X-No-Archive: yes)

Report this message

#4: Re: Using system() like an http "get"

Posted on 2007-10-11 19:19:54 by Bill H

On Oct 11, 1:06 pm, Paul Lalli <mri...@gmail.com> wrote:
> On Oct 11, 1:02 pm, Bill H <b...@ts1000.us> wrote:
>
> > I have a number of pages on a website that run perl scripts to
> > create different content. They are all basically accessed with
> > an HREF such as:
>
> > scriptname.pl?param1=1&param2=2 etc
>
> > The question I have is, an I use the same syntax in a system
> > call from another perl program, ie:
>
> > system("scriptname.pl?param1=1&param2=2");
>
> No. system() executes a program specified on the command line.
> Unless "scriptname.pl?param1=1&param2=2" is a valid command you could
> type at your console window, you can't use system() for it.
>
> You want LWP::Simple, and it's "get" method:
>
> use LWP::Simple;
> my $content = get("http://www.example.com/scriptname.pl?
> param1=1&param2=2");
>
> Paul Lalli

Thats what I realized after I posted the message. But thinking about
it, since the script I want to call is on the same server and in the
same directory I should be able to modify the ENV{'QUERY_STRING'} to
contain the new data then if I use system on the other script it
"should" work the same as if I called it from an HREF, or am I really
missing something here?

Bill H

Report this message

#5: Re: Using system() like an http "get"

Posted on 2007-10-11 19:37:13 by spambait

In article <1192122132.151687.76860@g4g2000hsf.googlegroups.com>, Bill H <bill@ts1000.us> wrote:
>I have a number of pages on a website that run perl scripts to create
>different content. They are all basically accessed with an HREF such
>as:
>
>scriptname.pl?param1=1&param2=2 etc
>
>The question I have is, an I use the same syntax in a system call from
>another perl program, ie:

Probably...
>
>system("scriptname.pl?param1=1&param2=2");

... but not like that. On my web server (Sun Solaris), this works at the
command line:

env -i QUERY_STRING="param1=1&param2=2" /path/scriptname.pl

and presumably would work in a system() call as well, although I have not
tested it. Similar behavior would be expected under other flavors of Unix.

--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.

Report this message

#6: Re: Using system() like an http "get"

Posted on 2007-10-11 21:00:41 by Glenn Jackman

At 2007-10-11 01:02PM, "Bill H" wrote:
> I have a number of pages on a website that run perl scripts to create
> different content. They are all basically accessed with an HREF such
> as:
>
> scriptname.pl?param1=1&param2=2 etc
>
> The question I have is, an I use the same syntax in a system call from
> another perl program, ie:
>
> system("scriptname.pl?param1=1&param2=2");

If your scripts use CGI, you might be able to get away with this:

system("scriptname.pl param1=1 param2=2");

See http://perldoc.perl.org/CGI.html#DEBUGGING

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

Report this message