From: Don Armstrong Date: Thu, 20 Sep 2007 06:17:19 +0000 (-0700) Subject: * Add the ability to have module import options X-Git-Tag: release/2.6.0~510^2~20 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a87a6cb9e637e558042dde45f02915a3bfd3f9e8;p=debbugs.git * Add the ability to have module import options * Indicate that Debbugs::Config can't yet be imported --- diff --git a/Debbugs/Text.pm b/Debbugs/Text.pm index 7913a047..9a06510d 100644 --- a/Debbugs/Text.pm +++ b/Debbugs/Text.pm @@ -155,11 +155,20 @@ sub _fill_in_template{ $safe = Safe->new() or die "Unable to create safe compartment"; $safe->deny_only(); my @modules = ('Text::Template' => undef, + # This doesn't work yet; have to figure it out + #'Debbugs::Config' => [qw(:globals :config)], ); while (my ($module,$param) = splice (@modules,0,2)) { print STDERR "Eval $module\n" if $DEBUG; - $safe->reval("use $module;"); - print STDERR "Error while attempting to 'use $module;' $@" if $@; + my $code = ''; + if (not defined $param) { + $code = "use $module;"; + } + else { + $code = "use $module ".(join(',',map {"q($_)"} @{$param})).';'; + } + $safe->reval($code); + print STDERR "Error while attempting to eval '$code': $@" if $@; } $safe->permit_only(':base_core',':base_io',':base_mem',':base_loop', qw(padsv padav padhv padany),