Hi Guys,

I am writing a Perl script that needs to initiate various http (or https) requests. Before doing so, I would like first to verify that a given string is indeed a valid URL address. I would like to do so (preferably) without using regexp.
Reason being, that URLs can be quite complex, and I'd prefer using a generic perl method (like a module). That way I am waaay more probable not to have missed any end-cases. Also, it would increase code-readability.

Thanks a bunch,

4 Years
Discussion Span
Last Post by FelineHazard
Featured Replies
  • 1

    Hi FelineHazard: The following modules from [CPAN](http://www.cpan.org) could be of help: [URI](http://search.cpan.org/~gaas/URI-1.60/URI.pm) with [URI::Escape](http://search.cpan.org/~gaas/URI-1.60/URI/Escape.pm). Or [Data::Validate::URI](http://search.cpan.org/~sonnen/Data-Validate-URI/lib/Data/Validate/URI.pm) However, I could only have one question; why validate if the URL doesn't exists? Hope this helps. Enjoy. Read More


Thanks that's exactly what I needed.
The URL might be online only sometimes. So first I check that the URL is valid, then that it is accisible, and depending on the result the answer would be logged and handled.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.