HTTP::Request; content_type
- From: robert.waters@xxxxxxxxx
- Date: 21 Oct 2005 13:35:02 -0700
Hi,
Why does the method 'content_type' work in an HTTP::Request object?
It is not a method of that class, nor is it a method of HTTP::Message
class, which is HTTP::Request's parent class.
'content_type' *is* a method of the HTTP::Headers class, and the man
page for HTTP::Headers says 'Instances of this class are usually
created as member variables of the HTTP::Request and HTTP::Response
classes' - if this were the case, wouldn't 'content_type' be a method
of a *member* of the HTTP::Request class, rather than a method of the
class itself?? (ex. $request->header->content_type(...))
Is there some sideways-inheritance going on?
I am sorry, am familiar with c++ style OOP, but am a relative newcomer
to perl.
Example code:
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST => 'http:some.site');
$req->content_type('application/x-www-form-urlencoded');
$req->content('user=user&password=password');
my $resp = $ua->request($req);
Thanks in advance,
Robert
.
- Follow-Ups:
- Re: HTTP::Request; content_type
- From: Paul Lalli
- Re: HTTP::Request; content_type
- Prev by Date: Re: killing a program
- Next by Date: creating a hash with a set of keys that are contained within an array.
- Previous by thread: killing a program
- Next by thread: Re: HTTP::Request; content_type
- Index(es):
Relevant Pages
|