On 8/3/07, Chas Owens <[EMAIL PROTECTED]> wrote: > On 8/3/07, vishnu <[EMAIL PROTECTED]> wrote: > snip > > 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 :) > snip > > Programming Perl (the Camel): http://www.oreilly.com/catalog/pperl3/ > Perl Best Practices: http://www.oreilly.com/catalog/perlbp/index.html > Object Oriented Perl: http://www.manning.com/conway/ > Higher-Order Perl: http://hop.perl.plover.com/ > > And, of course, the perldocs themselves (see perldoc perl or > http://perldoc.perl.org/) > > snip > > 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; > > } > snip > > -x is a file test operator, it test to see if the file exists and is > executable. So this is making sure it can execute the file whose name > is in $perl_binary. > > %ENV is a hash that holds the current state of the environment. > Changing a value in the hash changes the environmental variable > associated with it. So this is setting the environmental variable > VMWARE_PERL_NESTED_EXEC to 1. > > exec is a function that replaces the currently running process with > the one specified. > $0 is the name of the currently running script > @ARGV are the arguments to the script > > So this is replacing the current version of the Perl interpreter with > the one specified in the VMWare config file. It is probable, but I am > not certain, that the VMWARE_PERL_NESTED_EXEC environmental variable > is there to prevent infinite recursion. > > Now, why VMWare needs it's version of Perl instead of the system copy > is a mystery to me. >
Yes, the VMWARE_PERL_NESTED_EXEC is there to stop it from recursing forever, but your code does not seem to be using it. It appears as if VMWare wants to use its version of perl instead of the systems version. This will probably cause problems for you since VMWare's version is 5.005_03, and the current version is 5.8.8. There are lots of things that have been added in the eight years since 5.005_03 was released and if you ask questions on this list you will probably be told to do things like open my $fh, '<', '/etc/vmware/config' or die "could not open /etc/vmware/config:$!"; But that form of open was added in Perl 5.6 (I think) and you will not be able to use it. If you are paying for VMWare support I would suggest opening a trouble ticket and asking why they are using such an old version of Perl. #!/usr/bin/perl print "running\n"; unless ($ENV{'VMWARE_PERL_NESTED_EXEC'}) { open CONFIG, '</etc/vmware/config' or die "could not open config file:$!"; 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; } } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/