11.4 Checking Out a Module

We've got a useful look and feel module in the library, and over time we use it in many application scripts.

But two days later, we decide it needs changing: we want the title to default to empty, and the background color to be yellow. We also want to add a link to the bottom. So we need to edit the module's source code.

We deleted the source file code yesterday, but that's no problem because the library's got the source. We can view it by checking out the module on the command line:


  shell> texis -co -lock -module lookfeel code
  Checked out and locked module lookfeel:1.1 to file code

This tells Vortex to check out (copy) the module lookfeel to the file code : we've got the original source back.

Locking

We added the option -lock to the command line to lock the module. Locking a module helps prevent other programmers from updating the same module while we're editing it. It might take us several hours or days to make our changes: what if another programmer tries to edit the module while we're editing it? Our changes would stomp one another.

But since the module is locked, if another programmer on another host tries to edit it, they'll get an error message saying it's locked. This keeps modifications serial, so that each change is aware of the previous changes.

We can see the lock status with -listlib :


  shell> texis -listlib
  Module:Revision    Created           Locked
  -------------------------------------------
  lookfeel:1.1       1999-12-02 11:20  localhost 1999-12-04 11:25

Note the lock holder's remote host and date in the Locked column. (The host is used because a future release of Vortex will allow modules to be updated remotely.)

It is important to keep in mind what "locked" means. A locked module is a temporary state, and means someone is editing the module; no one else should edit it. An unlocked module means no work is in progress on the module: any one person can start editing it, but they've got to lock it first.

Don't think of "locked" as "it's safely locked, no one's editing it", but rather "I locked it for editing, I'll unlock it when I'm done."

We can now edit our module file code (next page):

Back: Using a Module Next: Updating a Module
Copyright © 2024 Thunderstone Software LLC. All rights reserved.