Re: What am I doing wrong? A bad end-user experience

demerphq <[email protected]>
Newsgroups gmane.comp.lang.perl.perl5.porters
Message-ID <CANgJU+WpuTtMix29TjXYWYnw2Ct4bHaZVPg2oDK8vfB0QiVhaA@mail.gmail.com>
On Thu, 10 Sept 2026 at 13:49, Paul "LeoNerd" Evans <[email protected]>
wrote:

> I keep a bunch of perl modules in my $HOME:
>
>   $ env | grep PERL
>   PERL5LIB=/home/leo/lib/perl5
>   PERL_MB_OPT=--install_base=/home/leo
>   PERL_MM_OPT=INSTALL_BASE=/home/leo
>
> I use system perl.
>

Yeah, well, that is where you go wrong. It is long and well established
that it is unwise to modify their system perl. Doing so is highly likely
to  break your OS.

Perl very well may be used in the OS'es build chain, and upgrading modules
can and will break things.

It has been folk wisdom for a very long time that you should install a
second perl which is not used by the system, with the easiest way to do so
using perlbrew.




> Today, I ran some debian updates that jumped from perl 5.40 to 5.42.
> Now, nothing is usable:
>
>   $ eachperl list
>   Perl API version v5.40.0 of Object::Pad does not match v5.42.0 at
>   /usr/lib/x86_64-linux-gnu/perl-base/DynaLoader.pm line 218.
>   ...
>
> OK, fair enough. I guess I need to rebuild Object::Pad:
>
>   $ cd Object-Pad
>
>   $ perl Build.PL
>   Attempt to reload Scalar/Util.pm aborted.
>   Compilation failed in require at
>   /usr/lib/x86_64-linux-gnu/perl-base/File/Temp.pm line 153.
>   ...
>
> Oops. Turns out the Scalar::Util that I have in $HOME/lib/perl5 is
> wrong. No matter, I can just update and install that, right..?
>
>   $ cpan Scalar::Util
>   Attempt to reload Scalar/Util.pm aborted.
>   Compilation failed in require at /usr/share/perl/5.42/Safe.pm line 4.
>
> Uhhm. OK.. How do I get out of this one?
>
>
> That isn't *actually* a question to folks here, I in fact do know how
> to solve this. It's "simple":
>
>   $ xargs rm
>   <lib/perl5/x86_64-linux-gnu-thread-multi/auto/List/Util/.packlist
>
> and now we're back to the system distributed one. From here I can
> backtrack and rebuild things from source. Of course, I can't just use
> `cpan` to install things because CPAN.pm simply notes that the required
> .pm files are in place and doesn't want to install:
>
>   $ cpan Object::Pad
>   ...
>   Object::Pad is up to date (0.825).
>
>   $ perl -MObject::Pad -e1
>   Perl API version v5.40.0 of Object::Pad does not match v5.42.0 at
>   /usr/lib/x86_64-linux-gnu/perl-base/DynaLoader.pm line 218.
>
> so now I have to guess around some way to force reinstall this, and all
> of its dependencies. One at a time. By hand. Because CPAN.pm won't help
> me.
>
> This exact problem of "argh all my perl is broken" is going to happen
> to anyone doing this kind of setup, whenever system perl gets updated.
>
> So someone, please tell me, what am I doing wrong here? I cannot
> believe that this is the intended behaviour of the system we have.
>

Its really simple. Never ever mess with your system perl without using your
system toolchain. Period. If you want to hand install things with CPAN then
use perlbrew or some  other approach to install a private perl.


> Alternatively, maybe this is as good as can currently be achieved. If
> so then I really don't like it, and I think we could do a lot better.
>
> <rant>
>   If users can't easily install newer versions of perl and have things
>   actually still usable, then I can quite well understand why people
>   don't update to newer versions, and so keep using ancient versions and
>   not bother making use of new features so nobody uses anything new that
>   we make and so why do we spend time making anything new?
> </rant>
>

IMO This all comes from the perl communities myopic focus on libraries and
toolchain and not applications - nobody installs an application and then
thinks they can mess with it without using Authorized Tooling. The perl on
your system is effectively part of your OS, it isnt there for you to mess
with directly, it's there to run your distro, maybe a few scripts,
whatever. Installing stuff into it should use your OS tooling NOT CPAN.

And yes, we could do waaaay better about explaining this in the docs.

And yes we could do waaaay better at being suitable for use in
applications. We suck at applications. When was the last time your saw
someone build an app with perl? It just doesn't happen. People build
frameworks but not apps. (IMO this is one reason we are losing market share)

So just do pretty much everybody does, use perlbrew. I personally have
every last-minor major version of perl since 5.005 installed available
through perlbrew, with 4 build configs each, and i do most of my scripting
in 5.36, if im not working directly in the blead repo.

Anyway, to repeat: Never, ever, mess with your system perl. Install a
different perl you use for that.

cheers
Yves

cheers,
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.