[Petal] [PETAL ERROR] cannot tokenize: <dpchrist@holgerdanske.com>
David Christensen
dpchrist at holgerdanske.com
Sun Dec 11 19:20:28 GMT 2005
petal:
I am a Petal newbie who has run into his first bug. My platform is Debian
3.1r0a stable (Sarge). Petal was installed via cpan:
dpchrist at p166v:~$ perl -e 'use Petal; print $Petal::VERSION, "\n"'
2.17
Here is the template:
dpchrist at p166v:~$ cat w3mud/templates/main.xhtml
<!--
#######################################################################
# $Id$
#
# World Wide Web Multi-User Dungeon main form template.
#
# Copyright 2005 by David Paul Christensen <dpchrist at holgerdanske.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
# USA.
#######################################################################
-->
<html xmlns:tal="http://purl.org/petal/1.0/">
<head tal:content="head_content">
</head>
<body tal:content="body_content">
body_content
</body>
</html>
Here is the CGI instance script:
dpchrist at p166v:~$ cat w3mud/cgi-bin/w3mud.pl
#!/usr/bin/perl
#######################################################################
# $Id: w3mud.pl,v 1.2 2005/12/11 06:27:52 dpchrist Exp $
#
# w3mud -- World-Wide Web multi-user dungeon instance script.
#
# Copyright 2005 by David Paul Christensen <dpchrist at holgerdanske.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
# USA.
#######################################################################
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use FindBin qw($Bin);
use lib "$Bin/../lib/perl/";
use W3mud;
my $app = W3mud->new(w3mud_root => "$Bin/../../w3mud");
$app->run();
#######################################################################
Here is the module:
dpchrist at p166v:~$ cat w3mud/modules/W3mud.pm
#######################################################################
# $Id: W3mud.pm,v 1.2 2005/12/11 06:27:52 dpchrist Exp $
#
# w3mud -- World-Wide Web multi-user dungeon instance script.
#
# Copyright 2005 by David Paul Christensen <dpchrist at holgerdanske.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
# USA.
#######################################################################
package W3mud;
use strict;
use warnings;
use CGI qw(:standard);
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
use File::Spec::Functions;
use Petal;
#######################################################################
# constructor:
#----------------------------------------------------------------------
sub new
{
my $class = shift;
die "'new' called as instance method"
if ref $class;
my $rh = { @_ };
die "required argument 'w3mud_root' missing"
unless exists $rh->{w3mud_root};
die "w3mud root '$rh->{w3mud_root}' not found"
unless -e $rh->{w3mud_root};
die "w3mud root '$rh->{w3mud_root}' is not a directory"
unless -d $rh->{w3mud_root};
my $self = bless $rh, $class;
return $self;
}
#######################################################################
# dispatcher:
#----------------------------------------------------------------------
sub run
{
my $self = shift;
die "'W3mud::run()' called as class method"
unless ref $self;
my $runmode = "main";
my $t = new Petal(
base_dir => $self->w3mud_root(),
file => "templates/$runmode.xhtml",
);
my $out = join "", header(), $t->process(bar => "BAZ"), "\n";
print $out;
open FH, "> w3mud.out";
print FH $out;
close FH;
}
#######################################################################
# accessor methods:
#----------------------------------------------------------------------
sub w3mud_root
{
my $self = shift;
die "'W3mud::w3mud_root()' called as class method"
unless ref $self;
die "'W3mud::w3mud_root()' called with arguments"
if scalar @_;
return $self->{w3mud_root};
}
#######################################################################
# end of module:
#----------------------------------------------------------------------
1;
#######################################################################
Here is the result using IE 6.0.2900.2180.xpsp_sp2_gdr.050301-1519:
http://www2.holgerdanske.com/cgi-bin/w3mud.pl/main
Software error:
[PETAL ERROR] cannot tokenize: <dpchrist at holgerdanske.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
# USA.
#######################################################################
-->
. Debug info written in /tmp/petal_debug.774.1134327440.tloxgxmqav at
/usr/local/share/perl/5.8.4/Petal.pm line 473.
For help, please send mail to the webmaster (webmaster at holgerdanske.com), giving
this error message and the time and date of the error.
It looks like Petal is crashing on <dpchrist at holgerdanske.com> inside the
comment block of the template. I thought everything inside a comment block is
supposed to be ignored (?).
Is this a bug or a feature of Petal, or is there something else going on here?
TIA,
David
More information about the Petal
mailing list