#! /usr/bin/perl -w use strict; use Safe; my $CODE = << 'END'; package A; sub new { my($class) = @_; bless { }, $class; } package B; our @ISA = qw(A); END # If I uncomment this line, everything works. # eval $CODE; my $safe = Safe->new(); $safe->reval($CODE); warn "code - $@" if $@; $safe->reval("B->new();"); warn "new - $@" if $@;