ppm install That::Module
or read How to install CPAN modules into ActivePerl to install the missing ones.
Setting locale failed
message perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:
uncomment the locale you need in /etc/locale.gen
and run locale-gen
.
# Install Devel::Trace: apt-get install libdevel-trace-perl # Run the script: perl -d:Trace my_script.pl
-CA
command-line argument to Perl interpreter:perl -CA -e 'binmode(STDOUT, ":utf8"); print $ARGV[0]. "\n";' unicode_file_name
decode_utf8()
.use Encode qw(decode_utf8); $text = $dbh->quote(decode_utf8($text)); $dbh->do("insert into MYTABLE (TEXT) values ($text)");
The same concerns subject and body returned by MIME::Parser, see Perl, UTF-8 Email Messages, MIME::Enity:
use Encode qw(decode_utf8); use MIME::Parser; $text = decode_utf8(MIME::Parser->new()->read(\*STDIN)->head()->get('Subject'));
See also:
STDIN
? binmode STDIN, ':crlf' or die; while (<>) { ... }
See also CR vs LF perl parsing.
$ echo "w7zDtsOkw58K" | perl -MMIME::Base64 -pe '$_ = MIME::Base64::decode($_) . "\n";' üöäß
Decode Base64-encoded binary string into number:
$ echo AQUAAAAAAAUVAAAA9TZFSbZE5CNDFwoyvJUBAA== | perl -MMIME::Base64 -MMath::BigInt -pe '$_ = Math::BigInt->new("0x" . join("", map sprintf("%.2x", ord($_)), split //, MIME::Base64::decode($_))) . "\n";' 107369172365208701678008732329624989801437041400940127167586828544
Decode Base64-encoded SID:
$ echo AQUAAAAAAAUVAAAA9TZFSbZE5CNDFwoyvJUBAA== | perl -MMIME::Base64 -pe '$_ = "S-1-5-21-" . join("-", unpack "VVVV", substr(MIME::Base64::decode($_), -16)) . "\n";' S-1-5-21-1229272821-602162358-839522115-103868
# The given string should be interpreted as 0x44,0x41,0x54,0x45,0x20,0x4f,0x46 and then printed as string of corresponding characters: $ perl -e 'print pack("H*", "44415445204f46") . "\n"' DATE OF
$ du -sh * | perl -e '%byte_order = ( G => 0, M => 1, K => 2, k => 2 ); print map { $_->[0] } sort { $byte_order{$a->[1]} <=> $byte_order{$b->[1]} || $b->[2] <=> $a->[2] } map { [ $_, /([MGKk])/, /(\d+)/ ] } <>'
but it is more wise to use du -sh | sort -rh
cat mime_mail | perl -MMIME::Parser -e 'print MIME::Parser->new()->read(\*STDIN)->bodyhandle()->as_string();'
More clean solution is here.
perl -MCPAN -e shell
fails with following message:ppm.bat install failed: Can't find any package that provides MinGW
dmake
(in particular, dmake-4.1pl1-win32.zip
) and unpack it to your PATH
.
See also ppm.bat install failed: Can't find any package that provides MinGW.
local::lib
tarball from CPAN.perl Makefile.PL –bootstrap
make test && make install
After that one can run e.g. perl -I~/perl5 -MCPAN -Mlocal::lib -e 'install DBD'
.
"Девица не хочет лезть в Окно" – device not compatible with Windows.