Re: Getting script to run w/o optional module

2011-06-10 Thread Dr.Ruud
On 2011-06-09 23:46, John SJ Anderson wrote: On Thu, Jun 9, 2011 at 17:42, wrote: Using either require, use, or do produces an error if I run the script without the module. Is there a specific function for this purpose, or would I have to do something like wrap a 'use' or 'require' in an i

Re: Getting script to run w/o optional module

2011-06-09 Thread sono-io
On Jun 9, 2011, at 2:46 PM, John SJ Anderson wrote: > my $module_is_enabled = 0; > eval 'use My::Special::Module'; > $module_is_enabled = 1 unless $@; > > should do what you're looking for. John, Thanks for the code. Between that and wrapping a call to an external sub in an if stat

Re: Getting script to run w/o optional module

2011-06-09 Thread Robert Wohlfarth
On Thu, Jun 9, 2011 at 4:42 PM, wrote: >I'd like to find a way to make a Perl script "modular". What I mean > is that I want to be able to distribute a script either with or without a > particular module/package/lib and have the main script run no matter if it's > included or not. > >

Re: Getting script to run w/o optional module

2011-06-09 Thread John SJ Anderson
On Thu, Jun 9, 2011 at 17:42, wrote: >        Using either require, use, or do produces an error if I run the script > without the module.  Is there a specific function for this purpose, or would > I have to do something like wrap a 'use' or 'require' in an if statement?   > I've tried that an

Getting script to run w/o optional module

2011-06-09 Thread sono-io
I'd like to find a way to make a Perl script "modular". What I mean is that I want to be able to distribute a script either with or without a particular module/package/lib and have the main script run no matter if it's included or not. What I'm trying to come up with is a "lite