On Fri, Sep 19, 2003 at 11:49:03AM -0400, Jeff Trawick wrote:
> a.k.a. "What should the apxs 2.0 require statement say?"
> 
> apxs says "require 5.003;"
> 
> on an old Sun box with this installation:
> 
> $ which perl
> /opt/LWperl/bin/perl
> $ perl -version
> 
> This is perl, version 5.003 with EMBED
>         built under solaris at Mar 12 1997 03:06:34
>         + suidperl security patch
> 
> Copyright 1987-1996, Larry Wall
> 
> Perl may be copied only under the terms of either the Artistic License 
> or the
> GNU General Public License, which may be found in the Perl 5.0 source kit.
> 
> apxs fails to build a module, giving this error message from Perl:
> 
> Can't modify stub in list assignment at /tmp/trawick/built/bin/apxs line 
> 600, ne
> ar ");"
> 
> Line 600 has
> 
> 597     # the '()=' trick forces list context and the scalar
> 598     # assignment counts the number of list members (aka number
> 599     # of matches) then
> 600     my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg);
> 601     my $cntclose = () = ($before =~ m|^\s*</.*$|mg);

Wow.  I thought anything older than 5.004 could be considered
dead and buried.

Try this:
  my $cntopen = @{[($before =~ m|^\s*<[^/].*$|mg)]};

Or this:
  my $cntopen = 0;
  while ($before =~ m|^\s*<[^/].*$|mg) {
      $cntopen++;
  }

> This silly perl won't even allow var declaration on foreach :)
> 
> foreach my $var (@list)

The 'my' can not be on the foreach line for Perl 5.003.
Just move it one line up.

  my $var;
  foreach $var (@list) {
    ...
  }

Cheers,
Glenn

Reply via email to