Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: IO::Compress::Gzip blank output

by Burak (Chaplain)
on Sep 07, 2009 at 00:27 UTC ( [id://793857]=note: print w/replies, xml ) Need Help??


in reply to IO::Compress::Gzip blank output

The docs clearly state that parameters can not be bare scalars (unless they are file paths, which is not the case for you). Try this:
use IO::Compress::Gzip qw(gzip $GzipError) # other code... IO::Compress::Gzip::gzip(\$content, \$newContent) or die "gzip failed: + $GzipError\n"
Also, you're doing the file slurp in a wrong and slow way:
my @transferFileContents = <FILE_TO_TRANSFER>; foreach(@transferFileContents) { $content .= $_; }
It is possible to write this as:
$content = do { local $/; my $rv = <FILE_TO_TRANSFER>; $rv };
which means:
$content = do { # minimize scope local $/; # make input separator undef 'till the end of this scope my $rv = <FILE_TO_TRANSFER>; # get all contents $rv # return it };

Replies are listed 'Best First'.
Re^2: IO::Compress::Gzip blank output
by shug94 (Sexton) on Sep 07, 2009 at 01:51 UTC
    Thankyou very much!

    I will try using references instead. I have only been using Perl for three weeks, and I am getting the hang, but some things are still not clear.

    Thanks for helping out.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-03-28 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found