Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
P is for Practical
 
PerlMonks

The Monastery Gates

 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

( #131=superdoc: print w/ replies, xml ) Need Help??
Donations gladly accepted
If you're new here please read PerlMonks FAQ
and Create a new user.

Want Mega XP? Prepare to have your hopes dashed, join in on the: poll ideas quest 2010  (Don't worry; you've got plenty of time.)

New Questions
Return $self, but what if I don't wanna?
on Mar 09, 2010 at 21:04
5 direct replies by asoftware
    Hi Monks, Usually when you are writing a method you make the return value $self, particularly important if you have modified one or more of the objects data members.
    What is the best way to return some other value, while still updating $self?

    Often I come across code where I work that does this sort of thing (Moose style OO).
    # The actual method to be called: sub calculate_foo { my $self = shift; $self->_calculate_foo(); return $self->foo; } # A private method that actually updates $self->foo sub _calculate_foo { my $self = shift; $self->foo($self->foo + 999); return $self }
    So my question's are these:
    1) Is it possible to update $self->foo while returning something other than $self, I doubt it. but asking just in case.

    2) If not, is the above example the correct 'convention' for returning arbitrary values from a method.

    3) When does it make sense to simply update an objects attributes, and expect the caller to use them instead of return values.

    Any thoughts you have on this subject would be greatly appreciated.
    -- Cam
