mr_p has asked for the wisdom of the Perl Monks concerning the following question:
Hello Everyone,
I am running into this issue where Mojo::URL to_abs returns me with incorrect absolute path? Can someone help me with this.
Results are: http://www.mellanox.com/page/page/rss They should be: http://www.mellanox.com/page/rss
#!/usr/bin/perl use 5.010; use open qw( :std :utf8 ); use strict; use utf8; use warnings qw(all); use Data::Dumper; use Mojo::UserAgent; # FIFO queue my $linkUrl = "http://www.mellanox.com/page/press_releases"; my $ua = Mojo::UserAgent->new(max_redirects => 2)->detect_proxy; my $tx = $ua->get($linkUrl); for my $e ($tx->res->dom('a[href]')->each) { my $link = Mojo::URL->new($e->{href}); next if 'Mojo::URL' ne ref $link; $link = $link->to_abs($tx->req->url)->fragment(undef); next unless grep { $link->protocol eq $_ } qw(http https); if ($link->to_string =~ /rss/ ) { print $link->to_abs; print "\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Mojo::URL returns incorrect absolute path
by McA (Priest) on May 17, 2013 at 02:15 UTC | |
by mr_p (Scribe) on May 17, 2013 at 18:09 UTC | |
by mr_p (Scribe) on May 17, 2013 at 20:29 UTC | |
by Anonymous Monk on May 17, 2013 at 22:10 UTC | |
Re: Mojo::URL returns incorrect absolute path
by Anonymous Monk on May 16, 2013 at 17:18 UTC | |
by mr_p (Scribe) on May 16, 2013 at 17:45 UTC | |
by Anonymous Monk on May 17, 2013 at 03:40 UTC | |
by Anonymous Monk on May 17, 2013 at 04:21 UTC | |
by mr_p (Scribe) on May 17, 2013 at 14:36 UTC | |
|
Back to
Seekers of Perl Wisdom