[Bps-public-commit] r14879 - in Class-Require/trunk: lib/Class t
sartak at bestpractical.com
sartak at bestpractical.com
Wed Aug 6 20:09:15 EDT 2008
Author: sartak
Date: Wed Aug 6 20:09:15 2008
New Revision: 14879
Modified:
Class-Require/trunk/ (props changed)
Class-Require/trunk/lib/Class/Require.pm
Class-Require/trunk/t/001-is-class-loaded.t
Log:
r68910 at onn: sartak | 2008-08-06 20:08:26 -0400
Step 1: check %INC
Modified: Class-Require/trunk/lib/Class/Require.pm
==============================================================================
--- Class-Require/trunk/lib/Class/Require.pm (original)
+++ Class-Require/trunk/lib/Class/Require.pm Wed Aug 6 20:09:15 2008
@@ -22,6 +22,10 @@
sub is_class_loaded {
my $class = shift;
+ my $file = (join '/', split '::', $class) . '.pm';
+ return 1 if $INC{$file};
+
+ return 0;
}
1;
Modified: Class-Require/trunk/t/001-is-class-loaded.t
==============================================================================
--- Class-Require/trunk/t/001-is-class-loaded.t (original)
+++ Class-Require/trunk/t/001-is-class-loaded.t Wed Aug 6 20:09:15 2008
@@ -3,8 +3,9 @@
use warnings;
use Test::More tests => 2;
-use Class::Require ':all';
+use Class::Require 'is_class_loaded';
ok(is_class_loaded('Class::Require'), "Class::Require is loaded");
+
ok(!is_class_loaded('Class::Require::NONEXISTENT'), "nonexistent class is NOT loaded");
More information about the Bps-public-commit
mailing list