Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

GotToBTru's scratchpad

by GotToBTru (Vicar)
on Jun 15, 2010 at 13:25 UTC ( #844863=scratchpad: print w/ replies, xml ) Need Help??

XML to Hash

sub mapxml { my $xml = shift; my ($tag, $value, %xmlhash); my @lines = (split /\n/, $xml); chomp @lines; while (@lines) { my $line = shift @lines; ($tag,$value) = ($line =~ /<([\w:]+?\/?)>([^<]*)/); next if (! defined($tag) || (substr($tag,-1) eq '/')); if ($value =~ /[\w:-\\]+/) { $xmlhash{$tag} = $value; } else { my $contents = ""; while (1) { $line = shift (@lines); last if ($line eq '</' . $tag . '>'); $contents .= $line . "\n"; } $xmlhash{$tag} = mapxml($contents); } } return \%xmlhash; }

On the Subject of Off Topic

If Perlmonks decides to get more formal in its definition of off-topic, I'd suggest the following:

  1. Add "Off Topic" as a moderation selection, as an alternative to "Approve" or "Frontpage"
  2. Add "Off Topic" as consideration category, an alternative to keep/edit/reap/nada
  3. Allow users a selection to suppress nodes designated OT. This could be as simple as posting possible CSS language

Testing

use Test::Simple tests => 2; ok(1 == 1, 'Identity theorem'); ok( &ask eq 'yep', 'User response test'); sub ask { print "Are you a human?\n"; $answer = <STDIN>; chomp $answer; return($answer); }

Link to use as starting point for CSS/JS to color user names to reflect their age relative to me (based on the cb_author id):

CSS to display level

Code code for coding

use strict; use warnings; my $plaintext = 'We are discovered. Flee at once!'; my $key = 'CorrectBatteryHorseStaple'; print "Original message: $plaintext\n"; my $ciphertext = cypher($plaintext,$key); my $represent = $ciphertext; $represent =~ tr/[A-Za-z0-9] /*/c; print " Encoded message: $represent (* indicates non-alphabet characte +r)\n "; my $decoded = cypher($ciphertext,$key); print " Decoded message: $decoded\n"; sub cypher { my $plain = shift; my $key = shift; my $i=0; $key x= ( 1 + length($plain)/length($key) ); return join '', map {$_ ^ substr($key,$i++,1)} (split '',$plain); }

Stuff to Check Out


History

DatePointsPostsRankETA Next RankNext Rank
2010061500InitiateN/AN/A
20100910201NoviceN/AAcolyte
20101221503AcolyteN/ASexton
20110223908SextonN/ABeadle
2011041215013BeadleN/AScribe
2011080325025ScribeN/AMonk
2013020440037MonkN/APilgrim
2013093060048PilgrimN/AFriar
2014020390081FriarN/AHermit
201404281300113HermitN/AChaplain
201407211794154HermitN/AChaplain (1800)
201407231806154Chaplain20141030Deacon(2400)
201410042400203Deacon20141210Curate(3000)Rank
201412103023266Curate20150130Priest(4000)679
201503033620326Curate20150422Priest(4000)
201504074000358Priest20150709Vicar(5400)
201507205403530Vicar20151115Parson(7000)338
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 wandering the Monastery: (14)
As of 2015-07-29 14:10 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 (263 votes), past polls