[tpm] how to conditional compile

Fulko Hew fulko.hew at gmail.com
Fri Nov 27 11:00:57 PST 2009


I thought I was doing the right thing, but I can't get there from here.
What I'd like to do is 'conditional compile'.  ie. define this set of
subroutines if something, and a different set if something else.

For example:

BEGIN {
  if (eval 'use AMODULE; 1") {
    sub mysub1 { print "do something"; }
    sub mysub2 { print "something else"; }
  } else {
    sub mysub1 { print "mysub1() is unsupported"; }
    sub mysub2 { print "mysub2() is unsupported"; }
  }
}

Or in otherwords... if the module isn't found, I'd like to stub out some
routines.

Ideas anyone?
TIA
Fulko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20091127/40f08bdd/attachment.html>


More information about the toronto-pm mailing list