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 ]

ddick (5726)

ddick
  (email not shown publicly)

I'm based out of Melbourne, Australia. I attend the excellent melbourne.pm.org meetings whenever i get the chance, which is not often enough.

Journal of ddick (5726)

Wednesday February 06, 2008
05:46 PM

use of perl considered dangerous?

While playing with rpmlint on the rpms i build for $WORK, i was confronted with the following warning message for fedora,

"dangerous-command-in-%pre perl"

a quick check of the responsible script showed that perl was put in the same list as rm,ln,userdel,etc. python of course, was not considered dangerous.

*sigh*

there is a distinct possibility that my sense of humour is seriously lacking. more sleep required, and in the meantime, an addition to the custom rpmlint configuration file.
Monday February 04, 2008
07:34 PM

rpmlint? excellent.

i've been a big fan of debian's lintian project for a while now because when a distribution/operating system goes to the effort of defining "best practice" for building packages, it makes it so much easier for the small software shops to package software that integrates easily with the host. i've only just discovered rpmlint, apparently fufilling the same role for rpm based distributions. anyone know of other operating systems/distribution with a similiar mechanism for detecting the "correctness" of an external software package?
Tuesday November 27, 2007
05:45 PM

where to go for perl with CVE-2007-5116 patch?

I can't figure out how to get a source version of perl with recent security fixes applied to it, or even get a patch to apply to 5.8.8 or similiar. What am i missing?
Tuesday November 20, 2007
11:20 PM

POSIX::close vs close, Expect && Proc::Daemon

Proc::Daemon uses POSIX::close() to close all the existing file descriptors during the daemonising process. However, this seemingly causes a very subtle issue with Expect. If i call
close(STDIN); close(STDOUT); close(STDERR); Proc::Daemon::Init();
then i can use Expect with no problems. However, just calling
Proc::Daemon::Init();
causes Expect to lose track of it's child processes/file handles. Very odd.
Monday October 22, 2007
01:34 AM

Amusing x/platform coding issues

coding on the cygwin platform today, i was impressed by the utter absence, both from the main perl package or in any perl library package of the relatively minor 'Win32' module. However, impressive miss that this is, i don't think this beats the /usr/bin/perl from hpux 11 where 'Config.pm' was considered unworthy of inclusion. Sometimes, i get the thought that people consider cross platform perl code too easy by default, and they try to increase the challenges. Maybe.
Thursday October 11, 2007
12:02 AM

World's first religious TOCTOU issue?

All sort of odd race conditions can spring up if you speed things up enough... What started out as east might not remain so for very long... very similar resolution to a more traditional TOCTOU issue, only one measurement of east is taken, and that is at the start of the prayer.
Thursday October 04, 2007
08:35 PM

new use.perl.org js. konq says ouch!

viewing a journal and descending into the comments has become a pretty horrible experience at least using the default konqueror on suse 10.0 (konq 3.4.2 (Using KDE 3.4.2 Level "b" SUSE 10.0)). Journal pages with comments often completely refresh when you descend through the comments and sometimes lose track of which comment you are viewing. Just thought i would mention it.
Tuesday August 21, 2007
01:18 AM

lots of cpan testers

something seems to have happened recently to bring out lots of cpan testers. I recently fixed up Date::Holidays::AU, which then got 39 passes from cpan testers, about 4 times more than the previous version.

Looking at other minor modules, quite a lot of them seem to be receiving good numbers of testers too.

very cool and much appreciated.

Thursday July 26, 2007
01:28 AM

x/platform mac address retrieval?

How to get a mac address from linux/solaris/aix/hpux/MSWin32? don't think this would be useful enough to send to cpan.org... but for future reference...

#! /usr/bin/perl -w

use strict;
use FileHandle();

