use Net::Stomp

Some of you know about ActiveMQ – an open source (Apache 2.0 licensed) Java Message Service 1.1 (JMS) message broker packed with many enterprise features. One of the way to communicate with it from none-Java programm languages is STOMP (Streaming Text Orientated Messaging Protocol). STOMP is very simple and looks like HTTP-protocol.
Perl has at least two ways to communicate with ActiveMQ over STOMP:

Using ActiveMQ may help you to integrate your applications with others on Enterprise level.

Develop right CGI scripts

I came across Ovid’s CGI Course. It’s definitely good tutorial. Both experts and beginners will find there something interesting and helpful. I found the third part – Basic Security the most important and interesting for me. I’d like to add that you can find many useful extensions for CGI like CGI::Forms, for example. This module will do all routine work for you to produce web forms. Or here is a CGI::Framework – a simple-to-use, lightweight web CGI framework.
But notice that using plain CGI is defensible in case of simple web script. If you’re going to develop something serious have a look some Perl framework such Catalyst, Gantry or Maypole. They’re enough powerful to be a base of scalable and efficient web applications.

Check password quality with Perl

When you manage some serious system where users can change their passwords you’ll face with problem of quality of those passwords. There is a Perl module – Data::Password, which may do all work to check user passwords: length or the number of character groups. Also, it’s possible to make more complicated checking: the password does not contain the same chars repeatedly or ascending or descending characters, or charcters close to each other in the keyboard. You can use system dictionary files (/usr/share/dict/words for Fedora Core 5, for example) or create you own. The module has only two methods and six variable which can be imported into your script/module to customize checking. Here is a small example of using Data::Password:
use Data::Password qw(:all);
$DICTIONARY = 0;
$GROUPS = 0;
# Will print "Bad password - contains the word 'clear', only lowercase"
print IsBadPassword("clearant");

Managing Standalone Scripts in PHP: part II

The second article about using standalone PHP script shows amazing ability of PHP such as fork, signals and demonizing. Yes, PHP allows to catch signals like SIGINT, SIGHUP, SIGALRM and so on. It’s really cool! When I develop background utils for SugarCRM I didn’t know about those useful PHP features. So, it’s time to make them more efficient and geek.

Run PHP script from command-line

I came across a brief howto “Implementing with PHP: Standalone Scripts”. I’m Perl guy but I have to use PHP in command line to perform some SugarCRM backgound tasks. I found useful the part about parsing command-line arguments with Console/Getopt.php. It may do administration tasks much easier.

How to rename files with bash

Recently I uploaded a few photos to the my site and I did a mistake in the name: Kirenia intead of Kyrenia. There were ten files but I didn’t want to change their names one by one. Thanks to bash. It offers an easy and elegant way to fix this problem:
for FILE in find|grep Kirenia; do TARGET=$(echo $FILE | sed -e "s/Ki/Ky/"); mv $FILE $TARGET; done;
P. S. I alwas forget about structure bash operator for:
for VARIABLE in LIST; do SOME_OPERATIONS ...; done

Perl and BIG projects

I came across this post on Perlmonks. One monk asked other monks about examples of BIG project based on Perl. I don’t want to digg thesis “BIG project” because, in my mind, a measurement of the project quantity in the number of lines is not so accurate. The main problem when we’re talking about Perl and Enterprise applications is in lack of knowledge of appropriate tools.