You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Garrett Rooney <ro...@electricjellyfish.net> on 2003/12/17 00:58:03 UTC

Problem with SVN::Client perl module

So I've been playing with the Perl bindings lately, and I've been 
having some trouble with the SVN::Client module.  When I import it I 
get the following error:

$ cat foo.pl
use SVN::Core;
use SVN::Client;
$ perl foo.pl
Usage: svn_client_import(path,url,nonrecursive,ctx,pool); at foo.pl 
line 2.
BEGIN failed--compilation aborted at foo.pl line 2.
$

The problem turns out to be in Base.pm.  We redefine the 'import' 
function so that we set up the perl version of svn_client_import, and 
it blows up later on when we try to call the perl import subroutine.  
I'm currently using the following hack to work around it, but I'm 
pretty sure it's the wrong solution...

Index: Base.pm
===================================================================
--- Base.pm     (revision 8017)
+++ Base.pm     (working copy)
@@ -76,6 +76,7 @@
         elsif (m/(.*)_set$/) {
         }
         else {
+            if ($_ eq "import") { $_ = "do_import"; }
             *{"${caller}::$_"} = ${"SVN::_${pkg}::"}{$name};
         }
      }

Any thoughts from the Perl gurus out there?

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Problem with SVN::Client perl module

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Dec 17, 2003, at 8:28 AM, Chia-Liang Kao wrote:

> And that's why the pod synopsis is suggesting require instead of use. 
> :)
>

Oh sure, now you're expecting me to actually read the documentation...

;-)

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Problem with SVN::Client perl module

Posted by Chia-Liang Kao <cl...@clkao.org>.
And that's why the pod synopsis is suggesting require instead of use. :)

Cheers,
CLK

On Wed, Dec 17, 2003 at 10:35:17AM +0100, Erik Huelsmann wrote:
> > The problem turns out to be in Base.pm.  We redefine the 'import' 
> > function so that we set up the perl version of svn_client_import, and 
> > it blows up later on when we try to call the perl import subroutine.  
> > I'm currently using the following hack to work around it, but I'm 
> > pretty sure it's the wrong solution...
> 
> The only way I've successfully used the bindings is to use 'require' (which
> doesn't use import) instead of 'use'. 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Problem with SVN::Client perl module

Posted by Erik Huelsmann <e....@gmx.net>.
> So I've been playing with the Perl bindings lately, and I've been 
> having some trouble with the SVN::Client module.  When I import it I 
> get the following error:
> 
> $ cat foo.pl
> use SVN::Core;
> use SVN::Client;
> $ perl foo.pl
> Usage: svn_client_import(path,url,nonrecursive,ctx,pool); at foo.pl 
> line 2.
> BEGIN failed--compilation aborted at foo.pl line 2.
> $
> 
> The problem turns out to be in Base.pm.  We redefine the 'import' 
> function so that we set up the perl version of svn_client_import, and 
> it blows up later on when we try to call the perl import subroutine.  
> I'm currently using the following hack to work around it, but I'm 
> pretty sure it's the wrong solution...

The only way I've successfully used the bindings is to use 'require' (which
doesn't use import) instead of 'use'. 

HTH,

bye,

Erik.

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Problem with SVN::Client perl module

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Dec 16, 2003, at 10:57 PM, Ben Reser wrote:

> Yeah I was aware of this I just hadn't tracked this issue down yet.
> I think the best way would be to wrap the import function so that it
> detects how it's being called (as an import from use or as import for
> subversion).  Shouldn't be hard to detect.  Calls to the real svn 
> import
> function will always start with a ref blessed as
> '_p_svn_client_commit_info_t'.  Also once we move to the OO style calls
> we'll have the ctx as the first item.
>
> I can't imagine a scenario where someone would pass such a ref to use.
>
> So it's on my fix list.  I just need to finish up this prompt stuff and
> then I'll look at it.

Fantastic, that sounds like an excellent work around for the problem.

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Problem with SVN::Client perl module

Posted by Ben Reser <be...@reser.org>.
On Tue, Dec 16, 2003 at 07:58:03PM -0500, Garrett Rooney wrote:
> So I've been playing with the Perl bindings lately, and I've been 
> having some trouble with the SVN::Client module.  When I import it I 
> get the following error:
> 
> $ cat foo.pl
> use SVN::Core;
> use SVN::Client;
> $ perl foo.pl
> Usage: svn_client_import(path,url,nonrecursive,ctx,pool); at foo.pl 
> line 2.
> BEGIN failed--compilation aborted at foo.pl line 2.
> $
> 
> The problem turns out to be in Base.pm.  We redefine the 'import' 
> function so that we set up the perl version of svn_client_import, and 
> it blows up later on when we try to call the perl import subroutine.  
> I'm currently using the following hack to work around it, but I'm 
> pretty sure it's the wrong solution...
> 
> Index: Base.pm
> ===================================================================
> --- Base.pm     (revision 8017)
> +++ Base.pm     (working copy)
> @@ -76,6 +76,7 @@
>         elsif (m/(.*)_set$/) {
>         }
>         else {
> +            if ($_ eq "import") { $_ = "do_import"; }
>             *{"${caller}::$_"} = ${"SVN::_${pkg}::"}{$name};
>         }
>      }
> 
> Any thoughts from the Perl gurus out there?

Yeah I was aware of this I just hadn't tracked this issue down yet.
I think the best way would be to wrap the import function so that it
detects how it's being called (as an import from use or as import for
subversion).  Shouldn't be hard to detect.  Calls to the real svn import
function will always start with a ref blessed as
'_p_svn_client_commit_info_t'.  Also once we move to the OO style calls
we'll have the ctx as the first item.

I can't imagine a scenario where someone would pass such a ref to use.  

So it's on my fix list.  I just need to finish up this prompt stuff and
then I'll look at it.

-- 
Ben Reser <be...@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