Hacker News new | past | comments | ask | show | jobs | submit login

That big boilerplate section can be rolled into a single pragma like Modern::Perl, and it's trivial to write such pragmas yourself using Import::into. The difficulties with the boilerplate are overrated, it's the incredibly loose type system that resists any attempts at static typing, and can't even differentiate numbers and strings except by having different operators for the two. Sigil soup still turns people off too, me included even after doing perl off and on for 20 years.



What on earth is modern Perl? I tried asking my search engine. I got nothing that showed me examples of what the code looks like. Is there really a popular faction in the Perl community that's evolving the language in a different direction using modules?


http://modernperlbooks.com/books/modern_perl_2016/index.html ... seriously tho, if your search engine didn't at least link "modern perl" to somewhere in that site, something's very wrong with it. (edit: I see what you mean, it's thin on worked examples. I'd say browse around cpan for new uploads, most new perl code these days uses modern idioms)

The principles of modern perl pretty much boil down to "use the new stuff and turn off the old stuff":

* use strict and warnings, those go without saying. 'autodie' is also pretty much de rigueur these days too.

* disable legacy things like bareword filehandles and indirect object syntax.

* enable unicode everywhere by default in strings and I/O layers

* use Moose, or at least a compatible subset like Moo or Type::Tiny. This is probably the biggest differentiator of modern perl, as Moose is a major addition to the OO system, basically a backport of the perl 6 object system.

I wouldn't say the evolution of the language via modules is any kind of "faction", it's very much the mainstream thought of perl and always has been. Perl was designed from nearly the start to be hackable from within itself.

Also quite a few hits on CPAN: https://metacpan.org/search?q=modern%3A%3Aperl (ima convert all my old production code to Acme::Thoroughly::Modern::Perl tonight!)


Generally I hear that in reference to chromatic's book / blog posts:

http://modernperlbooks.com/


Moderl Perl is the recent versions of perl, like modern Java is the recent versions of Java. But Perl is more flexible providing forward compatibility.

For stability, Perl defaults to an old stable behavior. Modern features are opt-in Perl::Modern is a handy way to select a version, sort of like Python's `from future import foo`

Searching for "perl" will lead you to https://www.perl.org/


Generally, I think, modern Perl is when rather than doing OOP with "bless" they use the Moose module.




Consider applying for YC's first-ever Fall batch! Applications are open till Aug 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: