When config file does not set parameters, methods from other modules are not availble to Config.pm in object creation

Bug #1256772 reported by Felipe Figueiredo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MMRRSim
Fix Released
Medium
Felipe Figueiredo

Bug Description

When parameters are used from the default, instead of read from the local config file, methods from Mosquito.pm, Traps.pm, etc. are not available to Config.pm when it creates a new config object. This causes problems in some cases for Config::read_*_file methods.

Correct calling order and make sure all methods are available to these Config.pm methods.

Related branches

Revision history for this message
Felipe Figueiredo (philsf) wrote :

Need to check if this is really a bug.

Changed in mmrrsim:
status: Triaged → New
milestone: none → 0.6.1.1
Revision history for this message
Felipe Figueiredo (philsf) wrote :

It is, indeed, a bug. When default attributes from Mosquito.pm and Trap.pm are not read from the config file, they are not set in the Config->params attribute, and thus are not availble early enough to be called, for example, from MMRRSim::log_header().

Changed in mmrrsim:
status: New → Triaged
Revision history for this message
Felipe Figueiredo (philsf) wrote :

A simple work-around this issue is to simply uncomment the parameters in the default config file. This would make all default values defined when the config file is checked.

Revision history for this message
Felipe Figueiredo (philsf) wrote :

Solution from IRC (ref to Moose::Manual::Attributes): remove default values from Mosquito.pm and Trap.pm, and store them in Config.pm (similarly to what's done in TRepid).

Changed in mmrrsim:
status: Triaged → In Progress
Changed in mmrrsim:
status: In Progress → Fix Committed
Revision history for this message
Felipe Figueiredo (philsf) wrote :

A regression detected when config file is not present, because read_config_file() returns too soon to get the default values was fixed in branch lp:~philsf/mmrrsim/fix-lp-1260621. Go back here and finish getting/setting the defaults for the other two classes: MMRRSim.pm and GridCell.pm, as defined in the config file.

Changed in mmrrsim:
status: Fix Committed → In Progress
Changed in mmrrsim:
status: In Progress → Fix Committed
Changed in mmrrsim:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.