You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Mattias Engdeg�rd <ma...@virtutech.se> on 2006/03/21 17:51:53 UTC

Export more API functions to Perl clients

There are more Swig-wrapped Perl bindings than are actually exported through
the corresponding Perl modules, which is rather frustrating - the functions
are there but they can't be used.

I keep adding the ones I need but maintaining a local patch isn't a tenable
long-term strategy, so what about something like this?

[[
Add more recent (1.1 and later) API functions to the Perl bindings.
* subversion/bindings/swig/perl/native/Client.pm
  Refactor list of exported API functions, and include those missing, except
  ones marked deprecated.
]]
Index: subversion/bindings/swig/perl/native/Client.pm
===================================================================
--- subversion/bindings/swig/perl/native/Client.pm	(revision 18977)
+++ subversion/bindings/swig/perl/native/Client.pm	(working copy)
@@ -5,12 +5,22 @@
 use SVN::Wc;
 
 package SVN::Client;
-use SVN::Base(qw(Client svn_client_ checkout update switch add mkdir delete
-                 commit status log blame diff merge cleanup relocate
-                 revert resolved copy move revprop_set propset
-                 proplist revvprop_list export ls cat import propget
-                 uuid_from_url uuid_from_path url_from_path revprop_get
-                 revprop_list info)); 
+my @_all_fns;
+BEGIN {
+    @_all_fns = qw(add add3 blame blame3 cat cat2 checkout checkout2 cleanup
+                   commit commit3 commit_item2_dup copy copy3 delete delete2
+                   diff diff3 diff_peg3 diff_summarize diff_summarize_peg
+                   export export3 import import2 info info_dup list lock
+                   log log2 log3 ls ls3
+                   merge merge2 merge_peg2 mkdir mkdir2 move move4
+                   propget propget2 proplist proplist2 proplist_item_dup
+                   propset propset2 relocate resolved revert
+                   revprop_get revprop_list revprop_set
+                   status status2 switch unlock update update2
+                   url_from_path uuid_from_path uuid_from_url);
+    require SVN::Base;
+    import SVN::Base (qw(Client svn_client_), @_all_fns);
+}
 
 =head1 NAME
 
@@ -820,13 +830,7 @@
 
 # import methods into our name space and wrap them in a closure
 # to support method calling style $ctx->log()
-foreach my $function (qw(checkout update switch add mkdir delete commit
-                       status log blame diff merge cleanup relocate
-                       revert resolved copy move revprop_set propset
-                       proplist revvprop_list export ls cat import
-                       propget uuid_from_url uuid_from_path
-                       url_from_path revprop_get revprop_list
-                       info))
+foreach my $function (@_all_fns)
 {
     no strict 'refs';
     my $real_function = \&{"SVN::_Client::svn_client_$function"};



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

Re: Export more API functions to Perl clients

Posted by Mattias Engdegård <ma...@virtutech.se>.
Peter Samuelson <pe...@p12n.org> writes:

>Isn't there any way to hide the interface revs behind the bindings?
>Like most scripting languages, Perl can be much more polymorphic than
>C.  It's not like the API matches up exactly anyway, unless you expect
>Perl apps to manage pools manually.

I agree on principle and I briefly considered this as well, but it
would require considerably heavier glue scriptery than I was prepared
to spend time on. Given the apparent orphaned state of the Perl bindings
(won't install properly, and lacks most calls added since 1.1 or 1.2),
I was aiming for a minimal amount of changes to improve matters without
breaking anything else, not claiming maintainership.


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

Re: Export more API functions to Perl clients

Posted by Peter Samuelson <pe...@p12n.org>.
[Mattias Engdegård]
> +    @_all_fns = qw(add add3 blame blame3 cat cat2 checkout checkout2 cleanup
> +                   commit commit3 commit_item2_dup copy copy3 delete delete2
> +                   diff diff3 diff_peg3 diff_summarize diff_summarize_peg
> +                   export export3 import import2 info info_dup list lock
> +                   log log2 log3 ls ls3
> +                   merge merge2 merge_peg2 mkdir mkdir2 move move4
> +                   propget propget2 proplist proplist2 proplist_item_dup
> +                   propset propset2 relocate resolved revert
> +                   revprop_get revprop_list revprop_set
> +                   status status2 switch unlock update update2
> +                   url_from_path uuid_from_path uuid_from_url);

Isn't there any way to hide the interface revs behind the bindings?
Like most scripting languages, Perl can be much more polymorphic than
C.  It's not like the API matches up exactly anyway, unless you expect
Perl apps to manage pools manually.

Maybe it is wishful thinking on my part.