May 12, 2008

Perl/cgi Help! - HTML skills required also.

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Perl Programming

free web hosting

Perl/cgi Help! - HTML skills required also.

Izlude
Im sort of new with perl and I know the basics. Lemme paste the code ...

CODE

#!/usr/bin/perl -w

if ($ENV{'REQUEST_METHOD'} eq 'POST') {

  read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  @pairs = split(/&/, $buffer);
  foreach $pair (@pairs) {
  ($name, $value) = split(/=/, $pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])<br>/pack("C", hex($1))/eg;
  $FORM{$name} = $value;
  }
 open (QUOTE, '>>logs.txt');
 print QUOTE "<center>$FORM{quote}<br><br>\n\n";
 print QUOTE "<hr width=20%></center><br><br>\n\n";
 close (QUOTE);
 &thx;
}
else {
 &error;
}


I have no problems with the subs .... I just want to end every line of text with a <br>. I have another perl script that reads the whole logs.txt file and pastes it into a HTML page. Can anyone help me?

Thanks in advance ...

 

 

 


Reply

Hamtaro
Just to let you know: I quit using Perl/CGI about 2 or 3 months ago and started learning PHP, but I still remember some of it, so I'll try my best to help you.

I think you called the item in the array wrong.
I usually did: $FORM[Name] instead of $FORM{Name}
That could be the problem you're having. Have you checked your error logs for the problem? By the way it looks, the rest is fine.

Here's what I think should be fixed:
$ENV{'REQUEST_METHOD'} to $ENV['REQUEST_METHOD']
$ENV{'CONTENT_LENGTH'} to $ENV['CONTENT_LENGTH']
$FORM{$name} = $value; to $FORM[$name] = $value;
$FORM{quote} to $FORM[quote]

I hope that helps you.

Reply