HTML::Parser Skip Style Content
on Mar 09, 2010 at 15:33
1 direct reply by spickles

    Anyone know how to skip the entire content between two HTML tags? I'm using HTML::Parser, and I have figured out how to use the start and end subclasses to match on certain tags and manipulate them. If there is text within those tags I want to keep or modify, I print them to an output file. So I thought that if I matched on a style tag and simply returned (rather than printing the text to my output file) that it wouldn't be there. But now I understand that the text within the tags is processed by the separate subclass for text. What I'd like to do is match on the <style></style> tags and NOT print the text between them.

    #!c:/perl/bin/perl #This version allows the use of a filename specified on the command li +ne use strict; use warnings; package HTMLStrip; use base "HTML::Parser"; #system("cls"); my $output = "c:/perl/bin/parseOutput.txt"; if (-e $output) { unlink $output; } open PARSETEXT,'>',$output or die $!; my $p = new HTMLStrip; # parse line-by-line, rather than the whole file at once while (<>) { $p->parse($_); } # flush and parse remaining unparsed HTML $p->eof; close PARSETEXT; sub text { my ($self, $text) = @_; chomp($text); $text =~ s/#.*//; # comments $text =~ s/^\s+//; # leading whitespace $text =~ s/\s+$//; # trailing whitespace #Once the beginning comment if found, remove style if ($text =~ /^<\!--$/) { next unless ($text =~ /^-->$/); } #Print non-blank lines if (length($text) > 0) { print PARSETEXT $text . "\n"; } } #Process OPENING/STARTING HTML tags sub start { my ($self, $tag, $attr, $attrseq, $origtext) = @_; #We're only interested in dealing with table tags if ($tag =~ /^table$/) { print PARSETEXT "\n************* BEGIN TABLE ****************\ +n"; } if ($tag =~ /^tr$/) { print PARSETEXT "\n"; } if ($tag =~ /^td$/) { print PARSETEXT "\t"; if (defined $attr->{'class'}) { if ($attr->{'class'} =~ /alarmClear/) { print PARSETEXT "OK"; } if ($attr->{'class'} =~ /alarmSet/) { print PARSETEXT "ALARM"; } } } } #Process CLOSING/ENDING HTML tags sub end { my($self, $tag, $origtext) = @_; if ($tag =~ /^table$/) { print PARSETEXT "\n************* END TABLE ****************\n" +; } }
    ############################################################ ############################################################ HTML FILE CONTENTS <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>System Status</title> <style type="text/css"> <!-- /* colors to use: "CSI Blue" 004683 "CSI Red" 7e2d41 "CSI Grey" e5e5e5 "Liz Green" 00CC33 */ body { background-color: #FFFFFF; color: #004683; } dt { font-weight: bold; } #main { float: left; margin: 1em; } #menu { float: left; margin: 1em; font-family: sans-serif; background-color: #7e2d41; } #menu ul { list-style: none; margin: 0; padding: 0; } #menu li { margin: 1em; } #menu li a { color: #fff; text-decoration: none; } #menu li a { width: auto; } div.messages { /*width: 70%;*/ padding: 1em; margin-top: 1em; margin-bottom: 1em; font-size: x-large; border: thin solid black; } #messages { /*width: 70%;*/ padding: 1em; margin-top: 1em; margin-bottom: 1em; font-size: x-large; border: thin solid black; } /* TODO trash all these? */ .tallrow { padding-bottom: 6em; /*width: 70%;*/ } .input { /*width: 45%;*/ float: right; } .info { float: right; } /* TODO end of area to trash? */ table.bigdata { text-align: center; } div.boxer { padding: 1em; background-color: #e5e5e5; border: thin solid black; } td.label { text-align: right; padding-right: 1em; } td.labelInvalid { text-align: right; padding-right: 1em; color: red; } td.lineitem { text-align: left; } th { padding-right: 1em; } tr.spacer { height: 1em; } .section { text-align: right; } td.alarmSet { background-color: red; color:white; } td.alarmSet:after { content: "ALARM"; } td.alarmClear { background-color: #00CC33; } td.alarmClear:after { content: "OK"; } --> </style> </head> <body onLoad="setTimeout('reload()',60000)" > <div id="menu"><ul><li><a href="index.cgi">System Status</a></li><li>< +a href="netconf.cgi">Local Network</a></li><li><a href="rf.cgi">RF Co +nfiguration</a></li><li><a href="programfilter.cgi">Program a Filter< +/a></li><li><a href="remotenetconf.cgi">Remote Network</a></li><li><a + href="snmpconf.cgi">SNMP Configuration</a></li><li><a href="status.c +gi">System Health</a></li><li><a href="install.cgi">Install Software< +/a></li><li><a href="reboot.cgi">Reboot</a></li></ul></div><div id="m +ain" onLoad=setTimeout('reload()',60000)><h1>System Status</h1> <script type="text/javascript"> function reload() { window.location.reload(); } </script> <table class="bigdata"> <tr> <td class="label"><b>Timestamp</b></td> <td colspan="4" class="lineitem"> 2010:03:09 - 18:26:45 </ +td> </tr> <tr> <td class="label"><b>System Uptime</b></td> <!-- I'd like to use colspan="0" but IE sucks. --> <td colspan="4" class="lineitem"> 16 days 3 hours 5 minutes </td> </tr> <tr> <td class="label"><b>Software Version</b></td> <td colspan="4" class="lineitem"> 2.2.4 REL </td> </tr> <tr> <td class="label"><b>Serial Number</b></td> <td colspan="4" class="lineitem"> CFB90357-000000 </td> </tr> <tr> <td class="label"><b>Model Number</b></td> <td colspan="4" class="lineitem"> DSP85-C/P </td> </tr> <tr> <td class="label"><b>Item Number</b></td> <td colspan="4" class="lineitem"> CS10-377-403 </td> </tr> <tr> <td class="label"><b>Location</b></td> <td colspan="4" class="lineitem"> Unknown </td> </tr> <tr class="spacer" /> <tr> <th></th> <th colspan="2"> Band 1 (CELL) </th> <th colspan="2"> Band 2 (PCS) </th> </tr> <tr> <th align="right">Active Filter</th> <td colspan="2"><tt +>cgA0-0</tt></td><td colspan="2"><tt>pgA0B4B5F0C5-0</tt></td> </tr> <tr class="spacer" /> <tr> <th style="text-align:right">Power</th> <th> Down Link </th> <th> Up Link</th> <th> Down Link </th> <th> + Up Link</th> </tr> <tr> <td class="label"> In-band Input<sup><a target="_blank" href="help.html#1 +">?</a></sup> (dBm) </td> <td>-35.6</td><td>&le; -66.0</td><td>-43.4</td><td>&le; -66.0</td> </tr> <tr> <td class="label"> Measured Output<sup><a target="_blank" href="help.html +#2">?</a></sup> (dBm) </td> <td>18.6</td><td>&le; 4.0</td><td>22.8</td><td>&le; 4.0</td> </tr> <tr> <td class="label"> Composite Input<sup><a target="_blank" href="help. +html#4">?</a></sup> (dBm) </td> <td>-33.9</td><td>-43.4</td><td>-23.7</td><td>&le; -53.0</td> </tr> <tr class="spacer" /> <tr class="section"> <th>Gain Control</th> </tr> <tr> <td class="label">AGC Mode</td> <td colspan="2">On</td><td colspan="2">On</td> </tr> <tr> <td class="label">AGC Attenuation (dB)</td> <td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td> </tr> <tr> <td class="label">System Gain</td> <td>53.5</td><td>70.0</td><td>66.0</td><td>70.0</td> </tr> <tr class="spacer" /> <tr class="section"> <th>RF Alarms</th> </tr> <tr> <td class="label">Over Range</td> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> </tr> <tr> <td class="label">Oscillation</td> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> </tr> <tr> <td class="label">VSWR</td> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> </tr> <tr> <td class="label">Out of Band Overdrive</td> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> </tr> <tr> <td class="label">Low Signal</td> <td class="alarmClear" /> <td /> <td class="alarmClear" /> <td /> </tr> <tr> <td class="label">No Signal</td> <td class="alarmClear" /> <td /> <td class="alarmClear" /> <td /> </tr> <tr class="spacer" /> <tr class="section"> <th>System Alarms</th> </tr> <tr> <td class="label">Synthesizer Lock</td> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> <td class="alarmClear" /> </tr> <tr> <td class="label">Voltage</td> <td colspan="2" class="alarmClear" /> <td colspan="2" class="alarmClear" /> </tr> <tr> <td class="label">Temperature</td> <td colspan="2" class="alarmClear" /> <td colspan="2" class="alarmClear" /> </tr> <tr> <td class="label">Software</td> <td colspan="2" class="alarmClear" /> <td colspan="2" class="alarmClear" /> </tr> <tr> <td class="label">Hardware</td> <td colspan="2" class="alarmClear" /> <td colspan="2" class="alarmClear" /> </tr> </table> </div></body> </html>

    Regards,

    Scott
