Sunday, November 30, 2008

whatever

Say that you want to run stuff written in Perl out of cron. Cron doesn't run as you. So it doesn't inherit your finely-crafted exported shell environment:

#setup the ENV that Perl knows about:
$ENV{ORACLE_HOME}='/opt/local/instantclient_10_2';
$ENV{LD_LIBRARY_PATH}='/opt/local/instantclient_10_2';

my $sqlplus;

$sqlplus=`sqlplus user/password\@DBNAME << END
sql statements here...;
exit
END
`;

open(MAILX, "| mailx -s 'db report' user\@domain ") || die "mailx no work
\n";
print MAILX $sqlplus;
close MAILX;


In addition, remember that to edit your crontab, you may need to: export EDITOR=vi

Wednesday, November 26, 2008

yeah yeah

just a reminder: when you're working in sqlplus:

> spool file.txt
> @script.sql
> spool off

now look inside 'file.txt' for the output of your query.

Monday, November 10, 2008

Perl modules different flavours

* the tried & trusted CPAN shell: perl -MCPAN -e shell ('install blah' etc)

* with Active Perl (no repos are maintained for Solaris/OSX etc) - so their 'ppm' command is no use there. ActiveState appear to have wrapped the CPAN shell into something that's invoked by : 'cpan'.

http://docs.activestate.com/activeperl/5.10/faq/ActivePerl-faq2.html#CPAN_shell

list installed perl modules

perl -MCPAN -e 'print CPAN::Shell->r '

oh yeah &:

"o conf init" inside of the MCPAN console to reconfigure (when the list of available mirror you picked proves to have been wildly over enthusiastic).