Closed xrmb closed 11 years ago
Interesting, I've never experienced such an error, can you post your test script to let me debug it?
I traced it down, it is this line: my $file_data = slurp $file;
the slurp does not handle binary files correctly, replacing it with something like my $fh; open($fh, '<', $file); binmode($fh); my $file_data; read($fh, $file_data, -s $file); close($file);
makes it work... well, some error handling should be added or slurp fixed.
this script: use Net::Google::Drive::Simple;
use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($DEBUG);
my $gd = Net::Google::Drive::Simple->new(config_file => 'google-drive.yml'); my (undef, $r) = $gd->children('/'); $gd->file_upload('a.png', $r);
spits out this: 2013/03/15 08:34:53 Read (91)[.PNG.......IHDR...d...d...[snip=39].Q@O...x...b.t....IEND.B`.] from a.png
where a.png is (lets hope github imges dont get modified):
edit: looks like github keeps my original, it is 92 bytes
Nice find! Which OS are you running your application on, Windows by any chance?
Yes, Windows (unfortunately). Will have to use CPAN, which is a pain, to get any updates from you. ActiveState is really slow updating ppm. At least they have your modules :)
But besides this little issue and google drive api being slow and loves error 500, it runs very smooth and stable.
I've made the fix in the Sysadm::Install module that provides the slurp() function: http://perlmeister.com/tmp/sysadm-install-0.43.tgz Would you be able to download the tarball from there, install the module and let me know if it fixes the problem?
It works, tried with text and binary files of different sizes.
On Fri, 15 Mar 2013, xrmb wrote:
Yes, Windows (unfortunately). Will have to use CPAN, which is a pain, to get any updates from you. ActiveState is really slow updating ppm. At least they have your modules :)
Okay, Sysadm::Install 0.43 is on CPAN now, might be a while until Activestate picks it up, but feel free to download/install!
-- Mike
Mike Schilli m@perlmeister.com
I updated it via CPAN, worked fine. ActiveState is still at 0.40.
I wrote a little script that uploads 100 files 100 bytes in size. When I go to the google drive website many of them are only 99 bytes. I tried to debug the issue but could not find anything.