Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^10: saveResources_future and tab in WWW::Mechanize::Chrome

by Corion (Patriarch)
on May 14, 2020 at 10:03 UTC ( [id://11116779]=note: print w/replies, xml ) Need Help??


in reply to Re^9: saveResources_future and tab in WWW::Mechanize::Chrome
in thread saveResources_future and tab in WWW::Mechanize::Chrome

Not having example code makes it much harder to find out what parts of the code don't work in your opinion.

I've added a new test case and will release it soonish, but I don't know if it addresses your case.

  • Comment on Re^10: saveResources_future and tab in WWW::Mechanize::Chrome

Replies are listed 'Best First'.
Re^11: saveResources_future and tab in WWW::Mechanize::Chrome
by 1nelly1 (Sexton) on May 14, 2020 at 11:07 UTC

    Ok. Here is my code:

    use strict; use warnings; use Log::Log4perl qw(:easy); use WWW::Mechanize::Chrome; Log::Log4perl->easy_init($ERROR); my $mech = WWW::Mechanize::Chrome->new(); $mech->get('https://metacpan.org/'); my $file_map = $mech->saveResources_future( target_file => 'this_page.html', target_dir => 'this_page_files/', wanted => sub { $_[0]->{url} =~ m!^https?:!i }, )->get();

    The only thing that happens is that after loading of the page a folder 'this_page_files' is created. The file 'this_page.html' as well as the resources are not saved anywhere. I hope that information helps.
    Best regards
    1nelly1

      Yes, indeed that helps! Thank you very much!

      The code in 0.54 had the logic for the wanted subroutine partially wrong and it didn't properly pass the callback on to where it actually matters.

      I've released version 0.55, which downloads several files in your test case, and puts them all below the this_page_files/ directory, except for the main page.

        Wonderful! This works great. Thank you very much again for your time, work and support. And the wanted-feature is very help- and useful.
        Now I know that you like to have code ;) Next time I will try to express myself right away with some code.
        Best regards
        1nelly1

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11116779]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found