Skip Menu |
 

This queue is for tickets about the Module-Util CPAN distribution.

Report information
The Basics
Id: 79930
Status: open
Priority: 0/
Queue: Module-Util

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: suggest namespace immediate children
Date: Sun, 30 Sep 2012 10:53:29 +1000
To: bug-Module-Util [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 642b
I've wanted in a couple of places to find only the immediate children of a namespace. So find("Foo") would give "Foo::Bar" but not descend to "Foo::Bar::Subpart" etc. As an idea for a feature, perhaps a variation on find_in_namespace() could look only for such one-level sub-names. I wouldn't want the given "Foo" included in the return, the same as it's not included in find_in_namespace(). Dunno what a good function name might be. find_submodules("Foo",@inc) perhaps, if that suggested one-level rather than whole namespace ... -- Restaurant jargon elucidated for the layman: "Special" -- almost gone off so has to be sold today.
Download (untitled) / with headers
text/plain 796b
On Sat Sep 29 20:53:45 2012, user42@zip.com.au wrote: Show quoted text
> I've wanted in a couple of places to find only the immediate children of > a namespace. So find("Foo") would give "Foo::Bar" but not descend to > "Foo::Bar::Subpart" etc. > > As an idea for a feature, perhaps a variation on find_in_namespace() > could look only for such one-level sub-names. I wouldn't want the given > "Foo" included in the return, the same as it's not included in > find_in_namespace(). Dunno what a good function name might be. > find_submodules("Foo",@inc) perhaps, if that suggested one-level rather > than whole namespace ... >
find_submodules works for me. I can't say I've ever needed that myself, but if you have someone else must have. It should be fairly straightforward to do, if I can only find the time.
Subject: Re: [rt.cpan.org #79930] suggest namespace immediate children
Date: Wed, 10 Oct 2012 10:56:47 +1100
To: bug-Module-Util [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 498b
"Matthew Lawrence via RT" <bug-Module-Util@rt.cpan.org> writes: Show quoted text
> > find_submodules
I was nosing around Lingua::Any::Numbers which does a lot of readdirs and catfiles etc to find two-level modules roughly Lingua::([A-Z]+)::(Numbers|Numeros|Num2Word) Maybe some sort of find-by-pattern could be interesting. Or a module names walker with a callback or a limited depth. Too much generality might be both hard work and not much use, but if a traversal or a few things could be done cleanly ...
On Tue Oct 09 19:57:58 2012, user42@zip.com.au wrote: Show quoted text
> "Matthew Lawrence via RT" <bug-Module-Util@rt.cpan.org> writes:
> > > > find_submodules
> > I was nosing around Lingua::Any::Numbers which does a lot of readdirs > and catfiles etc to find two-level modules roughly > > Lingua::([A-Z]+)::(Numbers|Numeros|Num2Word) > > Maybe some sort of find-by-pattern could be interesting. Or a module > names walker with a callback or a limited depth. Too much generality > might be both hard work and not much use, but if a traversal or a few > things could be done cleanly ...
It seems like this could be done by exposing more of File::Find's interface, this example could have been done by adding maxdepth => 2 and grepping the results, although that might still be wasteful given that the leaf names are effectively constants. Perhaps using File::Find::Rule would make the interface cleaner, it might be possible to hook in some extra rules specific to modules. FWIW it looks like Module::Find's findsubmod function does exactly what you originally wanted.
Subject: Re: [rt.cpan.org #79930] suggest namespace immediate children
Date: Sun, 14 Oct 2012 11:54:11 +1100
To: bug-Module-Util [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 227b
"Matthew Lawrence via RT" <bug-Module-Util@rt.cpan.org> writes: Show quoted text
> > FWIW it looks like Module::Find's findsubmod function does exactly what > you originally wanted.
Ah, yes. I forget why I thought Module::Util was better :).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.