Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Deparse produces different output for a different user

by jameshow (Initiate)
on Oct 06, 2010 at 22:11 UTC ( #863875=perlquestion: print w/ replies, xml ) Need Help??
jameshow has asked for the wisdom of the Perl Monks concerning the following question:

I am struggling with a large legacy module that compiles for one user and not for another user on the same system. I've run Deparser against the same file using the two different users and it produces unexpectedly different output.

root # perl -MO=Deparse webDB.pm package webDB; sub BEGIN { use strict 'refs'; require vars; do { 'vars'->import('$VERSION', '@ISA', '@EXPORT', '@EXPORT_OK') }; } use strict 'refs'; require Exporter; @ISA = 'Exporter'; @EXPORT = (); @EXPORT_OK = (); $VERSION = '1.00'; use DBI;

root has no trouble with this module, reporting syntax ok. But another user...

cabocron # perl -MO=Deparse webDB.pm Undefined subroutine &webDB::getRecord called at webSubs.pm line 1233. Compilation failed in require at webDB.pm line 26. BEGIN failed--compilation aborted at webDB.pm line 26. package webDB; sub BEGIN { use strict 'refs'; require vars; do { 'vars'->import('$VERSION', '@ISA', '@EXPORT', '@EXPORT_OK') }; } use DBI; ...

What would cause Deparser to produce different output for the same file, but different users? And what happened to Exporter for the second user?

I've looked at the environment and they seem identical. I also checked that both users are using the same perl executable. I have also been unsuccessful in creating a generic case, and this problem only occurs on our live server, not our development environment (naturally).

Any wisdom of the monks would be appreciated.

Comment on Deparse produces different output for a different user
Select or Download Code
Re: Deparse produces different output for a different user
by runrig (Abbot) on Oct 06, 2010 at 22:18 UTC

    getRecord() is not getting imported into webSubs.pm.

    webSubs.pm might need a 'use lib' statement or you might want to set PERL5LIB in the environment that doesn't work. The difference is probably either the PERL5LIB or PERLLIB variable(s) (see perlrun), or the directory that the program is run from (if the libraries(s) are in the same directory that the program is run from in the environment that works...the current directory is automatically included in the list of library directories).

      Thanks, runrig.

      use lib is set in webSubs for the location that contains webDB and I'm running the Deparse for both users from the same place, which contains both webDB and webSubs.

      I also added that location to PERL5LIB and still have the problem with the one user. The @INC is the same for both users, and includes the location of both webSubs and webDB.

      So the missing require Exporter; from the Deparse output of the user that doesn't work shouldn't be a concern? Does bad environment or another problem cause that line to go missing?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://863875]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-08-30 11:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls