Closed VVelox closed 1 year ago
Hello @VVelox ,
Is there any particular reason why you used the Gzip::Faster perl plugin as opposed to the PerlIO::gzip perl plugin? FWIW I'm not familiar with either, so it may be that the latter isn't a drop-in replacement anyway.
I ask because RPM-based distros appear to lack broad package support for Gzip::Faster while supporting PerlIO::gzip across a wider spectrum of distros. I'd personally rather install the modules via yum/dnf instead of cpan.
Hello @VVelox ,
Is there any particular reason why you used the Gzip::Faster perl plugin as opposed to the PerlIO::gzip perl plugin? FWIW I'm not familiar with either, so it may be that the latter isn't a drop-in replacement anyway.
I ask because RPM-based distros appear to lack broad package support for Gzip::Faster while supporting PerlIO::gzip across a wider spectrum of distros. I'd personally rather install the modules via yum/dnf instead of cpan.
Because PerlIO is designed around file IO and not string handling.
Yeah, this is one area where how terrible RPM and DPKG based systems really are. They are a major PITA to add any new packages for given how antiquated the build system is.
Yeah, if you have a suggestion on one that handles strings in a similar manner and is available on the various BSDs and Linux distros, let me know. :)
I do know Gzip::Faster is available for FreeBSD via p5-Gzip-Faster and will build nicely on every Linux distro I've used it on.
Hi @VVelox ,
I'm no perl-whiz, but according to our good friends at Stack Overflow, the same can be accomplished with IO::Compress::Gzip using references to scalars instead of files (\$
). I tried it out on my end and it appears to work:
$ sudo diff smart /etc/snmp/smart2
78c78
< use Gzip::Faster;
---
> use IO::Compress::Gzip qw(gzip $GzipError);
523c523,525
< my $compressed = encode_base64( gzip($toReturn) );
---
> my $toReturnCompressed;
> gzip \$toReturn => \$toReturnCompressed;
> my $compressed = encode_base64( $toReturnCompressed );
edit: IO::Compress::Gzip is provided by the perl-IO-Compress common package: https://pkgs.org/download/perl-IO-Compress
IO::Compress::Gzip
Thanks! Used in https://github.com/librenms/librenms-agent/pull/476 .
Now also grabs....