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 ]

jjohn (22)

jjohn
  (email not shown publicly)
http://taskboy.com/
AOL IM: taskboy3000 (Add Buddy, Send Message)

Perl hack/Linux buff/OSS junkie.

Journal of jjohn (22)

Wednesday April 10, 2002
10:08 AM

From my Perl blooper reel

[ #4086 ]

Here's some fun at my expense. This kept me in stitches for most of yesterday. After a good night's sleep (and more methodical debugging), I tracked the problem down to this block:

sub find_referral_by_ip {
  my($self, $ip, $dbh) = @_;

  # ... non-related code omitted

  unless($ip){
    my $ip = $r->connection->remote_ip;
  }

The intention here is to get the IP address of the current request if it wasn't passed in (yup, it's mod_perl). In otherwords, if $ip isn't populated then ensure it is. Normally, I don't pass in the IP, since this method will figure out the IP on its own, right? I began wondering: "should I be looking a subrequest? Is my sql [not shown here] broken? What's going on here?!"

Have you seen the problem yet? Here's a hint: it has NOTHING to do with mod_perl, a bug in Perl or the way Perl handles method calls.

The upshot is that I'm an idiot.

Thank you!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.