Skip to main content

I'm Still Lazy

·508 words·3 mins·
perl CPAN cpm
Table of Contents
❤️ It's great to see you here! I'm currently available on evenings and weekends for consulting and freelance work. Let's chat about how I can help you achieve your goals.

featured

This toy was somewhat broken
#

About six years ago, I wrote about lazy, which is a tool that will auto-install Perl dependencies for you as they are required. It’s not unique – it has been done before. But this implementation uses a different installer ( cpm) and it also allows you to pass in some flags directly to the installer. I think it’s fun, but it had some problems and it didn’t always work the way I wanted it to. I should have fixed it sooner, but I’m lazy.

Today I wanted to use it and I was so annoyed that I decided to have another look at it. But, it was after my work day and I was feeling lazy. So I asked GitHub Copilot to fix the biggest bug for me. It was deep recursion. Surprisingly, Copilot immediately grasped and fixed the issue. (At least it seems that way to me). Once that was done I took a closer look and decided to fix some design decisions that were making the internals overly complicated. I did that on my own. Then I added some GitHub Actions to give me a little more confidence in my changes and soon it was ready to ship.

Now it’s a better toy
#

As of right now version 1.000000 of lazy is now available for you to download. You can check it out on MetaCPAN.

Have some fun with it
#

At the command line
#

# Auto-install missing modules globally
perl -Mlazy foo.pl

# Auto-install missing modules into ./local
perl -Mlazy='-Llocal' foo.pl

# Auto-install missing modules into ./some-other-dir
perl -Mlazy='-Lsome-other-dir' foo.pl

In your code
#

# Auto-install missing modules globally
use lazy;

# Auto-install missing modules into ./local
use local::lib;
use lazy qw( -L local );

# Auto-install missing modules into ./some-other-dir
use local::lib qw( some-other-dir );
use lazy qw( -L some-other-dir );

# Auto-install missing modules into ./some-other-dir and pass
# more options to App::cpm
use local::lib qw( some-other-dir );
use lazy qw( -L some-other-dir --man-pages --verbose --no-color );

In a one-liner?
#

Install App::perlimports via a one-liner, but why would you want to?

$ perl -Mlazy -MApp::perlimports -E 'say "🧅"'
🌍 global install if required
DONE install Net-SSLeay-1.94
DONE install IO-Socket-SSL-2.088
DONE install LWP-Protocol-https-6.14
3 distributions installed.
skipping autoloader file auto::Net::SSLeay::DTLS1_VERSION.al at /Users/olaf/.plenv/versions/5.40.0/lib/perl5/site_perl/5.40.0/lazy.pm line 90.
skipping autoloader file auto::Net::SSLeay::DTLS1_VERSI.al at /Users/olaf/.plenv/versions/5.40.0/lib/perl5/site_perl/5.40.0/lazy.pm line 90.
skipping autoloader file auto::Net::SSLeay::DTLS1_2_VERSION.al at /Users/olaf/.plenv/versions/5.40.0/lib/perl5/site_perl/5.40.0/lazy.pm line 90.
skipping autoloader file auto::Net::SSLeay::DTLS1_2_VER.al at /Users/olaf/.plenv/versions/5.40.0/lib/perl5/site_perl/5.40.0/lazy.pm line 90.
skipping autoloader file auto::Net::SSLeay::DTLS1_BAD_VER.al at /Users/olaf/.plenv/versions/5.40.0/lib/perl5/site_perl/5.40.0/lazy.pm line 90.
skipping autoloader file auto::Net::SSLeay::DTLS1_BAD_V.al at /Users/olaf/.plenv/versions/5.40.0/lib/perl5/site_perl/5.40.0/lazy.pm line 90.
DONE install Mozilla-CA-20240730
1 distribution installed.
DONE install Regexp-IPv6-0.03
1 distribution installed.
DONE install Net::SSLeay is up to date. (1.94)
0 distribution installed.
DONE install IO::Socket::SSL is up to date. (2.088)
0 distribution installed.
DONE install App-perlimports-0.000055
1 distribution installed.
🧅

And that’s really it. I hope you have fun using it. I hope it makes you more productive. But, most importantly, I hope it leaves you more time in the day to goof off and, you know, just be lazy.


Related

The Perl QA Hackathon is still looking for Sponsors
·310 words·2 mins
CPAN metacpan perl QA Hackathon
How to Run a Single Test via Dist::Zilla
·375 words·2 mins
CPAN Dist::Zilla perl
Ab(Using) the MetaCPAN API for Fun and Profit v2013
·161 words·1 min
CPAN iCPAN metacpan perl YAPC