Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: NEW Pseudo Language
by Roger (Parson) on Dec 08, 2003 at 00:25 UTC
    I would assume that your VB6 server calls scripts written in Perl. The following is what I would do to pass parameters from VB6(etc) to Perl via command-line.

    In VB6, you would have enumerated types like -
    COMMAND1 (1) VALUE1 VALUE2 VALUE3 ... COMMAND2 (2) VALUE1 VALUE2 ... COMMAND3 (3) VALUE1 ...
    And in your Perl script, you could do something like -
    use strict; use warnings; use Data::Dumper; # define command enums my @commands = qw/ COMMAND1 COMMAND2 COMMAND3 /; my @parameters = ( [qw/ VAR1 VAR2 VAR3 /], # variables for COMMAND1 [qw/ VAR1 VAR2 /], # variables for COMMAND2 [qw/ VAR1 /], # variables for COMMAND3 ); # define possible input my %input; @input{@commands} = @parameters; # debug # print "Possible Inputs => ", Dumper(\%input); my ($command, $parameters) = __ParseInputFromVB(); die "Unknown command $ARGV[0]" if ! defined $command; die "Incorrect parameters for $command" if ! defined $parameters; # debug print "Want to process: $command => ", Dumper($parameters); # dispatch the command __PACKAGE__->$command(@{$parameters}); # returns the name of the command and parameters sub __ParseInputFromVB { return () if $#ARGV < 0; # no command specified return () if $ARGV[0] !~ /^\d+$/; # command is a number my $command = $commands[$ARGV[0] - 1]; # check if the command is defined or not return () if ! defined $input{$command}; # check for required parameters my $arglist = $input{$command}; return ($command, undef) if $#$arglist != $#ARGV-1; # if want a hash of parameters # my %param; # @param{@$arglist} = @ARGV[1..$#ARGV]; # return ($command, \%param); # if a list of parameters my @param = @ARGV[1..$#ARGV]; return ($command, \@param); } # handlers for commands sub COMMAND1 { my (undef, $var1, $var2, $var3) = @_; # .... print "process command 1, param: $var1, $var2, $var3\n"; } sub COMMAND2 { my (undef, $var1, $var2) = @_; # .... print "process command 2, param: $var1, $var2\n"; } sub COMMAND3 { my (undef, $var1) = @_; # .... print "process command 3, param: $var1\n"; }
    And when I invoke the script -
    C:> perl p110.pl 1 a b c Want to process: COMMAND1 => $VAR1 = [ 'a', 'b', 'c' ]; process command 1, param: a, b, c C:> perl p110.pl 1 a b Incorrect parameters for COMMAND1 at p110.pl line 22. C:> perl p110.pl X a b Unknown command X at p110.pl line 21.
Re: NEW Pseudo Language
by CountZero (Bishop) on Dec 07, 2003 at 21:31 UTC
    Pardon my ignorance, but what are "enumerated HASHES"?

    And how would it connect to Perl?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Perhaps Tie::Hash::Indexed-esque ordered hashes

      Also confused,

      jweed


      Who is Kayser Söze?
PUI? was Re: NEW Pseudo Language
by RMGir (Prior) on Dec 08, 2003 at 16:12 UTC
    Aw darn, it's already been considered.

    And here I was hoping to consider this post for suspected PUI (Posting Under the Influence). :)


    Mike