Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: use statement seemingly ignored

by davido (Cardinal)
on Nov 15, 2022 at 20:18 UTC ( [id://11148189]=note: print w/replies, xml ) Need Help??


in reply to use statement seemingly ignored

At the top of your code, after all the use statements, put the following:

warn "NCPS::Meets found at $INC{'NCPS/Meets.pm'}\n"; warn "Is NCPS::Meets a subclass of Exporter? ", NCPS::Meets->isa('Exporter') ? "Yes\n" : "No\n"; warn "Can NCPS::Meets export getMeetInfo? ", (0 != grep {$_ eq 'getMeetInfo'} @EXPORT, @EXPORT_OK) ? "Yes\n" : + "No\n";

This is really only useful if the modules are based on Exporter. There are other export modules out there.

If this doesn't reveal anything interesting, look at the version of NCPS::Meets that is found at $INC{'NCPS/Meets.pm'} when the code is run from the same invocation that you're getting the errors from. And if this is some sort of a web application, which it appears to be, verify that you've restarted the application. If it's running as mod_perl, make sure Apache has restarted.

It's unlikely that you would get this error message if the version of NCPS::Meets first found in @INC is an Exporter, and does export getMeetInfo.


Dave

Replies are listed 'Best First'.
Re^2: use statement seemingly ignored
by wolfie7873 (Novice) on Nov 15, 2022 at 20:44 UTC
    I tried what you said thusly:
    package NCPS::Results; use strict; use warnings; use lib '/var/www/html/lib' ; use NCPS::UTIL qw/prepareExecute pretty_time getTableColumns input_tim +e convertTime getInfoById / ; use NCPS::Meets qw/getMeetInfo getEventLayout getPointsParadigm getEve +ntLayout2 /; use NCPS::Teams qw/getTeamInfo getAthlete/ ; use NCPS::Events qw/getEventInfo/ ; use NCPS qw/debug logtime /; use Data::Dumper ; $Data::Dumper::Sortkeys = 1 ; $Data::Dumper::Indent = 1 ; my $debug = 1 ; our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); warn "NCPS::Meets found at $INC{'NCPS/Meets.pm'}\n" ; warn "Is NCPS::Meets a subclass of Exporter? ", NCPS::Meets->isa('Expo +rter') ? "Yes\n" : "No\n" ; warn "Can NCPS::Meets export getMeetInfo? ", (0 != grep { $_ eq 'getMe +etInfo'} @EXPORT_OK) ? "Yes\n" : "No\n" ; @EXPORT_OK = qw/ getTeamIdFromAbbr getMeetResults getTeamResults getResultDetail insertResult insertSplits insertRelay insertLeadoff getEventResults sortEventResults getScores getEventScores setEventScore updateMeetScores setMeetScore getCumulativeScores getPerformancePoints convertMeetToNWayDual scoreEvent addScoresAfterTheFact setResultScoreAndPlace deleteResult getEventIDFromResultRecord getLeadOffSplit updateMeetTimeStamp /; }
    And I tested the module syntax command-line:
    root@ncps-modperl-prod:/var/www/html/lib/NCPS# perl -ctw Results.pm NCPS::Meets found at /var/www/html/lib/NCPS/Meets.pm Is NCPS::Meets a subclass of Exporter? No Can NCPS::Meets export getMeetInfo? No NCPS::Meets found at /var/www/html/lib/NCPS/Meets.pm Is NCPS::Meets a subclass of Exporter? Yes Can NCPS::Meets export getMeetInfo? No Subroutine getPerformancePoints redefined at Results.pm line 58. Subroutine getTeamIdFromAbbr redefined at Results.pm line 104. Subroutine getMeetResults redefined at Results.pm line 112. Subroutine getTeamResults redefined at Results.pm line 126. Subroutine getResultDetail redefined at Results.pm line 256. Subroutine insertResult redefined at Results.pm line 296. Subroutine insertSplits redefined at Results.pm line 389. Subroutine insertRelay redefined at Results.pm line 421. Subroutine getEventResults redefined at Results.pm line 453. Subroutine sortEventResults redefined at Results.pm line 650. Subroutine getEventScores redefined at Results.pm line 718. Subroutine scoreEvent redefined at Results.pm line 745. Subroutine updateMeetTimeStamp redefined at Results.pm line 854. Subroutine getScores redefined at Results.pm line 863. Subroutine setEventScore redefined at Results.pm line 888. Subroutine updateMeetScores redefined at Results.pm line 919. Subroutine setMeetScore redefined at Results.pm line 939. Subroutine getCumulativeScores redefined at Results.pm line 988. Subroutine convertMeetToNWayDual redefined at Results.pm line 1016. Subroutine addScoresAfterTheFact redefined at Results.pm line 1098. Subroutine setResultScoreAndPlace redefined at Results.pm line 1132. Subroutine deleteResult redefined at Results.pm line 1147. Subroutine getEventIDFromResultRecord redefined at Results.pm line 117 +3. Subroutine getLeadOffSplit redefined at Results.pm line 1194. Subroutine insertLeadoff redefined at Results.pm line 1254. Results.pm syntax OK
    I double checked Meets.pm here:
    package NCPS::Meets; use strict; use warnings; use feature qw( switch ); no warnings qw( experimental::smartmatch ); use lib '/var/www/html/lib' ; use NCPS qw/ debug / ; use NCPS::UTIL qw/prepareExecute display_event display_event2 getInfoB +yId/ ; use NCPS::Teams qw/getTeamInfo/ ; my $debug = 1 ; our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw/ createMeet addMeetDirector addTeamsToMeet setupEventScores getEventStatus changeEventStatus getMeetInfo getMeetRoster getEventLayout getEventLayout2 getMyMeets getPointsParadigm getAllEventLayouts getAllScoringLayouts getAllFacilities getSubMeets getEventIDFromEventOrder getPointsLayout checkMeetId clearMeet getMeetsToEnter addDiveCat pastDeadline getReferees getMeetsToCertify getOfficials /; }
    I'm guessing all those redefined statements indicate a rather serious problem somewhere. I'll follow that thread.

      Why are you getting the output twice?

      NCPS::Meets found at /var/www/html/lib/NCPS/Meets.pm Is NCPS::Meets a subclass of Exporter? No Can NCPS::Meets export getMeetInfo? No NCPS::Meets found at /var/www/html/lib/NCPS/Meets.pm Is NCPS::Meets a subclass of Exporter? Yes Can NCPS::Meets export getMeetInfo? No Subroutine getPerformancePoints redefined at Results.pm line 58. Subroutine getTeamIdFromAbbr redefined at Results.pm line 104. Subroutine getMeetResults redefined at Results.pm line 112.

      Why are you getting "redefined" warnings?

      How is NCPS::Results getting loaded (twice)?

      Notice how you're getting two different answers to the same question, presumably because a redefinition has happened?

      Is NCPS::Meets a subclass of Exporter? No ... Is NCPS::Meets a subclass of Exporter? Yes

      Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148189]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-20 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found