Perl...

Soldato
Joined
24 Nov 2002
Posts
16,378
Location
38.744281°N 104.846806°W
Am I being dense or something here?

I've installed ActivePerl (5.8.8 Build 819) for Win as I don't have a mac/linux set up handy.

However, I am a complete newbie when it comes to perl etc... how do I, for instance, 'install' something?

The instructions say things like:

A. DECOMPRESS
B. UNPACK

C. BUILD

Go into the newly-created directory and type:

perl Makefile.PL
dmake
dmake test

Depending on your perl configuration, dmake might not be available. You might have to substitute whatever perl -V:make says. (Usually, that will be nmake or make.)

D. INSTALL

While still in that directory, type:

dmake install

This doesn't work....? (have tried make, nmake and dmake)...

Am I being stupid here?

EDIT - also can't get cpan to work..
 
Last edited:
JIMA said:
I remember that nmake is provided as part of Visual C++, I think it's also available as a separate free download from Microsoft.

When you run the MakeFile.pl script it creates a make file that is then run by using nmake etc. This installs the Perl module into the relevant directories. If you're prepared to do some fiddling it is usually possible to install modules manually by copying files to the various directories though it's probably not recommended.

All this is easier on UNIX as make is supplied as standard. If only a decent set (any set) of programming tools were provided with Windows!

Have a look at the O'Reilly Perl book (the Camel book). It gives a good description of how to install modules.

Hope that helps.

Cheers... will grab the book asap.

Quick question, define "relevant directories" please?
 
JIMA said:
If you look in the directory where you installed Perl you'll see a number of other directories such as lib, site/lib etc. When you install a Perl module the various files get copied to specific directories, these being specified within the make file. From what I remember modules that are installed after the installation of Perl commonly get put in the site/lib directory structure (rather than the installation's lib directory).

The O'Reilly Perl "Camel" book is well worth getting. However, if you're learning Perl I'd strongly recommend getting the O'Reilly "Learning Perl" book and reading through that first, doing the exercises as you go. I found this book really good at getting a grasp on the language, in particular regular-expressions. Took a couple of weeks to go through but well worth the effort.

The "Camel" book goes pretty deep into the language, and necessarily so, but does assume the reader is fairly familiar with Perl. For example, it covers reg exps in no end of detail, threads, the Perl debugger etc. and could be quite confusing.

If you read Learning Perl first I think you'll find you get much more out of the Camel book.
Cool! I'm gonna assume people have them at work that I can borrow as the perl a lot!

By the way, I copied the modules (that weren't in ppm) just randomly around.. some in site/lib, some in root/lib etc... It appears to have worked...

However, should I worry about errors such as:

Using an array as a reference is deprecated @ ....
Useless use of a contant in void context @....
Use of uninitialiszed value in concatenation <.> or string @.....
etc...

Like I said, I didn't write the code and just need it to work....
 
JIMA said:
Each Perl module usually comes with a set of test programs. Run these and they'll report back whether each module works. It could be that failure in some tests is OK, usually documented in the readme that comes with the module.

The "use of an uninitialized variable" points to a variable that has been declared but hasn't been explicitly assigned something is being used. You could fix this by assigning a value to the variable at the point it is declared. Not too sure about the other errors.

You can compile your Perl program using a number of different pre-processor commands to enforce strictness. I usually put "use strict" at the top of the code. This ensures variables are declared with scope (using the my statement) amongst other things. However, doing this on a piece of code which wasn't written with this at the top usually leads to a whole bunch of errors being displayed.

If you're concerned about the errors you can use the Perl debugger (have a look at the O'Reilly Perl Debugger Pocket Guide) to really get down to the nitty-gritty of what's going on. Being a command-line debugger it isn't particularly easy to use but is extremely useful once you get the hang of it.

Lots of fun and frustration to be had with Perl!
hold me :(
 
Back
Top Bottom