Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I'm surprised you got a response at all.

Your declaration of "my $url" is out-of-scope by the time you attempt to get $content:

while(1) { my $url="https://cucxnpub/vmrest/users?rowsPerPage=2000\&pageNumber= +$page"; $ua = LWP::UserAgent->new(ssl_opts => { SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE, verify_hostname => 0, }); #<<<< $url is OUT of scope $header = HTTP::Headers->new; $req = HTTP::Request->new(GET => $url); #IF you had "use strict", th +is would show an error.
Please do your self a favour and add this to the top of you script:
use strict; use warnings;
I also dont know why the "while (1)" is being used.
You should be setting the user agent up only one time, not in an indifinete loop.

I don't know how you are able to exit that loop.

If you are sure you have got past the URL issue, and are able to fetch $content, we can work on the remainder of the script, if you pshow us a sample of the $content.

Depending on what you are pulling data from, Cisco::IPPhone may be relevant.

Update:Thanks , gentoobob,syphillis and Marshall for pointing out that I mistook a mis-indentation for $url being out of scope. It is not.

                Python is a racist language what with it's dependence on white space!


In reply to Re: Script stopped working... by NetWallah
in thread Script stopped working... by gentoobob

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-20 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found