in reply to Re^2: pl – Perl One-Liner Magic Wand: looking for feedback
in thread pl – Perl One-Liner Magic Wand: looking for feedback

Thanks for the tip! It's fixed.
  • Comment on Re^3: pl – Perl One-Liner Magic Wand: looking for feedback

Replies are listed 'Best First'.
Re^4: pl – Perl One-Liner Magic Wand -- failing tests
by Discipulus (Canon) on Jun 16, 2022 at 11:27 UTC
    Hello DanielPfeiffer,

    I'm mad for oneliners.. :) so I'd like to investigate this, but I have some test failed (strawberry perl portable)

    The only thing I find atm is a SO post where #!perl -W seems guilty and you have use warnings 'all'; in all your tests.

    HtH

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      It's not the berries, because in the mean time cpantesters have reported success for 6 different Windows versions, all Strawberry.

      Something in yours is loading this non-standard variant of Config, where I don't even see why it would load Config at all. I have modified the failing test a bit: sub i tracks the modifications of %INC, using keydiff. Could you please run

      pl "$I = -1; sub i { ++$I; k $_, $INC{$_} for keys %INC } i; require Time::HiRes; i; for( @A, [$A[0], 123456] ) { E Isodate( $_, 0 ), I( 0.0, $_ ), I( $_, \"+0\" ), I( $_, 1 ), D( $_, -80, \"+90\", \"-9.5\" ), \"\"; Date \"08:45\", $_ } i" 123456789

      For me it records only a single change, the module I explicitly require. (Isodate would too, but I wanted to see it in isolation.) If you want more fun, what E would do for echoing refs, you can add this before the end quote: ; require Data::Dumper; i

      So much for maybe understanding. For the solution, I guess I'll have to drop my overzealous warnings (which I now realize, aren't complete anyway). Can you please remove '-W', from @cmd on line t/test.pm:51? Then please run perl t/unit.t

        Hello Daniel Pfeiffer,

        I hope the following will help

        cpan> look App::pl Working directory is R:\emoved\path\perl5.26.64bit\cpan\build\App-pl-0 +.90.2-1 Microsoft Windows [Versione 10.0.19044.1706] (c) Microsoft Corporation. Tutti i diritti sono riservati. C> cd t C>perl -lne "print if $. == 51" test.pm my @cmd = ($^X, $ENV{PLALT} // '../pl', @_); # +was: ($^X, '-W', $ENV{PLALT} // '../pl', @_) C>perl unit.t 1..8 ok 1 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "for( @A, [$A[0], 12 +3456] ) { E Isodate( $_, 0 ), I( 0.0, $_ ), I( $_, \"+0\" ), I( $_, 1 + ), D( $_, -80, \"+90\", \"-9.5\" ), \"\"; Date \"08:45\", $_ }" "123 +456789" "123456789.0" "123456789.1" "123456789.000001" "123456789.123 +456789" ok 2 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "$RESULT = \"$Q${quo +te}abc$q$Quote\"" ok 3 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "%R = qw(a 1 b 2 c 1 + d 3)" ok 4 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "%NUMBER = qw(a 1 b +2 c 1 d 3)" ok 5 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "-ENumber" "%N = qw( +a 1 b 2 c 1 d 3)" ok 6 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "-E" "N 3" "%N = qw( +a 1 b 2 c 1 d 3)" ok 7 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "form $_ = q!a%%b %% +1$d %x:%1$o %1$*1$b %%%1$X!, 27; tr/$/:/; F $_, 27" ok 8 - "perl5.26.64bit\perl\bin\perl.exe" "../pl" "-Mbignum" "Echo 123 +456789012345678901234567890 * 123456789012345678901234567890"

        L*

        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

        The Portable::Config error could be a red herring. The portable versions of Strawberry perl load Config and update its contents so the various paths are updated when code is run.

      Wow, they load a module that's not warning safe :~( I'd just switched to ActivePerl to get 5.36, which is fine. I guess I'll tweak it so that I distribute with lesser warnings than I test myself.
Re^4: pl – Perl One-Liner Magic Wand: looking for feedback
by Arunbear (Prior) on Jun 16, 2022 at 10:52 UTC
    Have you tested what happens when installing it with cpanm (or just cpan)? It's still not installing anything (I'm using a Mac).

      I'm sorry, I don't know how I can help you. I just installed cpanm 1.7044 as a Devuan package (Debian derived Linux) and it installs pl fine with -l /some/dir. (It does create various useless x86_64-linux-gnu-thread-multi subdirs, but that may be their problem and only cosmetic.) I can however confirm that reinstalling does overwrite the script – annoying but again not the end of the world.

      Maybe you can find a similarly minimal package as pl is, for you and me to compare? Cpanm is quite the opposite, having so many dependencies.

      Or you could open an issue against cpanm, saying that it works on Linux, but not Mac. If you add the output you get from cpanm -v App::pl, they'll probably know right away what's wrong. Or they might have access to a Mac, to find out…

        Thank you. This did in fact install with cpanm after your update, I thought it hadn't worked because repeating the install command re-installed it. A similar package to compare with might be Ack.

        In other news, there is already an installed program called pl:

        $ man pl NAME pl – ASCII property list utility SYNOPSIS pl [--input file] [--output file] DESCRIPTION pl can be used to check the syntax of old-style ASCII property li +st files. ...
        I'm not sure what the best practice is for dealing with name clashes like this. Perhaps giving it a non-clashing name and leaving it up to the user to make a shorter alias ...
      cpan on linux now works fine. Will have to check why cpanm does something different.