use Config; # discover your path

| No Comments | No TrackBacks

Reasoning why knowing the system paths is a good idea can be found here. Now let's see how one can guess (get?) them in Perl.

There are a lot of Perl installation made to non-standard paths. Like:

  • /usr/local/bin/perl
  • /home/$USERNAME/local/bin/perl
  • C:\Strawberry\bin\perl
  • /opt/bin/perl

I was trying to find out what do this installations share and what could be used to find out if the Perl is in file hierarchy standard folder - /usr/bin/perl. The simplest way, that I found out, was to:

use Config;
if ($Config::Config{'prefix'} eq '/usr') { ... do stuff ... }

That is basically all Sys::Path does. If the installation prefix was set to "/usr" (in all Linux distributions standard Perl packages it is), than the rest of system paths is by default set to FHS. If not all of the paths are based on the prefix - $PREFIX/etc, etc.

Just check the Pod of Sys::Path for all the different paths and their usage.

too simple? but works :-)

No TrackBacks

TrackBack URL: http://blog.meon.eu/admin/tb/86

Leave a comment

Updates

Subscribe to the blog updates with an email:

If you like it, share it.

Pages

About this Entry

This page contains a single entry by Jozef Kutej published on December 17, 2009 8:49 PM.

Once uppon a time there was a sysadmin was the previous entry in this blog.

Just put it where it belongs is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.