[]RSS

About Archives Artwork Comic Contact Philosophy Projects Tags

Good old Perl

[Comment]

February 28th, 2008 in Micro Blog

Drunken Stevey writes about Perl as an ancient language, in his long rambling style. He agrees with my belief that developers should take a compilers course:

The disease, nay, the virus of programming-language religion has a simple cure: you just write a compiler. Or an interpreter. One for any language other than the one you know best. It’s as easy as that. After you write a compiler (which, to be sure, is a nontrivial task, but if there’s some valid program out there that you couldn’t ever write, then you’re not justified in calling yourself a programmer), the disease simply vanishes. In fact, for weeks afterwards, you can’t look at your code without seeing right through it, with exactly the same sensation you get when you stare long enough at a random-dot stereogram: you see your code unfold into a beautiful parse tree, with scopes winding like vines through its branches, the leaves flowering into assembly language or bytecode.

A warning about learning Perl

[Comment]

February 26th, 2008 in Links

Do not learn Perl, or you will miss it from every other language you use.

Parsing Perl impossible?

[Comment]

January 28th, 2008 in Links

Perl Cannot Be Parsed: A Formal Proof, a proof of the impossible complexity of Perl’s syntax. It’s a deep, flexible grammar, that can be extended by its delegates.

Perl + Haiku?

[Comment]

January 27th, 2008 in Links

S.W.A.H.G. is a Haiku parser/generator written in Perl. Is there anything that Perl cannot do?

Perl + Infocom == interestingness

[Comment]

January 13th, 2008 in Links

Rezrov is a pure Perl z-code interpreter. Good example code for the kids, and fun retro gaming.

Perl6 and the Mozilla foundation

[Comment]

November 15th, 2007 in Links

Some good news for Perl6, the Mozilla foundation is offering a grant for a full time developer on the Perl 6 compiler.1 The grant is a great example of the good that can be done with Mozilla’s windfall.2

  1. Absurdly large set of operators and implicit variables here we come!
  2. Well, other than potentially making Firefox and Thunderbird better

New features in Perl 5.10

[Comment]

November 13th, 2007 in Links

A funny slideshow showing us the new features in Perl 5.10. say 'What?';

Hack of the day: serial programming on Linux versus Windows

[Comment]

October 19th, 2007 in Programming

screenshotI borrowed a serial UPC scanner from work today for some Friday night hacking. It’s a ReaderWare LaserChamp/Flic Barcode reader re-branded under the SerialIO name. It came with a standard serial cable and didn’t have a manual.

First, I booted to my partition to see the raw data from the scanner.

$ cat /dev/ttyS0

No dice. I did some searching and found that the scanner likely ran at 4800 baud.

$ setserial /dev/ttyS0 baud_base 4800
$ cat /dev/ttyS0

^B043396143234

Ah, some data. I removed the control characters and had myself a UPC symbol. I wrote a script and scanned a bunch of books, CDs, and other crap sitting on my desk. I also found a manual for the scanner, which had some settings symbols1.

I booted to my XP partition and started . I wrote a Perl script to mimic what I did on Linux, except using the Win32::Serial module. I fired up CPAN to grab the library, but CPAN was down. I switched to ActiveState’s Perl distribution and grabbed their Win32:: PPM. I finished the script and tested it. It worked.

A while later I checked CPAN again, grabbing the Win32:: module using Cygwin’s Perl. It didn’t build. This seems typical for Cygwin and CPAN/Perl modules2. I moved on.

I switched to C# to see how it compared to Perl and the Linux/Bash hack. I whipped together a simple application3 that listened for data on a serial port, cleaned it up, and copied it to the clipboard. It worked4.

I also attempted to hook the C# code up to the Amazon API (to get ASINs), but found the networking libraries more complicated than I had time for5.

My favorite approach? Hands down, I liked the Bash script6 best. It was one line of code, including cleaning it up with sed. It’s not something I can ship, but it’s the way I’ll scan all of my books/CDs/DVDs.

The Perl Win32::Serial hack was longer (a dozen lines), but it also worked. It was no better than the 1-line Bash script, so I tossed it.

The C# hack consisted of a single form and its supporting class (a few dozen lines of code). It worked, and is easy to distribute. I’ll use this if I’m stuck doing something in Windows.

Total time for all 3 hacks? 3 hours and 25 minutes7.

  1. You print the page and scan the symbols to change the scanner’s settings
  2. Most of the tests failed for the Win32::Serial module
  3. And the .NET build of it
  4. C#’s serial code was nicer than Perl’s, but not as nice as the devfs hack
  5. Perl’s networking is much nicer than C#’s
  6. Bash and devfs’s /dev/ttyS0
  7. My wife and kids were out for the evening

HTML to MediaWiki markup

[Comment]

August 21st, 2007 in Links

A Perl module for converting HTML to MediaWiki markup. There’s a Perl module for damn near anything, a fact that makes Perl difficult to ignore.

Perl problem solving

[Comment]

August 9th, 2007 in Links

Brian’s Guide to Solving Any Perl Problem, a neat guide to solving Perl scripting problems.

Next page [>>]