Le 16/05/2017 à 13:11, sisyph...@optusnet.com.au a écrit :
Le 15/05/2017 à 16:30, sisyph...@optusnet.com.au a écrit :
Unfortunately, I don't know how to get that binmode() into the
one-liner's angle brackets :-(

$ PERLIO=unix perl -MDigest::SHA1=sha1_hex -le "print sha1_hex <>"

Yes, I think that should give the OP the result he was seeking.

Heh ... I didn't realize (until after I had posted) that this was a bash
shell solution.

Yes, the intent was only to draw attention to the PERLIO environment variable as a possible alternative to binmode, not to offer a complete solution.

OTOH this was actually run on windows using Strawberry perl from a cygwin bash shell. That has been my standard setup on windows for more years than I care to count. Given that you can setup a decent portable environment including cygwin, ntemacs (with cygwin bash as shell and tramp via putty for remote anything), strawberry perl(s), and your own minicpan/darkpan, all on a USB key, that works on any windows from 2000 to win10, I have seen no need to come close to CMD for quite some time :-)

BTW, the :crlf layer is hopelessly broken on windows (can't seek reliably) so be sure to binmode any file you need to navigate with anything other than the angle brackets.

The PERLIO variable has also been a lifesaver on some instance where CPAN heroes, saintly as they are, could not find it in their heart to test their modules updates on a windows box. If you ever tried to e.g. install dzil in its early days you will know :-) In such cases it actually makes sense to setup a whole environment with a nonstandard setting of PERLIO. YMMV.

Hmmm. I should probably note that because of compatibility issues between cygwin and ntemacs (if you want to run the cygwin bash as your emacs shell), I run a very old version of cygwin, probably older than 2009 (its perl at the time was 5.10 I believe). Its bash and make are sufficient for my need, and I have no trouble using various instances of strawberry perl with it. No doubt others will have different standards so take the above with a pinch of salt.



Reply via email to