rkg has asked for the wisdom of the Perl Monks concerning the following question:
Each module or program I'm writing as part of a larger system starts with the same litany of 'use' code. I feel like I am typing the same structural code over and over, then woe to me should I need to make a change (as when I recently decided to use the warnings pragma throughout).
Would it be considered Bad Form to toss all of these into a Common.pm file and then require them? My thought is to start each module withuse strict; use warnings; package Foo::Bar; use Data::Dumper; use Log::Log4perl; my $log = Log::Log4perl->get_logger(__PACKAGE__); use MyDBI; use MyLWP; etc etc etc
Any pitfalls of this? Would I want a "use" or a "require" here? Would each package get their own copy of $log with the correct package name?package Foo::Bar; require Common;
Thanks for your advice.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: standard require
by broquaint (Abbot) on Apr 23, 2003 at 10:10 UTC | |
|
Re: standard require
by Abigail-II (Bishop) on Apr 23, 2003 at 10:11 UTC | |
|
Re: standard require
by demerphq (Chancellor) on Apr 23, 2003 at 10:11 UTC | |
|
Re: standard require
by zby (Vicar) on Apr 23, 2003 at 10:10 UTC | |
|
Re: standard require
by nothingmuch (Priest) on Apr 23, 2003 at 14:44 UTC |