Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Which package generates "Algorithm/Diff.pm"

293 views
Skip to first unread message

Stephen Liu

unread,
Nov 11, 2004, 6:17:45 AM11/11/04
to begi...@perl.org
Hi folks,

FedoraCore2

Kindly advise which package I have to install to
generate "Algorithm/Diff.pm"

I ran following script
$ perl compare_s3_fifo.pl doc_a doc_b

Printout;
>>>>>
Can't locate Algorithm/Diff.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.3/i386
-linux-thread-multi /usr/lib/perl5/5.8.3
/usr/lib/perl5/site_perl/5.8.3/i386-lin
ux-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/i38
6-linux-thread-multi /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.3/i386-linux-thread-multi
/usr/lib/perl
5/vendor_perl/5.8.2/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.1/i38
6-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/u sr/lib/perl5/vendor_perl/5.8.3
/usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/v
endor_perl/5.8.1
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl .) at
compare_s3_fifo.pl line 5.
BEGIN failed--compilation aborted at
compare_s3_fifo.pl line 5.
<<<<<

TIA

B.R.
Stephen Liu

Gunnar Hjalmarsson

unread,
Nov 11, 2004, 6:19:05 AM11/11/04
to begi...@perl.org
Stephen Liu wrote:
> Kindly advise which package I have to install to
> generate "Algorithm/Diff.pm"
>
> I ran following script
> $ perl compare_s3_fifo.pl doc_a doc_b
>
> Printout;
>
> Can't locate Algorithm/Diff.pm in @INC ...

A wild guess: Algorithm::Diff ;-)

Please study "perldoc perlmod".

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Stephen Liu

unread,
Nov 11, 2004, 7:23:22 AM11/11/04
to r.m.bo...@home.nl, begi...@perl.org
Hi Rene,

Tks for your URL.

I also found this link but could not resolve how to
create the module.

B.R.
Stephen

--- Rene Borchers <r.m.bo...@home.nl> wrote:
>
> Hi,
>
> Searching www.cpan.org
>
>
http://search.cpan.org/search?query=Algorithm%2FDiff&mode=all
>
>
> On Thu, 2004-11-11 at 12:17, Stephen Liu wrote:
> > Hi folks,
> >
> > FedoraCore2


> >
> > Kindly advise which package I have to install to
> > generate "Algorithm/Diff.pm"
> >
> > I ran following script
> > $ perl compare_s3_fifo.pl doc_a doc_b
> >
> > Printout;
> > >>>>>

Chris Devers

unread,
Nov 11, 2004, 7:30:32 AM11/11/04
to Stephen Liu, Perl Beginners List
On Thu, 11 Nov 2004, Stephen Liu wrote:

> I also found this link but could not resolve how to
> create the module.

Lucky for you, the module has already been created by someone else.

All you have to do is install it.

sudo perl -MCPAN -e 'install Algorithm::Diff'

Or something similar to that should work.


--
Chris Devers

Rene Borchers

unread,
Nov 11, 2004, 7:12:14 AM11/11/04
to Stephen Liu, begi...@perl.org

Hi,

Searching www.cpan.org

http://search.cpan.org/search?query=Algorithm%2FDiff&mode=all


On Thu, 2004-11-11 at 12:17, Stephen Liu wrote:

Stephen Liu

unread,
Nov 11, 2004, 9:42:14 AM11/11/04
to Perl Beginners List
Hi Chris,

Tks for your advice.

--- Chris Devers <cde...@pobox.com> wrote:

> All you have to do is install it.
>
> sudo perl -MCPAN -e 'install Algorithm::Diff'

There was something strange happend here in runnning

$sudo perl -MCPAN -e 'install Algorithm::Diff'
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
Sorry, try again.
sudo: 3 incorrect password attempts

I tried several times but I can't login. I have to
'su' first and then ran;

#perl -MCPAN -e 'install Algorithm::Diff'
.......
.......
Running make install
Installing
/usr/lib/perl5/site_perl/5.8.3/Algorithm/diffnew.pl
Installing
/usr/lib/perl5/site_perl/5.8.3/Algorithm/diff.pl
Installing
/usr/lib/perl5/site_perl/5.8.3/Algorithm/htmldiff.pl
Installing
/usr/lib/perl5/site_perl/5.8.3/Algorithm/Diff.pm
Installing
/usr/lib/perl5/site_perl/5.8.3/Algorithm/DiffOld.pm
Installing
/usr/lib/perl5/site_perl/5.8.3/Algorithm/cdiff.pl
Installing /usr/share/man/man3/Algorithm::Diff.3pm
Installing /usr/share/man/man3/Algorithm::DiffOld.3pm
Writing
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/auto/Algorithm/Diff/.packlist
Appending installation info to
/usr/lib/perl5/5.8.3/i386-linux-thread-multi/perllocal.pod
/usr/bin/make install -- OK

It worked for me. Did I make any mistake?

Furthermore if I could not find the module from
Internet, how to create it. As beginner on perl, I'm
interested to learn. Please advise.

TIA

B.R.
Stephen

Rene Borchers

unread,
Nov 11, 2004, 10:01:10 AM11/11/04
to Perl Beginners List
After installation, the module is ready to use. Try running your
program.

For the sudo command you have to modify the file /etc/sudoers, in this
file stands which user is allowed to execute which command with root
permission. therefore you you have to add yourself allowing to execute
the perl -M CPAN install ...... command.

Stephen Liu

unread,
Nov 11, 2004, 10:25:14 AM11/11/04
to Perl Beginners List
Hi Rene,

--- Rene Borchers <r.m.bo...@home.nl> wrote:

> After installation, the module is ready to use. Try
> running your program.

It worked now. Tks.

> For the sudo command you have to modify the file
> /etc/sudoers, in this
> file stands which user is allowed to execute which
> command with root
> permission. therefore you you have to add yourself
> allowing to execute
> the perl -M CPAN install ...... command.

# cat /etc/sudoers
.....
User privilege specification
root ALL=(ALL) ALL

# Uncomment to allow people in group wheel to run all
commands
# %wheel ALL=(ALL) ALL
....

I'll uncomment the above line

B.R.
Stephen

Chris Devers

unread,
Nov 11, 2004, 10:53:06 AM11/11/04
to Stephen Liu, Perl Beginners List
On Thu, 11 Nov 2004, Stephen Liu wrote:

> Hi Chris,
>
> [Thanks] for your advice.


>
> --- Chris Devers <cde...@pobox.com> wrote:
>
> > All you have to do is install it.
> >
> > sudo perl -MCPAN -e 'install Algorithm::Diff'
>
> There was something strange happend here in runnning
>
> $sudo perl -MCPAN -e 'install Algorithm::Diff'
> Password:
> Sorry, try again.
> Password:
> Sorry, try again.
> Password:
> Sorry, try again.
> sudo: 3 incorrect password attempts
>
> I tried several times but I can't login.

You use your own, normal login password for `sudo`.

Whatever you use to log in to the computer, that's what `sudo` needs.

> I have to 'su' first and then [run]:


>
> #perl -MCPAN -e 'install Algorithm::Diff'
> .......
> .......
> Running make install
> Installing
> /usr/lib/perl5/site_perl/5.8.3/Algorithm/diffnew.pl
> Installing
> /usr/lib/perl5/site_perl/5.8.3/Algorithm/diff.pl
> Installing
> /usr/lib/perl5/site_perl/5.8.3/Algorithm/htmldiff.pl
> Installing
> /usr/lib/perl5/site_perl/5.8.3/Algorithm/Diff.pm
> Installing
> /usr/lib/perl5/site_perl/5.8.3/Algorithm/DiffOld.pm
> Installing
> /usr/lib/perl5/site_perl/5.8.3/Algorithm/cdiff.pl
> Installing /usr/share/man/man3/Algorithm::Diff.3pm
> Installing /usr/share/man/man3/Algorithm::DiffOld.3pm
> Writing
> /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/auto/Algorithm/Diff/.packlist
> Appending installation info to
> /usr/lib/perl5/5.8.3/i386-linux-thread-multi/perllocal.pod
> /usr/bin/make install -- OK
>
> It worked for me. Did I make any mistake?

No, this is good -- you installed it.

You can test that it's installed by running a command like

$ perl -MAlgorithm::Diff -e '1'

If it works -- and it should -- then you can begin using scripts that
use this module. If you get an error, even though the installation
appears to have worked, something went wrong -- but chances are
excellent that if you made it this far, there will be no errors.

> Furthermore if I could not find the module from Internet, how to
> create it. As beginner on perl, I'm interested to learn. Please
> advise.

The nice thing about the CPAN tool is that it makes finding things from
the internet really easy. If you know exactly what you want to install,
you can just run it from the command line, as above, like

$ sudo perl -MCPAN -e 'install Module'

or, as you did it,

# perl -MCPAN -e 'install Module'

But you can also launch an interactive command shell by running

