For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2008 > algorithm/permute.pm









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author algorithm/permute.pm
Sharan Basappa

2008-03-24, 7:05 pm

Hi,

I am trying to use permute call from the above module and I get the
following error.
I believe this is due to either missing lib or incorrect path setting.
Can you tell
me how to install this package quickly in my home path and try out this call?

Regards

Can't locate Algorithm/Permute.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 Perm.pl line 2.
BEGIN failed--compilation aborted at Perm.pl line 2.
Paul Lalli

2008-03-24, 7:05 pm

On Mar 24, 11:52=A0am, sharan.basa...@gmail.com (Sharan Basappa) wrote:
> Hi,
>
> I am trying to use permute call from the above module and I get the
> following error.
> I believe this is due to either missing lib or incorrect path setting.
> Can you tell
> me how to install this package quickly in my home path and try out this ca=

ll?

perldoc -q install
Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq8.pod
How do I install a module from CPAN?


Paul Lalli

Sisyphus

2008-03-26, 8:03 am

On Mar 25, 2:52=A0am, sharan.basa...@gmail.com (Sharan Basappa) wrote:
> Hi,
>
> I am trying to use permute call from the above module and I get the
> following error.
> I believe this is due to either missing lib or incorrect path setting.
> Can you tell
> me how to install this package quickly in my home path and try out this ca=

ll?
>
> Regards
>
> Can't locate Algorithm/Permute.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 Perm.pl line 2.
> BEGIN failed--compilation aborted at Perm.pl line 2.


In addition to Paul's advice, I notice that @INC does not appear to
contain (anything that resembles my expectation of what would be) your
"home path".
Assuming that Permute.pm was successfully installed into the /home/me/
lib/Algorithm/ directory, then Perm.pl would need to begin with:

use lib '/home/me/lib';

If, instead, the problem is how to install Algorithm::Permute into /
home/me/lib, then (with a manual install) it's just a matter of
starting with:

perl Makefile.PL PREFIX=3D/home/me/lib
or
perl Makefile.PL PREFIX=3D~/lib

(This is documented in 'perldoc Extutils::MakeMaker', which is
referenced in the FAQ entry that Paul presented.)

Cheers,
Rob

Sharan Basappa

2008-03-31, 8:29 am

I did the following:
perl Makefile.PL PREFIX=/u/basappas/local/perl/Algorithm-Permute-0.06

I got the following message:
perl/Algorithm-Permute-0.06
Writing Makefile for Algorithm::Permute

Now what? Should I execute the make file?

After that can I point to this library and start using new library?

Regards

On Wed, Mar 26, 2008 at 3:45 PM, sisyphus <sisyphus359@gmail.com> wrote:
>
> On Mar 25, 2:52 am, sharan.basa...@gmail.com (Sharan Basappa) wrote:
>
> In addition to Paul's advice, I notice that @INC does not appear to
> contain (anything that resembles my expectation of what would be) your
> "home path".
> Assuming that Permute.pm was successfully installed into the /home/me/
> lib/Algorithm/ directory, then Perm.pl would need to begin with:
>
> use lib '/home/me/lib';
>
> If, instead, the problem is how to install Algorithm::Permute into /
> home/me/lib, then (with a manual install) it's just a matter of
> starting with:
>
> perl Makefile.PL PREFIX=/home/me/lib
> or
> perl Makefile.PL PREFIX=~/lib
>
> (This is documented in 'perldoc Extutils::MakeMaker', which is
> referenced in the FAQ entry that Paul presented.)
>
> Cheers,
> Rob
>
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

Sharan Basappa

2008-03-31, 7:51 pm

Here is what I have been able to do after installing the permute module:

My updated code looks like:
#!/usr/bin/perl
use lib "/u/basappas/local/perl/Algorithm-Permute-0.06/Algorithm::Permute";
Algorithm::Permute::permute { print "@array\n" } @array;

When I execute this script, I get the following error:
Can't call method "Algorithm::Permute::permute" without a package or
object reference at Perm.pl line 3.

Actually, I took this example from permute user manual, which says:

use Algorithm::Permute;

my $p = new Algorithm::Permute(['a'..'d']);
while (@res = $p->next) {
print join(", ", @res), "\n";
}

my @array = (1..9);
Algorithm::Permute::permute { print "@array\n" } @array;

Where Am I going wrong?

Regards

On Mon, Mar 31, 2008 at 6:40 PM, Sharan Basappa
<sharan.basappa@gmail.com> wrote:
> I did the following:
> perl Makefile.PL PREFIX=/u/basappas/local/perl/Algorithm-Permute-0.06
>
> I got the following message:
> perl/Algorithm-Permute-0.06
> Writing Makefile for Algorithm::Permute
>
> Now what? Should I execute the make file?
>
> After that can I point to this library and start using new library?
>
> Regards
>
>
>
> On Wed, Mar 26, 2008 at 3:45 PM, sisyphus <sisyphus359@gmail.com> wrote:
>

Sisyphus

2008-04-01, 7:05 pm

> I did the following:
> perl Makefile.PL PREFIX=/u/basappas/local/perl/Algorithm-Permute-0.06


That's probably where you've got the Algorithm-Permute source - I'm
not so sure it's a good idea to install the module into the source
folder, but if you want to do that then next run 'make test', followed
by 'make install'.

Then, try this script:

#!/usr/bin/perl
use warnings;
use lib "/u/basappas/local/perl/Algorithm-Permute-0.06";
use Algorithm::Permute;

my @array = (1..4);
Algorithm::Permute::permute { print "@array\n" } @array;

Why are you installing version 0.06 when the latest version is 0.11 ?

Cheers,
Rob

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com