szabgab has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use Archive::Any in a script where taint mode is enabled. Unfortunately it seems they don't like each other.

See the following example:

#!/usr/bin/perl -T use strict; use warnings; use Archive::Any; my $aa = Archive::Any->new($0); print "OK\n";

Which gave me

Insecure dependency in eval while running with -T switch at .../perl5/ +Archive/Any.pm line 153.
The code around line 153 looks like this:
sub new { my ( $class, $file, $type ) = @_; $file = rel2abs($file); return unless -f $file; my %available; my @plugins = Archive::Any::Plugin->findsubmod; foreach my $plugin (@plugins) { eval "require $plugin"; next if $@; my @types = $plugin->can_handle(); foreach my $type ( @types ) { next if exists( $available{$type} ); $available{$type} = $plugin; } }
Any idea how to get it work?

Replies are listed 'Best First'.
Re: Using Archive::Any in taint mode
by jethro (Monsignor) on Oct 30, 2010 at 23:38 UTC

    If the problem is because of $plugin,

    ($plugin)= $plugin=~/(.*)/;

    before the eval should work (or at least make sure that $plugin is not the culprit)

Re: Using Archive::Any in taint mode
by $h4X4_|=73}{ (Monk) on Oct 31, 2010 at 09:22 UTC
    Some modules on cpan are not built to work with Taint.
    You can try to un-taint the variable $0 in your code or the module may need a fix to work with taint.