Click here to get back home

use of xml in perl application to describe command line logic

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
use of xml in perl application to describe command line logic strepxe 12-20-2005
Get Chitika Premium
Posted by strepxe on December 20, 2005, 11:03 am
Please log in for more thread options


Hi,
I work for a compay which sells a unix-based product comprising several
binaries. The binaries have numerous command line options which change
with version releases [immutable facts].

We use shell scripts to control the binaries startup and shutown. It
does, unfortuately involve lots of modifications for each release
because of the increasingly complicated command line options (some of
which are mandatory, others are not).

I want to use perl to write an application which can manage the
execution of these processes. What I'm wondering is if anyone out there
has ever created a configuration file to describe the logic of command
line options for binaries or similar; I want to have a configuration
file I can modify rather than code in the utility I produce.

Any assistance on this would be greatly appreciated. This is my first
posting on the topic but I will add more information if anyone needs
further information about my problem.

g



Posted by metaperl@gmail.com on December 21, 2005, 7:34 am
Please log in for more thread options



strepxe@yahoo.co.uk wrote:
> Hi,

Hi, I think you need base classes and derived classes for this problem:

> I work for a compay which sells a unix-based product comprising several
> binaries. The binaries have numerous command line options which change
> with version releases [immutable facts].

let's just say you have the binaries jkapp and mqapp

package Cmdline::jkapp;

sub required_options {
...
}

sub optional_options {
...
}
1;

package Cmdline::jkapp::v5;
use base Cmdline::jkapp;

sub required_options {
my $self = shift;
my $options = $self->SUPER::required_options;
$options->{tweak => 'this', alter => 'that';
$options
}


>
> We use shell scripts to control the binaries startup and shutown. It
> does, unfortuately involve lots of modifications for each release
> because of the increasingly complicated command line options (some of
> which are mandatory, others are not).

yes, your base class has the default mandataory and optional options in
the subs (as shown above) and each version derives from base and
modifies the two subroutines as necessary.

>
> I want to use perl to write an application which can manage the
> execution of these processes. What I'm wondering is if anyone out there
> has ever created a configuration file to describe the logic of command
> line options for binaries or similar; I want to have a configuration
> file I can modify rather than code in the utility I produce.

What you want is in between the two. Some good configuration packages
allow for merges and over-rides, but why compromise. On the other hand,
you are also right - don't write a lot of dynamic code for this either.

>
> Any assistance on this would be greatly appreciated. This is my first
> posting on the topic but I will add more information if anyone needs
> further information about my problem.

you might also ask on perlmonks.org, but I have given you what I feel
is a workable solution... keep us posted on your progress!


>
> g



Similar ThreadsPosted
Search for a job online from command line May 31, 2007, 5:44 am
Search eBay from command line May 31, 2007, 11:33 am
Creating FULLTEXT index OK on command line, but NOT with DBI...? March 12, 2005, 6:24 am
GD demo cgi script works on command line but not on webserver. June 14, 2006, 5:07 am
Communicate to MFC application using perl February 19, 2007, 3:51 pm
Reusing SQL data-related logic, replacing weird modules and improving Class::DBI July 2, 2005, 1:23 am
ANNOUNCE: CGI::Application::Demo V 1.02 December 26, 2005, 3:14 am
VC++ Application Connecting PostgreSQL on Linux February 17, 2006, 2:11 am
Re: Best Practice - Modules to build a web application March 17, 2007, 10:10 am
Start printing at the end of the previous line in Perl July 18, 2006, 10:51 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap