Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
#!/usr/bin/perl -wT ######################################################### # Muse # A "Web of Content" Manager by Adrian P. Dunston # # This is a sort of dumbed down single user of the # Everything Engine that Perlmonks runs on. # (www.everydevel.com) # # Write different nodes or "musings" and link them # together by surrounding certain words with [brackets]. # In the case of the last sentence, the word "brackets" # links to the node of that title. ######################################################### use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); start(); sub start { my $cgi = new CGI; my $output; my $node_text; my $node = param("node"); my $text = param("text"); print $cgi->header; # Untaint ($node) = $node =~ /([A-Za-z0-9 -_.,?]{1,30})/g; # If text has been passed, put it into its node. if ($text) { open(NODE, ">data/$node.musing") or die "Couldn't open data/$n +ode.musing for writing because $!"; print NODE $text; close NODE; } # If the user wants to see a node, show it to him with a form for +editing it. if ($node) { if (open(NODE, "data/$node.musing")) { $node_text .= $_ while <NODE>; $output = $node_text; $output =~ s|\[(.+?)\]|<a href="muse.cgi?node=$1">$1</a>|g +; $output = "\n\n<table width=\"65\%\" style=\"margin-left: +50\"><tr><td>\n" . $output . "</td></tr></table>\n\n"; } else { $output = "There is currently no musing \"$node\". You ar +e welcome to create your own."; } $output = "<html>\n<head><title>$node - Muse</title></head>\n< +body>\n" . "<b style=\"font-size: 18pt\">$node</b><br><br>$output\n<b +r><br><br>\n"; $output .= '<form action="muse.cgi" method="post">'; $output .= "\nEdit the node:<br>\n<textarea name=\"text\" rows +=\"5\" cols=\"50\">$node_text</textarea><br>\n"; $output .= "<input type=\"hidden\" name=\"node\" value=\"$node +\">\n"; $output .= "<input type=\"submit\" value=\"Edit Musing\">\n</f +orm>\n"; $output .= "<hr>\n"; $output .= '<form action="muse.cgi" method="post"><input type= +"text" name="node"><input type="submit" value="New Musing"></form>'; $output .= '[ <a href="muse.cgi">Muse</a> ] '; $output .= "</body>\n</html>"; # Otherwise, show him the list of nodes in the system. } else { my @file = <data/*.musing>; foreach (@file) { s|data/||; # Get rid of data/ s/\.musing//; # Get rid of .musing $output .= "<li><a href=\"muse.cgi?node=$_\">$_</a></li>\n +"; } $output = "<html>\n<head><title>Muse</title></head>\n<body>\n< +u><b style=\"font-size: 24pt\">MUSE</b></u><br><br>\n" . "Musings: \n<ul>\n$output\n</ul>"; $output .= '<form action="muse.cgi" method="post"><input type= +"text" name="node"><input type="submit" value="New Musing"></form>'; $output .= "</body>\n</html>"; } ## OUTPUT print $output; }

In reply to Muse - Personal Interlinked Encyclopedia Builder by Pedro Picasso

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (3)
    As of 2015-07-05 05:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (60 votes), past polls