--- trunk/lib/Frey/Designer.pm 2008/10/28 18:33:53 195 +++ trunk/lib/Frey/Designer.pm 2008/10/28 19:34:10 196 @@ -25,14 +25,21 @@ default => 1, ); +has 'resolve_links' => ( + is => 'rw', + isa => 'Bool', + default => 1, +); + #use String::TT qw/strip tt/; #use pQuery; use HTML::Query; use File::Slurp; -use LWP::Simple (); +use LWP::Simple qw/get/; use File::Path; use Data::Dump qw/dump/; +use HTML::ResolveLink; sub path { my $self = shift; @@ -45,6 +52,7 @@ my ( $self ) = @_; my $path = $self->path; + my $body; if ( ! -e $path && $self->mirror ) { @@ -55,11 +63,20 @@ my $url = $self->uri; warn ">> mirror $url -> $path\n"; - LWP::Simple::mirror( $url, $path ) or die "can't mirror $url: $!"; + $body = get( $url ) or die "can't mirror $url: $!"; + + if ( $self->resolve_links ) { + my $resolver = HTML::ResolveLink->new( base => $url ); + $body = $resolver->resolve( $body ); + } + + write_file( $path, $body ); warn "WW mirror $url -> $path ", -s $path, " bytes\n"; + + } else { + $body = read_file( $path ); } - my $body = read_file( $path ); warn "# $path ", -s $path, " == ", length($body), "bytes"; return $body; } @@ -108,7 +125,7 @@ 'body', ); # warn dump( $dom->as_HTML ); - $body = $dom->as_HTML->[0]; +# $body = $dom->as_HTML->[0]; warn "<< ", $self->uri, " ", -s $self->path,