Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Bad Religion!

by zentara (Archbishop)
on Jul 23, 2011 at 11:44 UTC ( [id://916305]=note: print w/replies, xml ) Need Help??


in reply to Bad Religion!

I was musing to post a similar meditation to yours, based on a quote I saw by Einstein, and it seemed to remind me of the problem. I decided not to make the post, because I'm not an XPWhore ;-), but your node seemed like an invitation from the Tao. :-)

Theory is when you know all and nothing works. Practice is when all works and nobody knows why. (Albert Einstein)

As it relates to manipulexity and whipuptitude and religion, the modules work well in practice, but very few know why. Whearas, back in the pre-module days of Perl4, everyone could see why, but nothing worked. :-) The best example is the CGI module, try using the often seen manual Perl4 cgi readparse code

sub ReadParse { local($name, $value, $pair, $buffer, @pairs); if ($ENV{'REQUEST_METHOD'} eq 'GET') { @pairs = split(/&/, $ENV{'QUERY_STRING'}); } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # @pairs = split(/&/, $buffer); # } else { $Error_Message = "Bad request method ($ENV{'REQUEST_METHOD'}). Use PO +ST or GET"; return(0); } foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ s/\n//g; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\n//g; $value =~ s/<!--(.|\n)*-->//g; # disallow SSI $in{$name} = $value; } return; }
and compare it to
use CGI; my $query = CGI->new(); my @names = $query->param;
The second modular one almost always works, but the average programmer does not know why. The first, allows the programmer to see why, but it seldom works out in the real world anymore.

Other modules follow a similar course, try writing your own program to do mail with multiple attachments, then compare it's ease and functionality to code written using MIME::Lite. Or try writing your own html parser code.

There is no Bad Religion, in a world of religous freedom. There is just your religion and then there is the other guy's. The first step toward religous intolerance, is to start yelling the other guy has a bad religion.

It is true, some religions put you on the path to enlightenment faster, but maybe some people can't handle a quick awakening, so the slow paths to enlightenment are still needed.

Update: just to prove I'm susceptible too, see Gmail ssl pop mail stopped working. (SOLVED) , where my overlooking a simple thing like Content-type in the header, causes my manual code to fail, where the module worked!!


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found