mod_perl 2.0 Handler issue

mod_perl 2.0 Handler issue

am 12.03.2008 17:29:34 von xyon

Hello everyone,

I am writing my first mod_perl handler. I've looked at some of the docs
online and have come up with the config/code below. However, when I go
to visit the URL in Apache, I get a download prompt for type:
httpd/unix-directory.



OS Info:
----------------------------------------------------
CentOS release 4.6 (Final)
----------------------------------------------------



Package info:
----------------------------------------------------
perl-5.8.8-11
httpd-2.0.59-1.el4s1.10.el4.centos
mod_perl-2.0.3-1.el4s1.3
----------------------------------------------------



Apache config:
----------------------------------------------------
PerlRequire /etc/httpd/perl/startup.pl

SetHandler modperl
PerlResponseHandler Myserver::Handler

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



/etc/httpd/perl/startup.pl:
----------------------------------------------------
use lib qw(/home/Perl/);
1;
----------------------------------------------------



/home/perl/Myserver/Handler.pm
----------------------------------------------------
package Myserver::Handler;

#Setup some essentials
use strict; #strict tolerance for code
use Carp; #debugging
use diagnostics; #more debugging
use warnings; #more debugging

#Handler-related stuff
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(OK);

sub handler {
my $self = shift;
return Apache2::Const::OK;
}

1;

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


--
xyon

Re: mod_perl 2.0 Handler issue

am 12.03.2008 17:43:26 von xyon

Got it sorted, I forgot I had removed the content_type definition from
the handler. It's always the simple things that hang ya up.



/home/perl/Myserver/Handler.pm
----------------------------------------------------
package Myserver::Handler;

#Setup some essentials
use strict; #strict tolerance for code
use Carp; #debugging
use diagnostics; #more debugging
use warnings; #more debugging

#Handler-related stuff
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(OK);

sub handler {
my $self = shift;
$self->content_type('text/html');
return Apache2::Const::OK;
}

1;
----------------------------------------------------


On Wed, 2008-03-12 at 12:29 -0400, xyon wrote:
> Hello everyone,
>
> I am writing my first mod_perl handler. I've looked at some of the docs
> online and have come up with the config/code below. However, when I go
> to visit the URL in Apache, I get a download prompt for type:
> httpd/unix-directory.
>
>
>
> OS Info:
> ----------------------------------------------------
> CentOS release 4.6 (Final)
> ----------------------------------------------------
>
>
>
> Package info:
> ----------------------------------------------------
> perl-5.8.8-11
> httpd-2.0.59-1.el4s1.10.el4.centos
> mod_perl-2.0.3-1.el4s1.3
> ----------------------------------------------------
>
>
>
> Apache config:
> ----------------------------------------------------
> PerlRequire /etc/httpd/perl/startup.pl
>
> SetHandler modperl
> PerlResponseHandler Myserver::Handler
>

> ----------------------------------------------------
>
>
>
> /etc/httpd/perl/startup.pl:
> ----------------------------------------------------
> use lib qw(/home/Perl/);
> 1;
> ----------------------------------------------------
>
>
>
> /home/perl/Myserver/Handler.pm
> ----------------------------------------------------
> package Myserver::Handler;
>
> #Setup some essentials
> use strict; #strict tolerance for code
> use Carp; #debugging
> use diagnostics; #more debugging
> use warnings; #more debugging
>
> #Handler-related stuff
> use Apache2::RequestRec ();
> use Apache2::RequestIO ();
> use Apache2::Const -compile => qw(OK);
>
> sub handler {
> my $self = shift;
> return Apache2::Const::OK;
> }
>
> 1;
>
> ----------------------------------------------------
>

Re: mod_perl 2.0 Handler issue

am 12.03.2008 18:04:11 von aw

xyon wrote:
> Hello everyone,
>
> I am writing my first mod_perl handler. I've looked at some of the docs
> online and have come up with the config/code below. However, when I go
> to visit the URL in Apache, I get a download prompt for type:
> httpd/unix-directory.
>
[snip]
try this :

sub handler {
my $r = shift; # get the Apache Request object

$r->content_type('text/html'); # set some Response header
$r->print("

It works !

); # send some content

return Apache2::Const::OK; # make Apache happy
}

In your original version, what happens is :

sub handler {
my $self = shift; # you get the Request object here
# you return no content at all
return Apache2::Const::OK; # tell Apache it's OK
}

I guess that with no content returned (not even HTTP headers), Apache is
left to wonder what to return, and returns something to the browser with
a funny content type.

On the other hand, if in your http config you had :

PerlResponseHandler Myserver::Handler->handler

then your handler sub should be :

sub handler {
my $self = shift; # get Myserver::Handler class
my $r = shift; # get the Apache Request object

$r->content_type('text/html'); # set the Response headers
$r->print("

It works !

); # send some content

return Apache2::Const::OK; # make Apache happy
}

That is because with the Package->sub syntax in the http config,
mod_perl sets up the call differently, and calls you sub() as a method.

One last tip :
If, instead of returning Apache2::const::OK in your handler, you send
nothing back but return Apache2::const::DECLINED, then Apache will
revert to its own default handler, and send back what it would normally
send (probably a directory listing in this case).

Hope this helps.


André

Re: mod_perl 2.0 Handler issue

am 12.03.2008 23:58:45 von xyon

Hey everyone,

I am working on my first Object-Oriented project, and have hit a slight
snag. I am using HTML::Template to output within the View module, but it
never outputs. I don't see any errors in the logs, I just get a blank
page. Below is pertinent information including a test script with its
output:



OS Info:
----------------------------------------------------
CentOS release 4.6 (Final)
----------------------------------------------------



Package info:
----------------------------------------------------
perl-5.8.8-11
perl-HTML-Template-2.9-1
httpd-2.0.59-1.el4s1.10.el4.centos
mod_perl-2.0.3-1.el4s1.3
----------------------------------------------------



/home/perl/Myserver/View.pm
----------------------------------------------------
package Myserver::View;

#Setup some essentials
use strict; #strict tolerance for code
use Carp; #debugging
use diagnostics; #more debugging
use warnings; #more debugging

#Loadup some needed functions
use HTML::Template;

sub new {
my $self = shift;
return $self;
}

sub mainpage {
my $self = shift;
my $template = HTML::Template->new( filename =>
'/home/Perl/tmpl/mainpage.tmpl',
cache => 1,
debug => 1,
stack_debug => 1 );
print "Content-Type: text/html\n\n";
$template->output;
return $self;
}

1;
----------------------------------------------------



/home/Perl/tests/View_mainpage.pl
----------------------------------------------------
#!/usr/bin/perl -w

# Test printing of the main page
print "Main Page..";

#Let's load the view module
use lib "../";
use Myserver::View;
#Now let's load some things that are very handy
use strict; #strict tolerance for code
use Carp; #debugging
use warnings; #more debugging
use diagnostics; #even more debugging

# Let's create an object
my $view = Myserver::View->new;

# Now, let's tell View to display the main page
$view->mainpage;

print ".OK";

1;
----------------------------------------------------



/home/Perl/tmpl/mainpage.tmpl:
----------------------------------------------------
Test!
----------------------------------------------------



Output with debugging on (as above):
----------------------------------------------------
$ tests/View_mainpage.pl
### HTML::Template Debug ### In _parse:
### HTML::Template _param Stack Dump ###

$VAR1 = [
\'Test!
'
];

Main Page..Content-Type: text/html

### HTML::Template Debug ### In output
### HTML::Template output Stack Dump ###

$VAR1 = [
\'Test!
'
];

..OK
----------------------------------------------------



Output without debugging:
----------------------------------------------------
$ tests/View_mainpage.pl
Main Page..Content-Type: text/html

..OK
----------------------------------------------------




--
xyon

Custom Object-Oriented Module using HTML::Template

am 13.03.2008 00:02:27 von xyon

Hey everyone,

Firstly, I apologize I sent the previous email under an incorrect subject line.

I am working on my first Object-Oriented project, and have hit a slight
snag. I am using HTML::Template to output within the View module, but it
never outputs. I don't see any errors in the logs, I just get a blank
page. Below is pertinent information including a test script with its
output:



OS Info:
----------------------------------------------------
CentOS release 4.6 (Final)
----------------------------------------------------



Package info:
----------------------------------------------------
perl-5.8.8-11
perl-HTML-Template-2.9-1
httpd-2.0.59-1.el4s1.10.el4.centos
mod_perl-2.0.3-1.el4s1.3
----------------------------------------------------



/home/perl/Myserver/View.pm
----------------------------------------------------
package Myserver::View;

#Setup some essentials
use strict; #strict tolerance for code
use Carp; #debugging
use diagnostics; #more debugging
use warnings; #more debugging

#Loadup some needed functions
use HTML::Template;

sub new {
my $self = shift;
return $self;
}

sub mainpage {
my $self = shift;
my $template = HTML::Template->new( filename =>
'/home/Perl/tmpl/mainpage.tmpl',
cache => 1,
debug => 1,
stack_debug => 1 );
print "Content-Type: text/html\n\n";
$template->output;
return $self;
}

1;
----------------------------------------------------



/home/Perl/tests/View_mainpage.pl
----------------------------------------------------
#!/usr/bin/perl -w

# Test printing of the main page
print "Main Page..";

#Let's load the view module
use lib "../";
use Myserver::View;
#Now let's load some things that are very handy
use strict; #strict tolerance for code
use Carp; #debugging
use warnings; #more debugging
use diagnostics; #even more debugging

# Let's create an object
my $view = Myserver::View->new;

# Now, let's tell View to display the main page
$view->mainpage;

print ".OK";

1;
----------------------------------------------------



/home/Perl/tmpl/mainpage.tmpl:
----------------------------------------------------
Test!
----------------------------------------------------



Output with debugging on (as above):
----------------------------------------------------
$ tests/View_mainpage.pl
### HTML::Template Debug ### In _parse:
### HTML::Template _param Stack Dump ###

$VAR1 = [
\'Test!
'
];

Main Page..Content-Type: text/html

### HTML::Template Debug ### In output
### HTML::Template output Stack Dump ###

$VAR1 = [
\'Test!
'
];

..OK
----------------------------------------------------



Output without debugging:
----------------------------------------------------
$ tests/View_mainpage.pl
Main Page..Content-Type: text/html

..OK
----------------------------------------------------




--
xyon

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 00:39:42 von roberto

--f0KYrhQ4vYSV2aJu
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Mar 12, 2008 at 11:02:27PM +0000, xyon wrote:
> Hey everyone,
>=20
> Firstly, I apologize I sent the previous email under an incorrect subject=
line.
>=20

Yes, but you still hijacked another thread.

=3D> In-Reply-To:

Please don't do that. Start a new thread by sending a new message to
the list. Don't just repky some random message and change the subject
line.

Regards,

-Roberto

--=20
Roberto C. S=E1nchez
http://people.connexer.com/~roberto
http://www.connexer.com

--f0KYrhQ4vYSV2aJu
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH2Gm+5SXWIKfIlGQRAmV1AKDQawhKwgYF7mHVcJDbsL0DfG2FzACd EhLB
lUDu2WDYpZe4KN5mTUMnyGI=
=JaJb
-----END PGP SIGNATURE-----

--f0KYrhQ4vYSV2aJu--

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 00:58:25 von Colin Wetherbee

Roberto � wrote:
> On Wed, Mar 12, 2008 at 11:02:27PM +0000, xyon wrote:
>> Hey everyone,
>>
>> Firstly, I apologize I sent the previous email under an incorrect subject line.
>>
>
> Yes, but you still hijacked another thread.
>
> => In-Reply-To:
>
> Please don't do that. Start a new thread by sending a new message to
> the list. Don't just repky some random message and change the subject
> line.

At least give him credit for showing plenty of diagnostic information.
That's something we rarely see with newbies. :)

Colin

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 00:58:36 von xyon

Fixed. I forgot to print the template->output.

print $template->output;

On Wed, 2008-03-12 at 23:02 +0000, xyon wrote:
> Hey everyone,
>
> Firstly, I apologize I sent the previous email under an incorrect subject line.
>
> I am working on my first Object-Oriented project, and have hit a slight
> snag. I am using HTML::Template to output within the View module, but it
> never outputs. I don't see any errors in the logs, I just get a blank
> page. Below is pertinent information including a test script with its
> output:
>
>
>
> OS Info:
> ----------------------------------------------------
> CentOS release 4.6 (Final)
> ----------------------------------------------------
>
>
>
> Package info:
> ----------------------------------------------------
> perl-5.8.8-11
> perl-HTML-Template-2.9-1
> httpd-2.0.59-1.el4s1.10.el4.centos
> mod_perl-2.0.3-1.el4s1.3
> ----------------------------------------------------
>
>
>
> /home/perl/Myserver/View.pm
> ----------------------------------------------------
> package Myserver::View;
>
> #Setup some essentials
> use strict; #strict tolerance for code
> use Carp; #debugging
> use diagnostics; #more debugging
> use warnings; #more debugging
>
> #Loadup some needed functions
> use HTML::Template;
>
> sub new {
> my $self = shift;
> return $self;
> }
>
> sub mainpage {
> my $self = shift;
> my $template = HTML::Template->new( filename =>
> '/home/Perl/tmpl/mainpage.tmpl',
> cache => 1,
> debug => 1,
> stack_debug => 1 );
> print "Content-Type: text/html\n\n";
> $template->output;
> return $self;
> }
>
> 1;
> ----------------------------------------------------
>
>
>
> /home/Perl/tests/View_mainpage.pl
> ----------------------------------------------------
> #!/usr/bin/perl -w
>
> # Test printing of the main page
> print "Main Page..";
>
> #Let's load the view module
> use lib "../";
> use Myserver::View;
> #Now let's load some things that are very handy
> use strict; #strict tolerance for code
> use Carp; #debugging
> use warnings; #more debugging
> use diagnostics; #even more debugging
>
> # Let's create an object
> my $view = Myserver::View->new;
>
> # Now, let's tell View to display the main page
> $view->mainpage;
>
> print ".OK";
>
> 1;
> ----------------------------------------------------
>
>
>
> /home/Perl/tmpl/mainpage.tmpl:
> ----------------------------------------------------
> Test!
> ----------------------------------------------------
>
>
>
> Output with debugging on (as above):
> ----------------------------------------------------
> $ tests/View_mainpage.pl
> ### HTML::Template Debug ### In _parse:
> ### HTML::Template _param Stack Dump ###
>
> $VAR1 = [
> \'Test!
> '
> ];
>
> Main Page..Content-Type: text/html
>
> ### HTML::Template Debug ### In output
> ### HTML::Template output Stack Dump ###
>
> $VAR1 = [
> \'Test!
> '
> ];
>
> .OK
> ----------------------------------------------------
>
>
>
> Output without debugging:
> ----------------------------------------------------
> $ tests/View_mainpage.pl
> Main Page..Content-Type: text/html
>
> .OK
> ----------------------------------------------------
>
>
>

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 01:42:26 von roberto

--/3yNEOqWowh/8j+e
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Mar 12, 2008 at 07:58:25PM -0400, Colin Wetherbee wrote:
> Roberto ï¿=BD wrote:
> >On Wed, Mar 12, 2008 at 11:02:27PM +0000, xyon wrote:
> >>Hey everyone,
> >>
> >>Firstly, I apologize I sent the previous email under an incorrect subje=
ct=20
> >>line.
> >>
> >
> >Yes, but you still hijacked another thread.
> >
> >=3D> In-Reply-To:
> >
> >Please don't do that. Start a new thread by sending a new message to
> >the list. Don't just repky some random message and change the subject
> >line.
>=20
> At least give him credit for showing plenty of diagnostic information.=20
> That's something we rarely see with newbies. :)
>=20
True. I apologize for overlooking that.

Regards,

-Roberto

--=20
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

--/3yNEOqWowh/8j+e
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH2Hhy5SXWIKfIlGQRAoUyAJ4+f74IFYcS0sJY0UEHg9/XZsVUdACf bwbb
+KCKZXerlOrhk4Of8OzOw0I=
=FpDP
-----END PGP SIGNATURE-----

--/3yNEOqWowh/8j+e--

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 06:29:51 von Foo JH

try print $template->output;

You forgot the print();

