• Shaarli
  • Tag cloud
  • Picture wall
  • Daily
  • RSS
  • Login
4453 shaares
3 / 8
Filters
155 results tagged perl

Announcing Date::Parse::Modern

QRCode

I'm a big fan of PHP's strtotime() so I wanted that same functionality in Perl. If you have a date/time string and need a unixtime, then strtotime() is the way to go.

I just released the first public version of Date::Parse::Modern, which is a modern replacement for Date::Parse. Not only does it support more formats than Date::Parse, it's also significantly faster.

In a perfect world this functionality (strtotime) should be in Time::Piece. It's very common in my work flow to read a log file and need to parse the date/time part of the line to a Unixtime.

https://www.reddit.com/r/perl/comments/10r05fy/announcing_dateparsemodern/?%24deep_link=true&correlation_id=260983e3-5f5e-477c-b886-91d84587ded4&post_fullname=t3_10r05fy&post_index=3&ref=email_digest&ref_campaign=email_digest&ref_source=email&%243p=e_as&_branch_match_id=1017042970052510291&_branch_referrer=H4sIAAAAAAAAA22P3UrEMBCFn6betd1t%2BrfCIoL4GiEm024wmYTJlOrbO3XVKyEhh%2B9wzkxuzLk8ti2Bc54bk3MTPL63Kj9VXa%2FyFbQpDyIT%2BdWjCXqjcL0dqUo9V92rnH3fm5%2B8TVEAyc1AQR4BEZCLyPOJTsPyKcogpg2tx1U7w5ANFYjJAeFRqKSzdwBZH5tU6oVpg6obbSKCYNgn1N4J78bTZVag6mEZoO6nydZv8zzWl7Ob%2B2GeHLhecjkV1ssWApoIR53Sf6vcTY8OPsRRAggWURCND9r5FQrfobYmZuNX%2FN8taSMLv57AjaO2CVk%2BL%2FR7DHsO8AV%2FZ0EicQEAAA%3D%3D
February 3, 2023 at 2:17:01 PM EST *
dates perl
FILLER

Perl Advent Calendar 2022 - The Christmas Time Machine

QRCode
use Feature::Compat::Try;

try {
    deliver();
} catch($e) {
    print "Failed to deliver\n";
}

https://youtu.be/Kc_bP73xNyM

https://perladvent.org/2022/2022-12-10.html
January 5, 2023 at 10:10:48 AM EST *
perl
FILLER

Perl Advent Calendar 2022 - A Perlmas Tree - pEFL

QRCode

Nowadays you can create a Christmas tree with perl. There was a wonderful module by Dave Cross in the Perl Advent Calendar 2018. But to find the perfect fitting tree, you have to hack the code. Therefore a GUI is needed. And why not to try the new module pEFL?

pEFL is an object oriented binding to the Enlightenment Foundation Libraries. And even if it is a very young module, the Elementary part (the widget toolkit) is already very usable. But let's see:

But before take a deep dive into pEFL we make a global hash for the settings to SVG::ChristmasTree with nice defaults on top of our code:

https://perladvent.org/2022/2022-12-08.html
December 19, 2022 at 11:18:46 AM EST *
perl gui efl
FILLER

Input Validation and Errors — Swagg::Blogg

QRCode

I used to use the flash() helper in Mojolicious for reporting errors back to the user but recently discovered I can just use Mojolicious:...

https://blog.swagg.net/input-validation-and-errors
September 16, 2022 at 2:58:47 PM EDT *
mojolicious perl
FILLER

Fast perceptual image hashing with Perl - Dimitrios Kechagias

QRCode

Talk slides, images & code used: https://github.com/dkechag/ImagePHash-Talk

This talk will take you through a novel Perl implementation of perceptual hashes for “similar image” searches. I'll start with the basics, if you don't know what a Discrete Cosine Transform is, you'll find out with a visual demo - no math required (although math is always encouraged!). After DCTs and p-hashing basics, I will go through the implementation’s new features that make it efficient and easy to integrate with our large MySQL-based image database.

At SpareRoom, the world’s largest roommate finding service, we handle tens of millions of images, mostly of customer rooms/properties. When tasked with adding an internal ability for a “similar image” search, I first looked at existing solutions and found out that some did not work as expected, while others were either slow or required changes to our infrastructure (mainly Perl, with the data - including the image index - on a large MySQL database).
In the end, I went with a solution initially based on Image::Hash, but with p-hashes reimplemented to fix collision issues and add speed (over 10x faster than pHash.org’s equivalent DCT-based hash). Then, I added features such as support for mirroring, as well as “index/reduced” hashes, in order to effectively use MySQL indices (and thus easily fit in our existing setup).
After an intro to the theory behind the DCT and perceptual hashes in general, I will discuss the abilites of this implementation and the experiences from developing and using it. The module will be released to CPAN before my talk, although the XS part responsible for the fast DCT calculation has been available for a while as Math::DCT.

https://tprc2022.sched.com/event/10Fn5

https://www.youtube.com/watch?v=vw4y506TsDA&list=PLA9_Hq3zhoFyOpb-U3DMU7OT93dPUdtpE&index=13
June 27, 2022 at 10:28:41 AM EDT *
perl images
FILLER

