Tuesday, September 8, 2009

Application Variables during Upgrade

A quick note related to my previous post: it turns out the application controller gives "old values" for application variables during the code upgrade process. Therefore the call to

element (2, application:get_key (drurly, modules))

returns the old list of modules, i.e., is missing new modules. ct_expand to the rescue! I get the list of modules at compile time from the application specification via

Modules =
ct_expand:term (
begin
{ ok, [ { application, drurly, PropList } ] } =
file:consult ("drurly.app"),
case proplists:get_value (modules, PropList) of
Y when is_list (Y) -> Y
end
end
),

For this to work, you must ensure the application specification is generated prior to compiling the module with this function in it.

No comments:

Post a Comment