Installing Perl modules with cpanminus

While browsing CPAN I found an intersting module by Tatsuhiko Miyagawa cpanminus.  Basically, this is a script to get, unpack, build and install modules from CPAN. The best part of  is it’s dependency free, requires zero configuration, and stands alone. When running, it requires only 10MB of RAM. [Source: CPAN]

There are Debian packages, RPMs, FreeBSD ports, and packages for other operation systems available. If you want to use the package management system, search for cpanminus and use the appropriate command to install.

You can also build from latest source itself.

I have tried it on my CentOs 4.6 and Windows XP machine. Some of the advantages which I can see at first place are:

  • It seems to consume lesser memory than traditional like CPAN and CPANPLUS which sometime goes out of the memory for heavy installation.
  • It’s provides really quiet installation in comparison to CPAN. Not many questions.
  • I think it’s good for beginners
  • Automates installation and install dependencies without CPAN installed so no need to download TAR unpack, makefile, make, make test stuff.

Will try to get some  more findings.

Cheers,

Installing Microsoft TrueType fonts (TTF) on CentOS 4.6 and RHEL 4

Default Linux installation (Cent OS in this case) doesn’t contain true type fonts. The application like open office, PDF generators requires proper fonts to embed into if not it will use the free system fonts which can create a lot of issues like  pdf, not showing content properly etc. It’s always good idea to install ms core fonts Well you can buy more fonts as per your requirement if you want.
To install the ms core fonts follow the below steps (Login as a ROOT):
Install RPM: Change the directory to download folder and run the follwing command:
#rpm -ivh cabextract-0.6-1.i386.rpm

Create RPM: Change the directory to download folder and run the follwing command
#rpmbuild -bb msttcorefonts-1.3-4.spec

(This step will download Microsoft CAB files and extracts the fonts and builds an RPM.  This will use system utilities [wget, rpm-build, chkfontpath, fc-cache, ttmkfdir] and also check that http port 80 opened or not. This process will download the executable for all the font files.
This step will create RPM in /usr/src/redhat/RPMS/noarch/msttcorefonts-1.3-4.noarch.rpm
  • Installing RPM: Change the directory to /usr/src/redhat/RPMS/noarch/ and run the follwing command
# rpm -ivh msttcorefonts-1.3-4.noarch.rpm

  • Restart X server:
/sbin/service xfs restart

Now you can check the newly installed fonts on /usr/X11R6/lib/X11/fonts/TTF
Important Note:  Sometimes you might need to modify the msttcorefonts-1.3-4.spec file  for adding new address of mscorefonts location in sourceforge.net.  If you still face problems downloading font file then you can use my own font RPM [msttcorefonts-1.3-4.noarch.rpm].  You can download and install directly using # rpm -ivh msttcorefonts-1.3-4.noarch.rpm.
Good Luck!

Enjoy new fonts in your Linux machine.

Perl’s hidden treasure (The Schwartzian Transform)

Hello,

If you ask me about the best features of Perl then there will be many answers CPAN, Hashes, RegX etc etc but the one of the hidden feature of perl is The Schwartzian Transform. This is a technique that allows you to efficiently sort by a computed, secondary index.  Let’s say that you wanted to sort a list of strings by their md5 sum.  Pl. see the code below (the comments below are best read from bottom).

my @strings = (‘C’, ‘CPlusPlus’, ‘Java’, ‘Perl’);

my $sorted_strings_on_MD5 =

map { $_->[0] } # map back to the original value

sort { $a->[1] cmp $b->[1] } # sort by the correct element of the list

map { [$_, MD5Calu_func($_)] } #  create a list of anonymous lists

@strings #  take strings

Where MD5Calu_func($_) represents an expression that takes $_ (each item of the list in turn) and produces the corresponding value that is to be compared. This way,  you only have to do the expensive md5 computation N times, rather than N log N times. That’s the beauty of algorithm.

The algorithm has been given by one of the greatest guy is Perl community Randal L. Schwartz.

Happy reading!

Perl Myths

Hello

I am sharing a presentation on Perl Myths directly from author of the Perl DBI module,  Tom Brnce.  He has given a detailed analysis of myths associated with Perl and future of  Perl5/ Perl 6.

[slideshare id=2044080&doc=perl-myths-200909-090922145348-phpapp01]

Enjoy!

Catalyst Perl MVC framework Introduction

See the link below for a excellent intro video on Catalyst MVC framework.

http://www.youtube.com/watch?v=zmm56R0Nqis
http://wiki.dandascalescu.com/howtos/catalyst/introduction_to_catalyst#comment-32571154

The guy has done great job for putting all together. I hope this will help in accelerating Catalyst learning.

I am waiting for more videos on Catalyst like using DBIx::Class, REST controller etc.

Continue reading “Catalyst Perl MVC framework Introduction”

Open source PDF engine with CSS

While looking for open source PDF generators I came across some very interesting engines available like Apache FOP and some very good PHP based engines too. My basic requirement was to run it as a batch process in Linux/Perl. The engine should supports CSS and if possible should supports PDF/A and SVG too. After doing a lot of analysis I was still not sure if all pdf issues can be solved by open source engines or not??. Then I tried my hand a bit on properitery engines like princexml and PDFReactor. They have there own advantage and disadvantages. Princexml looks really nice but there is underlying cost and also doesn’t provide interface to access the API’s for pdf manipulation. Finally I found a open source engine WKHTMLTOPDF it supports CSS and looks promising as it uses already tested rendering engine webkit .

Will share if it fits in my requirement and delivers the results.

Perl on RedHat – multiple bless/overload problem

I was reading over internet regarding the performance issue of Perl bundled in some Redhat versions (A combination of Rehhat and Perl version) which uses multiple bless/overload. Vipul’s blog has given a good insight on this problem.

Well, Red hat has finally registered the bug last year on Bugzilla.

Would recommend  everybody falling under this should  test it.  You can test your running installations by using the program given in Bugzilla.  I have done at my end and fortunately I am out of the bug.  I was running Cent Os 4.6 with Perl 5.8.6.

All the best