Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

runrig (3385)

runrig
  dougwNO@SPAMcpan.org

Just another perl hacker somewhere near Disneyland

I have this homenode [perlmonks.org] of little consequence on Perl Monks [perlmonks.org] that you probably have no interest in whatsoever.

I also have some modules [cpan.org] on CPAN [cpan.org] some of which are marginally [cpan.org] more [cpan.org] useful [cpan.org] than others.

Journal of runrig (3385)

Wednesday March 24, 2010
01:24 PM

Gearman fun and frustration

I've been using Gearman a lot lately with Gearman::XS. In an effort to reduce boilerplate, I've released GearmanX::Starter to launch Gearman workers.

Other features of the module are signal handling, where if a worker gets a SIGTERM, it'll finish any current task before terminating. To get this to work, I had to use Perl::Unsafe::Signals, otherwise you could not terminate the process while the worker was waiting for a job. It would only terminate after getting a new task from the server (causing the task to fail).

I had an interesting issue converting a worker script to using my GX::S module though...One line had $job->send_complete(1); which tells gearman to send the result "1" and a status of "complete" to the client. However, I was getting an error of "gearman_con_flush:write:14" when the worker was trying to wait for the next job. This didn't happen before I started using GX::S, but it was fixed when I changed the code to $job->send_complete("1"); (with quotes). I can not come up with a simple test case, but just in case someone else has the same issue, here's the possible work around.

Update: This is with Gearman::XS 0.7. It doesn't seem to occur with 0.8, so perhaps it's time to upgrade :-)

Monday November 09, 2009
06:48 PM

Runrig's thousand island salad bar dressing

I haven't seen any recipe posts for quite a while (perhaps for good reason), so I'll go ahead and break that streak.

Ever been to a salad bar where you pay by the ounce (or whatever unit of weight your locality uses)? And then they also make you weigh the salad dressing with the rest of the salad, adding $0.50-$1.00 or more to the cost? Well, say no more! Just go over to the condiments, grab 4 packets of mayo, 2 packets of relish, and 2 packets of ketchup (adjust packets to taste), blend together w/your fork, and enjoy w/your salad.

I don't know how economical this is if they charge 5-10p (as they sometimes did last time I was in the UK) for condiment packets. And if they don't make you weigh the salad dressing, why are you putting it on before weighing it? 8-)

Tuesday August 11, 2009
12:54 PM

Still no Strawberry for me

I'd really like to try out Strawberry Perl, but it'll have to wait 'till I get around to installing it at home, where I do a lot less perl than at work. 'Cuz you need admin rights to install strawberry, and they don't hand that out for work laptops.

ActiveState Perl, on the other hand, does install without admin privs, though with some caveats. ".pl" files don't get associated with Perl, and the global PATH does not get updated.

