in reply to appending to html at beginning

This is what you're supposed to do

use CGI (); my $q = CGI->new; my $navn = $q->param('navn'); my $navn2 = $q->param('navn2'); my $adj1 = $q->param('adj1'); my $bann1 = $q->param('bann1'); ... print $q->header, $readystory;

Replies are listed 'Best First'.
Re^2: appending to html at beginning (don't use CGI)
by haukex (Archbishop) on Feb 03, 2017 at 11:43 UTC

    Hi Anonymous,

    That's how I would have done it too, years ago* - now, CGI's own documentation says:

    CGI.pm is no longer considered good practice for developing web applications, including quick prototyping and small web scripts. There are far better, cleaner, quicker, easier, safer, more scalable, more extensible, more modern alternatives available at this point in time. These will be documented with CGI::Alternatives.

    * Update: Okay, I admit I have sinned more recently than that. But only because (I thought) I knew what I was doing :-) And I still wouldn't recommend CGI to newcomers, who are more likely to misuse the module.

    Regards,
    -- Hauke D

      Did you look at the op? Op wrote and ran a cgi program. But is hand parsing...reinventing the cgi.pm module-- cgi module is best for doing that; every time you quote that when if doesnt apply is trolling
        Hey :-)
        Wow Ok, Got a lot to learn.. Didnt know that Matts guestbook script was such risky business... (altho my webserver is very dear to me - its just a personal playground, and I take a backup often, besides - I think the hiawatha webserver should be pretty secure) - But wow - many interesting suggestions - "swapping" file content with a temp text file seems actually quite understandable - but then - wow - the idea with a separate text file just listing all the stories is also a gem - because then one could - have links to a html file with all the different $names of peoples stories - so instead of just all stories being listed - one could click on someones name and their story would come up, that would be very cool.
        Anonymous Monk: yeah, probably better to just start from scratch listing all the $variables - eh stupid question, why do you all put "my" in front of the scalars?

        Hi Anonymous,

        cgi module is best for doing that

        Plack, Catalyst, Dancer2, Mojolicious, and more... (Update: As hippo pointed out, CGI::Minimal, CGI::Lite, or CGI::Simple)

        - versus -

        A module that is no longer recommended by its own documentation, and was removed from Perl's core. I didn't even say the module was summarily bad, just that it shouldn't be recommended for newcomers/new developments.

        You're using some strange definitions of "best" and "trolling" ;-P

        Regards,
        -- Hauke D