Mike Brentlinger wrote:
> Im having some difficulties with http::daemon. I know it must be 
> something i just dont understand, so could someone explain why in the 
> example below
>            $c->send_file_response("C:\\index.html");
> works for me and
>            $c->send_response("<HTML>test</HTML>\n");
> does not?
> 
> Do I need to send a header? and if so how and why do i not have to with 
> the send_file_response.
> 
> Thanks much in advance.
> 
> 
> 
> 
> 
>#http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/site/lib/HTTP/Daemon.html
> 
> 
>  use HTTP::Daemon;
>  use HTTP::Status;
>  my $d = new HTTP::Daemon LocalPort => 80 || die;
>  print "Please contact me at: <URL:", $d->url, ">\n";
>  while (my $c = $d->accept) {
>      while (my $r = $c->get_request) {
>          if ($r->method eq 'GET') {
> #              $c->send_file_response("C:\\index.html");
>            $c->send_response("<HTML>test</HTML>\n");

Try more like:

my $resp = HTTP::Response->new(200, 'OK', undef, "<HTML>test</HTML>\n") or
   die "HTTP::Response: $!";
$c->send_response($resp);


>           } else {
>              $c->send_error(RC_FORBIDDEN)
>          }
>      }
>      $c->close;
>      undef($c);
>  }
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 



-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to