Perl DBI and INTERVAL values

I was having trouble using DBI to bind an interval value. Wonder if anyone has a better solution than this:

i could not find any information about binding an Oracle INTERVAL LITERAL. Maybe I just missed it in the docs?

Another reason not to use each()

So I’ve learned my lesson. Do not use each().

Always good to read the blogs…

Here’s a fun one that caused perl to go into an infinite loop. I suppose being frugal and not assigning things to variables is not necessarily a good idea.


  use strict;
  use warnings;

  my %thingies = %{{qw/a 1 b 2 c 3/}};

  my $c=0;

  #while (my ($a,$b) = each %thingies ) {
  while (my ($a,$b) = each %{{qw/a 1 b 2 c 3/}} ) {
    print "$a $b $c\n";
    last if ++$c > 4;  # stop the madness

Uncommenting out the line above where each uses a pre-assigned version of the same data element works fine. Not knowing anything regarding the internals of Perl makes me scratch my head. I’m sure there is a perfectly good explanation for this and maybe it has even been corrected in a more recent version of Perl?

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi


Reading the PerlMonks helps too!

I guess perl does not read minds all of the time. In the tradition of do what I want, not what I wrote I had hoped that perl knew that I only wanted to create the data element once, not each time through the loop. My bad.

Moral: Do not use each() - unless you are aware of all of the gotchas and even them don’t use each.

Perl is dead

Again...I guess this trope is something Perl developers just have to accept as we keep coding our Perl modules and scripts.

The eigenvector of "Why we moved from language X to language Y"

AWS CodeBuild

I've been playing with Amazon's CodeBuild for Bedrock's CI/CD pipeline.

Some gotchas but CodeBuild is cool.

Build an RPM in the Cloud

If you are as frustrated as I am when you try to launch a stock Amazon AMI as an EC2 instance in Amazon's cloud and then try to do any kind of Perl development, then here's an AMI image or you.

Search the community AMIs for this: ami-0043036a

The image contains pre-installed tools so you can easily roll a new RPM using cpanspec and rpmbuild.

Amazon AMIs are now shipped with Perl version 5.16 and unfortunately Amazon's rpm repo does not contain all of the modules you might want or need. If you enable the epel repo, you'll find some incompatibilities with those rpms and things quickly get frustrating.

Adding to the frustration is the fact that cpanspec from the epel repo itself has a broken dependency and if you manage to figure out how to work around that, you'll find yourself cursing either Perl, Moose, epel, Amazon or maybe all of the above.

Yes, this problem has been solved by building your own perl (plenv, perlbrew) and then using cpanm to install the modules you need, but if you want (or have) to stay in the rpm world and play nice with the O/S version of perl, then you might want to try this image out.

No doubt someone will point out that using the O/S perl binary for application development is not the way to do Perl application development, and I don't necessarily disagree.

But, in the spirit of the season, I decided to share a few hours of work for those that might also have experienced this problem.

Launch an EC2 using this image and try something like this:

 $ cpanget Text::Wrapper
 $ cpanspec -v --packager="ec2-user" Text::Wrapper
 $ mv Text-Wrapper-1.05.tar.gz rpm-build/SOURCES
 $ mv perl-Text-Wrapper.spec rpm-build/SPECS
 $ rpmbuild -ba rpm-build/SPECS/perl-Text-Wrapper.spec