in reply to Re: CGI::Application run mode does not recognize external css
in thread CGI::Application run mode does not recognize external css

As I said, I saved the html source that my code generates as a separate html file and that seems to recruit the external css just fine.
  • Comment on Re^2: CGI::Application run mode does not recognize external css

Replies are listed 'Best First'.
Re^3: CGI::Application run mode does not recognize external css
by Corion (Patriarch) on Apr 19, 2010 at 14:53 UTC

    Well, if you refuse to show the HTML generated for the first solution that works, and the HTML generated for the second solution that fails, then it will be quite hard to determine why the one works while the other does not.

    My guess is that the URL does not work, at least http://www.mystyle.com/styles/style.css does not work for me. But feel free to try other approaches to finding out why this does not work.

      sorry about that.. here is the source
      <!DOCTYPE html PUBLIC"-// W3C//DTD Xhtml 1.0 Strict//EN"" http://www.w +3.org/TR/xhtml2/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT" +> <LINK REL=StyleSheet href="file:///C:/Program Files/Apache Softwar +e Foundation/Apache2.2/cgi-bin/myapp/templates/basic.css" TYPE="text/ +css" MEDIA=screen> <title> Browse </title> </head> ... ...
      above code, when generated through run-mode does not recruit the external css, whereas if I copy this and paste it to a dummy html file, then the css works fine. Whats bothering me is why the browser treats the same html content in 2 files (one generated melodramatically, other created manually) differently? Sorry if I missed out something please let me know and I'll post. Thanks
Re^3: CGI::Application run mode does not recognize external css
by marto (Cardinal) on Apr 19, 2010 at 14:56 UTC

    Have you checked your webservers logs? I doubt it's serving this css file, and in your test case your browser is just picking it up from the path in the html.

      Hi Here is what I got from the error logs.. Can you suggest what might be going wrong here? Thanks Mon Apr 19 11:22:50 2010 error client 127.0.0.1 script not found or unable to stat: C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/myapp/basic.css, referer: http://localhost/cgi-bin/myapp/simple.pl

        This isn't a perl issue, or an issue relating to CGI::Application. I'd simply replace this path you assign to the template variable with one relative to your myapp site, that your apache configuration will be able to locate and serve.

        You should spend some time reading about HTML, the apache documentation, and Ovid's CGI course (thanks to jdporter for hosting this) to learn how to debug such problems.

        As marto pointed out, you need to fix the URL to your CSS file. I suppose your App might work if you double click the CGI (windows right?) but when it's run by a real web server, no major browser (in default configuration) will allow a remote file to access a local file.

        See the spec at HTML 4.01, look around for HTML tutorials, and/or buy a book on HTML.