[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

use base or use parent?



ledgersmb has stopped working on my Debian system. Substituting "use 
parent" for "use base" in two modules has 'fixed' the problem.

I believe this is since a recent perl update, but only discovered the 
problem on restarting Starman after upgrading ledgersmb. The problem is 
not specific to one version of ledgersmb - I see the same issue with 
1.3.26 and 1.3.31.

I am running Debian GNU/Linux 8.5 (jessie) with perl 5.20.2 and 
ledgersmb 1.3.31

I try to start ledgersmb with:
# starman --preload-app tools/starman.psgi

But I get an error:

> Error while loading /srv/ledgersmb-1.4.31/tools/starman.psgi:
> Base class package "LedgerSMB::DBObject" is empty.
> (Perhaps you need to 'use' the module which defines that package first,
> or make that module available in @INC... [snip]
> at LedgerSMB/Setting.pm line 53

http://perldoc.perl.org/perlobj.html says:

> ...Much older code also uses the base pragma.
> For new code, we recommend that you use the parent pragma to
> declare your parents. This pragma will take care of setting @ISA.
> It will also load the parent classes and make sure that the
> package doesn't inherit from itself.

changing "use base" for "use parent" in Setting.pm fixes this error.

I then get another error:

> Error while loading /srv/ledgersmb-1.4.31/tools/starman.psgi:
> Base class package "LedgerSMB::Request" is empty.
> (Perhaps you need to 'use' the module which defines that package first,
> or make that module available in @INC... [snip]
> at LedgerSMB.pm line 182.

changing "use base" for "use parent" in LedgerSMB.pm fixes this error. 
Starman then starts and I can use ledgersmb normally.

Frankly I don't understand why "use base" is failing in these two 
locations and why "use parent" behaves differently. I wonder if this 
problem is unique to my setup, or it affects others also. For now I'm up 
and running. I document my steps here in case anybody else encounters a 
similar problem, but I'd also appreciate any words of wisdom to help me 
understand what is happening.

Many thanks,

Nick


------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel