Replacement for - Page 2

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Re: Replacement for

Quoted text here. Click to load it

Except this: Considering what I know about (X)HTML generated by JSF and
RichFaces (both 'state of the art, enterprise-grade HTML generation
toolkits/ frameworks'), the statement that 'nowadays, we use
attribute-free hand-written HTML5 formatted only via CSS' must have been
made by some guy living on a different planet: Maybe, some people do
that, but it certainly isn't the norm for web GUIs, which are rather
centered around "use bits and pieces of everything" (favoring more
conservative approaches over more modern ones where possible) _provided
the result works_.

Re: Replacement for

Quoted text here. Click to load it

You could probably do that using the HTML::Tree parser and then writing
a proper printer...

Chiming in a bit late in the discussion, is terrible terrible for
anything facing the internet in general.  Good luck sanitizing any kind
of input, or quoting stuff correctly in the generated html.

That's one area where template systems like TT shine, they have everything
needed to enlighten you to the multiple problems properly encoding stuff
to write non-broken pages with no XSS issues...

(big fan of perl-dancer + template toolkit these days... the RESTful nature
of the engine being a big plus)

Re: Replacement for

espie@lain.home (Marc Espie) writes:


Quoted text here. Click to load it

That this is something you consider an almost insurmountable obstacle
doesn't mean everybody shares your opinion on that.

Re: Replacement for

Quoted text here. Click to load it

I don't think this would be very useful: While this could be used to
reduce the amount of redundant information in the markup, it couldn't
recover semantic information available in the code which generated the
HTML. Eg, another form of the same application is generated by the
following code:

sub form()
    return ($cgi->start_form(-action => 'vmecs-ctrl.cgi'),

            $cgi->table(8, #{border => 1 },


vmecs_ctrl_pads is

sub vmecs_ctrl_pads()
    my @output;
    @output = map { vmecs_ctrl_pad($vmecs); } @vmecs_names;
    unless (@output) {

    return @output;

and vmecs_ctrl_pad is a subroutine returning a list of strings which
make up the HTML for displaying various parameters of 'a vmecs' and some
buttons used to control it.

NB: This is a general problem of 'reverse compilers'. They basically
produce 'assembler code with a different syntax'.

Re: Replacement for

Quoted text here. Click to load it

With TT you can make a macro to do this. That's what I've been doing the
past years; I have several macros that make building forms very easy,

Conditional execution and repetition are all easy to do with

John Bokma                                                               j3b

Blog:        Perl Consultancy:
Perl for books:

Re: Replacement for

Quoted text here. Click to load it

I would replace the non-HTML parts of with Plack.

Using the CGI handler it is easy to produce CGI scripts and it is easy
to later "upgrade" to something persistent.

Using Plack::Request and Plack::Response you get almost the same
internal features than the request handling parts of At least
easy access to request parameters and cookie handling.

It been years since I have used the HTML-parts of Most of the
time I would use a real template system (Template::Toolkit) and write
the HTML by hand.  

For an API comparable to's HTML interface I think HTML::Tiny can
be used instead.


Re: Replacement for

Quoted text here. Click to load it

As of now (perl 5.18.0), has neither been removed from the perl
core nor is listed in the 'future deprecations' section. AFAICT, there's
a bunch of marketing clowns^W^Wweb devsloppers who strongly market their
opinion that it ought to be removed - with the fact that "Oh my fancy
darling!" uselessnesses a la Mo "my antlers are bigger than yours!" ose
being all but unusuable in CGI programs certainly being a mere
coincidence - but so far, that's it.

I'm using it, not because it is anything in particular, just because it
is available and works (within its limits). If you want something
specific (eg, HTML-generation via templates), I suggest that you look
for a module providing what you want to have. For as long as does
what you need, there's seems to be little reason to stop using it:
Customers generally don't care about what developers consider
fashionable today.

Re: Replacement for

Quoted text here. Click to load it

I don't think it's deprecated, as such; there are just newer and simpler
modules for doing the same job.

CGI itself, however, probably should be considered obsolescent. Running
a persistent application process which communicates with the web server
via FastCGI or proxied HTTP generally scales better, and often allows a
better code structure. (Note that supports both FastCGI and

Quoted text here. Click to load it

As far as parsing incoming requests goes, nowadays it would be foolish
to use anything which isn't based on Plack. Plack is a generic
web-server-interface module; it allows you to switch from a CGI backend
to FastCGI/HTTP/mod_perl/whatever without changing anything else in your
code. Plack::Handler::CGI is the CGI interface; the documentation for
that module explains how to create a CGI script that invokes your
application properly.

Plack itself provides a rather low-level interface to incoming requests
(the interface is called PSGI, and is designed to be as simple as
possible). It also provides Plack::Request, a slightly higher-level
interface; if you're used to using, a Plack::Request looks very
much like a CGI request object, so you can probably stick with that.
There are also a number of frameworks which layer on top of Plack to
provide more sophisticated facilities, such as mapping incoming requests
to methods on objects and managing database connections and sessions and
so on.

As far as output goes, I would recommend using, either
directly or through one of the frameworks which supports it. It takes a
very different approach from rather than calling methods which
generate HTML, you write HTML templates (generally in their own files)
which you can then fill in with values from your program. If you'd
rather stick to a CGIish interface, I'm sure there are modules on CPAN
which will do that; a quick look finds HTML::Stream, which looks pretty


Re: Replacement for

On 10/22/13 06:51, Bernie Cosell wrote:
Quoted text here. Click to load it

I don't think I'd be keen to use any module that was not old enough and  
widely used enough to accumulate a few neurotic haters.

Quoted text here. Click to load it

I have no plans to stop using CGI, because my needs on that front are  
also very simple and it mostly serves them well.  And it is pure perl,  
so if worst comes to worst you can run your own copy of it until support  
for Perl 5 completely goes away.

On the other hand if I were learning from scratch, I might pick  
something different to learn.  The problem is there are so many flavors  
of the day, how would you pick the one for it to be?


Re: Replacement for

Στις 22/10/2013 16:51, ο/η Bernie Cosell έγραψε:
Quoted text here. Click to load it

Maybe for you if you think so.
I can do everything with CGI, faster that you can do with these fancy  

Re: Replacement for is a lifesaver, a true work of genius. I use it for all my
websites and make great money with it.  

Thank you, Lincoln Stein!

What exactly is wrong with


Quoted text here. Click to load it

Site Timeline