Server Differences

I prototyped this system on my Mac at home, before uploading it to the Ohlone College server. I found many differences between the server installations. There are several crucial modules like DBD and DBI (which power the interface between PERL and MySQL) that are not available on my home system, and I encountered errors when trying to install them. On the other hand, there are several standard modules like Utils that don't seem to be available on the Ohlone College server.

DBD and DBI

Because DBD and DBI are not available on my home computer, I just wrote the commands and debugged them later on the Ohlone College server.

List::MoreUtils

This is a standard utility, available on my home computer, not available on the Ohlone College server. It includes a function first_index(), which returns the first occurence of a specified element in an array. I had to write my own find_month() function instead.

This does not work:

use List::MoreUtils 'first_index'; 
my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
my $monthNumber = 1+ first_index { $_ eq $dance[7] } @months;

Instead, I wrote my own function that finds the month in the array:

my $monthNumber = 1 + find_month ($month);

sub find_month
{
  # because List::MoreUtils 'first_index' is not found on the Ohlone server
  #
  $monthToFind = $_[0];

  my $i;
  for ($i=0; $i<@months; $i++) {
    if ($monthToFind eq $months[$i]) {
      return $i;
    }
  }
  return -1;
}

String:Util

This is another standard utility not available on the Ohlone server. It includes the standard function trim(), which removes white space from the beginning and end of a string. I was not able to do this:

use String::Util qw(trim);
$dance = trim ($dance);

So, again, I wrote my own function that does this. This function uses a regular expression that I found online:

sub trim
{
  # becase String::Util trim does not seem to exist on the Ohlone server
  #
  # http://perlmaven.com/trim
  #
  my $str = $_[0];
  $str =~ s/^\s+|\s+$//g;
  return $str;
}