Problems with ROUGE on Windows - perl

I am trying to use ROUGE on Windows:
So the first few lines of the file:
use XML::DOM;
use DB_File;
use Getopt::Std;
#-------------------------------------------------------------------------------------
use vars qw($opt_a $opt_b $opt_c $opt_d $opt_e $opt_f $opt_h $opt_H $opt_m $opt_n $opt_p $opt_s $opt_t $opt_l $opt_v $opt_w $opt_2 $opt_u $opt_x $opt_U $opt_3 $opt_M $opt_z);
And it gives me this error:
Can't locate DB_File.pm in #INC (#INC contains: C:/Perl64/site/lib C:/Perl64/lib
.) at C:\RELEASE-1.5.5\ROUGE-1.5.5.pl line 174.
BEGIN failed--compilation aborted at C:\RELEASE-1.5.5\ROUGE-1.5.5.pl line 174.
I am new to perl. All i need is ROUGE to work. What does this mean? How can i fix it?

The author of the perl script probably did not test his script
on windows.
You could probably hack the script to make it work, but
since you're new to perl and seem to be in a hurry,
I suggest you use linux/unix for ROGUE.
The README for ROGUE mentions linuxy things like bash etc,
which is a clue.
If you insist, here's a way to get the perl script running
on windows, but be warned, further errors can pop up
as you get deeper in to the features.
remove activeperl
install strawberryperl 32bit
cpan install XML:DOM
cpan install DB_File

try:
close existing windows
open a new command prompt
run this command
ppm install DB_File
close window
try running rogue again
hope it helps
---
if you have a copy of the rogue application please share it so we can check it out.

Related

utf8::all on perl-5.12.3 doesn't work and I can't uninstall it

On Mac OS X 10.7.5 on which perl-5.12.3 is installed, I needed to use the utf8::all module so I have manually installed utf8-all-0.024 (Note the minimum perl version of v5.10.0 on its CPAN page) The make test has failed but I've still installed it to see if it would work. It didn't work so I've decided to uninstall it. I've tried 2 methods given at perl.com the first method didn't work as it required perl-5.14.2 The second method gave this message:
! utf-8 is not found in the following directories and can't be uninstalled.
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
and it couldn't uninstall it either. How to uninstall the utf8-all-0.024?
Furthermore, I had a small script listing all the Perl modules. It is:
use ExtUtils::Installed;
my $inst = ExtUtils::Installed->new();
my #modules = $inst->modules();
foreach $module (#modules) {
print $module . "\n";
}
This script started to take about a minute and half of the CPU time, to list the modules. Before I messed up the system, it was giving instant result. How to rectify it?
For the sake of completeness here is the #INC as given by the perl -V
#INC:
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
/Network/Library/Perl/5.12/darwin-thread-multi-2level
/Network/Library/Perl/5.12
/Library/Perl/Updates/5.12.3/darwin-thread-multi-2level
/Library/Perl/Updates/5.12.3
/System/Library/Perl/5.12/darwin-thread-multi-2level
/System/Library/Perl/5.12
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.12
.
Further info:
perl -Mutf8::all -e 'print $INC{"utf8/all.pm"}, "\n"' gives:
Can't locate Import/Into.pm in #INC (#INC contains: /Library
/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network
/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library
/Perl/5.12 /Library/Perl/Updates/5.12.3/darwin-thread-multi-2level
/Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-
thread-multi-2level /System/Library/Perl/5.12 /System/Library
/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library
/Perl/Extras/5.12 .) at /Library/Perl/5.12/utf8/all.pm line 140.
BEGIN failed--compilation aborted at /Library/Perl/5.12/utf8/all.pm line 140.
Compilation failed in require.
BEGIN failed--compilation aborted.
You've made a mess of things by incorrectly installing the module. Specifically, you didn't install the dependencies.
Ideally, you should use the package manager that provided perl itself. But they don't provide every module. So you'd use the non-package manager approach:
cpan utf8::all
(I prefer to install my own perl using perlbrew, then I can use cpan without worry.)
Now, cpan might claim that utf8::all is already installed. If so, this should get you straightened out:
cpan -t utf8::all
cpan -f utf8::all # Only if the previous command says everything is ok!

