[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] User Defined Tags - problem
Hi list;
I have my own defined tag that look like this:
UserTag get-license Order email CompanyName CompanyAddress URLLimit
HostIPAddr IssueDate ExpiryDate SerialNumber MappingLimit Evaluation
UserTag get-license-temporary AddAttr
UserTag get-license-temporary Documentation <<EOD
usage: [get-license-temporary email CompanyName CompanyAddress
URLLimit HostIPAddr IssueDate ExpiryDate SerialNumber MappingLimit
Evaluation]
Gets a license number from the license server
EOD
UserTag get-license-temporary Routine <<EOR
use Socket;
sub {
my ( $email, $CompanyName, $CompanyAddress,
$URLLimit, $HostIPAddr,
$IssueDate, $ExpiryDate, $SerialNumber, $MappingLimit,
$Evaluation,
$opt ) = @_;
my $licensehost = "licenseserver";
my $licenseport = "2201";
if ($MappingLimit == ""){
my $licensestr = "\
CONTACT-EMAIL=$email\
COMPANY-NAME=$CompanyName\
COMPANY-ADDRESS=$CompanyAddress\
URL-LIMIT=$URLLimit\
HOST-IP-ADDRESS=$HostIPAddr\
ISSUE-DATE=$IssueDate\
EXPIRY-DATE=$ExpiryDate\
SERIAL-NUMBER=$SerialNumber\
EVALUATION=$Evaluation\
";
}
else{
my $licensestr = "\
CONTACT-EMAIL=$email\
COMPANY-NAME=$CompanyName\
COMPANY-ADDRESS=$CompanyAddress\
URL-LIMIT=$URLLimit\
HOST-IP-ADDRESS=$HostIPAddr\
ISSUE-DATE=$IssueDate\
EXPIRY-DATE=$ExpiryDate\
SERIAL-NUMBER=$SerialNumber\
MAPPING_LIMIT=$MappingLimit\
EVALUATION=$Evaluation\
";
}
my $iaddr = inet_aton($licensehost);
my $paddr = sockaddr_in($licenseport,$iaddr);
my $proto = getprotobyname('tcp');
socket(SOCK,PF_INET,SOCK_STREAM,$proto) || return undef;
connect(SOCK,$paddr) || return undef;
print SOCK $licensestr;
print SOCK "\0";
my $fh = select SOCK;
$| = 1;
select $fh;
my $signed_license = '';
my $buf = '';
my $line;
while (defined($line = <SOCK>)) {
$signed_license .= $line;
}
close(SOCK) || return undef;
return $signed_license;
}
EOR
I am getting following error message:
UserTag 'get_license_temporary' subroutine failed compilation:
Global symbol "$licensestr" requires explicit package name at (eval
109) line 25, <GLOBAL> line 74.
In line 74 of the configuration file
'usertag/get_license_temporary.tag':
UserTag get-license-temporary Routine <<EOR
I defined this tag as get_license_temporary.tag in
/usr/lib/interchange/usertag
As soon as I remove if and else statments works perfect ie if I have
just this:
UserTag get-license Order email CompanyName CompanyAddress URLLimit
HostIPAddr IssueDate ExpiryDate SerialNumber MappingLimit Evaluation
UserTag get-license-temporary AddAttr
UserTag get-license-temporary Documentation <<EOD
usage: [get-license-temporary email CompanyName CompanyAddress
URLLimit HostIPAddr IssueDate ExpiryDate SerialNumber MappingLimit
Evaluation]
Gets a license number from the license server
EOD
UserTag get-license-temporary Routine <<EOR
use Socket;
sub {
my ( $email, $CompanyName, $CompanyAddress,
$URLLimit, $HostIPAddr,
$IssueDate, $ExpiryDate, $SerialNumber, $MappingLimit,
$Evaluation,
$opt ) = @_;
my $licensehost = "licenseserver";
my $licenseport = "2201";
my $licensestr = "\
CONTACT-EMAIL=$email\
COMPANY-NAME=$CompanyName\
COMPANY-ADDRESS=$CompanyAddress\
URL-LIMIT=$URLLimit\
HOST-IP-ADDRESS=$HostIPAddr\
ISSUE-DATE=$IssueDate\
EXPIRY-DATE=$ExpiryDate\
SERIAL-NUMBER=$SerialNumber\
EVALUATION=$Evaluation\
";
...............................(rest of the thing).
I nedd to check if some of the past values are empty, in which case they
wll not be included in license.
Thank you.
Alma