Code Monkey home page Code Monkey logo

perl5i's Issues

Use Alias

Instead of

no strict 'refs';
*{$package .'::'. $name} = sub { ... };

write

alias( $package .'::'. $name, sub { ... } );

wrap()

Wrap to X columns. use Text::Wrap

List::MoreUtils

Though some of the method names could use some work. Like natatime().

uniq, zip, any, all, none, true, false are all nice.

Add perl5i command for Windows

The bin/perl5i.PL script currently generates a *nix sell script that invokes perl with perl5i niceties. Something similar is needed for Windows, likely using a .bat file or something. Schwern mentioned pl2bat from Module::Build as a possible solution.

local::lib?

Somehow integrate local::lib to solve the problem of locally installed modules

workaround the local @CWD bug

It might be a good idea to have a source filter to change

local @CWD;

into

local $CWD;

or at least throw a warning.

cpani

An improved configuration for the CPAN shell. It will ask one question "do you want to install for yourself or for the whole system" and then configure everything for you. Then it will ask "do you want detailed configuration?" with a default of "no". That's it. You will have a working, configured CPAN shell.

super()

A replacement for $self->SUPER::method(@Args) would be $self->super(@Args);

Include Time::y2038

Time::y2038 doesn't play nice with Time::Piece. They both want to override localtime and gmtime. Worse, Time::Piece will use CORE::localtime and CORE::gmtime so it won't see Time::y2038.

gmtime() and localtime() crap out around y5872869

And they don't warn!

$ time perl -wle 'use perl5i; print scalar gmtime 248-246-245+244-243+242-241-240'
Mon Jan 3 06:09:04 -5868930

$ time perl -wle 'use perl5i; print scalar gmtime 248-246-245+244-243+242-241-240-2**39'
Sat Dec 28 17:50:56 5872869

Something to make reading and writing files easier.

File::Slurp is the obvious candidate. I also like that it can write_file() in one go.

Perl6::Slurp is far more complete, but it doesn't write files, its way more complicated and its scary, old, unmaintained Damian-ware. Perhaps the solution is to enhance File::Slurp with Perl6::Slurp features.

Finally, a solution to the "how do I insert a line in the middle of a file" would be nice. That can be served by the excellent and efficient Tie::File but with a sprinkling of sugar so the user isn't exposed to a tie() call. They just get an array (or array ref or object acting like an array ref).

More useful file commands

touch

recursive rm

mv and cp allowing multiple source files to a directory

mkdir -p

Crib from ExtUtils::Command and Shell::Command.

MooseX::Declare

MooseX::Declare is sexy. It also solves the problem of Moose load time since it can lazy load when class() is called.

Regexp::Common?

Might it be handy to load that? Maybe make %RE load Regexp::Common on demand.

Make it lexicaler

Much of perl5i is not lexical. Muck with %^H to make it so. Tests in t/lexical.t

Fix File::stat to be compatible in array context

File::stat will cause stat() to always return an object. It should be trivial to make it return the traditional list of stuff in array context, or to overload the object. This will make it backwards compatible.

Localized chdir()

Something to make changing directory lexical.

File::chdir? File::pushd?

Autoload as much as possible

This thing is going to get pretty fat pretty fast. It would be nice if it delayed loading of modules for as long as possible.

Things like File::stat and Time::Piece that only export a handful of functions can be wrapped in autoloading functions. Just benchmark before hand to see if it helps load time to actually remove them. A lot of the cost of loading a module in isolation is actually loading very common modules (strict, Exporter, base...) which will be loaded anyway.

Objects and references in hash keys

Jesse Wolfe is annoyed that he can't put objects/references in hash keys. I don't know if there's a way to do this without patching core, but it sure would be nice

flat

force anything in to list context

