program.pl has lengthy hard to read CONSTANT initalization section

Bug #653168 reported by Dan MacNeil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MVHub
Fix Released
Medium
frank allaby

Bug Description

files:
   app-mvhub/DocumentRoot/cgi-bin/mvhub/program.pl

There are many, many initialization lines like:

my $MODE_REMOVE_PROGRAM = 'remove';

...at the top of the file. You have to read a bunch of kruft before you get a chance to read the block:

{ #main

}

to increase legibility create a create sub routines:

       sub init_consts {
         my %k=(
              MODE_REMOVE_PROGRAM => 'remove',
         # ....
              PROGRAM_APPROVED_TAG => 'program_approved',
           );
          return %k
      }

and:

       sub init_fields_to_copy_from_agency{
           my @fields =qw/
                  address1

              /;
          return @fields;
        }

and then before main do:

  my %k=init_consts();

and then replace $CONSTANT with $k{CONSTANT};

Tags: refactor
Dan MacNeil (omacneil)
Changed in mvhub:
assignee: nobody → Nicholas Lavertue (nlavertue)
tags: added: refactor
removed: refac
Dan MacNeil (omacneil)
Changed in mvhub:
assignee: Nicholas Lavertue (nlavertue) → frank allaby (fallaby)
Dan MacNeil (omacneil)
Changed in mvhub:
status: Confirmed → 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.