Split a binary file in pieces
on Mar 09, 2010 at 14:38
2 direct replies by ranrodrig

    Folks I need your help because I have several 128 MB binary files that I need to split into 10MB pieces and then join them later, but I'm not sure if split can do this with binary files?

    TIA for helping me to solve my ignorance

Server side computational suggestion
on Mar 09, 2010 at 13:59
5 direct replies by sherab
    Hello monks! I have been a perl developer for some time. Needless to say I use it every chance I get. What I am tasked with now is doing some hard core computational finance related tasks. I don't know how much many of you know about computing stock related data but the types of stats I need to come up with are numerous and these would have to be computed every day for numerous stocks and sometimes on the fly. It's massive number crunching. (It will need to be done everyday for charts, etc)

    I am all about the best tool for the job but I'm not sure that Perl represents my fastest choice with this kind of need. It may be the ONLY time in my life I have said that about, what I feel, is the best language ever.

    Does anyone know if Perl would indeed be worth using for this gargantuan number crunching task? I absolutely refuse to remove Perl from the equation. The site I am working on needs things like authentication and I have my mind made up about using Catalyst. I would think the only other way to handle it would be to still use Perl but to hand off the extremely heavy lifting to some C++.

    Any words of advice or input is appreciated.There is no other group's opinion I respect more than you monks.
File transfer abstractor?
on Mar 09, 2010 at 10:34
2 direct replies by suaveant
    Does anyone know of a remote file retrieval abstractor for Perl or that could be called from Perl? Some Googling ans CPAN searching isn't coming back with anything.

    I'm thinking something that basically lets you specify location, method and credentials and from there on offers a single interface whether it be ftp, ssh, sftp, http, local, email or whatever. Kind of like IO::Any, but Remote::File::Any

    I see a File::Remote which looks cool, but is not what I had in mind.

                    - Ant
                    - Some of my best work - (1 2 3)

