dump2file("$pfile.$seq", $dtext);
}
}
- $DEBUG or unlink ($sfile, $pfile);
+ if ( ! $DEBUG ) {
+ 1 while unlink ($sfile);
+ 1 while unlink ($pfile);
+ }
}
}
# reading
for my $utf (sort keys %bom){
my $bomed = $bom{$utf} . encode($utf, $str);
- my $sfile = File::Spec->catfile($dir,".$utf.$seq.$$");
+ my $sfile = File::Spec->catfile($dir,".${utf}_${seq}_$$");
dump2file($sfile, $bomed);
my $utf_nobom = $utf; $utf_nobom =~ s/(LE|BE)$//o;
# reading
# writing
for my $utf_nobom (qw/UTF-16 UTF-32/){
my $utf = $utf_nobom . 'BE';
- my $sfile = File::Spec->catfile($dir,".$utf_nobom.$seq.$$");
+ my $sfile = File::Spec->catfile($dir,".${utf_nobom}_${seq}_$$");
my $bomed = $bom{$utf} . encode($utf, $str);
open $fh, ">:encoding($utf_nobom)", $sfile or die "$sfile : $!";
print $fh $str;
close $fh;
- open my $fh, "<:raw", $sfile or die "$sfile : $!";
+ open my $fh, "<", $sfile or die "$sfile : $!";
read $fh, my $cmp, -s $sfile;
close $fh;
use bytes ();