Ovid's JournalOvid's use Perl JournalStupid Perl 6 Ideas While Sick- June 9, 2008 Somehow, being sick seems to bring out the stupid in me. Or maybe I'm brilliant. I don't know. However, I just realized that I want the following to be legal in Perl 6. subset Crosshair of Point where $_.inside_of($target_area) $target_area.has_moved $_.move_inside($target_area) :: $target_area.move_outside($_); In other words, I think I want subsets to be allowed to mutate their variable. If that works, I...http://use.perl.org/~Ovid/journal/36635?from=rss Whiny Consultants- June 9, 2008 I just read some rules of consulting and I was particularly struck by rule 5:Never complain. They have enough of that, that's why they need you. You're their machete in the jungle of red tape. If you can't take it any more, try to affect positive change or leave. There's no crying in consulting!Twice now I've worked with consultants who've bitched and moaned their way through their work. Even the one who was really qualified managed to offend the hell out of everyone. If there's an issue,...http://use.perl.org/~Ovid/journal/36630?from=rss Content Management Systems- June 9, 2008 With content management systems (CMSs), there are basically two paradigms that I call "client-side" and "server-side" (not entirely accurate, but bear with me). The vast majority are server-side. The code constantly runs, keeping everything going where it should be. This is great because it's conceptually simple and easy to integrate with existing codedatabases.The downsides are legion. Another dependencyIf your Web server goes down, your hosed either way. If your CMS goes down, the...http://use.perl.org/~Ovid/journal/36628?from=rss New Scientist Enigmas- June 8, 2008 Every week, New Scientist has an "Enigma" puzzle. I've always thought they should be easy to solve with programming, so this week I decided to try it. Here's this week's puzzle:Using each of the digits 1 to 9, find a 3-digit positive integer divisible by 7 whose reverse is an integer also divisible by 7, a 3-digit positive integer divisible by 9 whose reverse is an integer also divisible by 9, and a 3-digit positive integer divisible by 11 whose reverse is an integer also divisible by...http://use.perl.org/~Ovid/journal/36624?from=rss Closures to Ease Procedural Pain- June 6, 2008 We have some legacy procedural code (xml builders) which really needs to be refactored into proper classes. This is a perfect case where classes are preferred to procedural code because we have several of these modules which have identical functions with identical arguments. They share a lot of behavior but have to pass their arguments everywhere. There are plenty of ad hoc functions to add XML elements, but I find myself routinely needing a simple, easy to use 'single element builder'. For.http://use.perl.org/~Ovid/journal/36603?from=rss My Favorite Vim Function, ever!- June 6, 2008 This could use some work, but it's quickly become an indispensable navigation tool for me. Place your cursor on any package name and type ',gm' (GotoModule -- assumes your leader is a comma) and you will automatically jump to that module.Features: Uses INC to find the same modules Perl would find.If only one version is found, automatically jumps to it.If more than one version is found, you will be presented with a list to pick from.Cached searches for better performance.Highlighted "Module...http://use.perl.org/~Ovid/journal/36602?from=rss Custom per directory Environment Variables- June 5, 2008 It's a long story why I needed this, but I did. First, we create a little Perl program which can read a YAML file (it's simple now, but might get extended in the future). !usrbinperl use YAML::Tiny 'LoadFile'; exit unless -e '.dev';my $yaml = LoadFile('.dev'); my $env = $yaml->env ;while ( my ( $var, $value ) = each %$env ) make it easy for the shell to parse print "$vart$valuen"; The YAML file might look something like this: ---env: TEST_DB:...http://use.perl.org/~Ovid/journal/36596?from=rss http://use.perl.org/~Ovid/journal/36593?from=rss Are Object-Relational Mappers Worth It- June 3, 2008 I know this has been a long-standing area of debate and has been discussed to death, but I just have to get this out of my system since it's bugging the heck out of me.We use DBIx::Class on our project. It's a great ORM. For my last job, I chose Rose::DB because I needed the performance. I've recently heard that they're ripping it out and replacing it with DBIx::Class -- for performance reasons. Allegedly all of the hacking I had to do to get classes to share database handles (it doesn't by.http://use.perl.org/~Ovid/journal/36575?from=rss Should I Offer a Testing Class- June 1, 2008 I'm back from a week in the US and had a fabulous time celebrating the birthdays of two of my closest friends. Because I was on vacation, I did what any self-respecting geek would do: I taught someone automated testing.The basic problem she had was the same problem I had when I got started in testing, but with an added twist. Many people like the idea of testing but they need that initial push. Just trying to test a 'Point' class or a log file parser sounds nice, but I keep hearing people...http://use.perl.org/~Ovid/journal/36560?from=rss |