So, a few workarounds. I create a shortcut to "cmd.exe" that executes %SystemRoot%\system32\cmd.exe /v:on /s /k "set PATH=C:\bin;C:\msys\1.0\bin;C:\Perl\site\bin;C:\Perl\bin;!PATH!", which sets the path to all my favorite places before starting up "cmd.exe". And since you can't doubleclick on a ".pl" file to run it (file extension association, remember?), the pl2bat program becomes more useful, except that it doesn't work, because PATH is not set, so you have to add the path to perl.exe inside the pl2bat program. Last (though not due to admin issues), you need to set the HTTP_PROXY environment variable ('http://user:password@proxyhost', if it's authenticated, which it is for me) for ppm to work, except that it so happens that in my case, setting HTTP_PROXY interferes with Informatica, so I set it in a BEGIN block inside the ppm program itself.

Friday July 24, 2009
11:39 AM

Perl, SSH, and Windows

It's been a while since I've used SSH...most companies I've worked at just use plain telnet. And SSH is one of those things that once set up, you forget about, so you keep having to relearn it. I got two logins set up with public key auth, but a third would only work with a password. I finally learned about the StrictModes setting in the sshd config...the permissions on my home directory were 777. Changed it to not be world-writable and now the public key auth works.

And I've set up my work provided Windows laptop with Perl (of course), Vim, MSYS, and Firefox. I wanted to automate some SFTP file transfers, and was not having any luck/progress with Net::SFTP or Net::SFTP::Foreign and their dependencies. Then a post on perlmonks directed me to Net::SSH2, which does ssh, scp, and sftp. Net::SSH2 is definitely the easiest to get working on Windows.

11:02 AM

New Job

I haven't said anything about it here, but I've been out of work for a while. Until recently. And I don't even have to relocate or commute 100 miles...the new job is just down the street from the old job. In retrospect, I'm glad I didn't get those other positions I interviewed for, even though I was completely qualified for them, and at the time, I thought I really wanted them :-) It's like Adam Corolla said during his last radio show..."It's all for the best...eventually"
Friday March 20, 2009
03:29 PM

Support gauntlet

When you're able to re-create a bug in a 3rd party app, you may think that the hard part is over. Just submit your bug to support, along with a test case, and you're done.

Nope.

Now you need to get the first-level support to understand what the problem is, and is not. Then you need to explain to the 2nd level support what the problem is, and is not. Then you need to get them to actually follow the instructions in your test case. The test case involved perl. It was my mistake assuming that they actually know how to use perl. I'm pretty sure that they do use perl, but when they ask "Can you send us the DBI library", I have doubts. I'm still waiting for them to tell me that it's a feature, not a bug.

Tuesday March 10, 2009
12:34 PM

Blowing your stack on exit

I seriously doubt you'll ever have to worry about this in "real" code, but some comments last night at a talk about "Garbage Collection" got me thinking. The comments were to the effect of how, once, some perl program had lots of data structures and took a "long time" to exit because it first had to clean up all the reference counts. So I tried to come up with a worst case, and threw this together to make a ref to a ref to a ref etc...and was surprised by the result. It didn't take all that long to exit when n was 1 million, but when I bumped it to 2 million, I got a core dump, not when trying to build the data structure, but when the program was exiting. Well, yeah, duh, I guess the reference (un)counting is recursive :-)

my $n = 2_000_000;

my $s = "hello";
my $t = deepref(\$s, $n);
print "Made ref: ";
my $p = scalar(<STDIN>);

sub deepref {
  my ($s,$n) = @_;
  my $r = \$s;
  for (1..$n) {
    my $t = $$r;
    $r = \\$t;
  }
  return $r;
}

Tuesday December 16, 2008
01:20 PM

Friends don't let friends...

...make the homepage of their company website:

<SCRIPT language="javascript">
    window.location.href="home/";
</SCRIPT>

Really, if you want to tell everyone how wonderful your company is, it should be at least just a little bit functional without JavaScript. I wonder if they'll care...

Sunday September 28, 2008
12:47 PM

Saving the planet (and some $$$)

Update: I've decided the sub-title of this post is "I still don't want a pickle: s/motor/bi/"

It's about an 8 mile drive to work, and I decided that it was time to see about riding my bike instead. And there's all sorts of reasons for doing it, and people ask ("But what about...") about all sorts of reasons for not doing it. But the biggest reason is that instead of dreading the drive home and wondering if I should take the freeway or surface streets (and not caring much more about the trip to work), I actually look forward to the commute, each way, whether it's cold and foggy, or hot and sweltering (I'm not yet prepared for rain, so I'll drive if that's the case, 'cuz you know that in Southern California we're afraid of melting if it rains, even a little).

12:37 PM

I Don't Want A Pickle

Once upon a time there was a marine base. And it was decommissioned. And there was some discussion over what to do with the space left by the decommissioned marine base. Some people wanted an airport, some people wanted a park. There was a vote. And the park people won.

And Arlo Guthrie played while a big orange balloon went up and down. And everyone who "thought that guy was dead"[1] got to hear Alice's Restaurant (for free!), and lots of other songs and stories, and it was funny, and entertaining, and a wonderful time was had by all. But we didn't get there early enough to get passes for the Orange Balloon :-(

So a few weeks later, we went back earlier to get passes, rode the Orange Balloon, and listened to some more music (a "Wartime Radio Revue", which was cool, but not Arlo Guthrie... :-), and a wonderful time was had by all (again) :-)

[1] I called my wife Friday morning when I heard on the radio about the show:

  • Me: "Hey, Arlo Guthrie is playing tomorrow night"
  • Her: "Isn't he dead?"

The first thing he said onstage was "I bet some of you heard about this and said "I thought that guy was dead..."