[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Drop-in modules



>>>>> "Peter" == Peter Scott <Peter@PSDT.com> writes:

Peter>   foreach my $mod (map { /(.*)\.pm$/; $1 } grep /\.pm$/, sort readdir DIR)

Ugh.  That map-grep smells.  How about:

for my $mod (sort map { /(.*)\.pm$/ ? $1 : () } readdir DIR)

Peter>     eval "require \"$file\"";
Peter>     die "Couldn't load $file: $@\n" if $@;

Uh, if you can't load $file, let the require fail!

	require $file;

:-)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org