#!/usr/bin/perl -w #This will be a program that will create new dtd, xml, forms, and directories needed to add stuff to the system #Information you will need: #the name of the new dtd or xml #its relationship to existing dtd or xml #how you want the naming convention to work (default name) ## --- Steps: -- ## #cp existing xml (base) #cp existing dtd #modify newXMl #modify newDTD #cp newXML to the working directory and the play directory #cp newXML to the corresponding out directories (otherwise you'd have to touch them anyway) #create the new cgi form from an existing cgi script (from the base cgi) #modify the existing cgi - the scalars should all be in the correct section, or better yet, object oriented #chmod to give all the files the proper permissions #try them out. ## -- That's it -- ## #-- set scalars once to match your system --# my $start_dir = '/home/openkey/public_html/shared/'; my $working_dir = '/home/openkey/public_html3/cgi-bin/'; my $play_dir = $working_dir . 'testing_dir/xml_forms/'; my $out_dir = 'Out/'; my $permissions = '664'; my @out_prefixes ('master_new_', 'new_'); my $base_xml = ''; my $type = ''; #-- main tasks in this program (script) --# &ask4Base(); &modifyBase(); &createXml(); &createDtd(); &ask4Type(); if(($type eq characterGroup)||($type eq character)){ ©2cgi(); &createForms(); if( eq characterGroup){ &createDirectories(); }elsif( eq character){ &createGenericXML(); }# end if }elsif($type eq state){ &createState(); }# end if #--- sub routines ---# sub ask4Base { return; }# end ask4Base sub modifyBase { return; }# end modifyBase sub createDtd { my $dtd = ''; return $dtd; }# end sub sub createXml { my $xml = ''; return $xml; }# end sub sub createFiles{ my ($file_name, $dir, $perm, $pre) = @_; my $new_file = ''; if(!$perm){ $perm = $permissions; # some default permissions (global variable) }# end if not if($pre){ $new_file = $dir . $pre . $file_name; }else{ $new_file = $dir . $file_name; }# end if system (cp $file_name $new_file)#|| $oops = 'system (cp $file_name $new_file)'; system (chmod $perm $new_file); }# end sub sub copy2cgi{ # this needs major rewriting! my @files = (); ©2cgi($xml_file, $working_dir, $permissions); push (@files, $working_dir . $xml_file); ©2cgi($xml_file, $play_dir, $permissions); push (@files, $play_dir . $xml_file); ©2cgi($xml_file, $working_dir . $out_dir, $permissions); push (@files, $working_dir . $out_dir . $xml_file); foreach $out(@out_prefixes){ ©2cgi($xml_file, $play_dir . $out_dir, $permissions, $out); push (@files, $play_dir . $out_dir . $xml_file); }# end foreach return @files; }# end sub