Class-Load

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


- BACK COMPAT CHANGE: Remove $Class::Load::ERROR in favor of a contextual
  return value. ( Jesse Luehrs )

- Add load_optional_class($class) that fails only if there is a problem with
  the attempted-to-load $class. ( Kent Fredric )

- Force internal require to try-again if we are SURE the class is not
  there. This produces reliable errors. ( Kent Fredric )

- Replace Test::Exception with Test::Fatal ( Kent Fredric )

0.05     2009-09-02

- Cargo-cult Class::MOP's is_class_loaded so we work on 5.10

0.04     2008-11-09

- No changes

0.03     2008-11-09

META.json  view on Meta::CPAN

            "warnings" : "0"
         }
      },
      "test" : {
         "recommends" : {
            "CPAN::Meta" : "2.120900"
         },
         "requires" : {
            "ExtUtils::MakeMaker" : "0",
            "File::Spec" : "0",
            "Test::Fatal" : "0",
            "Test::More" : "0.88",
            "Test::Needs" : "0",
            "constant" : "0",
            "lib" : "0",
            "perl" : "5.006",
            "version" : "0"
         }
      },
      "x_Dist_Zilla" : {
         "requires" : {

META.yml  view on Meta::CPAN

---
abstract: 'A working (require "Class::Name") and more'
author:
  - 'Shawn M Moore <sartak at bestpractical.com>'
build_requires:
  ExtUtils::MakeMaker: '0'
  File::Spec: '0'
  Test::Fatal: '0'
  Test::More: '0.88'
  Test::Needs: '0'
  constant: '0'
  lib: '0'
  perl: '5.006'
  version: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
  perl: '5.006'
dynamic_config: 0

Makefile.PL  view on Meta::CPAN

    "Package::Stash" => "0.14",
    "Scalar::Util" => 0,
    "Try::Tiny" => 0,
    "base" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0,
    "File::Spec" => 0,
    "Test::Fatal" => 0,
    "Test::More" => "0.88",
    "Test::Needs" => 0,
    "constant" => 0,
    "lib" => 0,
    "version" => 0
  },
  "VERSION" => "0.25",
  "test" => {
    "TESTS" => "t/*.t"
  }

Makefile.PL  view on Meta::CPAN

my %FallbackPrereqs = (
  "Carp" => 0,
  "Data::OptList" => "0.110",
  "Exporter" => 0,
  "ExtUtils::MakeMaker" => 0,
  "File::Spec" => 0,
  "Module::Implementation" => "0.04",
  "Module::Runtime" => "0.012",
  "Package::Stash" => "0.14",
  "Scalar::Util" => 0,
  "Test::Fatal" => 0,
  "Test::More" => "0.88",
  "Test::Needs" => 0,
  "Try::Tiny" => 0,
  "base" => 0,
  "constant" => 0,
  "lib" => 0,
  "strict" => 0,
  "version" => 0,
  "warnings" => 0
);

t/00-report-prereqs.dd  view on Meta::CPAN

                                      'warnings' => '0'
                                    }
                    },
       'test' => {
                   'recommends' => {
                                     'CPAN::Meta' => '2.120900'
                                   },
                   'requires' => {
                                   'ExtUtils::MakeMaker' => '0',
                                   'File::Spec' => '0',
                                   'Test::Fatal' => '0',
                                   'Test::More' => '0.88',
                                   'Test::Needs' => '0',
                                   'constant' => '0',
                                   'lib' => '0',
                                   'perl' => '5.006',
                                   'version' => '0'
                                 }
                 },
       'x_Dist_Zilla' => {
                           'requires' => {

t/003-load-class.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.88;
use lib 't/lib';
use Test::Class::Load ':all';
use Test::Fatal;

is( load_class('Class::Load::OK'), 'Class::Load::OK', 'loaded class OK' );
is( $Class::Load::ERROR, undef, 'ERROR is undef' );

like(
    exception {
        load_class('Class::Load::Nonexistent');
    },
    qr{^Can't locate Class/Load/Nonexistent.pm in \@INC},
    'threw exception for nonexistent class'

t/004-load-double.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More 0.88;
use lib 't/lib';
use Test::Class::Load ':all';
use Test::Fatal;

# This test does 2 things.
# Firstly, confirm that on 5.8, load_class will
# still throw an exception, even if it's been loaded before:
#
#    eval { require Foo; }; require Foo; # doesn't error on 5.8
#
# Secondly, to ensure errors thrown are useful.
# ( As without the code in load_class to delete $INC{file}
#    it will just die with "COMPILATION ERROR", which is

t/005-load-optional.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More 0.88;
use Test::Fatal;
use lib 't/lib';
use Test::Class::Load qw( :all );

is(
  exception {
    load_optional_class('Class::Load::OK');
  },
  undef,
  'No failure loading a good class'
);

t/007-first-existing.t  view on Meta::CPAN

use strict;
use warnings;
use Test::Fatal;
use Test::More 0.88;
use lib 't/lib';
use Test::Class::Load 'load_first_existing_class';

is(
    load_first_existing_class(
        'Class::Load::Nonexistent', 'Class::Load::OK'
    ),
    'Class::Load::OK',
    'load_first_existing_class ignore nonexistent class'

t/008-gvstash-bug.t  view on Meta::CPAN

use strict;
use warnings;
use Test::Fatal;
use Test::More 0.88;
use lib 't/lib';
use Test::Class::Load 'load_class';

is( exception {
    load_class('Class::Load::Stash::Sub');
}, undef, 'Loaded Class::Load::Stash::Sub' );

Class::Load::Stash->can('a_method');

t/009-invalid-module-name.t  view on Meta::CPAN

use strict;
use warnings;
use Test::Fatal;
use Test::More 0.88;
use lib 't/lib';
use Test::Class::Load 'load_class';

my @bad = qw(
    Foo:Bar
    123
    Foo::..::..::tmp::bad.pl
    ::..::tmp::bad
    ''tmp

t/010-isa-false-positive.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.88;
use Test::Fatal;

use lib 't/lib';
use Test::Class::Load 'load_optional_class';

isnt(
    exception {
        load_optional_class('Class::Load::Error::DieAfterIsa');
    },
    undef,
    'Class which calls die is reported as an error'

t/012-without-implementation.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.88;
use Test::Fatal;

use Test::Needs 'Test::Without::Module';

Test::Without::Module->import(qw( Class::Load::PP Class::Load::XS ));

{
    like(
        exception { require Class::Load },
        qr!Can't locate Class.Load.PP\.pm in \@INC|Class.Load.PP\.pm did not return a true value!,
        'error when loading Class::Load and no implementation is available includes errors from trying to load modules'

t/014-weird-constants.t  view on Meta::CPAN

use strict;
use warnings;

use Test::Fatal;
use Test::More 0.88;

use lib 't/lib';
use Test::Class::Load ':all';

{
    package ConstantISA;

    use constant ISA => 1;
}



( run in 2.273 seconds using v1.01-cache-2.11-cpan-54e63673c56 )