Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

error in locating libraries

Quote Reply
error in locating libraries
i get this error when i try to visit a link i've added to my database. anyone know how to fix it? Error including libraries: Can't locate admin/links.cfg in @INC (@INC contains: /home/victoria/public_html/cgi-bin/buffy /usr/lib/perl5/5.6.1/i686-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i686-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at /home/victoria/public_html/cgi-bin/buffy/jump.cgi line 34.Make sure they exist, permissions are set properly, and paths are set correctly.
Quote Reply
Re: [Breathless] error in locating libraries In reply to
Mmm..doesn't look like you have your links.cfg file configured correctly. Could you post it here, or just the first 40-50 lines should do.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] error in locating libraries In reply to
The error is nothing to do with the configuration of links.cfg, it is to do with the paths to links.cfg within the cgi-scripts, they need to be full not relative. Either that or links.cfg doesn't exist or has wrong permissions.

Last edited by:

Paul: Aug 27, 2002, 3:56 AM
Quote Reply
Re: [Paul] error in locating libraries In reply to
Ahem Paul...but I think you will find that entering the relative path in links.cfg can also give this error! It is more likely to be your answer...but mine is also possible!

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] error in locating libraries In reply to
ok here's my links.cfg file

# Paths and URL's to Important Stuff
# --------------------------------------------------------
# PATH and URL of Admin CGI directory. No Trailing Slash.
$db_script_path = "/home/victoria/public_html/cgi-bin/buffy/sarah";
$db_dir_url = "http://www.smg-breathlessforum.com/cgi-bin/buffy/sarah";

# URL of User CGI directory. No Trailing Slash.
$db_cgi_url = "http://www.smg-breathlessforum.com/cgi-bin/buffy";

# PATH and URL of Pages to be built. No Trailing Slash.
$build_root_path = "/home/victoria/public_html/links/pages";
$build_root_url = "http://www.smg-breathlessforum.com/links/pages";

# PATH and URL of What's New page. No Trailing slash.
$build_new_path = "$build_root_path/New";
$build_new_url = "$build_root_url/New";

# PATH and URL of What's Cool page. No Trailing slash.
$build_cool_path = "$build_root_path/Cool";
$build_cool_url = "$build_root_url/Cool";

# PATH and URL of What's Rating page. No Trailing slash.
$build_ratings_path = "$build_root_path/Ratings";
$build_ratings_url = "$build_root_url/Ratings";


# Database Options
# --------------------------------------------------------
# You really need to use flock(). However if your system doesn't support it (Win95),
# then turn this off at your own risk!
$db_use_flock = 1;
# Use Pragma: no-cache to stop browsers from caching output? (0 = cache, 1 = nocache)
$db_nocache = 0;
# Use IIS headers? Set this to 1 if your web server needs the full headers (HTTP/1.0 etc.)
$db_iis = 0;
# Field number of category in category.db
$db_main_category = 1;
# Referers -- which hosts are allowed to add to your database.
@db_referers = ();

# Email Options
# --------------------------------------------------------
# NOTE: Be sure to edit the text of the message. It can be found
# in the templates directory: email-add.txt, email-del.txt and
# email-mod.txt respectively.

# Set only ONE of either $db_mail_path which should go to a
# mail program like sendmail, or $db_smtp_server which will use
# a SMTP server. Do not set both at once!

# PATH of sendmail. # SMTP Server
$db_mail_path = '/usr/sbin/sendmail'; $db_smtp_server = '';

# Email address of the administrator. BE SURE TO SET!
$db_admin_email = 'victoria@smg-breathless.com';

# Notify visitors automatically when their links are validated?
$db_email_add = 0;

# Notify visitors automatically when their links are modified?
$db_email_modify = 0;

# Log all outgoing messages? Put the full path to a logfile and make sure it
# exists and is writeable (chmod 666 -rw-rw-rw-). This logfile can get pretty
# big!
$db_mailer_log = '';

# Build Options
# --------------------------------------------------------
# Setting for popular cutoff, can either be a percent (i.e. top 3%), or
# a fixed value (i.e. top 10). Enter 0.03 or 10 respectively.
$db_popular_cutoff = 0.05; # Top 5%
# Number of days a link is considered New.
$db_new_cutoff = 14; # 14 days old.
# Return search results bolded (1 = yes, 0 = no).
$search_bold = 1;
# The name of an index file.
$build_index = "index.html";
# The extension to use for non index files:
$build_extension = ".html";

# Should your add.cgi automatically select what category the user
# is adding his link into?
$db_single_category = 1;

# Directory Permissions. Do NOT put quotes around it. Set to 0777
# for world writeable. If you put this at 0755, you might need a
# script to remove any directories created as they will be owned
# by the web server or user nobody. Better solution might be to
# run the nph-build routine from the command shell.
$build_dir_per = 0777;

# The script can now break up category pages that have more then x
# number of links in it. It will also create next and previous links
# to help navigate. Set this to 1 if you want to break up pages or 0 if
# you want to have only one page per category.
# Setting this to one, will also break up the What's New pages into
# per day sections (not affected by number of links per page).
$build_span_pages = 1;

