Hi All,
I would like to create a function to send email which will be triggered
on certain dabatase events. Since we already have installed plPerl, I
was thinking of creating plPerl function which will be called from DB
trigger afterwards...
However, whenever I try to execute this plperl function, it gives me
some error messages (the same function executed as pure perl script-
executes fine - no syntax errors, no logical errors)...
Here is the code for the function
create or replace function mymail() returns integer as '
#!/opt/dist/perl/bin/perl
my ($sendTo, $Subject, $Message)=(''mymail@mail.de'', ''TESTSubject'',
''TESTMSG'');
use Net::SMTP;
my $smtp=Net::SMTP->new("localhost");
$smtp->mail("frommail\@mail.de");
$smtp->recipient($sendTo);
$smtp->data();
$smtp->datasend("To: $sendTo\n");
$smtp->datasend("Subject: $Subject\n");
$smtp->datasend("Content-Type: text/plain;\n\n");
$smtp->datasend("$Message and somethning TEST else \n");
$smtp->dataend();
$smtp->quit();
return 1;
' language 'plperl';
This is the error message I get:
ERROR: creation of function failed: Can't load
'/opt/dist/perl/lib/5.8.0/i686-linux/auto/Socket/Socket.so' for module
Socket: /opt/dist/perl/lib/5.8.0/i686-linux/auto/Socket/Socket.so:
undefined symbol: PL_sv_undef at
/opt/dist/perl/lib/5.8.0/i686-linux/XSLoader.pm line 83.
at /opt/dist/perl/lib/5.8.0/i686-linux/Socket.pm line 399
Compilation failed in require at /opt/dist/perl/lib/5.8.0/Net/SMTP.pm
line 13.
BEGIN failed--compilation aborted at
/opt/dist/perl/lib/5.8.0/Net/SMTP.pm line 13.
Compilation failed in require at (eval 1) line 6.
BEGIN failed--compilation aborted at (eval 1) line 6.
I have been executing other plperl functions - they are fine - seems the
problem is with specific libraries or so.. I also set up the
LD_LIBRARY_PATH to these paths - but no success...
Any ideas?
PS. Would like to avoid installing TCL just for using pgMail - this is
the only reason why would I need pgMail...
Cheers
Natasa