Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Script stopped working...

by NetWallah (Canon)
on Mar 18, 2018 at 04:01 UTC ( #1211173=note: print w/replies, xml ) Need Help??


in reply to Script stopped working...

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!

Replies are listed 'Best First'.
Re^2: Script stopped working...
by gentoobob (Novice) on Mar 18, 2018 at 17:23 UTC

    Thats interesting! I will definitely do that first thing Monday morning. I don't want to run bad code on a live environment. We are just trying to move this script over off a server going bad and the guy who made it, isn't with us anymore. Guess I might need to buy a Perl book too. haha. Thanks again!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1211173]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2020-12-05 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (63 votes). Check out past polls.

    Notices?