SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Newb perl problems

  1. #1
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    - Re: .cgi and .pl: I don't think it makes a difference.

    - Some hosts require Perl scripts to be placed in the cgi-bin, and others do not, it all depends.

    - I don't believe plain old Perl can be imbedded into an HTML page, but you CAN use HTML in a Perl print command

    Here's an example:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    print "&lt;html&gt;&lt;head&gt;";
    print "&lt;title&gt;This Page Has Been Created By Perl!&lt;/title&gt;";
    print "&lt;/head&gt;&lt;body&gt;Hello World&lt;/body&gt;&lt;/html&gt;";
    [/code]

    Also, don't forget that you cannot use a quotation mark inside the print command...unless you use the print qq command instead.


    ------------------
    Chris Bowyer – chris@mycoding.com
    MyCoding.com: Visit for Launch Notification!
    DomainMailings.com: Who Says All The Good Ones Are Taken?
    MovieForums.com: Talk About Your Favorite Flicks!

    [This message has been edited by TWTCommish (edited August 10, 2000).]

  2. #2
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i was just starting on perl and doing some basic scripts but the tutorial doesnt cover some things could someone plz anwser them for me.

    1. Ok basically all i am doing is using print to say 1 line of text but what do i do? like should i use embed code on html into a page, run it from my ftp or shell? or just goto the address i put it on

    2. Whats the difference between .cgi and .pl does it make a difference if i dont put them in the cgi-bin?

    thats all for now =)

  3. #3
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,936
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it doesn't matter what you name your perl scripts on a unix server, its the first line that says how to execute the file. .cgi is just what most people do.

    On an NT server you need to name it .pl or whatever extension is associated with perl.

    And no they don't have to be in a cgi-bin but because scripts ofter require different permissions than the other files its generally a good idea to keep them all in 1 place.

    As to how to print 1 line of text, you could execute the program from the shell. To do it from a webpage you'd either load the script in your browser or, if it takes variables (like most do) access it using an HTML Form.

    Chris

  4. #4
    SitePoint Evangelist
    Join Date
    Jul 2000
    Location
    Warwickshire, England
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are printing a lot of text you can use a delimiter...

    print &lt;&lt;SomeHTML;
    &lt;html&gt;
    some html
    you can also use "
    &lt;/html&gt;
    SomeHTML

    You can use the backslash to escape special characters like \@ and \"

    You can embed perl into html if you have modperl and ssi (i think). Visit my website to see an example of perl embedded in a webpage.
    http://www.incomplete.co.uk *under constrcution*

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •