lib_url.pl to HTML.

index -|- end

Generated: Sat Oct 12 17:23:08 2013 from lib_url.pl 2013/01/18 686. text copy

#!/bin/perl
# lib_url.pl
# AIM: Load a URL file into a line array, return line count
use strict;
use warnings;
use LWP::Simple;

## my $url = "http://static.fgx.ch/js/OpenLayers-2.12/theme/default/style.css";
## sub prt($) { print shift; }

sub fetch_url($$$) {
   my ($url,$ra,$dbg) = @_;
    my $ret = 0;
   prt( "Fetching: $url\n" ) if ($dbg & 0x01);
   my $txt = get($url);
   if ($txt && length($txt)) {
      # prt( "$txt\n" );
        @{$ra} = split("\n",$txt);
        $ret = scalar @{$ra};
    } else {
        prt("URL: $url FAILED!\n");
    }
    return $ret;
}

## my @arr = ();
## my $cnt = fetch_url($url,\@arr);
# prt("Got $cnt lines...\n");

1;
# eof

index -|- top

checked by tidy  Valid HTML 4.01 Transitional