skip to content

Programming

How to Install a Perl Module at a Custom Location

If you don't have permission to install a Perl module into the system Perl directories, you will not be able to use CPAN or yum or atp-get etc to install the module. You have to manually install it. Here are the steps:

  1. Download the module's package from search.cpan.org
  2. Install the package:

    $ tar zxf module-name.tgz
    $ cd module-name
    $ perl Makefile.PL PREFIX=/your-custom-dir
    $ make
    $ make test
    $ make install

HTML::Encoding Dependencies

The locale library for at least utf-8 must be compiled before we attempt to install HTML::Encoding.

On Gentoo, we run "locale-gen" to compile the locales, after we have setup the locale options follow the notes at the bottom of Installing the Gentoo Base System.

On Red Hat/CentOS, we run "localedef" to compile definition files. For instance, you can do "localedef -c -f UTF-8 -i en_US en_US.utf8" to compile utf-8 of en_US.

Fix HTML::Tidy libtidy Dependency

To use HTML::Tidy, we must first make sure the libtidy is installed in the system. Otherwise, when you try to install it via cpan, it will give you compilation error.

On Gentoo, in order to install it from cpan, you must make sure you have "emerge -v app-text/htmltidy".  Or better, just directly "emerge -v dev-perl/perltidy" and that should take care of everything for you, I think.

Ruby's Include and Extend

Ruby's mixin is quite slick. But I was confused by include and extend for a while until I stumble upon this posting Extending your include knowledge of Ruby

Both include and extend are used for mixing-in module methods. "extend" adds methods from a module into a class as class methods. "include" adds methods from a module into a class as instance methods.

Do not attempt to include or extend another Class. Say, you have:

RDoc Error: Directory doc already exists

In my Rails application direcotory, when I run "rdoc", I got an error message:

Directory doc already exists, but it looks like it
isn't an RDoc directory. Because RDoc doesn't want to risk
destroying any of your existing files, you'll need to
specify a different output directory name (using the
--op <dir> option).

That's because rails generated "doc" directory that rdoc don't like. To fix this, we can either use rake:

$ rake doc:app

Or specify another directory name to rdoc:

$rdoc --op rdoc_dir

Install Ruby on Rails 2.0 on Gentoo

Install RoR 2.0

At this date, Ruby on Rails 2.0 is the latest greatest RoR, which is not available in Portage yet.

Ruby language

If you want to install the ruby from source, then download the source from http://www.ruby-lang.org/en/downloads/.

Or, you can use emerge:

# emerge -pv  dev-lang/ruby

How to Silent the Warning of "Parsing of undecoded UTF-8 will give garbage when decoding entities at ..."

When we use the LWP to parse a page that is UTF-8 encoded, we get a warning of "Parsing of undecoded UTF-8 will give garbage when decoding entities at /usr/share/perl5/LWP/Protocol.pm line 114". This is documented in HTML::Parser's manual.

A simple way to get around this is to silent the warning like this:

Perl 6 on the Way

When I attended a seminar by Damian Conway on 2005, he told us they expected to release Perl 6 the next year. Two more years later, I started to wonder, where is it?

Looks like it is coming. Check out this site Official Perl 6 Wiki, and you will see that it is going along just fine. There is even a CPAN6.

.vimrc Tips

 The global vimrc files are located in /etc/vim/.

For Drupal programmers, you can add this line to make vim recognize *.module files are PHP:

Advanced Theme Construction Kit (ATCK) Review

I came accross this tool Advanced Theme Construction Kit (ATCK) today and I really like it.

It is very useful if you want to build grid layout. i had tried using YUI CSS grid layout directly before. YUI is good, but it wasn't very straightforward if I want to build complex nested grid layouts. But this, with its builder tool, make creating grid easy and comfortable. Nice and clear documents too. Two thumbs up.

Syndicate content
Powered by Drupal.