in reply to Error with my perl script when i generate a script to cvs checkout
You seem to be changing a program without understanding it or understanding what it is supposed to do. This is a problematic and dangerous practice.
The error message is output by the script itself, in the sub Dispatch, whenever it does not find a supported platform. If you had run your program with warnings enabled, like I suggested when you last posted, Perl would have told you that you used a variable which was not initialized. In this case, it is $ENV{PLATFORM}, most likely, because you did not set the PLATFORM environment variable.
You could change Dispatch like this to make the program give you a more explicit error message:
sub Dispatch { if ( exists( $Platforms{ lc( $ENV{PLATFORM} ) } ) ) { print "\nProduct $Product - Platform $ENV{PLATFORM} supported!\n +"; } elsif (defined $ENV{PLATFORM}) { print "\nProduct $Product - Not implemented ". "for platform $ENV{PLATFORM}\n"; return; } else { print "\nThe environment variable PLATFORM was not set.\n"; return; } my $FnTable = $Platforms{ lc( $ENV{PLATFORM} ) }; for ( @ARGV ) { if ( exists( $FnTable->{ lc( $_ ) } ) ) { print "\nProduct $Product - Platform $ENV{PLATFORM} - Functio +n $_\n"; $FnTable->{ lc( $_ ) }(); $Options = ''; } else { $Options .= " $_"; } } print "\n"; }
The code also seems to be somewhat problematic or weird, because it calls the functions Checkout, Clean and Build when building the hashes; at least assuming you left out the definitions of these subroutines. Otherwise, if these are to be strings, you should put them into quotes to clearly mark them as strings.
|
|---|