eq_or_diff( [flat([[{this =>{is => [qw{a test}]}}])], [qw{this is a test}] )

More scalar utilities

trim (strip whitespace), ltrim, rtrim
is a number
is an integer, decimal... all the stuff from perlfaq4

is a regex

is an object/instance
is a reference

gmtime() and localtime() crap out around y5872869

And they don't warn!

$ time perl -wle 'use perl5i; print scalar gmtime 2**48-2**46-2**45+2**44-2**43+2**42-2**41-2**40'
Mon Jan 3 06:09:04 -5868930

$ time perl -wle 'use perl5i; print scalar gmtime 2**48-2**46-2**45+2**44-2**43+2**42-2**41-2**40-2**39'
Sat Dec 28 17:50:56 5872869

People seem to always want a trim function

One pain I have seen people have is the lack of a trim function. I have seen numerous CompanyName::Util modules with weird/bad/ugly trim functions. The problem with trim though is its lack of definition: should it trim on the left, on the right, or both; should it trim spaces, whitespace, or custom character classe; should it modify the string or return a copy; etc. Normally the right answer (in my opinion) is to use a substitution written for that specific case, but people seem resistant to that (and they do have some good arguments). I think we should provide a scalar trim method with the following arguments:

is "\tfoo  "->trim, "foo", "default removes whitespace on both sides, does not modify string";
is "\tfoo  "->trim(" "), "\tfoo", "sinlge arg is character to remove";
is "\tfoo  "->trim("[f \t]"), "oo", "single arg can be a character class";
is "\tfoo  "->trim('\s'), "foo", "sinlge arg can be a shorthand character class";
is "\tfoo  "->trim(left => '\s'), "foo  ", "multiple args are a named paramters, in this case trim on the left";
is "\tfoo  "->ltrim, "foo  ", "trim on the left (TIMTOWTDI);
not_ok eval { "\tfoo  "->ltrim(right => '\s'); 1 }, "left trim croaks if asked to trim on the right";
is $@, "probable misuse of ltrim", "ltrim croaks with this error message";
not_ok eval { "\tfoo  "->trim(both => '\s'); 1 }, "left trim croaks if asked to trim both";
is $@, "probable misuse of ltrim", "ltrim croaks with this error message";
is "\tfoo  "->trim(right => '\s'), "\tfoo", "trim on the right";
is "\tfoo  "->rtrim, "\tfoo", "trim on the right ("TIMTOWTDI");
not_ok eval { "\tfoo  "->rtrim(left => '\s'); 1 }, "right trim croaks if asked to trim on the left";
is $@, "probable misuse of rtrim", "rtrim croaks with this error message";
not_ok eval { "\tfoo  "->trim(both => '\s'); 1 }, "right trim croaks if asked to trim both";
is $@, "probable misuse of ltrim", "rtrim croaks with this error message";
is "\tfoo  "->trim(both => '\s'), "foo", "trim on both";
is "\tfoo  "->trim(left => '\s', right => '\s'), "foo", "trim on both (TIMTOWTDI)";
my $foo = "\tfoo  ";
is $foo->(inplace => 'true'), "foo", "if left, right, or both is not set default to both";
is $foo, "foo", "inplace attempts to change the scalar";
not_ok eval { "\tfoo  "->trim(inplace => 1); 1 }, "inplace croaks if it can't modify the string";
ok $@ =~ qr/trim could not modify scalar/, "it croaks with this error message";

alias lexicals

alias my $foo => \$bar; would be spiffy. Data::Alias would do that, but its kinda broken on bleadperl.

A foreach iterator for hashes / tuples / pairs

Instead of

for my $key (keys %hash) {
    my $value = $hash{$key};
    ....
}

I want
for my($key, $value) (%hash) {
...
}

Or something. Also working for pairs in lists. Extend it out to work for any number of elements.

Include DateTime. Junk Time::Piece.

Use DateTime instead of Time::Piece. Write gmtime() and localtime() to return DateTime objects which stringify to emulate ctime. This may eliminate the need for Time::y2038.

Integrate mylib?

Would it be helpful to automatically use mylib to have an absolute path to /path/which/contains/program/lib ?

Dependencies missing

I don't know if this is a bug in perl5i or the modules it uses, but I needed to install the following modules to get the tests to pass (even though perl Build.PL said everything was okay):

Time-Piece.t - IPC::System::Simple
Module-Load.t - Text::ParseWords
modern-perl.t - Array::Compare

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.