Hi Stephen!
Thank you for hat hint. I've got to think it over for a while...
--Dirk
> Stephen Howard wrote:
>
> Hi Dirk,
>
> I think your question has less to do with CGI::Application than you
> think. Consider this. Put the logic to your unix-admin into a
>
> set of modules outside your web-application module:
>
> instancescript.cgi
> webapp.pm
>
> AccountEditor::Unix.pm
> AccountEditor::Solaris.pm ( 'ISA' AccountEditor::Unix )
> AccountEditor::AIX.pm ( 'ISA' AccountEditor::Unix )
> AccountEditor::HPUX.pm ( 'ISA' AccountEditor::Unix )
> AccountEditor::FreeBSD.pm ( 'ISA' AccountEditor::Unix )
> AccountEditor::Linux.pm ( 'ISA' AccountEditor::Unix )
>
> You define all of the normal admin opertations in Unix.pm. You then
> selectively add/override methods in the OS-specific modules.
>
> Then if you've gotten their os preference in a variable called
> $osPref, you can do something like this in your WebApp.pm:
>
> sub setup {
>
> my $self = shift;
>
> $self->start_mode(...your default mode);
> $self->mode_param(...your param here);
> $self->run_modes( ... your run mode list here );
>
> my %implementations = (
> 'Default' => 'AccountEditor::Unix',
> 'Solaris' => 'AccountEditor::Solaris',
> ...
> );
>
> my $implementation = $implementations{ $osPref } ||
> $implementations{ 'Default' );
>
> my $file = join('/', split(/::/, $implementation) ) . '.pm';
> require $file;
>
> $self->param('administrator', $implementation->new() );
> }
>
> Then in each run mode, you can check to see if the 'administrator'
> you've installed can support the action that the run mode wants
>
> to allow the user to do:
>
> my $administrator = $self->param('administrator');
>
> if( my $method = $administrator->can( 'action_for_this_runmode' )
> ) {
>
> $administrator->$method( parameters appropriate for the action
> );
> return "success page";
> }
> else {
>
> return "I'm Sorry, but I don't know how to do that"
> }
>
> HTH
>
> -Stephen
>
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]