Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Mad Libs Script

by wolverina (Beadle)
on Apr 06, 2001 at 03:35 UTC ( #70345=perlquestion: print w/replies, xml ) Need Help??
wolverina has asked for the wisdom of the Perl Monks concerning the following question:

Hi.. ive been looking all over the web for mad lib script that works. Does anybody have one.. including the input and story files? That would really be cool. Thanx. Lisa

Replies are listed 'Best First'.
Re: Mad Libs Script
by merlyn (Sage) on Apr 06, 2001 at 07:45 UTC
Re: Mad Libs Script
by tadman (Prior) on Apr 06, 2001 at 03:49 UTC
    Perhaps you could be more specific as to how this should work. Example URLs of other scripts that do what you want would be a good start.
      Well.. here's a link that has a script called web libs. However, they don't include the input or story files, so i'm not sure exactly how to lay out the variables in the input file. Here's the link. I'm confused, because you call once, and it brings up the input form, then you hit submit, which calls up again.. and this time, gives the output with the inserted words. So i'm like real confused. But any mad libs type script would be cool. Lisa.
        The basics of this are taking input from a Web form and putting it into a text template and then displaying the output. This is pretty much standard fare for Perl CGI.

        The reason the script calls itself is so that the program that produces the form is also the program that processes the responses. It's efficient and perfectly valid. What the CGI does is check for the form submissions, and if they aren't there, it shows you the form. If they are there, it shows you the result.

        All the code you need is there on the page you sent me under Files. Maybe you are having trouble setting it up?

        In the example file, they are using HTML comments to position the words. You won't be able to see them if you're trying to view the file in your Web browser and it is showing up as HTML. Use Notepad or an equivalent instead.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://70345]
Approved by root
[marto]: there are many, to this day.
[ovedpo15]: @Corion Yes I use the regex you showed me. its very good regex. although now i need to know that substring unit that comma
marto mad corrections to one around 18 months ago
[ovedpo15]: my code checks the value after that comma, if it isn't valid it will remove it. so I would like to remove the substring after that comma meaning getting the string before comma.
[hippo]: Are you sure that Text::CSV_XS isn't already installed at your work? It's such a useful module that it might well be there.
[marto]: pointing out the advantages of cpan modules is well worth in, as both developer and $client/$company benefit greatly
[Tux]: $src =~ m{^(.*),(.*)$/ and $2 !~ $valid and $src = $1;
[Tux]: s,/,},

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2018-05-27 10:51 GMT
Find Nodes?
    Voting Booth?