Good day.
I have some trouble during writing the program. I got script that 100% throw exception if i run it from perl (perl test.pl). Script body see below:
sub register_vm
{
my ($config) = @_;
my $connect_params = VMware::VmPerl::ConnectParams::new();
# Establish a persistent connection with server
my $server = VMware::VmPerl::Server::new();
if (!$server->connect($connect_params))
{
my ($error_number, $error_string) = $server>get_last_error();
die "Could not connect to server: Error $error_number: $error_stri
+ng\n";
}
if (!$server->register_vm($config))
{
my ($error_number, $error_string) = $server>get_last_error();
die "Could not register of VM $config: Error $error_number: $error_
+string\n";
}
undef $server;
}
Then i wrote function in order to use that script from C++.
bool PerlWrapper::PerlRegisterVm(char* config, char* error)
{
bool bRet = true;
dSP;
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(config, 0)));
PUTBACK;
perl_call_pv("register_vm", G_DISCARD|G_EVAL);
SPAGAIN;
if(SvTRUE(ERRSV))
{
strcpy(error, SvPV(ERRSV, PL_na));
bRet = false;
}
PUTBACK;
FREETMPS;
LEAVE;
return bRet;
}
The block of exception handling (SvTRUE) never take control. Why?
Thanks for any suggestions.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.