Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

The Monastery Gates

( #131=superdoc: print w/replies, xml ) Need Help??

If you're new here please read PerlMonks FAQ
and Create a new user.

Monk Quips Quest
Starts at: May 01, 2023 at 08:00
Ends at: Dec 31, 2023 at 18:59
Current Status: Active
8 replies by erzuuli
    Esteemed Monk kcott has recently proposed an excellent idea.

    heretoforthwithstanding, we invite all monks to submit ideas for new monk quips!

    Your quip suggestion should include the following details:

    • Intended quip location: either XP Nodelet, Chatterbox, or Monkbar (that's the page header).
    • Text of quip.
    • Optional: background & foreground colours. If you include these, be sure they are nicely contrasting.


poll ideas quest 2023
Starts at: Jan 01, 2023 at 00:00
Ends at: Dec 31, 2023 at 23:59
Current Status: Active
4 replies by pollsters
    First, read How do I create a Poll?. Then suggest your poll here. Complete ideas are more likely to be used.

    Note that links may be used in choices but not in the title.

Perl News
A Roguelike in Perl Tutorials by Chris Prather
on Aug 08, 2023 at 05:19
1 reply by ait
berrybrew version 1.40 released
on Aug 02, 2023 at 13:38
1 reply by stevieb

    I have released version 1.40 of berrybrew. It comes with some extensive changes over this, and the previous 1.39 version. (See the changes list).

    User facing changes include:

    • Ability to install and use the new 5.36 and 5.38 releases of Strawberry Perl
    • berrybrew archives hidden command. It displays the list of portable Strawberry Perl zip files previously downloaded
    • berrybrew download hidden command. Download, but do not extract the zip archive of a perl version
    • berrybrew snapshot command. Export an installed perl version to a zip archive, and import a previous zip snapshot to a new installed instance

    berrybrew snapshot usage:

    • bb snapshot export <perl version> [snapshot name]
    • bb snapshot import <snapshot name> [new instance name]

    As far as changes on the developer side, the changes are significant. Here's a high-level list:

    • Broke out like functionality in the main berrybrew.cs source file, and spread it across several new classes, each in their own source file
    • Removed the deprecated berrybrew upgrade command. Upgrades shall be done via the installer
    • Created a very extensive MANIFEST checking system for the installer. This ensures that all files that need to be installed are, those same files are removed upon uninstall, and no rogue files when building the installer are accidentally leaked in
    • Added a significant amount of documentation for the development, build, test and release lifecycle of the project. If I get hit by a bus, I've created a fantastic roadmap for someone to carry on the project quite readily (bb dev docs)
    • A few minor bug fixes, and one major one


Storable for user preferences
6 direct replies — Read more / Contribute
by Bod
on Sep 30, 2023 at 14:17

    I need to store user preferences...

    Currently, there are only two user preferences and these are stored as fields in the User table of the database. However, the number of preferences is going to increase. I guess there will be around 20 or so eventually. Experience suggests that most users won't change most of their preferences from the default setting. Therefore, I don't really want to add all the preferences to the User table when nearly all of them will be set to the default values.

    I could implement the preferences in the database with an EAV model. But I wondered if Perl's core Storable might be a better solution.

    I've not used Storable before so I'd appreciate the monastic wisdom about any issues I might face using Storable generally and it's suitability for this specific application...

Hex regex fails in subroutine
2 direct replies — Read more / Contribute
by Version7
on Sep 29, 2023 at 17:21

    Hello everyone I've written a subroutine that replaces a handful of Windows-1252 characters within a UTF8 string with HTML entities. Basically changing ' … ' to  ' &#8230; '. This code works fine on its own outside of a function, but the regex fails within  if( $strng =~ /\xE2/ ) { it doesn't "see" \xE2. Something is changing in $clmnVal once it's passed to the subroutine and I don't understand why or how to fix it.

    my $clmnVal = 'La Conner….Shelter Bay Fee Simple'; if ( grep $_ eq $clmnNm, @smblClmns ) { $clmnVal = smblRpr( $clmnVal ); } sub smblRpr { my $strng = $_[0]; my %smblCO = ( 'xE2' => { '\xE2\x80\x9A' => '&#8218;', '\xE2\x80\x9C' => '&#8220;', '\xE2\x80\x9D' => '&#8221;', '\xE2\x80\x9E' => '&#8222;', '\xE2\x80\x93' => '&#8211;', '\xE2\x80\x94' => '&#8212;', '\xE2\x80\x98' => '&#8216;', '\xE2\x80\x99' => '&#8217;', '\xE2\x80\xA0' => '&#8224;', '\xE2\x80\xA6' => '&#8230;', '\xE2\x84\xA2' => '&#8482;' }, 'xC2' => { '\xC2\xA9' => '&#169;', '\xC2\xAE' => '&#174;', '\xC2\xB1' => '&#177;', '\xC2\xBC' => '&#188;', '\xC2\xBD' => '&#189;', '\xC2\xBE' => '&#190;', '\xC2\xB0' => '&#176;' } ); if( $strng =~ /\xC2/ ) { my $C2 = $smblCO{'xC2'}; while ( my($bytes, $replc) = each %$C2 ) { if( $strng =~ /$bytes/ ) { $strng =~ s/$bytes/$replc/g; } } } if( $strng =~ /\xE2/ ) { my $E2 = $smblCO{'xE2'}; while ( my($bytes, $replc) = each %$E2 ) { if( $strng =~ /$bytes/ ) { $strng =~ s/$bytes/$replc/g; } } } return $strng; } # end smblRpr
Text::CSV and escaped quotes
1 direct reply — Read more / Contribute
by mldvx4
on Sep 28, 2023 at 19:37

    Thanks, Tux, for Text:CSV. It keeps coming in handy both directly and indirectly.

    I have a question about escaped quotes in incoming files. I would have expected the output for the three data lines below to be identical, but the second line misses the escaped single quote. Is an escaped single quote some kind of faux pax or even a mistake within the data or would it be one in something which Text::CSV draws on?

    #!/usr/bin/perl use Text::CSV qw(csv); use strict; use warnings; my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1 }); my $o = \*STDOUT; # Read/parse CSV while (my $row = $csv->getline (\*DATA)) { my @selected = ( splice(@{$row}, 0, 2), splice(@{$row}, -6, 2) ); $csv->say($o, \@selected); } exit(0); __DATA__ 8, 9, NULL, 'Filler', '555-999', '77:88', 0, 0, 0, 0 8, 9, NULL, 'Filler', '555-999', '77:88', 'A \' B , C', 0, 0, 0 8, 9, NULL, 'Filler', '555-999', '77:88', 0, 0, 0, 0

    This is based on something found in the wild.

how to use DBI connect to >1 database
4 direct replies — Read more / Contribute
by misterperl
on Sep 28, 2023 at 09:58
    O'Rielly cookbook suggests:

    SELECT, db2.painting.title FROM db1.artist INNER JOIN db2.painting ON db1.artist.a_id = db2.painting.a_id;

    which is similar to my application requirements. I can use DBI of course to connect to db1. And make ANOTHER connection to db2. But then I need to "prepare" - which needs a database connection. How can I create a handle connected to TWO databases as this statement requires? Maybe:

    $db1->$db2->prepare( $query );


Finding when a feature or keyword was introduced
5 direct replies — Read more / Contribute
by Bod
on Sep 26, 2023 at 13:12

    Is there an easy way to find out when a feature or keyword was introduced to Perl?
    In other words, which version introduced it...

    I have a module that uses pos, a keyword I infrequently use. How can I find out when this, or any other keyword, was introduced so I can set the minimum required Perl version?

    Obviously I could go through each delta until I find it but that seems rather tedious...

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 examining the Monastery: (4)
As of 2023-10-02 21:00 GMT
Find Nodes?
    Voting Booth?

    No recent polls found