Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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();

I noticed that you changed the reference of $file_map now refering to a hash containing uri as key and file as value. In my last posting I wanted to inform you that there is only one value in that hash which is the url of the current fetched webpage. I also wanted to inform you that there is no saving of files at all.
This seems to be like that because the printing in this code of saveResources_future is never executed:
$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 );

So for me as is the method does not work as intended. Kindly recheck by yourself.
Thank you and best regards
1nelly1


In reply to Re^9: saveResources_future and tab in WWW::Mechanize::Chrome by 1nelly1
in thread saveResources_future and tab in WWW::Mechanize::Chrome by 1nelly1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-25 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found