xyon wrote:
> Hey everyone,
>
> Firstly, I apologize I sent the previous email under an incorrect subject line.
>
> I am working on my first Object-Oriented project, and have hit a slight
> snag. I am using HTML::Template to output within the View module, but it
> never outputs. I don't see any errors in the logs, I just get a blank
> page. Below is pertinent information including a test script with its
> output:
>
>
>
> OS Info:
> ----------------------------------------------------
> CentOS release 4.6 (Final)
> ----------------------------------------------------
>
>
>
> Package info:
> ----------------------------------------------------
> perl-5.8.8-11
> perl-HTML-Template-2.9-1
> httpd-2.0.59-1.el4s1.10.el4.centos
> mod_perl-2.0.3-1.el4s1.3
> ----------------------------------------------------
>
>
>
> /home/perl/Myserver/View.pm
> ----------------------------------------------------
> package Myserver::View;
>
> #Setup some essentials
> use strict; #strict tolerance for code
> use Carp; #debugging
> use diagnostics; #more debugging
> use warnings; #more debugging
>
> #Loadup some needed functions
> use HTML::Template;
>
> sub new {
> my $self = shift;
> return $self;
> }
>
> sub mainpage {
> my $self = shift;
> my $template = HTML::Template->new( filename =>
> '/home/Perl/tmpl/mainpage.tmpl',
> cache => 1,
> debug => 1,
> stack_debug => 1 );
> print "Content-Type: text/html\n\n";
> $template->output;
> return $self;
> }
>
> 1;
> ----------------------------------------------------
>
>
>
> /home/Perl/tests/View_mainpage.pl
> ----------------------------------------------------
> #!/usr/bin/perl -w
>
> # Test printing of the main page
> print "Main Page..";
>
> #Let's load the view module
> use lib "../";
> use Myserver::View;
> #Now let's load some things that are very handy
> use strict; #strict tolerance for code
> use Carp; #debugging
> use warnings; #more debugging
> use diagnostics; #even more debugging
>
> # Let's create an object
> my $view = Myserver::View->new;
>
> # Now, let's tell View to display the main page
> $view->mainpage;
>
> print ".OK";
>
> 1;
> ----------------------------------------------------
>
>
>
> /home/Perl/tmpl/mainpage.tmpl:
> ----------------------------------------------------
> Test!
> ----------------------------------------------------
>
>
>
> Output with debugging on (as above):
> ----------------------------------------------------
> $ tests/View_mainpage.pl
> ### HTML::Template Debug ### In _parse:
> ### HTML::Template _param Stack Dump ###
>
> $VAR1 = [
> \'Test!
> '
> ];
>
> Main Page..Content-Type: text/html
>
> ### HTML::Template Debug ### In output
> ### HTML::Template output Stack Dump ###
>
> $VAR1 = [
> \'Test!
> '
> ];
>
> .OK
> ----------------------------------------------------
>
>
>
> Output without debugging:
> ----------------------------------------------------
> $ tests/View_mainpage.pl
> Main Page..Content-Type: text/html
>
> .OK
> ----------------------------------------------------
>
>
>
>
>

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:01:15 von xyon

That worked great with the test script ( print $template->output; ), but
unfortunately, I'm having trouble getting the display onto a web page
(via the Handler). The resulting web page is blank, with no source.


Below are my Apache configs for the handler, logs, and the handler and
view module's latest code. I've also included the test script code, just
in case there is some obvious reason it would work and the handler
won't.




Apache config:
----------------------------------------------------
PerlRequire /etc/httpd/perl/startup.pl

SetHandler modperl
PerlResponseHandler Myserver::Handler

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




/etc/httpd/perl/startup.pl:
----------------------------------------------------
use lib qw(/home/Perl/);
1;
----------------------------------------------------




Apache log:
----------------------------------------------------
==> /var/log/httpd/error_log <==
### HTML::Template Debug ### In _parse:
### HTML::Template _param Stack Dump ###

$VAR1 = [
\'Test!
'
];

### HTML::Template Debug ### In output
### HTML::Template output Stack Dump ###

$VAR1 = [
\'Test!
'
];


