[sf-perl] global symbol requires explicit package

David Alban extasia at extasia.org
Thu Apr 8 14:16:05 PDT 2010


i know the error.  just not why i'm getting it this time.

     1  package foo;
     2
     3  use strict;
     4  use warnings;
     5
     6  BEGIN {
     7    use Exporter   ();
     8    our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
     9    $VERSION = do { my @r = (q$Revision: 1.4 $ =~ /\d+/g);
sprintf "%d."."%02d" x $#r, @r };
    10    @ISA         = qw( Exporter );
    11    @EXPORT      = qw(
    12                       $cleanup_subroutine
    13                     );
    14    @EXPORT_OK   = qw();
    15  }
    16  our @EXPORT_OK;
    17
    18  our $cleanup_subroutine = sub { return 1; };
    19
    20  sub foo_die ( @ ) {
    21    defined $cleanup_routine and &{ $cleanup_subroutine }();
    22    exit 255;
    23  } # foo_die
    24
    25  1;


the error:

     $ perl -c junk
     Global symbol "$cleanup_routine" requires explicit package name
at junk line 21.
     junk had compilation errors.

given line 18, i don't understand the error.  what am i missing?

thanks,
david
-- 
Live in a world of your own, but always welcome visitors.


More information about the SanFrancisco-pm mailing list