Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2889/lib/OpenInteract2
Modified Files:
Util.pm
Log Message:
assume @INC in find_factry_subclasses() unless other directories given
Index: Util.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Util.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** Util.pm 8 Feb 2005 01:12:35 -0000 1.19
--- Util.pm 13 Feb 2005 20:22:52 -0000 1.20
***************
*** 305,309 ****
sub find_factory_subclasses {
my ( $class, $factory_class, @dirs ) = @_;
!
%FACTORY_FILES = ();
--- 305,311 ----
sub find_factory_subclasses {
my ( $class, $factory_class, @dirs ) = @_;
! unless ( @dirs ) {
! @dirs = @INC;
! }
%FACTORY_FILES = ();
***************
*** 337,340 ****
--- 339,343 ----
# messages under '-w', irritating.
+ my @included = ();
foreach my $factory_subclass ( sort keys %FACTORY_CLASSES ) {
eval "require $factory_subclass";
***************
*** 342,346 ****
--- 345,353 ----
carp "Failed to bring in library '$factory_subclass': $@";
}
+ else {
+ push @included, $factory_subclass;
+ }
}
+ return @included;
}
***************
*** 573,585 ****
=head1 FACTORY SUBCLASSES
! B<find_factory_subclasses( $factory_class, @directories )>
! Finds all subclasses of C<$factory_class> using C<@directories> as the
! list of directories from which to start. So to discover all the
L<OpenInteract2::Manage> subclasses from all Perl module directories
we would do:
OpenInteract2::Util->find_factory_subclasses(
! 'OpenInteract2::Manage', @INC
);
--- 580,593 ----
=head1 FACTORY SUBCLASSES
! B<find_factory_subclasses( $factory_class, [ @directories ] )>
! Finds and requires all subclasses of C<$factory_class> using
! C<@directories> as the list of directories from which to start. (If
! C<@directories> not given we use C<@INC>.) So to discover all the
L<OpenInteract2::Manage> subclasses from all Perl module directories
we would do:
OpenInteract2::Util->find_factory_subclasses(
! 'OpenInteract2::Manage',
);
***************
*** 591,594 ****
--- 599,604 ----
);
+ Returns a list of all the classes included.
+
=head1 TO DO
|