What's In That String? | Tom Wyant [blogs.perl.org]

QRCode

local $Data::Dumper::Useqq = 1;
print Data::Dumper::Dumper( $_ );

$VAR1 = "\30\31\32\e\34\35\36\37 !\"#\$%&'";
$VAR1 = "\30\31\32\e\34\35\36\37 !\"#\$%&\x{100}";

http://blogs.perl.org/users/tom_wyant/2022/05/whats-in-that-string.html
May 31, 2022 at 10:28:51 AM EDT *
perl unicode
FILLER

How much is that BLÅHAJ in the (terminal) window?—The Phoenix Trap

QRCode

Using one line of Perl, you can grab the price and even a picture of IKEA’s iconic cuddly shark toy!

https://phoenixtrap.com/2022/04/12/how-much-is-that-blahaj-in-the-terminal-window/

$ perl -Mojo -E 'say g("https://sik.search.blue.cdtapps.com/us/en/search-result-page", form => {types => "PRODUCT", q => "BLÅHAJ"})->json->{searchResultPage}{products}{main}{items}[0]{product}->@{qw(currencyCode priceNumeral)}'
https://phoenixtrap.com/2022/04/12/how-much-is-that-blahaj-in-the-terminal-window/
May 4, 2022 at 2:06:28 PM EDT *
perl mojolicious
FILLER

Max Maischein. What I learned about SQL in 2018

QRCode

PerlCon 2019 Rīga — Day 2 — 8 August 2019

https://perlcon.eu/talk/56

~20:00 - Window functions
~33:45 - CTE
~43:00 - Recursive CTE

This talk shows how to use SQL Window Functions (ISO SQL:2008) and how to use Common Table Expressions (CTE, ISO SQL:1999).

Using these two techniques, you can often avoid munging the query result afterwards. This potentially saves roundtrips between the program and the database.

The presentation assumes an intermediate familiarity with SQL. To get the most of the presentation, youshpuld be familiar with SELECT and JOIN. The Perl level is suitable for the beginner, but there will be very little Perl.

https://www.youtube.com/watch?v=-8wJL4qvEOs
April 5, 2022 at 3:51:48 PM EDT *
perl sql mssql
FILLER

Ricardo Signes (‎rjbs‎) - ‎1.21 Gigawatts‎

QRCode

You should write your own debugger!

~25:00

https://speakerdeck.com/rjbs/1-dot-21-gigawatts?slide=174

https://www.youtube.com/watch?v=IG425RMEkRo
March 12, 2022 at 8:49:22 PM EST *
perl debugger
FILLER

Ricardo Signes - The Perl 5 Debugger: Wuh?

QRCode

95% of all debugging is print statements, but once or twice a year, a problem shows up that is best attached with perl5db.pl, the venerable core Perl 5 debugger. Like a light saber, it dates back to a forgotten time and its operations are poorly understood. Unlike a light saber, it is not elegant, and nobody aspires to use it. Also, it can cut limbs right off. Still, it’s a very useful multi-purpose tool, and if you learn how to use it, it can save a lot of time and clear up a lot of mysteries.

This talk will cover what the debugger is, how to use it at a basic and intermediate level, how to customize it, and at least one or two stories about how it is very, very awful.

https://www.youtube.com/watch?v=LtAGbUYTnR0
February 25, 2022 at 2:22:41 PM EST *
perl debugger
FILLER

How to add a relative directory to @INC

QRCode

Solution 5 - Path::Tiny
The solution that I currently like the best, involves the use of the Path::Tiny module

use Path::Tiny qw(path);
use lib path($0)->absolute->parent(2)->child('lib')->stringify;

https://perlmaven.com/how-to-add-a-relative-directory-to-inc
February 8, 2022 at 1:49:21 PM EST *
perl
FILLER

Migrating from LWP::UserAgent to Mojo::UserAgent : perl

QRCode

I'm in the process of migrating my development process from the old comfortable tools I've been using for the last handful of years over to Mojo-based code whenever possible. I'd like to thank everyone in this subreddit that's helped me in on this journey of discovery in prior posts, and hope that I can continue to benefit from the wisdom of the collective.

Mojolicious lets you do a lot of things more concisely than some other frameworks/modules, too. This type of setup/flow is normally what I use in my client-side scripts:

my $ua = Mojo::UserAgent->new;

my $post_result = $ua->post(
  $endpoint,
  { SOAPAction => $soapaction, 'Content-Type' => 'text/xml' }, # headers
  $message # request body
)->result;
https://www.reddit.com/r/perl/comments/8njtgi/migrating_from_lwpuseragent_to_mojouseragent/
September 16, 2021 at 2:59:33 PM EDT *
perl mojolicious
FILLER

Kent C. Dodds’ .filter() Trick Will Change How You Use JavaScript | by Dr. Derek Austin 🥳 | Coding at Dawn | Jun, 2021 | Medium

QRCode

Kent C. Dodds’ .filter() Trick Will Change How You Use JavaScript. This one-liner uses the Boolean constructor to magically remove all falsy values from an array ✨.