$ sudo perl -MCPAN -e shell

and from there, you can search for and install anything on CPAN. It
should be pretty self-explanatory, but if at any time you need help,
just type '?' at the prompt for a list of commands.


--
Chris Devers

Chris Devers

unread,
Nov 11, 2004, 10:56:54 AM11/11/04
to Stephen Liu, Perl Beginners List
On Thu, 11 Nov 2004, Stephen Liu wrote:

Wait!

All changes to the /etc/sudoers file should be made with the `visudo`
command. `visudo` will edit the file (using whatever editor you have
specified with $EDITOR or $VISUAL), make sure things are consistent,
etc. It's a good idea not to edit it directly, but to go in through
`visudo` just to get the checks that it provides.

--
Chris Devers

Stephen Liu

unread,
Nov 12, 2004, 3:20:03 AM11/12/04
to Perl Beginners List
Hi Chris,

Tks for your advice.

> All changes to the /etc/sudoers file should be made


> with the `visudo`
> command. `visudo` will edit the file (using whatever
> editor you have
> specified with $EDITOR or $VISUAL), make sure things
> are consistent,
> etc. It's a good idea not to edit it directly, but
> to go in through
> `visudo` just to get the checks that it provides.

I tried follows without result;

# /etc/sudoers `visudo`
Vim: Warning: Output is not to a terminal

# /etc/sudoers `visudo` $nano
Vim: Warning: Output is not to a terminal

# /etc/sudoers `visudo` $VISUAL
Vim: Warning: Output is not to a terminal

I could not proceed further, no output found.

B.R.
Stephen

Chasecreek Systemhouse

unread,
Nov 12, 2004, 3:09:56 AM11/12/04
to Perl Beginners List
As root type -

perl -MCPAN e shell

at the cpan> type -

install Bundle::CPAN

Research and Answer all the questions; if you have issues then e-mail
them to the list.

--
WC -Sx- Jones
http://youve-reached-the.endoftheinternet.org/

Chris Devers

unread,
Nov 12, 2004, 7:32:56 AM11/12/04
to Chasecreek Systemhouse, Perl Beginners List
On Fri, 12 Nov 2004, Chasecreek Systemhouse wrote:

> As root type -
>
> perl -MCPAN e shell
>
> at the cpan> type -
>
> install Bundle::CPAN
>
> Research and Answer all the questions; if you have issues then e-mail
> them to the list.

Is this safe? Didn't this used to try to install a whole new copy of
Perl? Has that been fixed yet?

--
Chris Devers

Chris Devers

unread,
Nov 12, 2004, 7:36:04 AM11/12/04
to Stephen Liu, Perl Beginners List
On Fri, 12 Nov 2004, Stephen Liu wrote:

> I tried follows without result;
>
> # /etc/sudoers `visudo`
> Vim: Warning: Output is not to a terminal
>
> # /etc/sudoers `visudo` $nano
> Vim: Warning: Output is not to a terminal
>
> # /etc/sudoers `visudo` $VISUAL
> Vim: Warning: Output is not to a terminal
>
> I could not proceed further, no output found.

????

The entire command is `visudo`:

# visudo

"/etc/sudoers" is a config file, not a program, so any command line that
begins with it is not going to do anything.

For help, see the man page:

$ man visudo


--
Chris Devers

Chris Devers

unread,
Nov 12, 2004, 7:56:29 AM11/12/04
to Stephen Liu, Perl Beginners List
On Fri, 12 Nov 2004, Stephen Liu wrote:

> Hi Chris,


>
> > #perl -MCPAN -e 'install Algorithm::Diff'
>

> What will be the option '-MCPAN' for, to connect MCPAN
> FTP site?

Please run this command to see Perl's command line options:

$ perl --help

The construct '-M...' loads module '...'; in this case that's CPAN.pm.



> > You can test that it's installed by running a
> > command like
> >
> > $ perl -MAlgorithm::Diff -e '1'
>

> I ran it, no complaint popup (no printout). I suppose
> '-MAlgorithm' is the module. What will be the number
> '1' for?

See `perl --help` again: the '-e' flag says "execute one line of program
code. I'm using '1' because it's simple, it does nothing, and it should
always return true. If you get an error, it's not because '1' is broken,
it's because the module import went wrong. For example:

$ perl -MNonexistent::Module -e 1
Can't locate Nonexistent/Module.pm in @INC (@INC
contains: /sw/lib/perl5/5.8.1/darwin-thread-multi-2level
/sw/lib/perl5/5.8.1 /sw/lib/perl5 /sw/lib/perl5/darwin
/System/Library/Perl/5.8.1/darwin-thread-multi-2level
/System/Library/Perl/5.8.1 /Library/Perl/5.8.1/darwin-thread-multi-2level
/Library/Perl/5.8.1 /Library/Perl
/Network/Library/Perl/5.8.1/darwin-thread-multi-2level
/Network/Library/Perl/5.8.1 /Network/Library/Perl .).
BEGIN failed--compilation aborted.

Which is expected, because I made up 'Nonexistent::Module.pm' knowing
that it doesn't actually exist. On the other hand,

$ perl -MCGI -e 1
$

is also expected, because CGI.pm exists and comes bundled with Perl.

> Ran following test
> # perl -MCPAN -e shell
> Terminal does not support AddHistory.
>
> cpan shell -- CPAN exploration and modules
> installation (v1.7601)
> ReadLine support available (try 'install
> Bundle::CPAN')
>
> cpan> ?
> displaying help
>
> Whether 'look' there for seaching modules? What does
> "Terminal does not support AddHistory' indicate

Nothing important.

To look up a module, try:

cpan> i /PATTERN/

for example,

cpan> i /lgorithm/

(I forget if the pattern is case sensitive here, so I'm leaving off the
initial 'a' from 'algorithm' to be on the safe side.)

To install a module, try:

cpan> install Module

It will download, unpack, configure, build, test, and installl for you.
If the module has dependencies, it will attempt to get them first.

Please read `perldoc CPAN.pm` for an overview of the CPAN.pm shell:

$ perldoc CPAN.pm

> <Ctrl+c> did not exit the command but popup
> cpan> Caught SIGINT
>
> What does it indicate?
>
> I have to close xterm to exit

<Ctrl+d> should have worked, but the right way is to just `quit`:

cpan> quit
Lockfile removed.
$

and you end up back at your OS shell prompt.


--
Chris Devers

Chasecreek Systemhouse

unread,
Nov 12, 2004, 10:42:37 AM11/12/04
to Perl Beginners List
On Fri, 12 Nov 2004 07:32:56 -0500 (EST), Chris Devers
<cde...@pobox.com> wrote:
> On Fri, 12 Nov 2004, Chasecreek Systemhouse wrote:
> > install Bundle::CPAN

>
> Is this safe? Didn't this used to try to install a whole new copy of
> Perl? Has that been fixed yet?


Well, it was fixed on the three systems I have used it on this past month:

CygWin, Debian Ultrasparc, and Solaris 10.

It did not try to install a new version of Perl.
--
WC -Sx- Jones
http://insecurity.org/

Chris Devers

unread,
Nov 12, 2004, 11:07:04 AM11/12/04
to Chasecreek Systemhouse, Perl Beginners List
On Fri, 12 Nov 2004, Chasecreek Systemhouse wrote:

> On Fri, 12 Nov 2004 07:32:56 -0500 (EST), Chris Devers
> <cde...@pobox.com> wrote:
> > On Fri, 12 Nov 2004, Chasecreek Systemhouse wrote:
> > > install Bundle::CPAN
> >
> > Is this safe? Didn't this used to try to install a whole new copy of
> > Perl? Has that been fixed yet?
>
> Well, it was fixed on the three systems I have used it on this past
> month:

Okay, just checking -- I learned quickly not to use it, and have been
ignoring the warnings about "you should upgrade" ever since out of an
apparently outdated fear that it would go haywire :-)

--
Chris Devers

Stephen Liu

unread,
Nov 12, 2004, 10:23:33 PM11/12/04
to Perl Beginners List
Hi Chris,

Tks for your advice.

Chris Devers <cde...@pobox.com> wrote:

> To look up a module, try:
>
> cpan> i /PATTERN/
>
> for example,
>
> cpan> i /lgorithm/
>
> (I forget if the pattern is case sensitive here, so
> I'm leaving off the
> initial 'a' from 'algorithm' to be on the safe
> side.)

It works on both upper and lower cases.

> To install a module, try:
>
> cpan> install Module

- snip -


> Please read `perldoc CPAN.pm` for an overview of the
> CPAN.pm shell:
>
> $ perldoc CPAN.pm

- snip -

> <Ctrl+d> should have worked, but the right way is to
> just `quit`:
>
> cpan> quit
>
> Lockfile removed.
> $
>
> and you end up back at your OS shell prompt.

Noted with thanks

B.R.
Stephen

0 new messages