[Omaha.pm] Safely instantiate (or not) a class that may or may notexist?

Kenneth Thompson kthompson at omnihotels.com
Fri Dec 16 11:14:10 PST 2005


Any chance this approach might work?

  my $obj = ref("${namespace}::${partner_id}::OutboundHeader");
  my $class = $obj || "";
  return 1 if $class
  
(Completely untested, and off the top of my head...)
  


---------------------

Howdy! I've got a chuck of code. For most partner_id's, I have an
OutboundHeader. For some, though, I don't. So I'm trying to safely trap
the possible non-existance using eval like so:



More information about the Omaha-pm mailing list