← Back to team overview

mvhub-dev team mailing list archive

Re: Calling update_cpan_libs

 


Hi Emaad

(see below)

On 08/07/2011 11:00 AM, Emaad Ahmed Manzoor wrote:
Hi Dan,

I'm trying to call update_cpan_libs like this:

use MVHub::Utils::Setup;

MVHub::Utils::Setup::update_cpan_libs()
     or die "Could not update CPAN libraries\n";

For some reason, it's running into this:

Can't locate SQL/Library.pm in @INC (@INC contains: /etc/perl
/usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10
/usr/local/lib/site_perl .) at /usr/share/perl5/MVHub/Utils/DB.pm line 8.

BEGIN failed--compilation aborted at /usr/share/perl5/MVHub/Utils/DB.pm line
8.
Compilation failed in require at /usr/share/perl5/MVHub/Utils/Setup.pm line
18.

BEGIN failed--compilation aborted at /usr/share/perl5/MVHub/Utils/Setup.pm
line 18.

Setup.pm has this on line 18:

use MVHub::Utils::DB;

I tried using this too:

use MVHub::Utils::Setup qw(update_cpan_libs);

But it runs into the same issue.

-- Emaad Ahmed Manzoor

FIRST GUESS

SQL::Library isn't installed on your local system. This seems unlikely, as you've been using it all along, but I've never seen this error msg unless the library isn't missing.

what do you get from:

	sudo updatedb
	locate Library.pm | grep SQL

..if you get:
	...SQL/Library.pm

...is it in one of the dirs that make up  @INC  ?

> use MVHub::Utils::DB;

MORE THOUGHTS

> use MVHub::Utils::DB;

Assuming for the moment that SQL::Library isn't installed...

As you observe, this is probably the line that is the source of your immediate problem. MVHub::Utils::DB uses SQL::Library and (indirectly) so does MVHub::Utils::Setup in a bunch of places example: get_db_version()

...and a pointer to a general class of circular dependency problems.

MVHub::Utils::Setup is responsible for installing modules from CPAN, but it depends on modules that haven't been installed.

Some possible solutions:

  1) make Debian packages from the CPAN packages we need
  2) break off MVHub::Utils::Setup::CPANLibs

	a. don't use libs that aren't part of Perl-core
           or installed as Debian packages (assuming that
	   happens before preinst)

	b. call update_cpan_libs() from debian package
           preinst script	

Sadly, MVHub::Utils::Setup::CPANLibs isn't likely to be installed/usable from preisnt. Maybe (ugh!) copy 'n paste
update_cpan_libs() into preinst


   3) play games with BEGIN {} eval 'use SQL::Library;'

   4) Ask http://perlmonks.org  , http://pkg-perl.alioth.debian.org/
      http://lists.debian.org/debian-webapps/

The Right Way (tm) to deal with this is to package the modules we need as Debian packages. We'll need to do this to get the user-orientated package into Debian/Ubuntu

preinst may be less work, but if starts to get ugly, I'd look at #4 or #1

...Of course everything changes if SQL::Library is in fact installed.