Mailinglist Archive: opensuse-commit (1903 mails)

< Previous Next >
commit perl-Class-Inspector for openSUSE:Factory
Hello community,

here is the log from the commit of package perl-Class-Inspector for
openSUSE:Factory checked in at 2019-04-02 09:17:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Class-Inspector (Old)
and /work/SRC/openSUSE:Factory/.perl-Class-Inspector.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Class-Inspector"

Tue Apr 2 09:17:34 2019 rev:32 rq:689720 version:1.34

Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Class-Inspector/perl-Class-Inspector.changes
2017-08-19 10:55:37.495162779 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Class-Inspector.new.25356/perl-Class-Inspector.changes
2019-04-02 09:17:35.572486801 +0200
@@ -1,0 +2,12 @@
+Fri Mar 29 06:06:42 UTC 2019 - Stephan Kulow <coolo@xxxxxxxx>
+
+- updated to 1.34
+ see /usr/share/doc/packages/perl-Class-Inspector/Changes
+
+ 1.34 2019-03-28 12:13:40 -0400
+ - Producton release identical to 1.33_01
+
+ 1.33_01 2019-03-27 23:30:09 -0400
+ - Fix compatability with Devel::Hide (gh#6, gh#8).
+
+-------------------------------------------------------------------

Old:
----
Class-Inspector-1.32.tar.gz

New:
----
Class-Inspector-1.34.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Class-Inspector.spec ++++++
--- /var/tmp/diff_new_pack.HWilPV/_old 2019-04-02 09:17:37.196488627 +0200
+++ /var/tmp/diff_new_pack.HWilPV/_new 2019-04-02 09:17:37.224488659 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Class-Inspector
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,25 +12,25 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name: perl-Class-Inspector
-Version: 1.32
+Version: 1.34
Release: 0
%define cpan_name Class-Inspector
Summary: Get information about a class and its structure
-License: Artistic-1.0 or GPL-1.0+
+License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
-Url: http://search.cpan.org/dist/Class-Inspector/
+Url: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
-BuildRequires: perl(Test::More) >= 0.94
+BuildRequires: perl(Test::More) >= 0.98
%{perl_requires}

%description
@@ -42,13 +42,14 @@

%prep
%setup -q -n %{cpan_name}-%{version}
+find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644

%build
-%{__perl} Makefile.PL INSTALLDIRS=vendor
-%{__make} %{?_smp_mflags}
+perl Makefile.PL INSTALLDIRS=vendor
+make %{?_smp_mflags}

%check
-%{__make} test
+make test

%install
%perl_make_install

++++++ Class-Inspector-1.32.tar.gz -> Class-Inspector-1.34.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/Changes
new/Class-Inspector-1.34/Changes
--- old/Class-Inspector-1.32/Changes 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/Changes 2019-03-28 17:13:43.000000000 +0100
@@ -1,5 +1,11 @@
Revision history for Perl extension Class-Inspector

+1.34 2019-03-28 12:13:40 -0400
+ - Producton release identical to 1.33_01
+
+1.33_01 2019-03-27 23:30:09 -0400
+ - Fix compatability with Devel::Hide (gh#6, gh#8).
+
1.32 2017-08-08 14:12:42 -0400
- The installed method now supports @INC hooks of any type
(coderef was supported as of 1.29, now arrayrefs and objects
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/INSTALL
new/Class-Inspector-1.34/INSTALL
--- old/Class-Inspector-1.32/INSTALL 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/INSTALL 2019-03-28 17:13:43.000000000 +0100
@@ -22,7 +22,7 @@
## Manual installation

As a last resort, you can manually install it. Download the tarball, untar it,
-then build it:
+install configure prerequisites (see below), then build it:

% perl Makefile.PL
% make && make test
@@ -31,13 +31,42 @@

% make install

+On Windows platforms, you should use `dmake` or `nmake`, instead of `make`.
+
If your perl is system-managed, you can create a local::lib in your home
directory to install modules to. For details, see the local::lib documentation:
https://metacpan.org/pod/local::lib

+The prerequisites of this distribution will also have to be installed
manually. The
+prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json`
generated
+by running the manual build process described above.
+
+## Configure Prerequisites
+
+This distribution requires other modules to be installed before this
+distribution's installer can be run. They can be found under the
+"configure_requires" key of META.yml or the
+"{prereqs}{configure}{requires}" key of META.json.
+
+## Other Prerequisites
+
+This distribution may require additional modules to be installed after running
+Makefile.PL.
+Look for prerequisites in the following phases:
+
+* to run make, PHASE = build
+* to use the module code itself, PHASE = runtime
+* to run tests, PHASE = test
+
+They can all be found in the "PHASE_requires" key of MYMETA.yml or the
+"{prereqs}{PHASE}{requires}" key of MYMETA.json.
+
## Documentation

Class-Inspector documentation is available as POD.
-You can run perldoc from a shell to read the documentation:
+You can run `perldoc` from a shell to read the documentation:

% perldoc Class::Inspector
+
+For more information on installing Perl modules via CPAN, please see:
+https://www.cpan.org/modules/INSTALL.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/LICENSE
new/Class-Inspector-1.34/LICENSE
--- old/Class-Inspector-1.32/LICENSE 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/LICENSE 2019-03-28 17:13:43.000000000 +0100
@@ -1,4 +1,4 @@
-This software is copyright (c) 2016 by Adam Kennedy.
+This software is copyright (c) 2002-2019 by Adam Kennedy.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@

--- The GNU General Public License, Version 1, February 1989 ---

-This software is Copyright (c) 2016 by Adam Kennedy.
+This software is Copyright (c) 2002-2019 by Adam Kennedy.

This is free software, licensed under:

@@ -272,7 +272,7 @@

--- The Artistic License 1.0 ---

-This software is Copyright (c) 2016 by Adam Kennedy.
+This software is Copyright (c) 2002-2019 by Adam Kennedy.

This is free software, licensed under:

diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/MANIFEST
new/Class-Inspector-1.34/MANIFEST
--- old/Class-Inspector-1.32/MANIFEST 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/MANIFEST 2019-03-28 17:13:43.000000000 +0100
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest
v6.010.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest
v6.012.
Changes
INSTALL
LICENSE
@@ -8,15 +8,16 @@
Makefile.PL
README
author.yml
-cpanfile
dist.ini
lib/Class/Inspector.pm
lib/Class/Inspector/Functions.pm
+maint/cip-before-install
t/00_diag.t
-t/01_compile.t
-t/02_main.t
-t/03_inc_to_local.t
-t/04_main_functions.t
+t/01_use.t
+t/class_inspector.t
+t/class_inspector__devel_hide.t
+t/class_inspector__inc_to_local.t
+t/class_inspector_functions.t
xt/author/eol.t
xt/author/no_tabs.t
xt/author/pod.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/META.json
new/Class-Inspector-1.34/META.json
--- old/Class-Inspector-1.32/META.json 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/META.json 2019-03-28 17:13:43.000000000 +0100
@@ -5,7 +5,7 @@
"Adam Kennedy <adamk@xxxxxxxx>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version
2.150010",
+ "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version
2.150010",
"license" : [
"perl_5"
],
@@ -26,7 +26,7 @@
"FindBin" : "0",
"Test::EOL" : "0",
"Test::Fixme" : "0.07",
- "Test::More" : "0.94",
+ "Test::More" : "0.98",
"Test::NoTabs" : "0",
"Test::Pod" : "0",
"Test::Pod::Coverage" : "0",
@@ -43,7 +43,7 @@
},
"test" : {
"requires" : {
- "Test::More" : "0.94",
+ "Test::More" : "0.98",
"perl" : "5.006"
}
}
@@ -51,11 +51,11 @@
"provides" : {
"Class::Inspector" : {
"file" : "lib/Class/Inspector.pm",
- "version" : "1.32"
+ "version" : "1.34"
},
"Class::Inspector::Functions" : {
"file" : "lib/Class/Inspector/Functions.pm",
- "version" : "1.32"
+ "version" : "1.34"
}
},
"release_status" : "stable",
@@ -70,7 +70,7 @@
"web" : "https://github.com/plicease/Class-Inspector";
}
},
- "version" : "1.32",
+ "version" : "1.34",
"x_contributors" : [
"Adam Kennedy <adamk@xxxxxxxx>",
"Graham Ollis <plicease@xxxxxxxx>",
@@ -78,6 +78,8 @@
"Steffen M\u00fcller",
"Kivanc Yazan (KYZN)"
],
- "x_serialization_backend" : "Cpanel::JSON::XS version 3.0237"
+ "x_generated_by_perl" : "v5.26.2",
+ "x_serialization_backend" : "Cpanel::JSON::XS version 4.09",
+ "x_use_unsafe_inc" : 0
}

diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/META.yml
new/Class-Inspector-1.34/META.yml
--- old/Class-Inspector-1.32/META.yml 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/META.yml 2019-03-28 17:13:43.000000000 +0100
@@ -4,13 +4,13 @@
- 'Graham Ollis <plicease@xxxxxxxx>'
- 'Adam Kennedy <adamk@xxxxxxxx>'
build_requires:
- Test::More: '0.94'
+ Test::More: '0.98'
perl: '5.006'
configure_requires:
ExtUtils::MakeMaker: '0'
perl: '5.006'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version
2.150010'
+generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version
2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -19,10 +19,10 @@
provides:
Class::Inspector:
file: lib/Class/Inspector.pm
- version: '1.32'
+ version: '1.34'
Class::Inspector::Functions:
file: lib/Class/Inspector/Functions.pm
- version: '1.32'
+ version: '1.34'
requires:
File::Spec: '0.80'
perl: '5.006'
@@ -30,11 +30,13 @@
bugtracker: https://github.com/plicease/Class-Inspector/issues
homepage: https://metacpan.org/pod/Class::Inspector
repository: git://github.com/plicease/Class-Inspector.git
-version: '1.32'
+version: '1.34'
x_contributors:
- 'Adam Kennedy <adamk@xxxxxxxx>'
- 'Graham Ollis <plicease@xxxxxxxx>'
- 'Tom Wyant'
- 'Steffen Müller'
- 'Kivanc Yazan (KYZN)'
-x_serialization_backend: 'YAML::Tiny version 1.70'
+x_generated_by_perl: v5.26.2
+x_serialization_backend: 'YAML::Tiny version 1.73'
+x_use_unsafe_inc: 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/Makefile.PL
new/Class-Inspector-1.34/Makefile.PL
--- old/Class-Inspector-1.32/Makefile.PL 2017-08-08 20:12:46.000000000
+0200
+++ new/Class-Inspector-1.34/Makefile.PL 2019-03-28 17:13:43.000000000
+0100
@@ -1,5 +1,5 @@
-use strict; use warnings;
BEGIN {
+ use strict; use warnings;
{
my $fn = 'Class/Inspector.pm';
unless(index('lib/Class/Inspector.pm', $fn) ==
index('lib/Class/Inspector.pm', 'Class/Inspector.pm'))
@@ -16,47 +16,43 @@
exit;
}
}
-# This file was automatically generated by
Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.21.
+# This file was automatically generated by
Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.36.
use strict;
use warnings;
-
use 5.006;
-
use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
- "ABSTRACT" => "Get information about a class and its structure",
- "AUTHOR" => "Graham Ollis <plicease\@cpan.org>, Adam Kennedy
<adamk\@cpan.org>",
+ "ABSTRACT" => "Get information about a class and its structure",
+ "AUTHOR" => "Graham Ollis <plicease\@cpan.org>, Adam Kennedy
<adamk\@cpan.org>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
- "DISTNAME" => "Class-Inspector",
- "LICENSE" => "perl",
+ "DISTNAME" => "Class-Inspector",
+ "LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.006",
- "NAME" => "Class::Inspector",
- "PM" => {
- "lib/Class/Inspector.pm" => "\$(INST_LIB)/Class/Inspector.pm",
+ "NAME" => "Class::Inspector",
+ "PM" => {
+ "lib/Class/Inspector.pm" => "\$(INST_LIB)/Class/Inspector.pm",
"lib/Class/Inspector/Functions.pm" =>
"\$(INST_LIB)/Class/Inspector/Functions.pm"
},
"PREREQ_PM" => {
"File::Spec" => "0.80"
},
"TEST_REQUIRES" => {
- "Test::More" => "0.94"
+ "Test::More" => "0.98"
},
- "VERSION" => "1.32",
- "test" => {
+ "VERSION" => "1.34",
+ "test" => {
"TESTS" => "t/*.t"
}
);

-
my %FallbackPrereqs = (
"File::Spec" => "0.80",
- "Test::More" => "0.94"
+ "Test::More" => "0.98"
);

-
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
@@ -66,4 +62,4 @@
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

-WriteMakefile(%WriteMakefileArgs);
+WriteMakefile(%WriteMakefileArgs);
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/README
new/Class-Inspector-1.34/README
--- old/Class-Inspector-1.32/README 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/README 2019-03-28 17:13:43.000000000 +0100
@@ -4,7 +4,7 @@

VERSION

- version 1.32
+ version 1.34

SYNOPSIS

@@ -248,7 +248,7 @@

COPYRIGHT AND LICENSE

- This software is copyright (c) 2016 by Adam Kennedy.
+ This software is copyright (c) 2002-2019 by Adam Kennedy.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/cpanfile
new/Class-Inspector-1.34/cpanfile
--- old/Class-Inspector-1.32/cpanfile 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/cpanfile 1970-01-01 01:00:00.000000000 +0100
@@ -1,25 +0,0 @@
-requires "File::Spec" => "0.80";
-requires "perl" => "5.006";
-
-on 'test' => sub {
- requires "Test::More" => "0.94";
- requires "perl" => "5.006";
-};
-
-on 'configure' => sub {
- requires "ExtUtils::MakeMaker" => "0";
- requires "perl" => "5.006";
-};
-
-on 'develop' => sub {
- requires "FindBin" => "0";
- requires "Test::EOL" => "0";
- requires "Test::Fixme" => "0.07";
- requires "Test::More" => "0.94";
- requires "Test::NoTabs" => "0";
- requires "Test::Pod" => "0";
- requires "Test::Pod::Coverage" => "0";
- requires "Test::Pod::Spelling::CommonMistakes" => "0";
- requires "Test::Strict" => "0";
- requires "YAML" => "0";
-};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/dist.ini
new/Class-Inspector-1.34/dist.ini
--- old/Class-Inspector-1.32/dist.ini 2017-08-08 20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/dist.ini 2019-03-28 17:13:43.000000000 +0100
@@ -3,8 +3,8 @@
author = Adam Kennedy <adamk@xxxxxxxx>
license = Perl_5
copyright_holder = Adam Kennedy
-copyright_year = 2016
-version = 1.32
+copyright_year = 2002-2019
+version = 1.34

[@Author::Plicease]
:version = 2.21
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Class-Inspector-1.32/lib/Class/Inspector/Functions.pm
new/Class-Inspector-1.34/lib/Class/Inspector/Functions.pm
--- old/Class-Inspector-1.32/lib/Class/Inspector/Functions.pm 2017-08-08
20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/lib/Class/Inspector/Functions.pm 2019-03-28
17:13:43.000000000 +0100
@@ -7,7 +7,7 @@
use Class::Inspector ();

# ABSTRACT: Get information about a class and its structure
-our $VERSION = '1.32'; # VERSION
+our $VERSION = '1.34'; # VERSION

BEGIN {
our @ISA = 'Exporter';
@@ -58,7 +58,7 @@

=head1 VERSION

-version 1.32
+version 1.34

=head1 SYNOPSIS

@@ -129,7 +129,7 @@

=head1 COPYRIGHT AND LICENSE

-This software is copyright (c) 2016 by Adam Kennedy.
+This software is copyright (c) 2002-2019 by Adam Kennedy.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/lib/Class/Inspector.pm
new/Class-Inspector-1.34/lib/Class/Inspector.pm
--- old/Class-Inspector-1.32/lib/Class/Inspector.pm 2017-08-08
20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/lib/Class/Inspector.pm 2019-03-28
17:13:43.000000000 +0100
@@ -8,7 +8,7 @@
use File::Spec ();

# ABSTRACT: Get information about a class and its structure
-our $VERSION = '1.32'; # VERSION
+our $VERSION = '1.34'; # VERSION


# If Unicode is available, enable it so that the
@@ -34,12 +34,14 @@
sub _resolved_inc_handler {
my $class = shift;
my $filename = $class->_inc_filename(shift) or return undef;
-
+
foreach my $inc ( @INC ) {
my $ref = ref $inc;
if($ref eq 'CODE') {
my @ret = $inc->($inc, $filename);
- if(@ret) {
+ if(@ret == 1 && ! defined $ret[0]) {
+ # do nothing.
+ } elsif(@ret) {
return 1;
}
}
@@ -56,7 +58,7 @@
}
}
}
-
+
'';
}

@@ -231,7 +233,7 @@
foreach my $namespace ( @path ) {
my @functions = grep { ! $methods{$_} }
grep { /$RE_IDENTIFIER/o }
- grep { defined &{"${namespace}::$_"} }
+ grep { defined &{"${namespace}::$_"} }
keys %{"${namespace}::"};
foreach ( @functions ) {
$methods{$_} = $namespace;
@@ -245,8 +247,8 @@

# Return in the correct format
@methodlist = map { "$methods{$_}::$_" } @methodlist if $options{full};
- @methodlist = map {
- [ "$methods{$_}::$_", $methods{$_}, $_, \&{"$methods{$_}::$_"} ]
+ @methodlist = map {
+ [ "$methods{$_}::$_", $methods{$_}, $_, \&{"$methods{$_}::$_"} ]
} @methodlist if $options{expanded};

\@methodlist;
@@ -332,7 +334,7 @@
my $name = $class->_class(shift) or return ();
my @children = ( $name );

- # Do the search using a nicer, more memory efficient
+ # Do the search using a nicer, more memory efficient
# variant of actual recursion.
my $i = 0;
no strict 'refs';
@@ -404,7 +406,7 @@

=head1 VERSION

-version 1.32
+version 1.34

=head1 SYNOPSIS

@@ -432,7 +434,7 @@
Class::Inspector allows you to get information about a loaded class. Most or
all of this information can be found in other ways, but they aren't always
very friendly, and usually involve a relatively high level of Perl wizardry,
-or strange and unusual looking code. Class::Inspector attempts to provide
+or strange and unusual looking code. Class::Inspector attempts to provide
an easier, more friendly interface to this information.

=head1 METHODS
@@ -572,7 +574,7 @@
=item public

The C<public> option will return only 'public' methods, as defined by the Perl
-convention of prepending an underscore to any 'private' methods. The C<public>
+convention of prepending an underscore to any 'private' methods. The C<public>
option will effectively remove any methods that start with an underscore.

=item private
@@ -593,12 +595,12 @@

=item expanded

-The C<expanded> option will cause a lot more information about method to be
+The C<expanded> option will cause a lot more information about method to be
returned. Instead of just the method name, you will instead get an array
reference containing the method name as a single combined name, a la C<full>,
the separate class and method, and a CODE ref to the actual function ( if
-available ). Please note that the function reference is not guaranteed to
-be available. C<Class::Inspector> is intended at some later time, to work
+available ). Please note that the function reference is not guaranteed to
+be available. C<Class::Inspector> is intended at some later time, to work
with modules that have some kind of common run-time loader in place ( e.g
C<Autoloader> or C<Class::Autouse> for example.

@@ -648,7 +650,7 @@

=head1 COPYRIGHT AND LICENSE

-This software is copyright (c) 2016 by Adam Kennedy.
+This software is copyright (c) 2002-2019 by Adam Kennedy.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/maint/cip-before-install
new/Class-Inspector-1.34/maint/cip-before-install
--- old/Class-Inspector-1.32/maint/cip-before-install 1970-01-01
01:00:00.000000000 +0100
+++ new/Class-Inspector-1.34/maint/cip-before-install 2019-03-28
17:13:43.000000000 +0100
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+set -ex
+
+cip exec cpanm Devel::Hide
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/01_compile.t
new/Class-Inspector-1.34/t/01_compile.t
--- old/Class-Inspector-1.32/t/01_compile.t 2017-08-08 20:12:46.000000000
+0200
+++ new/Class-Inspector-1.34/t/01_compile.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,11 +0,0 @@
-#!/usr/bin/perl
-
-# Compile testing for Class::Inspector
-
-use strict;
-use warnings;
-use Test::More tests => 2;
-
-ok( $] >= 5.006, "Your perl is new enough" );
-
-use_ok('Class::Inspector');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/01_use.t
new/Class-Inspector-1.34/t/01_use.t
--- old/Class-Inspector-1.32/t/01_use.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Class-Inspector-1.34/t/01_use.t 2019-03-28 17:13:43.000000000 +0100
@@ -0,0 +1,8 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+ok( $] >= 5.006, "Your perl is new enough" );
+
+use_ok('Class::Inspector');
+use_ok('Class::Inspector::Functions');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/02_main.t
new/Class-Inspector-1.34/t/02_main.t
--- old/Class-Inspector-1.32/t/02_main.t 2017-08-08 20:12:46.000000000
+0200
+++ new/Class-Inspector-1.34/t/02_main.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,320 +0,0 @@
-#!/usr/bin/perl
-
-# Unit testing for Class::Inspector
-
-# Do all the tests on ourself, where possible, as we know we will be loaded.
-
-use strict;
-use warnings;
-use Test::More tests => 54;
-use Class::Inspector ();
-
-# To make maintaining this a little faster,
-# CI is defined as Class::Inspector, and
-# BAD for a class we know doesn't exist.
-use constant CI => 'Class::Inspector';
-use constant BAD => 'Class::Inspector::Nonexistant';
-
-# How many functions and public methods are there in Class::Inspector
-my $base_functions = 18;
-my $base_public = 12;
-my $base_private = $base_functions - $base_public;
-
-
-
-
-
-#####################################################################
-# Begin Tests
-
-# Check the good/bad class code
-ok( CI->_class( CI ), 'Class validator works for known valid' );
-ok( CI->_class( BAD ), 'Class validator works for correctly
formatted, but not installed' );
-ok( CI->_class( 'A::B::C::D::E' ), 'Class validator works for long classes'
);
-ok( CI->_class( '::' ), 'Class validator allows main' );
-ok( CI->_class( '::Blah' ), 'Class validator works for main aliased'
);
-ok( ! CI->_class(), 'Class validator failed for missing
class' );
-ok( ! CI->_class( '4teen' ), 'Class validator fails for number
starting class' );
-ok( ! CI->_class( 'Blah::%f' ), 'Class validator catches bad characters'
);
-
-
-
-
-
-
-# Check the loaded method
-ok( CI->loaded( CI ), "->loaded detects loaded" );
-ok( ! CI->loaded( BAD ), "->loaded detects not loaded" );
-
-
-
-
-
-# Check the file name methods
-my $filename = CI->filename( CI );
-ok( $filename eq File::Spec->catfile( "Class", "Inspector.pm" ), "->filename
works correctly" );
-my $inc_filename = CI->_inc_filename( CI );
-ok( $inc_filename eq "Class/Inspector.pm", "->_inc_filename works correctly" );
-ok( index( CI->loaded_filename(CI), $filename ) >= 0, "->loaded_filename
works" );
-ok( ($filename eq $inc_filename or index( CI->loaded_filename(CI),
$inc_filename ) == -1), "->loaded_filename works" );
-ok( index( CI->resolved_filename(CI), $filename ) >= 0, "->resolved_filename
works" );
-ok( ($filename eq $inc_filename or index( CI->resolved_filename(CI),
$inc_filename ) == -1), "->resolved_filename works" );
-
-
-
-
-
-# Check the installed stuff
-ok( CI->installed( CI ), "->installed detects installed" );
-ok( ! CI->installed( BAD ), "->installed detects not installed" );
-
-
-
-
-
-# Check the functions
-my $functions = CI->functions( CI );
-ok( (ref($functions) eq 'ARRAY'
- and $functions->[0] eq '_class'
- and scalar @$functions == $base_functions),
- "->functions works correctly" );
-ok( ! CI->functions( BAD ), "->functions fails correctly" );
-
-
-
-
-
-# Check function refs
-$functions = CI->function_refs( CI );
-ok( (ref($functions) eq 'ARRAY'
- and ref $functions->[0]
- and ref($functions->[0]) eq 'CODE'
- and scalar @$functions == $base_functions),
- "->function_refs works correctly" );
-ok( ! CI->functions( BAD ), "->function_refs fails correctly" );
-
-
-
-
-
-# Check function_exists
-ok( CI->function_exists( CI, 'installed' ),
- "->function_exists detects function that exists" );
-ok( ! CI->function_exists( CI, 'nsfladf' ),
- "->function_exists fails for bad function" );
-ok( ! CI->function_exists( CI ),
- "->function_exists fails for missing function" );
-ok( ! CI->function_exists( BAD, 'function' ),
- "->function_exists fails for bad class" );
-
-
-
-
-
-# Check the methods method.
-# First, defined a new subclass of Class::Inspector with some additional
methods
-CLASS: {
- package Class::Inspector::Dummy;
-
- use strict;
- BEGIN {
- require Class::Inspector;
- @Class::Inspector::Dummy::ISA = 'Class::Inspector';
- }
-
- sub _a_first { 1; }
- sub adummy1 { 1; }
- sub _dummy2 { 1; }
- sub dummy3 { 1; }
- sub installed { 1; }
-}
-
-package main;
-
-my $methods = CI->methods( CI );
-ok( ( ref($methods) eq 'ARRAY'
- and $methods->[0] eq '_class'
- and scalar @$methods == $base_functions),
- "->methods works for non-inheriting class" );
-$methods = CI->methods( 'Class::Inspector::Dummy' );
-ok( (ref($methods) eq 'ARRAY'
- and $methods->[0] eq '_a_first'
- and scalar @$methods == ($base_functions + 4)
- and scalar( grep { /dummy/ } @$methods ) == 3),
- "->methods works for inheriting class" );
-ok( ! CI->methods( BAD ), "->methods fails correctly" );
-
-# Check the variety of different possible ->methods options
-
-# Public option
-$methods = CI->methods( CI, 'public' );
-ok( (ref($methods) eq 'ARRAY'
- and $methods->[0] eq 'children'
- and scalar @$methods == $base_public),
- "Public ->methods works for non-inheriting class" );
-$methods = CI->methods( 'Class::Inspector::Dummy', 'public' );
-ok( (ref($methods) eq 'ARRAY'
- and $methods->[0] eq 'adummy1'
- and scalar @$methods == ($base_public + 2)
- and scalar( grep { /dummy/ } @$methods ) == 2),
- "Public ->methods works for inheriting class" );
-ok( ! CI->methods( BAD ), "Public ->methods fails correctly" );
-
-# Private option
-$methods = CI->methods( CI, 'private' );
-ok( (ref($methods) eq 'ARRAY'
- and $methods->[0] eq '_class'
- and scalar @$methods == $base_private),
- "Private ->methods works for non-inheriting class" );
-$methods = CI->methods( 'Class::Inspector::Dummy', 'private' );
-ok( (ref($methods) eq 'ARRAY'
- and $methods->[0] eq '_a_first'
- and scalar @$methods == ($base_private + 2)
- and scalar( grep { /dummy/ } @$methods ) == 1),
- "Private ->methods works for inheriting class" );
-ok( ! CI->methods( BAD ), "Private ->methods fails correctly" );
-
-# Full option
-$methods = CI->methods( CI, 'full' );
-ok( (ref($methods) eq 'ARRAY'
- and $methods->[0] eq 'Class::Inspector::_class'
- and scalar @$methods == $base_functions),
- "Full ->methods works for non-inheriting class" );
-$methods = CI->methods( 'Class::Inspector::Dummy', 'full' );
-ok( (ref($methods) eq 'ARRAY'
- and $methods->[0] eq 'Class::Inspector::Dummy::_a_first'
- and scalar @$methods == ($base_functions + 4)
- and scalar( grep { /dummy/ } @$methods ) == 3),
- "Full ->methods works for inheriting class" );
-ok( ! CI->methods( BAD ), "Full ->methods fails correctly" );
-
-# Expanded option
-$methods = CI->methods( CI, 'expanded' );
-ok( (ref($methods) eq 'ARRAY'
- and ref($methods->[0]) eq 'ARRAY'
- and $methods->[0]->[0] eq 'Class::Inspector::_class'
- and $methods->[0]->[1] eq 'Class::Inspector'
- and $methods->[0]->[2] eq '_class'
- and ref($methods->[0]->[3]) eq 'CODE'
- and scalar @$methods == $base_functions),
- "Expanded ->methods works for non-inheriting class" );
-$methods = CI->methods( 'Class::Inspector::Dummy', 'expanded' );
-ok( (ref($methods) eq 'ARRAY'
- and ref($methods->[0]) eq 'ARRAY'
- and $methods->[0]->[0] eq 'Class::Inspector::Dummy::_a_first'
- and $methods->[0]->[1] eq 'Class::Inspector::Dummy'
- and $methods->[0]->[2] eq '_a_first'
- and ref($methods->[0]->[3]) eq 'CODE'
- and scalar @$methods == ($base_functions + 4)
- and scalar( grep { /dummy/ } map { $_->[2] } @$methods ) == 3),
- "Expanded ->methods works for inheriting class" );
-ok( ! CI->methods( BAD ), "Expanded ->methods fails correctly" );
-
-# Check clashing between options
-ok( ! CI->methods( CI, 'public', 'private' ), "Public and private ->methods
clash correctly" );
-ok( ! CI->methods( CI, 'private', 'public' ), "Public and private ->methods
clash correctly" );
-ok( ! CI->methods( CI, 'full', 'expanded' ), "Full and expanded ->methods
class correctly" );
-ok( ! CI->methods( CI, 'expanded', 'full' ), "Full and expanded ->methods
class correctly" );
-
-# Check combining options
-$methods = CI->methods( CI, 'public', 'expanded' );
-ok( (ref($methods) eq 'ARRAY'
- and ref($methods->[0]) eq 'ARRAY'
- and $methods->[0]->[0] eq 'Class::Inspector::children'
- and $methods->[0]->[1] eq 'Class::Inspector'
- and $methods->[0]->[2] eq 'children'
- and ref($methods->[0]->[3]) eq 'CODE'
- and scalar @$methods == $base_public),
- "Public + Expanded ->methods works for non-inheriting class" );
-$methods = CI->methods( 'Class::Inspector::Dummy', 'public', 'expanded' );
-ok( (ref($methods) eq 'ARRAY'
- and ref($methods->[0]) eq 'ARRAY'
- and $methods->[0]->[0] eq 'Class::Inspector::Dummy::adummy1'
- and $methods->[0]->[1] eq 'Class::Inspector::Dummy'
- and $methods->[0]->[2] eq 'adummy1'
- and ref($methods->[0]->[3]) eq 'CODE'
- and scalar @$methods == ($base_public + 2)
- and scalar( grep { /dummy/ } map { $_->[2] } @$methods ) == 2),
- "Public + Expanded ->methods works for inheriting class" );
-ok( ! CI->methods( BAD ), "Expanded ->methods fails correctly" );
-
-
-
-
-
-#####################################################################
-# Search Tests
-
-# Create the classes to use
-CLASSES: {
- package Foo;
-
- sub foo { 1 };
-
- package Foo::Subclass;
-
- @Foo::Subclass::ISA = 'Foo';
-
- package Bar;
-
- @Bar::ISA = 'Foo';
-
- package This;
-
- sub isa { $_[1] eq 'Foo' ? 1 : undef }
-
- 1;
-}
-
-# Check trivial ->find cases
-SCOPE: {
- is( CI->subclasses( '' ), undef, '->subclasses(bad) returns undef' );
- is( CI->subclasses( BAD ), '', '->subclasses(none) returns false' );
- my $rv = CI->subclasses( CI );
- is_deeply( $rv, [ 'Class::Inspector::Dummy' ], '->subclasses(CI) returns
just itself' );
-
- # Check non-trivial ->subclasses cases
- $rv = CI->subclasses( 'Foo' );
- is_deeply( $rv, [ 'Bar', 'Foo::Subclass', 'This' ],
- '->subclasses(nontrivial) returns the expected class list' );
-}
-
-
-
-
-
-#####################################################################
-# Regression Tests
-
-# Discovered in 1.06, fixed in 1.07
-# In some cases, spurious empty GLOB entries can be created in a package.
-# These contain no actual symbols, but were causing ->loaded to return true.
-# An empty namespace with a single spurious empty glob entry (although
-# created in this test with a scalar) should return FALSE for ->loaded
-$Class::Inspector::SpuriousPackage::something = 1;
-$Class::Inspector::SpuriousPackage::something = 1; # Avoid a warning
-ok( ! Class::Inspector->loaded('Class::Inspector::SpuriousPackage'),
- '->loaded returns false for spurious glob in package' );
-
-
-
-# Discovered in 1.11, fixed in 1.12
-# With the introduction of ->subclasses, we exposed ourselves to
-# non-local problems with ->isa method implementations.
-PACKAGES: {
- # The busted package
- package Class::Inspector::BrokenISA;
- use vars qw{&isa};
- our $VERSION = '0.01';
- # The test packages
- package My::Foo;
- our $VERSION = '0.01';
- package My::Bar;
- our $VERSION = '0.01';
- our @ISA = 'My::Foo';
-}
-TESTS: {
- my $rv = Class::Inspector->subclasses( 'My::Foo' );
- is_deeply( $rv, [ 'My::Bar' ],
- '->subclasses in the presence of an evil ->isa does not crash' );
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/03_inc_to_local.t
new/Class-Inspector-1.34/t/03_inc_to_local.t
--- old/Class-Inspector-1.32/t/03_inc_to_local.t 2017-08-08
20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/t/03_inc_to_local.t 1970-01-01
01:00:00.000000000 +0100
@@ -1,33 +0,0 @@
-#!/usr/bin/perl
-
-# Unit testing for Class::Inspector
-
-# Do all the tests on ourself, where possible, as we know we will be loaded.
-
-use strict;
-use warnings;
-use Test::More tests => 2;
-use Class::Inspector ();
-
-
-
-
-#####################################################################
-# Try the simplistic Win32 approach
-
-SKIP: {
- skip( "Skipping Win32 test", 1 ) unless $^O eq 'MSWin32';
- my $inc = 'C:/foo/bar.pm';
- my $local = Class::Inspector->_inc_to_local($inc);
- is( $local, 'C:\foo\bar.pm', '->_inc_to_local ok' );
-}
-
-
-
-
-
-#####################################################################
-# More general tests
-
-my $module = Class::Inspector->_inc_to_local($INC{'Class/Inspector.pm'});
-ok( -f $module, 'Found ourself' );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/04_main_functions.t
new/Class-Inspector-1.34/t/04_main_functions.t
--- old/Class-Inspector-1.32/t/04_main_functions.t 2017-08-08
20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/t/04_main_functions.t 1970-01-01
01:00:00.000000000 +0100
@@ -1,120 +0,0 @@
-#!/usr/bin/perl
-
-# Reproduce some of the unit tests in the main unit tests
-# of the method interface, but not all. This makes the maintenance
-# slightly less annoying.
-
-use strict;
-use warnings;
-use Test::More tests => 24;
-use Class::Inspector::Functions;
-
-# To make maintaining this a little faster,
-# CI is defined as Class::Inspector, and
-# BAD for a class we know doesn't exist.
-use constant CI => 'Class::Inspector';
-use constant BAD => 'Class::Inspector::Nonexistant';
-
-my @exported_functions = qw(
- installed
- loaded
- filename
- functions
- methods
- subclasses
-);
-
-my @exportok_functions = qw(
- loaded_filename
- function_refs
- function_exists
-);
-
-#####################################################################
-# Begin Tests
-
-# check the export lists:
-foreach my $function (@exported_functions) {
- ok( main->can($function), "exported function '$function' was found" );
-}
-
-foreach my $function (@exportok_functions) {
- ok( ! main->can($function), "optionally exported function '$function' was
not found" );
-}
-
-Class::Inspector::Functions->import(':ALL');
-
-foreach my $function (@exportok_functions) {
- ok( main->can($function), "optionally exported function '$function' was
found after full import" );
-}
-
-
-
-# Check the loaded function
-ok( loaded( CI ), "loaded detects loaded" );
-ok( ! loaded( BAD ), "loaded detects not loaded" );
-
-# Check the file name functions
-my $filename = filename( CI );
-ok( $filename eq File::Spec->catfile( "Class", "Inspector.pm" ), "filename
works correctly" );
-ok( index( loaded_filename(CI), $filename ) >= 0, "loaded_filename works" );
-my $inc_filename = CI->_inc_filename( CI );
-ok( ($filename eq $inc_filename or index( loaded_filename(CI), $inc_filename )
== -1), "loaded_filename works" );
-ok( index( resolved_filename(CI), $filename ) >= 0, "resolved_filename works"
);
-ok( ($filename eq $inc_filename or index( resolved_filename(CI), $inc_filename
) == -1), "resolved_filename works" );
-
-unshift @INC, sub {
- my $coderef = shift;
- my $filename = shift;
-
- if ($filename eq 'Foo/Bar.pm') {
- open my $fh, '<', __FILE__;
- return (undef, $fh);
- }
- return
-};
-
-unshift @INC, [ sub {
- my $arrayref = shift;
- my $filename = shift;
-
- die "args wrong" unless
- ref($arrayref->[0]) eq 'CODE'
- && $arrayref->[1] == 1
- && $arrayref->[2] == 2
- && $arrayref->[3] == 3;
-
- if($filename eq 'Foo/Baz.pm') {
- open my $fh, '<', __FILE__;
- return $fh;
- }
- return
-}, 1,2,3];
-
-unshift @INC, MyHook->new;
-
-# Check the installed stuff
-ok( installed( CI ), "installed detects installed" );
-ok( ! installed( BAD ), "installed detects not installed" );
-ok( installed( 'Foo::Bar'), "installed detects coderef installed" );
-ok( installed( 'Foo::Baz'), "installed detects arrayref installed" );
-ok( installed( 'Foo::Foo'), "installed detects object installed" );
-
-package
- MyHook;
-
-sub new {
- my($class) = @_;
- bless {}, $class;
-}
-
-sub MyHook::INC {
- my($self, $filename) = @_;
- die "self wrong" unless ref $self eq 'MyHook';
-
- if($filename eq 'Foo/Foo.pm') {
- open my $fh, '<', __FILE__;
- return $fh;
- }
- return;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/class_inspector.t
new/Class-Inspector-1.34/t/class_inspector.t
--- old/Class-Inspector-1.32/t/class_inspector.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Class-Inspector-1.34/t/class_inspector.t 2019-03-28
17:13:43.000000000 +0100
@@ -0,0 +1,322 @@
+# Unit testing for Class::Inspector
+
+# Do all the tests on ourself, where possible, as we know we will be loaded.
+
+use strict;
+use warnings;
+use Test::More tests => 54;
+use Class::Inspector ();
+
+# To make maintaining this a little faster,
+# CI is defined as Class::Inspector, and
+# BAD for a class we know doesn't exist.
+use constant CI => 'Class::Inspector';
+use constant BAD => 'Class::Inspector::Nonexistant';
+
+# How many functions and public methods are there in Class::Inspector
+my $base_functions = 18;
+my $base_public = 12;
+my $base_private = $base_functions - $base_public;
+
+
+
+
+
+#####################################################################
+# Begin Tests
+
+# Check the good/bad class code
+ok( CI->_class( CI ), 'Class validator works for known valid' );
+ok( CI->_class( BAD ), 'Class validator works for correctly
formatted, but not installed' );
+ok( CI->_class( 'A::B::C::D::E' ), 'Class validator works for long classes'
);
+ok( CI->_class( '::' ), 'Class validator allows main' );
+ok( CI->_class( '::Blah' ), 'Class validator works for main aliased'
);
+ok( ! CI->_class(), 'Class validator failed for missing
class' );
+ok( ! CI->_class( '4teen' ), 'Class validator fails for number
starting class' );
+ok( ! CI->_class( 'Blah::%f' ), 'Class validator catches bad characters'
);
+
+
+
+
+
+
+# Check the loaded method
+ok( CI->loaded( CI ), "->loaded detects loaded" );
+ok( ! CI->loaded( BAD ), "->loaded detects not loaded" );
+
+
+
+
+
+# Check the file name methods
+my $filename = CI->filename( CI );
+ok( $filename eq File::Spec->catfile( "Class", "Inspector.pm" ), "->filename
works correctly" );
+my $inc_filename = CI->_inc_filename( CI );
+ok( $inc_filename eq "Class/Inspector.pm", "->_inc_filename works correctly" );
+ok( index( CI->loaded_filename(CI), $filename ) >= 0, "->loaded_filename
works" );
+ok( ($filename eq $inc_filename or index( CI->loaded_filename(CI),
$inc_filename ) == -1), "->loaded_filename works" );
+ok( index( CI->resolved_filename(CI), $filename ) >= 0, "->resolved_filename
works" );
+ok( ($filename eq $inc_filename or index( CI->resolved_filename(CI),
$inc_filename ) == -1), "->resolved_filename works" );
+
+
+
+
+
+# Check the installed stuff
+ok( CI->installed( CI ), "->installed detects installed" );
+ok( ! CI->installed( BAD ), "->installed detects not installed" )
+ || do {
+ diag "\@INC=$_" for @INC;
+ diag "$_=$INC{$_}" for sort keys %INC;
+ };
+
+
+
+
+
+# Check the functions
+my $functions = CI->functions( CI );
+ok( (ref($functions) eq 'ARRAY'
+ and $functions->[0] eq '_class'
+ and scalar @$functions == $base_functions),
+ "->functions works correctly" );
+ok( ! CI->functions( BAD ), "->functions fails correctly" );
+
+
+
+
+
+# Check function refs
+$functions = CI->function_refs( CI );
+ok( (ref($functions) eq 'ARRAY'
+ and ref $functions->[0]
+ and ref($functions->[0]) eq 'CODE'
+ and scalar @$functions == $base_functions),
+ "->function_refs works correctly" );
+ok( ! CI->functions( BAD ), "->function_refs fails correctly" );
+
+
+
+
+
+# Check function_exists
+ok( CI->function_exists( CI, 'installed' ),
+ "->function_exists detects function that exists" );
+ok( ! CI->function_exists( CI, 'nsfladf' ),
+ "->function_exists fails for bad function" );
+ok( ! CI->function_exists( CI ),
+ "->function_exists fails for missing function" );
+ok( ! CI->function_exists( BAD, 'function' ),
+ "->function_exists fails for bad class" );
+
+
+
+
+
+# Check the methods method.
+# First, defined a new subclass of Class::Inspector with some additional
methods
+CLASS: {
+ package Class::Inspector::Dummy;
+
+ use strict;
+ BEGIN {
+ require Class::Inspector;
+ @Class::Inspector::Dummy::ISA = 'Class::Inspector';
+ }
+
+ sub _a_first { 1; }
+ sub adummy1 { 1; }
+ sub _dummy2 { 1; }
+ sub dummy3 { 1; }
+ sub installed { 1; }
+}
+
+package main;
+
+my $methods = CI->methods( CI );
+ok( ( ref($methods) eq 'ARRAY'
+ and $methods->[0] eq '_class'
+ and scalar @$methods == $base_functions),
+ "->methods works for non-inheriting class" );
+$methods = CI->methods( 'Class::Inspector::Dummy' );
+ok( (ref($methods) eq 'ARRAY'
+ and $methods->[0] eq '_a_first'
+ and scalar @$methods == ($base_functions + 4)
+ and scalar( grep { /dummy/ } @$methods ) == 3),
+ "->methods works for inheriting class" );
+ok( ! CI->methods( BAD ), "->methods fails correctly" );
+
+# Check the variety of different possible ->methods options
+
+# Public option
+$methods = CI->methods( CI, 'public' );
+ok( (ref($methods) eq 'ARRAY'
+ and $methods->[0] eq 'children'
+ and scalar @$methods == $base_public),
+ "Public ->methods works for non-inheriting class" );
+$methods = CI->methods( 'Class::Inspector::Dummy', 'public' );
+ok( (ref($methods) eq 'ARRAY'
+ and $methods->[0] eq 'adummy1'
+ and scalar @$methods == ($base_public + 2)
+ and scalar( grep { /dummy/ } @$methods ) == 2),
+ "Public ->methods works for inheriting class" );
+ok( ! CI->methods( BAD ), "Public ->methods fails correctly" );
+
+# Private option
+$methods = CI->methods( CI, 'private' );
+ok( (ref($methods) eq 'ARRAY'
+ and $methods->[0] eq '_class'
+ and scalar @$methods == $base_private),
+ "Private ->methods works for non-inheriting class" );
+$methods = CI->methods( 'Class::Inspector::Dummy', 'private' );
+ok( (ref($methods) eq 'ARRAY'
+ and $methods->[0] eq '_a_first'
+ and scalar @$methods == ($base_private + 2)
+ and scalar( grep { /dummy/ } @$methods ) == 1),
+ "Private ->methods works for inheriting class" );
+ok( ! CI->methods( BAD ), "Private ->methods fails correctly" );
+
+# Full option
+$methods = CI->methods( CI, 'full' );
+ok( (ref($methods) eq 'ARRAY'
+ and $methods->[0] eq 'Class::Inspector::_class'
+ and scalar @$methods == $base_functions),
+ "Full ->methods works for non-inheriting class" );
+$methods = CI->methods( 'Class::Inspector::Dummy', 'full' );
+ok( (ref($methods) eq 'ARRAY'
+ and $methods->[0] eq 'Class::Inspector::Dummy::_a_first'
+ and scalar @$methods == ($base_functions + 4)
+ and scalar( grep { /dummy/ } @$methods ) == 3),
+ "Full ->methods works for inheriting class" );
+ok( ! CI->methods( BAD ), "Full ->methods fails correctly" );
+
+# Expanded option
+$methods = CI->methods( CI, 'expanded' );
+ok( (ref($methods) eq 'ARRAY'
+ and ref($methods->[0]) eq 'ARRAY'
+ and $methods->[0]->[0] eq 'Class::Inspector::_class'
+ and $methods->[0]->[1] eq 'Class::Inspector'
+ and $methods->[0]->[2] eq '_class'
+ and ref($methods->[0]->[3]) eq 'CODE'
+ and scalar @$methods == $base_functions),
+ "Expanded ->methods works for non-inheriting class" );
+$methods = CI->methods( 'Class::Inspector::Dummy', 'expanded' );
+ok( (ref($methods) eq 'ARRAY'
+ and ref($methods->[0]) eq 'ARRAY'
+ and $methods->[0]->[0] eq 'Class::Inspector::Dummy::_a_first'
+ and $methods->[0]->[1] eq 'Class::Inspector::Dummy'
+ and $methods->[0]->[2] eq '_a_first'
+ and ref($methods->[0]->[3]) eq 'CODE'
+ and scalar @$methods == ($base_functions + 4)
+ and scalar( grep { /dummy/ } map { $_->[2] } @$methods ) == 3),
+ "Expanded ->methods works for inheriting class" );
+ok( ! CI->methods( BAD ), "Expanded ->methods fails correctly" );
+
+# Check clashing between options
+ok( ! CI->methods( CI, 'public', 'private' ), "Public and private ->methods
clash correctly" );
+ok( ! CI->methods( CI, 'private', 'public' ), "Public and private ->methods
clash correctly" );
+ok( ! CI->methods( CI, 'full', 'expanded' ), "Full and expanded ->methods
class correctly" );
+ok( ! CI->methods( CI, 'expanded', 'full' ), "Full and expanded ->methods
class correctly" );
+
+# Check combining options
+$methods = CI->methods( CI, 'public', 'expanded' );
+ok( (ref($methods) eq 'ARRAY'
+ and ref($methods->[0]) eq 'ARRAY'
+ and $methods->[0]->[0] eq 'Class::Inspector::children'
+ and $methods->[0]->[1] eq 'Class::Inspector'
+ and $methods->[0]->[2] eq 'children'
+ and ref($methods->[0]->[3]) eq 'CODE'
+ and scalar @$methods == $base_public),
+ "Public + Expanded ->methods works for non-inheriting class" );
+$methods = CI->methods( 'Class::Inspector::Dummy', 'public', 'expanded' );
+ok( (ref($methods) eq 'ARRAY'
+ and ref($methods->[0]) eq 'ARRAY'
+ and $methods->[0]->[0] eq 'Class::Inspector::Dummy::adummy1'
+ and $methods->[0]->[1] eq 'Class::Inspector::Dummy'
+ and $methods->[0]->[2] eq 'adummy1'
+ and ref($methods->[0]->[3]) eq 'CODE'
+ and scalar @$methods == ($base_public + 2)
+ and scalar( grep { /dummy/ } map { $_->[2] } @$methods ) == 2),
+ "Public + Expanded ->methods works for inheriting class" );
+ok( ! CI->methods( BAD ), "Expanded ->methods fails correctly" );
+
+
+
+
+
+#####################################################################
+# Search Tests
+
+# Create the classes to use
+CLASSES: {
+ package Foo;
+
+ sub foo { 1 };
+
+ package Foo::Subclass;
+
+ @Foo::Subclass::ISA = 'Foo';
+
+ package Bar;
+
+ @Bar::ISA = 'Foo';
+
+ package This;
+
+ sub isa { $_[1] eq 'Foo' ? 1 : undef }
+
+ 1;
+}
+
+# Check trivial ->find cases
+SCOPE: {
+ is( CI->subclasses( '' ), undef, '->subclasses(bad) returns undef' );
+ is( CI->subclasses( BAD ), '', '->subclasses(none) returns false' );
+ my $rv = CI->subclasses( CI );
+ is_deeply( $rv, [ 'Class::Inspector::Dummy' ], '->subclasses(CI) returns
just itself' );
+
+ # Check non-trivial ->subclasses cases
+ $rv = CI->subclasses( 'Foo' );
+ is_deeply( $rv, [ 'Bar', 'Foo::Subclass', 'This' ],
+ '->subclasses(nontrivial) returns the expected class list' );
+}
+
+
+
+
+
+#####################################################################
+# Regression Tests
+
+# Discovered in 1.06, fixed in 1.07
+# In some cases, spurious empty GLOB entries can be created in a package.
+# These contain no actual symbols, but were causing ->loaded to return true.
+# An empty namespace with a single spurious empty glob entry (although
+# created in this test with a scalar) should return FALSE for ->loaded
+$Class::Inspector::SpuriousPackage::something = 1;
+$Class::Inspector::SpuriousPackage::something = 1; # Avoid a warning
+ok( ! Class::Inspector->loaded('Class::Inspector::SpuriousPackage'),
+ '->loaded returns false for spurious glob in package' );
+
+
+
+# Discovered in 1.11, fixed in 1.12
+# With the introduction of ->subclasses, we exposed ourselves to
+# non-local problems with ->isa method implementations.
+PACKAGES: {
+ # The busted package
+ package Class::Inspector::BrokenISA;
+ use vars qw{&isa};
+ our $VERSION = '0.01';
+ # The test packages
+ package My::Foo;
+ our $VERSION = '0.01';
+ package My::Bar;
+ our $VERSION = '0.01';
+ our @ISA = 'My::Foo';
+}
+TESTS: {
+ my $rv = Class::Inspector->subclasses( 'My::Foo' );
+ is_deeply( $rv, [ 'My::Bar' ],
+ '->subclasses in the presence of an evil ->isa does not crash' );
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/class_inspector__devel_hide.t
new/Class-Inspector-1.34/t/class_inspector__devel_hide.t
--- old/Class-Inspector-1.32/t/class_inspector__devel_hide.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Class-Inspector-1.34/t/class_inspector__devel_hide.t 2019-03-28
17:13:43.000000000 +0100
@@ -0,0 +1,11 @@
+use strict;
+use warnings;
+use Test::More;
+use Class::Inspector;
+
+eval q{ use Devel::Hide };
+plan skip_all => 'test requires Devel::Hide' if $@;
+plan tests => 2;
+
+ok( Class::Inspector->installed('Class::Inspector') );
+ok( ! Class::Inspector->installed('Class::Inspector::Bogus') );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Class-Inspector-1.32/t/class_inspector__inc_to_local.t
new/Class-Inspector-1.34/t/class_inspector__inc_to_local.t
--- old/Class-Inspector-1.32/t/class_inspector__inc_to_local.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Class-Inspector-1.34/t/class_inspector__inc_to_local.t 2019-03-28
17:13:43.000000000 +0100
@@ -0,0 +1,31 @@
+# Unit testing for Class::Inspector
+
+# Do all the tests on ourself, where possible, as we know we will be loaded.
+
+use strict;
+use warnings;
+use Test::More tests => 2;
+use Class::Inspector ();
+
+
+
+
+#####################################################################
+# Try the simplistic Win32 approach
+
+SKIP: {
+ skip( "Skipping Win32 test", 1 ) unless $^O eq 'MSWin32';
+ my $inc = 'C:/foo/bar.pm';
+ my $local = Class::Inspector->_inc_to_local($inc);
+ is( $local, 'C:\foo\bar.pm', '->_inc_to_local ok' );
+}
+
+
+
+
+
+#####################################################################
+# More general tests
+
+my $module = Class::Inspector->_inc_to_local($INC{'Class/Inspector.pm'});
+ok( -f $module, 'Found ourself' );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/t/class_inspector_functions.t
new/Class-Inspector-1.34/t/class_inspector_functions.t
--- old/Class-Inspector-1.32/t/class_inspector_functions.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Class-Inspector-1.34/t/class_inspector_functions.t 2019-03-28
17:13:43.000000000 +0100
@@ -0,0 +1,118 @@
+# Reproduce some of the unit tests in the main unit tests
+# of the method interface, but not all. This makes the maintenance
+# slightly less annoying.
+
+use strict;
+use warnings;
+use Test::More tests => 24;
+use Class::Inspector::Functions;
+
+# To make maintaining this a little faster,
+# CI is defined as Class::Inspector, and
+# BAD for a class we know doesn't exist.
+use constant CI => 'Class::Inspector';
+use constant BAD => 'Class::Inspector::Nonexistant';
+
+my @exported_functions = qw(
+ installed
+ loaded
+ filename
+ functions
+ methods
+ subclasses
+);
+
+my @exportok_functions = qw(
+ loaded_filename
+ function_refs
+ function_exists
+);
+
+#####################################################################
+# Begin Tests
+
+# check the export lists:
+foreach my $function (@exported_functions) {
+ ok( main->can($function), "exported function '$function' was found" );
+}
+
+foreach my $function (@exportok_functions) {
+ ok( ! main->can($function), "optionally exported function '$function' was
not found" );
+}
+
+Class::Inspector::Functions->import(':ALL');
+
+foreach my $function (@exportok_functions) {
+ ok( main->can($function), "optionally exported function '$function' was
found after full import" );
+}
+
+
+
+# Check the loaded function
+ok( loaded( CI ), "loaded detects loaded" );
+ok( ! loaded( BAD ), "loaded detects not loaded" );
+
+# Check the file name functions
+my $filename = filename( CI );
+ok( $filename eq File::Spec->catfile( "Class", "Inspector.pm" ), "filename
works correctly" );
+ok( index( loaded_filename(CI), $filename ) >= 0, "loaded_filename works" );
+my $inc_filename = CI->_inc_filename( CI );
+ok( ($filename eq $inc_filename or index( loaded_filename(CI), $inc_filename )
== -1), "loaded_filename works" );
+ok( index( resolved_filename(CI), $filename ) >= 0, "resolved_filename works"
);
+ok( ($filename eq $inc_filename or index( resolved_filename(CI), $inc_filename
) == -1), "resolved_filename works" );
+
+unshift @INC, sub {
+ my $coderef = shift;
+ my $filename = shift;
+
+ if ($filename eq 'Foo/Bar.pm') {
+ open my $fh, '<', __FILE__;
+ return (undef, $fh);
+ }
+ return
+};
+
+unshift @INC, [ sub {
+ my $arrayref = shift;
+ my $filename = shift;
+
+ die "args wrong" unless
+ ref($arrayref->[0]) eq 'CODE'
+ && $arrayref->[1] == 1
+ && $arrayref->[2] == 2
+ && $arrayref->[3] == 3;
+
+ if($filename eq 'Foo/Baz.pm') {
+ open my $fh, '<', __FILE__;
+ return $fh;
+ }
+ return
+}, 1,2,3];
+
+unshift @INC, MyHook->new;
+
+# Check the installed stuff
+ok( installed( CI ), "installed detects installed" );
+ok( ! installed( BAD ), "installed detects not installed" );
+ok( installed( 'Foo::Bar'), "installed detects coderef installed" );
+ok( installed( 'Foo::Baz'), "installed detects arrayref installed" );
+ok( installed( 'Foo::Foo'), "installed detects object installed" );
+
+package
+ MyHook;
+
+sub new {
+ my($class) = @_;
+ bless {}, $class;
+}
+
+sub MyHook::INC {
+ my($self, $filename) = @_;
+ die "self wrong" unless ref $self eq 'MyHook';
+
+ if($filename eq 'Foo/Foo.pm') {
+ open my $fh, '<', __FILE__;
+ return $fh;
+ }
+ return;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-Inspector-1.32/xt/author/version.t
new/Class-Inspector-1.34/xt/author/version.t
--- old/Class-Inspector-1.32/xt/author/version.t 2017-08-08
20:12:46.000000000 +0200
+++ new/Class-Inspector-1.34/xt/author/version.t 2019-03-28
17:13:43.000000000 +0100
@@ -13,8 +13,6 @@
1
};

- plan skip_all => "test requires Path::Class"
- unless eval q{ use Path::Class qw( file dir ); 1 };
plan skip_all => 'test requires YAML'
unless eval q{ use YAML; 1; };
}
@@ -23,10 +21,6 @@
use FindBin;
use File::Spec;

-plan skip_all => "test not built yet (run dzil test)"
- unless -e dir( $FindBin::Bin)->parent->parent->file('Makefile.PL')
- || -e dir( $FindBin::Bin)->parent->parent->file('Build.PL');
-
my $config_filename = File::Spec->catfile(
$FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml'
);


< Previous Next >
This Thread
  • No further messages