teknomage1 has asked for the wisdom of the Perl Monks concerning the following question:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to Teach artists Perl w/out Modules
by flyingmoose (Priest) on Jan 30, 2004 at 21:42 UTC | |
I would not just copy and paste the code you need. Create a local directory on your machine and save the CPAN files (which should be available in an archive format) on your hard drive or locker space or whatever is the easiest. Most universities with Unix systems can create public lockers that users can mount, or maybe you can share this in your home directory for others to use. Then towards the top of the file
You will be able to use most, if not all, modules as if you had installed them through the normal convention. A good module to use might be GD | [reply] [d/l] |
by Intrepid (Curate) on Jan 30, 2004 at 22:51 UTC | |
I would not just copy and paste the code you need. Create a local directory on your machine and save the CPAN files (which should be available in an archive format) on your hard drive or locker space or whatever is the easiest. Right. This is the right answer nearly all the time, I think. In this case particularly, modules that deal with images are very complex, usually use xsubs, and so on. Cutting-and-pasting is not likely to work out well. One question I have (for the OP) is "why targa (.tga)?" That's one of the odder and more difficult formats to work with. GD supports PNG (IMHO, the best format for this case), JPEG and so forth, and PerlMagick/ImageMagick.pm supports .tga and many others, but is much more difficult to install than GD. For starters I would recommend working in the PNG format, doing any pre-conversion of .tga to .png necessary. Soren A / somian / perlspinr / Intrepid
-- Cynicism is not "cool" or "hip" or "intelligent". It's like Saddam Hussein's piss mixed with 004 grit and nitric acid. It's corrosive to everything it touches, destructive to human endeavors, foul and disgusting. And ultimately will eat away the insides of the person who nurtures it. | [reply] |
by g00n (Hermit) on Jan 31, 2004 at 05:24 UTC | |
ohh, this is a horrible way to do things. I know I've done this and would not recommend it. Why? CPAN modules are built much like LEGO. A lot of the image modules may be built upon other modules. So you require all the parent modules of the module you choose. I had to use this method (no net connection) to download, install a complex system using many CPAN modules. Downloading and installing by hand is bad, frustrating and slow.
What system are you using? (Windows? - Can you install Cygwin?) or Do you have access to a laptop with net access so you can install the CPAN modules. Using CPAN to download modules is good.
ls AUTHORNAME get AUTHORNAME/CPAN_MODULENAME At least you can use the systems side by side with the possibility of transferring working code from the laptop to target machine.
| [reply] [d/l] [select] |
by teknomage1 (Initiate) on Jan 31, 2004 at 18:28 UTC | |
| [reply] |
by ysth (Canon) on Feb 01, 2004 at 08:36 UTC | |
Re: How to Teach artists Perl w/out Modules
by Sol-Invictus (Scribe) on Jan 31, 2004 at 15:07 UTC | |
1. make a site_perl folder somewhere in your user account :
2. set the environment variable PERL5LIB :
you can check if it's set correctly by typing:
This only affects the Environment variables of the shell, not the system, so you may have to logout and re-login in before the new path will become active. If the echo command still doesn't seem to print anything, or, if it prints something different from what you typed even after logging out and in, then the variable hasn't been set correctly. Repeat the last few steps again to set the new path. 3. FTP the module into your site_perl folder
4. DECOMPRESS the file:
5. UNPACK the file :
6. BUILD the module (sometimes unnecessary):
7. INSTALL the module:
8. Troubleshooting: If you get errors about a file not being created:
i. create the path to the file as it was written in the error If the error says a module is missing - this is caused by dependancy, in other words the module you want uses another module:
i. FTP the missing module from ftp.CPAN.org into your site_perl folder as before After installation, in your scripts and cgis, insert the line (perl versions 5.002 and later):
or for earlier perls (5.001 and before):
so the perl interpreter will know to check your site_perl dir for modules. Installing CPAN.pm CPAN.pm was designed to free you out from the circular hell of dependancy. Follow the installation procedure as above, once installed and you've checked that the path to your site_perl folder is set correctly in the ENVIRONMENT variables you can start up the CPAN shell by typing:
the first time you run it you'll be prompted for config info, in most cases the default values are fine (just press enter without writing anything), but you must make sure you set the following two correctly for either CPAN.pm, or any modules it installs, to work correctly:
which outputs a listing of all the config variables* similar to this:
*note: the first 3 are commands To run this config script again at any time type (in the CPAN shell):
See the relevant MAN page or PODs for more information on how to set or unset these variables individually, either:
or:
Once installed correctly, adding other modules to your site_perl becomes a breeze - just type:
and CPAN.pm does the rest (including installing any other fish hooked modules). Equally as useful, through CPAN you can check for newer releases of existing modules and automatically install them as they become available, much like a package management system. For a brief summary of CPAN.pm's commands use the CPAN shell's own internal help function:
| [reply] [d/l] [select] |
Re: How to Teach artists Perl w/out Modules
by hardburn (Abbot) on Jan 30, 2004 at 21:37 UTC | |
Grab the module off CPAN and cut-and-paste the code you need. ---- : () { :|:& };: Note: All code is untested, unless otherwise stated | [reply] [d/l] |
by teknomage1 (Initiate) on Jan 30, 2004 at 21:55 UTC | |
| [reply] |
Re: How to Teach artists Perl w/out Modules
by David Caughell (Monk) on Jan 30, 2004 at 21:56 UTC | |
I ran into this problem at my college also. However, if you're allowed to put a module in your home directory, with your perl script, go ahead and do that, because when the use (directive?) is called, it checks the current (script's?) directory. You might be able to skate by them this time. :) Dave | [reply] [d/l] |
Re: How to Teach artists Perl w/out Modules
by cees (Curate) on Jan 31, 2004 at 01:20 UTC | |
If you want to do a lot of work with images and don't want to use external modules, then can I suggest you find a targa to pbm (portable bit map) converter so that you can work with the images in pbm format (or ppm if you want color as well). That is about the simplest image format available, and is very easy to manipulate with straight perl. I am pretty sure that the netpbm package comes with a pbmtotga and tgatopbm program to do the conversion for you. Here is a description of the ppm image format: http://netpbm.sourceforge.net/doc/ppm.html | [reply] |
Re: How to Teach artists Perl w/out Modules
by CountZero (Bishop) on Jan 31, 2004 at 08:39 UTC | |
Such stupid policies are like trying to teach someone to drive a car, but the steering wheel has been removed and you may not install it, since steering wheels have caused a lot of chest injuries in the past. CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law | [reply] |