Book Reviews   Digital Libraries   Astronomy Log   Software   About  
The main stuff

Another cool perl module: Commands::Guarded
09 November 2005 17:21

Today while scouring CPAN for a Perl module that wrapped the 'chkconfig' command I bumped into the Commands::Guarded module. This module is based around the concept of idempotency. Idempotency is basically this: a function f(x) is idempotent if f(f(x)) = f(x). In other words, evaluating such a function more than once (and even many times) still yields the same result as evaluating it only once.

As a sysadmin, I very much like scripts and tools that are idempotent. That is, no matter how many times I run them, they always move the system towards the desired end state. Once the system is in that desired end state, running the script has no further effect. This is the main concept espoused by cfengine, in which each run of the agent brings the system towards (but no further) than the state defined by the configuration.

This module is particularly useful for sysadmins writing scripts which execute a sequence of actions, each of which depends upon the successful execution of the previous action. It makes for much cleaner and almost declarative code, in that I can define the state each step needs to effectuate, and the code required to bring that state into being. Thus if you run your script and it dies on step 3 of 20, you can run it again, and it will recognize that steps 1 and 2 have already happened, and that it needs to try step 3 again and go from there. A good read through the module docs is highly recommended.


Comments
Add a comment
Your name: (Required)


Your email: (Optional, not displayed)


URL: (Optional, the address of your web site or blog)


Your comments: (Required)

Please enter the text you see in the image
The CAPTCHA image


Thank you!
Please donate
liftingupserenity.com

Some dude

Daniel Hanks

I'm a database/systems administrator working for a large web hosting company in Utah.

Interested in

perl
books
databases
genealogy
astronomy
digital archival
digital libraries
web applications
web infrastructure
distributed storage

among other things . . .

Storyteller


Pamela Hanks

is an excellent storyteller.

(She also happens to be my wife :-)

A storyteller makes a wonderful and unique addition to family, school, church or other group events. Schedule her for your next gathering.


Kiva.org

Recent Entries

Subscribe with Bloglines
- Harnessing human computational power from computer games
- I love a good roadtrip
- FamilySearch Developers Conference 2008 presentations now available online
- FHT follow up: an idea for a mobile genealogical application
- Family history and technology: it's only getting better
- President Hinckley passes away
- December is NaBoMoReMo - National Book of Mormon Reading Month
- Family History, Photos, Blogs, and Books
- The Compact Oxford English Dictionary
- 1830s English and the Book of Mormon
- Google adds My Library feature to Book Search
- Utah Open Source Conference
- Wiki diagrammer (Steal this idea!)
- Microloans at Internet-scale
- Podcasting content created by someone else
- Silver Lining thought: Parking at work
- Emerging technologies for system administrators
- Amazon S3 storage engine for MySQL, part II
- Total lunar eclipse on Sat, Mar 3, 2007
- Are you ready for the 2007 Daylight Savings time changes?

All Entries . . .

LDSOSS
LDS Open Source Software
A website discussing the use of Open-source software for applications useful to those sharing values of the Latter-day Saint (Mormon) faith.

Cool Perl Modules

My del.icio.us
Recent bookmarks

Spread the Word
Get Firefox!

--> © 2004, Daniel C. Hanks