Showing posts with label Pugs. Show all posts
Showing posts with label Pugs. Show all posts

Wednesday, July 15, 2009

Getting STD.pm to work

In a comment to my last post, moritz suggested STD.pm would be a better check for the validity of my code as I ported it from Perl 5 to Perl 6. I duly set out to figure out how to do this -- and since I didn't find any hint of how to do it with a Google search, I'll document it here in hopes it helps someone else.

The legendary TimToady pointed me in the right direction. First, STD.pm and the scripts for using it live in the Pugs repository. I got http://svn.pugscode.org/pugs, though it may be possible to just get the src/perl6 directory tree, as that is the one we are interested in.

Once you have that src/perl6 directory, cd to it. You need to make to get it ready to use. Unfortunately, it is hardcoded to assume Perl 5.10 is available in /usr/local/bin/perl. If, like me, you only have 5.10 installed as a local user, you will need to go through the code and replace that path with the path to your Perl 5.10. (This is a great application for a quick Perl script.) You also need to have Moose and YAML::Syck installed. (I should thank moritz and PerlJam for helping me with getting this directory prepped to work.)

If you get that all set up and execute make and it doesn't return any errors, then you should have a working STD.pm! The tryfile command will try to parse your Perl 6 file carefully and provide sensible error messages.