Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

There ain't no PERL. The language is spelled "Perl", the script interpreter is spelled "perl".

Right-Click on the broken ("X") image and select "properties". Look at the image's URL. I could bet that you don't load the image from where you want to load it. With your code, and a typical CGI mapping set up on the web server, and no PATH_INFO in your URL (i.e. your URL ends with the script's name), the file LOGO.gif must reside in the same directory as your Perl CGI script. This is possible, but unusual. Most web servers don't allow static resources inside the CGI directories, and typically return an error page for those files. Copy the image's URL into the address line of a new browser window and look for yourself.

To fix that problem, either move the image into a directory from which static resources are served, and use a proper URL in the "src" attribute of the "img" tag; or switch from the dedicated CGI directory to CGIs inside the "normal" directories, detected by the file extensions. (For Apache: switch from "ScriptAlias" to "AddHandler cgi-script".)

Looking at your shebang line, it looks like you are running Windows, which can add some strange effects, too. But for this trivial case, Windows does not hurt.

Oh, and you don't have to write all HTML by yourself, the CGI module offers a nice syntax for creating HTML, and if you want to separate program logic (Perl) and presentation (HTML) -- which you really should, except for tiny throw-away scripts -- you should use a template engine like Template Toolkit.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^4: <img> tag does not work in my perl/cgi code by afoken
in thread <img> tag does not work in my perl/cgi code by vit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-26 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found