Using system() like an http "get"

Discussion in 'Perl Misc' started by Bill H, Oct 11, 2007.

  1. Bill H

    Bill H Guest

    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: etc

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


    Bill H, Oct 11, 2007
    1. Advertisements

  2. Bill H

    Paul Lalli Guest

    No. system() executes a program specified on the command line.
    Unless "" 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("

    Paul Lalli
    Paul Lalli, Oct 11, 2007
    1. Advertisements

  3. I'm afraid Hotspur and Glendower got to this one first.
    What's the shell produced by system() going to think when it sees "&",
    and does "" match anything in the PATH ?
    all mail refused, Oct 11, 2007
  4. Bill H

    Bill H Guest

    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
    Bill H, Oct 11, 2007
  5. Bill H

    Doug Miller Guest

    ... 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/

    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.
    Doug Miller, Oct 11, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.