Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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.

Quests
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

    -stevieb

Supplications
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 db1.artist.name, 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 );

    Gracias

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...

Writing Perl with Emacs: Are there perl-mode users around?
2 direct replies — Read more / Contribute
by haj
on Sep 25, 2023 at 09:54

    Emacs comes with two different major modes to edit Perl code: perl-mode and cperl-mode.

    perl-mode is somewhat stuck with the Perl syntax of 5.14, has less features, but a cleaner implementation. cperl-mode is up to date with Perl 5.38 and has deeper understanding of Perl syntax, but a somewhat arcane implementation, most of it written in the previous century.

    With all due respect to TIMTOWTDI, maintaining two major modes turns out to be not enough fun in the long run, and last week Stefan Kangas opened a wishlist item to Making perl-mode.el obsolete.

    The mail thread shows that some people prefer perl-mode because it is less "colorful" and intrusive than cperl-mode. Therefore, the idea is to enable cperl-mode to (optionally) look like and behave like perl-mode. That way, perl-mode.el can be obsoleted without making those users uncomfortable: perl-mode would continue to exist as a custom theme of cperl-mode.

    Users of perl-mode are now encouraged to try cperl-mode, and to report bugs against cperl-mode where they prefer the behavior of perl-mode. This has already started. The "current" cperl-mode.el is available from the repository: cperl-mode.el and is supposed to work with Emacs 26 and newer.

    Keep the reports going!

    This article also appears on blogs.perl.org.

    Edited: Fixed the link to blogs.perl.org. Thanks to hippo for noticing!

How can I send a "transposed slice" of an array of hashes and by extension an array of arrays, or hash of hashes to a subroutine
5 direct replies — Read more / Contribute
by ObiPanda
on Sep 24, 2023 at 16:34

    I very much appreciate the thorough answers I receive here: they have helped me get reacquainted with Perl. The hardest part I still encounter is to understand what the symbols mean, not so much the concepts.

    I'm simply asking for a "better" way to accomplish a task I already can do.

    An example: I want to know if there's a way to send just one key & value per array/hash - preferably by reference - to a subroutine. In the example code below, I want to send all and only the {Sub_Name}s and their respective values. The code below works and I've come up with two ways to list the Sub_Name. I'm simply wanting to know if there's a better way to do it, so I don't have to make an array or send the entire array of hashes to the subroutine.

    #!/usr/bin/env perl #use 5.36.1; use strict; use warnings; use Data::Dumper; use autodie; use File::Find; use File::Copy; use File::Rename; use feature 'fc'; use File::Path qw( make_path ); my $Wait_Time = 10; # Implement Time Delay # Subscription DATA sets my @Subscription = ( { Sub_Name => "Morph", Archive_File => "Morph Archive.txt", }, { Sub_Name => "Analogue", Archive_File => "Analogue Archive.txt", }, { Sub_Name => "Cat", Archive_File => "Cat Archive.txt", }, { Sub_Name => "Zoonotic", Archive_File => "Zoonotic Archive.txt", }, { Sub_Name => "Hydro", Archive_File => "Hydro Archive.txt", }, ); #Subscription of Names my @Subscription_Names_List; for (@Subscription) {push @Subscription_Names_List, $_->{Sub_Name};} List_Subscriptions(\@Subscription_Names_List); for (@Subscription) { Display_Subs(\%$_); } sub Display_Subs { my ($my_Sub) = @_; print "Testing Subscription to: $my_Sub->{Sub_Name}\n"; return $my_Sub; } sub List_Subscriptions { my (@Sub_ARRAY) = @{$_[0]}; # my (@Sub_ARRAY) = @_; print "The Current Subscription List:\n\n"; for (@Sub_ARRAY) { print " \t$_ \n"; } print "\n\n"; }
Windows precompiled binaries or DIY compile
8 direct replies — Read more / Contribute
by ObiPanda
on Sep 23, 2023 at 12:43

    Is it better to use a "packaged" easily installable version of Perl such as Strawberry on a Windows OS or to compile a version or there is no practical difference, etc...?

    I primarily ask for two reasons: stability and speed. An underlying assumption to both reasons is that compiling code will always be faster, because it will compile based on specific chipsets and its respective native math libraries.

      1. Stability. My systems run both AMD CPUs and GPUs. I have wondered if instability in GAMES are sometimes caused by various issues of the binaries being compiled for Intel CPUs and NVidia GPUs. By extension, is there an inherent stability benefit of compiling Perl on a Windows system?
      2. Speed. This likely has no real practical value unless one is running a "large" server on Windows; but, I wanted to ask anyway. So, by a similar analogy to GAMES stability, since there is a real benefit to GAMES which have been optimized for either AMD or Intel/NVidia and sometimes specifically a chipset, is there a speed benefit to compiling Perl on Windows?

    thanks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2023-09-29 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?