This question about Installation of Foswiki: Answered
Errors in extender.pl, Archive::Tar not found
While using the "Find More Extensions" or manual installation of Plugins, I get a failure in extender.pl with the message (among others): Archive::Tar is not installed; trying tar on the command-line .
Since I'm running Windows XP, tar is not part of the standard configuration. Nevertheless, upon further examination I found that Archive::Tar does indeed exist on my Strawberry Perl Install (5.10.0) and that the problem exists in the extender.pl code,
My current Environment:
Foswiki-1.0.6, Sun, 21 Jun 2009, build 4272, Plugin API version
2.0
Problem code (extender.pl):
sub untar {
<snip>
if ( not eval 'require Archive::Tar' ) {
When the eval statement returned false, the code kicks to the message:
sub untar {
<snip>
else {
print STDERR
"Archive::Tar is not installed; trying tar on the command-line\n";
Which is where it falls apart.
I seemed to have fixed the problem (which exists in either Configure or manual installs) by changing extender.pl at line 661 to:
if ( not eval 'use Archive::Tar' ) {
Changing "require" to "use" seems to work. Most of the plugins installed succesfully via configure, a handful I had to use manual install.
Any thoughts?
phil g
Extraordinary. Can you reproduce this? If so, please add a "print" statement to get the value of $@ e.g.
sub untar {
---
if ( not eval 'require Archive::Tar' ) {
print STDERR "Archive::Tar had indigestion: $@";
That should indicate why the require is failing.
--
CrawfordCurrie - 29 Jun 2009
Curious, $@ is empty...
C:\www\Foswiki\tools>type extraordinary.pl
#!perl -w
if ( not eval 'require Archive::Tar' ) {
print STDERR "Archive::Tar require worked...";
}
else {
print STDERR "Archive::Tar had indigestion (dollar-at) : $@ \n";
print STDERR "Archive::Tar had indigestion (dollar-exl): $! \n";
}
print "Now we'll try 'use'\n";
if ( not eval 'use Archive::Tar' ) {
print STDERR "Archive::Tar use worked...";
}
else {
print STDERR "Archive::Tar had indigestion (dollar-at) : $@ \n";
print STDERR "Archive::Tar had indigestion (dollar-exl): $! \n";
}
exit;
C:\www\Foswiki\tools>perl extraordinary.pl
Archive::Tar had indigestion (dollar-at) :
Archive::Tar had indigestion (dollar-exl): Bad file descriptor
Now we'll try 'use'
Archive::Tar use worked...
pg
$! is noise, I think; it will just be whatever was left lying around. $@ is the important data point. The fact that it's empty suggests rather strongly that Archive::Tar was in fact found, but for some reason the 'require' doesn't return a true value.
I'm nut sure why it was written that way in the first place; I would normally write:
eval 'require Archive::Tar';
if ($@) {
print STDERR "Archive::Tar has heartburn";
Can you try that?
--
CrawfordCurrie - 30 Jun 2009
Voila:
#!perl -w
eval 'require Archive::Tar';
if ($@) {
print STDERR "Archive::Tar has heartburn";
}
else {
print "Looks like require worked just fine!\n";
}
exit;
C:\www\Foswiki\tools>perl ext2.pl
Looks like require worked just fine!
I have little experience using eval, but it seems the existing form presumes that the eval statement returns a value, which according to
http://perldoc.perl.org/functions/eval.html is an incorrect assumption:
The value of the expression (which is itself determined within scalar context) is first parsed, and if there weren't any errors, executed in the lexical context of the current Perl program...
I'm guessing that require simply has no 'return' context (or whatever you call it) - which would make the form you suggested the better one -especially since it works!
pg
See
Tasks.Item1782 for the checked-in fix. Will be released in 1.1 and 1.0.7.
Cool! thanks...
pg
--
CrawfordCurrie - 02 Jul 2009