Perl, Perl 6, and Two Application Frameworks Release 2017 Advent Calendars (perladvent.org)
An anonymous reader writes:
Friday saw this year's first new posts on the Perl Advent Calendar, a geeky tradition first started back in 2000. It describes Santa including Unicode's "Father Christmas" emoji by enabling UTF-8 encoding and then using the appropriate hexadecimal code.
But in another corner of the North Pole, you can also unwrap the Perl 6 Advent Calendar, which this year celebrates the two-year anniversary of the official launch of Perl 6. Its first post follows a Grinch who used the but and does operators in Perl 6, while wrapping methods and subroutines to add extra sneaky features, "and even mutated the language itself to do our bidding."
Perl/Python guru Joel Berger has also started an advent calendar for the Mojolicious web application framework (written in Perl), and there's apparently also an advent calendar coming for the Perl Dancer web application framework.
But in another corner of the North Pole, you can also unwrap the Perl 6 Advent Calendar, which this year celebrates the two-year anniversary of the official launch of Perl 6. Its first post follows a Grinch who used the but and does operators in Perl 6, while wrapping methods and subroutines to add extra sneaky features, "and even mutated the language itself to do our bidding."
Perl/Python guru Joel Berger has also started an advent calendar for the Mojolicious web application framework (written in Perl), and there's apparently also an advent calendar coming for the Perl Dancer web application framework.
If you weren't retarded you would learn pearl instead of Python & go
-=}BeauHD{=-
Real programmers just use it to get 'er done. I guess you feel embarrassed enough to want to hide your identity while displaying ignorance and intellectual laziness.
Why guess when you can know? Measure!
If you see cartoon swearing, like "?#@*&%!" and think to yourself "That's silly, he should have used "#@$_" instead, it's more efficient", you're been using too much perl.
Its first post follows a Grinch who used the but and does operators in Perl 6 ...
It must have been something you assimilated. . . .
At least it seems like it's getting somewhat decent Unicode support. I remember writing a Perl script to strip out stuff from something because reasons.
Why the awkward $delim_len? Because if the hyphen is a U+ 2013 EN DASH the length is 2. If it's a regular ASCII hyphen it's 1. And the only reason I'm stripping them out is because they cause problems later.
You expect this sort of thing in C because strlen returns a length in bytes because it was invented in the 1970s, but it kind of sucks for a scripting language.
echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
No explosions here. It's just that most of the really nasty trolls - who never seem able to actually back up their crap - are also AC for reasons other than the cookie issue.
Why guess when you can know? Measure!
Why the awkward $delim_len? Because if the hyphen is a U+ 2013 EN DASH the length is 2.
But then it isn't a hyphen.
Decouple your mind from visual representations.
In perl, there are even special functions and methods for handling separators, making it very easy to use any delimiters or set of delimiters you define. The typical way to handle this would be with split and join.
Someone has a good sense of humor. The Perl6 advent calendar is hosted on a Wordpress site.
Perl seems to be dying. Everybody loves bash again now, and python, go, node.js, etc..
A big miss by the Perl community was not getting AWS Lambda support or an AWS module for a long time. Boto ate Perl's lunch.
But then it isn't a hyphen.
Yeah, I changed the variable name when I was bowdlerizing the code. And broke it, because I'm sloppy.
Well but the deeper point is that Perl - at least the version I was using then - didn't properly support UTF-8. length($delim) returned the number of bytes like strlen in C by default.
Meanwhile trying the same thing in Python. All the dashes in my code at EN DASHes which Slashdot won't let me post.
prints 1 as even if foo is a EN DASH.
Mind you, just now I tried this
Without the use utf8; line I get 3 when $hyphen is a EN DASH With it I get 1. It still complains about "Wide character in print".
A bit of Googling turns up binmode as the way around this. I.e. to get rid of the complaint I can do
I.e. Perl 5 is a bit clunky for this stuff because by default it runs in a mode which isn't UTF-8 aware probably for compatibility reasons. You need to turn on support for utf8 strings in the string functions and utf strings in stdout and probably in other places too.
You can see how non automatic it is because slashdot, which is written in Perl, is pretty much guaranteed to corrupt unicode characters in comments even though slashdot is is utf8.
Of course Python doesn't have these issues. Then again Python doesn't really care about back compatibility - they probably turned on UTF aware mode at some point and just told people to suck it up if that broke their scripts.
Still these days I prefer Python to Perl. And not just or even primarily the UTF stuff - there's loads of useful things available to Python code for data manipulation like numpy I really like. Could I do the same thing in Perl? Yeah, I'm sure I could. It'd just take longer.
echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
You can see how non automatic it is because slashdot, which is written in Perl, is pretty much guaranteed to corrupt unicode characters in comments even though slashdot is is utf8.
Slashdot had UTF-8 support for a short while a decade or so ago. It was turned back off again, because the perl support was too good, allowing things like right-to-left spaces, which the crowd here naturally pounced on.
Turning it back on is easy enough, but unless someone spends a lot of time hardening the system, it will get abused again.
As for your perl em-dash problem, why do you need to know the length, if it's a separator? Use the built-in functions that can deal with a separator of any length, and you should not have to write specific handling.
I see people complain about this from time to time, but I dont agree. Perl scripts often process binary data and if you assumed UTF-8 on input and output then it would break things like unzipping compressed data on stdin or streaming it to stdout. The unix tradition perl is built on assumes bytes until you tell it otherwise.
I dont follow python, but Id assume you get the exact opposite problem, needing to turn on binary mode any time your script might need to stream binary data?
Meanwhile, I am rather annoyed at slashdots lack of unicode. It would be nice if they could at least support the common characters used by i.e. the iOS screen keyboard which makes it impossible for me to use apostrophes.
Mark of the Coder fades from you. You perform Opening on World of Warcraft. Warcraft crits GPA for 4. GPA dies.