I have a simple print script
my $pdf_data = $agent->content;
open my $ofh, '>:raw', "test.pdf"
or die "Could not write: $!";
print {$ofh} $pdf_data;
close $ofh;
Sometimes I get the “Wide character warning”, I know why I receive this and would like to be able to cancel the print instead of printing a corrupted fail. Something like
if(wideCharWarning)
{
delete "test.pdf"
}
else{
print {$ofh} $pdf_data;
}
You specified you’re printing bytes (:raw), but you’re not.
To “cancel the print”, you simply have to check that what you print doesn’t contains non-bytes.