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.

In reply to Re: NEW Pseudo Language by Roger
in thread NEW Pseudo Language by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.