GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MODULE::COLLECT (3)

.ds Aq ’

NAME

Module::Collect - Collect sub-modules in directories

CONTENTS

SYNOPSIS



  use Module::Collect;
  my $collect = Module::Collect->new(
      path     => /foo/bar/plugins,
      prefix   => MyApp::Plugin, # optional
      pattern  => *.pm,          # optional
      multiple => 1,               # optional, see t/06_multiple.t
  );

  my @modules = @{ $collect->modules };
  for my $module (@modules) {
      print $module->path;    # package fuke oatg
      print $module->package; # package name
      $module->require;       # require package
      my $obj = $module->new; # aliae for $module->package->new
  }



DESCRIPTION

Module::Collect finds sub-modules, or plugins in directories.

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;
      $module->require;
  }



results



  MyApp::Foo, t/plugins/foo.pm
  With::Comment, t/plugins/withcomment.pm
  With::Pod, t/plugins/withpod.pm
  MyApp::Foo::Bar, t/plugins/foo/bar.pm



AUTHOR

Kazuhiro Osawa <ko@yappo.ne.jp>

lopnor

gfx

mattn

INSPIRED BY

Plagger, Module::Pluggable

SEE ALSO

Module::Collect::Package

REPOSITORY



  git clone git://github.com/yappo/p5-Module-Collect.git



Module::Collect is git repository is hosted at <http://github.com/yappo/p5-Module-Collect>. 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.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MODULE::COLLECT (3) 2010-02-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.