https://twitter.com/kentcdodds/status/1009918457394225152

const plugins = [
    isProd ? optimizePlug : null,
    isProd ? prodOnlyPlug : null,
    !isProd ? testingPlug : null,
    usefulPlug,
].filter( Boolean );
https://medium.com/coding-at-dawn/kent-c-dodds-filter-trick-will-change-how-you-use-javascript-87b5112f9f6d
July 9, 2021 at 9:31:51 AM EDT *
javascript coding perl
FILLER

Debugging with Perl

QRCode

Eugen Konkov — 45 minutes 🐪

Interactive debugging.

This talk about how to catch and report perl application exceptions.

An example based on Mojolicious web server will be given.
I will show how to reproduce exceptions and debug them.
The example will describe how to access and view data at any stack frame.

Also I will show how to implement new debugger commands and how to debug them (yeah, you understand right: how to debug perl debugger while debugging)

This talk will about my second proprietary debugger. It is full rewrite of first version: https://github.com/KES777/Devel-DebugHooks

https://perlcon.eu/talk/34
May 21, 2021 at 2:57:13 PM EDT *
perl mojolicious debugger
FILLER

unicode - Why does modern Perl avoid UTF-8 by default? - Stack Overflow

QRCode

I wonder why most modern solutions built using Perl don't enable UTF-8 by default.

Saying that “Perl should [somehow!] enable Unicode by default” doesn’t even start to begin to think about getting around to saying enough to be even marginally useful in some sort of rare and isolated case. Unicode is much much more than just a larger character repertoire; it’s also how those characters all interact in many, many ways.

https://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default
May 11, 2021 at 9:01:16 AM EDT *
perl unicode
FILLER

Playwright and Mojolicious - DEV Community

QRCode

It's Hack Week again at SUSE. 🥳 An annual tradition where we all work on passion projects for a whole... Tagged with mojolicious, perl, javascript, node.

https://dev.to/kraih/playwright-and-mojolicious-21hn
April 5, 2021 at 9:27:52 AM EDT *
mojolicious perl javascript testing
FILLER

Easy Data::Printer in the perl debugger | Chisel [blogs.perl.org]

QRCode

If you want to try it add the following to $HOME/.perldb:

$DB::alias{dp} = 's/dp/DB::dp/';
sub DB::dp {
    eval {
        require Data::Printer;
        Data::Printer->import(colored=>1,use_prototypes=>0);
    };
    if ($@=~/Can't locate/) {
        print 'Data::Printer is not installed';
        return;
    };
    print Data::Printer::p(@_);
}
http://blogs.perl.org/users/chisel/2012/03/easy-dataprinter-in-the-perl-debugger.html
March 17, 2021 at 10:40:10 AM EDT *
perl debugger
FILLER

Dist::Zilla::PluginBundle::Starter - A new way to start using Dist::Zilla - DEV Community

QRCode

Dist::Zilla is an extremely powerful and versatile CPAN authoring tool, which has enabled me to relia... Tagged with perl.

https://dev.to/grinnz/dist-zilla-pluginbundle-starter-a-new-way-to-start-using-dist-zilla-38m6
March 16, 2021 at 11:20:34 AM EDT *
perl cpan
FILLER

The Perl debugger can be your superpower - The Phoenix Trap

QRCode

What if I told you that you could freeze time in the middle of your program?

By far my favorite thing to do with the debugger is to run it against test scripts using the prove command. This takes advantage of prove’s ability to run an arbitrary interpreter through its test harness. Run it like this:

% prove --verbose --lib --exec 'perl -Ilib -d' t/foo.t

https://phoenixtrap.com/2021/03/09/perl-debugger-superpower/
March 16, 2021 at 11:19:31 AM EDT *
perl cpan
FILLER

IPC::Cmd considered harmful - ETOOBUSY

QRCode

Recently, I had to do some command-line invocations from Perl. Well, let’s see what we have at our disposal then…

  • system is fine, but too limited. E.g. it does not allow grabbing the output of a command, which I might need;
  • qx is a joke from the past. I mean, not having a list-oriented alternative and forcing the user to do (and possibly forget) quotemeta is something I can’t bear in 2021;
  • IPC::Open2 and IPC::Open3 are in CORE but require some effort to be used, which I’d like to avoid;
  • IPC::Cmd seems interesting, because it’s in CORE and its run_forked seems to hit the sweet spot: it supports providing the command as an array reference, has a bunch of options and provides back everything that’s needed;
  • IPC::Run, IPC::Run3, insert your favourite module here all seem very interesting and flexible, but they are not in CORE and are probably overkill in my case.

Well then, we’re done! IPC::Cmd’s run_forked for the win… right?!?

Well… not so fast.

https://www.reddit.com/r/perl/comments/lu39cy/ipccmd_considered_harmful/

https://github.polettix.it/ETOOBUSY/2021/02/27/ipc-cmd-considered-harmful/
March 9, 2021 at 10:20:21 AM EST *
perl
FILLER
3 / 8
Shaarli · The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community · Documentation
Fold Fold all Expand Expand all Are you sure you want to delete this link? Are you sure you want to delete this tag? The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community