use Shell
on Mar 09, 2010 at 01:45
3 direct replies by sharath
    #!/usr/bin/perl use Shell; my $sh=Shell->new; $sh->mail -s "hi" sharath@gmail.com it not working.it's gving syntax Error..I verified shell module is available in perl area.I am trying this bkz I donnt have sendmail oe Mime perl modules in my area..please resolve this ASAP
UTF8 and XML
on Mar 08, 2010 at 18:18
2 direct replies by clintonm9

    I am having some unicode issues with XML::Simple. I have wrote a test program to show my problem

    #!/usr/bin/perl use strict; use utf8; # A simple test to show the UTF8 problem my $parameters; push (@{ $parameters->{Request} }, { URI => '/HRM/EmploymentManager/AvailableOpening +s', Action => 'GET', ID => '123', Parameters => { Status => 'Test', }, }); # convert Perl hash ref into XML my $xs = XML::Simple->new(); my $x = $xs->XMLout($parameters, KeepRoot => 0, RootName => 'Requests' +); print $x; # convert XML into Perl hash ref my $xs = XML::Simple->new(); my $XML = $xs->XMLin($x,ForceArray => 0); # Look at the perl hash ref, there shouldnt be any my $temp = $XML->{'Request'}->{'Action'}; my $flag = utf8::is_utf8($temp); print "$flag ! $temp\n\n\n"; exit;

    I am trying to use iso-8859-1 and not use UTF8. Any ideas why the UTF8 Flag is on and to make XML::Simple not make UTF8 when sending iso-8859-1 in the headers

use of date n time functions
on Mar 08, 2010 at 01:13
5 direct replies by blackgoat

    Hi Monks!

    I have some data stored in text form which appears in the following format:

    mon_jan_01_16:00:33_t23.96-d568

    A number of such entries are present in my file. I need to pick out(thru regexp)the entry that is most recent. I, however, fail to understand how can the date and time functions be used in this case. Pls help me out...

    Thanks!

    BG

Dynamic Class Loading, Compilation, & Speed
on Mar 06, 2010 at 17:12
4 direct replies by zerohero

    I'm wondering if there is a better (safer, faster, etc.) way of dynamically loading a class by it's name, and then invoking the constructor (using the class name). The key is we don't want to have to say "use BAREWORD_CLASS", but want to get some of the same benefits. Here's what I'm doing now:

    sub creator_func { my ($class, $arg1, $arg2) = @_; eval "require $class"; if ($@) { print "Load error for class='$class': $@\n"; return; } my $new_obj = $class->new ($arg1, $arg2); return $new_obj; }

    Is this inefficient? Will it compile the perl class every time it hits the require statement?

Client/Server Question
on Mar 06, 2010 at 14:33
1 direct reply by commodorejim
    Hi everyone, I've recently started experimenting with PERL in the area of sockets and networks. I've gotten the two programs listed below working on my own machine (through localhost). However, I want to prompt the server to ask the client for a password, printing a message if the correct password is entered or not. The problem I'm having is how do I send the values I read in in the client program to the server program? I know how to check for these values but I'm stumped as to how to send the string that's entered client-side to the server-side. Or am I completely on the wrong track? Server Program
    #!/usr/bin/perl -w # server2way.pl - a server that reads from # and writes to a client use strict; use IO::Socket; use Sys::Hostname; my $sock = new IO::Socket::INET( LocalHost => 'localhost', LocalPort => 7890, Proto => 'tcp', Listen => SOMAXCONN, Reuse => 1); $sock or die "no socket :$!"; STDOUT->autoflush(1); my($new_sock, $buf); while ($new_sock = $sock->accept()) { while (defined($buf = <$new_sock>)) { foreach ($buf) { /^HELLO$/ and print($new_sock "Enter Name: \n"), l +ast; /^NAME$/ and print($new_sock "Enter Password: \n +"), last; /^DATE$/ and print($new_sock scalar(localtime), "\ +n"),last; print $new_sock "DEFAULT\n"; } } close $new_sock; }
    Client Code
    #!/usr/bin/perl -w # client2way.pl - a client that writes to # and reads from a server use strict; use IO::Socket; my $host = shift || 'localhost'; my $port = shift || 7890; my $sock = new IO::Socket::INET( PeerAddr => $host, PeerPort => $port, Proto => 'tcp'); $sock or die "no socket :$!"; # send message to server print $sock "HELLO\n"; print scalar <$sock>; my $name =<STDIN>; print $sock "NAME\n"; print scalar <$sock>; my $guess=<STDIN>; print $sock "DATE\n"; print scalar <$sock>; print $sock "NONE\n"; print scalar <$sock>; close $sock;
