ANSIColor-1.07 problem with colors in dtterm

R

Roman Kaganovich

Hello,

When I run this script example from Perl Cookbook in - chapter 15.5
==================================================
1 #!/usr/bin/perl -w
2
3
4 use lib qw(~/Perl/Modules/ANSIColor-1.07/blib/lib/Term/ANSIColor.pm);
5
6 use Term::ANSIColor ;
7
8 print color("red"), " Red Text sample\n", color("reset");
9 print "Just simple text\n";
10 print colored("<BLINK> Blinked text </BLINK>", "blink");

==================================================

In Linux (xterm) I got all expected outputs, but in
dtterm of SunOS 5.8 I got:

Can't locate Term/ANSIColor.pm in @INC (@INC contains:
~/Perl/Modules/ANSIColor-1.07/blib/lib/Term/ANSIColor.pm .
/usr/local/tools/tcsh/6.10.00/lib/perl5
/usr/local/toolset/2002Q1/lib/perl5 /usr/local/lib/perl5
/usr/local/lib/perl /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503
/usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .)
at ./colors.pl line 6.
BEGIN failed--compilation aborted at ./colors.pl line 6.

Will thankful for answer.
Bye.
 
A

Anno Siegel

Roman Kaganovich said:
Hello,

When I run this script example from Perl Cookbook in - chapter 15.5
==================================================
1 #!/usr/bin/perl -w
2
3
4 use lib qw(~/Perl/Modules/ANSIColor-1.07/blib/lib/Term/ANSIColor.pm);

That line is wrong. With "use lib" you don't specify the module file,
but additional directories to search for modules. So that should be

use lib qw(~/Perl/Modules/ANSIColor-1.07/blib/lib);

It is also unusual to load a module from the build directory, but
that should work if you want to do it that way.
5
6 use Term::ANSIColor ;
7
8 print color("red"), " Red Text sample\n", color("reset");
9 print "Just simple text\n";
10 print colored("<BLINK> Blinked text </BLINK>", "blink");

==================================================

In Linux (xterm) I got all expected outputs, but in
dtterm of SunOS 5.8 I got:
Can't locate Term/ANSIColor.pm in @INC (@INC contains:

[...]

I suppose the Linux system happens to have Term::ANSIColor installed
elsewhere and the Solaris doesn't.

Anno
 
B

Ben Morrow

Quoth (e-mail address removed) (Roman Kaganovich):
Hello,

When I run this script example from Perl Cookbook in - chapter 15.5
==================================================
1 #!/usr/bin/perl -w
2
3
4 use lib qw(~/Perl/Modules/ANSIColor-1.07/blib/lib/Term/ANSIColor.pm);

You just want .../blib/lib, not the whole path down to the module.

Note that if your current directory is (pretty much) anywhere underneath
ANSIColor-1.07 you can simply 'use blib;' which will find the right blib
directory for you.
Can't locate Term/ANSIColor.pm in @INC (@INC contains:
~/Perl/Modules/ANSIColor-1.07/blib/lib/Term/ANSIColor.pm .

Perl's looking for .../blib/lib/Term/ANSIColor.pm/Term/ANSIColor.pm, and
not finding it.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top