Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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 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 Undefined subroutine &webDB::getRecord called at line 1233. Compilation failed in require at line 26. BEGIN failed--compilation aborted at 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.

Replies are listed 'Best First'.
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 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://863875]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2018-06-24 11:24 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.