1- >perl Makefile.pl
2- >make
3-
4- copy the resulting library somewhere that
5- the postgresql backend can see it. assume
6- that path is /usr/local/pgsql/modules/plperl.so
7-
8- CREATE FUNCTION plperl_call_handler() RETURNS opaque
9- AS '/usr/local/pgsql/modules/plperl.so' LANGUAGE 'C';
10-
11- CREATE TRUSTED PROCEDURAL LANGUAGE 'plperl'
12- HANDLER plperl_call_handler
13- LANCOMPILER 'PL/Perl';
14-
15- -- here is simple example
1+ README for PL/Perl 2000.10.24
2+
3+ PREREQUISITES
4+ ======================================================================
5+ + Perl must be built as a shared library.
6+ + when compiling Postgres, use the --with-perl option. Alternatively,
7+ you can build plperl separately in an already-configured source tree:
8+ cd to $POSTGRES_SRC/src/pl/plperl/ and do "gmake all install".
9+
10+ CONFIGURING
11+ ======================================================================
12+ + as postgres super user:
13+ createlang plperl [database]
14+
15+ NOTES ON USAGE
16+ ======================================================================
17+ + Use q[], qq[], and qw[] instead of single quotes in
18+ function definitions.
19+ + When using escape sequences, you must backslash your
20+ backslashes, e.g.
21+ $alphanum =~ s/\W//g; # Wrong! Will replace capital W's
22+ $alphanum =~ s/\\W//g; # Right! Will replace non-word chars
23+ + Arguments to the function are available in @_
24+ + If argument is declared as a tuple, then tuple is represented as a
25+ hash reference.
26+
27+ EXAMPLES
28+ ======================================================================
1629CREATE FUNCTION addints(int4, int4) RETURNS int4 AS '
1730return $_[0] + $_[1]
1831' LANGUAGE 'plperl';
@@ -37,5 +50,3 @@ return 1;
3750' LANGUAGE 'plperl';
3851
3952SELECT badfunc();
40-
41-
0 commit comments