http://www.perlmonks.org?node_id=816374
drodinthe559 has asked for the wisdom of the Perl Monks concerning the following question:

Perl Gurus: I trying to connect my perl script to a MS SQL Server from a Suse 11. I've tried using Freetds but was unsuccessful. I then tried downloading the Sybase AES ODBC libraries, but I'm not sure if just simply coping the Sybase.pm into the Perl library will work. Below is my script. Your help will be appreciated.
#!/usr/bin/perl -w use strict; use warnings; #You might need to define parameters for the input. use DBI; use Getopt::Long qw(:config no_ignore_case); my ($status, $failed, $host, $verbose, $timeout); my $VERSION = 0.1; my $HELP = 0; # Default values $failed = 0; my %STATUSCODE = ( 'OK' => '0', 'WARNING' => '1', 'CRITICAL' => '2', 'UNKNOWN' => '3'); my $usage = <<EOF; Test EOF # handle cmdline args my $result = GetOptions( "H|host=s" => \$host, "h|help" => \$HELP,); if( !$result ) { print "ERROR: Problem with cmdline args\n"; print $usage; exit($STATUSCODE{'UNKNOWN'});} if( $HELP ) { print $usage; exit($STATUSCODE{'UNKNOWN'});} if ( !($host) ){ print "ERROR: Missing required arguments\n"; print $usage; exit($STATUSCODE{'UNKNOWN'});}; my $dsn = 'DBI:Sybase:server=prime'; my $dbh = DBI->connect('DBI:Sybase:server=test;UID=sa;PWD=;'); if (!$dbh){die "Could not open connection to DSN because of [$!]";} my $query = $dbh->selectall_arrayref("SELECT COGIPF_STATUS FROM [PVP21_Audit].[dbo].[COGIPF_AGENTRUN] WHERE [COGIPF_LOCALTIMESTAMP] >= CONVERT(VarChar(20), +GetDate() +1,101)", { Slice => {} } ); foreach $query (@$query) { if ($query->{COGIPF_STATUS} eq 'Failed') {$failed = 1} } unless (@$query) { $failed = 1 }; if ( $failed == 0 ) { print "Jobs Succeeded\n"; exit($STATUSCODE{'OK'}); }elsif ( $failed == 1 ){ print "Job Failure\n"; exit($STATUSCODE{'CRITICAL'}); }else{ print "Undetermined error\n"; exit($STATUSCODE{'UNKNOWN'}); }