Thread: How to make it work? (PL/Perl + Net::LDAP)
hello, simple problem, I hope I can do this working on! If i'm on a wrong place, just tell me where I can find answers to my problem.... Here's my first pl/perl routine that compile very well: my $ldap = Net::LDAP->new('mydc.mycomp.com'); my $bind_uid = 'DOMAIN\\'.$_[0]; my $mesg = $ldap->bind($bind_uid, password => $_[1]); if ($mesg == 0) { return true; } else { return false; } But at runtime test it shows me this message: ERROR: error from Perl function: Can't locate object method "new" via package "Net::LDAP" (perhaps you forgot to load "Net::LDAP"?) at line 2. Okkkkkk, nice, so simple to put : use Net::Perl; but with this line added first of all, it's not compiling.... The error message is : ERROR: creation of Perl function failed: 'require' trapped by operation mask at line 2. What is the meaning of this message? ggld a bit and can't event found any piece of answers... Here's the complete create or replace code: CREATE OR REPLACE FUNCTION "public"."LDAP_AUTH" ("USER" varchar, "PASS" varchar) RETURNS boolean AS $body$ use Net::LDAP; my $ldap = Net::LDAP->new('mydc.mycomp.com'); my $bind_uid = 'DOMAIN\\'.$_[0]; my $mesg = $ldap->bind($bind_uid, password => $_[1]); if ($mesg == 0) { return true; } else { return false; } $body$ LANGUAGE 'plperl' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; WHY: compile without the use Net::LDAP and crash at runtime...? don't compiles with the use of Net::LDAP? thanks a lot! Bruno
Bruno Lavoie wrote: > hello, > if ($mesg == 0) { > return true; > } else { > return false; > } > $body$ > LANGUAGE 'plperl' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; > > > WHY: > compile without the use Net::LDAP and crash at runtime...? > don't compiles with the use of Net::LDAP? You need plperlu not plperl. plperl can't go outside of postgresql. Joshua D. Drake > > thanks a lot! > Bruno > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL Replication: http://www.commandprompt.com/products/
PL/Perl won't let you use modules, you need to createlang plperlu (u for "untrusted") and use that. Hope this helps, Stuart. On 7/16/07, Bruno Lavoie <bruno.lavoie@gmail.com> wrote: > hello, > > simple problem, I hope I can do this working on! If i'm on a wrong > place, just tell me where I can find answers to my problem.... > > Here's my first pl/perl routine that compile very well: > > my $ldap = Net::LDAP->new('mydc.mycomp.com'); > > my $bind_uid = 'DOMAIN\\'.$_[0]; > my $mesg = $ldap->bind($bind_uid, password => $_[1]); > > if ($mesg == 0) { > return true; > } else { > return false; > } > > But at runtime test it shows me this message: > > ERROR: error from Perl function: Can't locate object method "new" via > package "Net::LDAP" (perhaps you forgot to load "Net::LDAP"?) at line 2. > > Okkkkkk, nice, so simple to put : use Net::Perl; but with this line > added first of all, it's not compiling.... > The error message is : ERROR: creation of Perl function failed: > 'require' trapped by operation mask at line 2. > What is the meaning of this message? ggld a bit and can't event found > any piece of answers... > > Here's the complete create or replace code: > > CREATE OR REPLACE FUNCTION "public"."LDAP_AUTH" ("USER" varchar, "PASS" > varchar) RETURNS boolean AS > $body$ > use Net::LDAP; > > my $ldap = Net::LDAP->new('mydc.mycomp.com'); > > my $bind_uid = 'DOMAIN\\'.$_[0]; > my $mesg = $ldap->bind($bind_uid, password => $_[1]); > > if ($mesg == 0) { > return true; > } else { > return false; > } > $body$ > LANGUAGE 'plperl' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; > > > WHY: > compile without the use Net::LDAP and crash at runtime...? > don't compiles with the use of Net::LDAP? > > thanks a lot! > Bruno > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match >