Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install Perl's SVN::Client?

Tags:

svn

perl

cpan

I want to use the SVN::Client cpan module to check out code from a repository.

But how to install and use this module? The documentation is kind of no existing.

I have tried install the Alien::SVN module both through cpan and build it myself. And it seems to install okay. No error messages, and when i go into cpan again and do the following it states that the Alien::SVN module is installed.

cpan> install Alien::SVN 
Alien::SVN is up to date. 

Here is my class that uses the SVN::Client:

use strict;
use warnings;
use Alien::SVN;
use SVN::Client;


sub new {
 my $self = {
  localpath => ''
 };
 bless($self);
 return $self;
}

sub update_repository{
 my ($self) = @_;

 my $svn = SVN::Client->new();
 return $svn->update($self->_getPath(), 'HEAD', 1);
}
sub _getPath{
 my ($self) = @_;
 return $self->{localpath};
}

So when i use a script to call the update repository method of this class i get the following error:

Can't locate SVN/Client.pm in @INC (@INC contains: /opt/STS /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /
usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /opt/STS/svn.pm line 7.

I have also tried changing use SVN::Client with use Alien::SVN but with no luck.

Does anyone have a working example of code, or a helpful tip to make the Alien::SVN / SVN::Client work?

like image 212
Joakim Avatar asked Mar 31 '10 12:03

Joakim


3 Answers

Install the package subversion-perl.

like image 51
daxim Avatar answered Nov 12 '22 08:11

daxim


Follow following steps to install Alien-SVN module on you system:

1) Download the latest Alien-SVN module from CPAN http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/Alien-SVN-v1.6.12.1.tar.gz

2) Untar the file using taz-zxf <Package_name>

3) cd Alien-SVN-v1.6.12.1

4) The Apache Portable Runtime is required by the Alien-SVN. To download APR and APR-Util run time run the following commands while inside Alien-SVN-v1.6.12.1 directory

svn co http://svn.apache.org/repos/asf/apr/apr/branches/1.2.x \apr
svn co  http://svn.apache.org/repos/asf/apr/apr-util/branches/1.2.x \apr-util

5) Now run perl Build.PL which is inside Alien-SVN-v1.6.12.1 directory

6) It will ask for some options

7) It will ask whether you would like to pass some arguments to configure. Give arguments as follows

--with-apr=<path_where_you_chechek_out_apr> --with-apr-util=<path_where_you_chechek_out_apr-util>

8) After successfully running Build.PL, run ./Build Alien-SVN-v1.6.12.1 directory.

9) After running ./Build, successfully, open native directory which is located as Alien-SVN-v1.6.12.1/src/subversion/subversion/bindings/swig/perl/native

10) Run following commands: perl Makefile.PL make make install

11) This will install Alien-SVN on your system :)

like image 33
AnonGeek Avatar answered Nov 12 '22 08:11

AnonGeek


As best I can tell, Alien::SVN and its constituent modules are no longer maintained. The subversion binary it compiles is extremely old (1.4, circa 2006). You may be better off piping to a pre-installed (and up-to-date) binary.

like image 2
Richard Simões Avatar answered Nov 12 '22 09:11

Richard Simões