curl-users
SV: Problem of executing Curl via Perl (web-based)
Date: Mon, 28 Nov 2005 11:09:18 +0100
-----Ursprungligt meddelande-----
Från: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] För Daniel Stenberg
Skickat: den 28 november 2005 08:12
Till: the curl tool
Ämne: Re: Problem of executing Curl via Perl (web-based)
On Mon, 28 Nov 2005, Chadwick Leung wrote:
> I cannot execute Curl by using Perl.
Then you do something wrong!
> I have written a web-form in Perl. The program read data from the web-form
> and format the data into a CURL string which is output to a file (SHELL
> script).
You mean you invoke this from a web server? Then I would say that the most
likely reason for this failure is a difference in evironment.
> I tried executing the SHELL file in Perl in the followings two ways but
none
> of it works: system ("sh shell.sh"); `sh shell.sh`;
When you execute a script from the command line you have to call perl and
tell it which file you want to run, like this:
# perl myscript.pl
If a perl script has a shebang line you execute it like this;
./shell.sh
Usually you name a perl script .pl instead of .sh. Post the code you have in
your script so we can see what you are trying to do.
> I did some troubleshooting with the following codes:
>
> @return = `curl http://www.somewhere.com`;
>
> foreach (@return) {
> print "$_<p>\n";
> }
>
> There is no return. So I think the problem is in Curl.
-
A failure does not produce anything on stdout so of course those command
lines show nothing if they have the same error your original program has.
Run 'strace curl' instead and store its output to see what causes it to
fail.
Or just use curl as you do but make very sure to store and show the text
that
appears on stderr.
Received on 2005-11-28