MAIN: {
  my ($macAddress);
  if (($^O eq 'linux') || ($^O eq 'solaris') || ($^O eq 'hpux') || ($^O eq 'aix')) {

    $ENV{PATH} = '/sbin:/usr/sbin:/bin:/usr/bin';
    delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};

    my ($ifconfig) = new FileHandle();
    if (my $pid = $ifconfig->open('-|')) {
      my ($buffer);
      unless (defined $ifconfig->read($buffer, 8192)) {
        die("Failed to read from ifconfig:$!");
      }
      if (($^O eq 'linux') || ($^O eq 'solaris')) {
        # linux preceeded by HWaddr, solaris by ether
        if ($buffer =~ /(?:HWaddr +|ether +)([0-9A-Fa-f]{1,2}):([0-9A-Fa-f]{1,2}):([0-9A-Fa-f]{1,2}):([0-9A-Fa-f]{1,2}):([ 0-9A-Fa-f]{1,2}):([0-9A-Fa-f]{1,2})/) {
          $macAddress = formatMac($1, $2, $3, $4, $5, $6);
        }
      } elsif ($^O eq 'hpux') {
        if ($buffer =~ /^0x([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f] {2})([0-9A-Fa-f]{2}) +$/) {
          $macAddress = formatMac($1, $2, $3, $4, $5, $6);
        }
      } elsif ($^O eq 'aix') {
        if ($buffer =~ / +([0-9A-Fa-f]{1,2})\.([0-9A-Fa-f]{1,2})\.([0-9A-Fa-f]{1,2})\.([0-9A-Fa-f]{1,2})\ .([0-9A-Fa-f]{1,2})\.([0-9A-Fa-f]{1,2}) +/) {
          $macAddress = formatMac($1, $2, $3, $4, $5, $6);
        }
      }
      unless ($ifconfig->close()) {
        if (($^O eq 'linux') || ($^O eq 'solaris')) {
          die("Failed to successfully execute 'ifconfig -a':$!");
        } elsif ($^O eq 'hpux') {
          die("Failed to successfully execute 'lanscan -a':$!");
        } elsif ($^O eq 'aix') {
          die("Failed to successfully execute 'netstat -ia':$!");
        } else {
          die("Unknown failure when determining mac address for '$^O'");
        }
      }
    } elsif (defined $pid) {
      eval {
        if (($^O eq 'linux') || ($^O eq 'solaris')) {
          unless (exec({ 'ifconfig' } 'ifconfig', '-a')) {
            die("Failed to execute 'ifconfig -a':$!");
          }
        } elsif ($^O eq 'hpux') {
          unless (exec({ 'lanscan' } 'lanscan', '-a')) {
            die("Failed to execute 'lanscan -a':$!");
          }
        } elsif ($^O eq 'aix') {
          unless (exec({ 'netstat' } 'netstat', '-ia')) {
            die("Failed to execute 'netstat -ia':$!");
          }
        } else {
          die("Failed to find a command to produce the mac address for '$^O'");
        }
      };
      print STDERR $@;
      exit(1);
    } else {
      die("Failed to fork:$!");
    }
  } elsif ($^O eq 'MSWin32') {
    my ($ipconfig) = new FileHandle("ipconfig /all |");
    unless ($ipconfig) {
      die("Failed to 'ipconfig /all':$!");
    }
    my ($buffer);
    unless (defined $ipconfig->read($buffer, 8192)) {
      die("Failed to read from ipconfig:$!");
    }
    if ($buffer =~ /^ +Physical Address(?:\. )+: ([0-9A-Fa-f]{1,2})\-([0-9A-Fa-f]{1,2})\-([0-9A-Fa-f]{1,2})\-([0-9A-Fa-f]{1,2})\- ([0-9A-Fa-f]{1,2})\-([0-9A-Fa-f]{1,2})/m) {
      $macAddress = formatMac($1, $2, $3, $4, $5, $6);
    }
    unless ($ipconfig->close()) {
      die("Failed to close 'ipconfig /all':$!");
    }
  } else {
    die("'$^O' cannot be recognised");
  }
  print "mac address is $macAddress\n";
}

sub formatMac {
  my (@octets) = @_;
  return join(':', map { sprintf('%.2X', hex($_)) } @_);
}

Sunday July 15, 2007
11:34 PM

Australia's character test

The saga over Dr Haneef just gets dumber and dumber. I'm trying hard to believe that our country has an effective and efficient police force, but with the curse of the internet and the ready access to information, this state of mind becomes harder and harder to maintain. According to local papers Dr Haneef, who has been released on bail due to the exceptional weak case the AFP have constructed, has now been detained in an immigration detention centre. Our federal Immigration minister, Kevin Andrews has decided that despite the release on bail, and that whole daft presumption of innocence thingy, Dr Haneef has failed the "character" test. The only possible conclusion i can come to is that he is implying that Dr Haneef is actually innocent and therefore unfit to be living in a land mostly populated by ex-convicts.