[sf-perl] global symbol requires explicit package

Joe McMahon mcmahon at ibiblio.org
Thu Apr 8 14:29:05 PDT 2010

Because you called it "cleanup_subroutine" before, not "cleanup_routine".

A minor cleanup:

use strict;
use warnings;

our $cleanup_subroutine = sub { return 1; };

use Exporter   ();

$VERSION = do {
  my @r = (q$Revision: 1.4 $ =~ /\d+/g);
  sprintf "%d."."%02d" x $#r, @r;

@foo::ISA         = qw( Exporter );
@foo::EXPORT      = qw( $cleanup_subroutine);
@foo::EXPORT_OK   = qw();

sub foo_die {
  defined $cleanup_subroutine and $cleanup_subroutine->();
  exit 255;
} # foo_die


I've moved the cleanup_subroutine declaration to the top as it's more important.
You don't need the BEGIN, so I removed it.
The call syntax I used for the cleanup subroutine is a little cleaner.

 --- Joe M.

More information about the SanFrancisco-pm mailing list