So you want to learn a unix scripting language that you'll be able to use in any situation? Perl is your answer !
This is a little intro to installing CPAN modules. If you don't know what CPAN is, check out http://search.cpan.org/. Basicly, it is a massive archive of perl libraries that will allow you to do pretty much anything. (Once I wrote a shoutcast-style streamer in perl with a web front end, automatic down sampling and ogg->mp3 conversion, but that is a whole other story.)
Using CPAN is easy.
The -M flag tells perl to load a perl module. -MCPAN is the same as putting 'use CPAN;' in your script.
The -e flag tells perl to execute a command. In this case, the CPAN module exports a function called 'shell'.
When you first run the CPAN shell, it'll ask you a bunch of questions about where to find a mirror, and what tar program to use, etc. You can use defaults if you don't know the answer to some of the questions.
Once you are at the cpan> prompt, you can start issuing commands. '?' will list all the commands.
Lets start with a simple search. Lets say I want to find a module that will let me encrypt and decrypt messages using a blowfish cipher. I would use one of the search commands 'a, b, d, m or i' (Author, Bundle, Distribution, Module or Any). Since I know I want a module, I'll use 'm'.
This tells me there are 3 modules with the name 'blowfish' in them. Crypt::Blowfish and Crypt::Blowfish_PP are one of the ones I want. But which one should I use?
By convention, some module that are written in pure perl (no extra binary code) have a _PP postfix. Pure Perl modules are often slower then their binary counterparts, but are often more compatible and easier to install as they have no other dependancies (not even a C compiler).
So I'll decide to go with the slower, easier to install version since it'll only be used to in my small program for encrypting and decrypting small amounts of data.
Now, I am not going to write a simple encrypt/decrypt tool for you (unless you really bug me to), needless to say, it's easy to do. Infact, less then 15 lines of code should do it.
The point is, CPAN is easy to use, the modules are often great, and most importantly, its fun because you can do alot with very little.
Hi,
I am trying to install Unicode::String from the cpan shell, and here is what I get:
Checking if your kit is complete...
Looks good
Writing Makefile for Unicode::String
cp String.pm blib/lib/Unicode/String.pm
cp lib/Unicode/CharName.pm blib/lib/Unicode/CharName.pm... (3 Replies)
Hi. Learning rsync from the man pages can be daunting. I wrote this tutorial to make learning rsync easier:
rsync tutorial (rsync2u)
The rsync tutorial is for new rsync users. Three small backup examples thoroughly explain rsync --link-dest, --recursive, and --exlcude-from options.
Enjoy. (2 Replies)
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)
Hi I'm totally new to solaris 5.9
Two questions.
1. What is the replacement for /proc/cpuinfo (isn't this part of POSIX). I heard it's psrinfo but it doesn't work.
2. I use ssh - v -X with X tunelling from linux onto a solaris server, but xclock failed. it says won't open display. $DISPLAY is... (6 Replies)
Hello all,
i am searching how to install a module but the question is :
howto specify CPAN to install a determined version of the module ?
In my case i want to install DBD:Oracle1.14 and not version 1.23 proposed !
Any idea welcome ! :rolleyes:
Thanks ! (1 Reply)
Hi All,
I am trying to run the following program
#!/usr/bin/perl
# use module
use XML::Simple;
use Data::Dumper;
# create object
$xml = new XML::Simple;
# read XML file
$data = $xml->XMLin("dump.xml");
# print output
print Dumper($dump);
At first i had the error mesage saying... (5 Replies)
Hi
I am new to Unix and need help. How do I use the $@ in my script to direct the executing of commands on various files.
Thanks
curious greenhorn (8 Replies)
Hello all!
I'm trying to compile the GD module for Perl on Redhat AS 4.
It fails when trying to link to libjpeg. The machine is a AMD Opteron 64 machine so I figure it's some kind of 32 vs 64bit interference in the lib dir?
Any idéas?
CPAN.pm: Going to build L/LD/LDS/GD-2.41.tar.gz
... (0 Replies)
I am one of the newbies. I want to load linux on my notebook, however, i am not sure which linux is the most recommend for the newbies.
Could you please advise?
Thanks you very much for any advise you may give me.
Best Regards,
SANLEN (2 Replies)
I am new to UNIX and Linux. I have some experiences with Windows server. I am thinking to start with those OS (Unix/Linux) and more specifically with the OS for the server. however, i have no idea which one would i start first, unix or linux? Because i also dont know how they are different.
... (3 Replies)