Hi, I'm having problems getting a simple perl program to work (a learning curve for me)

I am on a Linux host and if I do this

wget 'https://mytarget.com:9999/Mode/schedule/Host/myhost?User=myuser&Token=XXXXX-AXXX-4812-B123-XXXXXXXXC&type=xml'

I get

--2019-09-18 13:07:18-- 'https://mytarget.com:9999/Mode/schedule/Host/ +myhost?User=myuser&Token=XXXXX-AXXX-4812-B123-XXXXXXXXC&type=xml Resolving mytarget.com... xxx.xxx.xxx.xxx Connecting to mytarget.com|xxx.xxx.xxx.xxx|:9999... connected. HTTP request sent, awaiting response... 200 OK Length: 371 [application/xml] Saving to: .....

I am trying to convert this to perl so I am using this code

use strict; use warnings; use Data::Dumper; use feature 'say'; use HTTP::Tiny; my $Client = HTTP::Tiny->new(); my @urls = ( 'https://mytarget.com:9999/Mode/schedule/Host/myhost?User=myuser&T +oken=XXXXX-AXXX-4812-B123-XXXXXXXXC&type=xml', 'https://notarealsite.com:9999', ); for my $url (@urls) { my $response = $Client->get($url); say $url, ": ", $response->{status}; }

But when I run it I get

https://mytarget.com:9999/Mode/schedule/Host/myhost?User=myuser&Token= +XXXXX-AXXX-4812-B123-XXXXXXXXC&type=xml: 599 https://notarealsite.com:9999: 599

My understanding is that this means it's not able to contact the target

It's undoubtedly something simple I have missed but what am I doing wrong ?


In reply to url issues using HTTP::Tiny by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.