# Number of links per page.
$build_links_per_page = 15;

# Detailed View: The script can build a single html page per link. This is
# great if you have a review in your database. To enable, you must set
# the directory where all the pages will be stored, the url to that directory
# and set the enable option.
$build_detailed = 0;
$build_detail_path = "$build_root_path/Detailed";
$build_detail_url = "$build_root_url/Detailed";

# Use Templates: instead of editing site_html.pl, you can edit regular html pages
# encoded with special <%links_tags%>. It's not as flexible as site_html.pl, but it
# may be easier.
$build_use_templates = 1;

# Site Title, the default title to use. You should really spend some time customizing
# the directory though!
$build_site_title = 'Breathless Search';

# Date Routines
# --------------------------------------------------------
# Your date format can be whatever you like, as long as the following
# two functions are defined &date_to_unix and &unix_to_date:
# The default is dd-mmm-yyyy.

sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# timelocal does not like to be in array context, don't do my($time) = timelocal (..)
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require Time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }
return $time;
}

sub unix_to_date {
# --------------------------------------------------------
# This routine must take a unix time and return your date format
# A much simpler routine, just make sure your format isn't so complex that
# you can't get it back into unix time.
#
my $time = shift;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
$year = $year + 1900;
return "$day-$months[$mon]-$year";
}

sub long_date {
# --------------------------------------------------------
# This routine is for printing a nicer date format on the what's new page. It should
# take in a date in your current format and return a new one.
my $time = shift;
$time = &date_to_unix ($time);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!January February March April May June July August September October November December!;
my @days = qw!Sunday Monday Tuesday Wednesday Thursday Friday Saturday!;
$year = $year + 1900;
return "$days[$dweek], $months[$mon] $day $year";
}

# -------------------------------------------------------------
# Extra Paths -- unless you feel the need to rename files, you
# can leave this as is.
# -------------------------------------------------------------
$db_script_url = $db_dir_url . "/admin.cgi"; # Admin script.
$db_header_path = $db_script_path . "/header"; # Place to store header and footers.
$db_footer_path = $db_script_path . "/footer";
$build_search_url = $db_cgi_url . "/search.cgi"; # URL of search script.
$build_add_url = $db_cgi_url . "/add.cgi"; # URL of add script.
$build_modify_url = $db_cgi_url . "/modify.cgi"; # URL of modify script.
$build_jump_url = $db_cgi_url . "/jump.cgi"; # URL of jump script.
$build_email_url = $db_cgi_url . "/subscribe.cgi"; # URL of email update script.
$build_rate_url = $db_cgi_url . "/rate.cgi"; # URL of rate script.
$db_mail_url = $db_dir_url . "/nph-email.cgi"; # URL of admin mass mail script.
$build_css_url = $build_root_url . "/links.css"; # URL to your CSS file.

$db_lib_path = $db_script_path; # PATH of library files.
$db_links_name = "$db_script_path/data/links.db"; # PATH to links database.
$db_category_name = "$db_script_path/data/categories.db"; # PATH to category database.
$db_valid_name = "$db_script_path/data/validate.db"; # PATH to validation database.
$db_modified_name = "$db_script_path/data/modified.db"; # PATH to modification database.
$db_url_name = "$db_script_path/data/url.db"; # PATH to URL lookup database.
$db_email_name = "$db_script_path/data/email.db"; # PATH to email database.
$db_links_id_file_name = "$db_script_path/data/linksid.txt"; # PATH to links counter file.
$db_category_id_file_name = "$db_script_path/data/categoryid.txt"; # PATH to category counter file.
$db_hits_path = "$db_script_path/data/hits"; # PATH to hits directory.
$db_template_path = "$db_script_path/templates"; # PATH to templates.
$db_rates_path = "$db_script_path/data/rates"; # PATH to ratings.
1;

-----------------------------------------i added this line just for this post-----------------------



i am also getting this error when i try to build..

Error Message : fatal error: Template: Can't find template: /home/victoria/public_html/cgi-bin/buffy/sarah/templates/category.html at /home/victoria/public_html/cgi-bin/buffy/sarah/Template.pm line 41.

Script Location : /home/victoria/public_html/cgi-bin/buffy/sarah/nph-build.cgi
Perl Version : 5.006001



any idea how to fix that as well? the catergory.html file is in the correct place with CHMOD 666 like it's suppossed to be.

here is also my templates.pm file.

package Template;
# ===============================================================
use strict;
use vars qw($VERSION $error @ISA @EXPORT); # Globals.
@ISA = (); # Not inhereited.
@EXPORT = qw();
$Template::VERSION = '1.0';

