From 551f599a61d56fa0f711d98404052e6bb550cb83 Mon Sep 17 00:00:00 2001 From: "James E. Keenan" Date: Sat, 27 Mar 2010 12:47:16 -0400 Subject: [PATCH] Declare global instance as a stepping stone to an OO ExtUtils::ParseXS Declare 'our' variable $self and move the first package global ($ProtoUsed) into it. --- dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index 1c07c3a..57ed120 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -30,7 +30,7 @@ our $VERSION = '3'; $VERSION = eval $VERSION if $VERSION =~ /_/; our ( - $ProtoUsed, @InitFileCode, $FH, $proto_re, $Overload, $errors, $Fallback, + @InitFileCode, $FH, $proto_re, $Overload, $errors, $Fallback, $hiertype, $WantPrototypes, $WantVersionChk, $WantLineNumbers, $filepathname, $dir, $filename, %IncludedFiles, %input_expr, %output_expr, %type_kind, %proto_letter, $BLOCK_re, $lastline, $lastline_no, $Package, @@ -45,12 +45,14 @@ our ( ); our ($DoSetMagic, $newXS, $proto, $Module_cname, $XsubAliases, $Interfaces, $var_num, ); +our $self = {}; + sub process_file { # Allow for $package->process_file(%hash) in the future my ($pkg, %options) = @_ % 2 ? @_ : (__PACKAGE__, @_); - $ProtoUsed = exists $options{prototypes}; + $self->{ProtoUsed} = exists $options{prototypes}; # Set defaults. my %args = ( @@ -1061,7 +1063,7 @@ EOF EOF warn("Please specify prototyping behavior for $filename (see perlxs manual)\n") - unless $ProtoUsed; + unless $self->{ProtoUsed}; chdir($orig_cwd); select($orig_fh); @@ -1434,7 +1436,7 @@ sub PROTOTYPE_handler () { # If no prototype specified, then assume empty prototype "" $ProtoThisXSUB = 2 unless $specified; - $ProtoUsed = 1; + $self->{ProtoUsed} = 1; } sub SCOPE_handler () { @@ -1459,7 +1461,8 @@ sub PROTOTYPES_handler () { $WantPrototypes = 1 if $1 eq 'ENABLE'; $WantPrototypes = 0 if $1 eq 'DISABLE'; - $ProtoUsed = 1; + $self->{ProtoUsed} = 1; + } sub PushXSStack { -- 2.7.4