Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

just another CGI newbie

by Anonymous Monk
on Sep 19, 2008 at 22:44 UTC ( #712652=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm learning to use CGI.pm and it seems to work nicely. However, when using a stylesheet the output appears as if the stylesheet did not exist. The output source looked fine to me, so I copied it and tried accessing the "new" page: it now appears properly.

Since the stylesheet was in the same directory as the page calling the cgi script (so -style=>{'src'=>'style.css'}), I also copied it into cgi-bin but this didn't make any difference.

Does anyone know why two identical pages -- one saved as an actual .html file and one output from a perl script -- would end up appearing differently?

Replies are listed 'Best First'.
Re: just another CGI newbie
by ikegami (Pope) on Sep 19, 2008 at 22:57 UTC

    Since the stylesheet was in the same directory as the page calling the cgi script

    Irrelevant. (I was going to ask "Is the style sheet in the same directory as the cgi script?", but that's irrelevant too.)

    If the HTML returned by the script at
    http://www.example.com/app/script.cgi
    refers to the style sheet at
    style.css
    then the browser will attempt to locate the style sheet at
    http://www.example.com/app/style.css

    Is that where the style sheet is located?

      Well, I beg to differ ...

      It all depends how the webserver is configured.

      You can easily have all your "cgi" scripts be served out of a "cgi-bin" directory and all your "css" files out of a totally different directory without the URL showing any different path.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        How is that differing? That's exactly what I said. It all depends how the webserver is configured to handle individual urls, so it's irrelevant in which directory the files are located.
      "Is that where the style sheet is located?" yep. I actually have three copies of it on the server now (one in cgi-bin, one in "html", and one in their common parent)
        sorry all, it's because the server won't process it in cgi-bin, ie. "../style.css" and "../html/style.css" are okay where "style.css" is not...
Re: just another CGI newbie
by Cody Pendant (Prior) on Sep 20, 2008 at 10:51 UTC
    Does anyone know why two identical pages -- one saved as an actual .html file and one output from a perl script -- would end up appearing differently?
    Served from the same location at the same time? They can't. Not if they're truly identical.

    You can't send us links to these two identical pages? It would probably be a lot easier.



    Nobody says perl looks like line-noise any more
    kids today don't know what line-noise IS ...
Re: just another CGI newbie
by porta (Sexton) on Sep 20, 2008 at 12:47 UTC
    ... Or paste here the header section of the html to get an idea of what's really happening (to see if the problem is on the html or the server).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://712652]
Approved by planetscape
help
Chatterbox?
and !@monks...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-10-24 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (286 votes). Check out past polls.

    Notices?