Help - Search - Member List - Calendar
Full Version: how to add additional paths in $INC( can't locate SF:Logger.pm in $INC)
WorkTheWeb Forums > Webmaster Resources > Perl Beginner Help
Support our Sponsors!
Meena Selvam
My perl program snas.pl uses SF:Logger.pm which is
available in /usr/local/sf/lib/perl/5.8.3/SF. I have
added this directory in the path (.cshrc and .tshrc).
I am running as root, and I get the cant locate
SF::Logger.pm error in $INC.

$INC contains usr/lib/perl5/5.6.1/i386_linux and some
more usr/lib/perl5/... directories

How can i alter this $INC. I tried using
use lib "/usr/local/sf/lib/perl/5.8.3/SF"; since I
found that this should work as per perl.apache.org
perl reference document.

meena



____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com

Wiggins d'Anconia
MEENA SELVAM wrote:
QUOTE
My perl program snas.pl uses SF:Logger.pm which is
available in /usr/local/sf/lib/perl/5.8.3/SF. I have
added this directory in the path (.cshrc and .tshrc).
I am running as root, and I get the cant locate
SF::Logger.pm error in $INC.

$INC contains usr/lib/perl5/5.6.1/i386_linux and some
more usr/lib/perl5/... directories

How can i alter this $INC. I tried using
use lib "/usr/local/sf/lib/perl/5.8.3/SF"; since I
found that this should work as per perl.apache.org
perl reference document.

meena


If the module you are using is SF::Logger then the path you need to add
is like the above only without the 'SF', perl will add that
automagically. Try,

use lib "/usr/local/sf/lib/perl/5.8.3";

Alternatively, Perl doesn't use the $PATH shell environment variable, it
used $PERL5LIB instead. In bash for instance,

export PERL5LIB="$PERL5LIB:/usr/local/sf/lib/perl/5.8.3"

Should do the trick....

http://danconia.org

Meena Selvam
I have a section of code from a .pl file as follows:

------------------------------------------------
package SF::Constants;
use Exporter;

@ISA = qw(Exporter);
@EXPORT = qw(SF_SUCCESS SF_EINVAL SF_ENOSYS SF_ENOMEM
SF_ERANGE SF_EPERM SF_ENOENT SF_EEXIST SF_EDATABASE
SF_ESYNTAX SF_NOUSER SF_NOUSERROLE SF_NOTIMESPENT
SF_NOCOMMENT SF_ETRANSACT SF_NOTYPE SF_NOSTATE
SF_NOSUMMARY SF_EBUSY SF_ENOSPC SF_EREAD
SF_END_OF_FILE SF_EAGAIN SF_EREAD_PARTIAL SF_ENOTCONN
SF_EREAD_TRUNCATED SF_CLOSED SF_ENOPROTOSUPPORT
SF_ENOSUPPORT SF_EWRITE SF_EWRITE_PARTIAL SF_EBADLEN
SF_EPROTOCOL_VIOL SF_EPEER SF_ENOTDIR SF_EMUTEX
SF_EMUTEX_INVAL SF_EMUTEX_DEADLK SF_EOPEN SF_ELOCKED
SF_ESSL SF_ELICENSE_INVAL SF_ELICENSE_PLATFORM
SF_ELICENSE_CORRUPT SF_ESSL_NOCIPHERS
SF_ESSL_CRLEXPIRED SF_ENOMATCH SF_ESOCKET SF_ENITRO
SF_ENOLICENSE SF_EHASLICENSE SF_ECORRUPT SF_EBAD_MAGIC
SF_EBAD_LINKTYPE SF_NITRO_DUPLICATE SF_MAX_ERRNUM);
### Return Codes ###


use constant SF_SUCCESS => 0 # Success
use constant SF_EINVAL => 1 # Invalidargument
use constant SF_ENOSYS => 2 # Unimplemented
use constant SF_ENOMEM => 3 # Out of memory
use constant SF_ERANGE => 4 # Out of range

I get the following compilation error:
------------------------------------------
use not allowed in expression at
/usr/local/sf/lib/perl/5.8.3/SF/SFError.pm at line 10
end of line

syntax error at line 10 - near use constant

compilation failed in require at ../snas.pl line 16

-----------------------------------------
line 10 is the "use constant SFEINVAL" which seems
right for me

Actually snas.pl has the following statements
use lib "/usr/local/sf/lib/perl/5.8.3/SF"
use SFError qw(:try);

--------------------------

Does anyone see anything wrong in the syntax or reason
for this compilation error
--- Wiggins d'Anconia <[Email Removed]> wrote:

QUOTE
MEENA SELVAM wrote:
My perl program snas.pl uses SF:Logger.pm which is
available in /usr/local/sf/lib/perl/5.8.3/SF. I
have
added this directory in the path (.cshrc and
.tshrc).
I am running as root, and I get the cant locate
SF::Logger.pm error in $INC.

$INC contains usr/lib/perl5/5.6.1/i386_linux and
some
more usr/lib/perl5/... directories

How can i alter this $INC. I tried using
use lib "/usr/local/sf/lib/perl/5.8.3/SF"; since I
found that this should work as per perl.apache.org
perl reference document.

meena


If the module you are using is SF::Logger then the
path you need to add
is like the above only without the 'SF', perl will
add that
automagically. Try,

use lib "/usr/local/sf/lib/perl/5.8.3";

Alternatively, Perl doesn't use the $PATH shell
environment variable, it
used $PERL5LIB instead. In bash for instance,

export
PERL5LIB="$PERL5LIB:/usr/local/sf/lib/perl/5.8.3"

Should do the trick....

http://danconia.org





____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com

Wiggins d'Anconia
MEENA SELVAM wrote:
QUOTE
I have a section of code from a .pl file as follows:

------------------------------------------------
package SF::Constants;
use Exporter;

@ISA = qw(Exporter);
@EXPORT = qw(SF_SUCCESS SF_EINVAL SF_ENOSYS SF_ENOMEM
SF_ERANGE SF_EPERM SF_ENOENT SF_EEXIST SF_EDATABASE
SF_ESYNTAX SF_NOUSER SF_NOUSERROLE SF_NOTIMESPENT
SF_NOCOMMENT SF_ETRANSACT SF_NOTYPE SF_NOSTATE
SF_NOSUMMARY SF_EBUSY SF_ENOSPC SF_EREAD
SF_END_OF_FILE SF_EAGAIN SF_EREAD_PARTIAL SF_ENOTCONN
SF_EREAD_TRUNCATED SF_CLOSED SF_ENOPROTOSUPPORT
SF_ENOSUPPORT SF_EWRITE SF_EWRITE_PARTIAL SF_EBADLEN
SF_EPROTOCOL_VIOL SF_EPEER SF_ENOTDIR SF_EMUTEX
SF_EMUTEX_INVAL SF_EMUTEX_DEADLK SF_EOPEN SF_ELOCKED
SF_ESSL SF_ELICENSE_INVAL SF_ELICENSE_PLATFORM
SF_ELICENSE_CORRUPT SF_ESSL_NOCIPHERS
SF_ESSL_CRLEXPIRED SF_ENOMATCH SF_ESOCKET SF_ENITRO
SF_ENOLICENSE SF_EHASLICENSE SF_ECORRUPT SF_EBAD_MAGIC
SF_EBAD_LINKTYPE SF_NITRO_DUPLICATE  SF_MAX_ERRNUM);
### Return Codes ###


use constant SF_SUCCESS    => 0  # Success
use constant SF_EINVAL      => 1  # Invalidargument
use constant SF_ENOSYS      => 2  # Unimplemented
use constant SF_ENOMEM      => 3  # Out of memory
use constant SF_ERANGE      => 4  # Out of range

The above statements *as is* do not have semi-colons. Try adding them
and see if that resolves your issue. You also may want to read,

perldoc constant

Particularly the section on defining multiple constants at once. It can
reduce the typing, and *maybe* be more readable. I have used both ways
and don't have a strong feeling in either direction.

HTH,

http://danconia.org

QUOTE

I get the following compilation error:
------------------------------------------
use not allowed in expression at
/usr/local/sf/lib/perl/5.8.3/SF/SFError.pm at line 10
end of line

syntax error at line 10 - near use constant

compilation failed in require at ../snas.pl line 16

-----------------------------------------
line 10 is the "use constant SFEINVAL" which seems
right for me

Actually snas.pl has the following statements
use lib "/usr/local/sf/lib/perl/5.8.3/SF"
use SFError qw(:try);

--------------------------

Does anyone see anything wrong in the syntax or reason
for this compilation error



PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2005 Invision Power Services, Inc.