I'm trying to figure out exactly what opcode gives you the functionality to do quoted string interpretation, eg
when you set $foo='FOO!'; and then print "$foo"; -- what changes "$foo" into 'FOO!'.
So, I threw together this script... and it ain't workin. Anyone have any experience with the safe module and Text::Template?
#!/usr/bin/perl
use Opcode;
use Text::Template;
use Safe;
my @names = Opcode::opset_to_ops(Opcode::full_opset);
foreach my $name (@names)
{
my (@feh);
my ($cmptmt);
undef $cmptmt;
print "trying name $name..\t\t";
$cmptmt = new Safe;
push @feh,$name;
$cmptmt->permit_only(@feh);
$Journal::true = 10;
my $template_text = '{$true}';
my $template = new Text::Template (TYPE => 'STRING',
SOURCE => $template_text,
SAFE => $cmptmt);
my $return_text = $template->fill_in(PACKAGE => Journal);
if ($return_text eq "10")
{
print "return text is ok... ";
$cmptmt1 = new Safe;
$cmptmt1->permit_only(@feh);
my $template_text1 = '{open(PASSWD,"/etc/passwd");read(PASSWD,$_,1
+,0);print}';
$template1 = new Text::Template (TYPE => 'STRING',
SOURCE => $template_text1,
SAFE => $cmptmt1);
if ($return_text1 = $template1->fill_in(PACKAGE => Journal) == 1)
{ print "Um, ok?\n"; }
else
{ print "Bad!!\n"; }
}
}