Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Module::Pluggable

0 views
Skip to first unread message

Jens Rehsack

unread,
Aug 6, 2010, 4:24:29 AM8/6/10
to Simon Wistow, mod...@perl.org
On 07/15/10 07:21, Jens Rehsack wrote:
> Hi Simon,

Hi Simon (again),

> I use Module::Pluggable often and like it. But for my current work on
> DBD::Sys, I could need a new feature - min_search_depth and
> max_search_depth. Instead of opening ignored RT No°10 - I offer you
> help: if you don't have time to maintain it anymore, I'd love to care
> for you.

I neither received a response (I'm busy) nor anyone on #p5p on
irc.perl.org has seen you for ages. Are you seriously sick? Did you
resign and want see no mails anymore? Are you on a long vacation
without mail access?

Would you please be so kind and give me a time frame when you're
back again? Or can you simply login to PAUSE and give me the permissions
to handle the RT tickets for Module::Pluggable (if you have an accessible
repository, getting at least read access would be great).

Best regards,
Jens

Simon Wistow

unread,
Aug 6, 2010, 6:09:15 PM8/6/10
to Jens Rehsack, mod...@perl.org
On Fri, Aug 06, 2010 at 08:24:29AM +0000, Jens Rehsack said:
> Would you please be so kind and give me a time frame when you're
> back again? Or can you simply login to PAUSE and give me the permissions
> to handle the RT tickets for Module::Pluggable (if you have an accessible
> repository, getting at least read access would be great).

Sorry - things have been a little crazy and apparently I missed your
last mail.

The SVN respository is

https://svn.unixbeard.net/simon/Module-Pluggable/

I'm a little gun shy adding even more options to the module since it's
already getting quite bloated. I'll have a look at implementing the
search depth stuff and get back to you.

That said - the point of seperating the code out into Module::Pluggable
and a Module::Pluggable::Object class was so that people wouldn't need
me to keep adidng features. So for example you could do (off the top of
my head and not tested)

------- >8 -------

package Module::Pluggable::::Object::Jens;

use base qw(Module::Pluggable::Object);

sub find_files {
my $self = shift;
my $search_path = shift;
my $file_regex = $self->{'file_regex'} || qr/\.pm$/;
my $min_depth = $self->{'min_depth'};
my $max_depth = $self->{'max_depth'};

# find all the .pm files in it
# this isn't perfect and won't find multiple plugins per file
#my $cwd = Cwd::getcwd;
my @files = ();
{ # for the benefit of perl 5.6.1's Find, localize topic
local $_;
File::Find::find( { no_chdir => 1, wanted => sub {
# check if this matches our optional depth criteria
my $depth = _get_depth($File::Find::name);
return if ($min_depth && $depth<$min_depth) ||
($max_depth && $depth>$max_depth);


return unless $File::Find::name =~
/$file_regex/;
(my $path = $File::Find::name) =~
s#^\\./##;
push @files, $path;
}
}, $search_path );
}
#chdir $cwd;
return @files;

}

1;

------- >8 -------


Hope that helps and sorry to keep you hanging.

Simon

0 new messages