in reply to Re^8: saveResources_future and tab in WWW::Mechanize::Chrome
in thread saveResources_future and tab in WWW::Mechanize::Chrome
As I mentioned earlier I am just testing WWW::Mechanize::Chrome in order to use it instead of WWW::Mechanize::Firefox. In WWW::Mechanize::Firefox you implemented the save_url save_content methods and now I experiment with your saveResources_future method in WWW::Mechanize::Chrome. I do this by just using exactly the code of the documentation:
my $file_map = $mech->saveResources_future( target_file => 'this_page.html', target_dir => 'this_page_files/', wanted => sub { $_[0]->{url} =~ m!^https?:!i }, )->get();
$names{ $resource->{url} } ||= File::Spec->catfile( $target_dir, $name +s{ $resource->{url} }); my $target = $names{ $resource->{url} } or die "Don't have a filename for URL '$resource->{url}' ?!"; $s->log( 'debug', "Saving '$resource->{url}' to '$target'" ); open my $fh, '>', $target or croak "Couldn't save url '$resource->{url}' to $target: $!"; binmode $fh; print $fh $resource->{content}; CORE::close( $fh );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: saveResources_future and tab in WWW::Mechanize::Chrome
by Corion (Patriarch) on May 14, 2020 at 10:03 UTC | |
by 1nelly1 (Sexton) on May 14, 2020 at 11:07 UTC | |
by Corion (Patriarch) on May 14, 2020 at 15:24 UTC | |
by 1nelly1 (Sexton) on May 14, 2020 at 19:54 UTC |