Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

FW: Overriding a method (HTTP::Daemon::product_tokens)
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>






Report this thread to moderator Post Follow-up to this message
Old Post
OK News
09-22-04 08:57 PM


Re: FW: Overriding a method (HTTP::Daemon::product_tokens)
From:           	"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


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
09-22-04 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:14 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.