April 2023 Archives

Increasing Perl’s Visibility, Redux

Quite a while ago, I blogged about how Perl projects should have websites to increase not only their visibility, but the visibility of Perl as a whole.

Perl has had the CPAN and awesome websites like MetaCPAN and its predecessor search.cpan.org for a long time, so unlike how things happen in other programming language ecosystems, many Perl projects have felt no need to start their own websites for documentation, package downloads, and community — all these things were already provided.

However, I do feel that this centralization keeps Perl content on the Internet very isolated and makes Perl less visible than other programming languages.

Experiments in Overloading

Let's play with overloading a little.

A simple class:

  package Local::Overloaded {
    use Moo;
    
    has number => ( is => 'ro' );
    
    use overload '0+' => sub {
      my $self = shift;
      return $self->number;
    };
  }

And let's test it:

  use Test2::V0;
  my $obj = Local::Overloaded->new( number => 42 );
  is( 0+$obj, 42 );
  done_testing;

This test fails.

Why?

About Toby Inkster

user-pic I'm tobyink on CPAN, IRC and PerlMonks.