Category Archives: Perl Scripting

Perl parsing field value pairs without separation

It is possible with perl functional programming to solve some interesting problems.

Suppose that you have a data set that has been processed to a degree where there was an error in the processing which removed some required delimiters such as the following:

some_data=some_valuesome_data=some_valuesomedata=somevalue
Continue reading

Perl Socket.so and inet_aton.so

Upon building a module for perl I ran into a build issue with Socket.so in regards to an undefined symbol: inet_aton.so. When taking a closer look at the socket.so lib, it is apparent that the “proper” libraries should be there, however, in Solaris there are a few functions that do not exist in the same spots as other OS&squo;. So in order to properly build you need to add -lresolv or when you are invoking something that is prebuilt like cpan and using perl Socket.so you can simply use:

LD_PRELOAD=libresolv.so path_to_cpan

Using Perl to time Bash Calls – Bash fine grain timer

Using Perl to time Bash Calls – Bash fine grain timer

I was looking for a way to cross platform way to make a microsecond timer or anything less than one second for that matter in bash. Aside from doing a fork each time this function needs to be called, this is a pretty good alternative to c programming because it is quick and dirty. This function will allow us to be portable and not think too much about the implementation for the time being.

#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(usleep nanosleep);
usleep(100);

Simple Perl Template Engine

Simple Perl Template Engine

 

There are many uses for a template engine, but the basic idea to my knowledge is to reuse a design and replace the content quickly and efficiently. Like code re-usage, this helps to make our lives easier by allowing us to save time and preventing us from having to duplicate manually and create a page for every link. This also allows us to grab data from a data store, or database that will make managing content somewhat easier.