I'm trying to install the Text::Template module with cpan but get this when I run 'install Text::Template' from the cpan shell.
cpan> install Text::Template
Reading 'C:\Perl64\cpan\sources\authors\01mailrc.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163, <IN> line 1.
'-qdt' is not recognized as an internal or external command,
operable program or batch file.
............................................................................DONE
Reading 'C:\Perl64\cpan\sources\modules\02packages.details.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163.
'-qdt' is not recognized as an internal or external command,
operable program or batch file.
Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Line-Count header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Last-Updated header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
.Could not split line["┬0\cL²\cU\c?└'¸\cCé"]
Could not split line["cÌX'ÔÒ"├█\cP\cE?▀&Ù┌╠5Ó%â¥mþlýBô¶ñg▒R\cIØ\cT\cPȸ\cX."]
Could not split line["\cH·©s:░KÉþ\cC\c^Û{65j¼¸\cL"]
Could not split line["\cD│í¬ð\cP|:ü▒HôU▓┴Bú‗Ð\cZyÄ"]
Giving up parsing your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz, too many errorsReading 'C:\Perl64\cpan\sources\authors\01mailrc.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163.
'-qdt' is not recognized as an internal or external command,
operable program or batch file.
............................................................................DONE
Reading 'C:\Perl64\cpan\sources\modules\02packages.details.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163.
'-qdt' is not recognized as an internal or external command,
operable program or batch file.
Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Line-Count header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Last-Updated header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
.Could not split line["┬0\cL²\cU\c?└'¸\cCé"]
Could not split line["cÌX'ÔÒ"├█\cP\cE?▀&Ù┌╠5Ó%â¥mþlýBô¶ñg▒R\cIØ\cT\cPȸ\cX."]
Could not split line["\cH·©s:░KÉþ\cC\c^Û{65j¼¸\cL"]
Could not split line["\cD│í¬ð\cP|:ü▒HôU▓┴Bú‗Ð\cZyÄ"]
Giving up parsing your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz, too many errorsLockfile removed.
I'm using ActivePerl 5.28.1 64bit on Windows 10. The same problem occurs for all the packages I tried, including Log::Log4perl and Test::More.
I can replicate this by corrupting my sources/modules/02packages.details.txt.gz file.
Erase the files in the C:\Perl64\cpan\sources\modules directory and try again.
I got it to work using Strawberry Perl instead of ActivePerl.
Related
I am trying to convert my Perl script to standalone exe.
I assume perl2exe is a tool that serves this purpose. More or less.
When I am trying to generate the exe file, I am getting library issues.
One of the library issues is:
Warning: Can't locate VMS/Stdio.pm
at C:\Perl\lib\File\Temp.pm line 19
#INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)
When I went to line 19 of Temp.pm, the line is written as follows:
require VMS::Stdio if $^O eq 'VMS';
But,my OS is MSWin32.
I am coming to a conclusion that, perl2exe is not compiling the script properly. Its reading my OS wrong.
Sample script is as follows:
my_libraries.pl
use Tk;
use lib 'C:\Perl\lib\Digest';
use strict;
use strict;
use warnings;
use strict;
use warnings;
use LWP::Simple qw(getstore);
use LWP::UserAgent;
use Digest::MD5 qw( md5_hex );
use Digest::MD5::File qw( file_md5_hex );
use File::Fetch;
use WWW::Mechanize ;
use Tk::ErrorDialog;
c:\perl2exe\perl2exe-16.00-Win> perl2exe my_libraries.pl my_libraries.exe
Warning: Can't locate File/BSDGlob.pm
at C:\Perl\lib\File\GlobMapper.pm line 13
#INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)
Warning: Can't locate Digest/Perl/MD5.pm
at C:\Perl\lib\Digest\MD5.pm line 30
#INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)
Warning: Can't locate VMS/Stdio.pm
at C:\Perl\lib\File\Temp.pm line 19
#INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)
Warning: Can't locate VMS/DCLsym.pm
at C:\Perl\lib\IPC\Cmd.pm line 227
#INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)
Warning: Can't locate VMS/Filespec.pm
at C:\Perl\lib\ExtUtils\Manifest.pm line 31
#INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)
Warning: Can't locate HTML/FormatText.pm
at C:\Perl\lib\HTML\Element.pm line 1297
#INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)
Sorry. let me put my obvious question here:
Why is perl2exe giving library issues which are not intended to come? Is it a bug in perl2exe or am I doing something wrong?
I mean, you can see in line 19 that if the OS is 'VMS', then stdio.pm is required. My os is 'MSWin32'.
I tried a to z possible remediation to make the perl2exe work. I removed the sections that was producing warnings (Hacked the modules). Studied and tried various flags. I have to say it is not at all feasible to convert Perl programs using diverse modules to exe files using perl2exe.
I found a software that exactly did what I wanted- Cava Packager.
It took sometime to find the below page-
How can I package my Perl script to run on a machine without Perl?
It converted my Perl program to Exe and also generated an installation file. Awesome.
Thanks,
Anoop.
The problem is
C:\Perl\lib\File\Temp.pm line 19
Open the file you will see this
require VMS::Stdio if $^O eq 'VMS';
Change the file not read-only, then place # for this line, go back to perl2exe the file again, then it should be gone.
It may be of interest to readers of this issue that in addition to the VMS/Stdio.pm error, I also received "Can't locate the.pm". The line in my perl code that it pointed to was the text "Use the 't' command..." that was inside a double-quoted print statement. Apparently perl2exe looked for the 'use' statement regardless of where in my code it appeared. The fix was to either re-word the text to remove the word 'use' or put the text in single quotes.
I'm trying to install POE::Component:IRC::State but keep returning this error. I've tried googling but no solutions. Anyone know how to handle this?
install POE::Component:IRC::State
Going to read '/home/user/.cpan/Metadata'
Database was generated on Tue, 22 Jul 2014 11:41:02 GMT
Running install for module 'POE::Component::IRC::State'
Running make for B/BI/BINGOS/POE-Component-IRC-6.88.tar.gz
Checksum for /home/user/.cpan/sources/authors/id/B/BI/BINGOS/POE-Component-IRC-6.88.tar.gz ok
Scanning cache /home/user/.cpan/build for sizes
Use of uninitialized value $newdir in substitution (s///) at /opt/OMNIperl/lib/5.14/i86pc-solaris-thread-multi-64/Cwd.pm line 502.
Use of uninitialized value $newdir in chdir at /opt/OMNIperl/lib/5.14/i86pc-solaris-thread-multi-64/Cwd.pm line 510.
Use of chdir('') or chdir(undef) as chdir() is deprecated at /opt/OMNIperl/lib/5.14/i86pc-solaris-thread-multi-64/Cwd.pm line 510.
Use of uninitialized value $newdir in pattern match (m//) at /opt/OMNIperl/lib/5.14/i86pc-solaris-thread-multi-64/Cwd.pm line 525.
Use of uninitialized value $newdir in split at /opt/OMNIperl/lib/5.14/i86pc-solaris-thread-multi-64/Cwd.pm line 531.
............................................................................DONE
Use of uninitialized value $_[0] in join or string at /opt/OMNIperl/lib/5.14/i86pc-solaris-thread-multi-64/File/Spec/Unix.pm line 86.
Use of uninitialized value $path in pattern match (m//) at /opt/OMNIperl/lib/5.14/i86pc-solaris-thread-multi-64/File/Spec/Unix.pm line 267.
CPAN.pm: Going to build B/BI/BINGOS/POE-Component-IRC-6.88.tar.gz
Warning: No success on command[/opt/OMNIperl/bin/amd64/perl Makefile.PL]
BINGOS/POE-Component-IRC-6.88.tar.gz
/opt/OMNIperl/bin/amd64/perl Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Failed during this command:
BINGOS/POE-Component-IRC-6.88.tar.gz : writemakefile NO '/opt/OMNIperl/bin/amd64/perl Makefile.PL' returned status -1
I came across something similar to this before and I believe the reason for your error, assuming you are receiving this error for other modules installations as well*, is that you need to update your current version of Perl.
From your error report it seems that you are running 5.14 but you should be running 5.20 instead. If this is a remote/personal set up, you can try upgrading your version of Perl but definitely back up everything.
If this is part of a larger system, I would highly advise contacting your system administrator and asking them to look into the problem and have them upgrade it. It is a very sensitive action and upgrading can affect a bunch of other programs you have on your servers.
I have observed that there are two ways of executing a perl program:
perl test.pl
and
./test.pl
What is the exact difference between these two and which one is recommendable?
I will rephrase slightly what other answers stated.
The first case will run the program called "perl" - presumably, a Perl language interpreter, and pass the value "test.pl" to it as the first parameter. Please note that this will do one of 3 things, depending on what "perl" is and what "test.pl" is:
If "perl" does not exist as an executable in your $PATH or a shell alias (check by running which perl), your shell will try to find a non-existing executable, and fail with perl: Command not found error.
If "perl" is an executable in your path (or a shell alias) that is NOT actually a Perl interpreter program, that will get executed instead. As example, try this in csh:
alias perl echo
which perl # Will print "perl: aliased to echo"
perl test.pl # Will print "test.pl". NOT what you intended!
unalias perl
This will execute your "perl" alias and simply echo the word "test.pl"
If "perl" is an executable in your path that IS a real perl interpreter, it will pass "test.pl" to it as a first parameter. In that case, Perl interpreter will treat this parameter (as it doesn't start with a "-") as the name of a file containing Perl code to execute and try to read the file in, compile it as Perl code and execute it.
Note that, since the program being run is actually "perl" and "test.pl" is just a text file being read in, "test.pl" does NOT need to have the "execute" Unix file permission.
The second case, shell will try to find a file called "test.pl" in your current directory, and - if it exists AND is executable - try to execute it as a program.
If the file does not exist OR if the execute bit on it is not set, the shell will fail with "command not found" error.
If the file has the execute bit set, shell (or actually process loader in Unix kernel) will try to execute it. The rules by which Unix executes a given executable file is governed by the first 2 bytes of the file, aka "magic number".
For a VERY good in-depth coverage of how magic numbers work, see "How does the #! work?" question on SO.
In a special case where the "magic number" is "#!" (aka "shebang"), the loader will read the first line of the file, and treat the contents of that line (sans the first 2 bytes) as a command to run instead of the given executable file; and append the path to the executable file as one more parameter to the command it read from shebang line. As examples:
if "test.pl" is a text file with a first line of #!/bin/sh -x, the kernel will execute /bin/sh -x ./test.pl.
if "test.pl" is a text file with a first line of #!/usr/bin/perl, the kernel will execute /usr/bin/perl ./test.pl.
if "test.pl" is a text file with a first line of #!perl, the kernel will execute perl ./test.pl.
if "test.pl" is a text file with a first line of my $var = 1; (or any other first 2 bytes it doesn't know what to do with), it will either error out or (at least on RedHat Linux) will pretend that there was an implied #!/bin/sh shebang and try to execute the file as Bourne Shell script. Which will of course fail since it was Perl code, not shell script
In the first case you are starting the perl interpreter and asking it to use your file and run it.
In the second case you are asking your shell to execute your file. This requires that the file starts with
#!/<path to perl>/perl
and that the file has the execute bit set.
The best method to use is the one that fits your usecase the best.
The first one will always run the script as the perl code.
The second one will do it only in case the perl is specified in she-bang. Otherwise it will run it as shell code or whatever is specified in she-bang (if there is no she-bang at all it will run as current shell code).
The first one will be executed even noexec mount option is enabled.
The second one will fail in that case.
The same stuff with execute bit. The first one will work if +x isn't setted, the second will fail.
The first executes the program using the perl that is found first in your $PATH. The second uses whatever shebang line in the program says.
If u set the executable permissions to the file , then you can run the file by ./ or else run using perl filename.pl
perl test.pl
Specify to the shell that you want the current Perl executable (as is found in your $PATH) to execute the test.pl file that is located in your $PATH.
Run which perl to quickly see what version of perl is the default
Run echo $PATH to see where the '.' (current directory) is. ALL directories BEFORE the '.' will be checked FIRST for the test.pl file! Use ./test.pl instead so the shell looks in the current directory only...Unless you want it to hunt in the $PATH for the test.pl file.
./test.pl
Specify to the shell that you want the test.pl file, in the current directory, to be run by the executable as specified inside the test.pl file at the line with the she-bang (line that starts with #!).
I am executing my perl files in a batch. I am pasting all the name of the perl file in a batch file and executing it. I am giving a small demo of the file.
The batch file /10BT_run1.Amset contains:
Perl ../tools/test_driver_multi_aid_sequential.pl e2_h/l2_mode/set_bwprf #this is line 4 of the batch file
I am getting error like
Bareword found where operator expected at ./10BT_run1.Amset line 4, near "/tools /test_driver_multi_aid_sequential"
(Missing operator before test_driver_multi_aid_sequential?)
Bareword found where operator expected at ./10BT_run1.Amset line 4, near "/l2_mode/set_bwprf"
(Missing operator before et_bwprf?)
You are somehow executing the batch file (./10BT_run1.Amset) using perl instead of cmd.
you can run the perl files as argument to perl interpreter
perl "../tools/test_driver_multi_aid_sequential.pl e2_h/l2_mode/set_bwprf"
if you are going to use " in between the arguments separate those as escaping sequence like
\"
It will avoid the error that you have mentioned
I am pretty layman to Perl, never used it ...but now I want to use it.
Here is what I did:
http://www.activestate.com/activeperl/downloads
I installed universal version - 5.12.4.1205
To test my program is working, I used the following small program :
dnacon.plx
#i/Perl64/bin/perl -w
#Example 1-1 Concatenating DNA
$DNA1 = 'ATTTGGTAAAATGTATA'
$DNA2 = 'TTTTGGGTTTGAAAT'
print "Here are two DNA fragments: \n\n"
print $DNA1, "\n\n"
print $DNA2, "\n\n"
$DNA3 = "$DNA1$$DNA2"
print "$DNA3\n\n
When I try to execute it the following is command prompt with errors.
Sorry for too basic question...
EDTIS:
When I just type dnacon.plx, it is seems that it is working, but with error !!!
c:\myperllessions>dnacon.plx
Scalar found where operator expected at C:\myperllessions\dnacon.plx line 5, nea
r "$DNA2"
(Missing semicolon on previous line?)
syntax error at C:\myperllessions\dnacon.plx line 5, near "$DNA2 "
Execution of C:\myperllessions\dnacon.plx aborted due to compilation errors.
Am I good to go ??? What could be the error ...compilation errors ????
Edits:
I am using the following now : is this correct ?
#i/Perl64/bin -w
Edits:
I changed my script to following:
#i/Perl64/bin -w
#Example 1-1 Concatenating DNA
use strict;
use warnings;
$DNA1 = 'ATTTGGTAAAATGTATA';
$DNA2 = 'TTTTGGGTTTGAAAT';
print "Here are two DNA fragments: \n\n";
print $DNA1, "\n\n";
print $DNA2, "\n\n";
$DNA3 = "$DNA1$$DNA2";
print "$DNA3\n\n";
I got the following error:
c:\myperllessions>dnacon.plx
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 5.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 6.
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 9.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 10.
Global symbol "$DNA3" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA3" requires explicit package name at C:\myperllessions\dnacon
.plx line 13.
Execution of C:\myperllessions\dnacon.plx aborted due to compilation errors.
Is my problem now with programming knowledge or something to do with installation ?????
To get perl to be recognized, you must add C:\Perl64\bin to the PATH environment variable. Go to Control Panel > System > Advanced System Settings > Environment Variables. Edit the line containing PATH in the top box marked User variables for <user>, and add ;C:\Perl64\bin (note the semicolon) to the end. Be sure not to corrupt anything that's already there.
The problems you are left with in your latest edit - Global symbol requires explicit package name - are because you have added use strict (a very good thing to do) and you haven't declared your variables. Also the line #i/Perl64/bin -w won't do anything and may as well be removed. Write this instead
use strict;
use warnings;
my $DNA1 = 'ATTTGGTAAAATGTATA';
my $DNA2 = 'TTTTGGGTTTGAAAT';
print "Here are two DNA fragments: \n\n";
print $DNA1, "\n\n";
print $DNA2, "\n\n";
my $DNA3 = "$DNA1$$DNA2";
print "$DNA3\n\n";
Did you try out Strawberry perl? It takes care of setting up the environment vars for you.
An environment variable may not be set up yet.
Since I no longer use Windows, I cannot give you the exact step by step instructions, but I can tell you, that somewhere in System Properties, you'll find a place to edit the environment variables.
Edit the path variable and append 'C:\Perl64\bin\' to it.
P.S.:This is assuming that when you cd to the said path, you are able to run the perl program. If not, something is wrong with the installation. Try re-installing Perl.