[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] perl swig bindings failure in svn 1.1.0

From: Ben Reser <ben_at_reser.org>
Date: 2004-10-08 18:55:33 CEST

On Thu, Oct 07, 2004 at 01:42:10PM -0700, J Robert Ray wrote:
> >The error you got is indicitive of an attempt to change a constant.
> >$SVN::Core::VERSION shouldn't be a constant. Though this might be
> >related to the addtiion of svn_*_version() functions to the various
> >libraries. But Perl has case sensitive namespaces... So VERSION
> >shouldn't be mapping to a constant since there is no svn_VERSION.
>
> In core.c, I see a bunch of constants being defined here. e.g.:
>
> { SWIG_STRING, (char *) SWIG_prefix "SVN_KEYWORD_REVISION_LONG", 0, 0,
> (void *)"LastChangedRevision", 0},
> ...
> { SWIG_STRING, (char *) SWIG_prefix "SVN_VERSION", 0, 0, (void *)"1.1.0
> (dev build, r2)", 0},

Humm yeah looks like there is a SVN_VERSION in svn_version.h now. For
whatever reason I didn't see any (svn|SVN)_VERSION symbol when I
looked...

> I can see the values of any of these by stripping off the SVN_ prefix:
>
> > perl -MSVN::Core -le 'print $SVN::Core::KEYWORD_REVISION_LONG'
> LastChangedRevision
>
> > perl -MSVN::Core -le 'print $SVN::Core::VERSION'
> 1.1.0 (dev build, r2)

Correct.

> Looking more closely at Base.pm, line 71 is:
>
> next unless s/^$prefix//i;
>
> It is doing a case insensitive comparison for the symbol prefix. So
> even though SVN::Core passes in 'svn_' as the prefix, it matches all the
> SVN_* symbols too.

That's intentional. We want thos symbols...

> It doesn't feel like a perl bug to me, based on what I show above.

For whatever reason I'm seeing what you're seeing but not getting any
complaints from Perl about it...

See if the following patch fixes the problem for you:

Index: subversion/bindings/swig/perl/native/Core.pm
===================================================================
--- subversion/bindings/swig/perl/native/Core.pm (revision 11275)
+++ subversion/bindings/swig/perl/native/Core.pm (working copy)
@@ -2,7 +2,7 @@
 use warnings;
 
 package SVN::Core;
-use SVN::Base qw(Core svn_);
+use SVN::Base qw(Core svn_ VERSION);
 $SVN::Core::VERSION = "$SVN::Core::VER_MAJOR.$SVN::Core::VER_MINOR." .
                       "$SVN::Core::VER_MICRO";
 
Index: subversion/bindings/swig/perl/native/Base.pm
===================================================================
--- subversion/bindings/swig/perl/native/Base.pm (revision 11275)
+++ subversion/bindings/swig/perl/native/Base.pm (working copy)
@@ -70,7 +70,7 @@
        my $name = $_;
        next unless s/^$prefix//i;
     foreach my $ignored_symbol (@ignore) {
- next SYMBOL if ("$prefix$ignored_symbol" eq $name);
+ next SYMBOL if ($name =~ /^(?i:$prefix)$ignored_symbol$/);
     }
 
        # insert the accessor

-- 
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 8 18:55:58 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.