perl5i-v2.13.1000755000765000024 012451415774 13133 5ustar00schwernstaff000000000000perl5i-v2.13.1/.perlcriticrc000444000765000024 376312451415774 15767 0ustar00schwernstaff000000000000## ### Configure perlcritic display behavior. ### # Change the default message to show the policy name so we can shut it up if necessary verbose = %m [%p] at %f line %l, near '%r'\n # Force perlcritic to use color, even when run through a pager. color = 1 # Use a pager. pager = $PAGER ### ### Turn off policies. ### # Nuthin wrong with the expression form of map and grep. [-BuiltinFunctions::RequireBlockMap] [-BuiltinFunctions::RequireBlockGrep] # We realize that localizing a variable does not retain it's original value, # thanks. [-Variables::RequireInitializationForLocalVars] # I'd rather use a few unnecessary "" then forget to interpolate. [-ValuesAndExpressions::ProhibitInterpolationOfLiterals] # Inline POD is more worthwhile than the dubious optimization of putting it # after the __END__ block [-Documentation::RequirePodAtEnd] # No, we're not going to use English. [-Variables::ProhibitPunctuationVars] # That's just rediculous [-ControlStructures::ProhibitPostfixControls] [-ValuesAndExpressions::ProhibitEmptyQuotes] [-ValuesAndExpressions::ProhibitNoisyQuotes] # Test::Builder makes heavy use of local() [-Variables::ProhibitLocalVars] # Nuthin wrong with @$foo [-References::ProhibitDoubleSigils] # We're going to be doing this a lot [-Modules::ProhibitMultiplePackages] [-Modules::RequireFilenameMatchesPackage] ### ### Configure policies ### # Extend the ability to play with @_ to 3 line subroutines. [Subroutines::RequireArgUnpacking] short_subroutine_statements = 3 # No tabs ever [CodeLayout::ProhibitHardTabs] allow_leading_tabs = 0 # 'no strict "refs"' is ok [TestingAndDebugging::ProhibitNoStrict] allow = refs ### ### New policies and options which are not released yet. ### # "no warnings" is fine as long as it's restricted to one or more categories [TestingAndDebugging::ProhibitNoWarnings] allow_with_category_restriction = 1 # Don't need /x on small regexes. [RegularExpressions::RequireExtendedFormatting] minimum_regex_length_to_complain_about = 12 perl5i-v2.13.1/.perltidyrc000444000765000024 130412451415774 15450 0ustar00schwernstaff000000000000--maximum-line-length=100 # we have widescreen now --indent-columns=4 --continuation-indentation=2 --no-opening-sub-brace-on-new-line --paren-tightness=1 --square-bracket-tightness=1 --brace-tightness=1 --no-space-for-semicolon --no-outdent-long-quotes --output-line-ending=unix --no-outdent-labels --no-blanks-before-comments --blanks-before-subs --blanks-before-blocks --maximum-consecutive-blank-lines=2 # Allow two blanks between subroutines --nospace-after-keyword="my local our and or eq ne if else elsif until unless while for foreach return switch case given when" --want-break-before="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" perl5i-v2.13.1/Build.PL000444000765000024 744012451415774 14571 0ustar00schwernstaff000000000000#!/usr/bin/perl -w use strict; # Include 'lib' so it sees our perl5i::VERSION when version checking use lib 'inc', 'lib'; use MyBuild; use 5.010; my $builder = MyBuild->new( module_name => 'perl5i', license => 'perl', dist_author => 'Michael G Schwern ', dist_version => "v2.13.1", requires => { 'perl' => '5.10.0', 'Modern::Perl' => '1.03', 'CLASS' => '1.00', 'Child' => '0.009', 'DateTime' => '0.47', 'DateTime::Format::Epoch' => '0.11', 'DateTime::TimeZone::Tzfile' => '0.002', # for perl5i::1 'Module::Load' => '0.16', 'Text::Wrap' => '2009.0305', 'Try::Tiny' => '0.02', # plays nice with open pragma, Debian stable version 'autodie' => '2.12', # Needed for autodie :system 'IPC::System::Simple' => '1.18', 'autobox' => '2.80', 'autobox::Core' => '1.0', parent => '0.221', 'File::chdir' => '0.1002', # for perl5i::1 'autobox::dump' => '20090426', 'autobox::List::Util' => '20090629', 'Want' => '0.18', 'autovivification' => '0.06', 'version' => '0.77', 'Perl6::Caller' => '0.100', "Taint::Util" => '0.06', 'Hash::Merge::Simple' => '0.04', 'List::MoreUtils' => '0.22', indirect => '0.24', 'JSON' => '2.17', 'YAML::Any' => '0.70', 'Digest::SHA' => '5.45', 'Digest::MD5' => '2.36', 'Object::ID' => '0.1.0', "Devel::Declare::MethodInstaller::Simple" => '0.006009', 'true::VERSION' => '0.16', 'Capture::Tiny' => '0.06', # Change to how @ARGV is handled, wraps glob and <>. 'utf8::all' => '0.015', 'Carp::Fix::1_25' => '1.000000', 'Hash::StoredIterator' => '0.007', 'Hash::FieldHash' => '0.06', 'Path::Tiny' => '0.036', 'Import::Into' => '1.002003', }, build_requires => { 'ExtUtils::CBuilder' => '0.26', 'Test::More' => '0.88', 'Test::Warn' => '0.11', 'IPC::Open3' => '0', 'Test::Output' => '0.16', }, configure_requires => { # MB's auto configure requires only puts it in the META.yml # so some CPAN shells won't see it. "Module::Build" => '0.36', }, recommends => { # Significant performance improvements autodie => '2.26', }, meta_merge => { resources => { repository => 'http://github.com/evalEmpire/perl5i/tree/master', bugtracker => 'http://github.com/evalEmpire/perl5i/issues', IRC => "irc://irc.perl.org/#perl5i", }, no_index => { file => [qw( lib/perl5i/0/DateTime.pm lib/perl5i/0/ARRAY.pm lib/perl5i/0/DEFAULT.pm lib/perl5i/0/HASH.pm lib/perl5i/0/Meta.pm lib/perl5i/0/Meta/Class.pm lib/perl5i/0/Meta/Instance.pm lib/perl5i/0/SCALAR.pm lib/perl5i/VERSION.pm )], }, }, PL_files => { 'bin/perl5i.c.PL' => 'bin/perl5i.c', 'bin/perl5i.bat.PL' => 'bin/perl5i.bat', }, recursive_test_files => 1, create_readme => 1, create_license => 1, ); $builder->requires->{"Time::y2038"} = "20100218" if $builder->needs_y2038; $builder->create_build_script(); perl5i-v2.13.1/Changes000444000765000024 4514312451415774 14612 0ustar00schwernstaff0000000000002.13.1 Thu Jan 1 20:14:59 PST 2015 Distribution Changes * Upgrade utf8::all requirement to get consistent @ARGV behavior. * The latest autodie is recommended for load time and memory usage improvements. [github #284] Bug Fixes * Change how we import utf8::all so @ARGV is translated appropriately. [github #279] (Paul Howarth) * Update autobox to avoid segfaults during global destruction. [github #283] [rt.cpan.org 71777] (Michael Schwern) 2.13.0 Wed Jul 23 11:51:53 PDT 2014 New Features * $scalar->path will return a Path::Tiny object using the contents of $scalar. Makes working with files much, much easier. [github #229] [github #247] (Michael G Schwern) Distribution Changes * The project has moved to the evalEmpire organization to allow broader project admin options. http://github.com/evalEmpire/perl5i (Michael G Schwern) Doc Changes * Added a project rationale. [github #252] [github #226] (Carlos Lima) Bug Fixes * Fixed a crash if the perl5i command line is fed a null byte. [github #269] [github #273] (Reini Urban) (Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯) * Stop using deprecated Hash::StoreIterator::eech(). [github #270] (Chad Granum) * The methods() meta method now ignores subroutines declared with func(). [github #222] [github #253] (Carlos Lima) 2.12.0 Mon Jun 10 18:09:31 PDT 2013 New Features * Added the ability to skip loading certain features. [github #228] (Michael G Schwern) (Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯) Bug Fixes * Quiet "smartmatch is experimental" warnings in 5.18. [github #261] (Chuck Adams) Doc Changes * Document ->mo->as_yaml and ->mo->as_json [github #230] (Michael G. Schwern) * Remove references to the defunct mailing list [github #235] (Michael G. Schwern) * Add references to the wiki and Twitter [github #235] (Michael G. Schwern) Test Fixes * Test fixes for 5.18. [github #264] [github #262] (Chuck Adams) (Michael G Schwern) Distribution Fixes * Require a newer, safer version of Devel::Declare. [github #181] (Michael G Schwern) (Ben Hengst) * Forgot to explicitly depend on Hash::FieldHash. (Michael G Schwern) * Upgrade Hash::StoredIterator to avoid 5.12, 5.14 and 5.18 failures. (Michael G Schwern) (Chad Granum) 2.11.2 Mon Mar 18 02:55:20 GMT 2013 Distribution Fixes * perl5i::0 and perl5i::1 had internal packages outside the perl5i package which caused CPAN permissions problems. This has been fixed. (Michael G. Schwern) 2.11.1 Mon Mar 18 02:32:07 UTC 2013 Distribution Fixes * Creating a new release with correct PAUSE permissions (Nóirín Plunkett) 2.11.0 Mon Mar 18 02:24:20 UTC 2013 Bug Fixes * %hash->each({...}) iterator now uses Hash::StoredIterator to ensure that it's safe to nest calls to each(), and to use keys() and values() inside each() (Chad Granum) Test Fixes * Added new test template (Michael G. Schwern) New Features * ->mo->as_yaml and ->mo->as_json now allow you to dump a meta-object as yaml or json respectively [github #230] (Ben Hengst) Misc * Fixed examples in the documentation (Tom Legrady) 2.10.0 Sat Jul 7 11:57:01 PDT 2012 Bug Fixes * Upgraded autodie dependency to fix automatic utf8 open. [github #220] [github #218] Test Fixes * Removed a use of Test::Exception, which we don't depend on. New Features * %hash = @array->as_hash; will turn all the values in @array to keys in %hash. [github 172] (Prashan Dharmasena) * @array->popn($n) and @array->shiftn() pop() and shift() multiple elements off an array. [github 149] (Tanner Hobson) * @array->pick($n) and @array->pick_one will pick random elements out of an @array, like picking cards from a deck. [github 145] (Prashan Dharmasena) * The Carp 1.25 formatting change has been smoothed over using Carp::Fix::1_25. 2.9.1 Fri Nov 11 16:13:32 PST 2011 Bug Fixes * @empty_array->foreach(\&callback) would do the callback() once despite the array being empty. [github 211] (Andrew Parker) 2.9.0 Sun Oct 23 00:47:24 PDT 2011 New Features * %hash->each() is guaranteed to iterate through the entire hash. [github 142] * $string->is_module_name() checks if a string is a valid module name. Doc Changes * Document the very useful %hash->each( func ($k, $v) { ... } ). [github 142] * Add perl5ifaq entry: "How do I merge two hashes?" * Add perl5ifaq entry: "How can I get the unique keys from multiple hashes?" * Minor POD glitches and spelling fixes from Debian. [rt.cpan.org 71253] [rt.cpan.org 71254] Test Fixes * Updated tests for new version of Child. (Chad Granum) Bug Fixes * Depend on the newest version of Child. (Chad Granum) Security Fixes * require() will now only require modules. [github #204] 2.8.0 Sat Sep 24 21:36:32 PDT 2011 Bug Fixes * Depend on a newer, more reliable version of Devel::Declare. Lets perl5i work with Devel::REPL. [github 153] * Depend on a newer indirect.pm to avoid leaks into eval on 5.10. [rt.cpan.org 64521] * Quiet the overzealous "v-string in use/require non-portable" warning from 5.10.0. [github 174] New Features * Added a list() keyword to force list context. Compliments scalar(). [github #169] (Mike Doherty) * `strict vars` is now off for perl5i one-liners. [github #63] (Mike Doherty) * alias() will no longer issue "subroutine redefined" warnings. There was no way to make them honor "no warnings 'redefine'". [github #185] (Mike Doherty) * -Mperl5i now means -Mperl5i::latest rather than spitting at you. [github #193] (Mike Doherty) * $string->reverse now always reverses $string regardless of context. [github #182] Doc Changes * Removed unnecessarily detailed docs about Child. Misc * Delegate Unicode stuff to utf8::all. [github #190] * checksum() now using the core Digest::SHA module instead of Digest::SHA1. [github #196] (Mike Doherty) 2.6.1 Thu, 24 Mar 2011 16:33:39 +1100 Bug Fixes * methods() can handle modules like Fcntl with weird things in their symbol tables. [github 184] Test Fixes * Work around broken Test::Output 0.16_03 alpha that CPAN testers are using. See https://rt.cpan.org/Ticket/Display.html?id=66172 2.6.0 Thu, 24 Feb 2011 11:23:25 +1100 New Features * Added capture(), from Capture::Tiny, to capture output to STDOUT and STDERR [github 178] New Docs * Added perl5ifaq entries for capturing output from a command using capture() Bug Fixes * perl5i will no longer double encode @ARGV if it's loaded multiple times. [github 176] Windows Fixes * Fix t/center.t (Myf White) * Fix t/command_line_wrapper.t (Myf White) Misc * The dependency on true.pm will no longer confuse some YAML parsers. 2.5.1 Fri, 28 Jan 2011 11:01:33 +1000 Misc * Fix the META.yml file so the requirement on "true" is not interpreted as a boolean by YAML::XS. [github 173] 2.5.0 Mon, 24 Jan 2011 11:03:38 +1000 Doc Fixes * Update the Artistic License link to one that works. (Schwern) New Features * Added $class->mc->symbol_table to get a class's symbol table (Schwern) * Added $obj->mo->methods to get the methods available to an object (Schwern) [github 170] 2.4.1 Wed Nov 24 16:35:39 EST 2010 Bug Fixes * The lexical nature of the improved error message was implemented wrong and caused it to leak out or not work. [github 99] (Schwern) 2.4.0 Fri Aug 27 19:18:45 PDT 2010 New Features * You no longer have to put a true value at the end of a module. Thanks to chocolateboy's true.pm! Bug Fixes * Bumped the dependency on indirect.pm to avoid a seg fault in @{[ $x->$y ]} when $x and $y are undefined. [github 164] Thanks to Tokuhiro Matsuno and Vincent Pit. * The improved error message for failing to load a module is now a lexical feature. This prevents it messing up things that parse that error message, like base.pm. This makes perl5i play nice with Class::DBI amongst a lot of other things. [github 165] (Chad) 2.3.1 Fri Jul 30 18:14:38 PDT 2010 No changes from 2.3.0_03. 2.3.0_03 Wed Jul 28 20:32:36 PDT 2010 Incompatible Changes (only with this alpha series) * Signature->num_params is now Signature->num_positional_params because we'll add named params eventually and you generally only care about how many positional params a function takes. (Schwern) * Remove ngrep, nmap and nfor. Replaced by @array->foreach( def($x,$y) ) {} and @array->map( def($x) {} ); * def has been removed. Consensus is emerging for func. New Features * Added child() to make forking easier. [github 150] (Chad) * @array->foreach now takes a function with variable arguments and DWIM * $number->is_even and is_odd [github 143] (Eric A. Zarko) Bug Fixes * Anonymous functions were getting a new signature each time they're declared even though its the same code reference. (Schwern) 2.3.0_02 Thu Jul 15 19:13:22 PDT 2010 New Features * Signature introspection, via $code->signature, for subroutines defined with C, C and C. Documentation * Anonymous methods and functions (they always worked) 2.3.0_01 Mon Jul 12 16:15:05 PDT 2010 New Features * ngrep and nmap are like grep and map but you can name the $_ variable. (Chad) [github 36] * nfor is like for but you can specify it to loop over any number of elements at a time. (Chad) [github 40] * "method" declares a method and does the "my $self = shift" for you. (Schwern) [github 19] * "def" and "func" provide basic subroutine signatures. (Schwern) [github 19] * The error message upon not being able to load a module has been improved for human readability. (Chad) [github 99] Test Fixes * Clean up dangling temp files. (Avar) [github 139] 2.2.2 Mon May 17 16:34:52 PDT 2010 Bug Fixes * Let perl5i::1 load without Time::y2038 if Perl is already y2038 safe just like perl5i::2 does. Test Fixes * Possible failure of t/command_line_wrapper.t if perl5i isn't already installed. 2.2.1 Sun May 16 22:52:01 PDT 2010 Bug Fixes * Greatly reduced the amount of clashes when loading perl5i::1 and perl5i::2. * Make meta objects on read only strings and numbers work with non-threaded perls. [github 131] * Bumped to a version of indirect which does not leak out of scope. [rt.cpan.org 50570] 2.2.0 Sun May 9 13:22:56 PDT 2010 New Features * $thing->mo->is_tainted, along with untaint and taint, are now callable on everything to provide a unified interface. [github 89] * Added $number->commify and $number->group_digits to turn 1000 into 1,000. [github 128] * Added $obj->mo->id, a universal unique object identifier. Deprecation Warnings * $thing->is_tainted, untaint and taint will be removed in v3. Please use $thing->mo->is_tainted and friends. [github 89] Bug Fixes * $class->can($method) now works as it should (previously autoboxing would interfere). [github 112] 2.1.1 Tue Apr 27 21:34:04 PDT 2010 Fixes * Upgrade dependency on autovivification so Regexp::Common works with perl5i. [github 32] 2.1.0 Fri Apr 16 12:15:10 EEST 2010 New Features * trim, ltrim and rtrim now work on arrays. [github 121] (Nick Patch) Fixes * Quiet a warning in DateTime.pm on systems where gmtime() returns undef for out of bound times (mostly Windows). * Fix the perl5i command line tool on stock OS X 5.10.0 [github 116] * Fix perl5i.bat on Windows. * perl5i can load after List::MoreUtils (and thus things like Moose) [github 127] * Fix is_integer() and is_decimal() for things like 1.0 and 1. [github 123] * Fix rounding of negative numbers. [github 118] Test Fixes * Quiet the autodie test on Windows [github 126] * Fix the quoting of command_line_wrapper.t for Windows [github 126] 2.0.3 Fri Mar 19 13:57:37 PDT 2010 Fixes * Forgot to require B before using a B routine in the JSON dump. Build Fixes * Forgot to require Digest::SHA1 for checksum() Test Fixes * Removed use of Test::Exception which may have been causing the "Bizarre copy of HASH" errors in 5.11.5. 2.0.2 Wed Mar 17 12:21:00 PDT 2010 Build Fixes * Ensure non META.yml savy CPAN shells see the configure_requires for Module::Build. * Forgot to require indirect.pm, JSON and YAML::Any Test Fixes * Don't run the v1 and v0 sanity tests unless Time::y2038 is installed. * autobox 2.60 changed how isa() works and broke 42->isa("UNIVERSAL"). Will fix for real later. 2.0.1 Wed Mar 17 11:10:54 PDT 2010 Fixes * Quick fix to handle not always having Time::y2038. 2.0.0 Tue Mar 16 23:34:22 PDT 2010 Incompatible Changes * In general, methods which return a list return an array in list context and an array ref in scalar context. This enables chaining of autoboxed methods. * $module->load() is now $module->require() with simpler semantics. [github 107] [schwern] * Indirect object syntax (ie. $obj = new Class) is now a compile time syntax error. * $thing->mo now always returns a meta instance object. This allows the meta object to DWIM on plain strings which previously would be treated as classes and return the meta class object. * The guaranteed range of gm/localtime() has been reduced to avoid depending on Time::y2038 if possible. * $thing->perl is now $thing->mo->perl and works on everything. New Features * $thing->mo->is_equal($other) universal equality method. [brunov] * $thing->mc has been added to always return a meta class object. This allows disambiguation when $thing could be considered a class name. * new autoboxed methods: %hash->diff() and %hash->intersect() [brunov] * Added $thing->mo->dump to dump objects in multiple formats including YAML and JSON. Fixes * Update dep on autovivification to one that works on 5.11 [schwern] * Update autobox::Core dep to clarify scalar vs list context returns. * Fix taint test failing with Test::More 0.95_01. [schwern] * Fix time compat test failing because of unknown time zones. [schwern] * Time::y2038 is only required if the built in time functions are not up to task. [schwern] Optimizations * Optimize @array->intersect() and @array->diff() when @array contains no refs. [brunov] 1.1.0 Tue Mar 2 19:09:49 PST 2010 New Features * print() and say() now work on hashes, time(), localtime() and gmtime(). * $obj->mo->checksum will return a checksum for the contents of any object. * Added $path->path2module and $module->module2path Bugs * alias() was still being exported. * Work around DateTime::TimeZone not being able to determine the local time zone on FreeBSD and possibly others. * localtime() is less suseptable to the DateTime distant year DOS attack. Docs * Document that carp() and croak() are exported. 1.0.0 Thu Feb 25 21:56:47 PST 2010 New Features * @array->first() now takes a regex like @array->grep() [github 93] (brunov) * All autoboxed objects now respond to is_number() and friends. They always return false. [github 100] (brunov) * All applicable array and hash methods now return arrays in list context and array refs in scalar context. (brunov) * diff() now works on nested data structures and honors overloaded objects (brunov) * Add a basic $number->round() [github 95] * Added @array->intersect() (brunov) Docs * Wrote perl5ifaq for all your frequently asked questions. * Document the perl5i command line utility. [github 31] Bug Fixes * Ensure the DateTime objects coming from time(), gmtime() and localtime() compare with eq and == 0.2.2 Fri Feb 19 14:56:36 PST 2010 Other * Some modules got the wrong version. 0.2.1 Fri Feb 19 04:23:58 PST 2010 Bug Fixes * round_up() and round_down() didn't work 0.2.0 Fri Feb 19 03:48:36 PST 2010 Incompatible Changes * "use perl5i" no longer works. You must instead "use perl5i::0" to protect against future incompatibilities. "use perl5i::latest" for the adventurous. * We no longer export rreturn() or lnoreturn() from Want. This can wait if we tackle lvalue subroutines. * load() is now a scalar method, so its $module->load not load($module) * alias() is now an autoboxed method rather than a function. New Features * try/catch support via Try::Tiny (brunov) * caller() now returns an object via Perl6::Caller (schwern, Timothy Totten) * Everything has a Meta object (perl5i::Meta) accessable via $thing->mo * Added meta object methods to handle tainting. mo->is_tainted(), mo->taint(), mo->untaint(). * Added mo->reftype to get the bare reference type of anything. * Added mo->class to get the class of anything. * Added mo->ISA to return @ISA. * Added mo->super to call a method in a super class. * Added mo->linear_isa to get the object's inheritance path. * Introduced perl5i::latest to use the latest version. * Added %hash->flip() and %hash->merge() (brunov) * @array->grep now takes a regex * Select methods from List::MoreUtils added as ARRAY methods. all, any, none, true, false, uniq, minmax, mesh. * Added @array->diff() (brunov) * "use utf8" is on by default. * STDOUT, STDIN, STDERR and all opened filehandles have utf8 encoding on. * @ARGV is encoded as UTF8 * Added methods to determine if a scalar is a number and what kind it is. * Added ceil()/floor() and round_up()/round_down() synonyms. Docs * Various POD fixes (chromatic, Richard Soderberg) * Collected together the autoboxed methods Other * Look, a changes document! * Added a patching policy. See the PATCHING file. * We have a mailing list now. http://groups.google.com/group/perl5i 0.1.0 Sat Jan 23 14:55:52 2010 -0800 * Return to CPAN after deleting 20090424 * New versioning scheme so we can declare incompatibilities, see semver.org for details. If you have perl5i installed you must force an upgrade. * Thanks to the Open Source Bridge perl5i Hackathon! Incompatible Changes * Switched to DateTime from Time::Piece New Features * List::Util now autoboxed (Chas) * time() returns a DateTime object (schwern) * Added alias() (schwern) * Now y2038 safe (schwern) * die always returns 255 regardless of $! or $? (Chas) * Added a perl5i command line program (dap) * Add $CWD for localized chdir'ing via File::chdir (schwern) * Add $scalar->center() (chromatic, benh) * Add $scalar->ltrim(), ->rtrim() and trim() (benh) * Add $scalar->wrap() via Text::Wrap (brunov) * Automatic "use English" (schwern) * Automatic "use IO::Handle" so things like autoflush are available (schwern) * Automatic "use Want" (Jeff Lavallee) * Automatic "no autovivification" (schwern) Bug Fixes * stat() works in list context (schwern) 20090424 Fri Apr 24 11:38:24 2009 -0700 * First release perl5i-v2.13.1/INSTALL.SKIP000444000765000024 2112451415774 15017 0ustar00schwernstaff000000000000\.PL$ \.c$ \.o$ perl5i-v2.13.1/LICENSE000444000765000024 4377012451415774 14330 0ustar00schwernstaff000000000000This software is copyright (c) 2015 by Michael G Schwern . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2015 by Michael G Schwern . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2015 by Michael G Schwern . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End perl5i-v2.13.1/local-lib-rc000444000765000024 44312451415774 15434 0ustar00schwernstaff000000000000# Write to $HOME/.local-lib-rc and then add # "source ~/.local-lib-rc" to $HOME/.bashrc export PERL_MB_OPT="--install_base $HOME/perl5" export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" export PERL5LIB="$HOME/perl5/lib/perl5/i386-linux:$HOME/perl5/lib/perl5" export PATH="$HOME/perl5/bin:$PATH" perl5i-v2.13.1/MANIFEST000444000765000024 547012451415774 14427 0ustar00schwernstaff000000000000.perlcriticrc .perltidyrc bin/perl5i.bat.PL bin/perl5i.c.PL bin/perl5i.plx Build.PL Changes inc/MyBuild.pm INSTALL.SKIP lib/perl5i.pm lib/perl5i/0.pm lib/perl5i/0/ARRAY.pm lib/perl5i/0/DateTime.pm lib/perl5i/0/DEFAULT.pm lib/perl5i/0/HASH.pm lib/perl5i/0/Meta.pm lib/perl5i/0/Meta/Class.pm lib/perl5i/0/Meta/Instance.pm lib/perl5i/0/SCALAR.pm lib/perl5i/1.pm lib/perl5i/1/ARRAY.pm lib/perl5i/1/autobox.pm lib/perl5i/1/CODE.pm lib/perl5i/1/DateTime.pm lib/perl5i/1/HASH.pm lib/perl5i/1/Meta.pm lib/perl5i/1/Meta/Class.pm lib/perl5i/1/Meta/Instance.pm lib/perl5i/1/SCALAR.pm lib/perl5i/1/UNIVERSAL.pm lib/perl5i/2.pm lib/perl5i/2/ARRAY.pm lib/perl5i/2/autobox.pm lib/perl5i/2/CODE.pm lib/perl5i/2/DateTime.pm lib/perl5i/2/equal.pm lib/perl5i/2/HASH.pm lib/perl5i/2/Meta.pm lib/perl5i/2/Meta/Class.pm lib/perl5i/2/Meta/Instance.pm lib/perl5i/2/RequireMessage.pm lib/perl5i/2/SCALAR.pm lib/perl5i/2/Signature.pm lib/perl5i/2/Signature/Function/None.pm lib/perl5i/2/Signature/Method/None.pm lib/perl5i/2/Signature/None.pm lib/perl5i/2/Signature/Real.pm lib/perl5i/2/Signatures.pm lib/perl5i/2/UNIVERSAL.pm lib/perl5i/cmd.pm lib/perl5i/latest.pm lib/perl5i/Meta.pod lib/perl5i/Signature.pod lib/perl5i/VERSION.pm lib/perl5ifaq.pod LICENSE local-lib-rc MANIFEST This list of files MANIFEST.SKIP META.json META.yml PATCHING README t/alias.t t/ARGV.t t/ARGV_twice.t t/as_hash.t t/autobox.t t/autodie.t t/autovivification.t t/caller.t t/can.t t/capture.t t/carp.t t/center.t t/chdir.t t/Child.t t/CLASS.t t/command_line_wrapper.t t/commify.t t/datetime.t t/die.t t/diff.t t/dump/array.t t/dump/code.t t/dump/formats.t t/dump/hash.t t/dump/obj.t t/dump/scalar.t t/each.t t/English.t t/equal.t t/everything_is_an_object.t t/File-stat.t t/flip.t t/foreach.t t/github164.t t/grep.t t/hash-diff.t t/hash-intersect.t t/hash-merge.t t/intersect.t t/io-handle.t t/is_module_name.t t/lexical.t t/lib/Test/perl5i.pm t/lib/ThisIsTrue.pm t/List-MoreUtils/all.t t/List-MoreUtils/any.t t/List-MoreUtils/false.t t/List-MoreUtils/mesh.t t/List-MoreUtils/minmax.t t/List-MoreUtils/none.t t/List-MoreUtils/true.t t/List-MoreUtils/uniq.t t/list-trim.t t/List-Util/first.t t/List-Util/max.t t/List-Util/maxstr.t t/List-Util/min.t t/List-Util/minstr.t t/List-Util/reduce.t t/List-Util/shuffle.t t/List-Util/sum.t t/list.t t/load_together.t t/map.t t/Meta/checksum.t t/Meta/class.t t/Meta/id.t t/Meta/is-equal.t t/Meta/ISA.t t/Meta/linear_isa.t t/Meta/methods.t t/Meta/reftype.t t/Meta/super.t t/Meta/symbol_table.t t/method_leaking.t t/modern_perl.t t/module2path.t t/no_indirect.t t/number.t t/path/base.t t/perl5i.t t/pick.t t/popn.t t/require.t t/require_message.t t/say.t t/scalar.t t/shiftn.t t/signature.t t/signatures.t t/skip.t t/taint.t t/time_compat.t t/true.t t/try-tiny.t t/uniq.t t/utf8.t t/version_0/00_compile.t t/version_1/00_compile.t t/vs_listmoreutils.t t/Want.t t/wrap.t t/y2038.t perl5i-v2.13.1/MANIFEST.SKIP000444000765000024 266212451415774 15174 0ustar00schwernstaff000000000000 #!start included /Users/schwern/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid MYMETA files ^MYMETA\. #!end included /Users/schwern/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/ExtUtils/MANIFEST.SKIP # Avoid Devel::NYTProf files ^nytprof # Don't ship perl5i ^bin/perl5i$ ^bin/perl5i.c$ ^bin/perl5i.bat$ # Ignore C object files \.o$ ^MYMETA.yml$ # Ignore emacs temp files ^\.# # Ignore our own dist dir ^perl5i- # Don't ship admin scripts ^admin/ # Don't ship our motivational images ^img/ # Don't ship patch files \.patch$ \.diff$ # Don't ship the test template t/00_TEST_TEMPLATE.t # Don't ship Travis-CI config ^\.travis\.ymlperl5i-v2.13.1/META.json000444000765000024 1732012451415774 14734 0ustar00schwernstaff000000000000{ "abstract" : "Fix as much of Perl 5 as possible in one pragma", "author" : [ "Michael G Schwern " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.421", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "perl5i", "no_index" : { "file" : [ "lib/perl5i/0/DateTime.pm", "lib/perl5i/0/ARRAY.pm", "lib/perl5i/0/DEFAULT.pm", "lib/perl5i/0/HASH.pm", "lib/perl5i/0/Meta.pm", "lib/perl5i/0/Meta/Class.pm", "lib/perl5i/0/Meta/Instance.pm", "lib/perl5i/0/SCALAR.pm", "lib/perl5i/VERSION.pm" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::CBuilder" : "0.26", "IPC::Open3" : "0", "Test::More" : "0.88", "Test::Output" : "0.16", "Test::Warn" : "0.11" } }, "configure" : { "requires" : { "Module::Build" : "0.36" } }, "runtime" : { "recommends" : { "autodie" : "2.26" }, "requires" : { "CLASS" : "1.00", "Capture::Tiny" : "0.06", "Carp::Fix::1_25" : "1.000000", "Child" : "0.009", "DateTime" : "0.47", "DateTime::Format::Epoch" : "0.11", "DateTime::TimeZone::Tzfile" : "0.002", "Devel::Declare::MethodInstaller::Simple" : "0.006009", "Digest::MD5" : "2.36", "Digest::SHA" : "5.45", "File::chdir" : "0.1002", "Hash::FieldHash" : "0.06", "Hash::Merge::Simple" : "0.04", "Hash::StoredIterator" : "0.007", "IPC::System::Simple" : "1.18", "Import::Into" : "1.002003", "JSON" : "2.17", "List::MoreUtils" : "0.22", "Modern::Perl" : "1.03", "Module::Load" : "0.16", "Object::ID" : "v0.1.0", "Path::Tiny" : "0.036", "Perl6::Caller" : "0.100", "Taint::Util" : "0.06", "Text::Wrap" : "2009.0305", "Try::Tiny" : "0.02", "Want" : "0.18", "YAML::Any" : "0.70", "autobox" : "2.80", "autobox::Core" : "1.0", "autobox::List::Util" : "20090629", "autobox::dump" : "20090426", "autodie" : "2.12", "autovivification" : "0.06", "indirect" : "0.24", "parent" : "0.221", "perl" : "v5.10.0", "true::VERSION" : "0.16", "utf8::all" : "0.015", "version" : "0.77" } } }, "provides" : { "perl5i" : { "file" : "lib/perl5i.pm", "version" : "v2.13.1" }, "perl5i::0" : { "file" : "lib/perl5i/0.pm", "version" : "v2.13.1" }, "perl5i::0::ARRAY" : { "file" : "lib/perl5i/0/ARRAY.pm" }, "perl5i::0::DEFAULT" : { "file" : "lib/perl5i/0/DEFAULT.pm" }, "perl5i::0::DateTime" : { "file" : "lib/perl5i/0/DateTime.pm" }, "perl5i::0::DateTime::Format::CTime" : { "file" : "lib/perl5i/0/DateTime.pm" }, "perl5i::0::DateTime::time" : { "file" : "lib/perl5i/0/DateTime.pm" }, "perl5i::0::DateTime::y2038" : { "file" : "lib/perl5i/0/DateTime.pm" }, "perl5i::0::HASH" : { "file" : "lib/perl5i/0/HASH.pm" }, "perl5i::0::Meta" : { "file" : "lib/perl5i/0/Meta.pm" }, "perl5i::0::Meta::Class" : { "file" : "lib/perl5i/0/Meta/Class.pm" }, "perl5i::0::Meta::Instance" : { "file" : "lib/perl5i/0/Meta/Instance.pm" }, "perl5i::0::SCALAR" : { "file" : "lib/perl5i/0/SCALAR.pm" }, "perl5i::1" : { "file" : "lib/perl5i/1.pm", "version" : "v2.13.1" }, "perl5i::1::ARRAY" : { "file" : "lib/perl5i/1/ARRAY.pm" }, "perl5i::1::CODE" : { "file" : "lib/perl5i/1/CODE.pm" }, "perl5i::1::DateTime" : { "file" : "lib/perl5i/1/DateTime.pm" }, "perl5i::1::DateTime::Format::CTime" : { "file" : "lib/perl5i/1/DateTime.pm" }, "perl5i::1::DateTime::time" : { "file" : "lib/perl5i/1/DateTime.pm" }, "perl5i::1::DateTime::y2038" : { "file" : "lib/perl5i/1/DateTime.pm" }, "perl5i::1::HASH" : { "file" : "lib/perl5i/1/HASH.pm" }, "perl5i::1::Meta" : { "file" : "lib/perl5i/1/Meta.pm" }, "perl5i::1::Meta::Class" : { "file" : "lib/perl5i/1/Meta/Class.pm" }, "perl5i::1::Meta::Instance" : { "file" : "lib/perl5i/1/Meta/Instance.pm" }, "perl5i::1::SCALAR" : { "file" : "lib/perl5i/1/SCALAR.pm" }, "perl5i::1::UNIVERSAL" : { "file" : "lib/perl5i/1/UNIVERSAL.pm" }, "perl5i::1::autobox" : { "file" : "lib/perl5i/1/autobox.pm" }, "perl5i::2" : { "file" : "lib/perl5i/2.pm", "version" : "v2.13.1" }, "perl5i::2::ARRAY" : { "file" : "lib/perl5i/2/ARRAY.pm" }, "perl5i::2::CODE" : { "file" : "lib/perl5i/2/CODE.pm" }, "perl5i::2::DateTime" : { "file" : "lib/perl5i/2/DateTime.pm" }, "perl5i::2::DateTime::Format::CTime" : { "file" : "lib/perl5i/2/DateTime.pm" }, "perl5i::2::DateTime::time" : { "file" : "lib/perl5i/2/DateTime.pm" }, "perl5i::2::DateTime::y2038" : { "file" : "lib/perl5i/2/DateTime.pm" }, "perl5i::2::HASH" : { "file" : "lib/perl5i/2/HASH.pm" }, "perl5i::2::Meta" : { "file" : "lib/perl5i/2/Meta.pm" }, "perl5i::2::Meta::Class" : { "file" : "lib/perl5i/2/Meta/Class.pm" }, "perl5i::2::Meta::Instance" : { "file" : "lib/perl5i/2/Meta/Instance.pm" }, "perl5i::2::RequireMessage" : { "file" : "lib/perl5i/2/RequireMessage.pm" }, "perl5i::2::SCALAR" : { "file" : "lib/perl5i/2/SCALAR.pm" }, "perl5i::2::Signature" : { "file" : "lib/perl5i/2/Signature.pm" }, "perl5i::2::Signature::Function::None" : { "file" : "lib/perl5i/2/Signature/Function/None.pm" }, "perl5i::2::Signature::Method::None" : { "file" : "lib/perl5i/2/Signature/Method/None.pm" }, "perl5i::2::Signature::None" : { "file" : "lib/perl5i/2/Signature/None.pm" }, "perl5i::2::Signature::Real" : { "file" : "lib/perl5i/2/Signature/Real.pm" }, "perl5i::2::Signatures" : { "file" : "lib/perl5i/2/Signatures.pm" }, "perl5i::2::UNIVERSAL" : { "file" : "lib/perl5i/2/UNIVERSAL.pm" }, "perl5i::2::autobox" : { "file" : "lib/perl5i/2/autobox.pm" }, "perl5i::2::equal" : { "file" : "lib/perl5i/2/equal.pm" }, "perl5i::VERSION" : { "file" : "lib/perl5i/VERSION.pm", "version" : "v2.13.1" }, "perl5i::cmd" : { "file" : "lib/perl5i/cmd.pm" }, "perl5i::latest" : { "file" : "lib/perl5i/latest.pm", "version" : "v2.13.1" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://github.com/evalEmpire/perl5i/issues" }, "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/evalEmpire/perl5i/tree/master" }, "x_IRC" : "irc://irc.perl.org/#perl5i" }, "version" : "v2.13.1" } perl5i-v2.13.1/META.yml000444000765000024 1211612451415774 14562 0ustar00schwernstaff000000000000--- abstract: 'Fix as much of Perl 5 as possible in one pragma' author: - 'Michael G Schwern ' build_requires: ExtUtils::CBuilder: '0.26' IPC::Open3: '0' Test::More: '0.88' Test::Output: '0.16' Test::Warn: '0.11' configure_requires: Module::Build: '0.36' dynamic_config: 1 generated_by: 'Module::Build version 0.421, CPAN::Meta::Converter version 2.142060' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: perl5i no_index: file: - lib/perl5i/0/DateTime.pm - lib/perl5i/0/ARRAY.pm - lib/perl5i/0/DEFAULT.pm - lib/perl5i/0/HASH.pm - lib/perl5i/0/Meta.pm - lib/perl5i/0/Meta/Class.pm - lib/perl5i/0/Meta/Instance.pm - lib/perl5i/0/SCALAR.pm - lib/perl5i/VERSION.pm provides: perl5i: file: lib/perl5i.pm version: v2.13.1 perl5i::0: file: lib/perl5i/0.pm version: v2.13.1 perl5i::0::ARRAY: file: lib/perl5i/0/ARRAY.pm perl5i::0::DEFAULT: file: lib/perl5i/0/DEFAULT.pm perl5i::0::DateTime: file: lib/perl5i/0/DateTime.pm perl5i::0::DateTime::Format::CTime: file: lib/perl5i/0/DateTime.pm perl5i::0::DateTime::time: file: lib/perl5i/0/DateTime.pm perl5i::0::DateTime::y2038: file: lib/perl5i/0/DateTime.pm perl5i::0::HASH: file: lib/perl5i/0/HASH.pm perl5i::0::Meta: file: lib/perl5i/0/Meta.pm perl5i::0::Meta::Class: file: lib/perl5i/0/Meta/Class.pm perl5i::0::Meta::Instance: file: lib/perl5i/0/Meta/Instance.pm perl5i::0::SCALAR: file: lib/perl5i/0/SCALAR.pm perl5i::1: file: lib/perl5i/1.pm version: v2.13.1 perl5i::1::ARRAY: file: lib/perl5i/1/ARRAY.pm perl5i::1::CODE: file: lib/perl5i/1/CODE.pm perl5i::1::DateTime: file: lib/perl5i/1/DateTime.pm perl5i::1::DateTime::Format::CTime: file: lib/perl5i/1/DateTime.pm perl5i::1::DateTime::time: file: lib/perl5i/1/DateTime.pm perl5i::1::DateTime::y2038: file: lib/perl5i/1/DateTime.pm perl5i::1::HASH: file: lib/perl5i/1/HASH.pm perl5i::1::Meta: file: lib/perl5i/1/Meta.pm perl5i::1::Meta::Class: file: lib/perl5i/1/Meta/Class.pm perl5i::1::Meta::Instance: file: lib/perl5i/1/Meta/Instance.pm perl5i::1::SCALAR: file: lib/perl5i/1/SCALAR.pm perl5i::1::UNIVERSAL: file: lib/perl5i/1/UNIVERSAL.pm perl5i::1::autobox: file: lib/perl5i/1/autobox.pm perl5i::2: file: lib/perl5i/2.pm version: v2.13.1 perl5i::2::ARRAY: file: lib/perl5i/2/ARRAY.pm perl5i::2::CODE: file: lib/perl5i/2/CODE.pm perl5i::2::DateTime: file: lib/perl5i/2/DateTime.pm perl5i::2::DateTime::Format::CTime: file: lib/perl5i/2/DateTime.pm perl5i::2::DateTime::time: file: lib/perl5i/2/DateTime.pm perl5i::2::DateTime::y2038: file: lib/perl5i/2/DateTime.pm perl5i::2::HASH: file: lib/perl5i/2/HASH.pm perl5i::2::Meta: file: lib/perl5i/2/Meta.pm perl5i::2::Meta::Class: file: lib/perl5i/2/Meta/Class.pm perl5i::2::Meta::Instance: file: lib/perl5i/2/Meta/Instance.pm perl5i::2::RequireMessage: file: lib/perl5i/2/RequireMessage.pm perl5i::2::SCALAR: file: lib/perl5i/2/SCALAR.pm perl5i::2::Signature: file: lib/perl5i/2/Signature.pm perl5i::2::Signature::Function::None: file: lib/perl5i/2/Signature/Function/None.pm perl5i::2::Signature::Method::None: file: lib/perl5i/2/Signature/Method/None.pm perl5i::2::Signature::None: file: lib/perl5i/2/Signature/None.pm perl5i::2::Signature::Real: file: lib/perl5i/2/Signature/Real.pm perl5i::2::Signatures: file: lib/perl5i/2/Signatures.pm perl5i::2::UNIVERSAL: file: lib/perl5i/2/UNIVERSAL.pm perl5i::2::autobox: file: lib/perl5i/2/autobox.pm perl5i::2::equal: file: lib/perl5i/2/equal.pm perl5i::VERSION: file: lib/perl5i/VERSION.pm version: v2.13.1 perl5i::cmd: file: lib/perl5i/cmd.pm perl5i::latest: file: lib/perl5i/latest.pm version: v2.13.1 recommends: autodie: '2.26' requires: CLASS: '1.00' Capture::Tiny: '0.06' Carp::Fix::1_25: '1.000000' Child: '0.009' DateTime: '0.47' DateTime::Format::Epoch: '0.11' DateTime::TimeZone::Tzfile: '0.002' Devel::Declare::MethodInstaller::Simple: '0.006009' Digest::MD5: '2.36' Digest::SHA: '5.45' File::chdir: '0.1002' Hash::FieldHash: '0.06' Hash::Merge::Simple: '0.04' Hash::StoredIterator: '0.007' IPC::System::Simple: '1.18' Import::Into: '1.002003' JSON: '2.17' List::MoreUtils: '0.22' Modern::Perl: '1.03' Module::Load: '0.16' Object::ID: v0.1.0 Path::Tiny: '0.036' Perl6::Caller: '0.100' Taint::Util: '0.06' Text::Wrap: '2009.0305' Try::Tiny: '0.02' Want: '0.18' YAML::Any: '0.70' autobox: '2.80' autobox::Core: '1.0' autobox::List::Util: '20090629' autobox::dump: '20090426' autodie: '2.12' autovivification: '0.06' indirect: '0.24' parent: '0.221' perl: v5.10.0 true::VERSION: '0.16' utf8::all: '0.015' version: '0.77' resources: IRC: irc://irc.perl.org/#perl5i bugtracker: http://github.com/evalEmpire/perl5i/issues license: http://dev.perl.org/licenses/ repository: http://github.com/evalEmpire/perl5i/tree/master version: v2.13.1 perl5i-v2.13.1/PATCHING000444000765000024 455712451415774 14423 0ustar00schwernstaff000000000000Patching policy for perl5i. For the really impatient: ------------------------- * Rule 1: When in doubt, open a ticket. http://github.com/evalEmpire/perl5i/issues Found a bug? Not sure if its a bug or a weird feature? Have an idea? Found something unpleasent? Had trouble using something? Open a ticket. Don't worry, we won't yell at you. We'd rather get 10 duplicates than lose one good report because somebody wasn't sure. * We prefer if you use github, but you can always email a patch to perl5i@googlegroups.com. * Don't know if your code is up to our standard? Send it in and we'll work it out. * perl5i is about making Perl 5 better. A good rule of thumb is if it takes more than one line to do a simple thing, you might be on to something. If a newbie asks a simple question and the "right answer" takes a full page, you've probably found a candidate for perl5i. Here's the preferred way to make a patch: ---------------------------------------- 0) We'd rather you participate than follow all the rules, especially if its your first patch. Don't worry, be crappy. 1) Put an issue in the tracker for your problem. Then it can be discussed before you put a whole lot of effort into it. http://github.com/evalEmpire/perl5i/issues 1a) If its a bug, report the bug BEFORE work on it. This ensures the bug gets reported. Mention that you're working on it. 1b) If its a feature, we like to hear about your idea even if you don't have a patch. 2) You can either work from the CPAN version or the repository. We'd prefer you worked from the repository. http://github.com/evalEmpire/perl5i 2a) Ideally, make a fork on github and work on that. 3) DO add any new dependencies in Build.PL 3a) If you're not sure what version to depend on, pick the version you have installed. That's safest. 4) DON'T update MANIFEST. Its automated and will just cause conflicts. 5) DON'T update Changes. It will cause conflicts when merging. The release manager will handle it. 6) DO write tests. Otherwise the release manager has to. 7) DO write documentation. Otherwise the release manager has to. 8) Commit ONE THING AT A TIME. Preferrably use a branch for each feature. It makes it much easier to integrate. 9) You can either send patches to schwern+perl5i@pobox.com or (preferred) issue a github pull request. Thanks for patching! perl5i-v2.13.1/README000444000765000024 10336012451415774 14213 0ustar00schwernstaff000000000000NAME perl5i - Fix as much of Perl 5 as possible in one pragma SYNOPSIS use perl5i::2; or $ perl5i your_script.pl DESCRIPTION Perl 5 has a lot of warts. There's a lot of individual modules and techniques out there to fix those warts. perl5i aims to pull the best of them together into one module so you can turn them on all at once. This includes adding features, changing existing core functions and changing defaults. It will likely not be 100% backwards compatible with Perl 5, though it will be 99%, perl5i will try to have a lexical effect. Please add to this imaginary world and help make it real, either by telling me what Perl looks like in your imagination (http://github.com/evalEmpire/perl5i/issues) or make a fork (forking on github is like a branch you control) and implement it yourself. Rationale Changing perl 5 core is a slow and difficult process. Perl 5 aims to be compatible with ancient versions which means it is mostly stuck with design, decisions and defaults made way back in the 90's. There are modules in CPAN to solve or ease many of those issues but many people don't know about them or don't know which ones to use. Documentation and books are updated slowly and don't usually keep up; this information becomes some sort of community knowledge, invisible from the wider audience. Even if you know a solution, having to decide everytime which module to use and enable it individually might be enough for you to give up and just do things the old way. Perl5i brings all this community knowledge in a coherent way, in something like 'the best of CPAN', enabled with a single command. You don't need to know all it does nor how it does it, you just "use perl5i::2" on your code and you automatically get a modern environment, with perl defaults, problems and inconsistencies fixed. You can refer beginers to perl5i and they can benefit from it without needing to become a perl guru first. Using perl5i Because perl5i *plans* to be incompatible in the future, you do not simply "use perl5i". You must declare which major version of perl5i you are using. You do this like so: # Use perl5i major version 2 use perl5i::2; Thus the code you write with, for example, "perl5i::2" will always remain compatible even as perl5i moves on. If you want to be daring, you can "use perl5i::latest" to get the latest version. This will automatically happen if the program is "-e". This lets you do slightly less typing for one-liners like "perl -Mperl5i -e ..." If you want your module to depend on perl5i, you should depend on the versioned class. For example, depend on "perl5i::2" and not "perl5i". See "VERSIONING" for more information about perl5i's versioning scheme. What it does perl5i enables each of these modules and adds/changes these functions. We'll provide a brief description here, but you should look at each of their documentation for full details. The Meta Object Every object (and everything is an object) now has a meta object associated with it. Using the meta object you can ask things about the object which were previously over complicated. For example... # the object's class my $class = $obj->mo->class; # its parent classes my @isa = $obj->mo->isa; # the complete inheritance hierarchy my @complete_isa = $obj->mo->linear_isa; # the reference type of the object my $reftype = $obj->mo->reftype; A meta object is used to avoid polluting the global method space. "mo" was chosen to avoid clashing with Moose's meta object. See perl5i::Meta for complete details. Subroutine and Method Signatures perl5i makes it easier to declare what parameters a subroutine takes. func hello($place) { say "Hello, $place!\n"; } method get($key) { return $self->{$key}; } method new($class: %args) { return bless \%args, $class; } "func" and "method" define subroutines as "sub" does, with some extra conveniences. The signature syntax is currently very simple. The content will be assigned from @_. This: func add($this, $that) { return $this + $that; } is equivalent to: sub add { my($this, $that) = @_; return $this + $that; } "method" defines a method. This is the same as a subroutine, but the first argument, the *invocant*, will be removed and made into $self. method get($key) { return $self->{$key}; } sub get { my $self = shift; my($key) = @_; return $self->{$key}; } Methods have a special bit of syntax. If the first item in the siganture is $var: it will change the variable used to store the invocant. method new($class: %args) { return bless \%args, $class; } is equivalent to: sub new { my $class = shift; my %args = @_; return bless \%args, $class; } Anonymous functions and methods work, too. my $code = func($message) { say $message }; Guarantees include: @_ will not be modified except by removing the invocant Future versions of perl5i will add to the signature syntax and capabilities. Planned expansions include: Signature validation Signature documentation Named parameters Required parameters Read only parameters Aliased parameters Anonymous method and function declaration Variable method and function names Parameter traits Traditional prototypes See for more details about future expansions. The equivalencies above should only be taken for illustrative purposes, they are not guaranteed to be literally equivalent. Note that while all parameters are optional by default, the number of parameters will eventually be enforced. For example, right now this will work: func add($this, $that) { return $this + $that } say add(1,2,3); # says 3 The extra argument is ignored. In future versions of perl5i this will be a runtime error. Signature Introspection The signature of a subroutine defined with "func" or "method" can be queried by calling the "signature" method on the code reference. func hello($greeting, $place) { say "$greeting, $place" } my $code = \&hello; say $code->signature->num_positional_params; # prints 2 Functions defined with "sub" will not have a signature. See perl5i::Signature for more details. Autoboxing autobox allows methods to be defined for and called on most unblessed variables. This means you can call methods on ordinary strings, lists and hashes! It also means perl5i can add a lot of functionality without polluting the global namespace. autobox::Core wraps a lot of Perl's built in functions so they can be called as methods on unblessed variables. "@a->pop" for example. alias $scalar_reference->alias( @identifiers ); @alias->alias( @identifiers ); %hash->alias( @identifiers ); (\&code)->alias( @identifiers ); Aliases a variable to a new global name. my $code = sub { 42 }; $code->alias( "foo" ); say foo(); # prints 42 It will work on everything except scalar references. our %stuff; %other_hash->alias( "stuff" ); # %stuff now aliased to %other_hash It is not a copy, changes to one will change the other. my %things = (foo => 23); our %stuff; %things->alias( "stuff" ); # alias %things to %stuff $stuff{foo} = 42; # change %stuff say $things{foo}; # and it will show up in %things Multiple @identifiers will be joined with '::' and used as the fully qualified name for the alias. my $class = "Some::Class"; my $name = "foo"; sub { 99 }->alias( $class, $name ); say Some::Class->foo; # prints 99 If there is just one @identifier and it has no "::" in it, the current caller will be prepended. "$thing->alias("name")" is shorthand for "$thing->alias(CLASS, "name")" Due to limitations in autobox, non-reference scalars cannot be aliased. Alias a scalar ref instead. my $thing = 23; $thing->alias("foo"); # error my $thing = \23; $thing->alias("foo"); # $foo is now aliased to $thing This is basically a nicer way to say: no strict 'refs'; *{$package . '::'. $name} = $reference; Scalar Autoboxing All of the methods provided by autobox::Core are available from perl5i. in addition, perl5i adds some methods of its own. path my $object = $path->path; Creates a Path::Tiny $object for the given file or directory $path. my $path = "/foo/bar/baz.txt"->path; my $content = $path->slurp; center my $centered_string = $string->center($length); my $centered_string = $string->center($length, $character); Centers $string between $character. $centered_string will be of length $length. $character defaults to " ". say "Hello"->center(10); # " Hello "; say "Hello"->center(10, '-'); # "---Hello--"; "center()" will never truncate $string. If $length is less than "$string->length" it will just return $string. say "Hello"->center(4); # "Hello"; round my $rounded_number = $number->round; Round to the nearest integer. round_up ceil my $new_number = $number->round_up; Rounds the $number towards infinity. 2.45->round_up; # 3 (-2.45)->round_up; # -2 ceil() is a synonym for round_up(). round_down floor my $new_number = $number->round_down; Rounds the $number towards negative infinity. 2.45->round_down; # 2 (-2.45)->round_down; # -3 floor() is a synonyn for round_down(). is_number $is_a_number = $thing->is_number; Returns true if $thing is a number understood by Perl. 12.34->is_number; # true "12.34"->is_number; # also true "eleven"->is_number; # false is_positive $is_positive = $thing->is_positive; Returns true if $thing is a positive number. 0 is not positive. is_negative $is_negative = $thing->is_negative; Returns true if $thing is a negative number. 0 is not negative. is_even $is_even = $thing->is_even; Returns true if $thing is an even integer. is_odd $is_odd = $thing->is_odd; Returns true if $thing is an odd integer. is_integer $is_an_integer = $thing->is_integer; Returns true if $thing is an integer. 12->is_integer; # true 12.34->is_integer; # false "eleven"->is_integer; # false is_int A synonym for is_integer is_decimal $is_a_decimal_number = $thing->is_decimal; Returns true if $thing is a decimal number. 12->is_decimal; # false 12.34->is_decimal; # true ".34"->is_decimal; # true "point five"->is_decimal; # false require my $module = $module->require; Will "require" the given $module. This avoids funny things like "eval qq[require $module] or die $@". It accepts only module names. On failure it will throw an exception, just like "require". On a success it returns the $module. This is mostly useful so that you can immediately call $module's "import" method to emulate a "use". # like "use $module qw(foo bar);" if that worked $module->require->import(qw(foo bar)); # like "use $module;" if that worked $module->require->import; wrap my $wrapped = $string->wrap( width => $cols, separator => $sep ); Wraps $string to width $cols, breaking lines at word boundries using separator $sep. If no width is given, $cols defaults to 76. Default line separator is the newline character "\n". See Text::Wrap for details. ltrim rtrim trim my $trimmed = $string->trim; my $trimmed = $string->trim($character_set); Trim whitespace. ltrim() trims off the start of the string (left), rtrim() off the end (right) and trim() off both the start and end. my $string = ' testme'->ltrim; # 'testme' my $string = 'testme '->rtrim; # 'testme' my $string = ' testme '->trim; # 'testme' They all take an optional $character_set which will determine what characters should be trimmed. It follows regex character set syntax so "A-Z" will trim everything from A to Z. Defaults to "\s", whitespace. my $string = '-> test <-'->trim('-><'); # ' test ' title_case my $name = 'joe smith'->title_case; # Joe Smith Will uppercase every word character that follows a wordbreak character. path2module my $module = $path->path2module; Given a relative $path it will return the Perl module this represents. For example, "Foo/Bar.pm"->path2module; # "Foo::Bar" It will throw an exception if given something which could not be a path to a Perl module. module2path my $path = $module->module2path; Will return the relative $path in which the Perl $module can be found. For example, "Foo::Bar"->module2path; # "Foo/Bar.pm" is_module_name my $is_valid = $string->is_module_name; Will return true if the $string is a valid module name. "Foo::Bar"->is_module_name; # true "Foo/Bar"->is_module_name; # false group_digits my $number_grouped = $number->group_digits; my $number_grouped = $number->group_digits(\%options); Turns a number like 1234567 into a string like 1,234,567 known as "digit grouping". It honors your current locale to determine the separator and grouping. This can be overridden using %options. NOTE: many systems do not have their numeric locales set properly separator The character used to separate groups. Defaults to "thousands_sep" in your locale or "," if your locale doesn't specify. decimal_point The decimal point character. Defaults to "decimal_point" in your locale or "." if your locale does not specify. grouping How many numbers in a group? Defaults to "grouping" in your locale or 3 if your locale doesn't specify. Note: we don't honor the full grouping locale, its a wee bit too complicated. currency If true, it will treat the number as currency and use the monetary locale settings. "mon_thousands_sep" instead of "thousands_sep" and "mon_grouping" instead of "grouping". 1234->group_digits; # 1,234 (assuming US locale) 1234->group_digits( separator => "." ); # 1.234 commify my $number_grouped = $number->commify; my $number_grouped = $number->commify(\%options); commify() is just like group_digits() but it is not locale aware. It is useful when you want a predictable result regardless of the user's locale settings. %options defaults to "( separator => ",", grouping => 3, decimal_point => "." )". Each key will be overridden individually. 1234->commify; # 1,234 1234->commify({ separator => "." }); # 1.234 reverse my $reverse = $string->reverse; Reverses a $string. Unlike Perl's reverse(), this always reverses the string regardless of context. Array Autoboxing The methods provided by "Array Methods" in autobox::Core are available from perl5i. All the functions from List::Util and select ones from List::MoreUtils are all available as methods on unblessed arrays and array refs: first, max, maxstr, min, minstr, minmax, shuffle, reduce, sum, any, all, none, true, false, uniq and mesh. They have all been altered to return array refs where applicable in order to allow chaining. @array->grep(sub{ $_->is_number })->sum->say; foreach @array->foreach( func($item) { ... } ); Works like the built in "foreach", calls the code block for each element of @array passing it into the block. @array->foreach( func($item) { say $item } ); # print each item It will pass in as many elements as the code block accepts. This allows you to iterate through an array 2 at a time, or 3 or 4 or whatever. my @names = ("Joe", "Smith", "Jim", "Dandy", "Jane", "Lane"); @names->foreach( func($fname, $lname) { say "Person: $fname $lname"; }); A normal subroutine with no signature will get one at a time. If @array is not a multiple of the iteration (for example, @array has 5 elements and you ask 2 at a time) the behavior is currently undefined. as_hash my %hash = @array->as_hash; This method returns a %hash where each element of @array is a key. The values are all true. Its functionality is similar to: my %hash = map { $_ => 1 } @array; Example usage: my @array = ("a", "b", "c"); my %hash = @array->as_hash; say q[@array contains 'a'] if $hash{"a"}; pick my @rand = @array->pick($number); The pick() method returns a list of $number elements in @array. If $number is larger than the size of the list, it returns the entire list shuffled. Example usage: my @array = (1, 2, 3, 4); my @rand = @array->pick(2); pick_one my $rand = @array->pick_one; The pick_one() method returns a random element in @array. It is similar to @array->pick(1), except that it does not return a list. Example usage: my @array = (1,2,3,4); my $rand = @array->pick_one; diff Calculate the difference between two (or more) arrays: my @a = ( 1, 2, 3 ); my @b = ( 3, 4, 5 ); my @diff_a = @a->diff(\@b) # [ 1, 2 ] my @diff_b = @b->diff(\@a) # [ 4, 5 ] Diff returns all elements in array @a that are not present in array @b. Item order is not considered: two identical elements in both arrays will be recognized as such disregarding their index. [ qw( foo bar ) ]->diff( [ qw( bar foo ) ] ) # empty, they are equal For comparing more than two arrays: @a->diff(\@b, \@c, ... ) All comparisons are against the base array (@a in this example). The result will be composed of all those elements that were present in @a and in none other. It also works with nested data structures; it will traverse them depth-first to assess whether they are identical or not. For instance: [ [ 'foo ' ], { bar => 1 } ]->diff([ 'foo' ]) # [ { bar => 1 } ] In the case of overloaded objects (i.e., DateTime, URI, Path::Class, etc.), it tries its best to treat them as strings or numbers. my $uri = URI->new("http://www.perl.com"); my $uri2 = URI->new("http://www.perl.com"); [ $uri ]->diff( [ "http://www.perl.com" ] ); # empty, they are equal [ $uri ]->diff( [ $uri2 ] ); # empty, they are equal popn my @newarray = @array->popn($n); Pops $n values from the @array. If $n is greater than the length of @array, it will return the whole @array. If $n is 0, it will return an empty array. A negative $n or non-integer is an error. my @array = (1, 2, 3, 4, 5); my @newarray = @array->popn(3); # (3, 4, 5) shiftn my @newarray = @array->shiftn($n); Works like popn, but it shifts off the front of the array instead of popping off the end. my @array = (1, 2, 3, 4, 5); my @newarray = @array->shiftn(3); # (1, 2, 3) intersect my @a = (1 .. 10); my @b = (5 .. 15); my @intersection = @a->intersect(\@b) # [ 5 .. 10 ]; Performs intersection between arrays, returning those elements that are present in all of the argument arrays simultaneously. As with "diff()", it works with any number of arrays, nested data structures of arbitrary depth, and handles overloaded objects graciously. ltrim rtrim trim my @trimmed = @list->trim; my @trimmed = @list->trim($character_set); Trim whitespace from each element of an array. Each works just like their scalar counterpart. my @trimmed = [ ' foo', 'bar ' ]->ltrim; # [ 'foo', 'bar ' ] my @trimmed = [ ' foo', 'bar ' ]->rtrim; # [ ' foo', 'bar' ] my @trimmed = [ ' foo', 'bar ' ]->trim; # [ 'foo', 'bar' ] As with the scalar trim() methods, they all take an optional $character_set which will determine what characters should be trimmed. my @trimmed = ['-> foo <-', '-> bar <-']->trim('-><'); # [' foo ', ' bar '] Hash Autoboxing All of the methods provided by "Hash Methods" in autobox::Core are available from perl5i. In addition... each Iterate through each key/value pair in a hash using a callback. my %things = ( foo => 23, bar => 42 ); %things->each( func($k, $v) { say "Key: $k, Value: $v" }); Unlike the "each" function, individual calls to each are guaranteed to iterate through the entirety of the hash. flip Exchanges values for keys in a hash. my %things = ( foo => 1, bar => 2, baz => 5 ); my %flipped = %things->flip; # { 1 => foo, 2 => bar, 5 => baz } If there is more than one occurence of a certain value, any one of the keys may end up as the value. This is because of the random ordering of hash keys. # Could be { 1 => foo }, { 1 => bar }, or { 1 => baz } { foo => 1, bar => 1, baz => 1 }->flip; Because hash references cannot usefully be keys, it will not work on nested hashes. { foo => [ 'bar', 'baz' ] }->flip; # dies merge Recursively merge two or more hashes together using Hash::Merge::Simple. my $a = { a => 1 }; my $b = { b => 2, c => 3 }; $a->merge($b); # { a => 1, b => 2, c => 3 } For conflicting keys, rightmost precedence is used: my $a = { a => 1 }; my $b = { a => 100, b => 2}; $a->merge($b); # { a => 100, b => 2 } $b->merge($a); # { a => 1, b => 2 } It also works with nested hashes, although it won't attempt to merge array references or objects. For more information, look at the Hash::Merge::Simple docs. diff my %staff = ( bob => 42, martha => 35, timmy => 23 ); my %promoted = ( timmy => 23 ); %staff->diff(\%promoted); # { bob => 42, martha => 35 } Returns the key/value pairs present in the first hash that are not present in the subsequent hash arguments. Otherwise works as "@array->diff". intersect %staff->intersect(\%promoted); # { timmy => 23 } Returns the key/value pairs that are present simultaneously in all the hash arguments. Otherwise works as "@array->intersect". Code autoboxing signature my $sig = $code->signature; You can query the signature of any code reference defined with "func" or "method". See "Signature Introspection" for details. If $code has a signature, returns an object representing $code's signature. See perl5i::Signature for details. Otherwise it returns nothing. caller Perl6::Caller causes "caller" to return an object in scalar context. die "die" now always returns an exit code of 255 instead of trying to use $! or $? which makes the exit code unpredictable. If you want to exit with a message and a special exit code, use "warn" then "exit". list "list" will force list context similar to how scalar will force scalar context. utf8::all perl5i turns on utf8::all which turns on all the Unicode features of Perl it can. Here is the current list, more may be turned on later. Bare strings in your source code are now UTF8. This means UTF8 variable and method names, strings and regexes. my $message = "انا لا اتكلم العربيه"; my $τάδε = "It's all Greek to me!"; sub fünkßhüñ { ... } Strings will be treated as a set of characters rather than a set of bytes. For example, "length" will return the number of characters, not the number of bytes. length("perl5i is MËTÁŁ"); # 15, not 18 @ARGV will be read as UTF8. STDOUT, STDIN, STDERR and all newly opened filehandles will have UTF8 encoding turned on. Consequently, if you want to output raw bytes to a file, such as outputting an image, you must set "binmode $fh". capture my($stdout, $stderr) = capture { ... } %options; my $stdout = capture { ... } %options; "capture()" lets you capture all output to "STDOUT" and "STDERR" in any block of code. # $out = "Hello" # $err = "Bye" my($out, $err) = capture { print "Hello"; print STDERR "Bye"; }; If called in scalar context, it will only return "STDOUT" and silence "STDERR". # $out = "Hello" my $out = capture { print "Hello"; warn "oh god"; }; "capture" takes some options. tee tee will cause output to be captured yet still printed. my $out = capture { print "Hi" } tee => 1; merge merge will merge "STDOUT" and "STDERR" into one variable. # $out = "HiBye" my $out = capture { print "Hi"; print STDERR "Bye"; } merge => 1; Carp "croak" and "carp" from Carp are always available. The Carp message will always format consistently, smoothing over the backwards incompatible change in Carp 1.25. Child Child provides the "child" function which is a better way to do forking. "child" creates and starts a child process, and returns an Child::Link::Proc object which is a better interface for managing the child process. The only required argument is a codeblock, which is called in the new process. exit() is automatically called for you after the codeblock returns. my $proc = child { my $parent = shift; ... }; You can also request a pipe for IPC: my $proc = child { my $parent = shift; $parent->say("Message"); my $reply = $parent->read(); ... } pipe => 1; my $message = $proc->read(); $proc->say("reply"); See Child for more information. English English gives English names to the punctuation variables; for instance, "<$@"> is also "<$EVAL_ERROR">. See perlvar for details. It does not load the regex variables which affect performance. $PREMATCH, $MATCH, and $POSTMATCH will not exist. See the "p" modifier in perlre for a better alternative. Modern::Perl Modern::Perl turns on strict and warnings, enables all the 5.10 features like "given/when", "say" and "state", and enables C3 method resolution order. CLASS Provides "CLASS" and $CLASS alternatives to "__PACKAGE__". File::chdir File::chdir gives you $CWD representing the current working directory and it's assignable to "chdir". You can also localize it to safely chdir inside a scope. File::stat File::stat causes "stat" to return an object in scalar context. DateTime "time", "localtime", and "gmtime" are replaced with DateTime objects. They will all act like the core functions. # Sat Jan 10 13:37:04 2004 say scalar gmtime(2**30); # 2004 say gmtime(2**30)->year; # 2009 (when this was written) say time->year; Time::y2038 "gmtime()" and "localtime()" will now safely work with dates beyond the year 2038 and before 1901. The exact range is not defined, but we guarantee at least up to 2**47 and back to year 1. IO::Handle Turns filehandles into objects so you can call methods on them. The biggest one is "autoflush" rather than mucking around with $| and "select". $fh->autoflush(1); autodie autodie causes system and file calls which can fail ("open", "system", and "chdir", for example) to die when they fail. This means you don't have to put "or die" at the end of every system call, but you do have to wrap it in an "eval" block if you want to trap the failure. autodie's default error messages are pretty smart. All of autodie will be turned on. autovivification autovivification fixes the bug/feature where this: $hash = {}; $hash->{key1}{key2}; Results in "$hash->{key1}" coming into existence. That will no longer happen. No indirect object syntax perl5i turns indirect object syntax, ie. "new $obj", into a compile time error. Indirect object syntax is largely unnecessary and removing it avoids a number of ambiguous cases where Perl will mistakenly try to turn a function call into an indirect method call. See indirect for details. want "want()" generalizes the mechanism of the wantarray function, allowing a function to determine the context it's being called in. Want distinguishes not just scalar v. array context, but void, lvalue, rvalue, boolean, reference context, and more. See perldoc Want for full details. Try::Tiny Try::Tiny gives support for try/catch blocks as an alternative to "eval BLOCK". This allows correct error handling with proper localization of $@ and a nice syntax layer: # handle errors with a catch handler try { die "foo"; } catch { warn "caught error: $_"; }; # just silence errors try { die "foo"; }; See perldoc Try::Tiny for details. true You no longer have to put a true value at the end of a module which uses perl5i. Better load errors Most of us have learned the meaning of the dreaded "Can't locate Foo.pm in @INC". Admittedly though, it's not the most helpful of the error messages. In perl5i we provide a much friendlier error message. Example: Can't locate My/Module.pm in your Perl library. You may need to install it from CPAN or another repository. Your library paths are: Indented list of paths, 1 per line... Turning off features use perl5i::2 -skip => \@features_to_skip; While perl5i is intended as a curated collection of modules, its possible you might not want certain features. Features can be turned off in your scope by using "-skip". For example, this will skip loading Try::Tiny. use perl5i::latest -skip => [qw(Try::Tiny)]; Why would you do this? You might want to use a different try/catch module such as TryCatch which provides its own "try" and "catch". The feature strings are: "autobox", "autodie", "autovivification", "capture", "Carp::Fix::1_25", "Child", "CLASS", "die", "English", "File::chdir", "indirect", "list", "Meta", "Modern::Perl", "Perl6::Caller", "Signatures", "stat", "time", "true", "Try::Tiny", "utf8::all", "Want". Command line program There is a perl5i command line program installed with perl5i (Windows users get perl5i.bat). This is handy for writing one liners. perl5i -e 'gmtime->year->say' And you can use it on the "#!" line. #!/usr/bin/perl5i gmtime->year->say; If you write a one-liner without using this program, saying "-Mperl5i" means "-Mperl5i::latest". Please see "Using perl5i" and "VERSIONING" for details. BUGS Some parts are not lexical. Some parts are package scoped. If you're going to use two versions of perl5i together, we do not currently recommend having them in the same package. See for a complete list. Please report bugs at . VERSIONING perl5i follows the Semantic Versioning policy, . In short... Versions will be of the form X.Y.Z. 0.Y.Z may change anything at any time. Incrementing X (ie. 1.2.3 -> 2.0.0) indicates a backwards incompatible change. Incrementing Y (ie. 1.2.3 -> 1.3.0) indicates a new feature. Incrementing Z (ie. 1.2.3 -> 1.2.4) indicates a bug fix or other internal change. NOTES Inspired by chromatic's Modern::Perl and in particular http://www.modernperlbooks.com/mt/2009/04/ugly-perl-a-lesson-in-the-impo rtance-of-language-design.html. I totally didn't come up with the "Perl 5 + i" joke. I think it was Damian Conway. THANKS Thanks to our contributors: Chas Owens, Darian Patrick, rjbs, chromatic, Ben Hengst, Bruno Vecchi and anyone else I've forgotten. Thanks to Flavian and Matt Trout for their signature and Devel::Declare work. Thanks to all the CPAN authors upon whom this builds. LICENSE Copyright 2009-2010, Michael G Schwern This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See SEE ALSO Repository: Issues/Bugs: IRC: on the #perl5i channel Wiki: Twitter: Frequently Asked Questions about perl5i: perl5ifaq Some modules with similar purposes include: Modern::Perl, Common::Sense For a complete object declaration system, see Moose and MooseX::Declare. perl5i-v2.13.1/bin000755000765000024 012451415774 13703 5ustar00schwernstaff000000000000perl5i-v2.13.1/bin/perl5i.bat.PL000555000765000024 25412451415774 16226 0ustar00schwernstaff000000000000#!/usr/bin/perl -w my $file = shift; open my $fh, ">", $file or die "Can't open $file: $!"; printf $fh <<'END', $^X; @echo off %s -Mperl5i::cmd=perl5i.bat %%* END perl5i-v2.13.1/bin/perl5i.c.PL000444000765000024 513112451415774 15716 0ustar00schwernstaff000000000000# Write out the perl5i wrapper C program making sure it uses # the Perl its built with. use strict; use warnings; use File::Spec; my $file = shift; # Its going inside double quotes. my $perl_path = $^X; $perl_path =~ s{ ([\\"]) }{\\$1}gx; my $tempdir = File::Spec->tmpdir || "/tmp"; open my $fh, ">", $file or die $!; printf $fh <<'END', $0, $perl_path, $tempdir; /* THIS FILE IS GENERATED BY %s * Any changes here will be wiped out. Edit it there instead. */ #define DEBUG 0 #include #include #include #include /* * Meant to mimic the shell command * exec perl -Mperl5i::latest "$@" * * This is a C program so it works in a #! line. */ int main (int argc, char* argv[]) { int i; int j; const char* perl_cmd = "%s"; char* perl_args[argc+1]; char* dash_m = (char *)malloc(sizeof(char) * (strlen(argv[0]) + 20)); char* program; int saw_dash_e = 0; strcpy(dash_m, "-Mperl5i::cmd="); strcat(dash_m, argv[0]); perl_args[0] = (char *)perl_cmd; perl_args[1] = dash_m; for( i = 1, j = 2; i < argc; i++ ) { char *dash_e = strchr(argv[i], 'e'); /* Its a one liner */ if( dash_e && dash_e > argv[i] && *(dash_e-1) == '-' && (strchr(argv[i], '-') == argv[i]) ) { saw_dash_e = 1; /* Chop out the -e */ dash_e[0] = '\0'; /* If all that's left is a dash, ignore it */ if( strcmp(argv[i], "-") != 0 ) { perl_args[j] = argv[i]; j++; } /* Skip the next argument, its the program */ program = argv[i+1]; i++; continue; } perl_args[j] = argv[i]; j++; } /* Turn one liners into real programs to work around a Devel::Declare bug */ if( saw_dash_e ) { char tempfile[] = "%s/perl5i.XXXXXX"; int fd = mkstemp(tempfile); if( fd == -1 ) { perror("Could not open temporary file 'tempfile'"); exit(1); } FILE *fh = fdopen(fd, "w"); fprintf( fh, "$0 = '-e';\n" ); fprintf( fh, "#line 1 \"-e\"\n" ); fprintf( fh, "%%s", program ); fclose(fh); perl_args[j++] = tempfile; } /* Argument array must be terminated by a null */ perl_args[j] = (char *)NULL; #if DEBUG for( i = 0; i <= j; i++ ) { printf("perl_args[%%d]: %%s\n", i, perl_args[i]); } if( saw_dash_e ) printf("program: %%s\n", program); #endif return execv( perl_cmd, perl_args ); } END perl5i-v2.13.1/bin/perl5i.plx000555000765000024 6612451415774 15732 0ustar00schwernstaff000000000000#!/usr/bin/perl exec $^X, "-Mperl5i::cmd=$0", @ARGV; perl5i-v2.13.1/inc000755000765000024 012451415774 13704 5ustar00schwernstaff000000000000perl5i-v2.13.1/inc/MyBuild.pm000555000765000024 541112451415774 15750 0ustar00schwernstaff000000000000package MyBuild; use 5.010; use base 'Module::Build'; # Override default 'code' action # to allow compilation of perl5i.c sub ACTION_code { my $self = shift; # This has to be run first so the PL files are run to generate # the C code for us to compile. $self->process_PL_files; if ( $self->is_windowsish ) { # Writing a C wrapper is too hard on Windows # Don't need it as there's no #! anyway # Just do a bat file $self->script_files("bin/perl5i.bat"); } elsif ( $self->have_c_compiler() ) { my $b = $self->cbuilder(); my $obj_file = $b->compile( source => 'bin/perl5i.c', ); my $exe_file = $b->link_executable(objects => $obj_file); # script_files is set here as the resulting compiled # executable name varies based on operating system $self->script_files($exe_file); # Cleanup files from compilation $self->add_to_cleanup($obj_file, $exe_file); } else { # No C compiler, Unix style operating system. # Just use the Perl wrapper. File::Copy::copy("bin/perl5i.plx", "bin/perl5i"); $self->script_files("bin/perl5i"); $self->add_to_cleanup("bin/perl5i"); } return $self->SUPER::ACTION_code; } # Run perltidy over all the Perl code # Borrowed from Test::Harness sub ACTION_tidy { my $self = shift; my %found_files = map { %$_ } $self->find_pm_files, $self->_find_file_by_type( 'pm', 't' ), $self->_find_file_by_type( 'pm', 'inc' ), $self->_find_file_by_type( 't', 't' ), $self->_find_file_by_type( 'PL', '.' ); my @files = ( keys %found_files, map { $self->localize_file_path($_) } @extra ); print "Running perltidy on @{[ scalar @files ]} files...\n"; for my $file ( sort { $a cmp $b } @files ) { print " $file\n"; system( 'perltidy', '-b', $file ); unlink("$file.bak") if $? == 0; } } sub ACTION_critic { my $self = shift; my @files = keys %{ $self->find_pm_files }; print "Running perlcritic on @{[ scalar @files ]} files...\n"; system( "perlcritic", @files ); } # Check if the built in local/gmtime work for a reasonable set of # time. Some systems fail at 2**47 or beyond, and a lot fail at year # 0, so those are good boundaries. # This allows us to avoid depending on Time::y2038 which is a bit # unreliable. sub needs_y2038 { my $self = shift; state $limits = { # time year 2**47-1 => 4461763, -62135510400 => 1, }; for my $time (keys %$limits) { my $year = $limits->{$time}; return 1 if (gmtime($time))[5] + 1900 != $year; return 1 if (localtime($time))[5] + 1900 != $year; } return 0; } 1; perl5i-v2.13.1/lib000755000765000024 012451415774 13701 5ustar00schwernstaff000000000000perl5i-v2.13.1/lib/perl5i.pm000444000765000024 10173612451415774 15644 0ustar00schwernstaff000000000000package perl5i; ###################################### # The real code is in perl5i::2 # # Please patch that # ###################################### use strict; use parent 'perl5i::latest'; use perl5i::VERSION; our $VERSION = perl5i::VERSION->VERSION; my $Latest = perl5i::VERSION->latest; sub import { if ($0 eq '-e') { goto &perl5i::latest::import; } else { require Carp::Fix::1_25; Carp::Fix::1_25::croak(<) or make a fork (forking on github is like a branch you control) and implement it yourself. =head1 Rationale Changing perl 5 core is a slow and difficult process. Perl 5 aims to be compatible with ancient versions which means it is mostly stuck with design, decisions and defaults made way back in the 90's. There are modules in CPAN to solve or ease many of those issues but many people don't know about them or don't know which ones to use. Documentation and books are updated slowly and don't usually keep up; this information becomes some sort of community knowledge, invisible from the wider audience. Even if you know a solution, having to decide everytime which module to use and enable it individually might be enough for you to give up and just do things the old way. Perl5i brings all this community knowledge in a coherent way, in something like 'the best of CPAN', enabled with a single command. You don't need to know all it does nor how it does it, you just C on your code and you automatically get a modern environment, with perl defaults, problems and inconsistencies fixed. You can refer beginers to perl5i and they can benefit from it without needing to become a perl guru first. =head1 Using perl5i Because perl5i I to be incompatible in the future, you do not simply C. You must declare which major version of perl5i you are using. You do this like so: # Use perl5i major version 2 use perl5i::2; Thus the code you write with, for example, C will always remain compatible even as perl5i moves on. If you want to be daring, you can C to get the latest version. This will automatically happen if the program is C<-e>. This lets you do slightly less typing for one-liners like C If you want your module to depend on perl5i, you should depend on the versioned class. For example, depend on C and not C. See L for more information about perl5i's versioning scheme. =head1 What it does perl5i enables each of these modules and adds/changes these functions. We'll provide a brief description here, but you should look at each of their documentation for full details. =head2 The Meta Object Every object (and everything is an object) now has a meta object associated with it. Using the meta object you can ask things about the object which were previously over complicated. For example... # the object's class my $class = $obj->mo->class; # its parent classes my @isa = $obj->mo->isa; # the complete inheritance hierarchy my @complete_isa = $obj->mo->linear_isa; # the reference type of the object my $reftype = $obj->mo->reftype; A meta object is used to avoid polluting the global method space. C was chosen to avoid clashing with Moose's meta object. See L for complete details. =head2 Subroutine and Method Signatures perl5i makes it easier to declare what parameters a subroutine takes. func hello($place) { say "Hello, $place!\n"; } method get($key) { return $self->{$key}; } method new($class: %args) { return bless \%args, $class; } C and C define subroutines as C does, with some extra conveniences. The signature syntax is currently very simple. The content will be assigned from @_. This: func add($this, $that) { return $this + $that; } is equivalent to: sub add { my($this, $that) = @_; return $this + $that; } C defines a method. This is the same as a subroutine, but the first argument, the I, will be removed and made into C<$self>. method get($key) { return $self->{$key}; } sub get { my $self = shift; my($key) = @_; return $self->{$key}; } Methods have a special bit of syntax. If the first item in the siganture is C<$var:> it will change the variable used to store the invocant. method new($class: %args) { return bless \%args, $class; } is equivalent to: sub new { my $class = shift; my %args = @_; return bless \%args, $class; } Anonymous functions and methods work, too. my $code = func($message) { say $message }; Guarantees include: @_ will not be modified except by removing the invocant Future versions of perl5i will add to the signature syntax and capabilities. Planned expansions include: Signature validation Signature documentation Named parameters Required parameters Read only parameters Aliased parameters Anonymous method and function declaration Variable method and function names Parameter traits Traditional prototypes See L for more details about future expansions. The equivalencies above should only be taken for illustrative purposes, they are not guaranteed to be literally equivalent. Note that while all parameters are optional by default, the number of parameters will eventually be enforced. For example, right now this will work: func add($this, $that) { return $this + $that } say add(1,2,3); # says 3 The extra argument is ignored. In future versions of perl5i this will be a runtime error. =head3 Signature Introspection The signature of a subroutine defined with C or C can be queried by calling the C method on the code reference. func hello($greeting, $place) { say "$greeting, $place" } my $code = \&hello; say $code->signature->num_positional_params; # prints 2 Functions defined with C will not have a signature. See L for more details. =head2 Autoboxing L allows methods to be defined for and called on most unblessed variables. This means you can call methods on ordinary strings, lists and hashes! It also means perl5i can add a lot of functionality without polluting the global namespace. L wraps a lot of Perl's built in functions so they can be called as methods on unblessed variables. C<< @a->pop >> for example. =head3 alias $scalar_reference->alias( @identifiers ); @alias->alias( @identifiers ); %hash->alias( @identifiers ); (\&code)->alias( @identifiers ); Aliases a variable to a new global name. my $code = sub { 42 }; $code->alias( "foo" ); say foo(); # prints 42 It will work on everything except scalar references. our %stuff; %other_hash->alias( "stuff" ); # %stuff now aliased to %other_hash It is not a copy, changes to one will change the other. my %things = (foo => 23); our %stuff; %things->alias( "stuff" ); # alias %things to %stuff $stuff{foo} = 42; # change %stuff say $things{foo}; # and it will show up in %things Multiple @identifiers will be joined with '::' and used as the fully qualified name for the alias. my $class = "Some::Class"; my $name = "foo"; sub { 99 }->alias( $class, $name ); say Some::Class->foo; # prints 99 If there is just one @identifier and it has no "::" in it, the current caller will be prepended. C<< $thing->alias("name") >> is shorthand for C<< $thing->alias(CLASS, "name") >> Due to limitations in autobox, non-reference scalars cannot be aliased. Alias a scalar ref instead. my $thing = 23; $thing->alias("foo"); # error my $thing = \23; $thing->alias("foo"); # $foo is now aliased to $thing This is basically a nicer way to say: no strict 'refs'; *{$package . '::'. $name} = $reference; =head2 Scalar Autoboxing All of the methods provided by L are available from perl5i. in addition, perl5i adds some methods of its own. =head3 path my $object = $path->path; Creates a L $object for the given file or directory $path. my $path = "/foo/bar/baz.txt"->path; my $content = $path->slurp; =head3 center my $centered_string = $string->center($length); my $centered_string = $string->center($length, $character); Centers $string between $character. $centered_string will be of length $length. C<$character> defaults to " ". say "Hello"->center(10); # " Hello "; say "Hello"->center(10, '-'); # "---Hello--"; C will never truncate C<$string>. If $length is less than C<< $string->length >> it will just return C<$string>. say "Hello"->center(4); # "Hello"; =head3 round my $rounded_number = $number->round; Round to the nearest integer. =head3 round_up =head3 ceil my $new_number = $number->round_up; Rounds the $number towards infinity. 2.45->round_up; # 3 (-2.45)->round_up; # -2 ceil() is a synonym for round_up(). =head3 round_down =head3 floor my $new_number = $number->round_down; Rounds the $number towards negative infinity. 2.45->round_down; # 2 (-2.45)->round_down; # -3 floor() is a synonyn for round_down(). =head3 is_number $is_a_number = $thing->is_number; Returns true if $thing is a number understood by Perl. 12.34->is_number; # true "12.34"->is_number; # also true "eleven"->is_number; # false =head3 is_positive $is_positive = $thing->is_positive; Returns true if $thing is a positive number. 0 is not positive. =head3 is_negative $is_negative = $thing->is_negative; Returns true if $thing is a negative number. 0 is not negative. =head3 is_even $is_even = $thing->is_even; Returns true if $thing is an even integer. =head3 is_odd $is_odd = $thing->is_odd; Returns true if $thing is an odd integer. =head3 is_integer $is_an_integer = $thing->is_integer; Returns true if $thing is an integer. 12->is_integer; # true 12.34->is_integer; # false "eleven"->is_integer; # false =head3 is_int A synonym for is_integer =head3 is_decimal $is_a_decimal_number = $thing->is_decimal; Returns true if $thing is a decimal number. 12->is_decimal; # false 12.34->is_decimal; # true ".34"->is_decimal; # true "point five"->is_decimal; # false =head3 require my $module = $module->require; Will C the given $module. This avoids funny things like C. It accepts only module names. On failure it will throw an exception, just like C. On a success it returns the $module. This is mostly useful so that you can immediately call $module's C method to emulate a C. # like "use $module qw(foo bar);" if that worked $module->require->import(qw(foo bar)); # like "use $module;" if that worked $module->require->import; =head3 wrap my $wrapped = $string->wrap( width => $cols, separator => $sep ); Wraps $string to width $cols, breaking lines at word boundries using separator $sep. If no width is given, $cols defaults to 76. Default line separator is the newline character "\n". See L for details. =head3 ltrim =head3 rtrim =head3 trim my $trimmed = $string->trim; my $trimmed = $string->trim($character_set); Trim whitespace. ltrim() trims off the start of the string (left), rtrim() off the end (right) and trim() off both the start and end. my $string = ' testme'->ltrim; # 'testme' my $string = 'testme '->rtrim; # 'testme' my $string = ' testme '->trim; # 'testme' They all take an optional $character_set which will determine what characters should be trimmed. It follows regex character set syntax so C will trim everything from A to Z. Defaults to C<\s>, whitespace. my $string = '-> test <-'->trim('-><'); # ' test ' =head3 title_case my $name = 'joe smith'->title_case; # Joe Smith Will uppercase every word character that follows a wordbreak character. =head3 path2module my $module = $path->path2module; Given a relative $path it will return the Perl module this represents. For example, "Foo/Bar.pm"->path2module; # "Foo::Bar" It will throw an exception if given something which could not be a path to a Perl module. =head3 module2path my $path = $module->module2path; Will return the relative $path in which the Perl $module can be found. For example, "Foo::Bar"->module2path; # "Foo/Bar.pm" =head3 is_module_name my $is_valid = $string->is_module_name; Will return true if the $string is a valid module name. "Foo::Bar"->is_module_name; # true "Foo/Bar"->is_module_name; # false =head3 group_digits my $number_grouped = $number->group_digits; my $number_grouped = $number->group_digits(\%options); Turns a number like 1234567 into a string like 1,234,567 known as "digit grouping". It honors your current locale to determine the separator and grouping. This can be overridden using C<%options>. NOTE: many systems do not have their numeric locales set properly =over 4 =item separator The character used to separate groups. Defaults to "thousands_sep" in your locale or "," if your locale doesn't specify. =item decimal_point The decimal point character. Defaults to "decimal_point" in your locale or "." if your locale does not specify. =item grouping How many numbers in a group? Defaults to "grouping" in your locale or 3 if your locale doesn't specify. Note: we don't honor the full grouping locale, its a wee bit too complicated. =item currency If true, it will treat the number as currency and use the monetary locale settings. "mon_thousands_sep" instead of "thousands_sep" and "mon_grouping" instead of "grouping". =back 1234->group_digits; # 1,234 (assuming US locale) 1234->group_digits( separator => "." ); # 1.234 =head3 commify my $number_grouped = $number->commify; my $number_grouped = $number->commify(\%options); commify() is just like group_digits() but it is not locale aware. It is useful when you want a predictable result regardless of the user's locale settings. C<%options> defaults to C<< ( separator => ",", grouping => 3, decimal_point => "." ) >>. Each key will be overridden individually. 1234->commify; # 1,234 1234->commify({ separator => "." }); # 1.234 =head3 reverse my $reverse = $string->reverse; Reverses a $string. Unlike Perl's reverse(), this always reverses the string regardless of context. =head2 Array Autoboxing The methods provided by L are available from perl5i. All the functions from L and select ones from L are all available as methods on unblessed arrays and array refs: first, max, maxstr, min, minstr, minmax, shuffle, reduce, sum, any, all, none, true, false, uniq and mesh. They have all been altered to return array refs where applicable in order to allow chaining. @array->grep(sub{ $_->is_number })->sum->say; =head3 foreach @array->foreach( func($item) { ... } ); Works like the built in C, calls the code block for each element of @array passing it into the block. @array->foreach( func($item) { say $item } ); # print each item It will pass in as many elements as the code block accepts. This allows you to iterate through an array 2 at a time, or 3 or 4 or whatever. my @names = ("Joe", "Smith", "Jim", "Dandy", "Jane", "Lane"); @names->foreach( func($fname, $lname) { say "Person: $fname $lname"; }); A normal subroutine with no signature will get one at a time. If @array is not a multiple of the iteration (for example, @array has 5 elements and you ask 2 at a time) the behavior is currently undefined. =head3 as_hash my %hash = @array->as_hash; This method returns a %hash where each element of @array is a key. The values are all true. Its functionality is similar to: my %hash = map { $_ => 1 } @array; Example usage: my @array = ("a", "b", "c"); my %hash = @array->as_hash; say q[@array contains 'a'] if $hash{"a"}; =head3 pick my @rand = @array->pick($number); The pick() method returns a list of $number elements in @array. If $number is larger than the size of the list, it returns the entire list shuffled. Example usage: my @array = (1, 2, 3, 4); my @rand = @array->pick(2); =head3 pick_one my $rand = @array->pick_one; The pick_one() method returns a random element in @array. It is similar to @array->pick(1), except that it does not return a list. Example usage: my @array = (1,2,3,4); my $rand = @array->pick_one; =head3 diff Calculate the difference between two (or more) arrays: my @a = ( 1, 2, 3 ); my @b = ( 3, 4, 5 ); my @diff_a = @a->diff(\@b) # [ 1, 2 ] my @diff_b = @b->diff(\@a) # [ 4, 5 ] Diff returns all elements in array C<@a> that are not present in array C<@b>. Item order is not considered: two identical elements in both arrays will be recognized as such disregarding their index. [ qw( foo bar ) ]->diff( [ qw( bar foo ) ] ) # empty, they are equal For comparing more than two arrays: @a->diff(\@b, \@c, ... ) All comparisons are against the base array (C<@a> in this example). The result will be composed of all those elements that were present in C<@a> and in none other. It also works with nested data structures; it will traverse them depth-first to assess whether they are identical or not. For instance: [ [ 'foo ' ], { bar => 1 } ]->diff([ 'foo' ]) # [ { bar => 1 } ] In the case of overloaded objects (i.e., L, L, L, etc.), it tries its best to treat them as strings or numbers. my $uri = URI->new("http://www.perl.com"); my $uri2 = URI->new("http://www.perl.com"); [ $uri ]->diff( [ "http://www.perl.com" ] ); # empty, they are equal [ $uri ]->diff( [ $uri2 ] ); # empty, they are equal =head3 popn my @newarray = @array->popn($n); L C<$n> values from the C<@array>. If C<$n> is greater than the length of C<@array>, it will return the whole C<@array>. If C<$n> is 0, it will return an empty array. A negative C<$n> or non-integer is an error. my @array = (1, 2, 3, 4, 5); my @newarray = @array->popn(3); # (3, 4, 5) =head3 shiftn my @newarray = @array->shiftn($n); Works like L, but it L off the front of the array instead of popping off the end. my @array = (1, 2, 3, 4, 5); my @newarray = @array->shiftn(3); # (1, 2, 3) =head3 intersect my @a = (1 .. 10); my @b = (5 .. 15); my @intersection = @a->intersect(\@b) # [ 5 .. 10 ]; Performs intersection between arrays, returning those elements that are present in all of the argument arrays simultaneously. As with C, it works with any number of arrays, nested data structures of arbitrary depth, and handles overloaded objects graciously. =head3 ltrim =head3 rtrim =head3 trim my @trimmed = @list->trim; my @trimmed = @list->trim($character_set); Trim whitespace from each element of an array. Each works just like their scalar counterpart. my @trimmed = [ ' foo', 'bar ' ]->ltrim; # [ 'foo', 'bar ' ] my @trimmed = [ ' foo', 'bar ' ]->rtrim; # [ ' foo', 'bar' ] my @trimmed = [ ' foo', 'bar ' ]->trim; # [ 'foo', 'bar' ] As with the scalar trim() methods, they all take an optional $character_set which will determine what characters should be trimmed. my @trimmed = ['-> foo <-', '-> bar <-']->trim('-><'); # [' foo ', ' bar '] =head2 Hash Autoboxing All of the methods provided by L are available from perl5i. In addition... =head3 each Iterate through each key/value pair in a hash using a callback. my %things = ( foo => 23, bar => 42 ); %things->each( func($k, $v) { say "Key: $k, Value: $v" }); Unlike the C function, individual calls to each are guaranteed to iterate through the entirety of the hash. =head3 flip Exchanges values for keys in a hash. my %things = ( foo => 1, bar => 2, baz => 5 ); my %flipped = %things->flip; # { 1 => foo, 2 => bar, 5 => baz } If there is more than one occurence of a certain value, any one of the keys may end up as the value. This is because of the random ordering of hash keys. # Could be { 1 => foo }, { 1 => bar }, or { 1 => baz } { foo => 1, bar => 1, baz => 1 }->flip; Because hash references cannot usefully be keys, it will not work on nested hashes. { foo => [ 'bar', 'baz' ] }->flip; # dies =head3 merge Recursively merge two or more hashes together using L. my $a = { a => 1 }; my $b = { b => 2, c => 3 }; $a->merge($b); # { a => 1, b => 2, c => 3 } For conflicting keys, rightmost precedence is used: my $a = { a => 1 }; my $b = { a => 100, b => 2}; $a->merge($b); # { a => 100, b => 2 } $b->merge($a); # { a => 1, b => 2 } It also works with nested hashes, although it won't attempt to merge array references or objects. For more information, look at the L docs. =head3 diff my %staff = ( bob => 42, martha => 35, timmy => 23 ); my %promoted = ( timmy => 23 ); %staff->diff(\%promoted); # { bob => 42, martha => 35 } Returns the key/value pairs present in the first hash that are not present in the subsequent hash arguments. Otherwise works as C<< @array->diff >>. =head3 intersect %staff->intersect(\%promoted); # { timmy => 23 } Returns the key/value pairs that are present simultaneously in all the hash arguments. Otherwise works as C<< @array->intersect >>. =head2 Code autoboxing =head3 signature my $sig = $code->signature; You can query the signature of any code reference defined with C or C. See L for details. If C<$code> has a signature, returns an object representing C<$code>'s signature. See L for details. Otherwise it returns nothing. =head3 caller L causes C to return an object in scalar context. =head3 die C now always returns an exit code of 255 instead of trying to use C<$!> or C<$?> which makes the exit code unpredictable. If you want to exit with a message and a special exit code, use C then C. =head3 list C will force list context similar to how L will force scalar context. =head2 utf8::all perl5i turns on L which turns on all the Unicode features of Perl it can. Here is the current list, more may be turned on later. Bare strings in your source code are now UTF8. This means UTF8 variable and method names, strings and regexes. my $message = "انا لا اتكلم العربيه"; my $τάδε = "It's all Greek to me!"; sub fünkßhüñ { ... } Strings will be treated as a set of characters rather than a set of bytes. For example, C will return the number of characters, not the number of bytes. length("perl5i is MËTÁŁ"); # 15, not 18 C<@ARGV> will be read as UTF8. STDOUT, STDIN, STDERR and all newly opened filehandles will have UTF8 encoding turned on. Consequently, if you want to output raw bytes to a file, such as outputting an image, you must set C<< binmode $fh >>. =head3 capture my($stdout, $stderr) = capture { ... } %options; my $stdout = capture { ... } %options; C lets you capture all output to C and C in any block of code. # $out = "Hello" # $err = "Bye" my($out, $err) = capture { print "Hello"; print STDERR "Bye"; }; If called in scalar context, it will only return C and silence C. # $out = "Hello" my $out = capture { print "Hello"; warn "oh god"; }; C takes some options. =over 4 =item B tee will cause output to be captured yet still printed. my $out = capture { print "Hi" } tee => 1; =item B merge will merge C and C into one variable. # $out = "HiBye" my $out = capture { print "Hi"; print STDERR "Bye"; } merge => 1; =back =head2 Carp C and C from L are always available. The Carp message will always format consistently, smoothing over the backwards incompatible change in Carp 1.25. =head2 Child L provides the C function which is a better way to do forking. C creates and starts a child process, and returns an L object which is a better interface for managing the child process. The only required argument is a codeblock, which is called in the new process. exit() is automatically called for you after the codeblock returns. my $proc = child { my $parent = shift; ... }; You can also request a pipe for IPC: my $proc = child { my $parent = shift; $parent->say("Message"); my $reply = $parent->read(); ... } pipe => 1; my $message = $proc->read(); $proc->say("reply"); See L for more information. =head2 English L gives English names to the punctuation variables; for instance, C<<$@>> is also C<<$EVAL_ERROR>>. See L for details. It does B load the regex variables which affect performance. C<$PREMATCH>, C<$MATCH>, and C<$POSTMATCH> will not exist. See the C

modifier in L for a better alternative. =head2 Modern::Perl L turns on strict and warnings, enables all the 5.10 features like C, C and C, and enables C3 method resolution order. =head2 CLASS Provides C and C<$CLASS> alternatives to C<__PACKAGE__>. =head2 File::chdir L gives you C<$CWD> representing the current working directory and it's assignable to C. You can also localize it to safely chdir inside a scope. =head2 File::stat L causes C to return an object in scalar context. =head2 DateTime C