Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > CURL problem and System call in Paralles PBA

Reply
Thread Tools

CURL problem and System call in Paralles PBA

 
 
pakalk
Guest
Posts: n/a
 
      03-27-2009
Hello,

I am newbie to perl, and I have a problem...

I do:

#!/usr/bin/perl

print system("curl https://www.example.com");

in test.pl and ALL is OK. I get what I want.

I do this same in Paralles PBA Plugin, and... I get "0" only.

Please, tell my WHY? Do you know why?

Or could U tell me what library use to CURL, and/or how to do a curl
call in the easiest way.

I know perl very very bad and I do not want to learn it a lot - I
just need it to a job ;/


Thank You
 
Reply With Quote
 
 
 
 
Michael Vilain
Guest
Posts: n/a
 
      03-27-2009
In article
<(E-Mail Removed)>,
pakalk <(E-Mail Removed)> wrote:

> Hello,
>
> I am newbie to perl, and I have a problem...
>
> I do:
>
> #!/usr/bin/perl
>
> print system("curl https://www.example.com");
>
> in test.pl and ALL is OK. I get what I want.
>
> I do this same in Paralles PBA Plugin, and... I get "0" only.
>
> Please, tell my WHY? Do you know why?
>
> Or could U tell me what library use to CURL, and/or how to do a curl
> call in the easiest way.
>
> I know perl very very bad and I do not want to learn it a lot - I
> just need it to a job ;/
>
>
> Thank You


What are you trying to do in curl that you can't do from within perl
itself? Perl has ftp and http CPAN modules. Install them and use them
natively rather than shelling out to curl.

--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically by ignored]


 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      03-27-2009
pakalk <(E-Mail Removed)> wrote in news:27461ebd-693e-40b9-b0af-
http://www.velocityreviews.com/forums/(E-Mail Removed):

> Hello,
>
> I am newbie to perl, and I have a problem...
>
> I do:
>
> #!/usr/bin/perl
>
> print system("curl https://www.example.com");
>
> in test.pl and ALL is OK. I get what I want.


If you read

perldoc -f system

you'll see that system does not return the output of the command
executed. So, what you are seeing printed as a result of invoking curl
is being printed directly by curl, not by the print statement.

The print statement adds a lone 0 to the end of the output generated by
curl because 0 is what system returns if the call succeeded.

> I do this same in Paralles PBA Plugin, and... I get "0" only.


I have no idea what Paralles PBA Plugin is ...

> Please, tell my WHY? Do you know why?


because 0 is what system returns if it succeeds.

> Or could U tell me what library use to CURL, and/or how to do a curl
> call in the easiest way.


You should read

perldoc -f system

The answer to your question is in those few paragraphs.

> I know perl very very bad and I do not want to learn it a lot - I
> just need it to a job ;/
>
>
> Thank You


You seem to be asking someone else to do the job for which you are going
to get paid.

Sinan

--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
 
Reply With Quote
 
pakalk
Guest
Posts: n/a
 
      03-27-2009
On Mar 27, 4:20*am, Michael Vilain <(E-Mail Removed)> wrote:
> In article
> <(E-Mail Removed)>,
>
>
>
>
>
> *pakalk <(E-Mail Removed)> wrote:
> > Hello,

>
> > I am newbie to perl, and I have a problem...

>
> > I do:

>
> > #!/usr/bin/perl

>
> > print system("curlhttps://www.example.com");

>
> > in test.pl and ALL is OK. I get what I want.

>
> > I do this same in Paralles PBA Plugin, and... I get "0" only.

>
> > Please, tell my WHY? Do you know why?

>
> > Or could U tell me what library use to CURL, and/or how to do a curl
> > call in the easiest way.

>
> > I know perl very very bad and I do not want to learn it a lot - I
> > just need it to a job ;/

>
> > Thank You

>
> What are you trying to do in curl that you can't do from within perl
> itself? *Perl has ftp and http CPAN modules. *Install them and use them
> natively rather than shelling out to curl.
>


Thanks for response. Could you give me a direct link to http module
you are talking about?
 
Reply With Quote
 
pakalk
Guest
Posts: n/a
 
      03-27-2009
I mean... is http://search.cpan.org/~gaas/libwww-...825/lib/LWP.pm
ok?
 
Reply With Quote
 
Tad J McClellan
Guest
Posts: n/a
 
      03-27-2009
pakalk <(E-Mail Removed)> wrote:

> I am newbie to perl, and I have a problem...



You would have less of a problem if you read the documentation
for the two functions you are calling.


> print system("curl https://www.example.com");
>
> in test.pl and ALL is OK. I get what I want.



You want a failed connection?

That seems a strange thing to want...


> I do this same in Paralles PBA Plugin, and... I get "0" only.



What is "Paralles PBA Plugin"?

You got the zero in "what I want" too. Perhaps you just didn't notice it.

(assuming you are using the http protocol rather than https as above.)


> Please, tell my WHY?



Please read for yourself, we are not a "read the docs to me" service.

perldoc -f system

The return value is the exit status of the program...


> Do you know why?



Yes. Because that was the exit status of the curl program.


> how to do a curl
> call in the easiest way.



The easiest way it to type

curl http://www.example.com

at a command line.


> I know perl very very bad and I do not want to learn it a lot -



I am not like you guys, and I don't want to be like you guys...


> I
> just need it to a job ;/



... but I want you to do this for me anyway.


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
 
Reply With Quote
 
Jrgen Exner
Guest
Posts: n/a
 
      03-27-2009
pakalk <(E-Mail Removed)> wrote:
>#!/usr/bin/perl
>print system("curl https://www.example.com");


This doesn't make much sense. Why do you want to print the exit status
of the program (except maybe for debugging)?

>in test.pl and ALL is OK. I get what I want.


Ok, what DO you want?

>I do this same in Paralles PBA Plugin, and... I get "0" only.
>Please, tell my WHY? Do you know why?


That is the typical, normal return value, if the command executed
successfully (no error code) and returned a value of 0 (which typically
means no error, too).

jue
 
Reply With Quote
 
Peter J. Holzer
Guest
Posts: n/a
 
      03-28-2009
On 2009-03-27 11:30, pakalk <(E-Mail Removed)> wrote:
> I mean... is http://search.cpan.org/~gaas/libwww-...825/lib/LWP.pm
> ok?


Yes.

hp
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Curl and python httplib? Mark Lawrence Python 2 04-01-2013 10:07 PM
Re: Curl and python httplib? Chris Rebert Python 0 03-29-2013 04:58 AM
Page Curl Javascript wtd G HTML 10 06-07-2007 09:34 PM
curl and popen2 lists04@gmail.com Python 1 02-02-2005 05:57 AM
cURL in ASP.NET Chris ASP .Net 1 12-19-2004 04:59 PM



Advertisments