Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

RE: Runtime loading of arbitrary objects

by merlyn (Sage)
on Aug 21, 2000 at 17:26 UTC ( [id://28800]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $class_name = "Calvin::Hobbes"; # from some value above
    my $new_object = $class_name->new;
    
  2. or download this
    if (grep $class_name eq $_, qw(Calvin::Hobbes Peter::Gabriel Dog::Day:
    +:Afternoon)) {
      # must validate the name, or security holes will run rampant
      eval "require $class_name"; die $@ if $@;
      $object = $class_name->new;
    }
    
  3. or download this
    my %make_a = qw(
      Calvin::Hobbes new
    ...
      }
      $object = $class_name->$constructor();
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://28800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-18 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found