CURL problem and System call in Paralles PBA

Discussion in 'Perl Misc' started by pakalk, Mar 27, 2009.

  1. pakalk

    pakalk Guest

    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 :)
     
    pakalk, Mar 27, 2009
    #1
    1. Advertising

  2. In article
    <>,
    pakalk <> 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 :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.

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...
    [I filter all Goggle Groups posts, so any reply may be automatically by ignored]
     
    Michael Vilain, Mar 27, 2009
    #2
    1. Advertising

  3. pakalk <> wrote in news:27461ebd-693e-40b9-b0af-
    :

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

    comp.lang.perl.misc guidelines on the WWW:
    http://www.rehabitation.com/clpmisc/
     
    A. Sinan Unur, Mar 27, 2009
    #3
  4. pakalk

    pakalk Guest

    On Mar 27, 4:20 am, Michael Vilain <> wrote:
    > In article
    > <>,
    >
    >
    >
    >
    >
    >  pakalk <> 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 :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.
    >


    Thanks for response. Could you give me a direct link to http module
    you are talking about?
     
    pakalk, Mar 27, 2009
    #4
  5. pakalk

    pakalk Guest

    pakalk, Mar 27, 2009
    #5
  6. pakalk <> 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 :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.


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad J McClellan, Mar 27, 2009
    #6
  7. pakalk <> 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
     
    Jürgen Exner, Mar 27, 2009
    #7
  8. Peter J. Holzer, Mar 28, 2009
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris

    cURL in ASP.NET

    Chris, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    8,183
    Joerg Jooss
    Dec 19, 2004
  2. ß Ø ® G

    Page Curl Javascript wtd

    ß Ø ® G, Jan 26, 2004, in forum: HTML
    Replies:
    10
    Views:
    6,764
    supermann
    Jun 7, 2007
  3. curl and popen2

    , Feb 2, 2005, in forum: Python
    Replies:
    1
    Views:
    590
    Robey Holderith
    Feb 2, 2005
  4. Chris Rebert

    Re: Curl and python httplib?

    Chris Rebert, Mar 29, 2013, in forum: Python
    Replies:
    0
    Views:
    124
    Chris Rebert
    Mar 29, 2013
  5. Mark Lawrence

    Re: Curl and python httplib?

    Mark Lawrence, Apr 1, 2013, in forum: Python
    Replies:
    2
    Views:
    119
    vasudevram
    Apr 1, 2013
Loading...

Share This Page