Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Unknown PerlIO layer "encoding" when it should fail because it's tainted

by choroba (Cardinal)
on Feb 09, 2022 at 18:29 UTC ( [id://11141284]=note: print w/replies, xml ) Need Help??


in reply to Unknown PerlIO layer "encoding" when it should fail because it's tainted

I was able to reduce the code even more:
#!/usr/bin/perl -T use strict; use warnings; use FindBin; my $whereami = $FindBin::Bin; open my $fh, '<:encoding(UTF-8)', $whereami or die;

Note that untainting $whereami before opening the file prevents the error:

$whereami =~ /^(.*)$/ and $whereami = $1;

Interestingly, removing the :encoding prevents the error, too, without untainting, which seems wrong.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Unknown PerlIO layer "encoding" when it should fail because it's tainted
by bliako (Monsignor) on Feb 09, 2022 at 18:55 UTC

    not for me unless I add use Test::More;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141284]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-18 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found