From: Nicholas Clark Date: Mon, 26 Dec 2005 23:47:01 +0000 (+0000) Subject: Add method macro_from_item to encapsulate the entire logic for getting X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c48e04e60e0b6832c6f967240cc478d08e77d54f;p=p5sagit%2Fp5-mst-13.2.git Add method macro_from_item to encapsulate the entire logic for getting the correct macro direct from the item hash. p4raw-id: //depot/perl@26495 --- diff --git a/lib/ExtUtils/Constant/Base.pm b/lib/ExtUtils/Constant/Base.pm index 69dde25..8dab240 100644 --- a/lib/ExtUtils/Constant/Base.pm +++ b/lib/ExtUtils/Constant/Base.pm @@ -68,6 +68,10 @@ sub macro_from_name { 1; } +sub macro_from_item { + 1; +} + sub macro_to_ifdef { my ($self, $macro) = @_; if (ref $macro) { @@ -371,10 +375,10 @@ sub return_clause { my ($self, $args, $item) = @_; my $indent = $args->{indent}; - my ($name, $value, $macro, $default, $pre, $post, $def_pre, $def_post, $type) - = @$item{qw (name value macro default pre post def_pre def_post type)}; + my ($name, $value, $default, $pre, $post, $def_pre, $def_post, $type) + = @$item{qw (name value default pre post def_pre def_post type)}; $value = $name unless defined $value; - $macro = $self->macro_from_name($item) unless defined $macro; + my $macro = $self->macro_from_item($item); $indent = ' ' x ($indent || 6); unless (defined $type) { # use Data::Dumper; print STDERR Dumper ($item); diff --git a/lib/ExtUtils/Constant/XS.pm b/lib/ExtUtils/Constant/XS.pm index c98583a..010dfbd 100644 --- a/lib/ExtUtils/Constant/XS.pm +++ b/lib/ExtUtils/Constant/XS.pm @@ -143,6 +143,13 @@ sub macro_from_name { $macro; } +sub macro_from_item { + my ($self, $item) = @_; + my $macro = $item->{macro}; + $macro = $self->macro_from_name($item) unless defined $macro; + $macro; +} + # Keep to the traditional perl source macro sub memEQ { "memEQ";