in reply to Simple WebServer Scanner

Your perl4-style code ignores the advances made in Perl in the past 8 years. Socket code without "use IO::Socket", and HTTP code without touching the LWP library. Feh!
use LWP; use HTTP::Request::Common; my $response = LWP::UserAgent->new-> simple_request(HEAD "http://perltraining.stonehenge.com"); unless ($response->is_error) { print "server: ", $response->server, "\n"; } else { print "error: ", $response->status_line, "\n"; }

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Simple WebServer Scanner
by davorg (Chancellor) on Sep 21, 2001 at 19:53 UTC

    You're right about LWP of course and your version is much nicer, but the original script does "use Socket".

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you don't talk about Perl club."

Re: Re: Simple WebServer Scanner
by stefp (Vicar) on Sep 21, 2001 at 19:22 UTC
    I am not advocating writing perl4 code but not all programmers have the right of installing new modules on a given site. I don't know for this particular monk though.

    -- stefp

      I already covered this in "No excuses about not using CGI.pm".

      And hosting solutions are a dime-a-dozen these days. Not having basic tools like IO::Socket (which is part of the core distribution) or LWP available to you means you are burning a lot of time needlessly. Move to a different server.

      -- Randal L. Schwartz, Perl hacker

A reply falls below the community's threshold of quality. You may see it by logging in.