HOWTO migrate a CGI
Converting CGIs is relatively easily is you use the following guidelines. The most confusing part is juggling information between sources. You'll need to have several documents open and refer to browser views of the old site periodically so get organized first.
Contents
- 1 1. Take a look at the original page on dev.wormbase.org
- 2 2. Open the existing CGI
- 3 3. Create a new model
- 4 4. Start ripping code from the CGI into the new model
- 5 5. Add configuration for widgets and fields to WormBase.pm
- 6 6. Create a new controller
- 7 7. Add get_object method to controller
- 8 8. Freeze CGI if warranted and commit to CVS
1. Take a look at the original page on dev.wormbase.org
Explore a few different objects to get a sense for how the page performs with different conditions. Note the sections and subsections. These will become widgets and fields in the configuration.
2. Open the existing CGI
All the old CGIs are in the svn repository in old_site-deprecating
.
3. Create a new model
script/wormbase_create.pl controller Your_class
4. Start ripping code from the CGI into the new model
Preface each line of the CGI that migrates successfully with #++
. Preface problem areas with #--
. In the end, nearly every line of the CGI should have this markup. It's tedious but enables us to keep track of status very visually.
Notes
- Remove all formatting
- Ignore page formatting
You can safely ignore things like prompt(), print_prompt(), PrintTop(), PrintBottom(), StartSection();
- Look for common elements that already existing in WormBase::Model.pm. You can ignore these (although you still need to specify them in the configuration).
- The base class should be WormBase::Model
5. Add configuration for widgets and fields to WormBase.pm
Follow the examples and write configuration for your page. Sections are widgets; subsections are fields.
6. Create a new controller
script/wormbase_create.pl model Your_class
7. Add get_object method to controller
Copy and past this from an existing controller. Fix the PathPart and Class. I'm hoping the need for this goes away soon.
8. Freeze CGI if warranted and commit to CVS
Scripts that aren't modified often (use cvs history <script>
) can safely be "frozen". This means that no additional features will be added. Bug reports will be addressed in the new structure.
Fetch the current version number of the script using cvs status <script>
. Increment this version by one (ie 1.17 -> 1.18). The final frozen version corresponds to the current version with the blurb of text below added and committed to CVS.
Add this blurb to the top of the script.
############################################################## # REIMPLEMENTATION: # # THIS SCRIPT IS NOW FROZEN! (v1.17) # # Please do not make edits to it. # # Frozen by: tharris on 02.09.2008 # ##############################################################
Fix the version, commiter, and date.