Perl CPAN Can't locate CPAN/Author.pm... when trying to install nipe

I'm trying to install "nipe" on my Windows Machine but i get this error code all the time. I have installed Strawberry Perl.
This is the error code:
Can't locate CPAN/Author.pm in #INC (you may need to install the CPAN::Author module) (#INC contains: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/share/perl5/core_perl/CPAN.pm line 19.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/CPAN.pm line 19.
Compilation failed in require at /usr/share/perl5/core_perl/App/Cpan.pm line 290.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/App/Cpan.pm line 290.
Compilation failed in require at /c/Strawberry/perl/bin/cpan line 7.
BEGIN failed--compilation aborted at /c/Strawberry/perl/bin/cpan line 7.
While you may have Strawberry Perl installed, that's not the perl you are using. C:\Strawberry\perl\bin\cpan uses the first perl in your PATH, which isn't your installation of Strawberry Perl. It appears that you are using some unix emulation (Cygwin? MSYS?) and using the perl from that emulation.
To use your Strawberry Perl build of perl, you could adjust your PATH so that SP comes before whatever perl you ended up using, or you could use
C:\Strawberry\perl\bin\perl C:\Strawberry\perl\bin\cpan Try::Tiny Config::Simple JSON
or
C:\Strawberry\perl\bin\perl -MCPAN -e"install #ARGV" Try::Tiny Config::Simple JSON
in lieu of
cpan Try::Tiny Config::Simple JSON
Similarly, if you don't adjust your path, you'll need to use
C:\Strawberry\perl\bin\perl nipe.pl ...
in lieu of
perl nipe.pl ...
If your are using windows and a bash then try to it with cmd or powershell after you applied the changes from #ikegami. Took me some time to figure out, that it had no effect to change the paths for this terminal, as it still took the paths from /usr//perl5/
I tried to do all of the other answers, but it didn't work. Instead it appeared that it doesn't work because I tried to run it from unix shell script (sh in powershell or git bash). After moving it from .sh to .ps1 and running non-unix way it works perfectly.

Why can't my Perl script locate DBD/mysql.pm even though cpan tells me DBD::mysql is installed?

OS: Mac 10.12.1, mysql 5.7.15
perl -e 'print $];'
5.016000
Error message:
Can't locate DBD/mysql.pm in #INC (you may need to install the DBD::mysql module) (#INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at ./testDBConnection.pl line 8.
BEGIN failed--compilation aborted at ./testDBConnection.pl line 8.
Source Code:
#!/usr/bin/perl
#use lib '/usr/bin/cpan';
use strict;
use FileHandle;
use File::Spec;
use DBI;
use DBD::mysql;
When I run: cpan DBD::mysql
Reading '/Users/user/.cpan/Metadata'
Database was generated on Fri, 18 Nov 2016 19:41:02 GMT
DBD::mysql is up to date (4.039).
When I run: perldoc -lm DBI DBD::mysql
/Users/user/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/DBI.pm
/Users/user/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/DBD/mysql.pm
Any suggestions?
Your shebang line refers to /usr/bin/perl. That is the interpreter that will be used to execute your script.
/usr/bin/perl is the perl that comes with your system. You did the right thing by not messing with the modules that came with it and instead installing your own. Now, you should tell your script to use it.
It looks like the correct perl is already in your path. Use which perl to see the full path to it.
As a side note, there is really no reason for the
use DBD::mysql;
line. DBI will chose which driver to load based on your connection string.
For more on shebang lines, see my answer on a different question.
Make links to per-version tools by brian d foy may help. I personally find tools such as perlbrew to be more a hindrance than help.
I think you've answered your own question. perldoc tells you that DBI:mysql is installed in /Users/user/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/DBD/mysql.pm, and perl tells you that INC does not contain that path.
The simplest solution to start is to either run perl -I <path above> or use lib <path above>;. I'm sure there's a better solution, but this is enough to get you started solving your own problem.

