in reply to Conditional use of 'use'
Since use happens at compile time and both the if and else parts of your code get compiled, you proposed code has the same effect as:
which probably won't work very well.use LayerB2; use LayerB;
You can get around that with:
BEGIN { if ($version == 2) { eval "use LayerB2"; } else { eval "use LayerB"; } die $@ if $@; }
I'd actually suggest changing LayerB.pm to support both environments so that your staging environment is more likely to very closely match your production environment. Something like: use LayerB ( Version=>$version ); or use LayerB ( Production => 2!=$version );
- tye (but my friends call me "Tye")
|
|---|