Search code examples
perlhttpcpan

Perl CPAN: module for network-connectivity


I need to check the network-availability of some webservers (HTTP/HTTPS). For that I just need ip/dns and port. But I have a list of URLs. And I would like to use a CPAN-module for that job.

But: - HTTP::Tiny, LWP::UserAgent, ... checks the HTTP-stats, not the network-status. I need to check the 2nd (connection established) and I dont care about the HTTP-header and content.

  • A simple socket does not support URL-format for defining the destination. It needs ip and port.

So any ideas if a HTTP-module also provides a network-status??

Thanks!


Solution

  • You can parse URLs to obtain the host and port using URI module.

    Creating a connection can be done using the functions provided by Socket, or using the higher-level class IO::Socket::IP.