gvim can't locate the Perl modules

I'm trying to write a function in gvim that would use the module File::Path.But
it alert me "Can't locate File/Path.pm in #INC(#INC contains: .) at (eval 8) line 1.
BEGIN failed--compilation aborted at (eval 8) line 1." when gvim start.
I know it means gvim couldn't find my perl lib path.
So,my question was :
How to tell gvim the correct path to locate the Perl modules?I have tried to add use lib'C:/Perl/lib'; but the problem continued.
Thank you~~~
if has("perl")
function! Make_dir()
perl make_dir();
endfunction
autocmd VimEnter * call Make_dir()
perl <<EOF
use File::Path;
sub make_dir{
my $bakup=$ENV{'HOME'}."/bakup" ;
mkdir $bakup if not -e _;
#VIM::SetOption("backup");
#VIM::SetOption("backupdir=$bakup");
#VIM::Msg($bakup);
#todo....
}
EOF
endif
Did you "censor" your output, or does it really say just "(#INC contains: .)"? That would seem to indicate a bad installation of Perl. It should have a few more directories in there. It could indicate a permission problem, I imagine.
use lib doesn't work because Perl can't find lib.pm or any other module it comes with. -I should work though, but it would only be a bandaid fix.
http://vim.wikia.com/wiki/Script:556
BTW,I tried the way on vim tips wiki also...but the problem continued

installing Net/SSH/Perl.pm

I am fairly new to scripting with perl. I am trying to ssh into a server and perform some commands. I have to provide a username and password.
When trying to run the script that i have so far (code listed below). I get the following error.
I am assuming this means that i need to install/make Net/SSH/Perl.pm, however, when i follow the instructions and tutorials i have found online, none have worked.
Can someone please assist me. I have tried CPAN and ppm, CPAN says it cannot find net::ssh::perl or other variations of that string. And ppm will not even run, i do not see it in my perl directory. Any help is greatly appreciated!
// The code
#!/usr/bin/perl
use Net::SSH::Perl;
$uName = "username";
$pWord = "password";
$unitIp = $ARGV[0];
my $ssh = Net::SSH::Perl->new($unitIp, 35903);
$ssh->login($uName, $pWord);
my $out = $ssh->cmd("java -version");
print $out;
// the error that is returned
Can't locate Net/SSH/Perl.pm in #INC (#INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at needsAName.pl line 31.
BEGIN failed--compilation aborted at needsAName.pl line 31.
You can try this:
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
cpanm Net::SSH::Perl
case sensitive.
Explanation:
1st line will install "cpanm" - what is IMHO the easiest way installing modules
2nd line will install the module Net::SSH::Perl
Instead of Net::SSH::Perl try using Net::SSH2 or if you are in an Unix/Linux environment Net::OpenSSH. They are far easier to install!
Why should you use Net::OpenSSH instead of other perl ssh? This is what I found after install it via cpanm:
Net::OpenSSH Vs Net::SSH::.* modules
Why should you use Net::OpenSSH instead of any of the other Perl SSH
clients available?
Well, this is the perldoc writters (biased) opinion:
Net::SSH::Perl is not well maintained nowadays (update: a new
maintainer has stepped in so this situation could change!!!), requires
a bunch of modules (some of them very difficult to install) to be
acceptably efficient and has an API that is limited in some ways.
Net::SSH2 is much better than Net::SSH::Perl, but not completely stable
yet. It can be very difficult to install on some specific operative
systems and its API is also limited, in the same way as Net::SSH::Perl.
Using Net::SSH::Expect, in general, is a bad idea. Handling interaction
with a shell via Expect in a generic way just can not be reliably done.
Net::SSH is just a wrapper around any SSH binary commands available on
the machine. It can be very slow as they establish a new SSH connection
for every operation performed.
In comparison, Net::OpenSSH is a pure perl module that doesn't have any
mandatory dependencies (obviously, besides requiring OpenSSH binaries).
just type cpan on terminal and then type: force install Net::SSH::Perl
perl -MCPAN -e 'install Net::SSH::Perl'