jfroebe has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm using POE::Component::Server::HTTP and wish to add a stylesheet using CGI.pm but I'm having a spot of trouble.
What's happening is that when I add the css_link line to the headers, the script will appear to hang. If I kill the script (SIGINT) then the rest of the html code is magically sent to the web client. I don't think it has to do with buffering (see $|++ below). If I remove the css_link line, it runs fine. If I manually enter the css header line instead of calling a subroutine, it hangs.
I'm thinking it is something simple that I'm just overlooking. Any one see what I am not?
$|++; sub MainHandler { my ($request, $response) = @_; $response->code(RC_OK); $response->content( get_content($request) ); return RC_OK; } sub get_content { my $request = shift; my $my_content; $my_content = start_html( -title => $request->uri, -head => header_css() ); $my_content .= end_html(); return $my_content; } ########### ########### sub header_css { my @css_style_sheets = ("http://othermachine/css/standard.css", "h +ttp://othermachine/css/ssd.css"); ### in order to support multiple style sheets, ### we need to explicitly run CGI Link() ### we link only to those style sheets that ### actually exist my $css_link = ""; foreach (@css_style_sheets) { $css_link .= Link({ -rel => 'stylesheet', -type => 'text/css', -href => $_ }); } return $css_link; }
UPDATE: Looks like it was an issue of the remote css links and not the code itself. Argh. Certainly feels like monday
Thanks ikegami for the help as you made me see the light when I explained where the output was going! :)
No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: POE::Component::Server::HTTP and CSS
by ikegami (Patriarch) on Jan 10, 2006 at 19:15 UTC | |
by jfroebe (Parson) on Jan 10, 2006 at 19:23 UTC | |
by ikegami (Patriarch) on Jan 10, 2006 at 19:25 UTC | |
by jfroebe (Parson) on Jan 10, 2006 at 19:37 UTC | |
by jfroebe (Parson) on Jan 10, 2006 at 19:52 UTC |