NAME
Module::Collect - module files are collected from some directories
SYNOPSIS
use Module::Collect;
my $collect = Module::Collect->new(
path => '/foo/bar/plugins',
prefix => 'MyApp::Plugin', # not required option
pattern => '*.pm', # not required option
);
my @modules = @{ $collect->modules };
for my $module (@modules) {
print $module->{path};
print $module->{package};
}
DESCRIPTION
The following directory composition
$ ls -R t/plugins
t/plugins:
empty.pm foo foo.pm pod.pm withcomment.pm withpod.pm
t/plugins/foo:
bar.pm baz.plugin
The following code is executed
use strict;
use warnings;
use Module::Collect;
use Perl6::Say;
my $c = Module::Collect->new( path => 't/plugins' );
for my $module (@{ $c->modules }) {
say $module->{package} . ', ', $module->{path};
}
results
MyApp::Foo, plugins/foo.pm
With::Comment, plugins/withcomment.pm
With::Pod, plugins/withpod.pm
MyApp::Foo::Bar, plugins/foo/bar.pm
AUTHOR
Kazuhiro Osawa <ko@yappo.ne.jp>
INSPIRED BY
REPOSITORY
svn co http://svn.coderepos.org/share/lang/perl/Module-Collect/trunk Module-Collect
Module::Collect is Subversion repository is hosted at http://coderepos.org/share/. patches and collaborators are welcome.
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.