Acme-URL

 view release on metacpan or  search on metacpan

lib/Acme/URL.pm  view on Meta::CPAN

sub parser {
    my $self = shift;
    $self->init(@_);
    $self->skip_declarator;          # skip past "http"

    my $line = $self->get_linestr;   # get me current line of code
    my $pos  = $self->offset;        # position just after "http"
    my $url  = substr $line, $pos;   # url & everything after "http"

    for my $c (split //, $url) {
        # if blank, semicolon, closing parenthesis or a comma(!) then no longer a URL
        last if $c eq q{ };
        last if $c eq q{;};
        last if $c eq q{)};
        last if $c eq q{,};
        $pos++;
    }    

    # wrap the url with http() sub and quotes
    substr( $line, $pos,          0 ) = q{")};
    substr( $line, $self->offset, 0 ) = q{("http};



( run in 0.238 second using v1.01-cache-2.11-cpan-4d50c553e7e )