==> /var/log/httpd/ssl_request_log <==
[13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
"GET /admin/ HTTP/1.1" -

==> /var/log/httpd/ssl_access_log <==
10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 -
----------------------------------------------------




/home/Perl/Myserver/Handler.pm
----------------------------------------------------
package Myserver::Handler;

#Setup some essentials
use strict; #strict tolerance for code
use Carp; #debugging
use diagnostics; #more debugging
use warnings; #more debugging

#Handler-related stuff
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(OK);

sub handler {
my $self = shift;

my $view = Myserver::View->new();
$view->mainpage;

# Obligatory stuff for the handler
$self->content_type('text/html');
return Apache2::Const::OK;

}

1;

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




/home/Perl/Myserver/View.pm:
----------------------------------------------------
package Myserver::View;

#Setup some essentials
use strict; #strict tolerance for code
use Carp; #debugging
use diagnostics; #more debugging
use warnings; #more debugging

#Loadup some needed functions
use HTML::Template;

sub new {
my $self = shift;
return $self;
}

sub mainpage {
my $self = shift;
my $template = HTML::Template->new(
filename => '/home/Perl/tmpl/mainpage.tmpl',
cache => 1,
debug => 1,
stack_debug => 1 );
print "Content-Type: text/html\n\n";
print $template->output;
return $self;
}

1;
----------------------------------------------------




/home/Perl/tmpl/mainpage.tmpl:
----------------------------------------------------
Test!
----------------------------------------------------




/home/Perl/tests/View_mainpage.pl
----------------------------------------------------
#!/usr/bin/perl -w

# Test printing of the main page
print "Main Page..";

#Let's load the view module
use lib "../";
use Myserver::View;
#Now let's load some things that are very handy
use strict; #strict tolerance for code
use Carp; #debugging
use warnings; #more debugging
use diagnostics; #even more debugging

# Let's create an object
my $view = Myserver::View->new;

# Now, let's tell View to display the main page
$view->mainpage;

print ".OK";

1;
----------------------------------------------------




On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
> try print $template->output;
>
> You forgot the print();
>
> xyon wrote:
> > Hey everyone,
> >
> > Firstly, I apologize I sent the previous email under an incorrect subject line.
> >
> > I am working on my first Object-Oriented project, and have hit a slight
> > snag. I am using HTML::Template to output within the View module, but it
> > never outputs. I don't see any errors in the logs, I just get a blank
> > page. Below is pertinent information including a test script with its
> > output:
> >
> >
> >
> > OS Info:
> > ----------------------------------------------------
> > CentOS release 4.6 (Final)
> > ----------------------------------------------------
> >
> >
> >
> > Package info:
> > ----------------------------------------------------
> > perl-5.8.8-11
> > perl-HTML-Template-2.9-1
> > httpd-2.0.59-1.el4s1.10.el4.centos
> > mod_perl-2.0.3-1.el4s1.3
> > ----------------------------------------------------
> >
> >
> >
> > /home/perl/Myserver/View.pm
> > ----------------------------------------------------
> > package Myserver::View;
> >
> > #Setup some essentials
> > use strict; #strict tolerance for code
> > use Carp; #debugging
> > use diagnostics; #more debugging
> > use warnings; #more debugging
> >
> > #Loadup some needed functions
> > use HTML::Template;
> >
> > sub new {
> > my $self = shift;
> > return $self;
> > }
> >
> > sub mainpage {
> > my $self = shift;
> > my $template = HTML::Template->new( filename =>
> > '/home/Perl/tmpl/mainpage.tmpl',
> > cache => 1,
> > debug => 1,
> > stack_debug => 1 );
> > print "Content-Type: text/html\n\n";
> > $template->output;
> > return $self;
> > }
> >
> > 1;
> > ----------------------------------------------------
> >
> >
> >
> > /home/Perl/tests/View_mainpage.pl
> > ----------------------------------------------------
> > #!/usr/bin/perl -w
> >
> > # Test printing of the main page
> > print "Main Page..";
> >
> > #Let's load the view module
> > use lib "../";
> > use Myserver::View;
> > #Now let's load some things that are very handy
> > use strict; #strict tolerance for code
> > use Carp; #debugging
> > use warnings; #more debugging
> > use diagnostics; #even more debugging
> >
> > # Let's create an object
> > my $view = Myserver::View->new;
> >
> > # Now, let's tell View to display the main page
> > $view->mainpage;
> >
> > print ".OK";
> >
> > 1;
> > ----------------------------------------------------
> >
> >
> >
> > /home/Perl/tmpl/mainpage.tmpl:
> > ----------------------------------------------------
> > Test!
> > ----------------------------------------------------
> >
> >
> >
> > Output with debugging on (as above):
> > ----------------------------------------------------
> > $ tests/View_mainpage.pl
> > ### HTML::Template Debug ### In _parse:
> > ### HTML::Template _param Stack Dump ###
> >
> > $VAR1 = [
> > \'Test!
> > '
> > ];
> >
> > Main Page..Content-Type: text/html
> >
> > ### HTML::Template Debug ### In output
> > ### HTML::Template output Stack Dump ###
> >
> > $VAR1 = [
> > \'Test!
> > '
> > ];
> >
> > .OK
> > ----------------------------------------------------
> >
> >
> >
> > Output without debugging:
> > ----------------------------------------------------
> > $ tests/View_mainpage.pl
> > Main Page..Content-Type: text/html
> >
> > .OK
> > ----------------------------------------------------
> >
> >
> >
> >
> >
>

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:11:17 von aw

Hi.

First, a small disgression : along with perl, comes a beautiful test
tool for HTTP stuff, called "lwp-request".
Like, at the command-line :
lwp-request (to see the options)
lwp-request -m GET -Sed "http://myserver/myURL"
(that will show you what you get as a response, without a browser
getting in the way)

Then, below, are you not now sending one "Content-type" too many ?
It looks like you are doing it once in handler(), and once in mainpage().

André

xyon wrote:
> That worked great with the test script ( print $template->output; ), but
> unfortunately, I'm having trouble getting the display onto a web page
> (via the Handler). The resulting web page is blank, with no source.
>
>
> Below are my Apache configs for the handler, logs, and the handler and
> view module's latest code. I've also included the test script code, just
> in case there is some obvious reason it would work and the handler
> won't.
>
>
>
>
> Apache config:
> ----------------------------------------------------
> PerlRequire /etc/httpd/perl/startup.pl
>
> SetHandler modperl
> PerlResponseHandler Myserver::Handler
>

> ----------------------------------------------------
>
>
>
>
> /etc/httpd/perl/startup.pl:
> ----------------------------------------------------
> use lib qw(/home/Perl/);
> 1;
> ----------------------------------------------------
>
>
>
>
> Apache log:
> ----------------------------------------------------
> ==> /var/log/httpd/error_log <==
> ### HTML::Template Debug ### In _parse:
> ### HTML::Template _param Stack Dump ###
>
> $VAR1 = [
> \'Test!
> '
> ];
>
> ### HTML::Template Debug ### In output
> ### HTML::Template output Stack Dump ###
>
> $VAR1 = [
> \'Test!
> '
> ];
>
>
> ==> /var/log/httpd/ssl_request_log <==
> [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
> "GET /admin/ HTTP/1.1" -
>
> ==> /var/log/httpd/ssl_access_log <==
> 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 -
> ----------------------------------------------------
>
>
>
>
> /home/Perl/Myserver/Handler.pm
> ----------------------------------------------------
> package Myserver::Handler;
>
> #Setup some essentials
> use strict; #strict tolerance for code
> use Carp; #debugging
> use diagnostics; #more debugging
> use warnings; #more debugging
>
> #Handler-related stuff
> use Apache2::RequestRec ();
> use Apache2::RequestIO ();
> use Apache2::Const -compile => qw(OK);
>
> sub handler {
> my $self = shift;
>
> my $view = Myserver::View->new();
> $view->mainpage;
>
> # Obligatory stuff for the handler
> $self->content_type('text/html');
> return Apache2::Const::OK;
>
> }
>
> 1;
>
> ----------------------------------------------------
>
>
>
>
> /home/Perl/Myserver/View.pm:
> ----------------------------------------------------
> package Myserver::View;
>
> #Setup some essentials
> use strict; #strict tolerance for code
> use Carp; #debugging
> use diagnostics; #more debugging
> use warnings; #more debugging
>
> #Loadup some needed functions
> use HTML::Template;
>
> sub new {
> my $self = shift;
> return $self;
> }
>
> sub mainpage {
> my $self = shift;
> my $template = HTML::Template->new(
> filename => '/home/Perl/tmpl/mainpage.tmpl',
> cache => 1,
> debug => 1,
> stack_debug => 1 );
> print "Content-Type: text/html\n\n";
> print $template->output;
> return $self;
> }
>
> 1;
> ----------------------------------------------------
>
>
>
>
> /home/Perl/tmpl/mainpage.tmpl:
> ----------------------------------------------------
> Test!
> ----------------------------------------------------
>
>
>
>
> /home/Perl/tests/View_mainpage.pl
> ----------------------------------------------------
> #!/usr/bin/perl -w
>
> # Test printing of the main page
> print "Main Page..";
>
> #Let's load the view module
> use lib "../";
> use Myserver::View;
> #Now let's load some things that are very handy
> use strict; #strict tolerance for code
> use Carp; #debugging
> use warnings; #more debugging
> use diagnostics; #even more debugging
>
> # Let's create an object
> my $view = Myserver::View->new;
>
> # Now, let's tell View to display the main page
> $view->mainpage;
>
> print ".OK";
>
> 1;
> ----------------------------------------------------
>
>
>
>
> On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
>> try print $template->output;
>>
>> You forgot the print();
>>
>> xyon wrote:
>>> Hey everyone,
>>>
>>> Firstly, I apologize I sent the previous email under an incorrect subject line.
>>>
>>> I am working on my first Object-Oriented project, and have hit a slight
>>> snag. I am using HTML::Template to output within the View module, but it
>>> never outputs. I don't see any errors in the logs, I just get a blank
>>> page. Below is pertinent information including a test script with its
>>> output:
>>>
>>>
>>>
>>> OS Info:
>>> ----------------------------------------------------
>>> CentOS release 4.6 (Final)
>>> ----------------------------------------------------
>>>
>>>
>>>
>>> Package info:
>>> ----------------------------------------------------
>>> perl-5.8.8-11
>>> perl-HTML-Template-2.9-1
>>> httpd-2.0.59-1.el4s1.10.el4.centos
>>> mod_perl-2.0.3-1.el4s1.3
>>> ----------------------------------------------------
>>>
>>>
>>>
>>> /home/perl/Myserver/View.pm
>>> ----------------------------------------------------
>>> package Myserver::View;
>>>
>>> #Setup some essentials
>>> use strict; #strict tolerance for code
>>> use Carp; #debugging
>>> use diagnostics; #more debugging
>>> use warnings; #more debugging
>>>
>>> #Loadup some needed functions
>>> use HTML::Template;
>>>
>>> sub new {
>>> my $self = shift;
>>> return $self;
>>> }
>>>
>>> sub mainpage {
>>> my $self = shift;
>>> my $template = HTML::Template->new( filename =>
>>> '/home/Perl/tmpl/mainpage.tmpl',
>>> cache => 1,
>>> debug => 1,
>>> stack_debug => 1 );
>>> print "Content-Type: text/html\n\n";
>>> $template->output;
>>> return $self;
>>> }
>>>
>>> 1;
>>> ----------------------------------------------------
>>>
>>>
>>>
>>> /home/Perl/tests/View_mainpage.pl
>>> ----------------------------------------------------
>>> #!/usr/bin/perl -w
>>>
>>> # Test printing of the main page
>>> print "Main Page..";
>>>
>>> #Let's load the view module
>>> use lib "../";
>>> use Myserver::View;
>>> #Now let's load some things that are very handy
>>> use strict; #strict tolerance for code
>>> use Carp; #debugging
>>> use warnings; #more debugging
>>> use diagnostics; #even more debugging
>>>
>>> # Let's create an object
>>> my $view = Myserver::View->new;
>>>
>>> # Now, let's tell View to display the main page
>>> $view->mainpage;
>>>
>>> print ".OK";
>>>
>>> 1;
>>> ----------------------------------------------------
>>>
>>>
>>>
>>> /home/Perl/tmpl/mainpage.tmpl:
>>> ----------------------------------------------------
>>> Test!
>>> ----------------------------------------------------
>>>
>>>
>>>
>>> Output with debugging on (as above):
>>> ----------------------------------------------------
>>> $ tests/View_mainpage.pl
>>> ### HTML::Template Debug ### In _parse:
>>> ### HTML::Template _param Stack Dump ###
>>>
>>> $VAR1 = [
>>> \'Test!
>>> '
>>> ];
>>>
>>> Main Page..Content-Type: text/html
>>>
>>> ### HTML::Template Debug ### In output
>>> ### HTML::Template output Stack Dump ###
>>>
>>> $VAR1 = [
>>> \'Test!
>>> '
>>> ];
>>>
>>> .OK
>>> ----------------------------------------------------
>>>
>>>
>>>
>>> Output without debugging:
>>> ----------------------------------------------------
>>> $ tests/View_mainpage.pl
>>> Main Page..Content-Type: text/html
>>>
>>> .OK
>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>>
>

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:26:49 von xyon

Thanks for the reply.

I thought as you did (that there were too many "Content-Type"
definitions), so commented out this line in the View.pm module, but that
doesn't seem to have changed anything:

'print "Content-Type: text/html\n\n";'




Here is the lwp command and output:
------------------------------------------------------------ -------
$ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
GET http://localhost/admin/
User-Agent: lwp-request/2.07

GET http://localhost/admin/ --> 200 OK
Connection: close
Date: Thu, 13 Mar 2008 15:24:23 GMT
Server: Apache
Content-Length: 0
Content-Type: text/html; charset=3DUTF-8
Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
------------------------------------------------------------ -------


On Thu, 2008-03-13 at 16:11 +0100, André Warnier wrote:
> Hi.
>=20
> First, a small disgression : along with perl, comes a beautiful test=20
> tool for HTTP stuff, called "lwp-request".
> Like, at the command-line :
> lwp-request (to see the options)
> lwp-request -m GET -Sed "http://myserver/myURL"
> (that will show you what you get as a response, without a browser=20
> getting in the way)
>=20
> Then, below, are you not now sending one "Content-type" too many ?
> It looks like you are doing it once in handler(), and once in mainpage().
>=20
> André
>=20
> xyon wrote:
> > That worked great with the test script ( print $template->output; ), bu=
t
> > unfortunately, I'm having trouble getting the display onto a web page
> > (via the Handler). The resulting web page is blank, with no source.
> >=20
> >=20
> > Below are my Apache configs for the handler, logs, and the handler and
> > view module's latest code. I've also included the test script code, jus=
t
> > in case there is some obvious reason it would work and the handler
> > won't.
> >=20
> >=20
> >=20
> >=20
> > Apache config:
> > ----------------------------------------------------
> > PerlRequire /etc/httpd/perl/startup.pl
> >
> > SetHandler modperl=20
> > PerlResponseHandler Myserver::Handler
> >

> > ----------------------------------------------------
> >=20
> >=20
> >=20
> >=20
> > /etc/httpd/perl/startup.pl:
> > ----------------------------------------------------
> > use lib qw(/home/Perl/);
> > 1;
> > ----------------------------------------------------
> >=20
> >=20
> >=20
> >=20
> > Apache log:
> > ----------------------------------------------------
> > ==> /var/log/httpd/error_log <==
> > ### HTML::Template Debug ### In _parse:
> > ### HTML::Template _param Stack Dump ###
> >=20
> > $VAR1 =3D [
> > \'Test!
> > '
> > ];
> >=20
> > ### HTML::Template Debug ### In output
> > ### HTML::Template output Stack Dump ###
> >=20
> > $VAR1 =3D [
> > \'Test!
> > '
> > ];
> >=20
> >=20
> > ==> /var/log/httpd/ssl_request_log <==
> > [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
> > "GET /admin/ HTTP/1.1" -
> >=20
> > ==> /var/log/httpd/ssl_access_log <==
> > 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 -
> > ----------------------------------------------------
> >=20
> >=20
> >=20
> >=20
> > /home/Perl/Myserver/Handler.pm
> > ----------------------------------------------------
> > package Myserver::Handler;
> >=20
> > #Setup some essentials
> > use strict; #strict tolerance for code
> > use Carp; #debugging
> > use diagnostics; #more debugging
> > use warnings; #more debugging
> >=20
> > #Handler-related stuff
> > use Apache2::RequestRec ();
> > use Apache2::RequestIO ();
> > use Apache2::Const -compile =3D> qw(OK);
> >=20
> > sub handler {
> > my $self =3D shift;
> > =20
> > my $view =3D Myserver::View->new();
> > $view->mainpage;
> >=20
> > # Obligatory stuff for the handler
> > $self->content_type('text/html');
> > return Apache2::Const::OK;
> >=20
> > }
> >=20
> > 1;
> >=20
> > ----------------------------------------------------
> >=20
> >=20
> >=20
> >=20
> > /home/Perl/Myserver/View.pm:
> > ----------------------------------------------------
> > package Myserver::View;
> >=20
> > #Setup some essentials
> > use strict; #strict tolerance for code
> > use Carp; #debugging
> > use diagnostics; #more debugging
> > use warnings; #more debugging
> >=20
> > #Loadup some needed functions
> > use HTML::Template;
> >=20
> > sub new {
> > my $self =3D shift;
> > return $self;
> > }
> >=20
> > sub mainpage {
> > my $self =3D shift;
> > my $template =3D HTML::Template->new(
> > filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
> > cache =3D> 1,
> > debug =3D> 1,
> > stack_debug =3D> 1 );
> > print "Content-Type: text/html\n\n";
> > print $template->output;
> > return $self;
> > }
> >=20
> > 1;
> > ----------------------------------------------------
> >=20
> >=20
> >=20
> >=20
> > /home/Perl/tmpl/mainpage.tmpl:
> > ----------------------------------------------------
> > Test!
> > ----------------------------------------------------
> >=20
> >=20
> >=20
> >=20
> > /home/Perl/tests/View_mainpage.pl
> > ----------------------------------------------------
> > #!/usr/bin/perl -w
> >=20
> > # Test printing of the main page
> > print "Main Page..";
> >=20
> > #Let's load the view module
> > use lib "../";
> > use Myserver::View;
> > #Now let's load some things that are very handy
> > use strict; #strict tolerance for code
> > use Carp; #debugging
> > use warnings; #more debugging
> > use diagnostics; #even more debugging
> >=20
> > # Let's create an object
> > my $view =3D Myserver::View->new;
> >=20
> > # Now, let's tell View to display the main page
> > $view->mainpage;
> >=20
> > print ".OK";
> >=20
> > 1;
> > ----------------------------------------------------
> >=20
> >=20
> >=20
> >=20
> > On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
> >> try print $template->output;
> >>
> >> You forgot the print();
> >>
> >> xyon wrote:
> >>> Hey everyone,
> >>>
> >>> Firstly, I apologize I sent the previous email under an incorrect sub=
ject line.
> >>>
> >>> I am working on my first Object-Oriented project, and have hit a slig=
ht
> >>> snag. I am using HTML::Template to output within the View module, but=
it
> >>> never outputs. I don't see any errors in the logs, I just get a blank
> >>> page. Below is pertinent information including a test script with its
> >>> output:
> >>>
> >>>
> >>>
> >>> OS Info:
> >>> ----------------------------------------------------
> >>> CentOS release 4.6 (Final)
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>> Package info:
> >>> ----------------------------------------------------
> >>> perl-5.8.8-11
> >>> perl-HTML-Template-2.9-1
> >>> httpd-2.0.59-1.el4s1.10.el4.centos
> >>> mod_perl-2.0.3-1.el4s1.3
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>> /home/perl/Myserver/View.pm
> >>> ----------------------------------------------------
> >>> package Myserver::View;
> >>>
> >>> #Setup some essentials
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use diagnostics; #more debugging
> >>> use warnings; #more debugging
> >>>
> >>> #Loadup some needed functions
> >>> use HTML::Template;
> >>>
> >>> sub new {
> >>> my $self =3D shift;
> >>> return $self;
> >>> }
> >>>
> >>> sub mainpage {
> >>> my $self =3D shift;
> >>> my $template =3D HTML::Template->new( filename =3D>
> >>> '/home/Perl/tmpl/mainpage.tmpl',
> >>> cache =3D> 1,
> >>> debug =3D> 1,=20
> >>> stack_debug =3D> 1 );
> >>> print "Content-Type: text/html\n\n";
> >>> $template->output;
> >>> return $self;
> >>> }
> >>>
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>> /home/Perl/tests/View_mainpage.pl
> >>> ----------------------------------------------------
> >>> #!/usr/bin/perl -w
> >>>
> >>> # Test printing of the main page
> >>> print "Main Page..";
> >>>
> >>> #Let's load the view module
> >>> use lib "../";
> >>> use Myserver::View;
> >>> #Now let's load some things that are very handy
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use warnings; #more debugging
> >>> use diagnostics; #even more debugging
> >>>
> >>> # Let's create an object
> >>> my $view =3D Myserver::View->new;
> >>>
> >>> # Now, let's tell View to display the main page
> >>> $view->mainpage;
> >>>
> >>> print ".OK";
> >>>
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>> /home/Perl/tmpl/mainpage.tmpl:
> >>> ----------------------------------------------------
> >>> Test!
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>> Output with debugging on (as above):
> >>> ----------------------------------------------------
> >>> $ tests/View_mainpage.pl=20
> >>> ### HTML::Template Debug ### In _parse:
> >>> ### HTML::Template _param Stack Dump ###
> >>>
> >>> $VAR1 =3D [
> >>> \'Test!
> >>> '
> >>> ];
> >>>
> >>> Main Page..Content-Type: text/html
> >>>
> >>> ### HTML::Template Debug ### In output
> >>> ### HTML::Template output Stack Dump ###
> >>>
> >>> $VAR1 =3D [
> >>> \'Test!
> >>> '
> >>> ];
> >>>
> >>> .OK
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>> Output without debugging:
> >>> ----------------------------------------------------
> >>> $ tests/View_mainpage.pl=20
> >>> Main Page..Content-Type: text/html
> >>>
> >>> .OK
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> =20
> >=20

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:30:10 von xyon

Just for clarity's sake, here is the test script command and output:

------------------------------------------------------------ -------
$ tests/View_mainpage.pl=20
### HTML::Template Debug ### In _parse:
### HTML::Template _param Stack Dump ###

$VAR1 =3D [
\'Test!
'
];

### HTML::Template Debug ### In output
### HTML::Template output Stack Dump ###

$VAR1 =3D [
\'Test!
'
];

Main Page..Test!

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


On Thu, 2008-03-13 at 11:26 -0400, xyon wrote:
> Thanks for the reply.
>=20
> I thought as you did (that there were too many "Content-Type"
> definitions), so commented out this line in the View.pm module, but that
> doesn't seem to have changed anything:
>=20
> 'print "Content-Type: text/html\n\n";'
>=20
>=20
>=20
>=20
> Here is the lwp command and output:
> ------------------------------------------------------------ -------
> $ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
> GET http://localhost/admin/
> User-Agent: lwp-request/2.07
>=20
> GET http://localhost/admin/ --> 200 OK
> Connection: close
> Date: Thu, 13 Mar 2008 15:24:23 GMT
> Server: Apache
> Content-Length: 0
> Content-Type: text/html; charset=3DUTF-8
> Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
> Client-Peer: 127.0.0.1:80
> Client-Response-Num: 1
> ------------------------------------------------------------ -------
>=20
>=20
> On Thu, 2008-03-13 at 16:11 +0100, André Warnier wrote:
> > Hi.
> >=20
> > First, a small disgression : along with perl, comes a beautiful test=20
> > tool for HTTP stuff, called "lwp-request".
> > Like, at the command-line :
> > lwp-request (to see the options)
> > lwp-request -m GET -Sed "http://myserver/myURL"
> > (that will show you what you get as a response, without a browser=20
> > getting in the way)
> >=20
> > Then, below, are you not now sending one "Content-type" too many ?
> > It looks like you are doing it once in handler(), and once in mainpage(=
).
> >=20
> > André
> >=20
> > xyon wrote:
> > > That worked great with the test script ( print $template->output; ), =
but
> > > unfortunately, I'm having trouble getting the display onto a web page
> > > (via the Handler). The resulting web page is blank, with no source.
> > >=20
> > >=20
> > > Below are my Apache configs for the handler, logs, and the handler an=
d
> > > view module's latest code. I've also included the test script code, j=
ust
> > > in case there is some obvious reason it would work and the handler
> > > won't.
> > >=20
> > >=20
> > >=20
> > >=20
> > > Apache config:
> > > ----------------------------------------------------
> > > PerlRequire /etc/httpd/perl/startup.pl
> > >
> > > SetHandler modperl=20
> > > PerlResponseHandler Myserver::Handler
> > >

> > > ----------------------------------------------------
> > >=20
> > >=20
> > >=20
> > >=20
> > > /etc/httpd/perl/startup.pl:
> > > ----------------------------------------------------
> > > use lib qw(/home/Perl/);
> > > 1;
> > > ----------------------------------------------------
> > >=20
> > >=20
> > >=20
> > >=20
> > > Apache log:
> > > ----------------------------------------------------
> > > ==> /var/log/httpd/error_log <==
> > > ### HTML::Template Debug ### In _parse:
> > > ### HTML::Template _param Stack Dump ###
> > >=20
> > > $VAR1 =3D [
> > > \'Test!
> > > '
> > > ];
> > >=20
> > > ### HTML::Template Debug ### In output
> > > ### HTML::Template output Stack Dump ###
> > >=20
> > > $VAR1 =3D [
> > > \'Test!
> > > '
> > > ];
> > >=20
> > >=20
> > > ==> /var/log/httpd/ssl_request_log <==
> > > [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
> > > "GET /admin/ HTTP/1.1" -
> > >=20
> > > ==> /var/log/httpd/ssl_access_log <==
> > > 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 =
-
> > > ----------------------------------------------------
> > >=20
> > >=20
> > >=20
> > >=20
> > > /home/Perl/Myserver/Handler.pm
> > > ----------------------------------------------------
> > > package Myserver::Handler;
> > >=20
> > > #Setup some essentials
> > > use strict; #strict tolerance for code
> > > use Carp; #debugging
> > > use diagnostics; #more debugging
> > > use warnings; #more debugging
> > >=20
> > > #Handler-related stuff
> > > use Apache2::RequestRec ();
> > > use Apache2::RequestIO ();
> > > use Apache2::Const -compile =3D> qw(OK);
> > >=20
> > > sub handler {
> > > my $self =3D shift;
> > > =20
> > > my $view =3D Myserver::View->new();
> > > $view->mainpage;
> > >=20
> > > # Obligatory stuff for the handler
> > > $self->content_type('text/html');
> > > return Apache2::Const::OK;
> > >=20
> > > }
> > >=20
> > > 1;
> > >=20
> > > ----------------------------------------------------
> > >=20
> > >=20
> > >=20
> > >=20
> > > /home/Perl/Myserver/View.pm:
> > > ----------------------------------------------------
> > > package Myserver::View;
> > >=20
> > > #Setup some essentials
> > > use strict; #strict tolerance for code
> > > use Carp; #debugging
> > > use diagnostics; #more debugging
> > > use warnings; #more debugging
> > >=20
> > > #Loadup some needed functions
> > > use HTML::Template;
> > >=20
> > > sub new {
> > > my $self =3D shift;
> > > return $self;
> > > }
> > >=20
> > > sub mainpage {
> > > my $self =3D shift;
> > > my $template =3D HTML::Template->new(
> > > filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
> > > cache =3D> 1,
> > > debug =3D> 1,
> > > stack_debug =3D> 1 );
> > > print "Content-Type: text/html\n\n";
> > > print $template->output;
> > > return $self;
> > > }
> > >=20
> > > 1;
> > > ----------------------------------------------------
> > >=20
> > >=20
> > >=20
> > >=20
> > > /home/Perl/tmpl/mainpage.tmpl:
> > > ----------------------------------------------------
> > > Test!
> > > ----------------------------------------------------
> > >=20
> > >=20
> > >=20
> > >=20
> > > /home/Perl/tests/View_mainpage.pl
> > > ----------------------------------------------------
> > > #!/usr/bin/perl -w
> > >=20
> > > # Test printing of the main page
> > > print "Main Page..";
> > >=20
> > > #Let's load the view module
> > > use lib "../";
> > > use Myserver::View;
> > > #Now let's load some things that are very handy
> > > use strict; #strict tolerance for code
> > > use Carp; #debugging
> > > use warnings; #more debugging
> > > use diagnostics; #even more debugging
> > >=20
> > > # Let's create an object
> > > my $view =3D Myserver::View->new;
> > >=20
> > > # Now, let's tell View to display the main page
> > > $view->mainpage;
> > >=20
> > > print ".OK";
> > >=20
> > > 1;
> > > ----------------------------------------------------
> > >=20
> > >=20
> > >=20
> > >=20
> > > On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
> > >> try print $template->output;
> > >>
> > >> You forgot the print();
> > >>
> > >> xyon wrote:
> > >>> Hey everyone,
> > >>>
> > >>> Firstly, I apologize I sent the previous email under an incorrect s=
ubject line.
> > >>>
> > >>> I am working on my first Object-Oriented project, and have hit a sl=
ight
> > >>> snag. I am using HTML::Template to output within the View module, b=
ut it
> > >>> never outputs. I don't see any errors in the logs, I just get a bla=
nk
> > >>> page. Below is pertinent information including a test script with i=
ts
> > >>> output:
> > >>>
> > >>>
> > >>>
> > >>> OS Info:
> > >>> ----------------------------------------------------
> > >>> CentOS release 4.6 (Final)
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>> Package info:
> > >>> ----------------------------------------------------
> > >>> perl-5.8.8-11
> > >>> perl-HTML-Template-2.9-1
> > >>> httpd-2.0.59-1.el4s1.10.el4.centos
> > >>> mod_perl-2.0.3-1.el4s1.3
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>> /home/perl/Myserver/View.pm
> > >>> ----------------------------------------------------
> > >>> package Myserver::View;
> > >>>
> > >>> #Setup some essentials
> > >>> use strict; #strict tolerance for code
> > >>> use Carp; #debugging
> > >>> use diagnostics; #more debugging
> > >>> use warnings; #more debugging
> > >>>
> > >>> #Loadup some needed functions
> > >>> use HTML::Template;
> > >>>
> > >>> sub new {
> > >>> my $self =3D shift;
> > >>> return $self;
> > >>> }
> > >>>
> > >>> sub mainpage {
> > >>> my $self =3D shift;
> > >>> my $template =3D HTML::Template->new( filename =3D>
> > >>> '/home/Perl/tmpl/mainpage.tmpl',
> > >>> cache =3D> 1,
> > >>> debug =3D> 1,=20
> > >>> stack_debug =3D> 1 );
> > >>> print "Content-Type: text/html\n\n";
> > >>> $template->output;
> > >>> return $self;
> > >>> }
> > >>>
> > >>> 1;
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>> /home/Perl/tests/View_mainpage.pl
> > >>> ----------------------------------------------------
> > >>> #!/usr/bin/perl -w
> > >>>
> > >>> # Test printing of the main page
> > >>> print "Main Page..";
> > >>>
> > >>> #Let's load the view module
> > >>> use lib "../";
> > >>> use Myserver::View;
> > >>> #Now let's load some things that are very handy
> > >>> use strict; #strict tolerance for code
> > >>> use Carp; #debugging
> > >>> use warnings; #more debugging
> > >>> use diagnostics; #even more debugging
> > >>>
> > >>> # Let's create an object
> > >>> my $view =3D Myserver::View->new;
> > >>>
> > >>> # Now, let's tell View to display the main page
> > >>> $view->mainpage;
> > >>>
> > >>> print ".OK";
> > >>>
> > >>> 1;
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>> /home/Perl/tmpl/mainpage.tmpl:
> > >>> ----------------------------------------------------
> > >>> Test!
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>> Output with debugging on (as above):
> > >>> ----------------------------------------------------
> > >>> $ tests/View_mainpage.pl=20
> > >>> ### HTML::Template Debug ### In _parse:
> > >>> ### HTML::Template _param Stack Dump ###
> > >>>
> > >>> $VAR1 =3D [
> > >>> \'Test!
> > >>> '
> > >>> ];
> > >>>
> > >>> Main Page..Content-Type: text/html
> > >>>
> > >>> ### HTML::Template Debug ### In output
> > >>> ### HTML::Template output Stack Dump ###
> > >>>
> > >>> $VAR1 =3D [
> > >>> \'Test!
> > >>> '
> > >>> ];
> > >>>
> > >>> .OK
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>> Output without debugging:
> > >>> ----------------------------------------------------
> > >>> $ tests/View_mainpage.pl=20
> > >>> Main Page..Content-Type: text/html
> > >>>
> > >>> .OK
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> =20
> > >=20

RE: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:32:37 von mike.boston

Good Morning.

I updated apache from 1.27 to 1.3.41 and now I get an error in the
httpd.conf on the code segment below.

Please assist if possible.

Do I have to reinstall perl?

# Apache::Registry scripts
PerlModule Apache::Registry
Alias /perl/ "D:/Apache/perl/"

Sethandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
PerlSendHeader On




-----Original Message-----
From: xyon [mailto:xyon@indigorobot.com]
Sent: Thursday, March 13, 2008 11:27 AM
To: Andr=E9 Warnier
Cc: modperl
Subject: Re: Custom Object-Oriented Module using HTML::Template


This message uses a character set that is not supported by the Internet
Service. To view the original message content, open the attached =
message.
If the text doesn't display correctly, save the attachment to disk, and =
then
open it using a viewer that can display the original character set.=20

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:38:43 von aw

Hi.

First, don't take my suggestions as gospel, I don't know the TT2 and do
not really know how you're supposed to work with it.
But it seems to me that this is in the wrong order :

$view->mainpage;
$self->content_type('text/html');

I think you should trigger the HTTP header before you generate the
content. Now, whether that is the reason of your current problem or
not, I haven't a clue.

But I'm trying, and I'm really interested, because I am starting to want
to know more about TT2 (and Catalyst) these days. So your
"from-the-very beginning" approach is also very helpful to me.
(And I do have a certain experience of Apache2/mod_perl2)

And, re-check your lwp-request switches, you might have disabled the
display of the response content (remove the -d).

André



xyon wrote:
> Thanks for the reply.
>
> I thought as you did (that there were too many "Content-Type"
> definitions), so commented out this line in the View.pm module, but that
> doesn't seem to have changed anything:
>
> 'print "Content-Type: text/html\n\n";'
>
>
>
>
> Here is the lwp command and output:
> ------------------------------------------------------------ -------
> $ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
> GET http://localhost/admin/
> User-Agent: lwp-request/2.07
>
> GET http://localhost/admin/ --> 200 OK
> Connection: close
> Date: Thu, 13 Mar 2008 15:24:23 GMT
> Server: Apache
> Content-Length: 0
> Content-Type: text/html; charset=UTF-8
> Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
> Client-Peer: 127.0.0.1:80
> Client-Response-Num: 1
> ------------------------------------------------------------ -------
>
>
> On Thu, 2008-03-13 at 16:11 +0100, André Warnier wrote:
>> Hi.
>>
>> First, a small disgression : along with perl, comes a beautiful test
>> tool for HTTP stuff, called "lwp-request".
>> Like, at the command-line :
>> lwp-request (to see the options)
>> lwp-request -m GET -Sed "http://myserver/myURL"
>> (that will show you what you get as a response, without a browser
>> getting in the way)
>>
>> Then, below, are you not now sending one "Content-type" too many ?
>> It looks like you are doing it once in handler(), and once in mainpage().
>>
>> André
>>
>> xyon wrote:
>>> That worked great with the test script ( print $template->output; ), but
>>> unfortunately, I'm having trouble getting the display onto a web page
>>> (via the Handler). The resulting web page is blank, with no source.
>>>
>>>
>>> Below are my Apache configs for the handler, logs, and the handler and
>>> view module's latest code. I've also included the test script code, just
>>> in case there is some obvious reason it would work and the handler
>>> won't.
>>>
>>>
>>>
>>>
>>> Apache config:
>>> ----------------------------------------------------
>>> PerlRequire /etc/httpd/perl/startup.pl
>>>
>>> SetHandler modperl
>>> PerlResponseHandler Myserver::Handler
>>>

>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>> /etc/httpd/perl/startup.pl:
>>> ----------------------------------------------------
>>> use lib qw(/home/Perl/);
>>> 1;
>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>> Apache log:
>>> ----------------------------------------------------
>>> ==> /var/log/httpd/error_log <==
>>> ### HTML::Template Debug ### In _parse:
>>> ### HTML::Template _param Stack Dump ###
>>>
>>> $VAR1 = [
>>> \'Test!
>>> '
>>> ];
>>>
>>> ### HTML::Template Debug ### In output
>>> ### HTML::Template output Stack Dump ###
>>>
>>> $VAR1 = [
>>> \'Test!
>>> '
>>> ];
>>>
>>>
>>> ==> /var/log/httpd/ssl_request_log <==
>>> [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
>>> "GET /admin/ HTTP/1.1" -
>>>
>>> ==> /var/log/httpd/ssl_access_log <==
>>> 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 -
>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>> /home/Perl/Myserver/Handler.pm
>>> ----------------------------------------------------
>>> package Myserver::Handler;
>>>
>>> #Setup some essentials
>>> use strict; #strict tolerance for code
>>> use Carp; #debugging
>>> use diagnostics; #more debugging
>>> use warnings; #more debugging
>>>
>>> #Handler-related stuff
>>> use Apache2::RequestRec ();
>>> use Apache2::RequestIO ();
>>> use Apache2::Const -compile => qw(OK);
>>>
>>> sub handler {
>>> my $self = shift;
>>>
>>> my $view = Myserver::View->new();
>>> $view->mainpage;
>>>
>>> # Obligatory stuff for the handler
>>> $self->content_type('text/html');
>>> return Apache2::Const::OK;
>>>
>>> }
>>>
>>> 1;
>>>
>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>> /home/Perl/Myserver/View.pm:
>>> ----------------------------------------------------
>>> package Myserver::View;
>>>
>>> #Setup some essentials
>>> use strict; #strict tolerance for code
>>> use Carp; #debugging
>>> use diagnostics; #more debugging
>>> use warnings; #more debugging
>>>
>>> #Loadup some needed functions
>>> use HTML::Template;
>>>
>>> sub new {
>>> my $self = shift;
>>> return $self;
>>> }
>>>
>>> sub mainpage {
>>> my $self = shift;
>>> my $template = HTML::Template->new(
>>> filename => '/home/Perl/tmpl/mainpage.tmpl',
>>> cache => 1,
>>> debug => 1,
>>> stack_debug => 1 );
>>> print "Content-Type: text/html\n\n";
>>> print $template->output;
>>> return $self;
>>> }
>>>
>>> 1;
>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>> /home/Perl/tmpl/mainpage.tmpl:
>>> ----------------------------------------------------
>>> Test!
>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>> /home/Perl/tests/View_mainpage.pl
>>> ----------------------------------------------------
>>> #!/usr/bin/perl -w
>>>
>>> # Test printing of the main page
>>> print "Main Page..";
>>>
>>> #Let's load the view module
>>> use lib "../";
>>> use Myserver::View;
>>> #Now let's load some things that are very handy
>>> use strict; #strict tolerance for code
>>> use Carp; #debugging
>>> use warnings; #more debugging
>>> use diagnostics; #even more debugging
>>>
>>> # Let's create an object
>>> my $view = Myserver::View->new;
>>>
>>> # Now, let's tell View to display the main page
>>> $view->mainpage;
>>>
>>> print ".OK";
>>>
>>> 1;
>>> ----------------------------------------------------
>>>
>>>
>>>
>>>
>>> On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
>>>> try print $template->output;
>>>>
>>>> You forgot the print();
>>>>
>>>> xyon wrote:
>>>>> Hey everyone,
>>>>>
>>>>> Firstly, I apologize I sent the previous email under an incorrect subject line.
>>>>>
>>>>> I am working on my first Object-Oriented project, and have hit a slight
>>>>> snag. I am using HTML::Template to output within the View module, but it
>>>>> never outputs. I don't see any errors in the logs, I just get a blank
>>>>> page. Below is pertinent information including a test script with its
>>>>> output:
>>>>>
>>>>>
>>>>>
>>>>> OS Info:
>>>>> ----------------------------------------------------
>>>>> CentOS release 4.6 (Final)
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> Package info:
>>>>> ----------------------------------------------------
>>>>> perl-5.8.8-11
>>>>> perl-HTML-Template-2.9-1
>>>>> httpd-2.0.59-1.el4s1.10.el4.centos
>>>>> mod_perl-2.0.3-1.el4s1.3
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> /home/perl/Myserver/View.pm
>>>>> ----------------------------------------------------
>>>>> package Myserver::View;
>>>>>
>>>>> #Setup some essentials
>>>>> use strict; #strict tolerance for code
>>>>> use Carp; #debugging
>>>>> use diagnostics; #more debugging
>>>>> use warnings; #more debugging
>>>>>
>>>>> #Loadup some needed functions
>>>>> use HTML::Template;
>>>>>
>>>>> sub new {
>>>>> my $self = shift;
>>>>> return $self;
>>>>> }
>>>>>
>>>>> sub mainpage {
>>>>> my $self = shift;
>>>>> my $template = HTML::Template->new( filename =>
>>>>> '/home/Perl/tmpl/mainpage.tmpl',
>>>>> cache => 1,
>>>>> debug => 1,
>>>>> stack_debug => 1 );
>>>>> print "Content-Type: text/html\n\n";
>>>>> $template->output;
>>>>> return $self;
>>>>> }
>>>>>
>>>>> 1;
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> /home/Perl/tests/View_mainpage.pl
>>>>> ----------------------------------------------------
>>>>> #!/usr/bin/perl -w
>>>>>
>>>>> # Test printing of the main page
>>>>> print "Main Page..";
>>>>>
>>>>> #Let's load the view module
>>>>> use lib "../";
>>>>> use Myserver::View;
>>>>> #Now let's load some things that are very handy
>>>>> use strict; #strict tolerance for code
>>>>> use Carp; #debugging
>>>>> use warnings; #more debugging
>>>>> use diagnostics; #even more debugging
>>>>>
>>>>> # Let's create an object
>>>>> my $view = Myserver::View->new;
>>>>>
>>>>> # Now, let's tell View to display the main page
>>>>> $view->mainpage;
>>>>>
>>>>> print ".OK";
>>>>>
>>>>> 1;
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> /home/Perl/tmpl/mainpage.tmpl:
>>>>> ----------------------------------------------------
>>>>> Test!
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> Output with debugging on (as above):
>>>>> ----------------------------------------------------
>>>>> $ tests/View_mainpage.pl
>>>>> ### HTML::Template Debug ### In _parse:
>>>>> ### HTML::Template _param Stack Dump ###
>>>>>
>>>>> $VAR1 = [
>>>>> \'Test!
>>>>> '
>>>>> ];
>>>>>
>>>>> Main Page..Content-Type: text/html
>>>>>
>>>>> ### HTML::Template Debug ### In output
>>>>> ### HTML::Template output Stack Dump ###
>>>>>
>>>>> $VAR1 = [
>>>>> \'Test!
>>>>> '
>>>>> ];
>>>>>
>>>>> .OK
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> Output without debugging:
>>>>> ----------------------------------------------------
>>>>> $ tests/View_mainpage.pl
>>>>> Main Page..Content-Type: text/html
>>>>>
>>>>> .OK
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>
>

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:46:54 von xyon

Good suggestion, I moved the content_type to the top of the handler
routine in Handler.pm, so it now looks like:

------------------------------------------------------------ -------
sub handler {
my $self =3D shift;
$self->content_type('text/html');
=20
my $view =3D Myserver::View->new();
$view->mainpage;

# Obligatory stuff for the handler
return Apache2::Const::OK;
}
------------------------------------------------------------ -------



I am still getting a blank page, though. Here is the latest lwp-request
output:


------------------------------------------------------------ -------
$ lwp-request -s -U -S -e -m GET "http://localhost/admin/"
GET http://localhost/admin/
User-Agent: lwp-request/2.07

GET http://localhost/admin/ --> 200 OK
Connection: close
Date: Thu, 13 Mar 2008 15:45:08 GMT
Server: Apache
Content-Length: 0
Content-Type: text/html; charset=3DUTF-8
Client-Date: Thu, 13 Mar 2008 15:45:09 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
------------------------------------------------------------ -------



On Thu, 2008-03-13 at 16:38 +0100, André Warnier wrote:
> Hi.
>=20
> First, don't take my suggestions as gospel, I don't know the TT2 and do=20
> not really know how you're supposed to work with it.
> But it seems to me that this is in the wrong order :
>=20
> $view->mainpage;
> $self->content_type('text/html');
>=20
> I think you should trigger the HTTP header before you generate the=20
> content. Now, whether that is the reason of your current problem or=20
> not, I haven't a clue.
>=20
> But I'm trying, and I'm really interested, because I am starting to want=20
> to know more about TT2 (and Catalyst) these days. So your=20
> "from-the-very beginning" approach is also very helpful to me.
> (And I do have a certain experience of Apache2/mod_perl2)
>=20
> And, re-check your lwp-request switches, you might have disabled the=20
> display of the response content (remove the -d).
>=20
> André
>=20
>=20
>=20
> xyon wrote:
> > Thanks for the reply.
> >=20
> > I thought as you did (that there were too many "Content-Type"
> > definitions), so commented out this line in the View.pm module, but tha=
t
> > doesn't seem to have changed anything:
> >=20
> > 'print "Content-Type: text/html\n\n";'
> >=20
> >=20
> >=20
> >=20
> > Here is the lwp command and output:
> > ------------------------------------------------------------ -------
> > $ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
> > GET http://localhost/admin/
> > User-Agent: lwp-request/2.07
> >=20
> > GET http://localhost/admin/ --> 200 OK
> > Connection: close
> > Date: Thu, 13 Mar 2008 15:24:23 GMT
> > Server: Apache
> > Content-Length: 0
> > Content-Type: text/html; charset=3DUTF-8
> > Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
> > Client-Peer: 127.0.0.1:80
> > Client-Response-Num: 1
> > ------------------------------------------------------------ -------
> >=20
> >=20
> > On Thu, 2008-03-13 at 16:11 +0100, André Warnier wrote:
> >> Hi.
> >>
> >> First, a small disgression : along with perl, comes a beautiful test=20
> >> tool for HTTP stuff, called "lwp-request".
> >> Like, at the command-line :
> >> lwp-request (to see the options)
> >> lwp-request -m GET -Sed "http://myserver/myURL"
> >> (that will show you what you get as a response, without a browser=20
> >> getting in the way)
> >>
> >> Then, below, are you not now sending one "Content-type" too many ?
> >> It looks like you are doing it once in handler(), and once in mainpage=
().
> >>
> >> André
> >>
> >> xyon wrote:
> >>> That worked great with the test script ( print $template->output; ), =
but
> >>> unfortunately, I'm having trouble getting the display onto a web page
> >>> (via the Handler). The resulting web page is blank, with no source.
> >>>
> >>>
> >>> Below are my Apache configs for the handler, logs, and the handler an=
d
> >>> view module's latest code. I've also included the test script code, j=
ust
> >>> in case there is some obvious reason it would work and the handler
> >>> won't.
> >>>
> >>>
> >>>
> >>>
> >>> Apache config:
> >>> ----------------------------------------------------
> >>> PerlRequire /etc/httpd/perl/startup.pl
> >>>
> >>> SetHandler modperl=20
> >>> PerlResponseHandler Myserver::Handler
> >>>

> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /etc/httpd/perl/startup.pl:
> >>> ----------------------------------------------------
> >>> use lib qw(/home/Perl/);
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> Apache log:
> >>> ----------------------------------------------------
> >>> ==> /var/log/httpd/error_log <==
> >>> ### HTML::Template Debug ### In _parse:
> >>> ### HTML::Template _param Stack Dump ###
> >>>
> >>> $VAR1 =3D [
> >>> \'Test!
> >>> '
> >>> ];
> >>>
> >>> ### HTML::Template Debug ### In output
> >>> ### HTML::Template output Stack Dump ###
> >>>
> >>> $VAR1 =3D [
> >>> \'Test!
> >>> '
> >>> ];
> >>>
> >>>
> >>> ==> /var/log/httpd/ssl_request_log <==
> >>> [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
> >>> "GET /admin/ HTTP/1.1" -
> >>>
> >>> ==> /var/log/httpd/ssl_access_log <==
> >>> 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 =
-
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/Myserver/Handler.pm
> >>> ----------------------------------------------------
> >>> package Myserver::Handler;
> >>>
> >>> #Setup some essentials
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use diagnostics; #more debugging
> >>> use warnings; #more debugging
> >>>
> >>> #Handler-related stuff
> >>> use Apache2::RequestRec ();
> >>> use Apache2::RequestIO ();
> >>> use Apache2::Const -compile =3D> qw(OK);
> >>>
> >>> sub handler {
> >>> my $self =3D shift;
> >>> =20
> >>> my $view =3D Myserver::View->new();
> >>> $view->mainpage;
> >>>
> >>> # Obligatory stuff for the handler
> >>> $self->content_type('text/html');
> >>> return Apache2::Const::OK;
> >>>
> >>> }
> >>>
> >>> 1;
> >>>
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/Myserver/View.pm:
> >>> ----------------------------------------------------
> >>> package Myserver::View;
> >>>
> >>> #Setup some essentials
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use diagnostics; #more debugging
> >>> use warnings; #more debugging
> >>>
> >>> #Loadup some needed functions
> >>> use HTML::Template;
> >>>
> >>> sub new {
> >>> my $self =3D shift;
> >>> return $self;
> >>> }
> >>>
> >>> sub mainpage {
> >>> my $self =3D shift;
> >>> my $template =3D HTML::Template->new(
> >>> filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
> >>> cache =3D> 1,
> >>> debug =3D> 1,
> >>> stack_debug =3D> 1 );
> >>> print "Content-Type: text/html\n\n";
> >>> print $template->output;
> >>> return $self;
> >>> }
> >>>
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/tmpl/mainpage.tmpl:
> >>> ----------------------------------------------------
> >>> Test!
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/tests/View_mainpage.pl
> >>> ----------------------------------------------------
> >>> #!/usr/bin/perl -w
> >>>
> >>> # Test printing of the main page
> >>> print "Main Page..";
> >>>
> >>> #Let's load the view module
> >>> use lib "../";
> >>> use Myserver::View;
> >>> #Now let's load some things that are very handy
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use warnings; #more debugging
> >>> use diagnostics; #even more debugging
> >>>
> >>> # Let's create an object
> >>> my $view =3D Myserver::View->new;
> >>>
> >>> # Now, let's tell View to display the main page
> >>> $view->mainpage;
> >>>
> >>> print ".OK";
> >>>
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
> >>>> try print $template->output;
> >>>>
> >>>> You forgot the print();
> >>>>
> >>>> xyon wrote:
> >>>>> Hey everyone,
> >>>>>
> >>>>> Firstly, I apologize I sent the previous email under an incorrect s=
ubject line.
> >>>>>
> >>>>> I am working on my first Object-Oriented project, and have hit a sl=
ight
> >>>>> snag. I am using HTML::Template to output within the View module, b=
ut it
> >>>>> never outputs. I don't see any errors in the logs, I just get a bla=
nk
> >>>>> page. Below is pertinent information including a test script with i=
ts
> >>>>> output:
> >>>>>
> >>>>>
> >>>>>
> >>>>> OS Info:
> >>>>> ----------------------------------------------------
> >>>>> CentOS release 4.6 (Final)
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> Package info:
> >>>>> ----------------------------------------------------
> >>>>> perl-5.8.8-11
> >>>>> perl-HTML-Template-2.9-1
> >>>>> httpd-2.0.59-1.el4s1.10.el4.centos
> >>>>> mod_perl-2.0.3-1.el4s1.3
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> /home/perl/Myserver/View.pm
> >>>>> ----------------------------------------------------
> >>>>> package Myserver::View;
> >>>>>
> >>>>> #Setup some essentials
> >>>>> use strict; #strict tolerance for code
> >>>>> use Carp; #debugging
> >>>>> use diagnostics; #more debugging
> >>>>> use warnings; #more debugging
> >>>>>
> >>>>> #Loadup some needed functions
> >>>>> use HTML::Template;
> >>>>>
> >>>>> sub new {
> >>>>> my $self =3D shift;
> >>>>> return $self;
> >>>>> }
> >>>>>
> >>>>> sub mainpage {
> >>>>> my $self =3D shift;
> >>>>> my $template =3D HTML::Template->new( filename =3D>
> >>>>> '/home/Perl/tmpl/mainpage.tmpl',
> >>>>> cache =3D> 1,
> >>>>> debug =3D> 1,=20
> >>>>> stack_debug =3D> 1 );
> >>>>> print "Content-Type: text/html\n\n";
> >>>>> $template->output;
> >>>>> return $self;
> >>>>> }
> >>>>>
> >>>>> 1;
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> /home/Perl/tests/View_mainpage.pl
> >>>>> ----------------------------------------------------
> >>>>> #!/usr/bin/perl -w
> >>>>>
> >>>>> # Test printing of the main page
> >>>>> print "Main Page..";
> >>>>>
> >>>>> #Let's load the view module
> >>>>> use lib "../";
> >>>>> use Myserver::View;
> >>>>> #Now let's load some things that are very handy
> >>>>> use strict; #strict tolerance for code
> >>>>> use Carp; #debugging
> >>>>> use warnings; #more debugging
> >>>>> use diagnostics; #even more debugging
> >>>>>
> >>>>> # Let's create an object
> >>>>> my $view =3D Myserver::View->new;
> >>>>>
> >>>>> # Now, let's tell View to display the main page
> >>>>> $view->mainpage;
> >>>>>
> >>>>> print ".OK";
> >>>>>
> >>>>> 1;
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> /home/Perl/tmpl/mainpage.tmpl:
> >>>>> ----------------------------------------------------
> >>>>> Test!
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> Output with debugging on (as above):
> >>>>> ----------------------------------------------------
> >>>>> $ tests/View_mainpage.pl=20
> >>>>> ### HTML::Template Debug ### In _parse:
> >>>>> ### HTML::Template _param Stack Dump ###
> >>>>>
> >>>>> $VAR1 =3D [
> >>>>> \'Test!
> >>>>> '
> >>>>> ];
> >>>>>
> >>>>> Main Page..Content-Type: text/html
> >>>>>
> >>>>> ### HTML::Template Debug ### In output
> >>>>> ### HTML::Template output Stack Dump ###
> >>>>>
> >>>>> $VAR1 =3D [
> >>>>> \'Test!
> >>>>> '
> >>>>> ];
> >>>>>
> >>>>> .OK
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> Output without debugging:
> >>>>> ----------------------------------------------------
> >>>>> $ tests/View_mainpage.pl=20
> >>>>> Main Page..Content-Type: text/html
> >>>>>
> >>>>> .OK
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> =20
> >=20
> >=20

Re: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 16:58:25 von aw

Hi.

I know it's not clean, and it is probably not what you need to do in the
long run, and I don't know a bit about HTML::Template.
But why don't you try the following, just to check :

>>>>> package Myserver::Handler;
>>>>>
>>>>> #Setup some essentials
>>>>> use strict; #strict tolerance for code
>>>>> use Carp; #debugging
>>>>> use diagnostics; #more debugging
>>>>> use warnings; #more debugging

>>>>> #Handler-related stuff
>>>>> use Apache2::RequestRec ();
>>>>> use Apache2::RequestIO ();
>>>>> use Apache2::Const -compile => qw(OK);

>>>>> use HTML::Template;

>>>>>
>>>>> sub handler {
>>>>> my $self = shift;
>>>>> $self->content_type('text/html');
>>>>>
>>>>> my $template = HTML::Template->new(
>>>>> filename => '/home/Perl/tmpl/mainpage.tmpl',
>>>>> cache => 1,
>>>>> debug => 1,
>>>>> stack_debug => 1 );

>>>>> print $template->output;
>>>>>
>>>>> # Obligatory stuff for the handler
>>>>> return Apache2::Const::OK;
>>>>>
>>>>> }

André

xyon wrote:
> Good suggestion, I moved the content_type to the top of the handler
> routine in Handler.pm, so it now looks like:
>
> ------------------------------------------------------------ -------
> sub handler {
> my $self = shift;
> $self->content_type('text/html');
>
> my $view = Myserver::View->new();
> $view->mainpage;
>
> # Obligatory stuff for the handler
> return Apache2::Const::OK;
> }
> ------------------------------------------------------------ -------
>
>
>
> I am still getting a blank page, though. Here is the latest lwp-request
> output:
>
>
> ------------------------------------------------------------ -------
> $ lwp-request -s -U -S -e -m GET "http://localhost/admin/"
> GET http://localhost/admin/
> User-Agent: lwp-request/2.07
>
> GET http://localhost/admin/ --> 200 OK
> Connection: close
> Date: Thu, 13 Mar 2008 15:45:08 GMT
> Server: Apache
> Content-Length: 0
> Content-Type: text/html; charset=UTF-8
> Client-Date: Thu, 13 Mar 2008 15:45:09 GMT
> Client-Peer: 127.0.0.1:80
> Client-Response-Num: 1
> ------------------------------------------------------------ -------
>
>
>
> On Thu, 2008-03-13 at 16:38 +0100, André Warnier wrote:
>> Hi.
>>
>> First, don't take my suggestions as gospel, I don't know the TT2 and do
>> not really know how you're supposed to work with it.
>> But it seems to me that this is in the wrong order :
>>
>> $view->mainpage;
>> $self->content_type('text/html');
>>
>> I think you should trigger the HTTP header before you generate the
>> content. Now, whether that is the reason of your current problem or
>> not, I haven't a clue.
>>
>> But I'm trying, and I'm really interested, because I am starting to want
>> to know more about TT2 (and Catalyst) these days. So your
>> "from-the-very beginning" approach is also very helpful to me.
>> (And I do have a certain experience of Apache2/mod_perl2)
>>
>> And, re-check your lwp-request switches, you might have disabled the
>> display of the response content (remove the -d).
>>
>> André
>>
>>
>>
>> xyon wrote:
>>> Thanks for the reply.
>>>
>>> I thought as you did (that there were too many "Content-Type"
>>> definitions), so commented out this line in the View.pm module, but that
>>> doesn't seem to have changed anything:
>>>
>>> 'print "Content-Type: text/html\n\n";'
>>>
>>>
>>>
>>>
>>> Here is the lwp command and output:
>>> ------------------------------------------------------------ -------
>>> $ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
>>> GET http://localhost/admin/
>>> User-Agent: lwp-request/2.07
>>>
>>> GET http://localhost/admin/ --> 200 OK
>>> Connection: close
>>> Date: Thu, 13 Mar 2008 15:24:23 GMT
>>> Server: Apache
>>> Content-Length: 0
>>> Content-Type: text/html; charset=UTF-8
>>> Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
>>> Client-Peer: 127.0.0.1:80
>>> Client-Response-Num: 1
>>> ------------------------------------------------------------ -------
>>>
>>>
>>> On Thu, 2008-03-13 at 16:11 +0100, André Warnier wrote:
>>>> Hi.
>>>>
>>>> First, a small disgression : along with perl, comes a beautiful test
>>>> tool for HTTP stuff, called "lwp-request".
>>>> Like, at the command-line :
>>>> lwp-request (to see the options)
>>>> lwp-request -m GET -Sed "http://myserver/myURL"
>>>> (that will show you what you get as a response, without a browser
>>>> getting in the way)
>>>>
>>>> Then, below, are you not now sending one "Content-type" too many ?
>>>> It looks like you are doing it once in handler(), and once in mainpage().
>>>>
>>>> André
>>>>
>>>> xyon wrote:
>>>>> That worked great with the test script ( print $template->output; ), but
>>>>> unfortunately, I'm having trouble getting the display onto a web page
>>>>> (via the Handler). The resulting web page is blank, with no source.
>>>>>
>>>>>
>>>>> Below are my Apache configs for the handler, logs, and the handler and
>>>>> view module's latest code. I've also included the test script code, just
>>>>> in case there is some obvious reason it would work and the handler
>>>>> won't.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Apache config:
>>>>> ----------------------------------------------------
>>>>> PerlRequire /etc/httpd/perl/startup.pl
>>>>>
>>>>> SetHandler modperl
>>>>> PerlResponseHandler Myserver::Handler
>>>>>

>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> /etc/httpd/perl/startup.pl:
>>>>> ----------------------------------------------------
>>>>> use lib qw(/home/Perl/);
>>>>> 1;
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Apache log:
>>>>> ----------------------------------------------------
>>>>> ==> /var/log/httpd/error_log <==
>>>>> ### HTML::Template Debug ### In _parse:
>>>>> ### HTML::Template _param Stack Dump ###
>>>>>
>>>>> $VAR1 = [
>>>>> \'Test!
>>>>> '
>>>>> ];
>>>>>
>>>>> ### HTML::Template Debug ### In output
>>>>> ### HTML::Template output Stack Dump ###
>>>>>
>>>>> $VAR1 = [
>>>>> \'Test!
>>>>> '
>>>>> ];
>>>>>
>>>>>
>>>>> ==> /var/log/httpd/ssl_request_log <==
>>>>> [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
>>>>> "GET /admin/ HTTP/1.1" -
>>>>>
>>>>> ==> /var/log/httpd/ssl_access_log <==
>>>>> 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 -
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> /home/Perl/Myserver/Handler.pm
>>>>> ----------------------------------------------------
>>>>> package Myserver::Handler;
>>>>>
>>>>> #Setup some essentials
>>>>> use strict; #strict tolerance for code
>>>>> use Carp; #debugging
>>>>> use diagnostics; #more debugging
>>>>> use warnings; #more debugging
>>>>>
>>>>> #Handler-related stuff
>>>>> use Apache2::RequestRec ();
>>>>> use Apache2::RequestIO ();
>>>>> use Apache2::Const -compile => qw(OK);
>>>>>
>>>>> sub handler {
>>>>> my $self = shift;
>>>>>
>>>>> my $view = Myserver::View->new();
>>>>> $view->mainpage;
>>>>>
>>>>> # Obligatory stuff for the handler
>>>>> $self->content_type('text/html');
>>>>> return Apache2::Const::OK;
>>>>>
>>>>> }
>>>>>
>>>>> 1;
>>>>>
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> /home/Perl/Myserver/View.pm:
>>>>> ----------------------------------------------------
>>>>> package Myserver::View;
>>>>>
>>>>> #Setup some essentials
>>>>> use strict; #strict tolerance for code
>>>>> use Carp; #debugging
>>>>> use diagnostics; #more debugging
>>>>> use warnings; #more debugging
>>>>>
>>>>> #Loadup some needed functions
>>>>> use HTML::Template;
>>>>>
>>>>> sub new {
>>>>> my $self = shift;
>>>>> return $self;
>>>>> }
>>>>>
>>>>> sub mainpage {
>>>>> my $self = shift;
>>>>> my $template = HTML::Template->new(
>>>>> filename => '/home/Perl/tmpl/mainpage.tmpl',
>>>>> cache => 1,
>>>>> debug => 1,
>>>>> stack_debug => 1 );
>>>>> print "Content-Type: text/html\n\n";
>>>>> print $template->output;
>>>>> return $self;
>>>>> }
>>>>>
>>>>> 1;
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> /home/Perl/tmpl/mainpage.tmpl:
>>>>> ----------------------------------------------------
>>>>> Test!
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> /home/Perl/tests/View_mainpage.pl
>>>>> ----------------------------------------------------
>>>>> #!/usr/bin/perl -w
>>>>>
>>>>> # Test printing of the main page
>>>>> print "Main Page..";
>>>>>
>>>>> #Let's load the view module
>>>>> use lib "../";
>>>>> use Myserver::View;
>>>>> #Now let's load some things that are very handy
>>>>> use strict; #strict tolerance for code
>>>>> use Carp; #debugging
>>>>> use warnings; #more debugging
>>>>> use diagnostics; #even more debugging
>>>>>
>>>>> # Let's create an object
>>>>> my $view = Myserver::View->new;
>>>>>
>>>>> # Now, let's tell View to display the main page
>>>>> $view->mainpage;
>>>>>
>>>>> print ".OK";
>>>>>
>>>>> 1;
>>>>> ----------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
>>>>>> try print $template->output;
>>>>>>
>>>>>> You forgot the print();
>>>>>>
>>>>>> xyon wrote:
>>>>>>> Hey everyone,
>>>>>>>
>>>>>>> Firstly, I apologize I sent the previous email under an incorrect subject line.
>>>>>>>
>>>>>>> I am working on my first Object-Oriented project, and have hit a slight
>>>>>>> snag. I am using HTML::Template to output within the View module, but it
>>>>>>> never outputs. I don't see any errors in the logs, I just get a blank
>>>>>>> page. Below is pertinent information including a test script with its
>>>>>>> output:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> OS Info:
>>>>>>> ----------------------------------------------------
>>>>>>> CentOS release 4.6 (Final)
>>>>>>> ----------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Package info:
>>>>>>> ----------------------------------------------------
>>>>>>> perl-5.8.8-11
>>>>>>> perl-HTML-Template-2.9-1
>>>>>>> httpd-2.0.59-1.el4s1.10.el4.centos
>>>>>>> mod_perl-2.0.3-1.el4s1.3
>>>>>>> ----------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> /home/perl/Myserver/View.pm
>>>>>>> ----------------------------------------------------
>>>>>>> package Myserver::View;
>>>>>>>
>>>>>>> #Setup some essentials
>>>>>>> use strict; #strict tolerance for code
>>>>>>> use Carp; #debugging
>>>>>>> use diagnostics; #more debugging
>>>>>>> use warnings; #more debugging
>>>>>>>
>>>>>>> #Loadup some needed functions
>>>>>>> use HTML::Template;
>>>>>>>
>>>>>>> sub new {
>>>>>>> my $self = shift;
>>>>>>> return $self;
>>>>>>> }
>>>>>>>
>>>>>>> sub mainpage {
>>>>>>> my $self = shift;
>>>>>>> my $template = HTML::Template->new( filename =>
>>>>>>> '/home/Perl/tmpl/mainpage.tmpl',
>>>>>>> cache => 1,
>>>>>>> debug => 1,
>>>>>>> stack_debug => 1 );
>>>>>>> print "Content-Type: text/html\n\n";
>>>>>>> $template->output;
>>>>>>> return $self;
>>>>>>> }
>>>>>>>
>>>>>>> 1;
>>>>>>> ----------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> /home/Perl/tests/View_mainpage.pl
>>>>>>> ----------------------------------------------------
>>>>>>> #!/usr/bin/perl -w
>>>>>>>
>>>>>>> # Test printing of the main page
>>>>>>> print "Main Page..";
>>>>>>>
>>>>>>> #Let's load the view module
>>>>>>> use lib "../";
>>>>>>> use Myserver::View;
>>>>>>> #Now let's load some things that are very handy
>>>>>>> use strict; #strict tolerance for code
>>>>>>> use Carp; #debugging
>>>>>>> use warnings; #more debugging
>>>>>>> use diagnostics; #even more debugging
>>>>>>>
>>>>>>> # Let's create an object
>>>>>>> my $view = Myserver::View->new;
>>>>>>>
>>>>>>> # Now, let's tell View to display the main page
>>>>>>> $view->mainpage;
>>>>>>>
>>>>>>> print ".OK";
>>>>>>>
>>>>>>> 1;
>>>>>>> ----------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> /home/Perl/tmpl/mainpage.tmpl:
>>>>>>> ----------------------------------------------------
>>>>>>> Test!
>>>>>>> ----------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Output with debugging on (as above):
>>>>>>> ----------------------------------------------------
>>>>>>> $ tests/View_mainpage.pl
>>>>>>> ### HTML::Template Debug ### In _parse:
>>>>>>> ### HTML::Template _param Stack Dump ###
>>>>>>>
>>>>>>> $VAR1 = [
>>>>>>> \'Test!
>>>>>>> '
>>>>>>> ];
>>>>>>>
>>>>>>> Main Page..Content-Type: text/html
>>>>>>>
>>>>>>> ### HTML::Template Debug ### In output
>>>>>>> ### HTML::Template output Stack Dump ###
>>>>>>>
>>>>>>> $VAR1 = [
>>>>>>> \'Test!
>>>>>>> '
>>>>>>> ];
>>>>>>>
>>>>>>> .OK
>>>>>>> ----------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Output without debugging:
>>>>>>> ----------------------------------------------------
>>>>>>> $ tests/View_mainpage.pl
>>>>>>> Main Page..Content-Type: text/html
>>>>>>>
>>>>>>> .OK
>>>>>>> ----------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>
>
>

RE: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 17:01:03 von Adam Prime x443

SetHandler modperl doesn't bind 'print' to '$r->print'. Try SetHandler per=
l-script, or change your code to pass in the request object and use $r->pri=
nt instead of print.

Adam

-----Original Message-----
From: xyon [mailto:xyon@indigorobot.com]
Sent: Thursday, March 13, 2008 11:47 AM
To: modperl
Subject: Re: Custom Object-Oriented Module using HTML::Template

Good suggestion, I moved the content_type to the top of the handler
routine in Handler.pm, so it now looks like:

------------------------------------------------------------ -------
sub handler {
my $self =3D shift;
$self->content_type('text/html');

my $view =3D Myserver::View->new();
$view->mainpage;

# Obligatory stuff for the handler
return Apache2::Const::OK;
}
------------------------------------------------------------ -------



I am still getting a blank page, though. Here is the latest lwp-request
output:


------------------------------------------------------------ -------
$ lwp-request -s -U -S -e -m GET "http://localhost/admin/"
GET http://localhost/admin/
User-Agent: lwp-request/2.07

GET http://localhost/admin/ --> 200 OK
Connection: close
Date: Thu, 13 Mar 2008 15:45:08 GMT
Server: Apache
Content-Length: 0
Content-Type: text/html; charset=3DUTF-8
Client-Date: Thu, 13 Mar 2008 15:45:09 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
------------------------------------------------------------ -------



On Thu, 2008-03-13 at 16:38 +0100, Andr=E9 Warnier wrote:
> Hi.
>
> First, don't take my suggestions as gospel, I don't know the TT2 and do
> not really know how you're supposed to work with it.
> But it seems to me that this is in the wrong order :
>
> $view->mainpage;
> $self->content_type('text/html');
>
> I think you should trigger the HTTP header before you generate the
> content. Now, whether that is the reason of your current problem or
> not, I haven't a clue.
>
> But I'm trying, and I'm really interested, because I am starting to want
> to know more about TT2 (and Catalyst) these days. So your
> "from-the-very beginning" approach is also very helpful to me.
> (And I do have a certain experience of Apache2/mod_perl2)
>
> And, re-check your lwp-request switches, you might have disabled the
> display of the response content (remove the -d).
>
> Andr=E9
>
>
>
> xyon wrote:
> > Thanks for the reply.
> >
> > I thought as you did (that there were too many "Content-Type"
> > definitions), so commented out this line in the View.pm module, but tha=
t
> > doesn't seem to have changed anything:
> >
> > 'print "Content-Type: text/html\n\n";'
> >
> >
> >
> >
> > Here is the lwp command and output:
> > ------------------------------------------------------------ -------
> > $ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
> > GET http://localhost/admin/
> > User-Agent: lwp-request/2.07
> >
> > GET http://localhost/admin/ --> 200 OK
> > Connection: close
> > Date: Thu, 13 Mar 2008 15:24:23 GMT
> > Server: Apache
> > Content-Length: 0
> > Content-Type: text/html; charset=3DUTF-8
> > Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
> > Client-Peer: 127.0.0.1:80
> > Client-Response-Num: 1
> > ------------------------------------------------------------ -------
> >
> >
> > On Thu, 2008-03-13 at 16:11 +0100, Andr=E9 Warnier wrote:
> >> Hi.
> >>
> >> First, a small disgression : along with perl, comes a beautiful test
> >> tool for HTTP stuff, called "lwp-request".
> >> Like, at the command-line :
> >> lwp-request (to see the options)
> >> lwp-request -m GET -Sed "http://myserver/myURL"
> >> (that will show you what you get as a response, without a browser
> >> getting in the way)
> >>
> >> Then, below, are you not now sending one "Content-type" too many ?
> >> It looks like you are doing it once in handler(), and once in mainpage=
().
> >>
> >> Andr=E9
> >>
> >> xyon wrote:
> >>> That worked great with the test script ( print $template->output; ), =
but
> >>> unfortunately, I'm having trouble getting the display onto a web page
> >>> (via the Handler). The resulting web page is blank, with no source.
> >>>
> >>>
> >>> Below are my Apache configs for the handler, logs, and the handler an=
d
> >>> view module's latest code. I've also included the test script code, j=
ust
> >>> in case there is some obvious reason it would work and the handler
> >>> won't.
> >>>
> >>>
> >>>
> >>>
> >>> Apache config:
> >>> ----------------------------------------------------
> >>> PerlRequire /etc/httpd/perl/startup.pl
> >>>
> >>> SetHandler modperl
> >>> PerlResponseHandler Myserver::Handler
> >>>

> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /etc/httpd/perl/startup.pl:
> >>> ----------------------------------------------------
> >>> use lib qw(/home/Perl/);
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> Apache log:
> >>> ----------------------------------------------------
> >>> ==> /var/log/httpd/error_log <==
> >>> ### HTML::Template Debug ### In _parse:
> >>> ### HTML::Template _param Stack Dump ###
> >>>
> >>> $VAR1 =3D [
> >>> \'Test!
> >>> '
> >>> ];
> >>>
> >>> ### HTML::Template Debug ### In output
> >>> ### HTML::Template output Stack Dump ###
> >>>
> >>> $VAR1 =3D [
> >>> \'Test!
> >>> '
> >>> ];
> >>>
> >>>
> >>> ==> /var/log/httpd/ssl_request_log <==
> >>> [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
> >>> "GET /admin/ HTTP/1.1" -
> >>>
> >>> ==> /var/log/httpd/ssl_access_log <==
> >>> 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 200 =
-
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/Myserver/Handler.pm
> >>> ----------------------------------------------------
> >>> package Myserver::Handler;
> >>>
> >>> #Setup some essentials
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use diagnostics; #more debugging
> >>> use warnings; #more debugging
> >>>
> >>> #Handler-related stuff
> >>> use Apache2::RequestRec ();
> >>> use Apache2::RequestIO ();
> >>> use Apache2::Const -compile =3D> qw(OK);
> >>>
> >>> sub handler {
> >>> my $self =3D shift;
> >>>
> >>> my $view =3D Myserver::View->new();
> >>> $view->mainpage;
> >>>
> >>> # Obligatory stuff for the handler
> >>> $self->content_type('text/html');
> >>> return Apache2::Const::OK;
> >>>
> >>> }
> >>>
> >>> 1;
> >>>
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/Myserver/View.pm:
> >>> ----------------------------------------------------
> >>> package Myserver::View;
> >>>
> >>> #Setup some essentials
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use diagnostics; #more debugging
> >>> use warnings; #more debugging
> >>>
> >>> #Loadup some needed functions
> >>> use HTML::Template;
> >>>
> >>> sub new {
> >>> my $self =3D shift;
> >>> return $self;
> >>> }
> >>>
> >>> sub mainpage {
> >>> my $self =3D shift;
> >>> my $template =3D HTML::Template->new(
> >>> filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
> >>> cache =3D> 1,
> >>> debug =3D> 1,
> >>> stack_debug =3D> 1 );
> >>> print "Content-Type: text/html\n\n";
> >>> print $template->output;
> >>> return $self;
> >>> }
> >>>
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/tmpl/mainpage.tmpl:
> >>> ----------------------------------------------------
> >>> Test!
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> /home/Perl/tests/View_mainpage.pl
> >>> ----------------------------------------------------
> >>> #!/usr/bin/perl -w
> >>>
> >>> # Test printing of the main page
> >>> print "Main Page..";
> >>>
> >>> #Let's load the view module
> >>> use lib "../";
> >>> use Myserver::View;
> >>> #Now let's load some things that are very handy
> >>> use strict; #strict tolerance for code
> >>> use Carp; #debugging
> >>> use warnings; #more debugging
> >>> use diagnostics; #even more debugging
> >>>
> >>> # Let's create an object
> >>> my $view =3D Myserver::View->new;
> >>>
> >>> # Now, let's tell View to display the main page
> >>> $view->mainpage;
> >>>
> >>> print ".OK";
> >>>
> >>> 1;
> >>> ----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>> On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
> >>>> try print $template->output;
> >>>>
> >>>> You forgot the print();
> >>>>
> >>>> xyon wrote:
> >>>>> Hey everyone,
> >>>>>
> >>>>> Firstly, I apologize I sent the previous email under an incorrect s=
ubject line.
> >>>>>
> >>>>> I am working on my first Object-Oriented project, and have hit a sl=
ight
> >>>>> snag. I am using HTML::Template to output within the View module, b=
ut it
> >>>>> never outputs. I don't see any errors in the logs, I just get a bla=
nk
> >>>>> page. Below is pertinent information including a test script with i=
ts
> >>>>> output:
> >>>>>
> >>>>>
> >>>>>
> >>>>> OS Info:
> >>>>> ----------------------------------------------------
> >>>>> CentOS release 4.6 (Final)
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> Package info:
> >>>>> ----------------------------------------------------
> >>>>> perl-5.8.8-11
> >>>>> perl-HTML-Template-2.9-1
> >>>>> httpd-2.0.59-1.el4s1.10.el4.centos
> >>>>> mod_perl-2.0.3-1.el4s1.3
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> /home/perl/Myserver/View.pm
> >>>>> ----------------------------------------------------
> >>>>> package Myserver::View;
> >>>>>
> >>>>> #Setup some essentials
> >>>>> use strict; #strict tolerance for code
> >>>>> use Carp; #debugging
> >>>>> use diagnostics; #more debugging
> >>>>> use warnings; #more debugging
> >>>>>
> >>>>> #Loadup some needed functions
> >>>>> use HTML::Template;
> >>>>>
> >>>>> sub new {
> >>>>> my $self =3D shift;
> >>>>> return $self;
> >>>>> }
> >>>>>
> >>>>> sub mainpage {
> >>>>> my $self =3D shift;
> >>>>> my $template =3D HTML::Template->new( filename =3D>
> >>>>> '/home/Perl/tmpl/mainpage.tmpl',
> >>>>> cache =3D> 1,
> >>>>> debug =3D> 1,
> >>>>> stack_debug =3D> 1 );
> >>>>> print "Content-Type: text/html\n\n";
> >>>>> $template->output;
> >>>>> return $self;
> >>>>> }
> >>>>>
> >>>>> 1;
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> /home/Perl/tests/View_mainpage.pl
> >>>>> ----------------------------------------------------
> >>>>> #!/usr/bin/perl -w
> >>>>>
> >>>>> # Test printing of the main page
> >>>>> print "Main Page..";
> >>>>>
> >>>>> #Let's load the view module
> >>>>> use lib "../";
> >>>>> use Myserver::View;
> >>>>> #Now let's load some things that are very handy
> >>>>> use strict; #strict tolerance for code
> >>>>> use Carp; #debugging
> >>>>> use warnings; #more debugging
> >>>>> use diagnostics; #even more debugging
> >>>>>
> >>>>> # Let's create an object
> >>>>> my $view =3D Myserver::View->new;
> >>>>>
> >>>>> # Now, let's tell View to display the main page
> >>>>> $view->mainpage;
> >>>>>
> >>>>> print ".OK";
> >>>>>
> >>>>> 1;
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> /home/Perl/tmpl/mainpage.tmpl:
> >>>>> ----------------------------------------------------
> >>>>> Test!
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> Output with debugging on (as above):
> >>>>> ----------------------------------------------------
> >>>>> $ tests/View_mainpage.pl
> >>>>> ### HTML::Template Debug ### In _parse:
> >>>>> ### HTML::Template _param Stack Dump ###
> >>>>>
> >>>>> $VAR1 =3D [
> >>>>> \'Test!
> >>>>> '
> >>>>> ];
> >>>>>
> >>>>> Main Page..Content-Type: text/html
> >>>>>
> >>>>> ### HTML::Template Debug ### In output
> >>>>> ### HTML::Template output Stack Dump ###
> >>>>>
> >>>>> $VAR1 =3D [
> >>>>> \'Test!
> >>>>> '
> >>>>> ];
> >>>>>
> >>>>> .OK
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>> Output without debugging:
> >>>>> ----------------------------------------------------
> >>>>> $ tests/View_mainpage.pl
> >>>>> Main Page..Content-Type: text/html
> >>>>>
> >>>>> .OK
> >>>>> ----------------------------------------------------
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >
> >

RE: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 17:32:33 von xyon

Thank you all for your advice. With that and some help from a mentor, it
is now working, with the below code:


Apache config:
------------------------------------------------------------ -------
PerlSwitches -I/home/Perl/
PerlModule Myserver::Handler

SetHandler modperl=20
PerlResponseHandler Myserver::Handler

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




Handler.pm:
------------------------------------------------------------ -------
sub handler {
my $request =3D shift;

my $view =3D Myserver::View->new();
if (my $output =3D $view->mainpage()) {
$request->content_type('text/html');
$request->print($output);
return Apache2::Const::OK;
} else {
return Apache2::Const::Declined;
};
=20
1;

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




View.pm
------------------------------------------------------------ -------
sub new {
my $class =3D shift;
my $self =3D {};
return bless $self, $class;
}

sub mainpage {
my $self =3D shift;
my $template =3D HTML::Template->new(=20
filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
cache =3D> 1,
debug =3D> 1,=20
stack_debug =3D> 1 );
return $template->output;
}

1;
------------------------------------------------------------ -------




On Thu, 2008-03-13 at 12:01 -0400, Adam Prime x443 wrote:
> SetHandler modperl doesn't bind 'print' to '$r->print'. Try SetHandler p=
erl-script, or change your code to pass in the request object and use $r->p=
rint instead of print.
>=20
> Adam
>=20
> -----Original Message-----
> From: xyon [mailto:xyon@indigorobot.com]
> Sent: Thursday, March 13, 2008 11:47 AM
> To: modperl
> Subject: Re: Custom Object-Oriented Module using HTML::Template
>=20
> Good suggestion, I moved the content_type to the top of the handler
> routine in Handler.pm, so it now looks like:
>=20
> ------------------------------------------------------------ -------
> sub handler {
> my $self =3D shift;
> $self->content_type('text/html');
>=20
> my $view =3D Myserver::View->new();
> $view->mainpage;
>=20
> # Obligatory stuff for the handler
> return Apache2::Const::OK;
> }
> ------------------------------------------------------------ -------
>=20
>=20
>=20
> I am still getting a blank page, though. Here is the latest lwp-request
> output:
>=20
>=20
> ------------------------------------------------------------ -------
> $ lwp-request -s -U -S -e -m GET "http://localhost/admin/"
> GET http://localhost/admin/
> User-Agent: lwp-request/2.07
>=20
> GET http://localhost/admin/ --> 200 OK
> Connection: close
> Date: Thu, 13 Mar 2008 15:45:08 GMT
> Server: Apache
> Content-Length: 0
> Content-Type: text/html; charset=3DUTF-8
> Client-Date: Thu, 13 Mar 2008 15:45:09 GMT
> Client-Peer: 127.0.0.1:80
> Client-Response-Num: 1
> ------------------------------------------------------------ -------
>=20
>=20
>=20
> On Thu, 2008-03-13 at 16:38 +0100, André Warnier wrote:
> > Hi.
> >
> > First, don't take my suggestions as gospel, I don't know the TT2 and do
> > not really know how you're supposed to work with it.
> > But it seems to me that this is in the wrong order :
> >
> > $view->mainpage;
> > $self->content_type('text/html');
> >
> > I think you should trigger the HTTP header before you generate the
> > content. Now, whether that is the reason of your current problem or
> > not, I haven't a clue.
> >
> > But I'm trying, and I'm really interested, because I am starting to wan=
t
> > to know more about TT2 (and Catalyst) these days. So your
> > "from-the-very beginning" approach is also very helpful to me.
> > (And I do have a certain experience of Apache2/mod_perl2)
> >
> > And, re-check your lwp-request switches, you might have disabled the
> > display of the response content (remove the -d).
> >
> > André
> >
> >
> >
> > xyon wrote:
> > > Thanks for the reply.
> > >
> > > I thought as you did (that there were too many "Content-Type"
> > > definitions), so commented out this line in the View.pm module, but t=
hat
> > > doesn't seem to have changed anything:
> > >
> > > 'print "Content-Type: text/html\n\n";'
> > >
> > >
> > >
> > >
> > > Here is the lwp command and output:
> > > ------------------------------------------------------------ -------
> > > $ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
> > > GET http://localhost/admin/
> > > User-Agent: lwp-request/2.07
> > >
> > > GET http://localhost/admin/ --> 200 OK
> > > Connection: close
> > > Date: Thu, 13 Mar 2008 15:24:23 GMT
> > > Server: Apache
> > > Content-Length: 0
> > > Content-Type: text/html; charset=3DUTF-8
> > > Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
> > > Client-Peer: 127.0.0.1:80
> > > Client-Response-Num: 1
> > > ------------------------------------------------------------ -------
> > >
> > >
> > > On Thu, 2008-03-13 at 16:11 +0100, André Warnier wrote:
> > >> Hi.
> > >>
> > >> First, a small disgression : along with perl, comes a beautiful test
> > >> tool for HTTP stuff, called "lwp-request".
> > >> Like, at the command-line :
> > >> lwp-request (to see the options)
> > >> lwp-request -m GET -Sed "http://myserver/myURL"
> > >> (that will show you what you get as a response, without a browser
> > >> getting in the way)
> > >>
> > >> Then, below, are you not now sending one "Content-type" too many ?
> > >> It looks like you are doing it once in handler(), and once in mainpa=
ge().
> > >>
> > >> André
> > >>
> > >> xyon wrote:
> > >>> That worked great with the test script ( print $template->output; )=
, but
> > >>> unfortunately, I'm having trouble getting the display onto a web pa=
ge
> > >>> (via the Handler). The resulting web page is blank, with no source.
> > >>>
> > >>>
> > >>> Below are my Apache configs for the handler, logs, and the handler =
and
> > >>> view module's latest code. I've also included the test script code,=
just
> > >>> in case there is some obvious reason it would work and the handler
> > >>> won't.
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> Apache config:
> > >>> ----------------------------------------------------
> > >>> PerlRequire /etc/httpd/perl/startup.pl
> > >>>
> > >>> SetHandler modperl
> > >>> PerlResponseHandler Myserver::Handler
> > >>>

> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> /etc/httpd/perl/startup.pl:
> > >>> ----------------------------------------------------
> > >>> use lib qw(/home/Perl/);
> > >>> 1;
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> Apache log:
> > >>> ----------------------------------------------------
> > >>> ==> /var/log/httpd/error_log <==
> > >>> ### HTML::Template Debug ### In _parse:
> > >>> ### HTML::Template _param Stack Dump ###
> > >>>
> > >>> $VAR1 =3D [
> > >>> \'Test!
> > >>> '
> > >>> ];
> > >>>
> > >>> ### HTML::Template Debug ### In output
> > >>> ### HTML::Template output Stack Dump ###
> > >>>
> > >>> $VAR1 =3D [
> > >>> \'Test!
> > >>> '
> > >>> ];
> > >>>
> > >>>
> > >>> ==> /var/log/httpd/ssl_request_log <==
> > >>> [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
> > >>> "GET /admin/ HTTP/1.1" -
> > >>>
> > >>> ==> /var/log/httpd/ssl_access_log <==
> > >>> 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" 20=
0 -
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> /home/Perl/Myserver/Handler.pm
> > >>> ----------------------------------------------------
> > >>> package Myserver::Handler;
> > >>>
> > >>> #Setup some essentials
> > >>> use strict; #strict tolerance for code
> > >>> use Carp; #debugging
> > >>> use diagnostics; #more debugging
> > >>> use warnings; #more debugging
> > >>>
> > >>> #Handler-related stuff
> > >>> use Apache2::RequestRec ();
> > >>> use Apache2::RequestIO ();
> > >>> use Apache2::Const -compile =3D> qw(OK);
> > >>>
> > >>> sub handler {
> > >>> my $self =3D shift;
> > >>>
> > >>> my $view =3D Myserver::View->new();
> > >>> $view->mainpage;
> > >>>
> > >>> # Obligatory stuff for the handler
> > >>> $self->content_type('text/html');
> > >>> return Apache2::Const::OK;
> > >>>
> > >>> }
> > >>>
> > >>> 1;
> > >>>
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> /home/Perl/Myserver/View.pm:
> > >>> ----------------------------------------------------
> > >>> package Myserver::View;
> > >>>
> > >>> #Setup some essentials
> > >>> use strict; #strict tolerance for code
> > >>> use Carp; #debugging
> > >>> use diagnostics; #more debugging
> > >>> use warnings; #more debugging
> > >>>
> > >>> #Loadup some needed functions
> > >>> use HTML::Template;
> > >>>
> > >>> sub new {
> > >>> my $self =3D shift;
> > >>> return $self;
> > >>> }
> > >>>
> > >>> sub mainpage {
> > >>> my $self =3D shift;
> > >>> my $template =3D HTML::Template->new(
> > >>> filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
> > >>> cache =3D> 1,
> > >>> debug =3D> 1,
> > >>> stack_debug =3D> 1 );
> > >>> print "Content-Type: text/html\n\n";
> > >>> print $template->output;
> > >>> return $self;
> > >>> }
> > >>>
> > >>> 1;
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> /home/Perl/tmpl/mainpage.tmpl:
> > >>> ----------------------------------------------------
> > >>> Test!
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> /home/Perl/tests/View_mainpage.pl
> > >>> ----------------------------------------------------
> > >>> #!/usr/bin/perl -w
> > >>>
> > >>> # Test printing of the main page
> > >>> print "Main Page..";
> > >>>
> > >>> #Let's load the view module
> > >>> use lib "../";
> > >>> use Myserver::View;
> > >>> #Now let's load some things that are very handy
> > >>> use strict; #strict tolerance for code
> > >>> use Carp; #debugging
> > >>> use warnings; #more debugging
> > >>> use diagnostics; #even more debugging
> > >>>
> > >>> # Let's create an object
> > >>> my $view =3D Myserver::View->new;
> > >>>
> > >>> # Now, let's tell View to display the main page
> > >>> $view->mainpage;
> > >>>
> > >>> print ".OK";
> > >>>
> > >>> 1;
> > >>> ----------------------------------------------------
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
> > >>>> try print $template->output;
> > >>>>
> > >>>> You forgot the print();
> > >>>>
> > >>>> xyon wrote:
> > >>>>> Hey everyone,
> > >>>>>
> > >>>>> Firstly, I apologize I sent the previous email under an incorrect=
subject line.
> > >>>>>
> > >>>>> I am working on my first Object-Oriented project, and have hit a =
slight
> > >>>>> snag. I am using HTML::Template to output within the View module,=
but it
> > >>>>> never outputs. I don't see any errors in the logs, I just get a b=
lank
> > >>>>> page. Below is pertinent information including a test script with=
its
> > >>>>> output:
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> OS Info:
> > >>>>> ----------------------------------------------------
> > >>>>> CentOS release 4.6 (Final)
> > >>>>> ----------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> Package info:
> > >>>>> ----------------------------------------------------
> > >>>>> perl-5.8.8-11
> > >>>>> perl-HTML-Template-2.9-1
> > >>>>> httpd-2.0.59-1.el4s1.10.el4.centos
> > >>>>> mod_perl-2.0.3-1.el4s1.3
> > >>>>> ----------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> /home/perl/Myserver/View.pm
> > >>>>> ----------------------------------------------------
> > >>>>> package Myserver::View;
> > >>>>>
> > >>>>> #Setup some essentials
> > >>>>> use strict; #strict tolerance for code
> > >>>>> use Carp; #debugging
> > >>>>> use diagnostics; #more debugging
> > >>>>> use warnings; #more debugging
> > >>>>>
> > >>>>> #Loadup some needed functions
> > >>>>> use HTML::Template;
> > >>>>>
> > >>>>> sub new {
> > >>>>> my $self =3D shift;
> > >>>>> return $self;
> > >>>>> }
> > >>>>>
> > >>>>> sub mainpage {
> > >>>>> my $self =3D shift;
> > >>>>> my $template =3D HTML::Template->new( filename =3D>
> > >>>>> '/home/Perl/tmpl/mainpage.tmpl',
> > >>>>> cache =3D> 1,
> > >>>>> debug =3D> 1,
> > >>>>> stack_debug =3D> 1 );
> > >>>>> print "Content-Type: text/html\n\n";
> > >>>>> $template->output;
> > >>>>> return $self;
> > >>>>> }
> > >>>>>
> > >>>>> 1;
> > >>>>> ----------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> /home/Perl/tests/View_mainpage.pl
> > >>>>> ----------------------------------------------------
> > >>>>> #!/usr/bin/perl -w
> > >>>>>
> > >>>>> # Test printing of the main page
> > >>>>> print "Main Page..";
> > >>>>>
> > >>>>> #Let's load the view module
> > >>>>> use lib "../";
> > >>>>> use Myserver::View;
> > >>>>> #Now let's load some things that are very handy
> > >>>>> use strict; #strict tolerance for code
> > >>>>> use Carp; #debugging
> > >>>>> use warnings; #more debugging
> > >>>>> use diagnostics; #even more debugging
> > >>>>>
> > >>>>> # Let's create an object
> > >>>>> my $view =3D Myserver::View->new;
> > >>>>>
> > >>>>> # Now, let's tell View to display the main page
> > >>>>> $view->mainpage;
> > >>>>>
> > >>>>> print ".OK";
> > >>>>>
> > >>>>> 1;
> > >>>>> ----------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> /home/Perl/tmpl/mainpage.tmpl:
> > >>>>> ----------------------------------------------------
> > >>>>> Test!
> > >>>>> ----------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> Output with debugging on (as above):
> > >>>>> ----------------------------------------------------
> > >>>>> $ tests/View_mainpage.pl
> > >>>>> ### HTML::Template Debug ### In _parse:
> > >>>>> ### HTML::Template _param Stack Dump ###
> > >>>>>
> > >>>>> $VAR1 =3D [
> > >>>>> \'Test!
> > >>>>> '
> > >>>>> ];
> > >>>>>
> > >>>>> Main Page..Content-Type: text/html
> > >>>>>
> > >>>>> ### HTML::Template Debug ### In output
> > >>>>> ### HTML::Template output Stack Dump ###
> > >>>>>
> > >>>>> $VAR1 =3D [
> > >>>>> \'Test!
> > >>>>> '
> > >>>>> ];
> > >>>>>
> > >>>>> .OK
> > >>>>> ----------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> Output without debugging:
> > >>>>> ----------------------------------------------------
> > >>>>> $ tests/View_mainpage.pl
> > >>>>> Main Page..Content-Type: text/html
> > >>>>>
> > >>>>> .OK
> > >>>>> ----------------------------------------------------
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >
> > >
>=20

RE: Custom Object-Oriented Module using HTML::Template

am 13.03.2008 18:03:10 von xyon

FYI, for those interested, I had to do some code adjustments. There was
a missing right curly bracket in Handler.pm (need to close the sub), and
I wasn't loading DECLINED properly in Handler.pm. Here is the proper
setup:

------------------------------------------------------------ -------
package Myserver::Handler;

#Setup some essentials
use strict; #strict tolerance for code
use Carp; #debugging
use diagnostics; #more debugging
use warnings; #more debugging

#Handler-related stuff
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile =3D> qw(OK DECLINED);
#Loadup Apache2::Request so we know what's been passed to us
use Apache2::Request;
#Loadup the Main (Model) and View modules (staying true to the
#Model/View/Control (MVC) (We are, Handler, or Control))=20
use lib "../";
use Myserver::Main;
use Myserver::View;

sub handler {
# We are an instance method
my $request =3D shift;

my $view =3D Myserver::View->new();
if (my $output =3D $view->mainpage()) {
$request->content_type('text/html');
$request->print($output);
return Apache2::Const::OK;
} else {
return Apache2::Const::DECLINED;
};
}

1;
------------------------------------------------------------ -------


On Thu, 2008-03-13 at 16:32 +0000, xyon wrote:
> Thank you all for your advice. With that and some help from a mentor, it
> is now working, with the below code:
>=20
>=20
> Apache config:
> ------------------------------------------------------------ -------
> PerlSwitches -I/home/Perl/
> PerlModule Myserver::Handler
>
> SetHandler modperl=20
> PerlResponseHandler Myserver::Handler
>

> ------------------------------------------------------------ -------
>=20
>=20
>=20
>=20
> Handler.pm:
> ------------------------------------------------------------ -------
> sub handler {
> my $request =3D shift;
>=20
> my $view =3D Myserver::View->new();
> if (my $output =3D $view->mainpage()) {
> $request->content_type('text/html');
> $request->print($output);
> return Apache2::Const::OK;
> } else {
> return Apache2::Const::Declined;
> };
> =20
> 1;
>=20
> ------------------------------------------------------------ -------
>=20
>=20
>=20
>=20
> View.pm
> ------------------------------------------------------------ -------
> sub new {
> my $class =3D shift;
> my $self =3D {};
> return bless $self, $class;
> }
>=20
> sub mainpage {
> my $self =3D shift;
> my $template =3D HTML::Template->new(=20
> filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
> cache =3D> 1,
> debug =3D> 1,=20
> stack_debug =3D> 1 );
> return $template->output;
> }
>=20
> 1;
> ------------------------------------------------------------ -------
>=20
>=20
>=20
>=20
> On Thu, 2008-03-13 at 12:01 -0400, Adam Prime x443 wrote:
> > SetHandler modperl doesn't bind 'print' to '$r->print'. Try SetHandler=
perl-script, or change your code to pass in the request object and use $r-=
>print instead of print.
> >=20
> > Adam
> >=20
> > -----Original Message-----
> > From: xyon [mailto:xyon@indigorobot.com]
> > Sent: Thursday, March 13, 2008 11:47 AM
> > To: modperl
> > Subject: Re: Custom Object-Oriented Module using HTML::Template
> >=20
> > Good suggestion, I moved the content_type to the top of the handler
> > routine in Handler.pm, so it now looks like:
> >=20
> > ------------------------------------------------------------ -------
> > sub handler {
> > my $self =3D shift;
> > $self->content_type('text/html');
> >=20
> > my $view =3D Myserver::View->new();
> > $view->mainpage;
> >=20
> > # Obligatory stuff for the handler
> > return Apache2::Const::OK;
> > }
> > ------------------------------------------------------------ -------
> >=20
> >=20
> >=20
> > I am still getting a blank page, though. Here is the latest lwp-request
> > output:
> >=20
> >=20
> > ------------------------------------------------------------ -------
> > $ lwp-request -s -U -S -e -m GET "http://localhost/admin/"
> > GET http://localhost/admin/
> > User-Agent: lwp-request/2.07
> >=20
> > GET http://localhost/admin/ --> 200 OK
> > Connection: close
> > Date: Thu, 13 Mar 2008 15:45:08 GMT
> > Server: Apache
> > Content-Length: 0
> > Content-Type: text/html; charset=3DUTF-8
> > Client-Date: Thu, 13 Mar 2008 15:45:09 GMT
> > Client-Peer: 127.0.0.1:80
> > Client-Response-Num: 1
> > ------------------------------------------------------------ -------
> >=20
> >=20
> >=20
> > On Thu, 2008-03-13 at 16:38 +0100, André Warnier wrote:
> > > Hi.
> > >
> > > First, don't take my suggestions as gospel, I don't know the TT2 and =
do
> > > not really know how you're supposed to work with it.
> > > But it seems to me that this is in the wrong order :
> > >
> > > $view->mainpage;
> > > $self->content_type('text/html');
> > >
> > > I think you should trigger the HTTP header before you generate the
> > > content. Now, whether that is the reason of your current problem or
> > > not, I haven't a clue.
> > >
> > > But I'm trying, and I'm really interested, because I am starting to w=
ant
> > > to know more about TT2 (and Catalyst) these days. So your
> > > "from-the-very beginning" approach is also very helpful to me.
> > > (And I do have a certain experience of Apache2/mod_perl2)
> > >
> > > And, re-check your lwp-request switches, you might have disabled the
> > > display of the response content (remove the -d).
> > >
> > > André
> > >
> > >
> > >
> > > xyon wrote:
> > > > Thanks for the reply.
> > > >
> > > > I thought as you did (that there were too many "Content-Type"
> > > > definitions), so commented out this line in the View.pm module, but=
that
> > > > doesn't seem to have changed anything:
> > > >
> > > > 'print "Content-Type: text/html\n\n";'
> > > >
> > > >
> > > >
> > > >
> > > > Here is the lwp command and output:
> > > > ------------------------------------------------------------ -------
> > > > $ lwp-request -e -S -s -U -m GET -Sed "http://localhost/admin/"
> > > > GET http://localhost/admin/
> > > > User-Agent: lwp-request/2.07
> > > >
> > > > GET http://localhost/admin/ --> 200 OK
> > > > Connection: close
> > > > Date: Thu, 13 Mar 2008 15:24:23 GMT
> > > > Server: Apache
> > > > Content-Length: 0
> > > > Content-Type: text/html; charset=3DUTF-8
> > > > Client-Date: Thu, 13 Mar 2008 15:24:23 GMT
> > > > Client-Peer: 127.0.0.1:80
> > > > Client-Response-Num: 1
> > > > ------------------------------------------------------------ -------
> > > >
> > > >
> > > > On Thu, 2008-03-13 at 16:11 +0100, André Warnier wrote:
> > > >> Hi.
> > > >>
> > > >> First, a small disgression : along with perl, comes a beautiful te=
st
> > > >> tool for HTTP stuff, called "lwp-request".
> > > >> Like, at the command-line :
> > > >> lwp-request (to see the options)
> > > >> lwp-request -m GET -Sed "http://myserver/myURL"
> > > >> (that will show you what you get as a response, without a browser
> > > >> getting in the way)
> > > >>
> > > >> Then, below, are you not now sending one "Content-type" too many ?
> > > >> It looks like you are doing it once in handler(), and once in main=
page().
> > > >>
> > > >> André
> > > >>
> > > >> xyon wrote:
> > > >>> That worked great with the test script ( print $template->output;=
), but
> > > >>> unfortunately, I'm having trouble getting the display onto a web =
page
> > > >>> (via the Handler). The resulting web page is blank, with no sourc=
e.
> > > >>>
> > > >>>
> > > >>> Below are my Apache configs for the handler, logs, and the handle=
r and
> > > >>> view module's latest code. I've also included the test script cod=
e, just
> > > >>> in case there is some obvious reason it would work and the handle=
r
> > > >>> won't.
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> Apache config:
> > > >>> ----------------------------------------------------
> > > >>> PerlRequire /etc/httpd/perl/startup.pl
> > > >>>
> > > >>> SetHandler modperl
> > > >>> PerlResponseHandler Myserver::Handler
> > > >>>

> > > >>> ----------------------------------------------------
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> /etc/httpd/perl/startup.pl:
> > > >>> ----------------------------------------------------
> > > >>> use lib qw(/home/Perl/);
> > > >>> 1;
> > > >>> ----------------------------------------------------
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> Apache log:
> > > >>> ----------------------------------------------------
> > > >>> ==> /var/log/httpd/error_log <==
> > > >>> ### HTML::Template Debug ### In _parse:
> > > >>> ### HTML::Template _param Stack Dump ###
> > > >>>
> > > >>> $VAR1 =3D [
> > > >>> \'Test!
> > > >>> '
> > > >>> ];
> > > >>>
> > > >>> ### HTML::Template Debug ### In output
> > > >>> ### HTML::Template output Stack Dump ###
> > > >>>
> > > >>> $VAR1 =3D [
> > > >>> \'Test!
> > > >>> '
> > > >>> ];
> > > >>>
> > > >>>
> > > >>> ==> /var/log/httpd/ssl_request_log <==
> > > >>> [13/Mar/2008:10:48:38 -0400] 10.5.5.5 TLSv1 DHE-RSA-AES256-SHA
> > > >>> "GET /admin/ HTTP/1.1" -
> > > >>>
> > > >>> ==> /var/log/httpd/ssl_access_log <==
> > > >>> 10.5.5.5 - - [13/Mar/2008:10:48:38 -0400] "GET /admin/ HTTP/1.1" =
200 -
> > > >>> ----------------------------------------------------
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> /home/Perl/Myserver/Handler.pm
> > > >>> ----------------------------------------------------
> > > >>> package Myserver::Handler;
> > > >>>
> > > >>> #Setup some essentials
> > > >>> use strict; #strict tolerance for code
> > > >>> use Carp; #debugging
> > > >>> use diagnostics; #more debugging
> > > >>> use warnings; #more debugging
> > > >>>
> > > >>> #Handler-related stuff
> > > >>> use Apache2::RequestRec ();
> > > >>> use Apache2::RequestIO ();
> > > >>> use Apache2::Const -compile =3D> qw(OK);
> > > >>>
> > > >>> sub handler {
> > > >>> my $self =3D shift;
> > > >>>
> > > >>> my $view =3D Myserver::View->new();
> > > >>> $view->mainpage;
> > > >>>
> > > >>> # Obligatory stuff for the handler
> > > >>> $self->content_type('text/html');
> > > >>> return Apache2::Const::OK;
> > > >>>
> > > >>> }
> > > >>>
> > > >>> 1;
> > > >>>
> > > >>> ----------------------------------------------------
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> /home/Perl/Myserver/View.pm:
> > > >>> ----------------------------------------------------
> > > >>> package Myserver::View;
> > > >>>
> > > >>> #Setup some essentials
> > > >>> use strict; #strict tolerance for code
> > > >>> use Carp; #debugging
> > > >>> use diagnostics; #more debugging
> > > >>> use warnings; #more debugging
> > > >>>
> > > >>> #Loadup some needed functions
> > > >>> use HTML::Template;
> > > >>>
> > > >>> sub new {
> > > >>> my $self =3D shift;
> > > >>> return $self;
> > > >>> }
> > > >>>
> > > >>> sub mainpage {
> > > >>> my $self =3D shift;
> > > >>> my $template =3D HTML::Template->new(
> > > >>> filename =3D> '/home/Perl/tmpl/mainpage.tmpl',
> > > >>> cache =3D> 1,
> > > >>> debug =3D> 1,
> > > >>> stack_debug =3D> 1 );
> > > >>> print "Content-Type: text/html\n\n";
> > > >>> print $template->output;
> > > >>> return $self;
> > > >>> }
> > > >>>
> > > >>> 1;
> > > >>> ----------------------------------------------------
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> /home/Perl/tmpl/mainpage.tmpl:
> > > >>> ----------------------------------------------------
> > > >>> Test!
> > > >>> ----------------------------------------------------
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> /home/Perl/tests/View_mainpage.pl
> > > >>> ----------------------------------------------------
> > > >>> #!/usr/bin/perl -w
> > > >>>
> > > >>> # Test printing of the main page
> > > >>> print "Main Page..";
> > > >>>
> > > >>> #Let's load the view module
> > > >>> use lib "../";
> > > >>> use Myserver::View;
> > > >>> #Now let's load some things that are very handy
> > > >>> use strict; #strict tolerance for code
> > > >>> use Carp; #debugging
> > > >>> use warnings; #more debugging
> > > >>> use diagnostics; #even more debugging
> > > >>>
> > > >>> # Let's create an object
> > > >>> my $view =3D Myserver::View->new;
> > > >>>
> > > >>> # Now, let's tell View to display the main page
> > > >>> $view->mainpage;
> > > >>>
> > > >>> print ".OK";
> > > >>>
> > > >>> 1;
> > > >>> ----------------------------------------------------
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> On Thu, 2008-03-13 at 13:29 +0800, Foo JH wrote:
> > > >>>> try print $template->output;
> > > >>>>
> > > >>>> You forgot the print();
> > > >>>>
> > > >>>> xyon wrote:
> > > >>>>> Hey everyone,
> > > >>>>>
> > > >>>>> Firstly, I apologize I sent the previous email under an incorre=
ct subject line.
> > > >>>>>
> > > >>>>> I am working on my first Object-Oriented project, and have hit =
a slight
> > > >>>>> snag. I am using HTML::Template to output within the View modul=
e, but it
> > > >>>>> never outputs. I don't see any errors in the logs, I just get a=
blank
> > > >>>>> page. Below is pertinent information including a test script wi=
th its
> > > >>>>> output:
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> OS Info:
> > > >>>>> ----------------------------------------------------
> > > >>>>> CentOS release 4.6 (Final)
> > > >>>>> ----------------------------------------------------
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> Package info:
> > > >>>>> ----------------------------------------------------
> > > >>>>> perl-5.8.8-11
> > > >>>>> perl-HTML-Template-2.9-1
> > > >>>>> httpd-2.0.59-1.el4s1.10.el4.centos
> > > >>>>> mod_perl-2.0.3-1.el4s1.3
> > > >>>>> ----------------------------------------------------
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> /home/perl/Myserver/View.pm
> > > >>>>> ----------------------------------------------------
> > > >>>>> package Myserver::View;
> > > >>>>>
> > > >>>>> #Setup some essentials
> > > >>>>> use strict; #strict tolerance for code
> > > >>>>> use Carp; #debugging
> > > >>>>> use diagnostics; #more debugging
> > > >>>>> use warnings; #more debugging
> > > >>>>>
> > > >>>>> #Loadup some needed functions
> > > >>>>> use HTML::Template;
> > > >>>>>
> > > >>>>> sub new {
> > > >>>>> my $self =3D shift;
> > > >>>>> return $self;
> > > >>>>> }
> > > >>>>>
> > > >>>>> sub mainpage {
> > > >>>>> my $self =3D shift;
> > > >>>>> my $template =3D HTML::Template->new( filename =3D>
> > > >>>>> '/home/Perl/tmpl/mainpage.tmpl',
> > > >>>>> cache =3D> 1,
> > > >>>>> debug =3D> 1,
> > > >>>>> stack_debug =3D> 1 );
> > > >>>>> print "Content-Type: text/html\n\n";
> > > >>>>> $template->output;
> > > >>>>> return $self;
> > > >>>>> }
> > > >>>>>
> > > >>>>> 1;
> > > >>>>> ----------------------------------------------------
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> /home/Perl/tests/View_mainpage.pl
> > > >>>>> ----------------------------------------------------
> > > >>>>> #!/usr/bin/perl -w
> > > >>>>>
> > > >>>>> # Test printing of the main page
> > > >>>>> print "Main Page..";
> > > >>>>>
> > > >>>>> #Let's load the view module
> > > >>>>> use lib "../";
> > > >>>>> use Myserver::View;
> > > >>>>> #Now let's load some things that are very handy
> > > >>>>> use strict; #strict tolerance for code
> > > >>>>> use Carp; #debugging
> > > >>>>> use warnings; #more debugging
> > > >>>>> use diagnostics; #even more debugging
> > > >>>>>
> > > >>>>> # Let's create an object
> > > >>>>> my $view =3D Myserver::View->new;
> > > >>>>>
> > > >>>>> # Now, let's tell View to display the main page
> > > >>>>> $view->mainpage;
> > > >>>>>
> > > >>>>> print ".OK";
> > > >>>>>
> > > >>>>> 1;
> > > >>>>> ----------------------------------------------------
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> /home/Perl/tmpl/mainpage.tmpl:
> > > >>>>> ----------------------------------------------------
> > > >>>>> Test!
> > > >>>>> ----------------------------------------------------
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> Output with debugging on (as above):
> > > >>>>> ----------------------------------------------------
> > > >>>>> $ tests/View_mainpage.pl
> > > >>>>> ### HTML::Template Debug ### In _parse:
> > > >>>>> ### HTML::Template _param Stack Dump ###
> > > >>>>>
> > > >>>>> $VAR1 =3D [
> > > >>>>> \'Test!
> > > >>>>> '
> > > >>>>> ];
> > > >>>>>
> > > >>>>> Main Page..Content-Type: text/html
> > > >>>>>
> > > >>>>> ### HTML::Template Debug ### In output
> > > >>>>> ### HTML::Template output Stack Dump ###
> > > >>>>>
> > > >>>>> $VAR1 =3D [
> > > >>>>> \'Test!
> > > >>>>> '
> > > >>>>> ];
> > > >>>>>
> > > >>>>> .OK
> > > >>>>> ----------------------------------------------------
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> Output without debugging:
> > > >>>>> ----------------------------------------------------
> > > >>>>> $ tests/View_mainpage.pl
> > > >>>>> Main Page..Content-Type: text/html
> > > >>>>>
> > > >>>>> .OK
> > > >>>>> ----------------------------------------------------
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >
> > > >
> >=20

Re: Custom Object-Oriented Module using HTML::Template

am 14.03.2008 17:19:45 von Perrin Harkins

Mike,

Please start a new thread rather than responding to a message. Also,
please show the actual error messages you are receiving.
http://perl.apache.org/maillist/email-etiquette.html#To_post _to_the_List

- Perrin