Commit 9e59524a authored by Alessandro Ghedini's avatar Alessandro Ghedini

Imported Upstream version 0.34

parent a40562c8
Revision history for Package-Stash
0.34 2013-01-04
- support anonymous stashes on newer perl versions
- prevent harmful effects from invalid settings for
$ENV{PACKAGE_STASH_IMPLEMENTATION}
- switch to Module::Implementation
0.33 2011-09-28
- add conflict on MooseX::Method::Signatures 0.36 (ether)
......
This software is copyright (c) 2011 by Jesse Luehrs.
This software is copyright (c) 2013 by Jesse Luehrs.
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 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2011 by Jesse Luehrs.
This software is Copyright (c) 2013 by Jesse Luehrs.
This is free software, licensed under:
......@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
......@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2011 by Jesse Luehrs.
This software is Copyright (c) 2013 by Jesse Luehrs.
This is free software, licensed under:
......
......@@ -14,8 +14,10 @@ lib/Package/Stash/Conflicts.pm
lib/Package/Stash/PP.pm
t/00-compile.t
t/addsub.t
t/author-leaks-debug.t
t/author-leaks.t
t/anon-basic.t
t/anon.t
t/bare-anon-basic.t
t/bare-anon.t
t/basic.t
t/compile-time.t
t/edge-cases.t
......@@ -23,6 +25,7 @@ t/extension.t
t/get.t
t/impl-selection/basic-pp.t
t/impl-selection/basic-xs.t
t/impl-selection/bug-rt-78272.t
t/impl-selection/choice.t
t/impl-selection/env.t
t/impl-selection/var.t
......@@ -30,12 +33,14 @@ t/io.t
t/isa.t
t/lib/CompileTime.pm
t/lib/Package/Stash.pm
t/magic.t
t/paamayim_nekdotayim.t
t/release-eol.t
t/release-no-tabs.t
t/release-pod-coverage.t
t/release-pod-syntax.t
t/scalar-values.t
t/stash-deletion.t
t/synopsis.t
weaver.ini
xt/author/leaks-debug.t
xt/author/leaks.t
xt/release/eol.t
xt/release/no-tabs.t
xt/release/pod-coverage.t
xt/release/pod-syntax.t
This diff is collapsed.
......@@ -3,30 +3,44 @@ abstract: 'routines for manipulating stashes'
author:
- 'Jesse Luehrs <doy at tozt dot net>'
build_requires:
File::Find: 0
File::Temp: 0
Test::Fatal: 0
Test::More: 0.88
Test::Requires: 0
base: 0
configure_requires:
Dist::CheckConflicts: 0.02
ExtUtils::MakeMaker: 6.30
dynamic_config: 1
generated_by: 'Dist::Zilla version 4.300002, CPAN::Meta::Converter version 2.110440'
generated_by: 'Dist::Zilla version 4.300028, CPAN::Meta::Converter version 2.120921'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Package-Stash
recommends:
Package::Stash::XS: 0.24
Package::Stash::XS: 0.26
requires:
B: 0
Carp: 0
Dist::CheckConflicts: 0.02
Module::Implementation: 0.06
Package::DeprecationManager: 0
Scalar::Util: 0
perl: 5.8.1
Symbol: 0
constant: 0
perl: 5.008001
strict: 0
warnings: 0
resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Package-Stash
homepage: http://metacpan.org/release/Package-Stash
repository: git://github.com/doy/package-stash.git
version: 0.33
version: 0.34
x_Dist_Zilla:
perl:
version: 5.016002
plugins:
-
class: Dist::Zilla::Plugin::Prereqs
......@@ -35,43 +49,43 @@ x_Dist_Zilla:
phase: test
type: requires
name: '@DOY/TestMoreDoneTesting'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::GatherDir
name: '@DOY/GatherDir'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@DOY/PruneCruft'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@DOY/ManifestSkip'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@DOY/MetaYAML'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::License
name: '@DOY/License'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::Readme
name: '@DOY/Readme'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::ExtraTests
name: '@DOY/ExtraTests'
version: 4.300002
class: Dist::Zilla::Plugin::RunExtraTests
name: '@DOY/RunExtraTests'
version: 0.007
-
class: Dist::Zilla::Plugin::ExecDir
name: '@DOY/ExecDir'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::ShareDir
name: '@DOY/ShareDir'
version: 4.300002
version: 4.300028
-
class: inc::MMPackageStash
name: '@DOY/=inc::MMPackageStash'
......@@ -79,43 +93,47 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::Manifest
name: '@DOY/Manifest'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::TestRelease
name: '@DOY/TestRelease'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@DOY/ConfirmRelease'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@DOY/MetaConfig'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@DOY/MetaJSON'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::NextRelease
name: '@DOY/NextRelease'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::CheckChangesHasContent
name: '@DOY/CheckChangesHasContent'
version: 0.003
version: 0.006
-
class: Dist::Zilla::Plugin::PkgVersion
name: '@DOY/PkgVersion'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::Authority
name: '@DOY/Authority'
version: 1.006
-
class: Dist::Zilla::Plugin::PodCoverageTests
name: '@DOY/PodCoverageTests'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@DOY/PodSyntaxTests'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::NoTabsTests
name: '@DOY/NoTabsTests'
......@@ -125,25 +143,33 @@ x_Dist_Zilla:
name: '@DOY/EOLTests'
version: 0.02
-
class: Dist::Zilla::Plugin::CompileTests
name: '@DOY/CompileTests'
version: 1.110930
class: Dist::Zilla::Plugin::Test::Compile
name: '@DOY/Test::Compile'
version: 1.112820
-
class: Dist::Zilla::Plugin::Metadata
name: '@DOY/Metadata'
version: 3.03
-
class: Dist::Zilla::Plugin::Repository
name: '@DOY/Repository'
version: 0.18
class: Dist::Zilla::Plugin::MetaResources
name: '@DOY/MetaResources'
version: 4.300028
-
class: Dist::Zilla::Plugin::Git::Check
name: '@DOY/Git::Check'
version: 1.111590
version: 2.001
-
class: Dist::Zilla::Plugin::Git::Commit
name: '@DOY/Git::Commit'
version: 2.001
-
class: Dist::Zilla::Plugin::Git::Tag
name: '@DOY/Git::Tag'
version: 1.111590
version: 2.001
-
class: Dist::Zilla::Plugin::Git::NextVersion
name: '@DOY/Git::NextVersion'
version: 1.111590
version: 2.001
-
class: Dist::Zilla::Plugin::PodWeaver
name: '@DOY/PodWeaver'
......@@ -151,19 +177,15 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@DOY/UploadToCPAN'
version: 4.300002
version: 4.300028
-
class: inc::DistMeta
name: '=inc::DistMeta'
version: ~
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: runtime
type: requires
name: Prereqs
version: 4.300002
class: Dist::Zilla::Plugin::AutoPrereqs
name: AutoPrereqs
version: 4.300028
-
class: Dist::Zilla::Plugin::Prereqs
config:
......@@ -171,15 +193,7 @@ x_Dist_Zilla:
phase: runtime
type: recommends
name: RuntimeRecommends
version: 4.300002
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: test
type: requires
name: TestRequires
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::Prereqs
config:
......@@ -187,7 +201,7 @@ x_Dist_Zilla:
phase: develop
type: requires
name: DevelopRequires
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::Conflicts
name: Conflicts
......@@ -195,32 +209,33 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::FinderCode
name: ':IncModules'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
version: 4.300002
version: 4.300028
-
class: Dist::Zilla::Plugin::FinderCode
name: ':MainModule'
version: 4.300002
version: 4.300028
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: 0
version: 4.300002
version: 4.300028
x_authority: cpan:DOY
x_conflicts:
Class::MOP: 1.08
MooseX::Method::Signatures: 0.36
......
# This Makefile.PL for was generated by Dist::Zilla.
# Don't edit it but the dist.ini used to construct it.
BEGIN { require 5.8.1; }
BEGIN { require 5.008001; }
use strict;
use warnings;
use ExtUtils::MakeMaker 6.30;
......@@ -10,9 +10,12 @@ my %WriteMakefileArgs = (
'ABSTRACT' => 'routines for manipulating stashes',
'AUTHOR' => 'Jesse Luehrs <doy at tozt dot net>',
'BUILD_REQUIRES' => {
'File::Find' => '0',
'File::Temp' => '0',
'Test::Fatal' => '0',
'Test::More' => '0.88',
'Test::Requires' => '0'
'Test::Requires' => '0',
'base' => '0'
},
'CONFIGURE_REQUIRES' => {
'Dist::CheckConflicts' => '0.02',
......@@ -25,11 +28,18 @@ my %WriteMakefileArgs = (
'LICENSE' => 'perl',
'NAME' => 'Package::Stash',
'PREREQ_PM' => {
'B' => '0',
'Carp' => '0',
'Dist::CheckConflicts' => '0.02',
'Module::Implementation' => '0.06',
'Package::DeprecationManager' => '0',
'Scalar::Util' => '0'
'Scalar::Util' => '0',
'Symbol' => '0',
'constant' => '0',
'strict' => '0',
'warnings' => '0'
},
'VERSION' => '0.33',
'VERSION' => '0.34',
'test' => {
'TESTS' => 't/*.t t/impl-selection/*.t'
}
......@@ -52,7 +62,7 @@ unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
$WriteMakefileArgs{PREREQ_PM}{'Package::Stash::XS'} = 0.24
$WriteMakefileArgs{PREREQ_PM}{'Package::Stash::XS'} = 0.26
if can_cc();
WriteMakefile(%WriteMakefileArgs);
......
This archive contains the distribution Package-Stash,
version 0.33:
version 0.34:
routines for manipulating stashes
This software is copyright (c) 2011 by Jesse Luehrs.
This software is copyright (c) 2013 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
......@@ -6,24 +6,17 @@ copyright_holder = Jesse Luehrs
[@DOY]
:version = 0.05
dist = Package-Stash
repository = github
awesome = =inc::MMPackageStash
CompileTests_skip = [Cc]onflicts$
[=inc::DistMeta]
dynamic_config = 1
[Prereqs]
perl = 5.8.1
Package::DeprecationManager = 0
Scalar::Util = 0
[AutoPrereqs]
[Prereqs / RuntimeRecommends]
Package::Stash::XS = 0.24
[Prereqs / TestRequires]
Test::Fatal = 0
Test::More = 0.88
Test::Requires = 0
Package::Stash::XS = 0.26
[Prereqs / DevelopRequires]
Test::LeakTrace = 0
......
package Package::Stash;
BEGIN {
$Package::Stash::AUTHORITY = 'cpan:DOY';
}
{
$Package::Stash::VERSION = '0.33';
$Package::Stash::VERSION = '0.34';
}
use strict;
use warnings;
use 5.008001;
# ABSTRACT: routines for manipulating stashes
our $IMPLEMENTATION;
use Module::Implementation 0.06;
BEGIN {
$IMPLEMENTATION = $ENV{PACKAGE_STASH_IMPLEMENTATION}
if exists $ENV{PACKAGE_STASH_IMPLEMENTATION};
my $err;
if ($IMPLEMENTATION) {
if (!eval "require Package::Stash::$IMPLEMENTATION; 1") {
require Carp;
Carp::croak("Could not load Package::Stash::$IMPLEMENTATION: $@");
}
}
else {
for my $impl ('XS', 'PP') {
if (eval "require Package::Stash::$impl; 1;") {
$IMPLEMENTATION = $impl;
last;
}
else {
$err .= $@;
}
}
}
local $ENV{PACKAGE_STASH_IMPLEMENTATION} = $IMPLEMENTATION
if ( $IMPLEMENTATION and not $ENV{PACKAGE_STASH_IMPLEMENTATION} );
if (!$IMPLEMENTATION) {
require Carp;
Carp::croak("Could not find a suitable Package::Stash implementation: $err");
}
Module::Implementation::build_loader_sub(
implementations => [ 'XS', 'PP' ]
)->();
$IMPLEMENTATION = Module::Implementation::implementation_for(__PACKAGE__);
my $impl = "Package::Stash::$IMPLEMENTATION";
my $from = $impl->new($impl);
......@@ -56,37 +43,37 @@ use Package::DeprecationManager -deprecations => {
};
sub add_package_symbol {
#deprecated('add_package_symbol is deprecated, please use add_symbol');
deprecated('add_package_symbol is deprecated, please use add_symbol');
shift->add_symbol(@_);
}
sub remove_package_glob {
#deprecated('remove_package_glob is deprecated, please use remove_glob');
deprecated('remove_package_glob is deprecated, please use remove_glob');
shift->remove_glob(@_);
}
sub has_package_symbol {
#deprecated('has_package_symbol is deprecated, please use has_symbol');
deprecated('has_package_symbol is deprecated, please use has_symbol');
shift->has_symbol(@_);
}
sub get_package_symbol {
#deprecated('get_package_symbol is deprecated, please use get_symbol');
deprecated('get_package_symbol is deprecated, please use get_symbol');
shift->get_symbol(@_);
}
sub get_or_add_package_symbol {
#deprecated('get_or_add_package_symbol is deprecated, please use get_or_add_symbol');
deprecated('get_or_add_package_symbol is deprecated, please use get_or_add_symbol');
shift->get_or_add_symbol(@_);
}
sub remove_package_symbol {
#deprecated('remove_package_symbol is deprecated, please use remove_symbol');
deprecated('remove_package_symbol is deprecated, please use remove_symbol');
shift->remove_symbol(@_);
}
sub list_all_package_symbols {
#deprecated('list_all_package_symbols is deprecated, please use list_all_symbols');
deprecated('list_all_package_symbols is deprecated, please use list_all_symbols');
shift->list_all_symbols(@_);
}
......@@ -94,6 +81,7 @@ sub list_all_package_symbols {
1;
__END__
=pod
=head1 NAME
......@@ -102,7 +90,7 @@ Package::Stash - routines for manipulating stashes
=head1 VERSION
version 0.33
version 0.34
=head1 SYNOPSIS
......@@ -231,6 +219,16 @@ Please report any bugs through RT: email
C<bug-package-stash at rt.cpan.org>, or browse to
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Package-Stash>.
=head1 SEE ALSO
=over 4
=item * L<Class::MOP::Package>
This module is a factoring out of code that used to live here
=back
=head1 SUPPORT
You can find this documentation for this module with the perldoc command.
......@@ -274,22 +272,15 @@ get_or_add_package_symbol
remove_package_symbol
list_all_package_symbols
=head1 SEE ALSO
=over 4
=item * L<Class::MOP::Package>
This module is a factoring out of code that used to live here
=head1 AUTHOR
=back
Jesse Luehrs <doy at tozt dot net>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jesse Luehrs.
This software is copyright (c) 2013 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
......@@ -13,9 +13,16 @@ use Dist::CheckConflicts
'namespace::clean' => '0.18',
},
-also => [ qw(
B
Carp
Dist::CheckConflicts
Module::Implementation
Package::DeprecationManager
Scalar::Util
Symbol
constant
strict
warnings
) ],
;
......
This diff is collapsed.
......@@ -18,25 +18,39 @@ find(
$found =~ s{^lib/}{};
$found =~ s{[/\\]}{::}g;
$found =~ s/\.pm$//;
return if $found =~ /[Cc]onflicts$/;
# nothing to skip
push @modules, $found;
},
'lib',
);
my @scripts;
if ( -d 'bin' ) {
sub _find_scripts {
my $dir = shift @_;
my @found_scripts = ();
find(
sub {
return unless -f;
my $found = $File::Find::name;
return if $found =~ /[Cc]onflicts$/;
push @scripts, $found;
# nothing to skip
open my $FH, '<', $_ or do {
note( "Unable to open $found in ( $! ), skipping" );
return;
};
my $shebang = <$FH>;
return unless $shebang =~ /^#!.*?\bperl\b\s*$/;
push @found_scripts, $found;
},
'bin',
$dir,
);
return @found_scripts;
}
my @scripts;
do { push @scripts, _find_scripts($_) if -d $_ }
for qw{ bin script scripts };
my $plan = scalar(@modules) + scalar(@scripts);
$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
......
This diff is collapsed.
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use lib 't/lib';
use Test::Requires 'Package::Anon';
use Package::Stash;
use Symbol;
plan skip_all => "Anonymous stashes in PP need at least perl 5.14"
if $] < 5.014
&& $Package::Stash::IMPLEMENTATION eq 'PP';
my $anon = Package::Anon->new;
my $stash = Package::Stash->new($anon);
my $obj = $anon->bless({});
{
my $code = sub { 'FOO' };
$stash->add_symbol('&foo' => $code);
is($stash->get_symbol('&foo'), $code);
is($obj->foo, 'FOO');
}
{
$anon->{bar} = \123;
my $code = $stash->get_symbol('&bar');
is(ref($code), 'CODE');
is($code->(), 123);
is($obj->bar, 123);
}
{
$anon->{baz} = -1;
my $code = $stash->get_symbol('&baz');
is(ref($code), 'CODE');
like(
exception { $code->() },
qr/Undefined subroutine \&__ANON__::baz called/
);
}
done_testing;
This diff is collapsed.
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use lib 't/lib';
use Package::Stash;
use Symbol;
plan skip_all => "Anonymous stashes in PP need at least perl 5.14"
if $] < 5.014
&& $Package::Stash::IMPLEMENTATION eq 'PP';
plan skip_all => "This isn't really going to work yet, probably";