vizskywalker
First of all, I just checked all of my scripts, you had the correct format for an array, it is not necessarily $FORM['blah]. What do you mean by end with <br>. If you mean place the text "<br>" at the end of each line, simply place it in the end of each of your printed lines. That ought to work. If you tell us exactly what isn't working right we can provide better solutions.

~Viz

Reply

Izlude
Thanks to you both for replying biggrin.gif

Well .. I did a mass debug of the script and found that the problem I was looking for was not there lol.

CODE

open(READ,"<logs.txt") or die "Could not connect to database.";
while (<READ>) {
$s = $_;
print "<br> $s";
 };

the $s was being written to logs.txt in separate lines (as plain text), but since the other script (logs.pl) prints $s in a HTML page, it never line break'd.


Also ... the <br> inside this line messed up the first script posted above:
CODE

$value =~ s/%([a-fA-F0-9][a-fA-F0-9])<br>/pack("C", hex($1))/eg;


Thanks again. laugh.gif

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. interview questions on perl/cgi - 676.30 hr back.
Similar Topics

Keywords : perl, cgi, html, skills, required

  1. How To: Html Tables.
    I find these really useful. (8)
  2. Html Ascii Codes - A Complete List
    downloadable php file (3)
    I was often frustrated at how, despite there being thousands of ASCII "special characters" such as
    &8659; , websites that claimed to list them all only listed the first 256. To combat this issue,
    I have created a table which lists the first 10,001 - from &#000; to &10000; I am sure
    there are many more but it is simply not feasible to create a table with many more rows as viewing
    it would put terrific strain on the browser.! You can download the file in two forms. One uses
    PHP to dynamically create the table (1KB), the other has it ready-made in pure HT....
  3. Linux Anti-virus Software
    is it required? (6)
    Just installed Linux Ubuntu on a partition with Wireless access to the Internet and have a question
    about the need for an Ani-virus software. Is it suggested to have it installed? and which one is
    recommended by the Trap17 users? Ubuntu 8.04 installed via Wubi, if that matters. Both the LAN
    hard-wire connection and the Wireless Adapter work, if that matters.......
  4. Html Div Help [resolved]
    help with the divs in ipb (1)
    hey guys, as you may know, i have ipb 2.3.4 set up on my site. i am currently using the centura
    skin and like it a lot. i have customised the header bar in terms of the logo, however also want a
    slab of text linking to the forums home at the top of the banner. i have so far managed to achieve
    this to work in firefox (see attached screenshot), however it just screws up in ie, opera and safari
    (i think). the link is here here is the code, both html and css, of the ipb header, and i have
    placed between stars the parts i have edited: CODE the css (only the ed....
  5. How To Improve Analytical Writing (aw) Skills In Gre?
    Fluency, organization and technical English are three utmost important (2)
    After reading through the model essays on GRE official websites, I felt ever pressure. According to
    the BARRON'S HOW TO PREPARE FOR THE GRE, fluency, organization and technical English are three
    utmost important factors for GRE writing. However, for those Asian students like me, writing in
    idiomatic and grammatically correct compositions is really challenging. For example, most of those
    Japanese students study English word by word other than sentence by sentence, forming habitual
    mistakes in word matching in a Japanese way, thus it is quite common that nobody else bu....
  6. How Do I Get The Result To "stick" And Add Html Tags?
    Help please? (14)
    $changepage = $_REQUEST ; echo " $changepage "; ?> Okay, I need a
    way for any information typed in my textarea to "stick" on the page in which it "posts". Since I am
    creating a way for my registered users to decorate their "homepages". So any help, tutorials, etc.
    would be greatly appreciated. ^^ Thanks.....
  7. Google Has Sloppy Coders
    Can't even code proper HTML (6)
    Ok, just out of curiosity I ran Google through the w3c validator to see if the coders wrote valid
    code. I found out that Google had 50 errors. One of them was no DOCTYPE! I was surprised that
    Google has sloppy coders like that. It's not just the fact that it is a big company that
    generates millions of dollars, but the fact they have created one of the greatest search engines and
    can't even code correct HTML. The code looks extremely messy. Here is a link to the validation
    page: ....
  8. [php] Clean Code Functions
    Clean up your html output from php scripts (5)
    There is another Topic about writing 'clean' HTML code posted elsewhere on the Forum.
    I'll edit this Topic and add the link so you can review it on your own, and there is no need for
    me to comment on it in this thread, but the purpose of this Topic is to introduce a pair of
    functions which can be used for making sure that the HTML output from my scripts is readable when a
    view-source is reviewed. Two handy functions are included here. They work together quite nicely,
    and I will start this Tutorial with a short summary of the reasons for their 'being....
  9. Gimp Abstract Signature Tutorial
    Brushes required (7)
    In this tutorial I will be showing you how to make a abstract signature in GIMP. I have a lot of
    images for this so bear with the loading time. First, you need to make a new image. I think
    400x100px is a good signature size. I used these settings. You should have a blank white canvas.
    We will start out our sig by brushing up a quick background. I came out with this: Next, we will
    make a new layer. We will do more brushing on this layer. I used these settings: Start brushing
    with a different brush set. I ended up with this: Select your first brushed layer, th....
  10. Kool Html
    Could anyone tell me some sites with some kool html on them? (6)
    Could anyone tell me some sites with some kool html on them? Like raninging images! and images
    blur when u hover ut mouse over them!....
  11. Seo And Php, Do You Really Need Programing Skills?
    Do you think learning PHP is a must in order to start doing SEO?? (5)
    Any advice on what technical skills are needed to start doing SEO?....
  12. Html 5 Draft Report Released
    Read the changes from html 4 here (16)
    Link: http://www.w3.org/TR/2008/WD-html5-diff-20080122/ I have just read it once, so I don't
    have an opinion to state, but the W3C has released the Draft Version of the HTML 5 Working Group.
    Apparently, it will remain as a Draft version until at least 2 Browsers actually implement the
    changes. The Document above lists the Differences between the html 4 specs and the proposed html 5.
    Looks like some interesting stuff, with a tag, , etc. Notice that there is a further separation
    of Structure and Style as a mess of Table attributes will be no longer supported. ....
  13. Script Help Required: Undefined Variable
    A fault I cannot spot in PHP (3)
    Hi, when running a PHP script I keep getting the error: QUOTE Notice: Undefined variable: bret
    in c:\program files\easyphp1-8\home\poll.php on line 294 Notice: Undefined
    variable: bret in c:\program files\easyphp1-8\home\poll.php on line 294 (And,
    yes, I get it twice). The code related to the variable is as follows: CODE function
    LogString($string,$type)     {         $t_log = "\n";
            $t_log .=
    $this->globaldata->server_vars['REMOTE_ADDR']."....
  14. Where Is There A Good Site To Learn Web Html?
    (15)
    im a noob when it comes to web html to design web sites, can some one tell me where to find a good
    website that has good tutorials on how to use web html?....
  15. Creating Navigation For Html Websites
    Have a common navigation menu for the whole website! (12)
    Pre-requisite: HTML, inline frame tags 1 Attachment(.zip) included. Updates : 29-12-07: Doctype
    added in example files (Advised by jlhaslip) Designing a whole website takes a lot of planning
    and organization. Designing a proper navigation system is a basic step in building your website. If
    you are developing webpages in html you would have observed that as you go on creating pages it
    becomes difficult to maintain the links to the pages. This article will guide you in developing a
    common navigation menu for your website. It describes three ways, so if you don'....
  16. Apply Your Ninja Skills At Work!
    (4)
    Contrary to popular belief, gaming does not turn people into anti-social recluses unable to adapt to
    the real world. In fact, gaming can help sharpen your survivial skills in the dog-eat-dog corporate
    jungle. Here are some skills you can pick up in gaming and potentially add to your resume. Lead
    by example Game examples: Team tactical types like Ghost Recon: Advanced Warfighter, Rainbow Six
    True leadership is about saving your entire team from being massacred and not getting a word of
    thanks when it's over. In team titles like these, you stick your neck out to ....
  17. Html Legend
    Learn how to create a handy legend with HTML! (9)
    I think this is pretty neat... good for those people who maybe aren't that great at designing
    things but still want something to look nice.. CODE <fieldset> <legend>Legend
    title</legend> Content </fieldset> try it in note pad.. it looks nice...good for
    forums, sign up forms.......
  18. Html Code Tester. Online Script
    (14)
    Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
    this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
    Current script: CODE <?php //Save this as something like htmltest.php function
    CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
    input $html_safe=str_replace("<?php"," ",$html_unsafe);
    //Starts security measures $html_safe=str_replace("?>","
    ",$html_sa....
  19. .php?id=html Not Working
    (15)
    I use a single php file for all my tag decorations and image calling so that each page is lighter
    and therefore isn't bogged down with the same repeated code over and over, which allows me not
    only to much easier change my layout and design (as I often do) but once I've finally gotten it
    up and working here, I realized none of the links work, I doubled, and triple checked them over and
    over again to make sure I wasn't making a mistake. I swore trap17 supported php, so why
    isn't it working? Am I missing some sorta code that i need to add, or need to take a....
  20. Help! Php Or Just Html?
    i want to start buliding my website. which is better, php or basic htm (6)
    i try to start this topic in webhost category but it seems like i cant. i dont have the permission
    so i just post my topic here. im sorry mod.. i want to build a website which contains: - Links to
    videos - Informations - photos - flash i don't know if i should use php or just HTML. guys,
    what are your opinions..??....
  21. A Small Html Problem
    How to display foreign characters correctly when designing a site. (4)
    I was wondering how I could solve a small problem. I was told that some people see accented and
    umlauted letters (such as " é " and " ë ") as question marks (" ? ") on my website. I come across
    the same thing sometimes when looking at websites which use non-English characters. Funnily enough,
    the other day, I looked at a site and the apostrophy ( ' ) was also shown as a question mark.
    That is a very common character usually, I would think. I thought it had something to do with the
    character encoding settings, and let me also mention I use Mozilla Firefox as my brows....
  22. Simple Scripts In Html And Javascript
    Things like BackgroundColorChanger and so (7)
    like in the topic, here is a description how to change the Backgroundcolor "On The Fly", by klicking
    on a button or radio-box first, we ned the html-and body-tags, create a new html-file on your
    desktop and write the following: QUOTE <script language = "JAVASCRIPT">
    browser interpretation: html - tag means "hey, browser, here comes HTML" in the body-tag you define
    the looking of your site. you can add things like "bgcolor" for the background, "text" for the
    textcolor and link / alink / hlink / vlink to define the linkcolor ( ) the scripttag i....
  23. Make $10 Money Instantly Or Free Domain Of Your Choice!
    Credit Card Required - I will pay via PayPal personally (16)
    Ok, first of all, this is a NO B.S. offer. This is how it works: Once you PM me, I will pay you
    $5 USD upfront via PayPal. Along with the money, I will send you a referral link. You will
    have to visit the site that the referral link points to and complete ONE offer. I RECOMMEND the
    TICKLE offer which costs $5 - that's why I'm paying you the $5. If you are
    uncomfortable with Tickle, you can choose Blockbuster, Netflix and other trusted companies! You
    will need a credit card to signup with tickle and complete the offer. Once you complete the....
  24. Truefusion Shoutbox
    No Database required! (31)
    After several tests, i think it's good enough to be released. Please report any problems in
    this topic. About the shoutbox: QUOTE It's supports many bbcodes that we're all used
    to. Over 60 smileys. No database required for shout storage: All stored on flatfile. XHTML valid.
    Installation is basically extract files, and chmod the files "shouts.log", "ipban.log",
    "wordfilter.log" 666. Compatible with standard-compliant browsers, and Internet Explorer. Admin
    Cpanel: Edit/delete shouts, IP ban/unban, Word Filter. Users can delete/edit their shouts within a....
  25. Adapting Html Code Embed To Work On Phpnuke
    Help With This Html Code Pls (7)
    QUOTE how can get this html code to work on my phpnuke site? what tags would i
    have to enable in the $Allowable HTML part of my config.php file?? Edited topic title. Moved
    to Programming. ....
  26. Html To Php Convertor?
    (12)
    Hey.I have made a simple website http://pakdir.com this is in html.But its very difficult to
    update the html pages.I want to convert it to php site.But i dont know about php language ... is
    there any "PHP website builder" ?? is there anyway to build a php website without knowledge of php ,
    with the help of some program ? for example there is a frontpage for html etc.Please tell me any
    solution?....
  27. Html Cool Codes?
    (6)
    hey guys..whats up..well i ws just wondering if you guys have any cool codes for myspace or
    something..you know to design a page using html/css codes...see i tried googling around but all the
    sites had the same thing..they dont have a unique one...i want like games in my page...like my
    friend he had like tetris in his page..and i want a game// or anything like that to make my page
    cool /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' />
    anybody????plz...PEAcE!....
  28. The Best And Free Website/html Editors + Text Editors
    A good collection! Check it out. (43)
    Here they are, the best html editors. Just pick one because they are all free, or choose one of the
    ones i most recommend. WebCore Designer 2005 http://www.mpsoftware.dk/webcoredesigner.php
    HTMLGate Free http://www.mpsoftware.dk/htmlgate.php Ma Page Web http://www.aldweb.com
    MAX's HTML Beauty++ 2004 http://www.htmlbeauty.com WebWorks http://w1.213.telia.com
    PageBuilder HTML Editor http://www.tafweb.com Website Mentor http://www.dark-street.com
    Cascade DTP http://www.price-media.demon.co.uk BPlainPro http://home5.swipnet.se/~w-52253/hy....
  29. Does Anyone Know Where I Can Get A Free Html Maker
    (10)
    I was curious. There is a program clled dreamweaver which does what I want but it cost to much.....
  30. where did you learn html from?
    (80)
    HI, i am intresting in knowing where you began learning html of what inspired you to start learning
    html. which programs did you use or which progs dyu use?....

    1. Looking for perl, cgi, html, skills, required

Searching Video's for perl, cgi, html, skills, required
Similar
How To: Html
Tables. - I
find these
really
useful.
Html Ascii
Codes - A
Complete
List -
downloadable
php file
Linux
Anti-virus
Software -
is it
required?
Html Div
Help
[resolved] -
help with
the divs in
ipb
How To
Improve
Analytical
Writing (aw)
Skills In
Gre? -
Fluency,
organization
and
technical
English are
three utmost
important
How Do I Get
The Result
To
"stick&
quot; And
Add Html
Tags? - Help
please?
Google Has
Sloppy
Coders -
Can't
even code
proper HTML
[php] Clean
Code
Functions -
Clean up
your html
output from
php scripts
Gimp
Abstract
Signature
Tutorial -
Brushes
required
Kool Html -
Could anyone
tell me some
sites with
some kool
html on
them?
Seo And Php,
Do You
Really Need
Programing
Skills? - Do
you think
learning PHP
is a must in
order to
start doing
SEO??
Html 5 Draft
Report
Released -
Read the
changes from
html 4 here
Script Help
Required:
Undefined
Variable - A
fault I
cannot spot
in PHP
Where Is
There A Good
Site To
Learn Web
Html?
Creating
Navigation
For Html
Websites -
Have a
common
navigation
menu for the
whole
website!
Apply Your
Ninja Skills
At Work!
Html Legend
- Learn how
to create a
handy legend
with
HTML!
Html Code
Tester.
Online
Script
.php?id=html
Not Working
Help!
Php Or Just
Html? - i
want to
start
buliding my
website.
which is
better, php
or basic htm
A Small Html
Problem -
How to
display
foreign
characters
correctly
when
designing a
site.
Simple
Scripts In
Html And
Javascript -
Things like
BackgroundCo
lorChanger
and so
Make
$10
Money
Instantly Or
Free Domain
Of Your
Choice!
- Credit
Card
Required - I
will pay via
PayPal
personally
Truefusion
Shoutbox -
No Database
required!
;
Adapting
Html Code
Embed To
Work On
Phpnuke -
Help With
This Html
Code Pls
Html To Php
Convertor?
Html Cool
Codes?
The Best And
Free
Website/html
Editors +
Text Editors
- A good
collection&#
33; Check it
out.
Does Anyone
Know Where I
Can Get A
Free Html
Maker
where did
you learn
html from?
advertisement



Perl/cgi Help! - HTML skills required also.



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE