Skip to main content



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]


submitted by /u/davorg
[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]






I'm experimenting with different frameworks and I've come across this wonderful catalyst framework based on Perl, does anyone know of a front end (which is website, forums, etc.) coupled with a back end (tracker engine) for use with modern Perl? I have a PHP based one and was wondering if it was possible to do the same using Perl.

submitted by /u/Otherwise-Tune-257
[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





Perl CPU Benchmark

Changes for 2.6 - 2024-04-25

  • Custom benchmark improvements.
  • Fix BSD tar xattr.


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