Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: fortune

by zeno (Friar)
on Jan 26, 2001 at 16:23 UTC ( #54532=note: print w/replies, xml ) Need Help??


in reply to Re: Re: fortune
in thread fortune

davorg is right! So I modified my original, um, modification to include some nice HTML formatting to it. Here's the new code. Thanks davorg for getting me to fix it! -timallen
#!/usr/bin/env perl -w use strict; my $quip = ""; { $/ = "%%\n"; rand($.) < 1 && chomp($quip = $_) while(<DATA>); } print "Content-Type: text/html\n\n"; print "<html><head><title>Fortune Teller Says...</title></head>"; print "<body bgcolor=#CCFFFF>"; print "<h3>$quip</h3>" || "<font color=FF0000>Could not get quote</fon +t>"; print "</body></html>"; __END__
... followed by the original (hilarious) quips!

Replies are listed 'Best First'.
(ichimunki) Re4: fortune
by ichimunki (Priest) on Jan 26, 2001 at 16:58 UTC
    First, I had trouble with __END__, seemed to work better with __DATA__.

    Here is the same thing looking a little more perlish and minus the deprecated FONT tag and BODY attributes and not using header tags to provide large text. Putting style back in using CSS is left as an exercise for the reader.
    #!/usr/bin/perl -w use strict; use CGI qw(:standard); my $quip = ""; { $/ = "%%\n"; rand($.) < 1 && chomp( $quip = $_ ) while(<DATA>); $quip = $quip || 'Doomed! No Fortune Found.'; } print header(), start_html( -title => 'Fortune Teller Says...' ), p( $quip ), end_html(); __DATA__

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://54532]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-09-23 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (191 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!