Skip to main content



I’m a dev with 20yoe in mostly Java and js but have various amounts of experience with other languages. I’ve decided that I need Perl in my toolkit because I find it on even the most minimal boxes preinstalled and I can’t always install Java or Js just to do admin things. Typically I use bash for these tasks but I just need a little more ability to abstract than what bash easily provides. What would you all recommend as the place to start? Most guides that I run into assume that I’m a beginner to programming and it feels slow. My normal method of learning a new language is to stumble through building a web server but I’m not sure that the way to go here.

submitted by /u/Jjabrahams567
[link] [comments]



I am working with the IP::Geolocation::MMDB module which replaces the deprecated modules for GeoIP databases.

I am having trouble understanding how to extract data.

my $ip = "8.8.8.8"; my $db = IP::Geolocation::MMDB->new(file => "$geolitecitydb"); my $geodata = $db->record_for_address($ip); print Dumper($geodata); 

Using Data::Dumper as above to show the results, I see something like (truncated):
Dumper...........$VAR1 = { 'continent' => { 'geoname_id' => 6255149, 'names' => { 'de' => 'Nordamerika', 'es' => "Norteam\x{e9}rica", 'zh-CN' => "\x{5317}\x{7f8e}\x{6d32}", 'ru' => "\x{421}\x{435}\x{432}\x{435}\x{440}\x{43d}\x{430}\x{44f} \x{410}\x{43c}\x{435}\x{440}\x{438}\x{43a}\x{430}", 'fr' => "Am\x{e9}rique du Nord", 'ja' => "\x{5317}\x{30a2}\x{30e1}\x{30ea}\x{30ab}", 'en' => 'North America', 'pt-BR' => "Am\x{e9}rica do Norte" }, 'code' => 'NA' 

Supposing I just want to grab the value of continent=>names=>en portion (value: 'North America') and write it to a value -- how would I do this? I'm having problems understanding the documentation I'm reading to deal with hashes of hashes.

Most examples I can find online involve looping through all of this; but in my case, I just want to make $somevar = 'North America.' I'd like to repeat it for other data as well, which is returned in this hash.

It feels like something like:

$geodata{city=>names=>en} should work, but it doesn't.

submitted by /u/SqualorTrawler
[link] [comments]




I have been using version 5.22.1 for years, and it did what I needed to do. After all these years, I need some additional functionality, so I thought installing the latest might help.

Which is when I found that ActiveState has changed the installation process totally. Anyway, I went through the installation of the "recommended" version, and installation seemed to go fine.

I then ran the following simple code through both versions.

use HTTP::Tiny; my $url ='https://www.scrapingcourse.com/ecommerce/' ; my $response = HTTP::Tiny->new->get($url); print $response->{content}; 

Version 5.22.1 runs this fine and gives me the HTML of the page.
Version 5.36.3 gives me the following errors;

IO::Socket::SSL 1.42 must be installed for https support
Net::SSLeay 1.49 must be installed for https support

When I use the old ppm command for Version 5.22.1, it gives me a list of 271 packages installed.

When I used the new "state" command: "state packages", it showed nothing.

So I used "state" to "install" IO-Socket-SSL, and Net-SSLeay, and now those are the only two that show up in the "state packages" list.

But it did not change functionality. The error messages are still there, and no execution.

It doesn't complain about HTTP::Tiny.

I tried installing Strawberry. But it had a problem with a more complex part of my original project, so I went back to ActiveState 5.22.1, which works fine.

Anybody got any ideas about what I need to do to get 5.36.3 actually working?

submitted by /u/AvWxA
[link] [comments]



submitted by /u/niceperl
[link] [comments]


On this site: https://codegolf.stackexchange.com/questions/246845/convert-json-object-of-directories-to-list-of-paths

There is an interesting perl solution but I'm trying to wrap my head around it and am baffled.

map/}/?/{/&&say($s)..$s=~s|[^/]+/$||:($s.=s/"//gr."/"),/{?}|".+?"/g When I do a simple test: my $s = <some json string> .. the map above I don't get any output. Thanks in advance 

submitted by /u/UnicodeConfusion
[link] [comments]


I have a bunch of files that I am parsing out a simple tag
<institution content-type="division">(.+?)?<\/institution>

Everything is going fine until I hit this result:
2) School of Chemical &amp; Biomolecular Engineering

This is complaining because it thinks the ) is unmatched. How do I get it to accept whatever is in the capture? I tried playing around with \Q and \E but that isn't working. For clarity, I won't know what is in this tag, it could be anything at all and the tag is simple enough that I don't want to use some XML parser.

submitted by /u/sirhalos
[link] [comments]






Mo utilities for email.

Changes for 0.02 - 2024-04-26T23:02:53+02:00

  • Add tests for error parameters.
  • Rewrite the tests so that the functional tests are first and then the errors.






Generic Module to inherit from

Changes for v0.35.4 - 2024-04-26T13:55:12Z

  • Minor improvements to Module::Generic::SharedMemXS





Hi! Asking for a wisdom here...

We have a module that modifies signal handler $SIG{__DIE__} to log information and to die afterwards. Hundreds of scripts relied on this module which worked fine in perl 5.10.1.

Recently we had the opportunity to install several Perl versions but unfortunately a large number of scripts that used to work with Perl 5.10.1 now behave differently:

  • Failed in 5.14.4: /home/dev/perl-5.14.4/bin/perl -wc test.pl RECEIVED SIGNAL - S_IFFIFO is not a valid Fcntl macro at /home/dev/perl-5.14.4/lib/5.14.4/File/stat.pm line 41
  • Worked without changes in 5.26.3: /home/dev/perl-5.26.3/bin/perl -wc test.pl test.pl syntax OK
  • Worked without changes in 5.38.2: /home/dev/perl-5.38.2/bin/perl -wc test.pl test.pl syntax OK

Many of the scripts can only be updated to 5.14.4 due to the huge jumps between 5.10 and 3.58; But we are stuck on that failures.

Was there an internal Perl change in 5.14 which cause the failures but works on other recent versions without any update on the scripts?

Cheerio!

submitted by /u/Longjumping_Army_525
[link] [comments]



Sanity-check calling context

Changes for 0.04

  • (no code changes)
  • Switched to MIT license.
  • Switched README from POD to Markdown.
  • Removed Travis CI.



Sort lines of text by a Comparer module

Changes for 0.002 - 2024-03-07

  • No functional changes.
  • [doc] Mention some related links.


An assortment of date-/time-related CLI utilities

Changes for 0.128 - 2024-03-07

  • [clis strftime, strftimeq] Use localtime() instead of gmtime(). We can still show UTC using "TZ=UTC strftime ...".