Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

User Posts

( #1135479=superdoc: print w/replies, xml ) Need Help??
Posts by Anonymous Monk
TPF PERL Swag in Meditations
1 direct reply — Read more / Contribute
by Anonymous Monk
on Jan 09, 2023 at 02:42
    I want some swag from The Perl Foundation but the graphics...

    1. They spelled it: PERL
    2. Raptors are extinct.
    3. Raw onions? C'mon!

    I want cool cryptic, like Perl itself:


    Front Back
    #!/usr/bin/perl exit;
    BEGIN{} END{}
    <DATA> __DATA__
    use Perl; $?
    $@% ...
    $_ @_

    Obviously: camel code

Perl::Dist::APPerl - Actually Portable Perl in Perl News
4 direct replies — Read more / Contribute
by Anonymous Monk
on Jan 06, 2023 at 07:34
    "Actually Portable Perl (APPerl) is a distribution of Perl that runs on several x86_64 operating systems (most Unix-like and Windows) via the same binary. It builds to a single binary with perl modules packed inside of it. Cross-platform, single binary, standalone Perl applications can be made by building custom versions of APPerl, with and without compiling Perl from scratch"

  • Perl::Dist::APPerl
Double the speed of Imager->setpixel in Meditations
3 direct replies — Read more / Contribute
by Anonymous Monk
on Dec 11, 2022 at 16:49
    My app was taking 5 seconds to generate an image involving about a million calls to Imager->setpixel and this felt way too slow. NYTProf revealed the cause to be expensive sanity checking in at lines 3456 and 3465. Commenting those lines gets me down to 3 seconds and this now feels much less slow:
    sub setpixel { my ($self, %opts) = @_; # $self->_valid_image("setpixel") or return; my $color = $opts{color}; unless (defined $color) { $color = $self->{fg}; defined $color or $color = NC(255, 255, 255); } # unless (ref $color && UNIVERSAL::isa($color, "Imager::Color")) { # unless ($color = _color($color, 'setpixel')) { # $self->_set_error("setpixel: " . Imager->errstr); # return; # } # } unless (exists $opts{'x'} && exists $opts{'y'}) { $self->_set_error('setpixel: missing x or y parameter'); return; } ... } sub _valid_image { my ($self, $method) = @_; ref $self or return Imager->_set_error("$method needs an image object"); $self->{IMG} && Scalar::Util::blessed($self->{IMG}) and return 1; my $msg = $self->{IMG} ? "images do not cross threads" : "empty inpu +t image"; $msg = "$method: $msg" if $method; $self->_set_error($msg); return; }
    Should the next version of Imager have an option to disable global sanity so it can operate almost twice the usual speed?
The new black metacpan (meta::cpan throws away brand) in Meditations
1 direct reply — Read more / Contribute
by Anonymous Monk
on Sep 30, 2022 at 06:15
the distribution is barmy in Meditations
1 direct reply — Read more / Contribute
by Anonymous Monk
on May 21, 2021 at 09:36
    put back the commented away 63 71 and 75 and it looks as we expect(?) - a file of random numbers from the physics wizards is referenced too - put in 27 remove 28
    use strict; use warnings; use List::Util qw(max sample); #use lib '/usr/local/share/perl/5.30.0'; #use Statistics::Basic::Stddev; #installs somewhere?? #use Statistics::Basic::StdDev; use Statistics::Basic qw(:all); use File::Slurp; #for large list of real randoms my @rands = read_file('../stats/bytes37Mb.txt'); my ($fertilewomen) = @ARGV; my @maxxes; my $cyclelength = 32; #my $duration = int(rand(1) + 0.5) == 1 ? 4 : 5; #my $duration = sample 1, (4, 5); $fertilewomen ||= 48; #print "duration is $duration\n"; #my @women; #for (1..100) { my @women; # for (1..48) { for (1..$fertilewomen) { # my $start = int(rand(31) + 0.5); # my $start = int(rand($cyclelength-1) + 0.5); # my $start = int(rand($cyclelength)); my $start = getrandom($_); # print "$start\n"; # my $range; # my $turnover = $cyclelength - $duration; # if ($start > 28) { # if ($start > $turnover) { # if ($start == 29) { # if ($start == $turnover+1) { # $range = [$start, $start+1, $start+2, 0]; # } elsif ($start == 30) { # } elsif ($start == $turnover+2) { # $range = [$start, $start+1, 0, 1]; # } else { # $range = [$start, 0, 1, 2]; # } # } else { # $range = [$start..$start+3]; # } # push @women, $range; # my $duration = sample 1, (4, 5); my $duration = 4; push @women, $start..($start+$duration-1); } my %count; my %mcount; for my $woman (@women) { # my @range = @{$woman}; # for (@range) { # my $moduluscyclelength = $_ % $cyclelength; my $moduluscyclelength = ($woman % $cyclelength); #print $moduluscyclelength, ' ', $woman, ' ', $cyclelength, "\n"; # $count{$_}++; $mcount{$moduluscyclelength}++; # $count{$woman}++; # } } my %occupancy; # for (0..31) { for (0..$cyclelength-1) { # my $value = exists $count{$_} ? $count{$_} : 0; my $mvalue = exists $mcount{$_} ? $mcount{$_} : 0; # $occupancy{$_} = $value; print "$_ $mvalue\n"; # print "$_ $value $mvalue\n"; } # print 'mean is ', mean(values %count), "\n"; # print 'sd is ', stddev(values %count), "\n"; # my %ostats; # for (values %occupancy) { # $ostats{$_}++; # } # for (sort { $a <=> $b } keys %ostats) { ## print $_, ' ', $ostats{$_}, "\n"; # } # push @maxxes, max(keys %ostats); #} #print join ' ', sort { $a <=> $b } @maxxes; sub getrandom { my $index = shift; my $byte = $rands[$index]; chomp $byte; return int($byte/8); }
When Perl saved the day (and Python couldn't) in Meditations
3 direct replies — Read more / Contribute
by Anonymous Monk
on Aug 28, 2020 at 15:59

    Yes, I know this is not a place to rant, nor is this place to talk bad about other languages, but heck, I am going to rant anyways....

    So I started my scripting journey (short and irregular) with Perl. It enabled me to write scripts pretty fast with least knowledge of the language in particular and programming in general. Job requirements made me take a long break from Perl and Scripting. I started learning Python, not because I had to write scripts, but to "check mark" a training requirement. It's a good language, nothing against it. I was happy on the learning journey, until a requirement came up to automate some alerts and that is when my troubles started.

    The client for which I was to do the automation has strict internet access policies, so no access to the internet from the servers used for environment management. Also, no admin access. I had promised to automate some stuff (my bad, I should have first checked the requirements). Python would not install, not even within the directories for my account. I was at wit's end. I tried downloading again thinking may be the file got corrupted, but same result. My colleague managed to install it for his servers (different client) but kept getting errors while trying to send out emails. So we both were kind of upset and pissed off.

    And then I remembered, Strawberry Perl. Downloaded it, pushed the installer to the servers (Yes, I again had to raise a request for that as well, and no they would not allow any special permissions). To my amazement, it installed without any errors!!. And every conceivable module I wanted was there!!

    This was two days ago...just now finished writing the scripts, sent a test email to myself, then sent it to the required DL Email. Informed my manager and the concerned client folks and they were all happy!!

    Now for my colleague, he too installed the same, I helped him out with the scripts, and I dunnowhathappened, but the emails just worked with Perl. Yeah this sounds stupid, but it didnt work with Python, but , it worked with Perl!!

    Also I found that, for Perl, there are two kind of Email Modules, Ones that "create"/"format" Email and the others you use to "send" emails. Some modules may have both, and I could be wrong, but what I really liked is the modularity given here.

    May be I did something wrong while trying to install Python, may be not, I am not sure. May be I was stupid. But, end of the day, it was Perl that saved the day.

    So thank you Perl, Thank you Perl Developers and especially Strawberry Perl Team for saving the day.

    Rant Over.

IntraMine service suite in Perl News
1 direct reply — Read more / Contribute
by Anonymous Monk
on May 26, 2020 at 13:59

    Dear suPerlatives,

    Allow me to introduce Intramine, an intranet service suite for Windows done in Strawberry Perl and JavaScript that provides sub-second local search of your half a million or more source and text files, among other things.

    Some other things:

    • five-second index update when you change a file, to keep searches current
    • automatic linking for all source and text and image file mentions, with minimal overhead (often none)
    • a really nice file Viewer to browse your files, and see search hits in full context (plus that automatic linking)
    • image hovers in your source and text files
    • Gloss, a markdown variant specifically for intranet use that takes advantage of autolinking and minimizes "computer friendly" overhead
    • scalable services: write your own IntraMine service, with or without a front end, and run multiple instances that can talk to other services
    • Search, Viewer, and Linker service support for 137 programming languages, as well as plain text
    • all original work is covered by an UNLICENSE.

    For a README and downloads see




Perl joke heard on television in Meditations
3 direct replies — Read more / Contribute
by Anonymous Monk
on Mar 28, 2020 at 07:41
    Stacy Herbert: You know the flu is way more complicated than this corona virus. I think it's like four strands of RNA. It's so simple apparently the code for it fits on one single page, and this simple little tiny virus is taking down our hyper-complex globalized just-in-time system.

    Max Keiser: Yeah I think the COVID-19 is written in Perl, and the flu is written in C++.

    Keiser Report E1520 Gold: Problems with Exchange for Physical
Let's finish Imager::GIF in Meditations
1 direct reply — Read more / Contribute
by Anonymous Monk
on Feb 06, 2020 at 16:42
    Imager::GIF - a handy module for animated GIF processing - is a nice thought, with one semi-working method and problematic documentation (Re^2: Imager::GIF seems broken), that needs some help, as the docs say:


      Implement the rest of the transformations (cropping, rotating etc).

    I needed to non-proportionally scale animated GIFs and implemented type=>nonprop in the scale method. Other desirable features include crop, watermark, and sharpening. Please share your mods and methods here.



    Your local file:

    perl -MImager::GIF -le 'for (keys %INC) { print $INC{$_} if /GIF\.pm/ +}'
    My scale method:
    sub scale { my ($self, %args) = @_; my $ratio = $args{scalefactor} // 1; my $qtype = $args{qtype} // 'mixing'; # add qtype support $self->_mangle(sub { my $img = shift; my $ret = $img->scale(%args, qtype => $qtype); my $h = $img->tags(name => 'gif_screen_height'); my $w = $img->tags(name => 'gif_screen_width'); # add non-proportional scaling if ( $args{xpixels} and $args{ypixels} and $args{type} and $args{type} eq 'nonprop') { my $xratio = defined $args{xpixels} ? $args{xpixels} / $w : $ratio; my $yratio = defined $args{ypixels} ? $args{ypixels} / $w : $ratio; $ret->settag(name => 'gif_left', value => int($xratio * $img->tags(name => 'gif +_left'))); $ret->settag(name => 'gif_top', value => int($yratio * $img->tags(name => 'gif +_top'))); $ret->settag(name => 'gif_screen_width', value => int($xr +atio * $w)); $ret->settag(name => 'gif_screen_height', value => int($yr +atio * $h)); } else { # proportional scaling, from the original unless ($ratio) { if (defined $args{xpixels}) { $ratio = $args{xpixels} / $w; } if (defined $args{ypixels}) { $ratio = $args{ypixels} / $h; } } $ret->settag(name => 'gif_left', value => int($ratio * $img->tags(name => 'gif +_left'))); $ret->settag(name => 'gif_top', value => int($ratio * $img->tags(name => 'gif +_top'))); $ret->settag(name => 'gif_screen_width', value => int($ra +tio * $w)); $ret->settag(name => 'gif_screen_height', value => int($ra +tio * $h)); } return $ret; }); }
    Thank you!
Hacker News! Just another reinvented wheel: uni in Meditations
2 direct replies — Read more / Contribute
by Anonymous Monk
on Dec 13, 2019 at 23:49
    Four years and seven weeks ago our friend Ricardo SIGNES brought forth on this network, a new program, conceived by Audrey Tang: App::Uni! For some reason a year old clone of uni, written in Go, was advertised as "Hacker News" yesterday:
    Uni: Query the Unicode database from the CLI...
    Usage of App::Uni:

    Identify a character:

     - U+020AC - EURO SIGN
    Or a string:
    uni -c h
    h - U+00068 - LATIN SMALL LETTER H
     - U+020AC - EURO SIGN
    Search description:
    uni /euro/
    ₠ - U+020A0 - EURO-CURRENCY SIGN
     - U+020AC - EURO SIGN
    Multiple words are matched individually:
    uni globe earth
    Print specific codepoints or groups of codepoints:
    uni -u 2042
    ⁂ - U+02042 - ASTERISM
    uni -u 2042 2043 2044
    ⁂ - U+02042 - ASTERISM
    ⁃ - U+02043 - HYPHEN BULLET
    ⁄ - U+02044 - FRACTION SLASH
    AFAIK App::Uni does not have the -race (I mean -tone) or -gender switches of the Go uni so there was some innovation I guess.

    Anyway my meditation consists of encouraging Perl programmers to announce their wares on Hacker News, and other such websites.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2023-03-31 19:36 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (76 votes). Check out past polls.