in reply to Re: Using Mechanize to download a zip file?
in thread Using Mechanize to download a zip file?

Maybe the module is broken :)? looks like a binmode is missing
=head2 $mech->save_content( $filename ) Dumps the contents of C<< $mech->content >> into I<$filename>. I<$filename> will be overwritten. =cut sub save_content { my $self = shift; my $filename = shift; open( my $fh, ">", $filename ) or $self->die( "Unable to create $f +ilename: $!" ); print $fh $self->content; close $fh; }

update: confirmed and reported

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^3: Using Mechanize to download a zip file?
by Scott7477 (Chaplain) on May 10, 2006 at 23:27 UTC
    The module might be still broken; when I attempt to use the $mech->save_content method in this code:

    use strict; use warnings; use LWP::UserAgent; use WWW::Mechanize; use Win32::FileOp; #use Win32::FileOp qw(ShellExecute); # ShellExecute("http://finance.yahoo.com"); my $mech = WWW::Mechanize->new(); $mech->get("http://finance.yahoo.com"); my $filename = 'c:yahoo.html'; $mech->save_content ( $filename );


    I get the following message:
    Can't locate object method "save_content" via package "WWW::Mechanize" at Yahoo. pl line 13, <DATA> line 164.
      The module might be still broken;
      Not in that regard.
      http://search.cpan.org/src/PETDANCE/WWW-Mechanize-1.18/Changes
      1.05_02 Sat Oct  2 16:55:59 CDT 2004
          [ENHANCEMENTS]
          * Added the $mech->save_content( $filename ) function, so you
                can dump stuff to files easily.

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.