How do I add a directory to my include path (@INC) at runtime?

Pragma lib
lib - manipulate @INC at compile time

DESCRIPTION

This is a small simple module which simplifies the manipulation of @INC at compile time.

It is typically used to add extra directories to perl's search path so that later use or require statements will find modules which are not located on perl's default search path.

Adding directories to @INC

The parameters to use lib are added to the start of the perl search path. Saying

  1. use lib LIST; ( use lib "$ENV{HOME}/myown_perllib"; )

is almost the same as saying

  1. BEGIN { unshift(@INC, LIST) }
The lib.pm pragmatic module was first included with the 5.002 release of Perl.
posted @ 2009-09-03 09:56  能巴  阅读(259)  评论(0编辑  收藏  举报