daniel <[EMAIL PROTECTED]> writes:
[ ... ]
> for example, mail() is a php function that sends mail to someone.
> this capability is available in perl, but requires much more work on
> your behalf. in perl, you have to open a pipe to your mail binary,
> write to it and then close the pipe.
eh, no, if you're sending a mail with Perl, you'll probably want to
do:
perl -MCPAN -e 'install Mail::Mailer'
and read the documentation for that module.
> i love perl. it's the shiz-nit when it comes to writing
> log-parsers, or system administration tools, but for my money, php
> is just faster and easier to use for the web.
with the CGI module, good abstractions and a good plan, perl is
extremely nice for the web. the main problem with people writing
web applications is that they seem to think that printing out HTML
with "print" is something you'll need to do here and there in every
other script.
to deal with our machine database at work, we have something that
looks a lot like this:
my $page = new HTML::Page;
$page->attribute('title', 'My title');
$page->attribute('header', 'First header (automatically h1)');
$page->attribute('leadin', 'The first "teaser" paragraph');
my $part = new HTML::Page::Part;
for my $node (@hostlist) {
next unless $node->attribute('retired');
# reblessing is also an option.
push @nodelist, new HTML::Host $node;
}
@nodelist = sort {
$a->attribute('retired') <=> $b->attribute('retired)
} @nodelist;
$part->attribute('header', 'retired hosts (automatically as a h2)');
$part->attribute('nodelist', @nodelist);
$part->attribute('keylist', qw|name jack retired|);
$page->add_part($part);
$page->display()
you construct a page as a series of parts, where each part has a
given set of characteristics and some data in it. the Part and Page
modules both inherit a bit of HTML-crud so they can produce valid
HTML or XHTML depending on the use. for our tasks, CSS does all the
formatting.
but, the point is more that the CGI (which isn't formally CGI due to
mod_perl) doesn't contain a single piece of HTML. achieving this
with PHP and "include" is butt ugly, but it will get less ugly when
PHP finally gets a somewhat decent object system.
[ ... ]
--
Terje
--
[EMAIL PROTECTED] mailing list