I don't know what would I do without Perl.
I even came up with a new acronym: JABS (Just Another Butt Saver)...
Think about it. Siebel OLEDB Driver that we've been told to use does not quite work with MS SQL Server. Nothing makes these two systems talk to each other in any meaningfull way, perhaps due to data type missmatch, or some weird ODBC interfacing hurdles, or whatever, I don't care, they just don't like each other. Well, I married them using Perl DBI. It's been working great for at least 6 months. Under 1000 lines of code incorporate everything which SQL DTS mechanism cannot even dream about (what a stupid piece of software anyway): process logging, data validation, backups, etc. Yes, I do use T-SQL also, but my impression is that it's a terrible language. If Perl is like a camel, then T-SQL, perhaps, is like a frog. Yes, it is a hack, but that seems to be the only way to get the job done.
Thanks to all of you, Perl community. Great language, great job, and just another butt saved
My company uses only ColdFusion and SQL Server, so I'm learning new things, for example:
IIf(if_condition,true_result,false_result),
but now in SQL Server I have to write
CASE source_value WHEN target_value THEN true_result ELSE false_result END
select str(3.1415927) as foo would return 3
Format(Now(),'yyyy-mm-dd') must now be written as left(convert(varchar(12),getdate(),120),10) to get me the same output.
String & ' ' & Number & ' ' & String works fine in Access, but in SQL Server it must be written as
string + ' ' + Cast(number as varchar) + ' ' + string but why the pluses if we don't even add anything, we're concatenating, right?
cfquery causes all single quoted characters to be auto-escaped, by doubling them. Good in 90% of cases, but what if you are doing dynamic SQL think with interpolation of single-quoted values? Then that becomes a mess. You must now use tag in order to to be used in PreserveSingleQuotes(sql) manner. This is not intuitive. I spent about an hour to find an answer.
On NT4 my Access application sent and received messages transparently through Outlook just fine. When time came to upgrade hardware, I received it with Win2K pre-installed. When I moved my application to that shining new workstation, I realized that Outlook has a new security patch with prevents messages from being sent directly through Outlook API. What happens, is that each time a message is sent you see a dialog with 5 second delay. After 5 seconds are over you see an enabled "Yes" button on that dialog. Then your Outlook is activated, so you have to switch back after message has been sent. When you receive new messages you have to tell outlook to allow access for certian number of minutes. Same when trying to resolve a name in Global Address Book.
Forget it, I thought, I'll do something with Perl. And I did. And it works. Everything except listing folders on Exchange server. That part I still need to figure out. Thank you, authors of such useful modules as Net::POP3, Net::SMTP, Net::LDAP, SOAP::Lite. Thanks for pocketSOAP developers also (that's how I connect between Access and other functions).
Outlook is bad. And it is getting worse and worse. So annoying.
Programming in Perl is difficult, because it is not intuitive. It is good, though. Sometimes I experience a certain relief when I find an elegant solution to an old dilema. And more often than before I put comments like
# THANK YOU, LORD!
or
# Glory to God in the Highest!
inside my code. Why? Because I'm not a perl programmer, I am a perl user, I suppose. Although I managed to write quite an extensive application in Perl, I feel like my learning of this language will never end. Unfortunately.
Don't you wish you would be able to say "I speak Perl fluently". How many of you out there can say that honestly? Does Perl have to be difficult?
How about one of my recent eurica's:
sub copy_button {
my ($item, $item_id, $parent_id) = @_;
my $kids = {
pilot => 'survey',
survey => 'section',
section => 'question',
question => 'option'
};
my $ref = $dbh->selectall_arrayref("
SELECT ID, NAME FROM $$kids{$item}s
WHERE $item\_id = $item_id
");
return submit({
name => 'copy_'.$item.'_'.$parent_id,
value => 'Copy'
})
. popup_menu({
name => 'source',
value => [ map ($$_[0], @$ref ) ],
label => { map {$$_[0], $$_[1]} @$ref } # Glory to God in the Highest!
});
}
I wish it would be simpler. Should I try Ruby?..