From: | "Bulatovic Natasa" <n(dot)bulatovic(at)zim(dot)mpg(dot)de> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | PlPerl + sending emails from Postgres |
Date: | 2004-02-23 12:58:45 |
Message-ID: | 004201c3fa0c$c59a2130$e402b782@zim03 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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(at)mail(dot)de'', ''TESTSubject'',
''TESTMSG'');
use Net::SMTP;
my $smtp=Net::SMTP->new("localhost");
$smtp->mail("frommail\(at)mail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Fromme | 2004-02-24 10:24:20 | current_query in pg_stat_activity |
Previous Message | Rajan Bhide | 2004-02-23 12:46:54 | Compilation issue with --enable-thread-safety |