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

new problem with the template.pm file

Quote Reply
new problem with the template.pm file
Hi,
I have found a new problem while testing now that I have things rockin and rollin. I have created a category, and added a link as a user...gotten the e-mail server to cooperate and send out the messages it is supposed to except for this one small thing. When I check for reciprocal links the script does fine until it tries to access the template which is supposed to be the email-norecip.txt . I am getting the following error:

Content-type: text/html Verifying recip Links
Verifying recip Links
Link checking started: 2 levels of checking (for casinoauthority.com)
--------------------------------------------------------
Starting checking..
Link ID=10001 http://www.terranovaweb.com

Checking http://www.terranovaweb.com
Expanding links:>
* http://www.terranovaweb.com/main.html title=enter alt=enter
- Link not found!

Template: Can't open template: E:/WWW/casinoauthority.com/cgi-bin/links/admin/templates/. Reason: Permission denied at E:/WWW/casinoauthority.com/cgi-bin/links/admin/Template.pm line 41, line 1.

What exactly is a *.pm file?
here are the first several lines of the pm file

# -------------
# Links
# -------------
# Links Manager
#
# File: Template.pm
# Description: Template parser package lossely based off of CGI::FastTemplate
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.01
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================

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, $template) = @_;
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 $temp = $self->{'templates'}{$template};



senior webmaster
http://www.realtimegaming.com
Subject Author Views Date
Thread new problem with the template.pm file rtenpin 2265 Jul 10, 2001, 11:39 AM
Thread Re: new problem with the template.pm file
Paul 2212 Jul 10, 2001, 11:48 AM
Post Re: new problem with the template.pm file
rtenpin 2200 Jul 10, 2001, 12:32 PM