<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2287077212528060224</id><updated>2011-04-21T23:55:27.128+02:00</updated><category term='meta'/><category term='cgi'/><category term='ids'/><title type='text'>Perlamentations</title><subtitle type='html'>Perl-related stuff and beyond (but not much)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://perlamentations.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://perlamentations.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>darko</name><uri>http://www.blogger.com/profile/00637012390696605561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2287077212528060224.post-8896190280809790355</id><published>2009-05-09T13:02:00.003+02:00</published><updated>2009-05-09T13:09:48.432+02:00</updated><title type='text'>Some say Perl is ugly</title><content type='html'>Some say Perl is ugly because is uses a lot of non-alphabetical characters in its syntax. Well, I think that approach is stupid. In effect it's the same as saying that russian is ugly because it's written in cyrillic. What kind of argument is that? What about all those people who speak russian? Are they not-really-smart because they write it in cyrillic? I don't understand it. I never will. It would be okay if Perl was ugly because you have to write the for loop in some uber-complex-assembler style. Ok, that's ugly and non-trivial. On the other hand, people that object to the sigils use funny nomenclature in their programs; combination of hungarian notation and camelCase. I cannot read it. It's ugly. (Sarcasm mode turned on.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2287077212528060224-8896190280809790355?l=perlamentations.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlamentations.blogspot.com/feeds/8896190280809790355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2287077212528060224&amp;postID=8896190280809790355' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/8896190280809790355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/8896190280809790355'/><link rel='alternate' type='text/html' href='http://perlamentations.blogspot.com/2009/05/some-say-perl-is-ugly.html' title='Some say Perl is ugly'/><author><name>darko</name><uri>http://www.blogger.com/profile/00637012390696605561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2287077212528060224.post-8705826967780226364</id><published>2009-05-07T15:38:00.001+02:00</published><updated>2009-05-07T22:46:06.488+02:00</updated><title type='text'>Extract base path</title><content type='html'>Simple solution to a Delphi &lt;a href="http://delphi.about.com/b/2009/05/06/delphi-programming-challenge-extractbasepath.htm"&gt;task&lt;/a&gt;: extract base path from two paths:&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;pre class="brush: perl; toolbar: false; gutter: false"&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;# extract_base_path.pl - extract base path from two paths&lt;br /&gt;# http://delphi.about.com/b/2009/05/06/delphi-programming-challenge-extractbasepath.htm&lt;br /&gt;# dprelec, 2009-05-07 &lt;br /&gt;&lt;br /&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;&lt;br /&gt;my $path1 = '/usr/bin/perl/lib/';&lt;br /&gt;my $path2 = '/usr/bin/perl/';&lt;br /&gt;&lt;br /&gt;my @parts = split('/', $path1);&lt;br /&gt;my $last = '';&lt;br /&gt;my $re = join('|', reverse map { $last .= $_ . '/'; $last } @parts);&lt;br /&gt;&lt;br /&gt;if ($path2 =~ /($re)/) {&lt;br /&gt;    print $1, "\n";&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2287077212528060224-8705826967780226364?l=perlamentations.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlamentations.blogspot.com/feeds/8705826967780226364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2287077212528060224&amp;postID=8705826967780226364' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/8705826967780226364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/8705826967780226364'/><link rel='alternate' type='text/html' href='http://perlamentations.blogspot.com/2009/05/extract-base-path.html' title='Extract base path'/><author><name>darko</name><uri>http://www.blogger.com/profile/00637012390696605561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2287077212528060224.post-899961045175228533</id><published>2009-04-30T17:44:00.006+02:00</published><updated>2009-05-05T16:58:14.175+02:00</updated><title type='text'>HTML::Mason is easy</title><content type='html'>For years we've been using HTML::Template and HTML::Template::Expr modules on our site, and it all worked pretty well. In the last few months I've been implementing some complex form validators with items that appear on the site based on non-trivial URI rules.&lt;br&gt;&lt;br /&gt;I need some template engine that I could program the complex presentation part with, so I choose HTML::Mason. Being that our site is served by a Perl daemon process, I can't use $r or plethora of Apache2 modules inside my templates but without that HTML::Mason is powerful enough and it works pretty well. Combining the new template engine with some Moose-based objects saved me couple of months of development time. Hooray for HTML::Mason!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2287077212528060224-899961045175228533?l=perlamentations.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlamentations.blogspot.com/feeds/899961045175228533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2287077212528060224&amp;postID=899961045175228533' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/899961045175228533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/899961045175228533'/><link rel='alternate' type='text/html' href='http://perlamentations.blogspot.com/2009/04/htmlmason-is-easy.html' title='HTML::Mason is easy'/><author><name>darko</name><uri>http://www.blogger.com/profile/00637012390696605561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2287077212528060224.post-865984278003078690</id><published>2009-04-22T17:08:00.008+02:00</published><updated>2009-04-24T18:19:15.616+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ids'/><category scheme='http://www.blogger.com/atom/ns#' term='cgi'/><title type='text'>Check your log files for intrusions</title><content type='html'>&lt;a href="http://search.cpan.org/search?query=CGI::IDS"&gt;CGI::IDS&lt;/a&gt; is a nice module on CPAN that enables you to check for a possible intrusion attempts in your web application. But, if evil attempts were made before, it's time to scan the log files. CGI::IDS is very flexible, so I crafted a simple program to check my log files at work.&lt;br /&gt;Here it is:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:perl; gutter: false; toolbar: false"&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;# ids_log_check.pl - process Apache access log files and check for possible &lt;br /&gt;# attacks via CGI::IDS&lt;br /&gt;# usage: ids_log_check.pl path_to_the_log_file&lt;br /&gt;&lt;br /&gt;# dprelec, 2009-01-14&lt;br /&gt;&lt;br /&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;&lt;br /&gt;use CGI;&lt;br /&gt;use CGI::IDS;&lt;br /&gt;&lt;br /&gt;# minimal impact to report for&lt;br /&gt;my $MIN_IMP = 20;&lt;br /&gt;&lt;br /&gt;# skip these requests&lt;br /&gt;my $RE_IGNORE = qr/GET(?:.*)\.(?:gif|css|png|jpeg|jpg|pdf|html|js|xml)\s/;&lt;br /&gt;&lt;br /&gt;my $ids = CGI::IDS-&gt;new();&lt;br /&gt;$ids-&gt;set_scan_keys(scan_keys =&gt; 1);&lt;br /&gt;&lt;br /&gt;my $log = shift or die "Specify input log file.\n";&lt;br /&gt;open $fh, "&lt;", $log or die "Cannot open $log: $!";&lt;br /&gt;&lt;br /&gt;while (&lt;$fh&gt;) {&lt;br /&gt;    next if /$RE_IGNORE/;&lt;br /&gt;    &lt;br /&gt;    if (/GET\s+(?:[^ ]+)\?([^ ]+)/) {&lt;br /&gt;        my %params = CGI-&gt;new($1)-&gt;Vars;&lt;br /&gt;        my $imp = $ids-&gt;detect_attacks(request =&gt; \%params);&lt;br /&gt;&lt;br /&gt;        if ($imp &gt; $MIN_IMP) {&lt;br /&gt;            print $_ . "\nParams: $1\nImpact: $imp\n\n";&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;close $fh;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update:&lt;/b&gt; Thanks to all for the answers. It's syntax highlighter that modifies the source code. I'll probably change it. I also ran my code through Perl::Critic, and changed the source code above according to it's suggestions and your comments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2287077212528060224-865984278003078690?l=perlamentations.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlamentations.blogspot.com/feeds/865984278003078690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2287077212528060224&amp;postID=865984278003078690' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/865984278003078690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/865984278003078690'/><link rel='alternate' type='text/html' href='http://perlamentations.blogspot.com/2009/04/check-your-log-files-for-intrusions.html' title='Check your log files for intrusions'/><author><name>darko</name><uri>http://www.blogger.com/profile/00637012390696605561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2287077212528060224.post-6676132082559483314</id><published>2009-04-22T12:09:00.003+02:00</published><updated>2009-04-22T12:47:34.861+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='meta'/><title type='text'>Fairies Wear Boots</title><content type='html'>Inspired by the &lt;a href="http://www.shadowcat.co.uk/blog/matt-s-trout/iron-man/"&gt;Iron Man post&lt;/a&gt;, I decided to post Perl-related article here, once a week, on my new blog. I've never done this blogging stuff before, so it's a new uncharted land for me. Being that I'm not that really good in public type of self-expressions, it (this blogging mess) will need some extra energy from me.&lt;br /&gt;So, don't expect some uberclever programming themes. For the start, I'll write about simple/dumb stuff I do all the time at my work.&lt;br /&gt;&lt;br /&gt;So much for the intro, and now for something slightly different.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2287077212528060224-6676132082559483314?l=perlamentations.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlamentations.blogspot.com/feeds/6676132082559483314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2287077212528060224&amp;postID=6676132082559483314' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/6676132082559483314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2287077212528060224/posts/default/6676132082559483314'/><link rel='alternate' type='text/html' href='http://perlamentations.blogspot.com/2009/04/fairies-wear-boots.html' title='Fairies Wear Boots'/><author><name>darko</name><uri>http://www.blogger.com/profile/00637012390696605561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
