<?xml version="1.0" encoding="windows-1252"?>
<node id="803372" title="Re: store module names in an array" created="2009-10-26 23:34:09" updated="2009-10-26 23:34:09">
<type id="11">
note</type>
<author id="585085">
kyle</author>
<data>
<field name="doctext">
&lt;p&gt;You could wrap it in a string [doc://eval] like so:
&lt;C&gt;
for my $dbh ( @dbf ) {
    die $@ if ! eval "use $dbf; 1";
}
&lt;/c&gt;
&lt;p&gt;I might be inclined to put the whole thing in a BEGIN block.
&lt;c&gt;
BEGIN {
    my @dbf = ...;
    for my $dbf ( @dbf ) {
        require $dbf;
        $dbf-&gt;import();
    }
}
&lt;/c&gt;
&lt;p&gt;Either way, there's a big security risk if &lt;c&gt;@dbf&lt;/c&gt; comes from an untrusted source, but I think the risk is bigger with eval.  It might be useful to read the documentation for [doc://use] and [doc://require] to see how close they are to what you want to do.
</field>
<field name="root_node">
803365</field>
<field name="parent_node">
803365</field>
</data>
</node>
