PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔䆹39. PL/Perl - Perl 誺䘋臺蘔媆誕嬉誕

39.5. 埇媇䔇启婉埇媇䔇 PL/Perl

锔婩PL/Perl 滇嘩婺婔䓉埆 plperl 䔇"埇媇"䚡䘋臺蘔垬輙䔇㔗婘認䓉螆䘞婺婺庖媺毕垬噘昊底 Perl 淉嘩赆噿閺毬庖㔗锔婩埖鍊彽䔇淉嘩鄘滇闼底启䯇嵄䕩庐庴庐䔇媘嘩㔗認寙拸桺傽埖昇淉嘩㔕requireuse(凹庯崡鄘昇庖)㔗澇橬媂濘螪閞昄扞康橉媇単誕䘋喙鄘潡蔙诙埡噙橬橉媇単誕䘋溄鍊䔇 OS 亓彆䔇螪閞儌償 C 庘昄闼湙㔗啹溴傂嘘麂䬹溄䔇昄扞康䫘潙鄘埇傖噕螩嘪䫘認䓉臺蘔㔗

認麯滇婔婻方濘誊蘸䔇庘昄䔇冋床啹婺庺庯垬噘寘啹桺傽係䂘䔇淉嘩滇婉噕螩䔇

CREATE FUNCTION badfunc() RETURNS integer AS $$
    my $tmpfile = "/tmp/badfile";
    open my $fh, '>', $tmpfile
        or elog(ERROR, qq{could not open the file "$tmpfile": $!});
    print $fh "Testing writing to a file\n";
    close $fh or elog(ERROR, qq{could not close the file "$tmpfile": $!});
    return 1;
$$ LANGUAGE plperl;

录傺認婻庘昄儖嚔崌蘖啹婺垄嘪䫘䔇麂濘脄䫘儖嚔赆黯臕単托诙㔗

橬施唍愿喍婉埖鍊彽䔇 Perl 庘昄㔗懫套埇脘驔襕婔婻脘埏锕闞傽䔇 Perl 庘昄㔗婺庖崇䊖認䓉愙喕PL/Perl 幘埇傖垬輙婺"婉埇媇"䔇臺蘔 PL/PerlU 㔗婘認䓉愙喕婋埇傖嘪䫘垯昘䔇 Perl 臺蘔㔗套悩䫘 createlang 垬輙臖臺蘔闼幽䫘 plperlu 認婻劉庖埇傖锬埡婉埇媇䔇 PL/Perl 埻䓉㔗

PL/PerlU 庘昄䔇嘩蔙媙釂濘懟婉脘檪臖庘昄䫘庯啔傂嘘婉愿啔䔇庋愙啹婺垄埇傖幾傂嘘昄扞康䞇䊖叻脘幾䔇庋愙㔗臙濘懟昄扞康係䂘埻噕螩昄扞康轙亓䫘潙录傺婉埇媇臺蘔喍䔇庘昄㔗

套悩婪麵䔇庘昄䫌轙亓䫘潙䫘 plperlu 录傺闼幽欓臯儌嚔潊媘㔗

㔊濘懟㔏婺庖幕婪傯 PL/Perl 彄 PL/PerlU 䔇䬹溄淉嘩埇脘庻婘䔇垬噘暟昂認婴婻臺蘔媙釂婘婉劯䔇 Perl 蓼麪単垂冋婺誊臯㔗套悩嘹䔇 Perl 垬輙敄嘷認儌婉滇閞鵻㔗嘖幽婉滇欔橬䔇垬輙婘䚡臏施鄘嘪䫘庖敄嘷䔇湺媖㔗套悩 PostgreSQL 演敋彄婉脘劇媘丸庯婻蓼麪単䔇臺儖嚔檖髍認湙嘹儌婉脘婘劯婔婻劯䆇誕䘋婺劯施嘪䫘 PL/PerlU 启 PL/Perl 㔗嫇婔䔇臖昏毻桘儌滇嘪䫘溼䇞䔇湺媖麉桄䚡臏 Perl 幘儌滇嘪䫘 usemultiplicity 潡蔙劯施嘪䫘 usethreadsuseithreads 㔗敘桄媇敇埗蓕 perlembed 欋喯釕㔗


劯锔饡釕嬉誕
PL/Perl 麯䔇噘匔埻麟婪婔亓PL/Perl 蓥埏単