added "return => name" to WebGUI::Pluggable::find

This commit is contained in:
Doug Bell 2008-10-27 16:54:19 +00:00
parent 314035912d
commit 4b120ad17c
2 changed files with 14 additions and 2 deletions

View file

@ -70,6 +70,7 @@ Return an array of all the modules in the given namespace. Will search all
onelevel => If true, only find sub modules (children), no deeper
find( "CGI", { onelevel => 1 } ) would match "CGI::Session" but
not "CGI::Session::File"
return => "name" - Return just the last part of the package, so CGI::Session would return "Session"
=cut
@ -111,6 +112,12 @@ sub find {
@modules = keys %modulesHash;
}
### Return valu
# If "name", just grab the last part
if ( $options->{ return } eq "name" ) {
@modules = map { /::([^:]+)$/; $1 } @modules;
}
return @modules;
}