Monitoring the death of oversized Perl processes
on Mar 06, 2010 at 00:40
3 direct replies by arthurg
    I'm running Perl programs in mod_perl in Apache (2.2) on RHEL.

    Processes that grow too large ruin performance; I want a general way to prevent that. I don't mind letting an oversized process die, but I want to detect and log that event and provide some Web feedback to the user.

    Unix usage limits seem like the solution. The bash shell's 'ulimit' reports on and sets limits. They're inherited by children through fork() and exec(). So, for example, I can start Apache with the script

    #!/bin/sh ulimit -v 1024000 exec /usr/sbin/apachectl restart

    and limit each process' virtual memory to 1 GB. But detecting and handling the death of a process that tries to allocate more memory seems hard. There are some hints in documentation (http://search.cpan.org/~gozer/mod_perl-1.29/mod_perl_traps.pod#Perl_Modules_and_Extensions and http://www.perl.com/doc/manual/html/pod/perlvar.html) that by

    1) compiling Perl with -DPERL_EMERGENCY_SBRK (run "./Configure -DPERL_EMERGENCY_SBRK -des -Dprefix=~/localperl" before make) (It seems that the code between lines 1130 and 1279 of "malloc.c" run if PERL_EMERGENCY_SBRK is defined.)

    2) and defining $SIG{__DIE__} = \&deathHandler;

    one can run a little code in deathHandler before finally dying.

    Does this make sense? Will it work?

    Thanks

    A

awk 2 perl oneliner
on Mar 05, 2010 at 16:38
2 direct replies by space_agent

    Hello fellow seekers of perl wisdom,

    To me the following awk code is a piece of art. I got it from
    http://www.unix.com/shell-programming-scripting/130349-fgrep-grep-awk-help-scanning-delimiters.html
    I wonder if it is possible to make an equally easy to understand and fast perl oneliner:

     awk 'NR==FNR {a[$1];next} $1 in a {print RS$0}' file1 RS=">" file2 > output
    cat file1 name1 name2 name3 cat file2 >name3 text text text text >name1 some kind of text cat output >name1 text text text text >name3 some kind of text

    The task is to extract the names that are present in file1 from file2 plus all the text that follows it until the next ">" character. Speed is of importance as files may well be several hundred MB big. I would be eager to hear any comments on this.

    cheers space_agent