sub error {
# ---------------------------------------------------------------
# Handles error messages.
#
my ($errtype, $e1, $e2) = @_;
my %errors = (
'CANTINIT' => "Template: Can't init, no root defined, or not a hash ref: '$e1'",
'NOTEMPLATE' => "Template: Can't find template: $e1",
'CANTOPEN' => "Template: Can't open template: $e1. Reason: $e2",
'NONAMESPACE' => "Tempalte: You haven't loaded a namespace yet!",
'NONAME' => "Template: No name was defined for this template!",
'NOSTRING' => "Template: No text was defined for template: $e1"
);
$Template::error = $errors{$errtype};
die $Template::error;
}

sub new {
# ---------------------------------------------------------------
# Initilizes a new instance of the template parser.
#
my $this = shift;
my $class = ref($this) || $this;
my $self = {};
bless $self, $class;

my $opt = shift;
unless ((ref $opt eq 'HASH') and (exists ${$opt}{'ROOT'})) {
&error ('CANTINIT', $opt);
return undef;
}
$self->{'ROOT'} = ${$opt}{'ROOT'};
$self->{'CHECK'} = ${$opt}{'CHECK'};

return $self;
}

sub load_template {
# ---------------------------------------------------------------
# Loads a template either from a file or from a string.
#
my $self = shift;
my ($name, $text) = @_;

if (!$self->{'CHECK'} and exists $self->{'templates'}{$name}) { return 1; }
if (!defined $text) {
my $file = $self->{'ROOT'} . "/$name";
-e $file or (&error('NOTEMPLATE', $file) and return undef);
open (TPL, "<$file") or (&error('CANTOPEN', $file, $!) and return undef);
$text = join ("", <TPL>);
close TPL;
}
$self->{'templates'}{$name} = $text;
return 1;
}

sub load_vars {
# ---------------------------------------------------------------
# Sets the variables (all the search and replaces).
#
my $self = shift;
my $vars = shift;

my ($name, $value);
while (($name, $value) = each %{$vars}) {
$self->{'vars'}{$name} = $value;
}
return 1;
}

sub clear_vars {
# ---------------------------------------------------------------
# Clears the namespace.
#
my $self = shift;
$self->{'vars'} = {};
return 1;
}

sub parse {
# ---------------------------------------------------------------
# Parses a template.
#
my $self = shift;
my $template = shift;
my $begin = $self->{'begin'} || quotemeta('<%');
my $end = $self->{'end'} || quotemeta('%>');

exists $self->{'templates'}{$template} or ($self->load_template($template) or return undef);
exists $self->{'vars'} or (&error ('NONAMESPACE') and return undef);
$self->{'parsed'}{$template} = '';

my @lines = split /\n/, $self->{'templates'}{$template};
my $go = 1;

foreach (@lines) {
/$begin\s*if\s*(.+)?\s*$end/o and ($self->{'vars'}{$1} !~ /^\s*$/) ? ($go = 1) : ($go = 0) and next;
/$begin\s*endif\s*$end/o and ($go = 1) and next;
$go or next;
s/$begin\s*(.+?)\s*$end/
if (exists $self->{'vars'}{$1}) {
ref ($self->{'vars'}{$1}) eq 'CODE' ? &{$self->{'vars'}{$1}} : $self->{'vars'}{$1};
}
else {
return "Unkown Tag: $1";
}
/goe;
$self->{'parsed'}{$template} .= $_ . "\n";
}
return $self->{'parsed'}{$template};
}

sub DESTROY {
# ---------------------------------------------------------------

}

1;

Quote Reply
Re: [Breathless] error in locating libraries In reply to
Ok, it looks like the problem Paul mentioned.

Replace all instances of the following (in all the .cgi scripts that are located outside the admin folder);

require "admin/links.cfg";

with

require "/home/victoria/public_html/cgi-bin/buffy/sarah/links.cfg";

Hopefully that will sort you out Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Aug 27, 2002, 5:36 AM
Quote Reply
Re: [Andy] error in locating libraries In reply to
"Ahem Andy" but sorry you are wrong.

Code:
require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.

Nothing in links.cfg can have anything to do with that line as links.cfg hasn't even been required yet as that's when the script is failing Tongue


Edit: Ooo nice edit Andy :)

Last edited by:

Paul: Aug 27, 2002, 5:42 AM
Quote Reply
Re: [Paul] error in locating libraries In reply to
>>>Ooo nice edit Andy :) <<<

Paul...shutup! That edit was because I made a typo!

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] error in locating libraries In reply to
ok well i tried that and it hasn't made a difference. i'm still getting the same error. i put it below to save scrolling time. also any ideas on my other error?Error including libraries: Can't locate /home/victoria/public_html/cgi-bin/buffy/sarah/admin/links.cfg at /home/victoria/public_html/cgi-bin/buffy/jump.cgi line 34.Make sure they exist, permissions are set properly, and paths are set correctly.
Quote Reply
Re: [Breathless] error in locating libraries In reply to
You have the extra 'admin' in your new paths...I specifically didn't put that into the code I gave you, cos I am assuming you were using 'sarah' as your admin folder Wink Try removing it, and then seeing how it works Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] error in locating libraries In reply to
great thanks. sorry bout that... you were right all along, obviously it's just that more often than not, i can't seem to read. lol. i was pretty tired.