RE: I use CGI.pm for
by royalanjr (Chaplain) on Jun 08, 2000 at 00:05 UTC
|
Call me crazy, but I generally do not let CGI.pm do my
HTML. I prefer to write that out myself. Being new, I know
I have not explored all its possibilies yet though. I do use
it to pass my parameters around.
Roy Alan
"I quit; I concede. Tanj on your silly game!" -- Louis Wu
| [reply] [Watch: Dir/Any] |
|
Ok, you're crazy. :)
I guess I'm worse cause I still use the "cgi-lib.pl compatility mode" with ReadParse(*in); Now is that lame or what?
#!/home/bbq/bin/perl
# Trust no1!
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
Not to mention, with some creative map use, you can create dynamic tables and such pretty easy, while not breaking the stylish print 'some','things','in','a','row'; :-)
use CGI;
my $cgi = CGI->new;
print $cgi->header,
$cgi->start_html('Times Tables'),
$cgi->table( { -border => 1 },
( map {
my $r = $_;
$cgi->Tr( ( map {
$cgi->td( $_ * $r ),
} 1 .. 50 ) ),
} 1..50 ) ),
$cgi->end_html;
And for the obfuscated lovers in all of us (some people would call the above obfuscated.. slackers:-)
use CGI;my$cgi=CGI->new;print##
$cgi->header=>$cgi->start_html#
('Times Tables')=>$cgi->table(#
{-border=>1}=>(map{my$r=$_;$cgi
->Tr((map{$cgi->td($_*$r)}1..50
))=>}1..50))=>$cgi->end_html;##
--
Casey
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
|
Sticky Fields?!?
*pulling at my hair in despair, dropping to my knees*
So much to learn!!!
Roy Alan
"I quit; I concede. Tanj on your silly game!" -- Louis Wu
| [reply] [Watch: Dir/Any] |
|
|
Try it you'll like it. I certainly do. It takes a little
bit to get used to but the shortcuts for creating multiple
table rows and table data are invaluable. I certainly don't
know all it can do but the little that I do know sure
seems to go a long ways. It is also easy to switch from using
CGI.pm notation for HTML to simple here documents, if I
want to write out HTML by hand.
| [reply] [Watch: Dir/Any] |
|
Personally, I use a mix of it, pending on what i shall do and who i am writing it for. Sometimes I find it easier to use the HTML tags rather than the shortcuts, especially when i make complicated tables. And there's always the option of a external HTML file and use regexps to insert variables:
open(HTML, "<a_file.html") or die "cant open HTML file: $!\n";
while($row = <HTML>) {
$row =~ s/---(.*?)---/eval $1/eg;
print $row;
}
close HTML;
Which will look for ---$variablename--- in the HTML code and replace it with the variable (as if you didnt know ; ))
I also use HTML comment flags to insert more complicated structures. I've written a rather simple Web-based discussion forum using this technique, which allows the administrator of the site to change the design without knowing any Perl at all. | [reply] [Watch: Dir/Any] [d/l] |
|
RE: I use CGI.pm for
by JanneVee (Friar) on Jun 08, 2000 at 00:48 UTC
|
Hmm.. I actually never use CGI.pm to generate my form tags. But handle them. I also use CGI.pm for header generation. (Cookies and expirydates and such!) | [reply] [Watch: Dir/Any] |
|
I use it to generate some of my html and handle the parameters. I prefer to do my own HTML outside of the <head> tags though. hidden() makes things easier occasionally, and I do use that.
CGI.pm header generation is very nice, though.
| [reply] [Watch: Dir/Any] |
|
I use it to generate some of my html and handle the parameters. I prefer to do my own HTML outside of the <head> tags though. hidden() makes things easier occasionally, and I do use that.
CGI.pm header generation is very nice, though.
| [reply] [Watch: Dir/Any] |
RE: I use CGI.pm for
by buzzcutbuddha (Chaplain) on Jun 08, 2000 at 16:13 UTC
|
Working at a web design company, I have always strived to keep the design and the code
seperate, especially because you often have clients who want to change the design of their
page often.
The other consideration is that HTML recently changed to XHTML, a subset of XML, and I haven't
heard anything stating that cgi.pm is up to date with the new standard yet.
If you want to know more about XHTML, I suggest you check out:
- W3C's Explanation of XHTML
- Mozquito.org which has already
created the first IDE for XHTML.
Sebastian Schnitzenbaumer and Cassandra Greer worked with other authors to produce Wrox's first book on XHTML.
cheers! | [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
XHTML, is nice... but the <br /> (br with a space then the empty element delineating slash) thing seems like a
bit of a hack which is neither XML nor HTML... then again,
I have only fooled with XML and never really made a full
app with it. And who know which if any browsers would barf at such a syntax. Mad love to the everything engine, though.
On the topic of the poll, I must be honest and say I've
used CGI.pm to generate entire pages, just do forms, and
parse form variables from forms I wrote by hand. The other
day in irc, chromatic gave me the tip of HTML::Template
which really helps things out when trying to separate
formatting (HTML) from code. I highly recommend it. It
shortened my latest job by at least 100 lines.
| [reply] [Watch: Dir/Any] |
|
Actually, since I have started learning XHTML, I have used the <br /> as in my post here, and I have
yet to see a browser complain or improperly render the layout. And as far as I remember, XML does use the
space and closing slash on empty elements. I don't know how far XHTML will be accepted in it's current
incarnation, but we'll see. I guess the biggest reason I don't use cgi.pm for the actual layout is because
you can't specify with DTD you want to use. I guess that's possible with HTML::Template? I need to read more
on that.
| [reply] [Watch: Dir/Any] |
RE: I use CGI.pm for
by perlcgi (Hermit) on Jun 14, 2000 at 21:06 UTC
|
MY CONFESSION
Bless me brothers for I have sinned...
I used Frontpage Express 6 times to create HTML. I just embedded my variables in the html, and spat it out as a HERE doc. Brothers... I also told the following lie:
meta name=Generator content=mycgi.pl
It felt quite good.
| [reply] [Watch: Dir/Any] [d/l] |
RE: I use CGI.pm for
by Punto (Scribe) on Jun 08, 2000 at 07:42 UTC
|
I didn't know cgi.pm could be used to generate html and form tags. Where can I find a simple, easy and nice tutorial for that? :-)
| [reply] [Watch: Dir/Any] |
|
Here's the official cgi.pm site.
There's also a book which i can recommend, The official guide to programming cgi.pm. written by L. Stein who wrote the module. You can obtain info about it at the page or at Wiley.
/wonko
| [reply] [Watch: Dir/Any] |
RE: I use CGI.pm for
by RichardH (Sexton) on Jun 14, 2000 at 17:21 UTC
|
Very rarely do we use CGI.pm to generate HTML at the site I work at. We try to seperate all the interface design out of the programming logic. We have 2 html programmers and 3 perl programmers, and we leave as much of the html as possible to the html programmers. We try to avoid situations where they have to directly access our perl code. This makes updates and debugging much easier for both groups. Of course, there are times when embedding html inside perl is simply easier and faster, but that seems to be the exception, not the rule. | [reply] [Watch: Dir/Any] |
RE: I use CGI.pm for
by anmaco (Novice) on Jun 10, 2000 at 01:12 UTC
|
Excuse me wise monks - but what is different about CGI in the afternoon? OK Ok I'm joking, please don't give me a bad vote - but what is CGI.pm? | [reply] [Watch: Dir/Any] |
|
CGI.PM is a module which makes your life much easier if you are dealing with CGI scripts. It is a part of the standard Perl distribution. See my post above for the link to the official cgi.pm page, and you will find out why so many use it ;)
/Wonko
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
I thought it stood for "pre-menstrual".........
"all was created from /dev/null and shall return to /dev/null"
| [reply] [Watch: Dir/Any] |
|