I can't say exactly because I don't fully understand it myself.
It seem to experience no fundamental run errors but something messes up (what seems to me to be) the encoding.
Try this shot code for example, and see the difference between it's pl and it's exe (pp) versions.
Note that it contains hebrew characters.
use strict;
use diagnostics;
use warnings;
use WWW::Mechanize 'new';
my $mech = WWW::Mechanize->new();
$mech->get( 'http://tv.walla.co.il/?w=/2//353//2011-10-22/1' );
$mech = $mech->content( format => 'text' );
writeFile('del at will.txt',$mech);
system('del at will.txt');
exit;
sub writeFile
{
my $filepath = shift;
my $nwntnt = join("",@_);
$nwntnt = "\x{feff}".$nwntnt; #utf8 char starter
no warnings;
do
{
open(TXT, ">:utf8",$filepath);
#open(txt, ">",$filepath);
print TXT $nwntnt;
close TXT;
if($! and
($! ne 'No such file or directory') and
($! ne 'Bad file descriptor')
)
{
print 'Error writing to file: '.$!."\a\nPath: $filepath\nhit the
+ enter to continue"; <>;
}
else{$! = '';}
}
while($!);
}
The extreme difference in length alone is unmistakeable,
even if your computer doesn't support hebrew. |