Ref-Util-0.203/0000775000076500000240000000000013106015630012125 5ustar aaronstaffRef-Util-0.203/Changes0000644000076500000240000001126513106015630013423 0ustar aaronstaff0.203 2017-05-14 10:55:51+02:00 Europe/Paris * Rename $REF_UTIL_IMPLEMENTATION environment variable to $PERL_REF_UTIL_IMPLEMENTATION (suggested by ether++) 0.202 2017-05-14 10:39:52+02:00 Europe/Paris * Use of the Pure-Perl implementation can now be forced at runtime by setting either $Ref::Util::IMPLEMENTATION or $ENV{REF_UTIL_IMPLEMENTATION} to "XS" * Fix is_*_formatref() error messages (reported by tobyink, #38) * Speed enhancements for is_*_formatref() on 5.8+ * Restore 5.6 and 5.8 compatibility * PP behaviour now matches XS for \v1.2.3 and \sub {} * Updated documentation to reflect the PP/XS split 0.201 2017-05-12 15:42:54+02:00 Europe/Paris * Fix space/tab issue in Makefile (srezic, ether) * Don't use DynamicPrereqs for unrelated Makefile.PL snippet (ether) 0.200 2017-05-12 10:14:26+02:00 Europe/Paris * Reimplement in pure Perl, with a dynamic dependency on a new Ref::Util::XS module that contains the fast XS implementation. ether++ for the Dist::Zilla wrangling. 0.113 2017-01-16 19:36:58+01:00 Europe/Amsterdam * Fix bugtracker link. (Shoichi Kaji) 0.112 2017-01-15 17:15:26+01:00 Europe/Amsterdam * GH #35: Fix compilation on Sun (Oracle) and some MSVC compilers. (stphnlyd) 0.111 2016-12-30 12:18:04+01:00 Europe/Amsterdam * Fix test failure on 5.8.5 and under. * Moved to Dist::Zilla. 0.110 2016-12-29 * GH #29, #34: Fix support of 5.8. (Sergey Aleynikov) * Additional optimizations. (Sergey Aleynikov) * More extensive test suite. 0.101 2016-08-29 * A test accidentally added a dependency on Readonly.pm. Fixed! (GH #30) * Update README. 0.100 2016-08-27 * Support situations in op-code implementation where the parameters do not come as a list. (Zefram) * Fix memory leak in dangling op. (Zefram) * Support magic (tied variables). (Tony Cook) * Rework op implementation. (Zefram) Thanks to Christian Walde for porting and merging Zefram's work from Hash::SharedMem. * Speed up by changing the top of the stack instead of POPing and PUSHing. (Sergey Aleynikov) * Update ppport.h file from Devel::PPPort and remove the copy of SVRXOK since it's now available. (Christian Walde) * Add license in Pod. (Pete Houston) * Specify minimum version of perl (5.6.2). (Pete Houston) 0.020 2016-05-02 * Work on Perl 5.22 and above with -DPERL_OP_PARENT. (Aaron Crane) * Verify number of arguments. (Aaron Crane) 0.011 2016-04-29 * Update README. 0.010 2016-04-29 * Add is_plain_* functions to support explicitly non-blessed variations of the functions. (Aaron Crane) * Add is_blessed* functions to support explicitly blessed variations of the functions. (Aaron Crane) * Support blessed and magical regexes in 5.10+. From the implementation perspective, we're now using SvRXOK() on Perl 5.10+ (both opcode and XS) because it's more correct. (Sawyer X, Aaron Crane) 0.008 2016-01-23 * Document is_ref() in the POD (GH #8). 0.007 2016-01-09 * Add is_ref(), asked by Ilmari (GH #6). (Tested on 5.18.2, 5.10.1, 5.8.9, 5.6.2) * Clarify tied variables support (or lack thereof). 0.006 2016-01-01 * Update changelog for 0.005 (5.10.1 tested successfully). * Add license metadata. Thanks, Manwar! * Rephrase croak message for is_formatref on 5.6. 0.005 2015-12-28 * Support for 5.10. (Tested on 5.10.1) * Support for 5.8. (Tested on 5.8.9) * Support for 5.6, except for is_formatref. (Tested on 5.6.2) * Support older Test::More versions. * Provide metadata to direct people to Github instead of RT. (Thanks, Graham Ollis!) * Clarify Readonly, tied variables, and magic. * Cleaned up docs a bit. 0.004 2015-12-18 * Add is_refref() function! * Mention and compare to Scalar::Util::reftype. * Add benchmark results, including against reftype. * Add a note about the nature of playing with op trees, sort of. * Add a note on what functions from reftype() are not available. * Clarify how bad overloading is. No, it's not duck-typing either. 0.003 2015-12-17 * Clarify overloading approach. Sorry, everyone! * Document :all option. 0.002 2015-12-05 * Ugh PAUSE. Thanks, Graham Barr. 0.001 2015-12-04 * First version Ref-Util-0.203/cpanfile0000644000076500000240000000013113106015630013622 0ustar aaronstaffrequires 'Exporter' => 5.57; on 'test' => sub { requires 'Test::More' => '0.96'; }; Ref-Util-0.203/dist.ini0000644000076500000240000000334713106015630013576 0ustar aaronstaffname = Ref-Util author = Sawyer X author = Aaron Crane author = Vikenty Fesunov author = Gonzalo Diethelm author = Karen Etheridge license = MIT copyright_holder = Sawyer X copyright_year = 2017 [PkgVersion] [Test::Compile] xt_mode = 1 [MetaTests] [Test::NoTabs] [PodSyntaxTests] [Test::ReportPrereqs] [PodWeaver] [RunExtraTests] [MetaJSON] [MinimumPerlFast] min = 5.006 ; undocumented config! max = 5.006 ; undocumented config! [MetaConfig] [MetaProvides::Package] [NextRelease] filename = Changes [TestRelease] [Test::MinimumVersion] max_target_perl = 5.006 [@Git] allow_dirty = Changes allow_dirty = dist.ini allow_dirty = README.mkdn add_files_in = Changes add_files_in = dist.ini add_files_in = README.mkdn [Git::NextVersion] [@Filter] -bundle = @Basic -remove = AutoPrereqs -remove = ExtraTests -remove = GatherDir -remove = MakeMaker ; MakeMaker::Awesome used lower down [GatherDir] exclude_filename = Makefile.PL ; -- static meta-information [MetaResources] bugtracker.web = https://github.com/p5pclub/ref-util/issues repository.url = git://github.com/p5pclub/ref-util.git repository.web = https://github.com/p5pclub/ref-util repository.type = git [PruneFiles] match = ~$ ; emacs backup files match = makefile-pl-inc.pl ;[PodCoverageTests] ;[Test::EOL] [Prereqs::FromCPANfile] [ ReadmeAnyFromPod / MarkdownInRoot ] filename = README.mkdn [MakeMaker::Awesome] :version = 0.35 footer_file = makefile-pl-inc.pl ; authordep ExtUtils::HasCompiler = 0.014 [DynamicPrereqs] :version = 0.029 -delimiter = | -body = |if (!want_pp() && can_xs()) { -body = | test_requires('Ref::Util::XS'); -body = | runtime_requires('Ref::Util::XS'); -body = |} Ref-Util-0.203/inc/0000775000076500000240000000000013106015630012676 5ustar aaronstaffRef-Util-0.203/inc/ExtUtils/0000775000076500000240000000000013106015630014457 5ustar aaronstaffRef-Util-0.203/inc/ExtUtils/HasCompiler.pm0000644000076500000240000001426713106015630017233 0ustar aaronstaffpackage ExtUtils::HasCompiler; $ExtUtils::HasCompiler::VERSION = '0.017'; use strict; use warnings; use base 'Exporter'; our @EXPORT_OK = qw/can_compile_loadable_object/; our %EXPORT_TAGS = (all => \@EXPORT_OK); use Config; use Carp 'carp'; use File::Basename 'basename'; use File::Spec::Functions qw/catfile catdir rel2abs/; use File::Temp qw/tempdir tempfile/; my $tempdir = tempdir('HASCOMPILERXXXX', CLEANUP => 1, DIR => '.'); my $loadable_object_format = <<'END'; #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifndef PERL_UNUSED_VAR #define PERL_UNUSED_VAR(var) #endif XS(exported) { #ifdef dVAR dVAR; #endif dXSARGS; PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(items); /* -W */ XSRETURN_IV(42); } #ifndef XS_EXTERNAL #define XS_EXTERNAL(foo) XS(foo) #endif /* we don't want to mess with .def files on mingw */ #if defined(WIN32) && defined(__GNUC__) # define EXPORT __declspec(dllexport) #else # define EXPORT #endif EXPORT XS_EXTERNAL(boot_%s) { #ifdef dVAR dVAR; #endif dXSARGS; PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(items); /* -W */ newXS("%s::exported", exported, __FILE__); } END my $counter = 1; my %prelinking = map { $_ => 1 } qw/MSWin32 VMS aix/; sub can_compile_loadable_object { my %args = @_; my $output = $args{output} || \*STDOUT; my $config = $args{config} || 'ExtUtils::HasCompiler::Config'; return if not $config->get('usedl'); my ($source_handle, $source_name) = tempfile('TESTXXXX', DIR => $tempdir, SUFFIX => '.c', UNLINK => 1); my $basename = basename($source_name, '.c'); my $shortname = '_Loadable' . $counter++; my $package = "ExtUtils::HasCompiler::$shortname"; printf $source_handle $loadable_object_format, $basename, $package or do { carp "Couldn't write to $source_name: $!"; return }; close $source_handle or do { carp "Couldn't close $source_name: $!"; return }; my $abs_basename = catfile($tempdir, $basename); my $object_file = $abs_basename . $config->get('_o'); my $loadable_object = $abs_basename . '.' . $config->get('dlext'); my $incdir = catdir($config->get('archlibexp'), 'CORE'); my ($cc, $ccflags, $optimize, $cccdlflags, $ld, $ldflags, $lddlflags, $libperl, $perllibs) = map { $config->get($_) } qw/cc ccflags optimize cccdlflags ld ldflags lddlflags libperl perllibs/; if ($prelinking{$^O}) { require ExtUtils::Mksymlists; ExtUtils::Mksymlists::Mksymlists(NAME => $basename, FILE => $abs_basename, IMPORTS => {}); } my @commands; if ($^O eq 'MSWin32' && $cc =~ /^cl/) { push @commands, qq{$cc $ccflags $cccdlflags $optimize /I "$incdir" /c $source_name /Fo$object_file}; push @commands, qq{$ld $object_file $lddlflags $libperl $perllibs /out:$loadable_object /def:$abs_basename.def /pdb:$abs_basename.pdb}; } elsif ($^O eq 'VMS') { # Mksymlists is only the beginning of the story. open my $opt_fh, '>>', "$abs_basename.opt" or do { carp "Couldn't append to '$abs_basename.opt'"; return }; print $opt_fh "PerlShr/Share\n"; close $opt_fh; my $incdirs = $ccflags =~ s{ /inc[^=]+ (?:=)+ (?:\()? ( [^\/\)]* ) }{}xi ? "$1,$incdir" : $incdir; push @commands, qq{$cc $ccflags $optimize /include=($incdirs) $cccdlflags $source_name /obj=$object_file}; push @commands, qq{$ld $ldflags $lddlflags=$loadable_object $object_file,$abs_basename.opt/OPTIONS,${incdir}perlshr_attr.opt/OPTIONS' $perllibs}; } else { my @extra; if ($^O eq 'MSWin32') { my $lib = '-l' . ($libperl =~ /lib([^.]+)\./)[0]; push @extra, "$abs_basename.def", $lib, $perllibs; } elsif ($^O eq 'cygwin') { push @extra, catfile($incdir, $config->get('useshrplib') ? 'libperl.dll.a' : 'libperl.a'); } elsif ($^O eq 'aix') { $lddlflags =~ s/\Q$(BASEEXT)\E/$abs_basename/; $lddlflags =~ s/\Q$(PERL_INC)\E/$incdir/; } elsif ($^O eq 'android') { push @extra, qq{"-L$incdir"}, '-lperl', $perllibs; } push @commands, qq{$cc $ccflags $optimize "-I$incdir" $cccdlflags -c $source_name -o $object_file}; push @commands, qq{$ld $object_file -o $loadable_object $lddlflags @extra}; } for my $command (@commands) { print $output "$command\n" if not $args{quiet}; system $command and do { carp "Couldn't execute $command: $!"; return }; } # Skip loading when cross-compiling return 1 if exists $args{skip_load} ? $args{skip_load} : $config->get('usecrosscompile'); require DynaLoader; local @DynaLoader::dl_require_symbols = "boot_$basename"; my $handle = DynaLoader::dl_load_file(rel2abs($loadable_object), 0); if ($handle) { my $symbol = DynaLoader::dl_find_symbol($handle, "boot_$basename") or do { carp "Couldn't find boot symbol for $basename"; return }; my $compilet = DynaLoader::dl_install_xsub('__ANON__::__ANON__', $symbol, $source_name); my $ret = eval { $compilet->(); $package->exported } or carp $@; delete $ExtUtils::HasCompiler::{"$shortname\::"}; eval { DynaLoader::dl_unload_file($handle) } or carp $@; return defined $ret && $ret == 42; } else { carp "Couldn't load $loadable_object: " . DynaLoader::dl_error(); return; } } sub ExtUtils::HasCompiler::Config::get { my (undef, $key) = @_; return $ENV{uc $key} || $Config{$key}; } 1; # ABSTRACT: Check for the presence of a compiler __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::HasCompiler - Check for the presence of a compiler =head1 VERSION version 0.017 =head1 DESCRIPTION This module tries to check if the current system is capable of compiling, linking and loading an XS module. B: this is an early release, interface stability isn't guaranteed yet. =head1 FUNCTIONS =head2 can_compile_loadable_object(%opts) This checks if the system can compile, link and load a perl loadable object. It may take the following options: =over 4 =item * quiet Do not output the executed compilation commands. =item * config An L (compatible) object for configuration. =item * skip_load This causes can_compile_loadable_object to not try to load the generated object. This defaults to true on a cross-compiling perl. =back =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Leon Timmermans. 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 Ref-Util-0.203/inc/ExtUtils/MakeMaker/0000775000076500000240000000000013106015630016314 5ustar aaronstaffRef-Util-0.203/inc/ExtUtils/MakeMaker/Dist/0000775000076500000240000000000013106015630017217 5ustar aaronstaffRef-Util-0.203/inc/ExtUtils/MakeMaker/Dist/Zilla/0000775000076500000240000000000013106015630020272 5ustar aaronstaffRef-Util-0.203/inc/ExtUtils/MakeMaker/Dist/Zilla/Develop.pm0000644000076500000240000001242013106015630022223 0ustar aaronstaffpackage ExtUtils::MakeMaker::Dist::Zilla::Develop; BEGIN { $ExtUtils::MakeMaker::Dist::Zilla::Develop::AUTHORITY = 'cpan:DOY'; } { $ExtUtils::MakeMaker::Dist::Zilla::Develop::VERSION = '0.03'; } use strict; use warnings; # ABSTRACT: create bare-bones Makefile.PL files for use with dzil use ExtUtils::MakeMaker (); sub import { warn <<'EOF'; ********************************* WARNING ********************************** This module uses Dist::Zilla for development. This Makefile.PL will let you run the tests, but you are encouraged to install Dist::Zilla and the needed plugins if you intend on doing any serious hacking. **************************************************************************** EOF ExtUtils::MakeMaker->export_to_level(1, @_); } { package # hide from PAUSE MY; my $message; BEGIN { $message = <<'MESSAGE'; ********************************* ERROR ************************************ This module uses Dist::Zilla for development. This Makefile.PL will let you run the tests, but should not be used for installation or building dists. Building a dist should be done with 'dzil build', installation should be done with 'dzil install', and releasing should be done with 'dzil release'. **************************************************************************** MESSAGE $message =~ s/^(.*)$/\t\$(NOECHO) echo "$1";/mg; } sub install { return < 'Foo::Bar'); =head1 DESCRIPTION L makes developing modules much easier by generating all kinds of boilerplate files, saving authors from having to write them by hand, but in some cases this can make developing more inconvenient. The most prominent example of this is with C files - although the majority of distributions can be hacked on just by editing the files in a source control checkout and using C for testing, for some this isn't sufficient. In particular, distributions which use an auto-generated test suite and distributions which use XS both need special handling at build time before they will function, and with Dist::Zilla, this means running C and rebuilding after every change. This is tedious! This module provides an alternative. Create a minimal C in source control which handles just enough functionality for basic development (it can be as minimal as just what is in the L, but can also contain commands to generate your test suite, for example), and tell Dist::Zilla to replace it with a real C when you're actually ready to build a real distribution. To do this, make sure you're still using the L plugin, either directly or through a pluginbundle like L<@Basic|Dist::Zilla::PluginBundle::Basic>, and add the C option to your F where you use C<[GatherDir]>. In addition, this module also intercepts the C and C rules in the generated Makefile to run the appropriate Dist::Zilla commands (C and C). This allows users to continue to use the C set of commands, and have the correct thing continue to happen. Note that if you're using this module to ease testing of an XS distribution, you'll need to account for your module not containing a C<$VERSION> statement (assuming you're using the L plugin). To do this, you should use an XSLoader invocation similar to this: BEGIN { XSLoader::load( 'Foo::Bar', $Foo::Bar::{VERSION} ? ${ $Foo::Bar::{VERSION} } : () ); } This ensures that the C<$Foo::Bar::VERSION> glob isn't created if it didn't exist initially, since this can confuse XSLoader. =head1 BUGS No known bugs. Please report any bugs to GitHub Issues at L. =head1 SEE ALSO L L =head1 SUPPORT You can find this documentation for this module with the perldoc command. perldoc ExtUtils::MakeMaker::Dist::Zilla::Develop You can also look for information at: =over 4 =item * MetaCPAN L =item * Github L =item * RT: CPAN's request tracker L =item * CPAN Ratings L =back =head1 AUTHOR Jesse Luehrs =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 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 Ref-Util-0.203/lib/0000775000076500000240000000000013106015630012673 5ustar aaronstaffRef-Util-0.203/lib/Ref/0000775000076500000240000000000013106015630013407 5ustar aaronstaffRef-Util-0.203/lib/Ref/Util/0000775000076500000240000000000013106015630014324 5ustar aaronstaffRef-Util-0.203/lib/Ref/Util/PP.pm0000644000076500000240000001651013106015630015202 0ustar aaronstaffpackage Ref::Util::PP; $Ref::Util::PP::VERSION = '0.203'; # ABSTRACT: pure-Perl version of Ref::Util use strict; use warnings; use Carp (); use Scalar::Util (); use Exporter 5.57 'import'; use constant _FORMAT_REFS_WORK => ("$]" >= 5.007); use constant _RX_NEEDS_MAGIC => (Scalar::Util::reftype(qr/^/) ne 'REGEXP'); our %EXPORT_TAGS = ( 'all' => [qw< is_ref is_scalarref is_arrayref is_hashref is_coderef is_regexpref is_globref is_formatref is_ioref is_refref is_plain_ref is_plain_scalarref is_plain_arrayref is_plain_hashref is_plain_coderef is_plain_globref is_plain_formatref is_plain_refref is_blessed_ref is_blessed_scalarref is_blessed_arrayref is_blessed_hashref is_blessed_coderef is_blessed_globref is_blessed_formatref is_blessed_refref >] ); our @EXPORT = (); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); sub _using_custom_ops () { 0 } if (_RX_NEEDS_MAGIC) { require B; *_is_regexp = sub { no warnings 'uninitialized'; return 0 if ref($_[0]) eq ''; my $o = B::svref_2object($_[0]) or return 0; return 0 if Scalar::Util::blessed($o) ne 'B::PVMG'; my $m = $o->MAGIC; while ($m) { return 1 if $m->TYPE eq 'r'; $m = $m->MOREMAGIC; } return 0; }; } # ---- # -- is_* # ---- sub is_ref($) { length ref $_[0] } sub is_scalarref($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_scalarref") if @_ > 1; my $reftype = Scalar::Util::reftype( $_[0] ); ( $reftype eq 'SCALAR' || $reftype eq 'VSTRING' ) && (!_RX_NEEDS_MAGIC || !_is_regexp($_[0])); } sub is_arrayref($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_arrayref") if @_ > 1; Scalar::Util::reftype( $_[0] ) eq 'ARRAY'; } sub is_hashref($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_hashref") if @_ > 1; Scalar::Util::reftype( $_[0] ) eq 'HASH'; } sub is_coderef($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_coderef") if @_ > 1; Scalar::Util::reftype( $_[0] ) eq 'CODE'; } sub is_regexpref($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_regexpref") if @_ > 1; _RX_NEEDS_MAGIC ? _is_regexp( $_[0] ) : re::is_regexp( $_[0] ); } sub is_globref($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_globref") if @_ > 1; Scalar::Util::reftype( $_[0] ) eq 'GLOB'; } sub is_formatref($) { _FORMAT_REFS_WORK or Carp::croak("is_formatref() isn't available on Perl 5.6.x and under"); no warnings 'uninitialized'; Carp::croak("Too many arguments for is_formatref") if @_ > 1; Scalar::Util::reftype( $_[0] ) eq 'FORMAT'; } sub is_ioref($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_ioref") if @_ > 1; Scalar::Util::reftype( $_[0] ) eq 'IO'; } sub is_refref($) { no warnings 'uninitialized'; Carp::croak("Too many arguments for is_refref") if @_ > 1; Scalar::Util::reftype( $_[0] ) eq 'REF'; } # ---- # -- is_plain_* # ---- sub is_plain_ref($) { Carp::croak("Too many arguments for is_plain_ref") if @_ > 1; ref $_[0] && !Scalar::Util::blessed( $_[0] ); } sub is_plain_scalarref($) { Carp::croak("Too many arguments for is_plain_scalarref") if @_ > 1; !defined Scalar::Util::blessed( $_[0] ) && ( ref( $_[0] ) eq 'SCALAR' || ref( $_[0] ) eq 'VSTRING' ); } sub is_plain_arrayref($) { Carp::croak("Too many arguments for is_plain_arrayref") if @_ > 1; !defined Scalar::Util::blessed( $_[0] ) && ref( $_[0] ) eq 'ARRAY'; } sub is_plain_hashref($) { Carp::croak("Too many arguments for is_plain_hashref") if @_ > 1; !defined Scalar::Util::blessed( $_[0] ) && ref( $_[0] ) eq 'HASH'; } sub is_plain_coderef($) { Carp::croak("Too many arguments for is_plain_coderef") if @_ > 1; !defined Scalar::Util::blessed( $_[0] ) && ref( $_[0] ) eq 'CODE'; } sub is_plain_globref($) { Carp::croak("Too many arguments for is_plain_globref") if @_ > 1; !defined Scalar::Util::blessed( $_[0] ) && ref( $_[0] ) eq 'GLOB'; } sub is_plain_formatref($) { _FORMAT_REFS_WORK or Carp::croak("is_plain_formatref() isn't available on Perl 5.6.x and under"); Carp::croak("Too many arguments for is_plain_formatref") if @_ > 1; !defined Scalar::Util::blessed( $_[0] ) && ref( $_[0] ) eq 'FORMAT'; } sub is_plain_refref($) { Carp::croak("Too many arguments for is_plain_refref") if @_ > 1; !defined Scalar::Util::blessed( $_[0] ) && ref( $_[0] ) eq 'REF'; } # ---- # -- is_blessed_* # ---- sub is_blessed_ref($) { Carp::croak("Too many arguments for is_blessed_ref") if @_ > 1; defined Scalar::Util::blessed( $_[0] ); } sub is_blessed_scalarref($) { Carp::croak("Too many arguments for is_blessed_scalarref") if @_ > 1; my $reftype = Scalar::Util::reftype( $_[0] ); defined Scalar::Util::blessed( $_[0] ) && ($reftype eq 'SCALAR' || $reftype eq 'VSTRING') && (!_RX_NEEDS_MAGIC || !_is_regexp( $_[0] )); } sub is_blessed_arrayref($) { Carp::croak("Too many arguments for is_blessed_arrayref") if @_ > 1; defined Scalar::Util::blessed( $_[0] ) && Scalar::Util::reftype( $_[0] ) eq 'ARRAY'; } sub is_blessed_hashref($) { Carp::croak("Too many arguments for is_blessed_hashref") if @_ > 1; defined Scalar::Util::blessed( $_[0] ) && Scalar::Util::reftype( $_[0] ) eq 'HASH'; } sub is_blessed_coderef($) { Carp::croak("Too many arguments for is_blessed_coderef") if @_ > 1; defined Scalar::Util::blessed( $_[0] ) && Scalar::Util::reftype( $_[0] ) eq 'CODE'; } sub is_blessed_globref($) { Carp::croak("Too many arguments for is_blessed_globref") if @_ > 1; defined Scalar::Util::blessed( $_[0] ) && Scalar::Util::reftype( $_[0] ) eq 'GLOB'; } sub is_blessed_formatref($) { _FORMAT_REFS_WORK or Carp::croak("is_blessed_formatref() isn't available on Perl 5.6.x and under"); Carp::croak("Too many arguments for is_blessed_formatref") if @_ > 1; defined Scalar::Util::blessed( $_[0] ) && Scalar::Util::reftype( $_[0] ) eq 'FORMAT'; } sub is_blessed_refref($) { Carp::croak("Too many arguments for is_blessed_refref") if @_ > 1; defined Scalar::Util::blessed( $_[0] ) && Scalar::Util::reftype( $_[0] ) eq 'REF'; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Ref::Util::PP - pure-Perl version of Ref::Util =head1 VERSION version 0.203 =head1 SYNOPSIS use Ref::Util; =head1 DESCRIPTION This module provides a pure-Perl implementation of the functions in L. Ref::Util:PP will be used automatically if Ref::Util is installed on a system with no C compiler, but you can force its usage by setting either C<$Ref::Util::IMPLEMENTATION> or the C environment variable to C. =head1 AUTHORS =over 4 =item * Sawyer X =item * Aaron Crane =item * Vikenty Fesunov =item * Gonzalo Diethelm =item * Karen Etheridge =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2017 by Sawyer X. This is free software, licensed under: The MIT (X11) License =cut Ref-Util-0.203/lib/Ref/Util.pm0000644000076500000240000002737413106015630014675 0ustar aaronstaffpackage Ref::Util; # ABSTRACT: Utility functions for checking references $Ref::Util::VERSION = '0.203'; use strict; use warnings; use Exporter 5.57 'import'; { my $impl = $ENV{PERL_REF_UTIL_IMPLEMENTATION} || our $IMPLEMENTATION || 'XS'; if ($impl ne 'PP' && eval { require Ref::Util::XS; 1 }) { _install_aliases('Ref::Util::XS'); } else { require Ref::Util::PP; _install_aliases('Ref::Util::PP'); } } sub _install_aliases { my ($package) = @_; no warnings 'once'; no strict 'refs'; our %EXPORT_TAGS = %{"${package}::EXPORT_TAGS"}; our @EXPORT_OK = @{"${package}::EXPORT_OK"}; *$_ = \&{"${package}::$_"} for '_using_custom_ops', @EXPORT_OK; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Ref::Util - Utility functions for checking references =head1 VERSION version 0.203 =head1 SYNOPSIS use Ref::Util qw( is_plain_arrayref is_plain_hashref ); if ( is_plain_arrayref( $something ) ) { print for @{ $something }; } elsif ( is_plain_hashref( $something ) ) { print for sort values %{ $something }; } =head1 DESCRIPTION Ref::Util introduces several functions to help identify references in a B (and usually faster) way. In short: # conventional approach # with Ref::Util ref( $foo ) eq 'ARRAY' is_plain_arrayref( $foo ) use Scalar::Util qw( reftype ); reftype( $foo ) eq 'ARRAY' is_arrayref( $foo ) The difference: =over 4 =item * No comparison against a string constant When you call C, you stringify the reference and then compare it to some string constant (like C or C). Not just awkward, it's brittle since you can mispell the string. If you use L's C, you still compare it as a string: if ( reftype($foo) eq 'ARRAY' ) { ... } =item * Supports blessed variables B In future versions, the idea is to make the default functions use the B variation, which means explicitly non-blessed references. If you want to explicitly check for B references, you should use the C functions. There will be an C variation which will act like the current main functions - not caring whether it's blessed or not. When calling C, you receive either the reference type (B, B, B, etc.) or the package it's blessed into. When calling C (et. al.), you check the variable flags, so even if it's blessed, you know what type of variable is blessed. my $foo = bless {}, 'PKG'; ref($foo) eq 'HASH'; # fails use Ref::Util 'is_hashref'; my $foo = bless {}, 'PKG'; is_hashref($foo); # works On the other hand, in some situations it might be better to specifically exclude blessed references. The rationale for that might be that merely because some object happens to be implemented using a hash doesn't mean it's necessarily correct to treat it as a hash. For these situations, you can use C and friends, which have the same performance benefits as C. There is also a family of functions with names like C; these return true for blessed object instances that are implemented using the relevant underlying type. =item * Supports tied variables and magic Tied variables (used in L, for example) are supported. use Ref::Util qw; use Readonly; Readonly::Scalar my $rh2 => { a => { b => 2 } }; is_plain_hashref($rh2); # success L added support for this in 0.100. Prior to this version the test would fail. =item * Ignores overloading These functions ignore overloaded operators and simply check the variable type. Overloading will likely not ever be supported, since I deem it problematic and confusing. Overloading makes your variables opaque containers and hides away B they are and instead require you to figure out B to use them. This leads to code that has to test different abilities (in C, so it doesn't crash) and to interfaces that get around what a person thought you would do with a variable. This would have been alright, except there is no clear way of introspecting it. =item * Ignores subtle types: The following types, provided by L's C, are not supported: =over 4 =item * C This is a C ("normal" variable) with a flag set for VSTRINGs. Since this is not a reference, it is not supported. =item * C A variable that delegates to another scalar. Since this is not a reference, it is not supported. =item * C I couldn't find documentation for this type. =back Support might be added, if a good reason arises. =item * Usually fast When possible, Ref::Util uses L as its implementation. (If you don't have a C compiler available, it uses a pure Perl fallback that has all the other advantages of Ref::Util, but isn't as fast.) In fact, Ref::Util::XS has two alternative implementations available internally, depending on the features supported by the version of Perl you're using. For Perls that supports custom OPs, we actually add an OP (which is faster); for other Perls, the implementation that simply calls an XS function (which is still faster than the pure-Perl equivalent). See below for L. =back =head1 EXPORT Nothing is exported by default. You can ask for specific subroutines (described below) or ask for all subroutines at once: use Ref::Util qw; # or use Ref::Util ':all'; =head1 SUBROUTINES =head2 is_ref($ref) Check for a reference to anything. is_ref([]); =head2 is_scalarref($ref) Check for a scalar reference. is_scalarref(\"hello"); is_scalarref(\30); is_scalarref(\$value); Note that, even though a reference is itself a type of scalar value, a reference to another reference is not treated as a scalar reference: !is_scalarref(\\1); The rationale for this is two-fold. First, callers that want to decide how to handle inputs based on their reference type will usually want to treat a ref-ref and a scalar-ref differently. Secondly, this more closely matches the behavior of the C built-in and of L, which report a ref-ref as C rather than C. =head2 is_arrayref($ref) Check for an array reference. is_arrayref([]); =head2 is_hashref($ref) Check for a hash reference. is_hashref({}); =head2 is_coderef($ref) Check for a code reference. is_coderef( sub {} ); =head2 is_regexpref($ref) Check for a regular expression (regex, regexp) reference. is_regexpref( qr// ); =head2 is_globref($ref) Check for a glob reference. is_globref( \*STDIN ); =head2 is_formatref($ref) Check for a format reference. # set up format in STDOUT format STDOUT = . # now we can test it is_formatref( *main::STDOUT{'FORMAT'} ); This function is not available in Perl 5.6 and will trigger a C. =head2 is_ioref($ref) Check for an IO reference. is_ioref( *STDOUT{IO} ); =head2 is_refref($ref) Check for a reference to a reference. is_refref( \[] ); # reference to array reference =head2 is_plain_scalarref($ref) Check for an unblessed scalar reference. is_plain_scalarref(\"hello"); is_plain_scalarref(\30); is_plain_scalarref(\$value); =head2 is_plain_ref($ref) Check for an unblessed reference to anything. is_plain_ref([]); =head2 is_plain_arrayref($ref) Check for an unblessed array reference. is_plain_arrayref([]); =head2 is_plain_hashref($ref) Check for an unblessed hash reference. is_plain_hashref({}); =head2 is_plain_coderef($ref) Check for an unblessed code reference. is_plain_coderef( sub {} ); =head2 is_plain_globref($ref) Check for an unblessed glob reference. is_plain_globref( \*STDIN ); =head2 is_plain_formatref($ref) Check for an unblessed format reference. # set up format in STDOUT format STDOUT = . # now we can test it is_plain_formatref(bless *main::STDOUT{'FORMAT'} ); =head2 is_plain_refref($ref) Check for an unblessed reference to a reference. is_plain_refref( \[] ); # reference to array reference =head2 is_blessed_scalarref($ref) Check for a blessed scalar reference. is_blessed_scalarref(bless \$value); =head2 is_blessed_ref($ref) Check for a blessed reference to anything. is_blessed_ref(bless [], $class); =head2 is_blessed_arrayref($ref) Check for a blessed array reference. is_blessed_arrayref(bless [], $class); =head2 is_blessed_hashref($ref) Check for a blessed hash reference. is_blessed_hashref(bless {}, $class); =head2 is_blessed_coderef($ref) Check for a blessed code reference. is_blessed_coderef( bless sub {}, $class ); =head2 is_blessed_globref($ref) Check for a blessed glob reference. is_blessed_globref( bless \*STDIN, $class ); =head2 is_blessed_formatref($ref) Check for a blessed format reference. # set up format for FH format FH = . # now we can test it is_blessed_formatref(bless *FH{'FORMAT'}, $class ); =head2 is_blessed_refref($ref) Check for a blessed reference to a reference. is_blessed_refref( bless \[], $class ); # reference to array reference =head1 BENCHMARKS Here is a benchmark comparing similar checks. my $bench = Dumbbench->new( target_rel_precision => 0.005, initial_runs => 20, ); my $amount = 1e7; my $ref = []; $bench->add_instances( Dumbbench::Instance::PerlSub->new( name => 'Ref::Util::is_plain_arrayref (CustomOP)', code => sub { Ref::Util::is_plain_arrayref($ref) for ( 1 .. $amount ) }, ), Dumbbench::Instance::PerlSub->new( name => 'ref(), reftype(), !blessed()', code => sub { ref $ref && Scalar::Util::reftype($ref) eq 'ARRAY' && !Scalar::Util::blessed($ref) for ( 1 .. $amount ); }, ), Dumbbench::Instance::PerlSub->new( name => 'ref()', code => sub { ref($ref) eq 'ARRAY' for ( 1 .. $amount ) }, ), Dumbbench::Instance::PerlSub->new( name => 'Data::Util::is_array_ref', code => sub { is_array_ref($ref) for ( 1 .. $amount ) }, ), ); The results: ref(): 5.335e+00 +/- 1.8e-02 (0.3%) ref(), reftype(), !blessed(): 1.5545e+01 +/- 3.1e-02 (0.2%) Ref::Util::is_plain_arrayref (CustomOP): 2.7951e+00 +/- 6.2e-03 (0.2%) Data::Util::is_array_ref: 5.9074e+00 +/- 7.5e-03 (0.1%) (Rounded run time per iteration) A benchmark against L: Ref::Util::is_plain_arrayref: 3.47157e-01 +/- 6.8e-05 (0.0%) Data::Util::is_array_ref: 6.7562e-01 +/- 7.5e-04 (0.1%) =head1 SEE ALSO =over 4 =item * L =item * L =item * L =back =head1 THANKS The following people have been invaluable in their feedback and support. =over 4 =item * Yves Orton =item * Steffen Müller =item * Jarkko Hietaniemi =item * Mattia Barbon =item * Zefram =item * Tony Cook =item * Sergey Aleynikov =back =head1 AUTHORS =over 4 =item * Aaron Crane =item * Vikentiy Fesunov =item * Sawyer X =item * Gonzalo Diethelm =item * p5pclub =back =head1 LICENSE This software is made available under the MIT Licence as stated in the accompanying LICENSE file. =head1 AUTHORS =over 4 =item * Sawyer X =item * Aaron Crane =item * Vikenty Fesunov =item * Gonzalo Diethelm =item * Karen Etheridge =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2017 by Sawyer X. This is free software, licensed under: The MIT (X11) License =cut Ref-Util-0.203/LICENSE0000644000076500000240000000220313106015630013125 0ustar aaronstaffThis software is Copyright (c) 2017 by Sawyer X. This is free software, licensed under: The MIT (X11) License The MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Ref-Util-0.203/Makefile.PL0000644000076500000240000000673013106015630014103 0ustar aaronstaff# This Makefile.PL for Ref-Util was generated by # Dist::Zilla::Plugin::MakeMaker::Awesome 0.38. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Utility functions for checking references", "AUTHOR" => "Sawyer X , Aaron Crane , Vikenty Fesunov , Gonzalo Diethelm , Karen Etheridge ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "Text::ParseWords" => 0 }, "DISTNAME" => "Ref-Util", "LICENSE" => "mit", "MIN_PERL_VERSION" => "5.006", "NAME" => "Ref::Util", "PREREQ_PM" => { "Exporter" => "5.57" }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => "0.96" }, "VERSION" => "0.203", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Exporter" => "5.57", "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => "0.96" ); # inserted by Dist::Zilla::Plugin::DynamicPrereqs 0.033 if (!want_pp() && can_xs()) { test_requires('Ref::Util::XS'); runtime_requires('Ref::Util::XS'); } unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); if (eval { require Ref::Util } && Ref::Util->VERSION < 0.114) { package MY; no warnings 'once'; *install = sub { my $self = shift; return ' pure_site_install :: $(NOECHO) $(RM_F) ' . $self->quote_literal( $self->catfile('$(DESTINSTALLSITEARCH)', 'Ref', 'Util.pm') ) . "\n" . $self->SUPER::install; }; } # inserted by Dist::Zilla::Plugin::DynamicPrereqs 0.033 sub _add_prereq { my ($mm_key, $module, $version_or_range) = @_; $version_or_range ||= 0; warn "$module already exists in $mm_key (at version $WriteMakefileArgs{$mm_key}{$module}) -- need to do a sane metamerge!" if exists $WriteMakefileArgs{$mm_key}{$module} and $WriteMakefileArgs{$mm_key}{$module} ne '0' and $WriteMakefileArgs{$mm_key}{$module} ne $version_or_range; warn "$module already exists in FallbackPrereqs (at version $WriteMakefileArgs{$mm_key}{$module}) -- need to do a sane metamerge!" if exists $FallbackPrereqs{$module} and $FallbackPrereqs{$module} ne '0' and $FallbackPrereqs{$module} ne $version_or_range; $WriteMakefileArgs{$mm_key}{$module} = $FallbackPrereqs{$module} = $version_or_range; return; } use lib 'inc'; use ExtUtils::HasCompiler 0.014 'can_compile_loadable_object'; { my $can_xs; sub can_xs { return $can_xs if defined $can_xs; $can_xs = can_compile_loadable_object(quiet => 1) ? 1 : 0; } } sub parse_args { require ExtUtils::MakeMaker; require Text::ParseWords; ExtUtils::MakeMaker::parse_args( my $tmp = {}, Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''), @ARGV, ); return $tmp->{ARGS} || {}; } sub runtime_requires { my ($module, $version_or_range) = @_; _add_prereq(PREREQ_PM => $module, $version_or_range); } sub test_requires { my ($module, $version_or_range) = @_; _add_prereq(TEST_REQUIRES => $module, $version_or_range); } { my $want_pp; sub want_pp { return $want_pp if defined $want_pp; $want_pp = parse_args()->{PUREPERL_ONLY} ? 1 : 0 } } Ref-Util-0.203/MANIFEST0000644000076500000240000000112113106015630013247 0ustar aaronstaff# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.009. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README cpanfile dist.ini inc/ExtUtils/HasCompiler.pm inc/ExtUtils/MakeMaker/Dist/Zilla/Develop.pm lib/Ref/Util.pm lib/Ref/Util/PP.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/all-permutations.t t/arrayref.t t/b-concise.t t/dynamic.t t/expr.t t/functions.t t/list.t t/magic-readonly.t t/magic.t t/pureperl.t t/toomany.t tools/bench.pl xt/author/00-compile.t xt/author/no-tabs.t xt/author/pod-syntax.t xt/release/distmeta.t xt/release/minimum-version.t Ref-Util-0.203/META.json0000644000076500000240000004570213106015630013554 0ustar aaronstaff{ "abstract" : "Utility functions for checking references", "author" : [ "Sawyer X ", "Aaron Crane ", "Vikenty Fesunov ", "Gonzalo Diethelm ", "Karen Etheridge " ], "dynamic_config" : 1, "generated_by" : "Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150005", "license" : [ "mit" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Ref-Util", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Text::ParseWords" : "0" } }, "develop" : { "requires" : { "ExtUtils::HasCompiler" : "0.014", "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::CPAN::Meta" : "0", "Test::MinimumVersion" : "0", "Test::More" : "0.88", "Test::NoTabs" : "0", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Exporter" : "5.57", "perl" : "5.006" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test::More" : "0.96" } } }, "provides" : { "Ref::Util" : { "file" : "lib/Ref/Util.pm", "version" : "0.203" }, "Ref::Util::PP" : { "file" : "lib/Ref/Util/PP.pm", "version" : "0.203" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/p5pclub/ref-util/issues" }, "repository" : { "type" : "git", "url" : "git://github.com/p5pclub/ref-util.git", "web" : "https://github.com/p5pclub/ref-util" } }, "version" : "0.203", "x_Dist_Zilla" : { "perl" : { "version" : "5.024001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "PkgVersion", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : "0", "fail_on_warning" : "author", "fake_home" : 0, "filename" : "xt/author/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "develop", "script_finder" : [ ":PerlExecFiles" ], "skips" : [], "switch" : [] } }, "name" : "Test::Compile", "version" : "2.056" }, { "class" : "Dist::Zilla::Plugin::MetaTests", "name" : "MetaTests", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "Test::NoTabs", "version" : "0.15" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "PodSyntaxTests", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "Test::ReportPrereqs", "version" : "0.027" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@Default/SingleEncoding", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@Default/Name", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@Default/Version", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Default/prelude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@Default/Leftovers", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Default/postlude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@Default/Authors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@Default/Legal", "version" : "4.015" } ] } }, "name" : "PodWeaver", "version" : "4.008" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "MetaJSON", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::MinimumPerlFast", "name" : "MinimumPerlFast", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "MetaConfig", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.009" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : "1", "inherit_version" : "1", "meta_noindex" : "1" }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000031", "version" : "0.004" } }, "name" : "MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "NextRelease", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "TestRelease", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::Test::MinimumVersion", "name" : "Test::MinimumVersion", "version" : "2.000007" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "README.mkdn", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.12.2", "repo_root" : "." } }, "name" : "@Git/Check", "version" : "2.042" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [ "Changes", "README.mkdn", "dist.ini" ], "commit_msg" : "v%v%n%n%c" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "README.mkdn", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.12.2", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git/Commit", "version" : "2.042" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "v0.203", "tag_format" : "v%v", "tag_message" : "v%v" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.12.2", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git/Tag", "version" : "2.042" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.12.2", "repo_root" : "." } }, "name" : "@Git/Push", "version" : "2.042" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : "0.001", "version_by_branch" : 0, "version_regexp" : "(?^:^v(.+)$)" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.12.2", "repo_root" : "." } }, "name" : "Git::NextVersion", "version" : "2.042" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Filter/PruneCruft", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Filter/ManifestSkip", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Filter/MetaYAML", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Filter/License", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@Filter/Readme", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Filter/ExecDir", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Filter/ShareDir", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Filter/Manifest", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Filter/TestRelease", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Filter/ConfirmRelease", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Filter/UploadToCPAN", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "Makefile.PL" ], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." } }, "name" : "GatherDir", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "MetaResources", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::PruneFiles", "name" : "PruneFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::Prereqs::FromCPANfile", "name" : "Prereqs::FromCPANfile", "version" : "0.08" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "MarkdownInRoot", "version" : "0.163250" }, { "class" : "Dist::Zilla::Plugin::MakeMaker::Awesome", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "MakeMaker::Awesome", "version" : "0.38" }, { "class" : "Dist::Zilla::Plugin::DynamicPrereqs", "config" : { "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000031", "version" : "0.004" } }, "name" : "DynamicPrereqs", "version" : "0.033" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.009" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.009" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "6.009" } }, "x_serialization_backend" : "Cpanel::JSON::XS version 3.0233" } Ref-Util-0.203/META.yml0000644000076500000240000002751613106015630013407 0ustar aaronstaff--- abstract: 'Utility functions for checking references' author: - 'Sawyer X ' - 'Aaron Crane ' - 'Vikenty Fesunov ' - 'Gonzalo Diethelm ' - 'Karen Etheridge ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Test::More: '0.96' configure_requires: ExtUtils::MakeMaker: '0' Text::ParseWords: '0' dynamic_config: 1 generated_by: 'Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150005' license: mit meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Ref-Util provides: Ref::Util: file: lib/Ref/Util.pm version: '0.203' Ref::Util::PP: file: lib/Ref/Util/PP.pm version: '0.203' requires: Exporter: '5.57' perl: '5.006' resources: bugtracker: https://github.com/p5pclub/ref-util/issues repository: git://github.com/p5pclub/ref-util.git version: '0.203' x_Dist_Zilla: perl: version: '5.024001' plugins: - class: Dist::Zilla::Plugin::PkgVersion name: PkgVersion version: '6.009' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: 0 filename: xt/author/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: develop script_finder: - ':PerlExecFiles' skips: [] switch: [] name: Test::Compile version: '2.056' - class: Dist::Zilla::Plugin::MetaTests name: MetaTests version: '6.009' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: Test::NoTabs version: '0.15' - class: Dist::Zilla::Plugin::PodSyntaxTests name: PodSyntaxTests version: '6.009' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: Test::ReportPrereqs version: '0.027' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.015' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.015' - class: Pod::Weaver::Plugin::SingleEncoding name: '@Default/SingleEncoding' version: '4.015' - class: Pod::Weaver::Section::Name name: '@Default/Name' version: '4.015' - class: Pod::Weaver::Section::Version name: '@Default/Version' version: '4.015' - class: Pod::Weaver::Section::Region name: '@Default/prelude' version: '4.015' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.015' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.015' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.015' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.015' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.015' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.015' - class: Pod::Weaver::Section::Leftovers name: '@Default/Leftovers' version: '4.015' - class: Pod::Weaver::Section::Region name: '@Default/postlude' version: '4.015' - class: Pod::Weaver::Section::Authors name: '@Default/Authors' version: '4.015' - class: Pod::Weaver::Section::Legal name: '@Default/Legal' version: '4.015' name: PodWeaver version: '4.008' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: RunExtraTests version: '0.029' - class: Dist::Zilla::Plugin::MetaJSON name: MetaJSON version: '6.009' - class: Dist::Zilla::Plugin::MinimumPerlFast name: MinimumPerlFast version: '0.003' - class: Dist::Zilla::Plugin::MetaConfig name: MetaConfig version: '6.009' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: MetaProvides::Package/AUTOVIV/:InstallModulesPM version: '6.009' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000031' version: '0.004' name: MetaProvides::Package version: '2.004003' - class: Dist::Zilla::Plugin::NextRelease name: NextRelease version: '6.009' - class: Dist::Zilla::Plugin::TestRelease name: TestRelease version: '6.009' - class: Dist::Zilla::Plugin::Test::MinimumVersion name: Test::MinimumVersion version: '2.000007' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - README.mkdn - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.12.2 repo_root: . name: '@Git/Check' version: '2.042' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: - Changes - README.mkdn - dist.ini commit_msg: v%v%n%n%c Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - README.mkdn - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.12.2 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git/Commit' version: '2.042' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v0.203 tag_format: v%v tag_message: v%v Dist::Zilla::Role::Git::Repo: git_version: 2.12.2 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git/Tag' version: '2.042' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.12.2 repo_root: . name: '@Git/Push' version: '2.042' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '0.001' version_by_branch: 0 version_regexp: (?^:^v(.+)$) Dist::Zilla::Role::Git::Repo: git_version: 2.12.2 repo_root: . name: Git::NextVersion version: '2.042' - class: Dist::Zilla::Plugin::PruneCruft name: '@Filter/PruneCruft' version: '6.009' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Filter/ManifestSkip' version: '6.009' - class: Dist::Zilla::Plugin::MetaYAML name: '@Filter/MetaYAML' version: '6.009' - class: Dist::Zilla::Plugin::License name: '@Filter/License' version: '6.009' - class: Dist::Zilla::Plugin::Readme name: '@Filter/Readme' version: '6.009' - class: Dist::Zilla::Plugin::ExecDir name: '@Filter/ExecDir' version: '6.009' - class: Dist::Zilla::Plugin::ShareDir name: '@Filter/ShareDir' version: '6.009' - class: Dist::Zilla::Plugin::Manifest name: '@Filter/Manifest' version: '6.009' - class: Dist::Zilla::Plugin::TestRelease name: '@Filter/TestRelease' version: '6.009' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Filter/ConfirmRelease' version: '6.009' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Filter/UploadToCPAN' version: '6.009' - class: Dist::Zilla::Plugin::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - Makefile.PL exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . name: GatherDir version: '6.009' - class: Dist::Zilla::Plugin::MetaResources name: MetaResources version: '6.009' - class: Dist::Zilla::Plugin::PruneFiles name: PruneFiles version: '6.009' - class: Dist::Zilla::Plugin::Prereqs::FromCPANfile name: Prereqs::FromCPANfile version: '0.08' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: MarkdownInRoot version: '0.163250' - class: Dist::Zilla::Plugin::MakeMaker::Awesome config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: MakeMaker::Awesome version: '0.38' - class: Dist::Zilla::Plugin::DynamicPrereqs config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000031' version: '0.004' name: DynamicPrereqs version: '0.033' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.009' - class: Dist::Zilla::Plugin::FinderCode name: MetaProvides::Package/AUTOVIV/:InstallModulesPM version: '6.009' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.009' x_serialization_backend: 'YAML::Tiny version 1.70' Ref-Util-0.203/README0000644000076500000240000000045313106015630013005 0ustar aaronstaff This archive contains the distribution Ref-Util, version 0.203: Utility functions for checking references This software is Copyright (c) 2017 by Sawyer X. This is free software, licensed under: The MIT (X11) License This README file was generated by Dist::Zilla::Plugin::Readme v6.009. Ref-Util-0.203/t/0000775000076500000240000000000013106015630012370 5ustar aaronstaffRef-Util-0.203/t/00-report-prereqs.dd0000644000076500000240000000316013106015630016106 0ustar aaronstaffdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0', 'Text::ParseWords' => '0' } }, 'develop' => { 'requires' => { 'ExtUtils::HasCompiler' => '0.014', 'File::Spec' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Test::CPAN::Meta' => '0', 'Test::MinimumVersion' => '0', 'Test::More' => '0.88', 'Test::NoTabs' => '0', 'Test::Pod' => '1.41' } }, 'runtime' => { 'requires' => { 'Exporter' => '5.57', 'perl' => '5.006' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test::More' => '0.96' } } }; $x; }Ref-Util-0.203/t/00-report-prereqs.t0000644000076500000240000001342613106015630015770 0ustar aaronstaff#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: Ref-Util-0.203/t/all-permutations.t0000644000076500000240000004072413106015630016062 0ustar aaronstaffuse strict; use warnings; use Test::More 'tests' => 5; use Ref::Util ':all'; use constant FORMAT_REFS_WORK => ("$]" >= 5.007); # FIXME: plain regular expressions, blessed regular expressions my $plain_formatref = do { format FH1 = . *FH1{'FORMAT'}; }; my $blessed_formatref = !FORMAT_REFS_WORK ? undef : bless do { format FH2 = . *FH2{'FORMAT'}; }, 'FormatRef'; my $evil_blessed_formatref = !FORMAT_REFS_WORK ? undef : bless do { format FH3 = . *FH3{'FORMAT'}; }, '0'; my ( $var_for_globref, $var_for_blessed_globref, $var_for_evil_globref ); my $plain_scalar = 'string'; my $var_for_scalarref = 'stringy'; my $blessed_scalarref = bless \$var_for_scalarref, 'ScalarRef'; my %all; {; # globref causes this warning no warnings qw; %all = ( 'plain_scalarref' => \$plain_scalar, 'plain_scalarref_vstring' => \v1.2.3, 'plain_arrayref' => [], 'plain_hashref' => +{}, 'plain_coderef' => sub {'plain_code'}, #'plain_regexpref' => qr{plain}, 'plain_globref' => \*::var_for_globref, 'plain_formatref' => $plain_formatref, 'plain_refref' => \\$plain_scalar, 'plain_refref_sub' => \sub{}, 'blessed_scalarref' => $blessed_scalarref, 'blessed_scalarref_vstring' => bless( \ do { my $x = v1.2.3 }, 'ScalarRef' ), 'blessed_arrayref' => bless( [], 'ArrayRef' ), 'blessed_hashref' => bless( +{}, 'HashRef' ), 'blessed_coderef' => bless( sub {'blessed_code'}, 'CodeRef' ), #'blessed_regexp' => bless( qr{blessed}, 'BlessedRegexp' ), 'blessed_globref' => bless( \*::var_for_blessed_globref, 'GlobRef' ), 'blessed_formatref' => $blessed_formatref, 'blessed_refref' => bless( \\$blessed_scalarref, 'RefRef' ), 'blessed_refref_sub' => bless( \sub {}, 'RefRef' ), 'evil_blessed_scalarref' => bless( \ do { my $x = 'evil' }, '0' ), 'evil_blessed_scalarref_vstring' => bless( \ do { my $x = v1.2.3 }, '0' ), 'evil_blessed_arrayref' => bless( [], '0' ), 'evil_blessed_hashref' => bless( +{}, '0' ), 'evil_blessed_coderef' => bless( sub {'blessed_code'}, '0' ), #'evil_blessed_regexp' => bless( qr{evil}, '0' ), 'evil_blessed_globref' => bless( \*::var_for_evil_globref, '0' ), 'evil_blessed_formatref' => $evil_blessed_formatref, 'evil_blessed_refref' => bless( \\do { my $x = 'evil' }, '0' ), ); } my ( %plain, %blessed ); foreach my $key ( keys %all ) { if (!FORMAT_REFS_WORK && $key =~ /formatref/) { delete $all{$key}; } else { $key =~ /^plain_/ and $plain{$key} = $all{$key}; $key =~ /blessed_/ and $blessed{$key} = $all{$key}; } } my @all_keys = sort keys %all; my @plain_keys = sort keys %plain; my @blessed_keys = sort keys %blessed; subtest 'non-refs' => sub { foreach my $value ( 0, 1, 'string', '', undef, '0', '0e0' ) { # better string representation for test output my $rep = defined $value ? $value eq '' ? q{''} : $value : '(undef)'; for my $name (grep /^is_/, @Ref::Util::EXPORT_OK) { next if !FORMAT_REFS_WORK && $name =~ /formatref/; my $func = do { no strict 'refs'; \&{"Ref::Util::$name"} }; ok( !$func->($value), "$name($rep) is false" ); } } done_testing(); }; subtest 'plain references only work on is_plain functions' => sub { # each %plain should fail each test of the %blessed foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; ok( !is_blessed_ref($value), "is_blessed_ref($plain_type) is false", ); ok( !is_blessed_scalarref($value), "is_blessed_scalarref($plain_type) is false", ); ok( !is_blessed_arrayref($value), "is_blessed_arrayref($plain_type) is false", ); ok( !is_blessed_hashref($value), "is_blessed_hashref($plain_type) is false", ); ok( !is_blessed_coderef($value), "is_blessed_coderef($plain_type) is false", ); ok( !is_blessed_globref($value), "is_blessed_coderef($plain_type) is false", ); ok( !is_blessed_formatref($value), "is_blessed_formatref($plain_type) is false", ) if FORMAT_REFS_WORK; ok( !is_blessed_refref($value), "is_blessed_refref($plain_type) is false", ); } done_testing(); }; subtest 'plain references' => sub { # each should fail everything except their own foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; ok( is_plain_ref($value), "is_plain_ref($plain_type) is true", ); ok( is_ref($value), "is_ref($plain_type) is true", ); #ok( # is_any_ref($value), # "is_any_ref($plain_type) is true", #); } # FIXME: each "is_scalarref" should also be "is_any_scalarref" foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; if ( $plain_type =~ /plain_scalarref/ ) { ok( is_plain_scalarref($value), "is_plain_scalarref($plain_type) is true", ); ok( is_scalarref($value), "is_scalarref($plain_type) is true", ); } else { ok( !is_plain_scalarref($value), "is_plain_scalarref($plain_type) is false", ); ok( !is_scalarref($value), "is_scalarref($plain_type) is false", ); } } foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; if ( $plain_type eq 'plain_arrayref' ) { ok( is_plain_arrayref($value), "is_plain_arrayref($plain_type) is true", ); ok( is_arrayref($value), "is_arrayref($plain_type) is true", ); } else { ok( !is_plain_arrayref($value), "is_plain_arrayref($plain_type) is false", ); ok( !is_arrayref($value), "is_arrayref($plain_type) is false", ); } } foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; if ( $plain_type eq 'plain_hashref' ) { ok( is_plain_hashref($value), "is_plain_hashref($plain_type) is true", ); ok( is_hashref($value), "is_hashref($plain_type) is true", ); } else { ok( !is_plain_hashref($value), "is_plain_hashref($plain_type) is false", ); ok( !is_hashref($value), "is_hashref($plain_type) is false", ); } } foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; if ( $plain_type eq 'plain_coderef' ) { ok( is_plain_coderef($value), "is_plain_coderef($plain_type) is true", ); ok( is_coderef($value), "is_coderef($plain_type) is true", ); } else { ok( !is_plain_coderef($value), "is_plain_coderef($plain_type) is false", ); ok( !is_coderef($value), "is_coderef($plain_type) is false", ); } } foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; if ( $plain_type eq 'plain_globref' ) { ok( is_plain_globref($value), "is_plain_globref($plain_type) is true", ); ok( is_globref($value), "is_globref($plain_type) is true", ); } else { ok( !is_plain_globref($value), "is_plain_globref($plain_type) is false", ); ok( !is_globref($value), "is_globref($plain_type) is false", ); } } if (FORMAT_REFS_WORK) { foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; if ( $plain_type eq 'plain_formatref' ) { ok( is_plain_formatref($value), "is_plain_formatref($plain_type) is true", ); ok( is_formatref($value), "is_formatref($plain_type) is true", ); } else { ok( !is_plain_formatref($value), "is_plain_formatref($plain_type) is false", ); ok( !is_formatref($value), "is_formatref($plain_type) is false", ); } } } foreach my $plain_type (@plain_keys) { my $value = $plain{$plain_type}; if ( $plain_type =~ /plain_refref/ ) { ok( is_plain_refref($value), "is_plain_refref($plain_type) is true", ); ok( is_refref($value), "is_refref($plain_type) is true", ); } else { ok( !is_plain_refref($value), "is_plain_refref($plain_type) is false", ); ok( !is_refref($value), "is_refref($plain_type) is false", ); } } done_testing(); }; subtest 'blessed references only work on is_blessed functions' => sub { # each %blessed should fail each test of the %plain foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; ok( !is_plain_ref($value), "is_plain_ref($blessed_type) is false", ); ok( !is_plain_scalarref($value), "is_plain_scalarref($blessed_type) is false", ); ok( !is_plain_arrayref($value), "is_plain_arrayref($blessed_type) is false", ); ok( !is_plain_hashref($value), "is_plain_hashref($blessed_type) is false", ); ok( !is_plain_coderef($value), "is_plain_coderef($blessed_type) is false", ); ok( !is_plain_globref($value), "is_plain_coderef($blessed_type) is false", ); ok( !is_plain_formatref($value), "is_plain_formatref($blessed_type) is false", ) if FORMAT_REFS_WORK; ok( !is_plain_refref($value), "is_plain_refref($blessed_type) is false", ); } done_testing(); }; subtest 'blessed references' => sub { # each should fail everything except their own foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; ok( is_blessed_ref($value), "is_blessed_ref($blessed_type) is true", ); ok( is_ref($value), "is_ref($blessed_type) is true", ); #ok( # is_any_ref($value), # "is_any_ref($blessed_type) is true", #); } foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; if ( $blessed_type =~ /blessed_scalarref/ ) { ok( is_blessed_scalarref($value), "is_blessed_scalarref($blessed_type) is true", ); ok( is_scalarref($value), "is_scalarref($blessed_type) is true", ); } else { ok( !is_blessed_scalarref($value), "is_blessed_scalarref($blessed_type) is false", ); ok( !is_scalarref($value), "is_scalarref($blessed_type) is false", ); } } foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; if ( $blessed_type =~ /blessed_arrayref/ ) { ok( is_blessed_arrayref($value), "is_blessed_arrayref($blessed_type) is true", ); ok( is_arrayref($value), "is_arrayref($blessed_type) is true", ); } else { ok( !is_blessed_arrayref($value), "is_blessed_arrayref($blessed_type) is false", ); ok( !is_arrayref($value), "is_arrayref($blessed_type) is false", ); } } foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; if ( $blessed_type =~ /blessed_hashref/ ) { ok( is_blessed_hashref($value), "is_blessed_hashref($blessed_type) is true", ); ok( is_hashref($value), "is_hashref($blessed_type) is true", ); } else { ok( !is_blessed_hashref($value), "is_blessed_hashref($blessed_type) is false", ); ok( !is_hashref($value), "is_hashref($blessed_type) is false", ); } } foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; if ( $blessed_type =~ /blessed_coderef/ ) { ok( is_blessed_coderef($value), "is_blessed_coderef($blessed_type) is true", ); ok( is_coderef($value), "is_coderef($blessed_type) is true", ); } else { ok( !is_blessed_coderef($value), "is_blessed_coderef($blessed_type) is false", ); ok( !is_coderef($value), "is_coderef($blessed_type) is false", ); } } foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; if ( $blessed_type =~ /blessed_globref/ ) { ok( is_blessed_globref($value), "is_blessed_globref($blessed_type) is true", ); ok( is_globref($value), "is_globref($blessed_type) is true", ); } else { ok( !is_blessed_globref($value), "is_blessed_globref($blessed_type) is false", ); ok( !is_globref($value), "is_globref($blessed_type) is false", ); } } if (FORMAT_REFS_WORK) { foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; if ( $blessed_type =~ /blessed_formatref/ ) { ok( is_blessed_formatref($value), "is_blessed_formatref($blessed_type) is true", ); ok( is_formatref($value), "is_formatref($blessed_type) is true", ); } else { ok( !is_blessed_formatref($value), "is_blessed_formatref($blessed_type) is false", ); ok( !is_formatref($value), "is_formatref($blessed_type) is false", ); } } } foreach my $blessed_type (@blessed_keys) { my $value = $blessed{$blessed_type}; if ( $blessed_type =~ /blessed_refref/ ) { ok( is_blessed_refref($value), "is_blessed_refref($blessed_type) is true", ); ok( is_refref($value), "is_refref($blessed_type) is true", ); } else { ok( !is_blessed_refref($value), "is_blessed_refref($blessed_type) is false", ); ok( !is_refref($value), "is_refref($blessed_type) is false", ); } } done_testing(); }; Ref-Util-0.203/t/arrayref.t0000644000076500000240000000073313106015630014371 0ustar aaronstaffuse strict; use warnings; use Test::More tests => 7; BEGIN { use_ok('Ref::Util'); Ref::Util->import('is_arrayref'); } can_ok( Ref::Util::, 'is_arrayref' ); Ref::Util::is_arrayref(\1); ok( !is_arrayref(\1), 'Correctly identify scalarref' ); ok( !is_arrayref({}), 'Correctly identify hashref' ); ok( !is_arrayref(sub {}), 'Correctly identify coderef' ); ok( !is_arrayref(qr//), 'Correctly identify regexpref' ); ok( is_arrayref([]), 'Correctly identify arrayref' ); Ref-Util-0.203/t/b-concise.t0000644000076500000240000000110313106015630014410 0ustar aaronstaffuse strict; use warnings; use Test::More; use Ref::Util 'is_arrayref'; require B::Concise; plan skip_all => 'This version of B::Concise does not have "compile"' if !B::Concise->can('compile'); plan skip_all => 'nothing to do when no custom ops' if !Ref::Util::_using_custom_ops(); plan tests => 2; sub func { is_arrayref([]) } my $walker = B::Concise::compile('-exec', 'func', \&func); B::Concise::walk_output(\ my $buf); eval { $walker->() }; my $exn = $@; ok(!$exn, 'deparsing ops succeeded'); like($buf, qr/\b is_arrayref \b/x, 'deparsing found the custom op'); Ref-Util-0.203/t/dynamic.t0000644000076500000240000000030413106015630014174 0ustar aaronstaffuse strict; use warnings; use Ref::Util; use Test::More tests => 2; my $cb = Ref::Util->can('is_arrayref'); ok( $cb->([]), 'is_arrayref with can()' ); ok( !$cb->({}), 'is_arrayref with can()' ); Ref-Util-0.203/t/expr.t0000644000076500000240000000025013106015630013526 0ustar aaronstaffuse strict; use warnings; use Test::More tests => 1; use Ref::Util 'is_arrayref'; sub arrayref { [] } ok( is_arrayref( arrayref() ), 'Got arrayref from expression' ); Ref-Util-0.203/t/functions.t0000644000076500000240000001155613106015630014573 0ustar aaronstaffuse strict; use warnings; use Test::More; use constant NO_FORMAT_REFS => ($] < 5.008); my @cases; BEGIN { my $blessed_glob = do { no warnings 'once'; my $glob = \*FOO; bless $glob; }; my $format = do { format FH1 = . *FH1{FORMAT}; # this yields undef on 5.6.x }; my $blessed_format = NO_FORMAT_REFS ? undef : do { format FH2 = . my $ref = *FH2{FORMAT}; bless $ref; }; push @cases, map [@$_, +{ map +($_ => 1), split ' ', $_->[1] }], ( [\1, 'plain scalar'], [[], 'plain array'], [{}, 'plain hash'], [sub {}, 'plain code'], [\*STDIN, 'plain glob'], [*STDOUT{'IO'}, 'io'], [qr/^/, 'regexp'], [bless(qr/^/, 'Surprise'), 'randomly-blessed regexp'], [\\1, 'plain ref'], [$format, 'plain format'], [do { bless \(my $x = 1) }, 'blessed scalar'], [bless([]), 'blessed array'], [bless({}), 'blessed hash'], [bless(sub {}), 'blessed code'], [$blessed_glob, 'blessed glob'], [do { bless \\(my $x = 1) }, 'blessed ref'], [$blessed_format, 'blessed format'], ); plan tests => 26 * @cases + 1; # extra one is for use_ok() above } BEGIN { use_ok('Ref::Util'); Ref::Util->import(qw< is_ref is_scalarref is_arrayref is_hashref is_coderef is_regexpref is_globref is_formatref is_ioref is_refref is_plain_ref is_plain_scalarref is_plain_arrayref is_plain_hashref is_plain_coderef is_plain_globref is_plain_formatref is_plain_refref is_blessed_ref is_blessed_scalarref is_blessed_arrayref is_blessed_hashref is_blessed_coderef is_blessed_globref is_blessed_formatref is_blessed_refref >); } for my $case (@cases) { SKIP: { my ($value, $desc, $tags) = @$case; skip "format references do not exist before Perl 5.8.0", 26 if NO_FORMAT_REFS && $tags->{format}; my %got = ( is_ref => is_ref($value), is_scalarref => is_scalarref($value), is_arrayref => is_arrayref($value), is_hashref => is_hashref($value), is_coderef => is_coderef($value), is_globref => is_globref($value), is_formatref => NO_FORMAT_REFS ? 0 : is_formatref($value), is_ioref => is_ioref($value), is_regexpref => is_regexpref($value), is_refref => is_refref($value), is_plain_ref => is_plain_ref($value), is_plain_scalarref => is_plain_scalarref($value), is_plain_arrayref => is_plain_arrayref($value), is_plain_hashref => is_plain_hashref($value), is_plain_coderef => is_plain_coderef($value), is_plain_globref => is_plain_globref($value), is_plain_formatref => NO_FORMAT_REFS ? 0 : is_plain_formatref($value), is_plain_refref => is_plain_refref($value), is_blessed_ref => is_blessed_ref($value), is_blessed_scalarref => is_blessed_scalarref($value), is_blessed_arrayref => is_blessed_arrayref($value), is_blessed_hashref => is_blessed_hashref($value), is_blessed_coderef => is_blessed_coderef($value), is_blessed_globref => is_blessed_globref($value), is_blessed_formatref => NO_FORMAT_REFS ? 0 : is_blessed_formatref($value), is_blessed_refref => is_blessed_refref($value), ); my %expected = ( is_ref => 1, is_plain_ref => $tags->{plain}, is_blessed_ref => $tags->{blessed} || $tags->{regexp} || $tags->{io}, (map +("is_${_}ref" => $tags->{$_}), qw), (map +("is_plain_${_}ref" => $tags->{plain} && $tags->{$_}), qw), (map +("is_blessed_${_}ref" => $tags->{blessed} && $tags->{$_}), qw), ); die "Oops, test bug" if keys(%got) != keys(%expected); for my $func (sort keys %expected) { if ($expected{$func}) { ok( $got{$func}, "$func ($desc)" ); } else { ok( !$got{$func}, "!$func ($desc)" ); } } } } Ref-Util-0.203/t/list.t0000644000076500000240000000044313106015630013527 0ustar aaronstaffuse strict; use warnings; use Test::More tests => 2; use Ref::Util qw; # Call multiple routines in a single list expression: my @got = ( is_arrayref([]), is_hashref({}) ); ok( $got[0], 'got arrayref in list context' ); ok( $got[1], 'got hashref in list context' ); Ref-Util-0.203/t/magic-readonly.t0000644000076500000240000000070013106015630015443 0ustar aaronstaffuse strict; use warnings; use Test::More; use Ref::Util qw; eval { require Readonly; Readonly->import; 1; } or plan 'skip_all' => 'Readonly is required for this test'; plan 'tests' => 3; Readonly::Scalar( my $rh2 => { a => { b => 2 } } ); ok( is_hashref($rh2), 'Readonly objects work!' ); ok( is_plain_hashref($rh2), 'They are not plain!' ); ok( !is_blessed_hashref($rh2), 'They are blessed!' ); Ref-Util-0.203/t/magic.t0000644000076500000240000000042413106015630013633 0ustar aaronstaffuse strict; use warnings; use Ref::Util qw; use Test::More 'tests' => 1; my ( $x, $y ); { package Foo; sub TIESCALAR { bless {}, shift } sub FETCH { $x } } tie $y, 'Foo'; $x = []; ok( is_arrayref($y), 'Will not accept tied hashref as arrayref' ); Ref-Util-0.203/t/pureperl.t0000644000076500000240000000137713106015630014421 0ustar aaronstaffuse strict; use warnings; use Test::More; BEGIN { plan skip_all => "All tests already executed in PP mode" if !eval { require Ref::Util::XS }; no warnings 'uninitialized'; plan skip_all => "Already running pure-Perl tests" if $ENV{PERL_REF_UTIL_IMPLEMENTATION} eq 'PP'; } use Config; use IPC::Open2 qw(open2); use File::Find qw(find); local $ENV{PERL_REF_UTIL_IMPLEMENTATION} = 'PP'; local $ENV{PERL5LIB} = join $Config{path_sep}, @INC; my $this_file = quotemeta __FILE__; find({ no_chdir => 1, wanted => sub { return if !/\.t\z/; my @cmd = ($^X, $_); open2(my $out, my $in, @cmd); while (my $line = <$out>) { print " $line"; } wait; ok !$?, "Exit $? from: @cmd"; } }, 't'); done_testing(); Ref-Util-0.203/t/toomany.t0000644000076500000240000000227513106015630014247 0ustar aaronstaffuse strict; use warnings; use Test::More tests => 6; use Ref::Util qw; my $array_func = \&is_arrayref; my $hash_func = \&is_hashref; is(prototype($array_func), '$', 'is_arrayref has "$" prototype'); is(prototype($hash_func), '$', 'is_hashref has "$" prototype'); # We have to use string eval for this, because when the custom op is being # used, we expect the direct calls to fail at compile time my @cases = ( [is_arrayref => 'is_arrayref([], 17)', 'direct array call with too many arguments'], [is_arrayref => '$array_func->([], 17)', 'array call through coderef with too many arguments'], [is_hashref => 'is_hashref([], 17)', 'direct hash call with too many arguments'], [is_hashref => '$hash_func->([], 17)', 'hash call through coderef with too many arguments'], ); for my $case (@cases) { my ($name, $code, $desc) = @$case; scalar eval $code; my $exn = $@; my @all_names = ($name, map "$_\::$name", qw); my $rx = join '|', ( (map "Too many arguments for $_\\b", @all_names), (map "Usage: $_\\(ref\\)", @all_names), ); like($exn, qr/^(?:$rx)/, $desc); } Ref-Util-0.203/tools/0000775000076500000240000000000013106015630013265 5ustar aaronstaffRef-Util-0.203/tools/bench.pl0000644000076500000240000000237213106015630014703 0ustar aaronstaffuse strict; use warnings; use constant { 'AMOUNT' => 1e8 }; use Ref::Util qw; use Scalar::Util (); use Data::Util ':check'; use Dumbbench; use Dumbbench::Instance::PerlSub; my $bench = Dumbbench->new( 'target_rel_precision' => 0.005, # seek ~0.5% 'initial_runs' => 20, # the higher the more reliable ); my $amount = AMOUNT(); my $ref = []; no warnings; $bench->add_instances( Dumbbench::Instance::PerlSub->new( 'name' => 'Ref::Util::is_plain_arrayref (CustomOP)', 'code' => sub { Ref::Util::is_plain_arrayref($ref) for ( 1 .. $amount ) }, ), Dumbbench::Instance::PerlSub->new( 'name' => 'ref(), reftype(), !blessed()', 'code' => sub { ref $ref && Scalar::Util::reftype($ref) eq 'ARRAY' && !Scalar::Util::blessed($ref) for ( 1 .. $amount ); }, ), Dumbbench::Instance::PerlSub->new( 'name' => 'ref()', 'code' => sub { ref($ref) eq 'ARRAY' for ( 1 .. $amount ) }, ), Dumbbench::Instance::PerlSub->new( 'name' => 'Data::Util::is_array_ref', 'code' => sub { is_array_ref($ref) for ( 1 .. $amount ) }, ), ); $bench->run; $bench->report; Ref-Util-0.203/xt/0000775000076500000240000000000013106015630012560 5ustar aaronstaffRef-Util-0.203/xt/author/0000775000076500000240000000000013106015630014062 5ustar aaronstaffRef-Util-0.203/xt/author/00-compile.t0000644000076500000240000000256513106015630016122 0ustar aaronstaffuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.056 use Test::More; plan tests => 3; my @module_files = ( 'Ref/Util.pm', 'Ref/Util/PP.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); Ref-Util-0.203/xt/author/no-tabs.t0000644000076500000240000000102213106015630015603 0ustar aaronstaffuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/Ref/Util.pm', 'lib/Ref/Util/PP.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/all-permutations.t', 't/arrayref.t', 't/b-concise.t', 't/dynamic.t', 't/expr.t', 't/functions.t', 't/list.t', 't/magic-readonly.t', 't/magic.t', 't/pureperl.t', 't/toomany.t' ); notabs_ok($_) foreach @files; done_testing; Ref-Util-0.203/xt/author/pod-syntax.t0000644000076500000240000000025213106015630016352 0ustar aaronstaff#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Ref-Util-0.203/xt/release/0000775000076500000240000000000013106015630014200 5ustar aaronstaffRef-Util-0.203/xt/release/distmeta.t0000644000076500000240000000017213106015630016175 0ustar aaronstaff#!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. use Test::CPAN::Meta; meta_yaml_ok(); Ref-Util-0.203/xt/release/minimum-version.t0000644000076500000240000000026613106015630017525 0ustar aaronstaff#!perl use Test::More; eval "use Test::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; all_minimum_version_ok( qq{5.006} );