New Meditations
The story of a strange line of code: pos($_) = pos($_);
on Mar 09, 2010 at 18:37
2 direct replies by ambrus

    This meditation answers the question why writing pos($_) = pos($_); in a perl program could ever make sense.

    The following code tokenizes AMSrefs format. It is an excerpt from an actual code I wrote, modified slightly here to run standalone. (You don't need to know what AMSrefs is to understand this meditation, but it's a text format to describe bibliographic references in scientific publications, similar to BibTeX.)

    # tokenizer rules our @toktab = ( [qr/\\bib(?![A-Za-z])/, "bib"], [qr/\\(?:[A-Za-z]+|.)/s, "text"], [qr/\%.*\n\s*/, "comment"], [qr/\=/, "equal"], [qr/\{/, "begin"], [qr/\}/, "end"], [qr/\s+/, "space"], [qr/[A-Za-z0-9_\-\.]+/, "word"], [qr/[^\\\%\=\{\}\sA-Za-z0-9_\-\.]/, "text"], ); # tokens buffer our(@tokfd); # tokenize amsrefs input TOK: while (1) { for my $tokrul (@toktab) { my($re, $id) = @$tokrul; if (/\G($re)/gc) { push @tokfd, [$id, $1]; next TOK; } } pos($_) = pos($_); # <--- line 39 if (/\G./sgc) { # <--- line 40 die "internal error: amsref reader tokenizer cannot match inpu +t line: ($_) at" . pos($_); } elsif (/\G\z/gc) { # <--- line 42 last; } else { # <--- line 44 die "internal error: amsref reader tokenizer really cannot mat +ch input line: ($_) " . pos($_); } } # dump tokens for debugging for my $t (@tokfd) { my($i, $c) = @$t; $c =~ s/\n/\\n/g; printf qq(%-8s "%s"\n), $i, $c; } __END__

    If you run this code, you see that it dumps the type and content of each token it finds. When writing the code, I tested it exactly this way: I ran it on some example input and made it print the tokens it's got. I would think that if I made an error in one of the tokenizing rules, it would be easy to find out by examining the output. If a rule would match too much, I would see tokens in the output where there's no such token; if it would match too little, I would see either other tokens matching that part of the text, or, at worse, the fallback rule in line 41 kick in if no other rule would match.

    Indeed, I made some mistake in one of the regexes in @toktab, and this was such that regex would accidentally match the empty string. I'm not sure what the exact mistake was, but let's assume that I wrote [qr/[A-Za-z0-9_\-\.]*/, "word"], instead of [qr/[A-Za-z0-9_\-\.]+/, "word"],. Per what I said above, one would think that this mistake was easy to recognize: we'd get lots of extra tokens with type word with the empty string as content. Indeed, if you change the regex this way in this code, you get that result.

    That's not the output I'd see at that time though. If you both introduce this mistake in the regex and remove line 40 from the above code, so you get the following code, and run it, you'll see what I have got.

    You get no tokens, only the error message from line 45. Now that's clearly impossible. No matter how I'd mess up the rules in @toktab, I thought, the code could never run on that line, because if no rule matched then either there were some characters left in the input, in which case the match on line 40 would succeed and you'd get the error from line 41; or there's no characters left in which case line 42 would match and the loop would exit.

    So at this point, I ask you, dear reader, explain if you can how the code could ever run to line 45, despite that I just proved that impossible.

    The answer is the following. Once the buggy rule for word tokens matches the empty string at the end of the input, perl's rule against repeatedly matching the empty string kicks in, and the other regex in line 42 can't match the empty string at the end of input. If you don't know what this rule is, it's described in the section Repeated Patterns Matching a Zero-length Substring in perlre. (Without that rule, the buggy tokenizer wouldn't even reach the end of input, instead it would repeatedly extract empty word tokens at the first possible place.)

    That section from the manual also tells the solution to this problem.

    The additional state of being matched with zero-length is associated with the matched string, and is reset by each assignment to pos().

    That's why I added the statement pos() = pos(); to line 39 of the code. This way, even if one of the tokenizer rules are wrong and can match the empty string at the end of the input string, line 42 will still match the same empty string again, thus line 45 can truly never be reached and we get an informative output.

What I am paid for
on Mar 07, 2010 at 10:08
9 direct replies by Svante

    I recently read a piece of opinion from Kevin Partner, in which he asserted that he "owns" his code, and that someone who paid him to write it should not be allowed to use even snippets of it for further own developments or other purposes. I do not agree with this.

    He likened his code, especially his precious libraries, which he has invested a lot of time in to develop, to a craftsman's toolbox. Said craftsman would not leave behind his toolbox after doing his work.

    This analogy does not hold. Code is nothing but procedure. The analogy is rather between the code libraries and the craftsman's knowledge of what to do. If I employ a plumber to build a kitchen sink for me, no one would deem it objectionable when I watch how he does it and do it myself the next time. It may seem as if economic value was lost there, but my own working time has a value, too.

    If my own work (whatever that is) is worth 50 silver pieces per hour, and I take two hours to build something in my home, it has cost me 100 silver pieces. If a company decides not to pay an outside talent for developing their application but do it in-house, they pay their own developers instead. The company is thus rather indifferent on who does it, and if you have built a reputation of doing good work, they will pay you.

    Obfuscating your code, and threatening legal repercussions if the customer builds on it without you, just severely diminishes your work's worth for the customer. This damage, in turn, diminishes your own reputation. Reputation is your most valuable asset. Existing software solving a specific problem is interchangable, but ability to solve new problems is what defines the developer.

autobox performance:a real-world comparison
on Mar 04, 2010 at 15:33
3 direct replies by BrowserUk
New Cool Uses for Perl
Disentangling the English language
on Mar 08, 2010 at 17:31
1 direct reply by talexb
Old 3-d cubes rendering code
on Mar 07, 2010 at 13:42
0 direct replies by ambrus

    I found a perl program I wrote ages ago. This renders three-dimensional vector graphics (hollow cubes made of triangles) by hand using a z-buffer.

    Redirect the output to a file. It's a ppm image. View it with an image viewer.

    The rendering is not perfect, you can see some ugly horizontal stripes where two triangles are coplanar and overlapping. (Perlmonks suggests that "If something looked unlike you expected it to you might need to check out Writeup Formatting Tips" but that page doesn't help. Yes, I previewed the image again and again, but I have no idea how to fix it. So someone tell me how to fix it and improve the autosuggest system of this site.)

New Perl Poetry
/snow//g - a haiku
on Mar 04, 2010 at 13:10
0 direct replies by sierpinski
    On this day I wish To use a regex for snow Slash snow slash slash gee.
    /\ Sierpinski
New Monk Discussion
Server glitches implicated in some dup posts?
on Mar 09, 2010 at 13:11
1 direct reply by ww

    Lately (in ca 60 days < today -- 2010-03-09), I have been noticing an anomaly: my clicks on certain submit buttons (including "vote" in Newest Nodes, "preview" and "create" when creating a response to a parent node, and a few others (sorry, not logged as carefully as I should have) produce in response, rendering of the Gates (in the window of origin -- that is, where I clicked) instead of the expected outcome -- preview, create or vote cast..

    Anecdotal evidence in the CB and elsewhere, that others have also experienced this. In my case, it's occuring with w32 and linux vers of FFox, 3.5.n on both. My impression is that this "get the wrong page" phenomonon occurs most frequently -- but NOT exclusively -- when the site is exceptionally slow.

    A case in point is presently visible in this section; in my replies to id://827391.
    and, an instance I suspect, in cdarkes at id://827495 amd id://827494
    and -- who knows -- perhaps some of the items recently marked "please reap; inadvertent dup" (or words to that effect) from posters who are among the most senior of Monks.

    Full Disclosure: Though I am honored by inclusion among devils, I'm not sufficiently skilled to track down a suspected cause and propose a solution.

SoPW Moderation made easier
on Mar 08, 2010 at 10:49
2 direct replies by rovf
    I don't know how *you* usually deal with with moderation of new posts in SoPW, but I always do it like this:

    When I go to Seekers Of Perl Wisdom, I first scroll down near the end of the page to see whether there is something to moderate. This is because I think new posters want to have their posts generally available as soon as possible. Then I go to the top of the page to have a look at the recent submissions.
    I think this process could be made easier if we either

    • Have an internal link on the top of the SoPW page down to the section of messages to moderate (if there are any),
    • Place the list of messages to moderate AHEAD of the other messages.

    -- 
    Ronald Fischer <ynnor@mm.st>
Login:
Password
remember me
What's my password?
Create A New User

Chatterbox?
[Boldra]: (sorry, was away) Yes, the first example is reading directly from the hashref created by moose - but I haven't seen anything in moose doc that says such a hasref mirrors the attributes in a reliable way
[Boldra]: The single access method is pretty common moose style.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (20)
BrowserUk
Corion
GrandFather
planetscape
marto
jdporter
almut
jethro
dHarry
Hue-Bond
rovf
Boldra
Ratazong
chanakya
ssandv
Felix2000
amasidlover
LinuxMercedes
im2
wdsaeghe
As of 2010-03-10 10:21 GMT
Sections?
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information?
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes?
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers?
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth?

The code I'm most proud of is:

A small script automating my daily work
Some production code used in my company
A CPAN module used by thousands of other programmers
An elegant implementation of a complicated algorithm
A really clever obfuscation
My first Perl program
A feature deep inside the PerlMonks code
My contributions to the Perl5/Perl6 core
My contributions to Parrot
At least 5 of the above
Not existent - pride is a sin
Something else

Results (310 votes), past polls