Code Comments
Programming Forum and web based access to our favorite programming groups.Hello,
This is my 2nd request on the below issue. I'm hoping someone out there
can help me out or point me in the right direction. I'm trying to learn
how to override a method so I can give my value rather than the one the
libwww package defaults to (see below).
Any help appreciated.
Thanks,
~jerry
-----Original Message-----
From: OK News [mailto:oknews@desidesh.com]
Sent: Saturday, September 18, 2004 6:45 PM
To: beginners@perl.org
Subject: Overriding a method (HTTP::Daemon::product_tokens
Hello,
I've read a lot of docs today and searched the web high and low but
cannot get past this problem.
I'm trying to override the product_tokens value in HTTPD::Daemon. I'm
creating a webserver and would like the 'Server' header to show my user
agent. I found the following code should be able to do this:
# my version of HTTP::Daemon with a different server name
@HTMLF::Daemon::ISA = qw(HTTP::Daemon);
sub HTMLF::Daemon::product_tokens {
return "My Agent Name";
}
And this appears before any real script logic begins. Each time the
server starts up and I get the headers by doing 'HEAD
http://localhost:8080', I keep getting the default header 'Server:
libwww-perl-daemon/1.25'. The docs say I should be able to override
this.
Any help truly appreciated...
~jerry
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Post Follow-up to this messageFrom: "OK News" <oknews@desidesh.com>
> Hello,
> I've read a lot of docs today and searched the web high and low but
> cannot get past this problem.
>
> I'm trying to override the product_tokens value in HTTPD::Daemon. I'm
> creating a webserver and would like the 'Server' header to show my
> user agent. I found the following code should be able to do this:
>
> # my version of HTTP::Daemon with a different server name
> @HTMLF::Daemon::ISA = qw(HTTP::Daemon);
> sub HTMLF::Daemon::product_tokens {
> return "My Agent Name";
> }
>
> And this appears before any real script logic begins. Each time the
> server starts up and I get the headers by doing 'HEAD
> http://localhost:8080', I keep getting the default header 'Server:
> libwww-perl-daemon/1.25'. The docs say I should be able to override
> this.
Can you show us more of the script? It looks OK so far, but we need
to see how do you create the object. Are you sure the created object
is a HTMLF::Daemon and not HTTP::Daemon? What does
print "And the object's type is: ", ref($daemon), "\n";
print?
Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.