mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
Author: Alex Hunsaker
This commit is contained in:
parent
65ad4e3157
commit
4aa14fe901
@ -36,3 +36,22 @@ select getme('on_init');
|
||||
42
|
||||
(1 row)
|
||||
|
||||
-- verify that we can use $_SHARED in strict mode
|
||||
create or replace function perl_shared() returns int as $$
|
||||
use strict;
|
||||
my $val = $_SHARED{'stuff'};
|
||||
$_SHARED{'stuff'} = '1';
|
||||
return $val;
|
||||
$$ language plperl;
|
||||
select perl_shared();
|
||||
perl_shared
|
||||
-------------
|
||||
|
||||
(1 row)
|
||||
|
||||
select perl_shared();
|
||||
perl_shared
|
||||
-------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
# $PostgreSQL: pgsql/src/pl/plperl/plc_perlboot.pl,v 1.6 2010/05/13 16:39:43 adunstan Exp $
|
||||
# $PostgreSQL: pgsql/src/pl/plperl/plc_perlboot.pl,v 1.6.2.1 2010/07/27 04:18:31 alvherre Exp $
|
||||
|
||||
use 5.008001;
|
||||
use vars qw(%_SHARED);
|
||||
|
||||
PostgreSQL::InServer::Util::bootstrap();
|
||||
|
||||
@ -9,7 +10,6 @@ package PostgreSQL::InServer;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use vars qw(%_SHARED);
|
||||
|
||||
sub plperl_warn {
|
||||
(my $msg = shift) =~ s/\(eval \d+\) //g;
|
||||
|
@ -29,3 +29,14 @@ select setme('ourkey','ourval');
|
||||
select getme('ourkey');
|
||||
|
||||
select getme('on_init');
|
||||
|
||||
-- verify that we can use $_SHARED in strict mode
|
||||
create or replace function perl_shared() returns int as $$
|
||||
use strict;
|
||||
my $val = $_SHARED{'stuff'};
|
||||
$_SHARED{'stuff'} = '1';
|
||||
return $val;
|
||||
$$ language plperl;
|
||||
|
||||
select perl_shared();
|
||||
select perl_shared();
|
||||
|
Loading…
Reference in New Issue
Block a user