Commit bfa7bf91 authored by root's avatar root

major update

parent d23e8d47
This diff is collapsed.
Imager::File::PNG 0.99|--configure-args="--libpath=/opt/thirdlane/perl_lib/local/usr/lib --incpath=/opt/thirdlane/perl_lib/local/usr/include"
#!/usr/bin/perl #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict; use strict;
use Module::Build 0.25; use Module::Build 0.25;
use Getopt::Long; use Getopt::Long;
......
#!/usr/bin/perl #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
# Time-stamp: "2000-10-02 14:48:15 MDT" # Time-stamp: "2000-10-02 14:48:15 MDT"
# #
# Parse the given HTML file(s) and dump the parse tree # Parse the given HTML file(s) and dump the parse tree
......
...@@ -38,11 +38,11 @@ ExtUtils::Install - install files from here to there ...@@ -38,11 +38,11 @@ ExtUtils::Install - install files from here to there
=head1 VERSION =head1 VERSION
2.06 2.04
=cut =cut
$VERSION = '2.06'; # <-- do not forget to update the POD section just above this line! $VERSION = '2.04'; # <-- do not forget to update the POD section just above this line!
$VERSION = eval $VERSION; $VERSION = eval $VERSION;
=pod =pod
...@@ -101,6 +101,12 @@ my $Is_Win32 = $^O eq 'MSWin32'; ...@@ -101,6 +101,12 @@ my $Is_Win32 = $^O eq 'MSWin32';
my $Is_cygwin = $^O eq 'cygwin'; my $Is_cygwin = $^O eq 'cygwin';
my $CanMoveAtBoot = ($Is_Win32 || $Is_cygwin); my $CanMoveAtBoot = ($Is_Win32 || $Is_cygwin);
# *note* CanMoveAtBoot is only incidentally the same condition as below
# this needs not hold true in the future.
my $Has_Win32API_File = ($Is_Win32 || $Is_cygwin)
? (eval {require Win32API::File; 1} || 0)
: 0;
my $Inc_uninstall_warn_handler; my $Inc_uninstall_warn_handler;
...@@ -167,9 +173,9 @@ If $moan is true then returns 0 on error and warns instead of dies. ...@@ -167,9 +173,9 @@ If $moan is true then returns 0 on error and warns instead of dies.
=cut =cut
{
my $Has_Win32API_File;
sub _move_file_at_boot { #XXX OS-SPECIFIC sub _move_file_at_boot { #XXX OS-SPECIFIC
my ( $file, $target, $moan )= @_; my ( $file, $target, $moan )= @_;
Carp::confess("Panic: Can't _move_file_at_boot on this platform!") Carp::confess("Panic: Can't _move_file_at_boot on this platform!")
unless $CanMoveAtBoot; unless $CanMoveAtBoot;
...@@ -178,11 +184,6 @@ If $moan is true then returns 0 on error and warns instead of dies. ...@@ -178,11 +184,6 @@ If $moan is true then returns 0 on error and warns instead of dies.
? "'$file' for deletion" ? "'$file' for deletion"
: "'$file' for installation as '$target'"; : "'$file' for installation as '$target'";
# *note* CanMoveAtBoot is only incidentally the same condition as below
# this needs not hold true in the future.
$Has_Win32API_File = ($Is_Win32 || $Is_cygwin)
? (eval {require Win32API::File; 1} || 0)
: 0 unless defined $Has_Win32API_File;
if ( ! $Has_Win32API_File ) { if ( ! $Has_Win32API_File ) {
my @msg=( my @msg=(
...@@ -213,7 +214,6 @@ If $moan is true then returns 0 on error and warns instead of dies. ...@@ -213,7 +214,6 @@ If $moan is true then returns 0 on error and warns instead of dies.
if ( $moan ) { _warnonce(@msg) } else { _choke(@msg) } if ( $moan ) { _warnonce(@msg) } else { _choke(@msg) }
} }
return 0; return 0;
}
} }
...@@ -1158,12 +1158,11 @@ sub run_filter { ...@@ -1158,12 +1158,11 @@ sub run_filter {
=item B<pm_to_blib> =item B<pm_to_blib>
pm_to_blib(\%from_to);
pm_to_blib(\%from_to, $autosplit_dir); pm_to_blib(\%from_to, $autosplit_dir);
pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd); pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd);
Copies each key of %from_to to its corresponding value efficiently. Copies each key of %from_to to its corresponding value efficiently.
If an $autosplit_dir is provided, all .pm files will be autosplit into it. Filenames with the extension .pm are autosplit into the $autosplit_dir.
Any destination directories are created. Any destination directories are created.
$filter_cmd is an optional shell command to run each .pm file through $filter_cmd is an optional shell command to run each .pm file through
...@@ -1181,7 +1180,7 @@ environment variable will silence this output. ...@@ -1181,7 +1180,7 @@ environment variable will silence this output.
sub pm_to_blib { sub pm_to_blib {
my($fromto,$autodir,$pm_filter) = @_; my($fromto,$autodir,$pm_filter) = @_;
_mkpath($autodir,0,0755) if defined $autodir; _mkpath($autodir,0,0755);
while(my($from, $to) = each %$fromto) { while(my($from, $to) = each %$fromto) {
if( -f $to && -s $from == -s $to && -M $to < -M $from ) { if( -f $to && -s $from == -s $to && -M $to < -M $from ) {
print "Skip $to (unchanged)\n" unless $INSTALL_QUIET; print "Skip $to (unchanged)\n" unless $INSTALL_QUIET;
...@@ -1217,7 +1216,7 @@ sub pm_to_blib { ...@@ -1217,7 +1216,7 @@ sub pm_to_blib {
utime($atime,$mtime+$Is_VMS,$to); utime($atime,$mtime+$Is_VMS,$to);
_chmod(0444 | ( $mode & 0111 ? 0111 : 0 ),$to); _chmod(0444 | ( $mode & 0111 ? 0111 : 0 ),$to);
next unless $from =~ /\.pm$/; next unless $from =~ /\.pm$/;
_autosplit($to,$autodir) if defined $autodir; _autosplit($to,$autodir);
} }
} }
......
...@@ -17,7 +17,7 @@ my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); ...@@ -17,7 +17,7 @@ my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/);
require VMS::Filespec if $Is_VMS; require VMS::Filespec if $Is_VMS;
use vars qw($VERSION); use vars qw($VERSION);
$VERSION = '2.06'; $VERSION = '2.04';
$VERSION = eval $VERSION; $VERSION = eval $VERSION;
sub _is_prefix { sub _is_prefix {
......
...@@ -5,7 +5,7 @@ use strict; ...@@ -5,7 +5,7 @@ use strict;
use Carp qw(); use Carp qw();
use Config; use Config;
use vars qw($VERSION $Relocations); use vars qw($VERSION $Relocations);
$VERSION = '2.06'; $VERSION = '2.04';
$VERSION = eval $VERSION; $VERSION = eval $VERSION;
# Used for generating filehandle globs. IO::File might not be available! # Used for generating filehandle globs. IO::File might not be available!
......
...@@ -10,18 +10,17 @@ sub config { $config->{$_[1]} } ...@@ -10,18 +10,17 @@ sub config { $config->{$_[1]} }
sub set_config { $config->{$_[1]} = $_[2] } sub set_config { $config->{$_[1]} = $_[2] }
sub set_feature { $features->{$_[1]} = 0+!!$_[2] } # Constrain to 1 or 0 sub set_feature { $features->{$_[1]} = 0+!!$_[2] } # Constrain to 1 or 0
sub auto_feature_names { grep !exists $features->{$_}, keys %$auto_features } sub auto_feature_names { sort grep !exists $features->{$_}, keys %$auto_features }
sub feature_names { sub feature_names {
my @features = (keys %$features, auto_feature_names()); my @features = (sort keys %$features, auto_feature_names());
@features; @features;
} }
sub config_names { keys %$config } sub config_names { sort keys %$config }
sub write { sub write {
my $me = __FILE__; my $me = __FILE__;
require IO::File;
# Can't use Module::Build::Dumper here because M::B is only a # Can't use Module::Build::Dumper here because M::B is only a
# build-time prereq of this module # build-time prereq of this module
...@@ -29,7 +28,7 @@ sub write { ...@@ -29,7 +28,7 @@ sub write {
my $mode_orig = (stat $me)[2] & 07777; my $mode_orig = (stat $me)[2] & 07777;
chmod($mode_orig | 0222, $me); # Make it writeable chmod($mode_orig | 0222, $me); # Make it writeable
my $fh = IO::File->new($me, 'r+') or die "Can't rewrite $me: $!"; open(my $fh, '+<', $me) or die "Can't rewrite $me: $!";
seek($fh, 0, 0); seek($fh, 0, 0);
while (<$fh>) { while (<$fh>) {
last if /^__DATA__$/; last if /^__DATA__$/;
...@@ -38,11 +37,11 @@ sub write { ...@@ -38,11 +37,11 @@ sub write {
seek($fh, tell($fh), 0); seek($fh, tell($fh), 0);
my $data = [$config, $features, $auto_features]; my $data = [$config, $features, $auto_features];
$fh->print( 'do{ my ' print($fh 'do{ my '
. Data::Dumper->new([$data],['x'])->Purity(1)->Dump() . Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
. '$x; }' ); . '$x; }' );
truncate($fh, tell($fh)); truncate($fh, tell($fh));
$fh->close; close $fh;
chmod($mode_orig, $me) chmod($mode_orig, $me)
or warn "Couldn't restore permissions on $me: $!"; or warn "Couldn't restore permissions on $me: $!";
...@@ -54,18 +53,13 @@ sub feature { ...@@ -54,18 +53,13 @@ sub feature {
my $info = $auto_features->{$key} or return 0; my $info = $auto_features->{$key} or return 0;
# Under perl 5.005, each(%$foo) isn't working correctly when $foo
# was reanimated with Data::Dumper and eval(). Not sure why, but
# copying to a new hash seems to solve it.
my %info = %$info;
require Module::Build; # XXX should get rid of this require Module::Build; # XXX should get rid of this
while (my ($type, $prereqs) = each %info) { foreach my $type (sort keys %$info) {
my $prereqs = $info->{$type};
next if $type eq 'description' || $type eq 'recommends'; next if $type eq 'description' || $type eq 'recommends';
my %p = %$prereqs; # Ditto here. foreach my $modname (sort keys %$prereqs) {
while (my ($modname, $spec) = each %p) { my $status = Module::Build->check_installed_status($modname, $prereqs->{$modname});
my $status = Module::Build->check_installed_status($modname, $spec);
if ((!$status->{ok}) xor ($type =~ /conflicts$/)) { return 0; } if ((!$status->{ok}) xor ($type =~ /conflicts$/)) { return 0; }
if ( ! eval "require $modname; 1" ) { return 0; } if ( ! eval "require $modname; 1" ) { return 0; }
} }
...@@ -168,27 +162,32 @@ do{ my $x = [ ...@@ -168,27 +162,32 @@ do{ my $x = [
{}, {},
{}, {},
{ {
'manpage_support' => {
'description' => 'Create Unix man pages',
'requires' => {
'Pod::Man' => 0
}
},
'HTML_support' => { 'HTML_support' => {
'description' => 'Create HTML documentation', 'description' => 'Create HTML documentation',
'requires' => { 'requires' => {
'Pod::Html' => 0 'Pod::Html' => 0
} }
}, },
'PPM_support' => {
'description' => 'Generate PPM files for distributions'
},
'dist_authoring' => { 'dist_authoring' => {
'description' => 'Create new distributions',
'recommends' => { 'recommends' => {
'Module::Signature' => '0.21', 'Module::Signature' => '0.21',
'Pod::Readme' => '0.04' 'Pod::Readme' => '0.04'
}, },
'requires' => { 'requires' => {
'Archive::Tar' => '1.09' 'Archive::Tar' => '1.09'
}
}, },
'description' => 'Create new distributions' 'inc_bundling_support' => {
'description' => 'Bundle Module::Build in inc/',
'requires' => {
'ExtUtils::Install' => '1.54',
'ExtUtils::Installed' => '1.999',
'inc::latest' => '0.5'
}
}, },
'license_creation' => { 'license_creation' => {
'description' => 'Create licenses automatically in distributions', 'description' => 'Create licenses automatically in distributions',
...@@ -196,16 +195,11 @@ do{ my $x = [ ...@@ -196,16 +195,11 @@ do{ my $x = [
'Software::License' => '0.103009' 'Software::License' => '0.103009'
} }
}, },
'inc_bundling_support' => { 'manpage_support' => {
'description' => 'Bundle Module::Build in inc/', 'description' => 'Create Unix man pages',
'requires' => { 'requires' => {
'ExtUtils::Installed' => '1.999', 'Pod::Man' => 0
'ExtUtils::Install' => '1.54',
'inc::latest' => '0.5'
} }
},
'PPM_support' => {
'description' => 'Generate PPM files for distributions'
} }
} }
]; ];
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
http://xml.org/sax/features/namespaces = 1 http://xml.org/sax/features/namespaces = 1
[XML::SAX::Expat] [XML::SAX::Expat]
http://xml.org/sax/features/namespaces = 1
http://xml.org/sax/features/external-general-entities = 1 http://xml.org/sax/features/external-general-entities = 1
http://xml.org/sax/features/namespaces = 1
http://xml.org/sax/features/external-parameter-entities = 1 http://xml.org/sax/features/external-parameter-entities = 1
...@@ -245,7 +245,7 @@ sub import { ...@@ -245,7 +245,7 @@ sub import {
${^WARNING_BITS} ^= ${^WARNING_BITS} ^ ""; ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "";
# use strict, use utf8; use feature; # use strict, use utf8; use feature;
$^H |= 0x1c820ec0; $^H |= 0x1c820ec0;
@^H{qw(feature_evalbytes feature_say feature_state feature_fc feature___SUB__ feature_unicode feature_switch)} = (1) x 7; @^H{qw(feature_say feature_evalbytes feature_state feature___SUB__ feature_fc feature_unicode feature_switch)} = (1) x 7;
} }
1; 1;
......
#===============================================================================
#
# Decrypt/lib/Filter/Crypto/Decrypt.pm
#
# DESCRIPTION
# Module providing a Perl source code filter for running Perl files that have
# been encrypted via Filter::Crypto::CryptFile.
#
# COPYRIGHT
# Copyright (C) 2004-2009, 2012, 2014 Steve Hay. All rights reserved.
#
# LICENCE
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU
# General Public License or the Artistic License, as specified in the LICENCE
# file.
#
#===============================================================================
package Filter::Crypto::Decrypt;
use 5.008001;
use strict;
use warnings;
use XSLoader qw();
#===============================================================================
# MODULE INITIALIZATION
#===============================================================================
our($VERSION);
BEGIN {
$VERSION = '2.10';
XSLoader::load(__PACKAGE__, $VERSION);
}
# Last error message.
our $ErrStr = '';
1;
__END__
#===============================================================================
# DOCUMENTATION
#===============================================================================
=head1 NAME
Filter::Crypto::Decrypt - Perl source code filter to run encrypted Perl files
=head1 SYNOPSIS
use Filter::Crypto::Decrypt;
=head1 DESCRIPTION
This module provides a Perl source code decryption filter for running files that
have been encrypted via the
L<Filter::Crypto::CryptFile|Filter::Crypto::CryptFile> module.
You should rarely, if ever, need to touch this module. The encrypted files
produced by the L<Filter::Crypto::CryptFile|Filter::Crypto::CryptFile> module
will automatically have the "C<use Filter::Crypto::Decrypt;>" statement added to
the start of them, which is all that is required to bring this decryption filter
into play. See L<perlfilter> if you want to know more about how Perl source
code filters work.
=head1 DIAGNOSTICS
=head2 Warnings and Error Messages
This module may produce the following diagnostic messages. They are classified
as follows (a la L<perldiag>):
(W) A warning (optional).
(F) A fatal error (trappable).
(I) An internal error that you should never see (trappable).
=over 4
=item Can't add MAGIC to decryption filter's SV
(F) The SV used by the source code decryption filter to maintain state could not
be assigned MAGIC to have it automatically free up allocated memory when it is
destroyed.
=item Can't complete decryption: %s
(F) There was an error producing the final block of decrypted data. The cipher
context structure used to perform the source code decryption could not be
finalized so the decryption could not be completed. The last error message from
the decryption code is also given.
=item Can't continue decryption: %s
(F) There was an error reading or decrypting a block of data from the encrypted
Perl file. The cipher context structure used to perform the source code
decryption could not be updated so the decryption could not continue. The last
error message from the decryption code is also given.
=item Can't find MAGIC in decryption filter's SV
(F) The MAGIC assigned to the SV used by the source code decryption filter to
maintain state could not be found.
=item Can't run with DEBUGGING flags
(F) The encrypted Perl file is being run by a perl with DEBUGGING flags enabled,
e.g. C<perl -Dp F<file>>. This is not allowed since it may assist in retrieving
the original unencrypted source code.
=item Can't run with DEBUGGING perl
(F) The encrypted Perl file is being run by a perl that was built with DEBUGGING
enabled, i.e. C<-DDEBUGGING>. This is not allowed since it may assist in
retrieving the original unencrypted source code.
=item Can't run with extra filters
(F) The encrypted Perl file is being run through extra source code filters (i.e.
over and above the decryption filter provided by this module). This is not
allowed since it may assist in retrieving the original unencrypted source code.
=item Can't run with Perl compiler backend
(F) The encrypted Perl file is being run by a perl with the Perl compiler
backend enabled, e.g. C<perl -MO=Deparse F<file>>. This is not allowed since it
may assist in retrieving the original unencrypted source code.
=item Can't run with Perl debugger
(F) The encrypted Perl file is being run by a perl with the Perl debugger
enabled, e.g. C<perl -d:ptkdb F<file>>. This is not allowed since it may assist
in retrieving the original unencrypted source code.
=item Can't start decryption: %s
(F) The cipher context structure used to perform the source code decryption
could not be initialized so the decryption could not be started. The last error
message from the decryption code is also given.
=item Found wrong MAGIC in decryption filter's SV: No valid mg_ptr
(F) The MAGIC found in the SV used by the source code decryption filter to
maintain state was not the correct MAGIC since it did not contain a valid
C<mg_ptr> member.
=item Found wrong MAGIC in decryption filter's SV: Wrong mg_ptr "signature"
(F) The MAGIC found in the SV used by the source code decryption filter to
maintain state was not the correct MAGIC since it did not contain the correct
"signature" in its C<mg_ptr> member.
=item No such package '%s'
(F) This module's bootstrap function was called on the specified package, which
does not exist.
=item Unknown crypto context mode '%d'
(I) The crypto context structure used internally when performing decryption has
been set-up with a crypt mode that it does not recognize.
=back
=head1 EXPORTS
I<None>.
=head1 KNOWN BUGS
=over
=item C<__DATA__> is not accessible when running encrypted files.
See L<https://rt.cpan.org/Ticket/Display.html?id=54370>.
=item Infinite loop when running a program using an encrypted Data::Alias.
See L<https://rt.cpan.org/Ticket/Display.html?id=122951>.
=back
=head1 SEE ALSO
L<Filter::Crypto>;
L<Filter::CBC>, L<Crypt::License>.
The latter two modules (in separate CPAN distributions, not related to the
Filter-Crypto distribution in any way) are both Perl-level source code filters
and are thus even less secure than this module is. (This module's filter code
is written in XS and C.)
=head1 ACKNOWLEDGEMENTS
Much of the XS code is based on that in the Filter::decrypt module (version
1.49), written by Paul Marquess.
Thanks to Nick Ing-Simmons for help in getting the MAGIC attached to the
decryption filter's SV working.
=head1 AUTHOR
Steve Hay E<lt>L<shay@cpan.org|mailto:shay@cpan.org>E<gt>.
=head1 COPYRIGHT
Copyright (C) 2004-2009, 2012-2014 Steve Hay. All rights reserved.
=head1 LICENCE
This module is free software; you can redistribute it and/or modify it under the
same terms as Perl itself, i.e. under the terms of either the GNU General Public
License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
Version 2.10
=head1 DATE
TODO
=head1 HISTORY
See the F<Changes> file.
=cut
#===============================================================================
package Imager::File::PNG;
use 5.006;
use strict;
use Imager;
BEGIN {
our $VERSION = "0.99";
require XSLoader;
XSLoader::load('Imager::File::PNG', $VERSION);
}
sub read {
my ($class, $im, $io, %hsh) = @_;
my $flags = 0;
$hsh{png_ignore_benign_errors}
and $flags |= IMPNG_READ_IGNORE_BENIGN_ERRORS;
$im->{IMG} = i_readpng_wiol($io, $flags);
unless ($im->{IMG}) {
$im->_set_error(Imager->_error_as_msg);
return;
}
return $im;
}
Imager->register_reader
(
type=>'png',
single =>
sub {
my ($im, $io, %hsh) = @_;
__PACKAGE__->read($im, $io, %hsh);
},
);
sub write {
my ($class, $im, $io, %hsh) = @_;
$im->_set_opts(\%hsh, "i_", $im);
$im->_set_opts(\%hsh, "png_", $im);
unless (i_writepng_wiol($im->{IMG}, $io)) {
$im->_set_error(Imager->_error_as_msg);
return;
}
return $im;
}
Imager->register_writer
(
type=>'png',
single =>
sub {
my ($im, $io, %hsh) = @_;
return __PACKAGE__->write($im, $io, %hsh);
},
);
__END__
=head1 NAME
Imager::File::PNG - read and write PNG files
=head1 SYNOPSIS
use Imager;
my $img = Imager->new;
$img->read(file=>"foo.png")
or die $img->errstr;
$img->write(file => "foo.png")
or die $img->errstr;
=head1 DESCRIPTION
Imager's PNG support is documented in L<Imager::Files>.
=head1 METHODS
Two low level class methods are provided, most for use by
L<Imager::File::APNG>, but it may later be used for other formats that
can encapsulate PNG such as ICO.
=over
=item C<< Imager::File::PNG->read($im, $io, %hsh) >>
Read a PNG image from the supplied L<Imager::IO> object C<$io> into
the L<Imager> object C<$im>.
Returns a true value on success.
=item C<< Imager::File::PNG->write($im, $io, %hsh) >>
Write a PNG image to the supplied L<Imager::IO> object C<$io> from the
L<Imager> object C<$im>.
Returns a true value on success.
=back
=head1 AUTHOR
Tony Cook <tonyc@cpan.org>
=head1 SEE ALSO
L<Imager>, L<Imager::Files>.
=cut
#===============================================================================
#
# lib/PAR/Filter/Crypto.pm
#
# DESCRIPTION
# PAR::Filter sub-class providing the means to convert files to an encrypted
# state in which they can be run via Filter::Crypto::Decrypt, primarily for
# use in creating PAR archives in which the Perl files are encrypted.
#
# COPYRIGHT
# Copyright (C) 2004-2008, 2012, 2014 Steve Hay. All rights reserved.
#
# LICENCE
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU
# General Public License or the Artistic License, as specified in the LICENCE
# file.
#
#===============================================================================
package PAR::Filter::Crypto;
use 5.008001;
use strict;
use warnings;
use Carp qw(carp croak);
use Fcntl qw(:seek);
use File::Temp qw(tempfile);
use Filter::Crypto::CryptFile qw(:DEFAULT $ErrStr);
use PAR::Filter qw();
#===============================================================================
# CLASS INITIALIZATION
#===============================================================================
our(@ISA, $VERSION);
BEGIN {
@ISA = qw(PAR::Filter);
$VERSION = '2.10';
}
#===============================================================================
# PUBLIC API
#===============================================================================
# This method is based on the apply() method in the PAR::Filter::Bytecode module
# in the PAR::Packer distribution (version 1.017).
sub apply {
my($class, $ref, $filename, $name) = @_;
# If we're encrypting modules (e.g. pp -F Crypto ...) then be careful not to
# encrypt the decryption module.
return 1 if $filename eq 'Filter/Crypto/Decrypt.pm';
if (eval { require Module::ScanDeps } and
$Module::ScanDeps::VERSION eq '0.75')
{
carp('Detected Module::ScanDeps version 0.75, which may not work ' .
'correctly with ' . __PACKAGE__);
}
# Open a temporary file. (The temporary file will be deleted automatically
# since tempfile() is called in scalar context.)
my $fh = tempfile();
# Write the source code to be encrypted to the temporary filehandle.
print $fh $$ref;
# Rewind the filehandle so that the encryption knows where to begin.
seek $fh, 0, SEEK_SET or
croak("Can't rewind temporary filehandle before encryption: $!");
# Encrypt the source code.
crypt_file($fh, CRYPT_MODE_ENCRYPT) or
croak("crypt_file() failed: $ErrStr");
# Rewind the filehandle again and read the now-encrypted source code from it
# back into the scalar referred to by $ref.
seek $fh, 0, SEEK_SET or
croak("Can't rewind temporary filehandle after encryption: $!");
{
local $/;
$$ref = <$fh>;
}
close $fh or
carp("Can't close temporary filehandle after encryption: $!");
return 1;
}
1;
__END__
#===============================================================================
# DOCUMENTATION
#===============================================================================
=head1 NAME
PAR::Filter::Crypto - Encrypt Perl files in PAR archives
=head1 SYNOPSIS
# Create a PAR archive containing an encrypted Perl script:
$ pp -f Crypto -M Filter::Crypto::Decrypt -o hello hello.pl
# The same, but with included modules encrypted as well:
$ pp -f Crypto -F Crypto -M Filter::Crypto::Decrypt -o hello hello.pl
# Encrypt Perl source code in $code:
use PAR::Filter::Crypto;
PAR::Filter::Crypto->apply(\$code);
=head1 DESCRIPTION
This module is a L<PAR::Filter|PAR::Filter> sub-class for producing PAR archives
containing encrypted Perl files. The PAR::Filter class itself is part of the
L<PAR|PAR> distribution, and is clearly a prerequisite for using this sub-class.
The usual means of producing a PAR archive is using the B<pp> script, which also
comes with the PAR distribution. That script's B<-f> and B<-F> command-line
options can be used to specify a "filter" through which to pass the Perl files
being put into the PAR archive. Specifying this sub-class as the filter (i.e.
"B<-f Crypto>" for scripts and/or "B<-F Crypto>" for modules) means that the
Perl files will be encrypted using the
L<Filter::Crypto::CryptFile|Filter::Crypto::CryptFile> module. The resulting
encrypted files are what will be placed in the PAR archive.
Note that the encrypted script requires the
L<Filter::Crypto::Decrypt|Filter::Crypto::Decrypt> module in order to decrypt
itself when it is run. The original Perl script will not have specified any
such dependency, so B<pp> will not automatically include that module in the PAR
archive for you. Therefore, you must use the B<-M> option to force that module
to be included. Also note that if you use the B<-F> option to encrypt modules
as well then the filtering will automatically skip the
L<Filter::Crypto::Decrypt|Filter::Crypto::Decrypt> module itself for obvious
reasons. A typical B<pp> invocation is thus something like:
$ pp -f Crypto -F Crypto -M Filter::Crypto::Decrypt -o hello hello.pl
(Version 0.75 of the L<Module::ScanDeps|Module::ScanDeps> module, used by B<pp>
to scan for dependencies that need including in the PAR archive, is known to
have problems finding shared library files for modules specified by B<pp>'s
B<-M> option (as illustrated above). If you find that the shared library file
for Filter::Crypto::Decrypt is missing from your PAR archive then you need to
upgrade Module::ScanDeps to version 0.76 or higher.)
Of course, you must not include the Filter::Crypto::CryptFile module as well,
otherwise people to whom you distribute your PAR archive will have the means to
easily decrypt the encrypted Perl script within it!
Also, note that the script is encrypted by reading its entire contents into
memory, encrypting it in memory, and then writing it out to disk. This should
be safe for most purposes given that Perl scripts are typically not very large,
but other methods should be considered instead if this is likely to cause
out-of-memory errors due to the size of the scripts, e.g. if the scripts have
very large C<__DATA__> sections.
=head2 Methods
=over 4
=item C<apply($ref)>
Class method. Encrypts the Perl source code referred to by $ref, and replaces
the code referred to by $ref with the encrypted code. Thus, the code in $$ref
gets encrypted "in-place".
Returns 1 on success, or C<croak()>s on failure (since the usual caller,
PAR::Filter::apply(), does not bother checking the return value (as of
PAR::Filter version 0.02, at least)).
=back
=head1 DIAGNOSTICS
=head2 Warnings and Error Messages
This module may produce the following diagnostic messages. They are classified
as follows (a la L<perldiag>):
(W) A warning (optional).
(F) A fatal error (trappable).
(I) An internal error that you should never see (trappable).
=over 4
=item Can't close temporary filehandle after encryption: %s
(W) The temporary file used to perform the encryption could not be closed after
use. The system error message corresponding to the standard C library C<errno>
variable is also given.
=item Can't rewind temporary filehandle before encryption: %s
(F) The temporary file used to perform the encryption could not be rewound
before encrypting the source that was just written to it. The system error
message corresponding to the standard C library C<errno> variable is also given.
=item Can't rewind temporary filehandle after encryption: %s
(F) The temporary file used to perform the encryption could not be rewound after
encrypting the source code that was written to it. The system error message
corresponding to the standard C library C<errno> variable is also given.
=item crypt_file() failed: %s
(F) The C<crypt_file()> function from the Filter::Crypto::CryptFile module that
is used to perform the encryption failed. The last error message from the
Filter::Crypto::CryptFile module is also given.
=item Detected Module::ScanDeps version 0.75, which may not work correctly with
PAR::Filter::Crypto
(W) Your current installation of the Module::ScanDeps module, used by B<pp> to
scan for dependencies that need including in the PAR archive, was found to be
version 0.75, which is known to have problems finding shared library files for
modules specified by B<pp>'s B<-M> option. If you are running B<pp> with the
B<-M> option and find that the shared library file for Filter::Crypto::Decrypt
is missing from your PAR archive then you need to upgrade Module::ScanDeps to
version 0.76 or higher.
=back
=head1 EXPORTS
I<None>.
=head1 KNOWN BUGS
I<None>.
=head1 SEE ALSO
L<PAR::Filter>;
L<Filter::Crypto>.
=head1 ACKNOWLEDGEMENTS
The C<apply()> method is based on that in the PAR::Filter::Bytecode module in
the PAR::Packer distribution (version 1.017), written by Audrey Tang.
=head1 AUTHOR
Steve Hay E<lt>L<shay@cpan.org|mailto:shay@cpan.org>E<gt>.
=head1 COPYRIGHT
Copyright (C) 2004-2008, 2012, 2014 Steve Hay. All rights reserved.
=head1 LICENCE
This module is free software; you can redistribute it and/or modify it under the
same terms as Perl itself, i.e. under the terms of either the GNU General Public
License or the Artistic License, as specified in the F<LICENCE> file.
=head1 VERSION
Version 2.10
=head1 DATE
TODO
=head1 HISTORY
See the F<Changes> file.
=cut
#===============================================================================
/opt/thirdlane/perl_lib/local/dist/bin/instmodsh /opt/thirdlane/perl_lib/local/dist/bin/instmodsh
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Command.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Command.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Command/MM.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Command/MM.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Install.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Installed.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Liblist.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Liblist.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Liblist/Kid.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Liblist/Kid.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/MM.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/MM.pm
...@@ -34,5 +32,4 @@ ...@@ -34,5 +32,4 @@
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/MakeMaker/version/vpp.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/MakeMaker/version/vpp.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Mkbootstrap.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Mkbootstrap.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Mksymlists.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Mksymlists.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/Packlist.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/testlib.pm /opt/thirdlane/perl_lib/local/dist/lib/perl5/ExtUtils/testlib.pm
/usr/local/bin/crypt_file
/usr/local/lib64/perl5/Filter/Crypto.pm
/usr/local/lib64/perl5/Filter/Crypto/CryptFile.pm
/usr/local/lib64/perl5/Filter/Crypto/Decrypt.pm
/usr/local/lib64/perl5/PAR/Filter/Crypto.pm
/usr/local/lib64/perl5/auto/Filter/Crypto/CryptFile/CryptFile.so
/usr/local/lib64/perl5/auto/Filter/Crypto/Decrypt/Decrypt.so
/usr/local/share/man/man1/crypt_file.1
/usr/local/share/man/man3/Filter::Crypto.3pm
/usr/local/share/man/man3/Filter::Crypto::CryptFile.3pm
/usr/local/share/man/man3/Filter::Crypto::Decrypt.3pm
/usr/local/share/man/man3/PAR::Filter::Crypto.3pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/x86_64-linux-thread-multi/Imager/File/PNG.pm
/opt/thirdlane/perl_lib/local/dist/lib/perl5/x86_64-linux-thread-multi/auto/Imager/File/PNG/PNG.so
libz.so.1.2.11
\ No newline at end of file
libz.so.1.2.11
\ No newline at end of file
.TH QRENCODE 1 "Sep. 21, 2017" "qrencode 4.0.2"
.SH NAME
qrencode \- Encode input data in a QR Code and save as a PNG or EPS image.
.SH SYNOPSIS
.B "qrencode"
[OPTION]...
[STRING]
.SH DESCRIPTION
Libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D
symbology that can be scanned by handy terminals such as a mobile phone with
CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has
high robustness.
Qrencode is a utility software using libqrencode to encode string data in
a QR Code and save as a PNG or EPS image.
.SH OPTIONS
.TP
.B \-h, \-\-help
display help message.
.TP
.B \-o FILENAME, \-\-output=FILENAME
write image to FILENAME. If '\-' is specified, the result will be output to standard output. If \-S is given, structured symbols are written to FILENAME-01.png, FILENAME-02.png, ... (suffix is removed from FILENAME, if specified)
.TP
.B \-r FILENAME, \-\-read\-from=FILENAME
read input data from FILENAME.
.TP
.B \-s NUMBER, \-\-size=NUMBER
specify the size of dot (pixel). (default=3)
.TP
.B \-l {LMQH}, \-\-level={LMQH}
specify error correction level from L (lowest) to H (highest). (default=L)
.TP
.B \-v NUMBER, \-\-symversion=NUMBER
specify the minimum version of the symbol. See SYMBOL VERSIONS for more information. (default=auto)
.TP
.B \-m NUMBER, \-\-margin=NUMBER
specify the width of margin. (default=4)
.TP
.B \-d NUMBER, \-\-dpi=NUMBER
specify the DPI of the generated PNG. (default=72)
.TP
.PD 0
.B \-t {PNG,PNG32,EPS,SVG,XPM,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}
.TP
.PD
.B \-\-type={PNG,PNG32,EPS,SVG,XPM,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}
specify the type of the generated image. (default=PNG)
.TP
.B \-S, \-\-structured
make structured symbols. Version must be specified.
.TP
.B \-k, \-\-kanji
assume that the input text contains kanji (shift-jis).
.TP
.B \-c, \-\-casesensitive
encode lower-case alphabet characters in 8-bit mode. (default)
.TP
.B \-i, \-\-ignorecase
ignore case distinctions and use only upper-case characters.
.TP
.B \-8, \-\-8bit
encode entire data in 8-bit mode. \-k, \-c and \-i will be ignored.
.TP
.B \-M, \-\-micro
encode in a Micro QR Code. (experimental)
.TP
.PD 0
.B \-\-foreground=RRGGBB[AA]
.TP
.PD
.B \-\-background=RRGGBB[AA]
specify foreground/background color in hexadecimal notation.
6-digit (RGB) or 8-digit (RGBA) form are supported.
Color output support available only in PNG, EPS and SVG.
.TP
.B \-V, \-\-version
display the version number and copyrights of the qrencode.
.TP
.B \-\-verbose
display verbose information to stderr.
.TP
.B [STRING]
input data. If it is not specified, data will be taken from standard input.
.SH SYMBOL VERSIONS
The symbol versions of QR Code range from Version 1 to Version 40.
Each version has a different module configuration or number of modules,
ranging from Version 1 (21 x 21 modules) up to Version 40 (177 x 177 modules).
Each higher version number comprises 4 additional modules per side by default.
See http://www.qrcode.com/en/about/version.html for a detailed version list.
.SH EXAMPLES
.TP
.B qrencode \-l L \-v 1 \-o output.png 'Hello, world!'
encode into a symbol version 1, level L.
.TP
.B qrencode \-iSv 1 \-\-output=output.png
read standard input and encode it into a structured-appended symbols in
case-insensitive mode.
.TP
.B qrencode \-S \-v 40 \-l L \-r bigfile.txt \-o output.png
read input data from bigfile.txt and encode into a symbol version 40, level L.
.SH AUTHOR
Written by Kentaro Fukuchi.
.SH RESOURCES
.TP
Main Web Site: https://fukuchi.org/works/qrencode/
.TP
Source code repository: https://github.com/fukuchi/libqrencode/
.SH COPYRIGHT
Copyright (C) 2006-2017 Kentaro Fukuchi.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment