Eclipse

This my portal page about Eclipse.

What is Eclipse? 

  • In brief, an IDE for multi-languages.

Plugins

Tips & Tricks

Perl package installation and manement

Tools

Package notes

CPAN is a great place to avoid reinvent the wheel, but some packages are not that reliable or not easy to use or install.

  • DBD::mysql. Follow this instruction. If you get something like “Library not loaded: libmysqlclient.16.dylib“, see here.
  • Interface to GNU Scientific Library Math::GSL. If you get lost at what the parameters are, read more in GSL manual, e.g. hypergeometric distribution.
  • Getopt::Long and Pod::Usage make a friendly command with options and help/man doc.
  • LSF (unauthorized!) – A perl API built on top of the LSF command line tools. I write my own version.
  • local::lib – create and use a local lib/ for perl modules with PERL5LIB (PS: best way to install package when you are not administrator.)
  • Dist::Zilla
  • FIle::Basename – Parse file paths into directory, filename and suffix.
  • Template Toolkit (TT) – website, book, and how to migarte from CGI
  • HTML::Table – set additional attribute by $table->setAttr("id=\"cluster_row\"");
  • Tree manipulation: Bio::TreeIO, Bio::Tree:Tree, Bio::Tree:TreeI, Bio::Tree::TreeFunctionsI, Bio::Tree::Node, Bio::Tree::NodeI
  • Perldoc server/mini CPAN: Pod::Webserver, Pod::POM::Web, Pod::Browser(Catalyst based), or CPAN::Mini::Webserver

Finding a Perl Module Version

perl -MYourModule 999
perl -MYourModule -e 'print "$YourModule::VERSIONn"'

For example,

perl -MNet::SSLeay 999
perl -MNet::SSLeay -e 'print "$Net::SSLeay::VERSIONn"'

Note

  • In first command, no space between and module name.
  • In second command, use $ before module name.

Setup local website on OS X

I am developing a website using LAMP, a dev toolkit of a combination of free and open source software. In particular, I am using Perl-based MVC framework Catalyst. Catalyst comes with PSGI server, i.e. you can run your web app without Apache. However, when I try to integrate my web app with MeidaWiki, a wiki engined based on PHP, I still need to setup  LAMP. Here are two posts I found particularly useful.

Perl for Web Dev

Is Perl still a viable language for web dev?

Catalyst

Catalyst Tips & Tricks

  • Diff between uri_for() and uri_for_action(). uri_for() is usually used for static files like images, css and js. uri_for_action() as its name implies, is usually used for action, such as redirect to a controller’s route, which paths may be changed. See here.
  • Use c.uri_for(“your/path”) rather than “your/path” in Template::Toolkit template
  • Catalyst::Plugin::PageCache – Cache the output of entire pages
  • What’s the difference between :Args and :CaptureArgs in Catalyst? (here)

:CaptureArgs(N) matches if there there at least N args left. It is used for non-terminal Chained handlers.
:Args(N) only matches if there are exactly N args left.

Other Frameworks

  • Mojolicious (doc and wiki). Why not Mojo (here and here)? Personally, I usually need to connect to MySQL/SQLite database, but Mojo is agnostic to database 😦
  • Dancer: lightweight

CGI

  • How to execute CGI through HTML’s HREF link (here).