[Catalyst-commits] r9687 - in trunk/CatalystX-Imports: .
lib/CatalystX lib/CatalystX/Imports
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Mon Apr 13 14:46:23 GMT 2009
Author: rafl
Date: 2009-04-13 15:46:22 +0100 (Mon, 13 Apr 2009)
New Revision: 9687
Modified:
trunk/CatalystX-Imports/Makefile.PL
trunk/CatalystX-Imports/lib/CatalystX/Imports.pm
trunk/CatalystX-Imports/lib/CatalystX/Imports/Context.pm
Log:
Use Class::MOP::load_class instead of a custom _ensure_class_loaded method.
Modified: trunk/CatalystX-Imports/Makefile.PL
===================================================================
--- trunk/CatalystX-Imports/Makefile.PL 2009-04-13 14:46:13 UTC (rev 9686)
+++ trunk/CatalystX-Imports/Makefile.PL 2009-04-13 14:46:22 UTC (rev 9687)
@@ -11,6 +11,7 @@
requires q{Carp::Clan}, 0;
requires q{Filter::EOF}, '0.02';
+requires q{Class::MOP}, 0;
requires q{Class::Inspector}, 0;
requires q{List::MoreUtils}, '0.19';
requires q{Scalar::Util}, '1.19';
Modified: trunk/CatalystX-Imports/lib/CatalystX/Imports/Context.pm
===================================================================
--- trunk/CatalystX-Imports/lib/CatalystX/Imports/Context.pm 2009-04-13 14:46:13 UTC (rev 9686)
+++ trunk/CatalystX-Imports/lib/CatalystX/Imports/Context.pm 2009-04-13 14:46:22 UTC (rev 9687)
@@ -18,6 +18,7 @@
use base 'CatalystX::Imports';
use vars qw( $EXPORT_MAP_NAME $DEFAULT_LIBRARY );
+use Class::MOP;
use List::MoreUtils qw( part apply uniq );
use Scalar::Util qw( set_prototype );
use Carp::Clan qw{ ^CatalystX::Imports(?:::|$) };
@@ -275,7 +276,7 @@
# load libraries and export symbols
for my $lib (keys %args) {
my $lib_class = __PACKAGE__ . '::' . $lib;
- $class->_ensure_class_loaded($lib_class);
+ Class::MOP::load_class($lib_class);
my @symbols = @{ $args{ $lib } };
push @symbols, $lib_class->default_exports
if $load_default{ $lib };
Modified: trunk/CatalystX-Imports/lib/CatalystX/Imports.pm
===================================================================
--- trunk/CatalystX-Imports/lib/CatalystX/Imports.pm 2009-04-13 14:46:13 UTC (rev 9686)
+++ trunk/CatalystX-Imports/lib/CatalystX/Imports.pm 2009-04-13 14:46:22 UTC (rev 9687)
@@ -15,7 +15,7 @@
$ACTION_WRAPPER_VAR
);
-use Class::Inspector;
+use Class::MOP;
use Carp::Clan qw{ ^CatalystX::Imports(?:::|$) };
use Filter::EOF;
use Sub::Name 'subname';
@@ -279,33 +279,13 @@
# to the target class
for my $exporter (keys %exporters) {
my $exporter_class = __PACKAGE__ . "::$exporter";
- $class->_ensure_class_loaded($exporter_class);
+ Class::MOP::load_class($exporter_class);
$exporter_class->export_into($target, $exporters{ $exporter });
}
return 1;
}
-=head2 _ensure_class_loaded
-
-Convenience method that tries to requires the passed package if it isn't
-already loaded. Will return -1 if it had to be required, and 1 if it was
-already loaded.
-
-=cut
-
-sub _ensure_class_loaded {
- my ($class, $target) = @_;
-
- # load the class only once
- unless (Class::Inspector->loaded($target)) {
- require Class::Inspector->filename($target);
- return -1;
- }
-
- return 1;
-}
-
=head2 resolve_component
Some functionality will allow you to prefix used components with a
More information about the Catalyst-commits
mailing list