Re: VMWARE PERL API



hi
The problem was like i had to read the config file in /etc/vmware/
directory.

*************************************************************************************
if (open CONFIG, '</etc/vmware/config') {
my $libdir;
my $line;

while (defined($line = <CONFIG>)) {
chomp $line;
if ($line =~ /^\s*libdir\s*=\s*\"(.*)\"\s*$/) {
$libdir = $1;
last;
}
}
close CONFIG;
if (defined($libdir)) {
my $perl_binary = $libdir . '/perl5/bin/perl';

if (-x $perl_binary) {
$ENV{'VMWARE_PERL_NESTED_EXEC'} = 1;
exec $perl_binary,
'-I'.$libdir.'/perl5/site_perl/5.005',
$0, @ARGV;
}
}
}
*************************************************************************************
this is the part that i included to get things working.
ie. adding a library path.

I think this stuff is going a bit complicated.. please give my some links on
perl concepts. i have fome pdf files from perk.org.. but they are a bit
basic and not deep into such things.

please refer dome books that might by of some use to me :)

can u explain this part in detail

if (-x $perl_binary) {
$ENV{'VMWARE_PERL_NESTED_EXEC'} = 1;
exec $perl_binary, '-I'.$libdir.'/perl5/site_perl/5.005',$0,
@ARGV;
}

thanks for ur help





On 8/2/07, John W. Krahn <krahnj@xxxxxxxxx> wrote:

Jeff Pang wrote:

From: vishnu <ckmvishnu@xxxxxxxxx>

Im trying to Build an API in perl.

I've included path of my installation like:


sub BEGIN {
push (@INC,
("/usr/lib/vmware-server/perl5/site_perl/5.005/i386-linux",
"."));
}

It's not sub BEGIN but BEGIN block,

BEGIN {
push @INC,"/your/lib/path";
}

perldoc perlmod

[ SNIP ]

BEGIN, CHECK, INIT and END

Four specially named code blocks are executed at the beginning and at
the
end of a running Perl program. These are the "BEGIN", "CHECK",
"INIT",
and "END" blocks.

These code blocks can be prefixed with "sub" to give the appearance
of a

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subroutine (although this is not considered good style). One should
note
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
that these code blocks don't really exist as named subroutines
(despite
their appearance). The thing that gives this away is the fact that
you can
have more than one of these code blocks in a program, and they will
get
all executed at the appropriate moment. So you can't execute any of
these
code blocks by name.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall

--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
http://learn.perl.org/





--
Vishnu,
cell:99944 75599

"if you don't make mistakes,
chances are you are not stretching yourself."