CURL problem and System call in Paralles PBA

P

pakalk

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 :p and I do not want to learn it a lot - I
just need it to a job ;/


Thank You :)
 
M

Michael Vilain

pakalk said:
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 :p 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.
 
A

A. Sinan Unur

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 :p 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 <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
 
P

pakalk

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?
 
T

Tad J McClellan

pakalk said:
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 :p 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.
 
J

Jürgen Exner

pakalk said:
#!/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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top