DBI-1.648/0000755000031300001440000000000015210302710011356 5ustar00merijnusersDBI-1.648/t/0000755000031300001440000000000015210302710011621 5ustar00merijnusersDBI-1.648/t/31methcache.t0000644000031300001440000000743114742423677014131 0ustar00merijnusers#!perl -w # # check that the inner-method lookup cache works # (or rather, check that it doesn't cache things when it shouldn't) BEGIN { eval "use threads;" } # Must be first my $use_threads_err = $@; use Config qw(%Config); # With this test code and threads, 5.8.1 has issues with freeing freed # scalars, while 5.8.9 doesn't; I don't know about in-between - DAPM my $has_threads = $Config{useithreads}; die $use_threads_err if $has_threads && $use_threads_err; use Test::More; # weaken itself is buggy on 5.8.1 (magic killbackrefs panic # triggered by threads, fixed in 5.8.2, but 5.8.2 has other # issues that should have been fixed in 5.8.3, but 5.8.4 .. # 5.8.6 still fail where 5.8.7 PASSes if ($has_threads && $] < 5.008007) { plan skip_all => "Test will fail in threaded perl <= 5.8.6"; } if ($] >= 5.010000 && $] < 5.012000) { plan skip_all => "Test will fail in perl-5.10.x"; } use strict; $|=1; $^W=1; plan tests => 49; use_ok( 'DBI' ); sub new_handle { my $dbh = DBI->connect("dbi:Sponge:foo","","", { PrintError => 0, RaiseError => 1, }); my $sth = $dbh->prepare("foo", # data for DBD::Sponge to return via fetch { rows => [ [ "row0" ], [ "row1" ], [ "row2" ], [ "row3" ], [ "row4" ], [ "row5" ], [ "row6" ], ], } ); return ($dbh, $sth); } sub Foo::local1 { [ "local1" ] }; sub Foo::local2 { [ "local2" ] }; my $fetch_hook; { package Bar; our @ISA = qw(DBD::_::st); sub fetch { &$fetch_hook }; } sub run_tests { my ($desc, $dbh, $sth) = @_; my $row = $sth->fetch; is($row->[0], "row0", "$desc row0"); { # replace CV slot no warnings 'redefine'; local *DBD::Sponge::st::fetch = sub { [ "local0" ] }; $row = $sth->fetch; is($row->[0], "local0", "$desc local0"); } $row = $sth->fetch; is($row->[0], "row1", "$desc row1"); { # replace GP local *DBD::Sponge::st::fetch = *Foo::local1; $row = $sth->fetch; is($row->[0], "local1", "$desc local1"); } $row = $sth->fetch; is($row->[0], "row2", "$desc row2"); { # replace GV local $DBD::Sponge::st::{fetch} = *Foo::local2; $row = $sth->fetch; is($row->[0], "local2", "$desc local2"); } $row = $sth->fetch; is($row->[0], "row3", "$desc row3"); { # @ISA = NoSuchPackage local $DBD::Sponge::st::{fetch}; local @DBD::Sponge::st::ISA = qw(NoSuchPackage); eval { local $SIG{__WARN__} = sub {}; $row = $sth->fetch }; like($@, qr/Can't locate DBI object method/, "$desc locate DBI object"); } $row = $sth->fetch; is($row->[0], "row4", "$desc row4"); { # @ISA = Bar $fetch_hook = \&DBD::Sponge::st::fetch; local $DBD::Sponge::st::{fetch}; local @DBD::Sponge::st::ISA = qw(Bar); $row = $sth->fetch; is($row->[0], "row5", "$desc row5"); $fetch_hook = sub { [ "local3" ] }; $row = $sth->fetch; is($row->[0], "local3", "$desc local3"); } $row = $sth->fetch; is($row->[0], "row6", "$desc row6"); } run_tests("plain", new_handle()); SKIP: { skip "no threads / perl < 5.8.9", 12 unless $has_threads; # only enable this when handles are allowed to be shared across threads #{ # my @h = new_handle(); # threads->new(sub { run_tests("threads", @h) })->join; #} threads->new(sub { run_tests("threads-h", new_handle()) })->join; }; # using weaken attaches magic to the CV; see whether this interferes # with the cache magic use Scalar::Util qw(weaken); my $fetch_ref = \&DBI::st::fetch; weaken $fetch_ref; run_tests("magic", new_handle()); SKIP: { skip "no threads / perl < 5.8.9", 12 unless $has_threads; # only enable this when handles are allowed to be shared across threads #{ # my @h = new_handle(); # threads->new(sub { run_tests("threads", @h) })->join; #} threads->new(sub { run_tests("magic threads-h", new_handle()) })->join; }; 1; DBI-1.648/t/91_store_warning.t0000644000031300001440000000253714742423677015240 0ustar00merijnusers# Test if a warning can be recorded in the STORE method # which it couldn't in DBI 1.628 # see https://rt.cpan.org/Ticket/Display.html?id=89015 # This is all started from the fact that the SQLite ODBC Driver cannot set the # ReadOnly attribute (which is mapped to ODBC SQL_ACCESS_MODE) - it # legitimately returns SQL_SUCCESS_WITH_INFO option value changed. # It was decided that this should record a warning but when it was added to DBD::ODBC # DBI did not show the warning - keep_err? # Tim's comment on #dbi was: # the dispatcher has logic to notice if ErrCount went up during a call and disables keep_err in that case. # I think something similar might be needed for err. E.g., "if it's defined now but wasn't defined before" then # act appropriately. use strict; use warnings; use Test::More; use DBI; my $warning; $SIG{__WARN__} = sub { $warning = $_[0] }; my $dbh = DBI->connect('dbi:NullP:', '', '', {PrintWarn => 1}); is $warning, undef, 'initially not set'; $dbh->set_err("0", "warning plain"); like $warning, qr/^DBD::\w+::db set_err warning: warning plain/, "Warning recorded by store"; $dbh->set_err(undef, undef); undef $warning; $dbh->set_err("0", "warning \N{U+263A} smiley face"); like $warning, qr/^DBD::\w+::db set_err warning: warning \x{263A} smiley face/, "Warning recorded by store" or warn DBI::data_string_desc($warning); done_testing; DBI-1.648/t/82sponge.t0000644000031300001440000000557315206024306013474 0ustar00merijnusers#! /usr/bin/env perl # vim: noet ts=2 sw=2: use strict; use warnings; use Test::More tests => 17; use Storable qw(dclone); use DBI qw(:sql_types); # our reference table: # # A0 B1 C2 # ------- --------- ------- # foo NULL bazooka # foolery bar NULL # NULL barrowman baz # # Historically, DBD::Sponge defaulted an sth's PRECISION to the length # of its column names, meaning that some DBI shells could truncate row # display. For example, formatting a row ('fo', NULL, 'ba') from our # reference table above. our @NAMES = ( 'A0', 'B1', 'C2' ); our @ROWS = (['foo', undef, 'bazooka'], ['foolery', 'bar', undef ], [undef, 'barrowman', 'baz' ]); my $dbh = DBI->connect("dbi:Sponge:", '', ''); ok($dbh, "connect(dbi:Sponge:) succeeds"); my $sth = $dbh->prepare("simple, correct sponge", { rows => dclone( \@ROWS ), NAME => [ @NAMES ], }); ok($sth, "prepare() of 3x3 result succeeded"); is_deeply($sth->{NAME}, ['A0', 'B1', 'C2'], "column NAMEs as expected"); is_deeply($sth->{TYPE}, [SQL_VARCHAR, SQL_VARCHAR, SQL_VARCHAR], "column TYPEs default to SQL_VARCHAR"); # # Old versions of DBD-Sponge defaulted PRECISION (data "length") to # length of the field _names_ rather than the length of the _data_. # is_deeply($sth->{PRECISION}, [7, 9, 7], "column PRECISION matches lengths of longest field data"); is_deeply($sth->fetch(), $ROWS[0], "first row fetch as expected"); is_deeply($sth->fetch(), $ROWS[1], "second row fetch as expected"); is_deeply($sth->fetch(), $ROWS[2], "third row fetch as expected"); ok(!defined($sth->fetch()), "fourth fetch returns undef"); # Test that DBD-Sponge preserves bogus user-supplied attributes but # ignores them when returning rows $sth = $dbh->prepare('user-supplied silly TYPE and PRECISION', { rows => dclone( \@ROWS ), NAME => [qw( first_col second_col third_col )], TYPE => [SQL_INTEGER, SQL_DATETIME, SQL_CHAR], PRECISION => [1, 100_000, 0], }); ok($sth, "prepare() 3x3 result with TYPE and PRECISION succeeded"); is_deeply($sth->{NAME}, ['first_col','second_col','third_col'], "column NAMEs again as expected"); is_deeply($sth->{TYPE}, [SQL_INTEGER, SQL_DATETIME, SQL_CHAR], "column TYPEs not overwritten"); is_deeply($sth->{PRECISION}, [1, 100_000, 0], "column PRECISION not overwritten"); is_deeply($sth->fetch(), $ROWS[0], "first row fetch as expected, despite bogus attributes"); is_deeply($sth->fetch(), $ROWS[1], "second row fetch as expected, despite bogus attributes"); is_deeply($sth->fetch(), $ROWS[2], "third row fetch as expected, despite bogus attributes"); ok(!defined($sth->fetch()), "fourth fetch returns undef, despite bogus attributes"); DBI-1.648/t/20meta.t0000644000031300001440000000142612127465144013120 0ustar00merijnusers#!perl -w use strict; use Test::More tests => 8; $|=1; $^W=1; BEGIN { use_ok( 'DBI', ':sql_types' ) } BEGIN { use_ok( 'DBI::DBD::Metadata' ) } # just to check for syntax errors etc my $dbh = DBI->connect("dbi:ExampleP:.","","", { FetchHashKeyName => 'NAME_lc' }) or die "Unable to connect to ExampleP driver: $DBI::errstr"; isa_ok($dbh, 'DBI::db'); #$dbh->trace(3); #use Data::Dumper; #print Dumper($dbh->type_info_all); #print Dumper($dbh->type_info); #print Dumper($dbh->type_info(DBI::SQL_INTEGER)); my @ti = $dbh->type_info; ok(@ti>0); is($dbh->type_info(SQL_INTEGER)->{DATA_TYPE}, SQL_INTEGER); is($dbh->type_info(SQL_INTEGER)->{TYPE_NAME}, 'INTEGER'); is($dbh->type_info(SQL_VARCHAR)->{DATA_TYPE}, SQL_VARCHAR); is($dbh->type_info(SQL_VARCHAR)->{TYPE_NAME}, 'VARCHAR'); 1; DBI-1.648/t/15array.t0000644000031300001440000001714714742423677013335 0ustar00merijnusers#!perl -w $|=1; use strict; use Test::More tests => 55; ## ---------------------------------------------------------------------------- ## 15array.t ## ---------------------------------------------------------------------------- # ## ---------------------------------------------------------------------------- BEGIN { use_ok('DBI'); } # create a database handle my $dbh = DBI->connect("dbi:Sponge:dummy", '', '', { RaiseError => 1, ShowErrorStatement => 1, AutoCommit => 1 }); # check that our db handle is good isa_ok($dbh, "DBI::db"); my $rv; my $rows = []; my $tuple_status = []; my $dumped; my $sth = $dbh->prepare("insert", { rows => $rows, # where to 'insert' (push) the rows NUM_OF_PARAMS => 4, execute_hook => sub { # DBD::Sponge hook to make certain data trigger an error for that row local $^W; return $_[0]->set_err(1,"errmsg") if grep { $_ and $_ eq "B" } @_; return 1; } }); isa_ok($sth, "DBI::st"); cmp_ok(scalar @{$rows}, '==', 0, '... we should have 0 rows'); # ----------------------------------------------- ok(! eval { local $sth->{PrintError} = 0; $sth->execute_array( { ArrayTupleStatus => $tuple_status }, [ 1, 2, 3 ], # array of integers 42, # scalar 42 treated as array of 42's undef, # scalar undef treated as array of undef's [ qw(A B C) ], # array of strings ) }, '... execute_array should return false' ); ok $@, 'execute_array failure with RaiseError should have died'; like $sth->errstr, '/executing 3 generated 1 errors/'; cmp_ok(scalar @{$rows}, '==', 2, '... we should have 2 rows'); cmp_ok(scalar @{$tuple_status}, '==', 3, '... we should have 3 tuple_status'); ok(eq_array( $rows, [ [1, 42, undef, 'A'], [3, 42, undef, 'C'] ] ), '... our rows are as expected'); ok(eq_array( $tuple_status, [1, [1, 'errmsg', 'S1000'], 1] ), '... our tuple_status is as expected'); # ----------------------------------------------- # --- change one param and re-execute @$rows = (); ok( $sth->bind_param_array(4, [ qw(a b c) ]), '... bind_param_array should return true'); ok( $sth->execute_array({ ArrayTupleStatus => $tuple_status }), '... execute_array should return true'); cmp_ok(scalar @{$rows}, '==', 3, '... we should have 3 rows'); cmp_ok(scalar @{$tuple_status}, '==', 3, '... we should have 3 tuple_status'); ok(eq_array( $rows, [ [1, 42, undef, 'a'], [2, 42, undef, 'b'], [3, 42, undef, 'c'] ] ), '... our rows are as expected'); ok(eq_array( $tuple_status, [1, 1, 1] ), '... our tuple_status is as expected'); # ----------------------------------------------- # --- call execute_array in array context to get executed AND affected @$rows = (); my ($executed, $affected) = $sth->execute_array({ ArrayTupleStatus => $tuple_status }); ok($executed, '... execute_array should return true'); cmp_ok($executed, '==', 3, '... we should have executed 3 rows'); cmp_ok($affected, '==', 3, '... we should have affected 3 rows'); # ----------------------------------------------- # --- with no values for bind params, should execute zero times @$rows = (); $rv = $sth->execute_array( { ArrayTupleStatus => $tuple_status }, [], [], [], []); ok($rv, '... execute_array should return true'); ok(!($rv+0), '... execute_array should return 0 (but true)'); cmp_ok(scalar @{$rows}, '==', 0, '... we should have 0 rows'); cmp_ok(scalar @{$tuple_status}, '==', 0,'... we should have 0 tuple_status'); # ----------------------------------------------- # --- with only scalar values for bind params, should execute just once @$rows = (); $rv = $sth->execute_array( { ArrayTupleStatus => $tuple_status }, 5, 6, 7, 8); cmp_ok($rv, '==', 1, '... execute_array should return 1'); cmp_ok(scalar @{$rows}, '==', 1, '... we should have 1 rows'); ok(eq_array( $rows, [ [5,6,7,8] ]), '... our rows are as expected'); cmp_ok(scalar @{$tuple_status}, '==', 1,'... we should have 1 tuple_status'); ok(eq_array( $tuple_status, [1]), '... our tuple_status is as expected'); # ----------------------------------------------- # --- with mix of scalar values and arrays only arrays control tuples @$rows = (); $rv = $sth->execute_array( { ArrayTupleStatus => $tuple_status }, 5, [], 7, 8); cmp_ok($rv, '==', 0, '... execute_array should return 0'); cmp_ok(scalar @{$rows}, '==', 0, '... we should have 0 rows'); cmp_ok(scalar @{$tuple_status}, '==', 0,'... we should have 0 tuple_status'); # ----------------------------------------------- # --- catch 'undefined value' bug with zero bind values @$rows = (); my $sth_other = $dbh->prepare("insert", { rows => $rows, # where to 'insert' (push) the rows NUM_OF_PARAMS => 1, }); isa_ok($sth_other, "DBI::st"); $rv = $sth_other->execute_array( {}, [] ); ok($rv, '... execute_array should return true'); ok(!($rv+0), '... execute_array should return 0 (but true)'); # no ArrayTupleStatus cmp_ok(scalar @{$rows}, '==', 0, '... we should have 0 rows'); # ----------------------------------------------- # --- ArrayTupleFetch code-ref tests --- my $index = 0; my $fetchrow = sub { # generate 5 rows of two integer values return if $index >= 2; $index +=1; # There doesn't seem any reliable way to force $index to be # treated as a string (and so dumped as such). We just have to # make the test case allow either 1 or '1'. return [ $index, 'a','b','c' ]; }; @$rows = (); ok( $sth->execute_array({ ArrayTupleFetch => $fetchrow, ArrayTupleStatus => $tuple_status }), '... execute_array should return true'); cmp_ok(scalar @{$rows}, '==', 2, '... we should have 2 rows'); cmp_ok(scalar @{$tuple_status}, '==', 2, '... we should have 2 tuple_status'); ok(eq_array( $rows, [ [1, 'a', 'b', 'c'], [2, 'a', 'b', 'c'] ] ), '... rows should match' ); ok(eq_array( $tuple_status, [1, 1] ), '... tuple_status should match' ); # ----------------------------------------------- # --- ArrayTupleFetch sth tests --- my $fetch_sth = $dbh->prepare("foo", { rows => [ map { [ $_,'x','y','z' ] } 7..9 ], NUM_OF_FIELDS => 4 }); isa_ok($fetch_sth, "DBI::st"); $fetch_sth->execute(); @$rows = (); ok( $sth->execute_array({ ArrayTupleFetch => $fetch_sth, ArrayTupleStatus => $tuple_status, }), '... execute_array should return true'); cmp_ok(scalar @{$rows}, '==', 3, '... we should have 3 rows'); cmp_ok(scalar @{$tuple_status}, '==', 3, '... we should have 3 tuple_status'); ok(eq_array( $rows, [ [7, 'x', 'y', 'z'], [8, 'x', 'y', 'z'], [9, 'x', 'y', 'z'] ] ), '... rows should match' ); ok(eq_array( $tuple_status, [1, 1, 1] ), '... tuple status should match' ); # ----------------------------------------------- # --- error detection tests --- $sth->{RaiseError} = 0; $sth->{PrintError} = 0; ok(!defined $sth->execute_array( { ArrayTupleStatus => $tuple_status }, [1],[2]), '... execute_array should return undef'); is($sth->errstr, '2 bind values supplied but 4 expected', '... errstr is as expected'); ok(!defined $sth->execute_array( { ArrayTupleStatus => { } }, [ 1, 2, 3 ]), '... execute_array should return undef'); is( $sth->errstr, 'ArrayTupleStatus attribute must be an arrayref', '... errstr is as expected'); ok(!defined $sth->execute_array( { ArrayTupleStatus => $tuple_status }, 1,{},3,4), '... execute_array should return undef'); is( $sth->errstr, 'Value for parameter 2 must be a scalar or an arrayref, not a HASH', '... errstr is as expected'); ok(!defined $sth->bind_param_array(":foo", [ qw(a b c) ]), '... bind_param_array should return undef'); is( $sth->errstr, "Can't use named placeholder ':foo' for non-driver supported bind_param_array", '... errstr is as expected'); $dbh->disconnect; 1; DBI-1.648/t/80proxy.t0000644000031300001440000003254014742423677013374 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- # vim:sw=4:ts=8 use strict; use warnings; use DBI; use Config; require VMS::Filespec if $^O eq 'VMS'; require Cwd; my $haveFileSpec = eval { require File::Spec }; my $failed_tests = 0; $| = 1; $^W = 1; # $\ = "\n"; # XXX Triggers bug, check this later (JW, 1998-12-28) # Can we load the modules? If not, exit the test immediately: # Reason is most probable a missing prerequisite. # # Is syslog available (required for the server)? eval { local $SIG{__WARN__} = sub { $@ = shift }; require Storable; require DBD::Proxy; require DBI::ProxyServer; require RPC::PlServer; require Net::Daemon::Test; }; if ($@) { if ($@ =~ /^Can't locate (\S+)/) { print "1..0 # Skipped: modules required for proxy are probably not installed (e.g., $1)\n"; exit 0; } die $@; } if ($DBI::PurePerl) { # XXX temporary I hope print "1..0 # Skipped: DBD::Proxy currently has a problem under DBI::PurePerl\n"; exit 0; } { my $numTest = 0; sub _old_Test($;$) { my $result = shift; my $str = shift || ''; printf("%sok %d%s\n", ($result ? "" : "not "), ++$numTest, $str); $result; } sub Test ($;$) { my($ok, $msg) = @_; $msg = ($msg) ? " ($msg)" : ""; my $line = (caller)[2]; ++$numTest; ($ok) ? print "ok $numTest at line $line\n" : print "not ok $numTest\n"; warn "# failed test $numTest at line ".(caller)[2]."$msg\n" unless $ok; ++$failed_tests unless $ok; return $ok; } } # Create an empty config file to make sure that settings aren't # overloaded by /etc/dbiproxy.conf my $config_file = "./dbiproxytst.conf"; unlink $config_file; (open(FILE, ">$config_file") and (print FILE "{}\n") and close(FILE)) or die "Failed to create config file $config_file: $!"; my $debug = ($ENV{DBI_TRACE}||=0) ? 1 : 0; my $dbitracelog = "dbiproxy.dbilog"; my ($handle, $port, @child_args); my $numTests = 136; if (@ARGV) { $port = $ARGV[0]; } else { unlink $dbitracelog; unlink "dbiproxy.log"; unlink "dbiproxy.truss"; # Uncommentand adjust this to isolate pure-perl client from server settings: # local $ENV{DBI_PUREPERL} = 0; # If desperate uncomment this and add '-d' after $^X below: # local $ENV{PERLDB_OPTS} = "AutoTrace NonStop=1 LineInfo=dbiproxy.dbg"; # pass our @INC to children (e.g., so -Mblib passes through) $ENV{PERL5LIB} = join($Config{path_sep}, @INC); # server DBI trace level always at least 1 my $dbitracelevel = DBI->trace(0) || 1; @child_args = ( #'truss', '-o', 'dbiproxy.truss', $^X, 'dbiproxy', '--test', # --test must be first command line arg "--dbitrace=$dbitracelevel=$dbitracelog", # must be second arg '--configfile', $config_file, ($dbitracelevel >= 2 ? ('--debug') : ()), '--mode=single', '--logfile=STDERR', '--timeout=90' ); warn " starting test dbiproxy process: @child_args\n" if DBI->trace(0); ($handle, $port) = Net::Daemon::Test->Child($numTests, @child_args); } my $dsn = "DBI:Proxy:hostname=127.0.0.1;port=$port;debug=$debug;dsn=DBI:ExampleP:"; print "Making a first connection and closing it immediately.\n"; Test(eval { DBI->connect($dsn, '', '', { 'PrintError' => 1 }) }) or print "Connect error: " . $DBI::errstr . "\n"; print "Making a second connection.\n"; my $dbh; Test($dbh = eval { DBI->connect($dsn, '', '', { 'PrintError' => 0 }) }) or print "Connect error: " . $DBI::errstr . "\n"; print "example_driver_path=$dbh->{example_driver_path}\n"; Test($dbh->{example_driver_path}); print "Setting AutoCommit\n"; $@ = "old-error"; # should be preserved across DBI calls Test($dbh->{AutoCommit} = 1); Test($dbh->{AutoCommit}); Test($@ eq "old-error", "\$@ now '$@'"); #$dbh->trace(2); eval { local $dbh->{ AutoCommit } = 1; # This breaks die! die "BANG!!!\n"; }; Test($@ eq "BANG!!!\n", "\$@ value lost"); print "begin_work...\n"; Test($dbh->{AutoCommit}); Test(!$dbh->{BegunWork}); Test($dbh->begin_work); Test(!$dbh->{AutoCommit}); Test($dbh->{BegunWork}); $dbh->commit; Test(!$dbh->{BegunWork}); Test($dbh->{AutoCommit}); Test($dbh->begin_work({})); $dbh->rollback; Test($dbh->{AutoCommit}); Test(!$dbh->{BegunWork}); print "Doing a ping.\n"; $_ = $dbh->ping; Test($_); Test($_ eq '2'); # ping was DBD::ExampleP's ping print "Ensure CompatMode enabled.\n"; Test($dbh->{CompatMode}); print "Trying local quote.\n"; $dbh->{'proxy_quote'} = 'local'; Test($dbh->quote("quote's") eq "'quote''s'"); Test($dbh->quote(undef) eq "NULL"); print "Trying remote quote.\n"; $dbh->{'proxy_quote'} = 'remote'; Test($dbh->quote("quote's") eq "'quote''s'"); Test($dbh->quote(undef) eq "NULL"); # XXX the $optional param is undocumented and may be removed soon Test($dbh->quote_identifier('foo') eq '"foo"', $dbh->quote_identifier('foo')); Test($dbh->quote_identifier('f"o') eq '"f""o"', $dbh->quote_identifier('f"o')); Test($dbh->quote_identifier('foo','bar') eq '"foo"."bar"'); Test($dbh->quote_identifier('foo',undef,'bar') eq '"foo"."bar"'); Test($dbh->quote_identifier(undef,undef,'bar') eq '"bar"'); print "Trying commit with invalid number of parameters.\n"; eval { $dbh->commit('dummy') }; Test($@ =~ m/^DBI commit: invalid number of arguments:/) unless $DBI::PurePerl && Test(1); print "Trying select with unknown field name.\n"; my $cursor_e = $dbh->prepare("select unknown_field_name from ?"); Test(defined $cursor_e); Test(!$cursor_e->execute('a')); Test($DBI::err); Test($DBI::err == $dbh->err); Test($DBI::errstr =~ m/unknown_field_name/, $DBI::errstr); Test($DBI::errstr eq $dbh->errstr); Test($dbh->errstr eq $dbh->func('errstr')); my $dir = Cwd::cwd(); # a dir always readable on all platforms $dir = VMS::Filespec::unixify($dir) if $^O eq 'VMS'; print "Trying a real select.\n"; my $csr_a = $dbh->prepare("select mode,name from ?"); Test(ref $csr_a); Test($csr_a->execute($dir)) or print "Execute failed: ", $csr_a->errstr(), "\n"; print "Repeating the select with second handle.\n"; my $csr_b = $dbh->prepare("select mode,name from ?"); Test(ref $csr_b); Test($csr_b->execute($dir)); Test($csr_a != $csr_b); Test($csr_a->{NUM_OF_FIELDS} == 2); if ($DBI::PurePerl) { $csr_a->trace(2); use Data::Dumper; warn Dumper($csr_a->{Database}); } Test($csr_a->{Database}->{Driver}->{Name} eq 'Proxy', "Name=$csr_a->{Database}->{Driver}->{Name}"); $csr_a->trace(0), die if $DBI::PurePerl; my($col0, $col1); my(@row_a, @row_b); #$csr_a->trace(2); print "Trying bind_columns.\n"; Test($csr_a->bind_columns(undef, \($col0, $col1)) ); Test($csr_a->execute($dir)); @row_a = $csr_a->fetchrow_array; Test(@row_a); Test($row_a[0] eq $col0); Test($row_a[1] eq $col1); print "Trying bind_param.\n"; Test($csr_b->bind_param(1, $dir)); Test($csr_b->execute()); @row_b = @{ $csr_b->fetchrow_arrayref }; Test(@row_b); Test("@row_a" eq "@row_b"); @row_b = $csr_b->fetchrow_array; Test("@row_a" ne "@row_b") or printf("Expected something different from '%s', got '%s'\n", "@row_a", "@row_b"); print "Trying fetchrow_hashref.\n"; Test($csr_b->execute()); my $row_b = $csr_b->fetchrow_hashref; Test($row_b); print "row_a: @{[ @row_a ]}\n"; print "row_b: @{[ %$row_b ]}\n"; Test($row_b->{mode} == $row_a[0]); Test($row_b->{name} eq $row_a[1]); print "Trying fetchrow_hashref with FetchHashKeyName.\n"; do { #local $dbh->{TraceLevel} = 9; local $dbh->{FetchHashKeyName} = 'NAME_uc'; Test($dbh->{FetchHashKeyName} eq 'NAME_uc'); my $csr_c = $dbh->prepare("select mode,name from ?"); Test($csr_c->execute($dir), $DBI::errstr); $row_b = $csr_c->fetchrow_hashref; Test($row_b); print "row_b: @{[ %$row_b ]}\n"; Test($row_b->{MODE} eq $row_a[0]); }; print "Trying finish.\n"; Test($csr_a->finish); #Test($csr_b->finish); Test(1); print "Forcing destructor.\n"; $csr_a = undef; # force destruction of this cursor now Test(1); print "Trying fetchall_arrayref.\n"; Test($csr_b->execute()); my $r = $csr_b->fetchall_arrayref; Test($r); Test(@$r); Test($r->[0]->[0] == $row_a[0]); Test($r->[0]->[1] eq $row_a[1]); Test($csr_b->finish); print "Retrying unknown field name.\n"; my $csr_c; $csr_c = $dbh->prepare("select unknown_field_name1 from ?"); Test($csr_c); Test(!$csr_c->execute($dir)); Test($DBI::errstr =~ m/Unknown field names: unknown_field_name1/) or printf("Wrong error string: %s", $DBI::errstr); print "Trying RaiseError.\n"; $dbh->{RaiseError} = 1; Test($dbh->{RaiseError}); Test($csr_c = $dbh->prepare("select unknown_field_name2 from ?")); Test(!eval { $csr_c->execute(); 1 }); #print "$@\n"; Test($@ =~ m/Unknown field names: unknown_field_name2/); $dbh->{RaiseError} = 0; Test(!$dbh->{RaiseError}); print "Trying warnings.\n"; { my @warn; local($SIG{__WARN__}) = sub { push @warn, @_ }; $dbh->{PrintError} = 1; Test($dbh->{PrintError}); Test(($csr_c = $dbh->prepare("select unknown_field_name3 from ?"))); Test(!$csr_c->execute()); Test("@warn" =~ m/Unknown field names: unknown_field_name3/); $dbh->{PrintError} = 0; Test(!$dbh->{PrintError}); } $csr_c->finish(); print "Trying type_info_all.\n"; my $array = $dbh->type_info_all(); Test($array and ref($array) eq 'ARRAY') or printf("Expected ARRAY, got %s, error %s\n", DBI::neat($array), $dbh->errstr()); Test($array->[0] and ref($array->[0]) eq 'HASH'); my $ok = 1; for (my $i = 1; $i < @{$array}; $i++) { print "$array->[$i]\n"; $ok = 0 unless ($array->[$i] and ref($array->[$i]) eq 'ARRAY'); print "$ok\n"; } Test($ok); # Test the table_info method # First generate a list of all subdirectories $dir = $haveFileSpec ? File::Spec->curdir() : "."; Test(opendir(DIR, $dir)); my(%dirs, %unexpected, %missing); while (defined(my $file = readdir(DIR))) { $dirs{$file} = 1 if -d $file; } closedir(DIR); my $sth = $dbh->table_info(undef, undef, undef, undef); Test($sth) or warn "table_info failed: ", $dbh->errstr(), "\n"; %missing = %dirs; %unexpected = (); while (my $ref = $sth->fetchrow_hashref()) { print "table_info: Found table $ref->{'TABLE_NAME'}\n"; if (exists($missing{$ref->{'TABLE_NAME'}})) { delete $missing{$ref->{'TABLE_NAME'}}; } else { $unexpected{$ref->{'TABLE_NAME'}} = 1; } } Test(!$sth->errstr()) or print "Fetching table_info rows failed: ", $sth->errstr(), "\n"; Test(keys %unexpected == 0) or print "Unexpected directories: ", join(",", keys %unexpected), "\n"; Test(keys %missing == 0) or print "Missing directories: ", join(",", keys %missing), "\n"; # Test the tables method %missing = %dirs; %unexpected = (); print "Expecting directories ", join(",", keys %dirs), "\n"; foreach my $table ($dbh->tables()) { print "tables: Found table $table\n"; if (exists($missing{$table})) { delete $missing{$table}; } else { $unexpected{$table} = 1; } } Test(!$sth->errstr()) or print "Fetching table_info rows failed: ", $sth->errstr(), "\n"; Test(keys %unexpected == 0) or print "Unexpected directories: ", join(",", keys %unexpected), "\n"; Test(keys %missing == 0) or print "Missing directories: ", join(",", keys %missing), "\n"; # Test large recordsets for (my $i = 0; $i <= 300; $i += 100) { print "Testing the fake directories ($i).\n"; Test($csr_a = $dbh->prepare("SELECT name, mode FROM long_list_$i")); Test($csr_a->execute(), $DBI::errstr); my $ary = $csr_a->fetchall_arrayref; Test(!$DBI::errstr, $DBI::errstr); Test(@$ary == $i, "expected $i got ".@$ary); if ($i) { my @n1 = map { $_->[0] } @$ary; my @n2 = reverse map { "file$_" } 1..$i; Test("@n1" eq "@n2"); } else { Test(1); } } # Test the RowCacheSize attribute Test($csr_a = $dbh->prepare("SELECT * FROM ?")); Test($dbh->{'RowCacheSize'} == 20); Test($csr_a->{'RowCacheSize'} == 20); Test($csr_a->execute('long_list_50')); Test($csr_a->fetchrow_arrayref()); Test($csr_a->{'proxy_data'} and @{$csr_a->{'proxy_data'}} == 19); Test($csr_a->finish()); Test($dbh->{'RowCacheSize'} = 30); Test($dbh->{'RowCacheSize'} == 30); Test($csr_a->{'RowCacheSize'} == 30); Test($csr_a->execute('long_list_50')); Test($csr_a->fetchrow_arrayref()); Test($csr_a->{'proxy_data'} and @{$csr_a->{'proxy_data'}} == 29) or print("Expected 29 records in cache, got " . @{$csr_a->{'proxy_data'}} . "\n"); Test($csr_a->finish()); Test($csr_a->{'RowCacheSize'} = 10); Test($dbh->{'RowCacheSize'} == 30); Test($csr_a->{'RowCacheSize'} == 10); Test($csr_a->execute('long_list_50')); Test($csr_a->fetchrow_arrayref()); Test($csr_a->{'proxy_data'} and @{$csr_a->{'proxy_data'}} == 9) or print("Expected 9 records in cache, got " . @{$csr_a->{'proxy_data'}} . "\n"); Test($csr_a->finish()); $dbh->disconnect; # Test $dbh->func() # print "Testing \$dbh->func().\n"; # my %tables = map { $_ =~ /lib/ ? ($_, 1) : () } $dbh->tables(); # $ok = 1; # foreach my $t ($dbh->func('lib', 'examplep_tables')) { # defined(delete $tables{$t}) or print "Unexpected table: $t\n"; # } # Test(%tables == 0); if ($failed_tests) { warn "Proxy: @child_args\n"; for my $class (qw(Net::Daemon RPC::PlServer Storable)) { (my $pm = $class) =~ s/::/\//g; $pm .= ".pm"; my $version = eval { $class->VERSION } || '?'; warn sprintf "Using %-13s %-6s %s\n", $class, $version, $INC{$pm}; } warn join(", ", map { "$_=$ENV{$_}" } grep { /^LC_|LANG/ } keys %ENV)."\n"; warn "More info can be found in $dbitracelog\n"; #system("cat $dbitracelog"); } END { local $?; $handle->Terminate() if $handle; undef $handle; unlink $config_file if $config_file; if (!$failed_tests) { unlink 'dbiproxy.log'; unlink $dbitracelog if $dbitracelog; } }; 1; DBI-1.648/t/72childhandles.t0000644000031300001440000000720014742423677014631 0ustar00merijnusers#!perl -w $|=1; use strict; # # test script for the ChildHandles attribute # use DBI; use Test::More; my $HAS_WEAKEN = eval { require Scalar::Util; # this will croak() if this Scalar::Util doesn't have a working weaken(). Scalar::Util::weaken( my $test = [] ); # same test as in DBI.pm 1; }; if (!$HAS_WEAKEN) { chomp $@; print "1..0 # Skipped: Scalar::Util::weaken not available ($@)\n"; exit 0; } plan tests => 16; my $using_dbd_gofer = ($ENV{DBI_AUTOPROXY}||'') =~ /^dbi:Gofer.*transport=/i; my $drh; { # make 10 connections my @dbh; for (1 .. 10) { my $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); push @dbh, $dbh; } # get the driver handle $drh = $dbh[0]->{Driver}; ok $drh; # get the kids, should be the same list of connections my $db_handles = $drh->{ChildHandles}; is ref $db_handles, 'ARRAY'; is scalar @$db_handles, scalar @dbh; # make sure all the handles are there my $found = 0; foreach my $h (@dbh) { ++$found if grep { $h == $_ } @$db_handles; } is $found, scalar @dbh; } # now all the out-of-scope DB handles should be gone { my $handles = $drh->{ChildHandles}; my @db_handles = grep { defined } @$handles; is scalar @db_handles, 0, "All handles should be undef now"; } my $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); my $empty = $dbh->{ChildHandles}; is_deeply $empty, [], "ChildHandles should be an array-ref if wekref is available"; # test child handles for statement handles { my @sth; my $sth_count = 20; for (1 .. $sth_count) { my $sth = $dbh->prepare('SELECT name FROM t'); push @sth, $sth; } my $handles = $dbh->{ChildHandles}; is scalar @$handles, scalar @sth; # test a recursive walk like the one in the docs my @lines; sub show_child_handles { my ($h, $level) = @_; $level ||= 0; push(@lines, sprintf "%sh %s %s\n", $h->{Type}, "\t" x $level, $h); show_child_handles($_, $level + 1) for (grep { defined } @{$h->{ChildHandles}}); } my $drh = $dbh->{Driver}; show_child_handles($drh, 0); print @lines[0..4]; is scalar @lines, $sth_count + 2; like $lines[0], qr/^drh/; like $lines[1], qr/^dbh/; like $lines[2], qr/^sth/; } my $handles = $dbh->{ChildHandles}; my @live = grep { defined $_ } @$handles; is scalar @live, 0, "handles should be gone now"; # test visit_child_handles { my $info; my $visitor = sub { my ($h, $info) = @_; my $type = $h->{Type}; ++$info->{ $type }{ ($type eq 'st') ? $h->{Statement} : $h->{Name} }; return $info; }; DBI->visit_handles($visitor, $info = {}); is_deeply $info, { 'dr' => { 'ExampleP' => 1, ($using_dbd_gofer) ? (Gofer => 1) : () }, 'db' => { '' => 1 }, }; my $sth1 = $dbh->prepare('SELECT name FROM t'); my $sth2 = $dbh->prepare('SELECT name FROM t'); DBI->visit_handles($visitor, $info = {}); is_deeply $info, { 'dr' => { 'ExampleP' => 1, ($using_dbd_gofer) ? (Gofer => 1) : () }, 'db' => { '' => 1 }, 'st' => { 'SELECT name FROM t' => 2 } }; } # test that the childhandle array does not grow uncontrollably SKIP: { skip "slow tests avoided when using DBD::Gofer", 2 if $using_dbd_gofer; for (1 .. 1000) { my $sth = $dbh->prepare('SELECT name FROM t'); } my $handles = $dbh->{ChildHandles}; cmp_ok scalar @$handles, '<', 1000; my @live = grep { defined } @$handles; is scalar @live, 0; } 1; DBI-1.648/t/14utf8.t0000644000031300001440000000313315205537614013062 0ustar00merijnusers#!perl -w # vim:ts=8:sw=4 $|=1; use Test::More; use DBI; eval { require Storable; import Storable qw(dclone); require Encode; import Encode qw(_utf8_on _utf8_off is_utf8); }; plan skip_all => "Unable to load required module ($@)" unless defined &_utf8_on; plan tests => 16; my $dbh = DBI->connect("dbi:Sponge:foo","","", { PrintError => 0, RaiseError => 1, }); my $source_rows = [ # data for DBD::Sponge to return via fetch [ 41, "AAA", 9 ], [ 42, "BB", undef ], [ 43, undef, 7 ], [ 44, "DDD", 6 ], ]; my($sth, $col0, $col1, $col2, $rows); # set utf8 on one of the columns so we can check it carries through into the # keys of fetchrow_hashref my @col_names = qw(Col1 Col2 Col3); _utf8_on($col_names[1]); ok is_utf8($col_names[1]); ok !is_utf8($col_names[0]); $sth = $dbh->prepare("foo", { rows => dclone($source_rows), NAME => \@col_names, }); ok($sth->bind_columns(\($col0, $col1, $col2)) ); ok($sth->execute(), $DBI::errstr); ok $sth->fetch; cmp_ok $col1, 'eq', "AAA"; ok !is_utf8($col1); # force utf8 flag on _utf8_on($col1); ok is_utf8($col1); ok $sth->fetch; cmp_ok $col1, 'eq', "BB"; # XXX sadly this test doesn't detect the problem when using DBD::Sponge # because DBD::Sponge uses $sth->_set_fbav (correctly) and that uses # sv_setsv which doesn't have the utf8 persistence that sv_setpv does. ok !is_utf8($col1); # utf8 flag should have been reset ok $sth->fetch; ok !defined $col1; # null ok !is_utf8($col1); # utf8 flag should have been reset ok my $hash = $sth->fetchrow_hashref; ok 1 == grep { is_utf8($_) } keys %$hash; $sth->finish; # end DBI-1.648/t/11fetch.t0000644000031300001440000000564212127465144013267 0ustar00merijnusers#!perl -w # vim:ts=8:sw=4 $|=1; use strict; use Test::More; use DBI; use Storable qw(dclone); use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; plan tests => 24; my $dbh = DBI->connect("dbi:Sponge:foo","","", { PrintError => 0, RaiseError => 1, }); my $source_rows = [ # data for DBD::Sponge to return via fetch [ 41, "AAA", 9 ], [ 41, "BBB", 9 ], [ 42, "BBB", undef ], [ 43, "ccc", 7 ], [ 44, "DDD", 6 ], ]; sub go { my $source = shift || $source_rows; my $sth = $dbh->prepare("foo", { rows => dclone($source), NAME => [ qw(C1 C2 C3) ], }); ok($sth->execute(), $DBI::errstr); return $sth; } my($sth, $col0, $col1, $col2, $rows); # --- fetchrow_arrayref # --- fetchrow_array # etc etc # --- fetchall_hashref my @fetchall_hashref_results = ( # single keys C1 => { 41 => { C1 => 41, C2 => 'BBB', C3 => 9 }, 42 => { C1 => 42, C2 => 'BBB', C3 => undef }, 43 => { C1 => 43, C2 => 'ccc', C3 => 7 }, 44 => { C1 => 44, C2 => 'DDD', C3 => 6 } }, C2 => { AAA => { C1 => 41, C2 => 'AAA', C3 => 9 }, BBB => { C1 => 42, C2 => 'BBB', C3 => undef }, DDD => { C1 => 44, C2 => 'DDD', C3 => 6 }, ccc => { C1 => 43, C2 => 'ccc', C3 => 7 } }, [ 'C2' ] => { # single key within arrayref AAA => { C1 => 41, C2 => 'AAA', C3 => 9 }, BBB => { C1 => 42, C2 => 'BBB', C3 => undef }, DDD => { C1 => 44, C2 => 'DDD', C3 => 6 }, ccc => { C1 => 43, C2 => 'ccc', C3 => 7 } }, ); push @fetchall_hashref_results, ( # multiple keys [ 'C1', 'C2' ] => { '41' => { AAA => { C1 => '41', C2 => 'AAA', C3 => 9 }, BBB => { C1 => '41', C2 => 'BBB', C3 => 9 } }, '42' => { BBB => { C1 => '42', C2 => 'BBB', C3 => undef } }, '43' => { ccc => { C1 => '43', C2 => 'ccc', C3 => 7 } }, '44' => { DDD => { C1 => '44', C2 => 'DDD', C3 => 6 } } }, ); my %dump; while (my $keyfield = shift @fetchall_hashref_results) { my $expected = shift @fetchall_hashref_results; my $k = (ref $keyfield) ? "[@$keyfield]" : $keyfield; print "# fetchall_hashref($k)\n"; ok($sth = go()); my $result = $sth->fetchall_hashref($keyfield); ok($result); is_deeply($result, $expected); # $dump{$k} = dclone $result; # just for adding tests } warn Dumper \%dump if %dump; # test assignment to NUM_OF_FIELDS automatically alters the row buffer $sth = go(); my $row = $sth->fetchrow_arrayref; is scalar @$row, 3; is $sth->{NUM_OF_FIELDS}, 3; is scalar @{ $sth->_get_fbav }, 3; $sth->{NUM_OF_FIELDS} = 4; is $sth->{NUM_OF_FIELDS}, 4; is scalar @{ $sth->_get_fbav }, 4; $sth->{NUM_OF_FIELDS} = 2; is $sth->{NUM_OF_FIELDS}, 2; is scalar @{ $sth->_get_fbav }, 2; $sth->finish; if (0) { my @perf = map { [ int($_/100), $_, $_ ] } 0..10000; require Benchmark; Benchmark::timethis(10, sub { go(\@perf)->fetchall_hashref([ 'C1','C2','C3' ]) }); } 1; # end DBI-1.648/t/09trace.t0000644000031300001440000000665214742423677013317 0ustar00merijnusers#!perl -w # vim:sw=4:ts=8 use strict; use Test::More tests => 99; ## ---------------------------------------------------------------------------- ## 09trace.t ## ---------------------------------------------------------------------------- # ## ---------------------------------------------------------------------------- BEGIN { $ENV{DBI_TRACE} = 0; # for PurePerl - ensure DBI_TRACE is in the env use_ok( 'DBI' ); } $|=1; my $trace_file = "dbitrace$$.log"; 1 while unlink $trace_file; warn "Can't unlink existing $trace_file: $!" if -e $trace_file; my $orig_trace_level = DBI->trace; DBI->trace(3, $trace_file); # enable trace before first driver load my $dbh = DBI->connect('dbi:ExampleP(AutoCommit=>1):', undef, undef); die "Unable to connect to ExampleP driver: $DBI::errstr" unless $dbh; isa_ok($dbh, 'DBI::db'); $dbh->dump_handle("dump_handle test, write to log file", 2); DBI->trace(0, undef); # turn off and restore to STDERR SKIP: { skip "cygwin has buffer flushing bug", 1 if ($^O =~ /cygwin/i); ok( -s $trace_file, "trace file size = " . -s $trace_file); } DBI->trace($orig_trace_level); # no way to restore previous outfile XXX # Clean up when we're done. END { $dbh->disconnect if $dbh; 1 while unlink $trace_file; }; ## ---------------------------------------------------------------------------- # Check the database handle attributes. cmp_ok($dbh->{TraceLevel}, '==', $DBI::dbi_debug & 0xF, '... checking TraceLevel attribute'); 1 while unlink $trace_file; $dbh->trace(0, $trace_file); ok( -f $trace_file, '... trace file successfully created'); my @names = qw( SQL CON ENC DBD TXN foo bar baz boo bop ); my %flag; my $all_flags = 0; foreach my $name (@names) { print "parse_trace_flag $name\n"; ok( my $flag1 = $dbh->parse_trace_flag($name) ); ok( my $flag2 = $dbh->parse_trace_flags($name) ); is( $flag1, $flag2 ); $dbh->{TraceLevel} = $flag1; is( $dbh->{TraceLevel}, $flag1 ); $dbh->{TraceLevel} = 0; is( $dbh->{TraceLevel}, 0 ); $dbh->trace($flag1); is $dbh->trace, $flag1; is $dbh->{TraceLevel}, $flag1; $dbh->{TraceLevel} = $name; # set by name $dbh->{TraceLevel} = undef; # check no change on undef is( $dbh->{TraceLevel}, $flag1 ); $flag{$name} = $flag1; $all_flags |= $flag1 if defined $flag1; # reduce noise if there's a bug } print "parse_trace_flag @names\n"; ok(eq_set([ keys %flag ], [ @names ]), '...'); $dbh->{TraceLevel} = 0; $dbh->{TraceLevel} = join "|", @names; is($dbh->{TraceLevel}, $all_flags, '...'); { print "inherit\n"; my $sth = $dbh->prepare("select ctime, name from foo"); isa_ok( $sth, 'DBI::st' ); is( $sth->{TraceLevel}, $all_flags ); } $dbh->{TraceLevel} = 0; ok !$dbh->{TraceLevel}; $dbh->{TraceLevel} = 'ALL'; ok $dbh->{TraceLevel}; { print "test unknown parse_trace_flag\n"; my $warn = 0; local $SIG{__WARN__} = sub { if ($_[0] =~ /unknown/i) { ++$warn; print "caught warn: ",@_ }else{ warn @_ } }; is $dbh->parse_trace_flag("nonesuch"), undef; is $warn, 0; is $dbh->parse_trace_flags("nonesuch"), 0; is $warn, 1; is $dbh->parse_trace_flags("nonesuch|SQL|nonesuch2"), $dbh->parse_trace_flag("SQL"); is $warn, 2; } $dbh->dump_handle("dump_handle test, write to log file", 2); $dbh->trace(0); ok !$dbh->{TraceLevel}; $dbh->trace(undef, "STDERR"); # close $trace_file ok( -s $trace_file ); 1; # end DBI-1.648/t/65transact.t0000644000031300001440000000120212127465144014012 0ustar00merijnusers#!perl -w $|=1; use strict; use DBI; use Test::More; plan skip_all => 'Transactions not supported by DBD::Gofer' if $ENV{DBI_AUTOPROXY} && $ENV{DBI_AUTOPROXY} =~ /^dbi:Gofer/i; plan tests => 10; my $dbh = DBI->connect('dbi:ExampleP(AutoCommit=>1):', undef, undef) or die "Unable to connect to ExampleP driver: $DBI::errstr"; print "begin_work...\n"; ok($dbh->{AutoCommit}); ok(!$dbh->{BegunWork}); ok($dbh->begin_work); ok(!$dbh->{AutoCommit}); ok($dbh->{BegunWork}); $dbh->commit; ok($dbh->{AutoCommit}); ok(!$dbh->{BegunWork}); ok($dbh->begin_work({})); $dbh->rollback; ok($dbh->{AutoCommit}); ok(!$dbh->{BegunWork}); 1; DBI-1.648/t/07kids.t0000644000031300001440000000704712127465144013136 0ustar00merijnusers#!perl -w $|=1; use strict; use Test::More; use DBI 1.50; # also tests Exporter::require_version BEGIN { plan skip_all => '$h->{Kids} attribute not supported for DBI::PurePerl' if $DBI::PurePerl && $DBI::PurePerl; # doubled to avoid typo warning plan tests => 20; } ## ---------------------------------------------------------------------------- ## 07kids.t ## ---------------------------------------------------------------------------- # This test check the Kids and the ActiveKids attributes and how they act # in various situations. # # Check the database handle's kids: # - upon creation of handle # - upon creation of statement handle # - after execute of statement handle # - after finish of statement handle # - after destruction of statement handle # Check the driver handle's kids: # - after creation of database handle # - after disconnection of database handle # - after destruction of database handle ## ---------------------------------------------------------------------------- # Connect to the example driver and create a database handle my $dbh = DBI->connect('dbi:ExampleP:dummy', '', '', { PrintError => 1, RaiseError => 0 }); # check our database handle to make sure its good isa_ok($dbh, 'DBI::db'); # check that it has no Kids or ActiveKids yet cmp_ok($dbh->{Kids}, '==', 0, '... database handle has 0 Kid(s) at start'); cmp_ok($dbh->{ActiveKids}, '==', 0, '... database handle has 0 ActiveKid(s) at start'); # create a scope for our $sth to live and die in do { # create a statement handle my $sth = $dbh->prepare('select uid from ./'); # verify that it is a correct statement handle isa_ok($sth, "DBI::st"); # check our Kids and ActiveKids after prepare cmp_ok($dbh->{Kids}, '==', 1, '... database handle has 1 Kid(s) after $dbh->prepare'); cmp_ok($dbh->{ActiveKids}, '==', 0, '... database handle has 0 ActiveKid(s) after $dbh->prepare'); $sth->execute(); # check our Kids and ActiveKids after execute cmp_ok($dbh->{Kids}, '==', 1, '... database handle has 1 Kid(s) after $sth->execute'); cmp_ok($dbh->{ActiveKids}, '==', 1, '... database handle has 1 ActiveKid(s) after $sth->execute'); $sth->finish(); # check our Kids and Activekids after finish cmp_ok($dbh->{Kids}, '==', 1, '... database handle has 1 Kid(s) after $sth->finish'); cmp_ok($dbh->{ActiveKids}, '==', 0, '... database handle has 0 ActiveKid(s) after $sth->finish'); }; # now check it after the statement handle has been destroyed cmp_ok($dbh->{Kids}, '==', 0, '... database handle has 0 Kid(s) after $sth is destroyed'); cmp_ok($dbh->{ActiveKids}, '==', 0, '... database handle has 0 ActiveKid(s) after $sth is destroyed'); # get the database handles driver Driver my $drh = $dbh->{Driver}; # check that is it a correct driver handle isa_ok($drh, "DBI::dr"); # check the driver's Kids and ActiveKids cmp_ok( $drh->{Kids}, '==', 1, '... driver handle has 1 Kid(s)'); cmp_ok( $drh->{ActiveKids}, '==', 1, '... driver handle has 1 ActiveKid(s)'); $dbh->disconnect; # check the driver's Kids and ActiveKids after $dbh->disconnect cmp_ok( $drh->{Kids}, '==', 1, '... driver handle has 1 Kid(s) after $dbh->disconnect'); cmp_ok( $drh->{ActiveKids}, '==', 0, '... driver handle has 0 ActiveKid(s) after $dbh->disconnect'); undef $dbh; ok(!defined($dbh), '... lets be sure that $dbh is not undefined'); # check the driver's Kids and ActiveKids after undef $dbh cmp_ok( $drh->{Kids}, '==', 0, '... driver handle has 0 Kid(s) after undef $dbh'); cmp_ok( $drh->{ActiveKids}, '==', 0, '... driver handle has 0 ActiveKid(s) after undef $dbh'); DBI-1.648/t/73cachedkids.t0000644000031300001440000000341614656646601014275 0ustar00merijnusersuse warnings; use strict; use Scalar::Util qw( weaken reftype refaddr blessed ); use DBI; use B (); use Tie::Hash (); use Test::More; my (%weak_dbhs, %weak_caches); # past this scope everything should be gone { ### get two identical connections my @dbhs = map { DBI->connect('dbi:ExampleP::memory:', undef, undef, { RaiseError => 1 }) } (1,2); ### get weakrefs on both handles %weak_dbhs = map { refdesc($_) => $_ } @dbhs; weaken $_ for values %weak_dbhs; ### tie the first one's cache if (1) { ok( tie( my %cache, 'Tie::StdHash'), refdesc($dbhs[0]) . ' cache tied' ); $dbhs[0]->{CachedKids} = \%cache; } ### prepare something on both $_->prepare_cached( 'SELECT name FROM .' ) for @dbhs; ### get weakrefs of both caches %weak_caches = map { sprintf( 'statement cache of %s (%s)', refdesc($_), refdesc($_->{CachedKids}) ) => $_->{CachedKids} } @dbhs; weaken $_ for values %weak_caches; ### check both caches have entries is (scalar keys %{$weak_caches{$_}}, 1, "One cached statement found in $_") for keys %weak_caches; ### check both caches have sane refcounts is ( refcount( $weak_caches{$_} ), 1, "Refcount of $_ correct") for keys %weak_caches; ### check both dbh have sane refcounts is ( refcount( $weak_dbhs{$_} ), 1, "Refcount of $_ correct") for keys %weak_dbhs; note "Exiting scope"; @dbhs=(); } # check both $dbh weakrefs are gone is ($weak_dbhs{$_}, undef, "$_ garbage collected") for keys %weak_dbhs; is ($weak_caches{$_}, undef, "$_ garbage collected") for keys %weak_caches; sub refdesc { sprintf '%s%s(0x%x)', ( defined( $_[1] = blessed $_[0]) ? "$_[1]=" : '' ), reftype $_[0], refaddr($_[0]), ; } sub refcount { B::svref_2object($_[0])->REFCNT; } done_testing; DBI-1.648/t/54_dbd_mem.t0000644000031300001440000000207614742423677013743 0ustar00merijnusers#!perl -w $|=1; use strict; use Cwd; use File::Path; use File::Spec; use Test::More; my $using_dbd_gofer = ($ENV{DBI_AUTOPROXY}||"") =~ /^dbi:Gofer.*transport=/i; $using_dbd_gofer and plan skip_all => "modifying meta data doesn't work with Gofer-AutoProxy"; my $tbl; BEGIN { $tbl = "db_". $$ . "_" }; #END { $tbl and unlink glob "${tbl}*" } use_ok ("DBI"); use_ok ("DBD::Mem"); my $dbh = DBI->connect( "DBI:Mem:", undef, undef, { PrintError => 0, RaiseError => 0, } ); # Can't use DBI::DBD::SqlEngine direct for my $sql ( split "\n", <<"" ) CREATE TABLE foo (id INT, foo TEXT) CREATE TABLE bar (id INT, baz TEXT) INSERT INTO foo VALUES (1, 'Hello world') INSERT INTO bar VALUES (1, 'Bugfixes welcome') INSERT bar VALUES (2, 'Bug reports, too') SELECT foo FROM foo where ID=1 UPDATE bar SET id=5 WHERE baz='Bugfixes welcome' DELETE FROM foo DELETE FROM bar WHERE baz='Bugfixes welcome' { my $done; $sql =~ s/^\s+//; eval { $done = $dbh->do( $sql ); }; ok( $done, "executed '$sql'" ) or diag $dbh->errstr; } done_testing (); DBI-1.648/t/90sql_type_cast.t0000644000031300001440000001445114742423677015067 0ustar00merijnusers# $Id$ # Test DBI::sql_type_cast use strict; #use warnings; this script generate warnings deliberately as part of the test use Test::More; use DBI qw(:sql_types :utils); use Config; # https://metacpan.org/release/MLEHMANN/Canary-Stability-2013/source/Stability.pm#L146 # 5.022 is the last supported perl for JSON::XS. my $jx = $] >= 5.022000 ? 0 : eval {require JSON::XS;}; my $dp = eval {require Data::Peek;}; my $pp = $DBI::PurePerl && $DBI::PurePerl; # doubled to avoid typo warning # NOTE: would have liked to use DBI::neat to test the cast value is what # we expect but unfortunately neat uses SvNIOK(sv) so anything that looks # like a number is printed as a number without quotes even if it has # a pv. use constant INVALID_TYPE => -2; use constant SV_IS_UNDEF => -1; use constant NO_CAST_STRICT => 0; use constant NO_CAST_NO_STRICT => 1; use constant CAST_OK => 2; my @tests = ( ['undef', undef, SQL_INTEGER, SV_IS_UNDEF, -1, q{[null]}], ['invalid sql type', "99", 123456789, 0, INVALID_TYPE, q{["99"]}], ['non numeric cast to int', "aa", SQL_INTEGER, 0, NO_CAST_NO_STRICT, q{["aa"]}], ['non numeric cast to int (strict)', "aa", SQL_INTEGER, DBIstcf_STRICT, NO_CAST_STRICT, q{["aa"]}], ['small int cast to int', "99", SQL_INTEGER, 0, CAST_OK, q{["99"]}], ['2 byte max signed int cast to int', "32767", SQL_INTEGER, 0, CAST_OK, q{["32767"]}], ['2 byte max unsigned int cast to int', "65535", SQL_INTEGER, 0, CAST_OK, q{["65535"]}], ['4 byte max signed int cast to int', "2147483647", SQL_INTEGER, 0, CAST_OK, q{["2147483647"]}], ['4 byte max unsigned int cast to int', "4294967295", SQL_INTEGER, 0, CAST_OK, q{["4294967295"]}], ['small int cast to int (discard)', "99", SQL_INTEGER, DBIstcf_DISCARD_STRING, CAST_OK, q{[99]}], ['non numeric cast to numeric', "aa", SQL_NUMERIC, 0, NO_CAST_NO_STRICT, q{["aa"]}], ['non numeric cast to numeric (strict)', "aa", SQL_NUMERIC, DBIstcf_STRICT, NO_CAST_STRICT, q{["aa"]}], ); unless ($pp) { # some tests cannot be performed with PurePerl as numbers don't # overflow in the same way as XS. push @tests, ( ['very large int cast to int', "99999999999999999999", SQL_INTEGER, 0, NO_CAST_NO_STRICT, q{["99999999999999999999"]}], ['very large int cast to int (strict)', "99999999999999999999", SQL_INTEGER, DBIstcf_STRICT, NO_CAST_STRICT, q{["99999999999999999999"]}], ['float cast to int', "99.99", SQL_INTEGER, 0, NO_CAST_NO_STRICT, q{["99.99"]}], ['float cast to int (strict)', "99.99", SQL_INTEGER, DBIstcf_STRICT, NO_CAST_STRICT, q{["99.99"]}], ['float cast to double', "99.99", SQL_DOUBLE, 0, CAST_OK, q{["99.99"]}] ); if ($Config{ivsize} == 4) { push @tests, ['4 byte max unsigned int cast to int (ivsize=4)', "4294967296", SQL_INTEGER, 0, NO_CAST_NO_STRICT, q{["4294967296"]}]; } elsif ($Config{ivsize} >= 8) { push @tests, ['4 byte max unsigned int cast to int (ivsize>8)', "4294967296", SQL_INTEGER, 0, CAST_OK, q{["4294967296"]}]; } } if ($] >= 5.010001) { # Some numeric tests fail the return value test on Perls before 5.10.1 # because sv_2nv leaves NOK set - changed in 5.10.1 probably via the # following change: # The public IV and NV flags are now not set if the string # value has trailing "garbage". This behaviour is consistent with not # setting the public IV or NV flags if the value is out of range for the # type. push @tests, ( ['non numeric cast to double', "aabb", SQL_DOUBLE, 0, NO_CAST_NO_STRICT, q{["aabb"]}], ['non numeric cast to double (strict)', "aabb", SQL_DOUBLE, DBIstcf_STRICT, NO_CAST_STRICT, q{["aabb"]}] ); } my $tests = @tests; $tests *= 2 if $jx; foreach (@tests) { $tests++ if ($dp) && ($_->[3] & DBIstcf_DISCARD_STRING); $tests++ if ($dp) && ($_->[2] == SQL_DOUBLE); } plan tests => $tests; foreach my $test(@tests) { my $val = $test->[1]; #diag(join(",", map {neat($_)} Data::Peek::DDual($val))); my $result; { no warnings; # lexical but also affects XS sub local $^W = 0; # needed for PurePerl tests $result = sql_type_cast($val, $test->[2], $test->[3]); } is($result, $test->[4], "result, $test->[0]"); if ($jx) { SKIP: { skip 'DiscardString not supported in PurePerl', 1 if $pp && ($test->[3] & DBIstcf_DISCARD_STRING); my $json = JSON::XS->new->encode([$val]); #diag(neat($val), ",", $json); # This test is about quotation of the value, not about the # style/formatting of JSON. Strip all leading/trailing # whitespace that is not part of the test, treating '[99]' # identical to ' [ 99 ] ' or '[99 ]' $json =~ s{^\s*\[\s*(.*?)\s*\]\s*$}{[$1]}; is($json, $test->[5], "json $test->[0]"); }; } if ($dp) { my ($pv, $iv, $nv, $rv, $hm); ($pv, $iv, $nv, $rv, $hm) = Data::Peek::DDual($val); if ($test->[3] & DBIstcf_DISCARD_STRING) { #diag("D::P ",neat($pv), ",", neat($iv), ",", neat($nv), # ",", neat($rv)); SKIP: { skip 'DiscardString not supported in PurePerl', 1 if $pp; ok(!defined($pv), "dp: discard works, $test->[0]"); }; } if ($test->[2] == SQL_DOUBLE) { #diag("D::P ", neat($pv), ",", neat($iv), ",", neat($nv), # ",", neat($rv)); if ($test->[4] == CAST_OK) { ok(defined($nv), "dp: nv defined $test->[0]"); } else { ok(!defined($nv) || !$nv, "dp: nv not defined $test->[0]"); } } } } 1; DBI-1.648/t/53sqlengine_adv.t0000644000031300001440000000245714742423677015036 0ustar00merijnusers#!perl -w $| = 1; use strict; use warnings; require DBD::DBM; use File::Path; use File::Spec; use Test::More; use Cwd; use Config qw(%Config); use Storable qw(dclone); my $using_dbd_gofer = ( $ENV{DBI_AUTOPROXY} || '' ) =~ /^dbi:Gofer.*transport=/i; plan skip_all => "Modifying driver state won't compute running behind Gofer" if($using_dbd_gofer); use DBI; # <[Sno]> what I could do is create a new test case where inserting into a DBD::DBM and after that clone the meta into a DBD::File $dbh # <[Sno]> would that help to get a better picture? do "./t/lib.pl"; my $dir = test_dir(); my $dbm_dbh = DBI->connect( 'dbi:DBM:', undef, undef, { f_dir => $dir, sql_identifier_case => 2, # SQL_IC_LOWER } ); $dbm_dbh->do(q/create table FRED (a integer, b integer)/); $dbm_dbh->do(q/insert into fRED (a,b) values(1,2)/); $dbm_dbh->do(q/insert into FRED (a,b) values(2,1)/); my $f_dbh = DBI->connect( 'dbi:File:', undef, undef, { f_dir => $dir, sql_identifier_case => 2, # SQL_IC_LOWER } ); my $dbm_fred_meta = $dbm_dbh->f_get_meta("fred", [qw(dbm_type)]); $f_dbh->f_new_meta( "fred", {sql_table_class => "DBD::DBM::Table"} ); my $r = $f_dbh->selectall_arrayref(q/select * from Fred/); ok( @$r == 2, 'rows found via mixed case table' ); done_testing(); DBI-1.648/t/42prof_data.t0000644000031300001440000001037714742423677014154 0ustar00merijnusers#!perl -w $|=1; use strict; use DBI; use Config; use Test::More; use Data::Dumper; BEGIN { plan skip_all => 'profiling not supported for DBI::PurePerl' if $DBI::PurePerl; # clock instability on xen systems is a reasonably common cause of failure # http://www.nntp.perl.org/group/perl.cpan.testers/2009/05/msg3828158.html # so we'll skip automated testing on those systems plan skip_all => "skipping profile tests on xen (due to clock instability)" if $Config{osvers} =~ /xen/ # eg 2.6.18-4-xen-amd64 and $ENV{AUTOMATED_TESTING}; plan tests => 31; } BEGIN { use_ok( 'DBI::ProfileDumper' ); use_ok( 'DBI::ProfileData' ); } my $sql = "select mode,size,name from ?"; my $prof_file = "dbi$$.prof"; my $prof_backup = $prof_file . ".prev"; END { 1 while unlink $prof_file; 1 while unlink $prof_backup; } my $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1, Profile=>"6/DBI::ProfileDumper/File:$prof_file" }); isa_ok( $dbh, 'DBI::db', 'Created connection' ); require DBI::Profile; DBI::Profile->import(qw(dbi_time)); # do enough work to avoid 0's on systems that are very fast or have low res timers my $t1 = dbi_time(); foreach (1..20) { $dbh->do("set dummy=$_"); my $sth = $dbh->prepare($sql); for my $loop (1..90) { $sth->execute("."); $sth->fetchrow_hashref; $sth->finish; } $sth->{Profile}->flush_to_disk(); } $dbh->disconnect; undef $dbh; my $t2 = dbi_time(); note sprintf "DBI work done in %fs (%f - %f)", $t2-$t1, $t2, $t1; # wrote the profile to disk? ok(-s $prof_file, "Profile written to disk, non-zero size" ); # load up my $prof = DBI::ProfileData->new( File => $prof_file, Filter => sub { my ($path_ref, $data_ref) = @_; $path_ref->[0] =~ s/set dummy=\d/set dummy=N/; }, ); isa_ok( $prof, 'DBI::ProfileData' ); cmp_ok( $prof->count, '>=', 3, 'At least 3 profile data items' ); # try a few sorts my $nodes = $prof->nodes; $prof->sort(field => "longest"); my $longest = $nodes->[0][4]; ok($longest); $prof->sort(field => "longest", reverse => 1); cmp_ok( $nodes->[0][4], '<', $longest ); $prof->sort(field => "count"); my $most = $nodes->[0]; ok($most); $prof->sort(field => "count", reverse => 1); cmp_ok( $nodes->[0][0], '<', $most->[0] ); # remove the top count and make sure it's gone my $clone = $prof->clone(); isa_ok( $clone, 'DBI::ProfileData' ); $clone->sort(field => "count"); ok($clone->exclude(key1 => $most->[7])); # compare keys of the new first element and the old one to make sure # exclude works ok($clone->nodes()->[0][7] ne $most->[7] && $clone->nodes()->[0][8] ne $most->[8]); # there can only be one $clone = $prof->clone(); isa_ok( $clone, 'DBI::ProfileData' ); ok($clone->match(key1 => $clone->nodes->[0][7])); ok($clone->match(key2 => $clone->nodes->[0][8])); ok($clone->count == 1); # take a look through Data my $Data = $prof->Data; print "SQL: $_\n" for keys %$Data; ok(exists($Data->{$sql}), "Data for '$sql' should exist") or print Dumper($Data); ok(exists($Data->{$sql}{execute}), "Data for '$sql'->{execute} should exist"); # did the Filter convert set dummy=1 (etc) into set dummy=N? ok(exists($Data->{"set dummy=N"})); # test escaping of \n and \r in keys $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1, Profile=>"6/DBI::ProfileDumper/File:$prof_file" }); isa_ok( $dbh, 'DBI::db', 'Created connection' ); my $sql2 = 'select size from . where name = "LITERAL: \r\n"'; my $sql3 = "select size from . where name = \"EXPANDED: \r\n\""; # do a little work foreach (1,2,3) { my $sth2 = $dbh->prepare($sql2); isa_ok( $sth2, 'DBI::st' ); $sth2->execute(); $sth2->fetchrow_hashref; $sth2->finish; my $sth3 = $dbh->prepare($sql3); isa_ok( $sth3, 'DBI::st' ); $sth3->execute(); $sth3->fetchrow_hashref; $sth3->finish; } $dbh->disconnect; undef $dbh; # load dbi.prof $prof = DBI::ProfileData->new( File => $prof_file, DeleteFiles => 1 ); isa_ok( $prof, 'DBI::ProfileData' ); ok(not(-e $prof_file), "file should be deleted when DeleteFiles set" ); # make sure the keys didn't get garbled $Data = $prof->Data; ok(exists $Data->{$sql2}, "Data for '$sql2' should exist") or print Dumper($Data); ok(exists $Data->{$sql3}, "Data for '$sql3' should exist") or print Dumper($Data); 1; DBI-1.648/t/49dbd_file.t0000644000031300001440000002000615206013200013707 0ustar00merijnusers#!perl -w $|=1; use strict; use Cwd; use File::Path; use File::Spec; use Test::More; my $using_dbd_gofer = ($ENV{DBI_AUTOPROXY}||"") =~ /^dbi:Gofer.*transport=/i; my $tbl; BEGIN { $tbl = "db_". $$ . "_" }; #END { $tbl and unlink glob "${tbl}*" } use_ok ("DBI"); use_ok ("DBD::File"); do "./t/lib.pl"; my $dir = test_dir (); my $rowidx = 0; my @rows = ( [ "Hello World" ], [ "Hello DBI Developers" ], ); my $dbh; # Check if we can connect at all ok ($dbh = DBI->connect ("dbi:File:"), "Connect clean"); is (ref $dbh, "DBI::db", "Can connect to DBD::File driver"); my $f_versions = $dbh->func ("f_versions"); note $f_versions; ok ($f_versions, "f_versions"); # Check if all the basic DBI attributes are accepted ok ($dbh = DBI->connect ("dbi:File:", undef, undef, { RaiseError => 1, PrintError => 1, AutoCommit => 1, ChopBlanks => 1, ShowErrorStatement => 1, FetchHashKeyName => "NAME_lc", }), "Connect with DBI attributes"); # Check if all the f_ attributes are accepted, in two ways ok ($dbh = DBI->connect ("dbi:File:f_ext=.txt;f_dir=.;f_encoding=cp1252;f_schema=test"), "Connect with driver attributes in DSN"); my $encoding = "iso-8859-1"; # now use dir to prove file existence ok ($dbh = DBI->connect ("dbi:File:", undef, undef, { f_ext => ".txt", f_dir => $dir, f_schema => undef, f_encoding => $encoding, f_lock => 0, RaiseError => 0, PrintError => 0, }), "Connect with driver attributes in hash"); my $sth; ok ($sth = $dbh->prepare ("select * from t_sbdgf_53442Gz"), "Prepare select from non-existing file"); { my @msg; eval { local $SIG{__DIE__} = sub { push @msg, @_ }; $sth->execute; }; like ("@msg", qr{Cannot open .*t_sbdgf_}, "Cannot open non-existing file"); eval { note $dbh->f_get_meta ("t_sbdgf_53442Gz", "f_fqfn"); }; } SKIP: { my $fh; my $tbl2 = $tbl . "2"; my $tbl2_file1 = File::Spec->catfile ($dir, "$tbl2.txt"); open $fh, ">", $tbl2_file1 or skip; print $fh "You cannot read this anyway ..."; close $fh; my $tbl2_file2 = File::Spec->catfile ($dir, "$tbl2"); open $fh, ">", $tbl2_file2 or skip; print $fh "Neither that"; close $fh; ok ($dbh->do ("drop table if exists $tbl2"), "drop manually created table $tbl2 (first file)"); ok (! -f $tbl2_file1, "$tbl2_file1 removed"); ok ( -f $tbl2_file2, "$tbl2_file2 exists"); ok ($dbh->do ("drop table if exists $tbl2"), "drop manually created table $tbl2 (second file)"); ok (! -f $tbl2_file2, "$tbl2_file2 removed"); } my @tfhl; # Now test some basic SQL statements my $tbl_file = File::Spec->catfile (Cwd::abs_path ($dir), "$tbl.txt"); ok ($dbh->do ("create table $tbl (txt varchar (20))"), "Create table $tbl") or diag $dbh->errstr; ok (-f $tbl_file, "Test table exists"); is ($dbh->f_get_meta ($tbl, "f_fqfn"), $tbl_file, "get single table meta data"); is_deeply ($dbh->f_get_meta ([$tbl, "t_sbdgf_53442Gz"], [qw(f_dir f_ext)]), { $tbl => { f_dir => $dir, f_ext => ".txt", }, t_sbdgf_53442Gz => { f_dir => $dir, f_ext => ".txt", }, }, "get multiple meta data"); # Expected: ("unix", "perlio", "encoding(iso-8859-1)") # use Data::Peek; DDumper [ @tfh ]; my @layer = grep { $_ eq "encoding($encoding)" } @tfhl; is (scalar @layer, 1, "encoding shows in layer"); my @tables = sort $dbh->func ("list_tables"); is_deeply (\@tables, [sort "000_just_testing", $tbl], "Listing tables gives test table"); ok ($sth = $dbh->table_info (), "table_info"); @tables = sort { $a->[2] cmp $b->[2] } @{$sth->fetchall_arrayref}; is_deeply (\@tables, [ map { [ undef, undef, $_, 'TABLE', 'FILE' ] } sort "000_just_testing", $tbl ], "table_info gives test table"); SKIP: { $using_dbd_gofer and skip "modifying meta data doesn't work with Gofer-AutoProxy", 6; ok ($dbh->f_set_meta ($tbl, "f_dir", $dir), "set single meta datum"); is ($tbl_file, $dbh->f_get_meta ($tbl, "f_fqfn"), "verify set single meta datum"); ok ($dbh->f_set_meta ($tbl, { f_dir => $dir }), "set multiple meta data"); is ($tbl_file, $dbh->f_get_meta ($tbl, "f_fqfn"), "verify set multiple meta attributes"); ok($dbh->f_new_meta("t_bsgdf_3544G2z", { f_ext => undef, f_dir => $dir, }), "initialize new table (meta) with settings"); my $t_bsgdf_file = File::Spec->catfile (Cwd::abs_path ($dir), "t_bsgdf_3544G2z"); is($t_bsgdf_file, $dbh->f_get_meta ("t_bsgdf_3544G2z", "f_fqfn"), "verify create meta from scratch"); } ok ($sth = $dbh->prepare ("select * from $tbl"), "Prepare select * from $tbl"); $rowidx = 0; SKIP: { $using_dbd_gofer and skip "method intrusion didn't work with proxying", 1; ok ($sth->execute, "execute on $tbl"); $dbh->errstr and diag $dbh->errstr; } my $uctbl = uc ($tbl); ok ($sth = $dbh->prepare ("select * from $uctbl"), "Prepare select * from $uctbl"); $rowidx = 0; SKIP: { $using_dbd_gofer and skip "method intrusion didn't work with proxying", 1; ok ($sth->execute, "execute on $uctbl"); $dbh->errstr and diag $dbh->errstr; } # ==================== ReadOnly tests ============================= ok ($dbh = DBI->connect ("dbi:File:", undef, undef, { f_ext => ".txt", f_dir => $dir, f_schema => undef, f_encoding => $encoding, f_lock => 0, sql_meta => { $tbl => { col_names => [qw(txt)], } }, RaiseError => 0, PrintError => 0, ReadOnly => 1, }), "ReadOnly connect with driver attributes in hash"); ok ($sth = $dbh->prepare ("select * from $tbl"), "Prepare select * from $tbl"); $rowidx = 0; SKIP: { $using_dbd_gofer and skip "method intrusion didn't work with proxying", 3; ok ($sth->execute, "execute on $tbl"); like ($_, qr{^[0-9]+$}, "TYPE is numeric") for @{$sth->{TYPE}}; like ($_, qr{^[A-Z]\w+$}, "TYPE_NAME is set") for @{$sth->{TYPE_NAME}}; $dbh->errstr and diag $dbh->errstr; } ok ($sth = $dbh->prepare ("insert into $tbl (txt) values (?)"), "prepare 'insert into $tbl'"); is ($sth->execute ("Perl rules"), undef, "insert failed intentionally"); ok ($sth = $dbh->prepare ("delete from $tbl"), "prepare 'delete from $tbl'"); is ($sth->execute (), undef, "delete failed intentionally"); is ($dbh->do ("drop table $tbl"), undef, "table drop failed intentionally"); is (-f $tbl_file, 1, "Test table not removed"); # ==================== ReadWrite again tests ====================== ok ($dbh = DBI->connect ("dbi:File:", undef, undef, { f_ext => ".txt", f_dir => $dir, f_schema => undef, f_encoding => $encoding, f_lock => 0, RaiseError => 0, PrintError => 0, }), "ReadWrite for drop connect with driver attributes in hash"); # XXX add a truncate test ok ($dbh->do ("drop table $tbl"), "table drop"); is (-s $tbl_file, undef, "Test table removed"); # -s => size test # ==================== Nonexisting top-dir ======================== my %drh = DBI->installed_drivers; my $qer = qr{\bNo such directory}; foreach my $tld ("./non-existing", "nonexisting_folder", "/Fr-dle/hurd0k/ok$$") { is (DBI->connect ("dbi:File:", undef, undef, { f_dir => $tld, RaiseError => 0, PrintError => 0, }), undef, "Should not be able to open a DB to $tld"); like ($DBI::errstr, $qer, "Error message"); $drh{File}->set_err (undef, ""); is ($DBI::errstr, undef, "Cleared error"); my $dbh; eval { $dbh = DBI->connect ("dbi:File:", undef, undef, { f_dir => $tld, RaiseError => 1, PrintError => 0, })}; is ($dbh, undef, "connect () should die on $tld with RaiseError"); like ($@, $qer, "croak message"); like ($DBI::errstr, $qer, "Error message"); } done_testing (); sub DBD::File::Table::fetch_row ($$) { my ($self, $data) = @_; my $meta = $self->{meta}; if ($rowidx >= scalar @rows) { $self->{row} = undef; } else { $self->{row} = $rows[$rowidx++]; } return $self->{row}; } # fetch_row sub DBD::File::Table::push_names ($$$) { my ($self, $data, $row_aryref) = @_; my $meta = $self->{meta}; @tfhl = PerlIO::get_layers ($meta->{fh}); @{$meta->{col_names}} = @{$row_aryref}; } # push_names DBI-1.648/t/04mods.t0000644000031300001440000000350712127465144013140 0ustar00merijnusers#!perl -w $|=1; use strict; use Test::More tests => 12; ## ---------------------------------------------------------------------------- ## 04mods.t - ... ## ---------------------------------------------------------------------------- # Note: # the modules tested here are all marked as new and not guaranteed, so this if # they change, these will fail. ## ---------------------------------------------------------------------------- BEGIN { use_ok( 'DBI' ); # load these first, since the other two load them # and we want to catch the error first use_ok( 'DBI::Const::GetInfo::ANSI' ); use_ok( 'DBI::Const::GetInfo::ODBC' ); use_ok( 'DBI::Const::GetInfoType', qw(%GetInfoType) ); use_ok( 'DBI::Const::GetInfoReturn', qw(%GetInfoReturnTypes %GetInfoReturnValues) ); } ## test GetInfoType cmp_ok(scalar(keys(%GetInfoType)), '>', 1, '... we have at least one key in the GetInfoType hash'); is_deeply( \%GetInfoType, { %DBI::Const::GetInfo::ANSI::InfoTypes, %DBI::Const::GetInfo::ODBC::InfoTypes }, '... the GetInfoType hash is constructed from the ANSI and ODBC hashes' ); ## test GetInfoReturnTypes cmp_ok(scalar(keys(%GetInfoReturnTypes)), '>', 1, '... we have at least one key in the GetInfoReturnType hash'); is_deeply( \%GetInfoReturnTypes, { %DBI::Const::GetInfo::ANSI::ReturnTypes, %DBI::Const::GetInfo::ODBC::ReturnTypes }, '... the GetInfoReturnType hash is constructed from the ANSI and ODBC hashes' ); ## test GetInfoReturnValues cmp_ok(scalar(keys(%GetInfoReturnValues)), '>', 1, '... we have at least one key in the GetInfoReturnValues hash'); # ... testing GetInfoReturnValues any further would be difficult ## test the two methods found in DBI::Const::GetInfoReturn can_ok('DBI::Const::GetInfoReturn', 'Format'); can_ok('DBI::Const::GetInfoReturn', 'Explain'); 1; DBI-1.648/t/50dbm_simple.t0000755000031300001440000002015414742423677014324 0ustar00merijnusers#!perl -w $|=1; use strict; use warnings; require DBD::DBM; use File::Path; use File::Spec; use Test::More; use Cwd; use Config qw(%Config); use Storable qw(dclone); my $using_dbd_gofer = ($ENV{DBI_AUTOPROXY}||'') =~ /^dbi:Gofer.*transport=/i; use DBI; my ( @mldbm_types, @dbm_types ); BEGIN { # 0=SQL::Statement if avail, 1=DBI::SQL::Nano # next line forces use of Nano rather than default behaviour # $ENV{DBI_SQL_NANO}=1; # This is done in zv*n*_50dbm_simple.t push @mldbm_types, ''; if (eval { require 'MLDBM.pm'; }) { push @mldbm_types, qw(Data::Dumper Storable); # both in CORE push @mldbm_types, 'FreezeThaw' if eval { require 'FreezeThaw.pm' }; push @mldbm_types, 'YAML' if eval { require MLDBM::Serializer::YAML; }; push @mldbm_types, 'JSON' if eval { require MLDBM::Serializer::JSON; }; } # Potential DBM modules in preference order (SDBM_File first) # skip NDBM and ODBM as they don't support EXISTS my @dbms = qw(SDBM_File GDBM_File DB_File BerkeleyDB NDBM_File ODBM_File); my @use_dbms = @ARGV; if( !@use_dbms && $ENV{DBD_DBM_TEST_BACKENDS} ) { @use_dbms = split ' ', $ENV{DBD_DBM_TEST_BACKENDS}; } if (lc "@use_dbms" eq "all") { # test with as many of the major DBM types as are available @dbm_types = grep { eval { no warnings; require "$_.pm" } } @dbms; } elsif (@use_dbms) { @dbm_types = @use_dbms; } else { # we only test SDBM_File by default to avoid tripping up # on any broken DBM's that may be installed in odd places. # It's only DBD::DBM we're trying to test here. # (However, if SDBM_File is not available, then use another.) for my $dbm (@dbms) { if (eval { no warnings; require "$dbm.pm" }) { @dbm_types = ($dbm); last; } } } if( eval { require List::MoreUtils; } ) { List::MoreUtils->import("part"); } else { # XXX from PP part of List::MoreUtils eval <<'EOP'; sub part(&@) { my ($code, @list) = @_; my @parts; push @{ $parts[$code->($_)] }, $_ for @list; return @parts; } EOP } } my $dbi_sql_nano = not DBD::DBM::Statement->isa('SQL::Statement'); do "./t/lib.pl"; my $dir = test_dir (); my %tests_statement_results = ( 2 => [ "DROP TABLE IF EXISTS fruit", -1, "CREATE TABLE fruit (dKey INT, dVal VARCHAR(10))", '0E0', "INSERT INTO fruit VALUES (1,'oranges' )", 1, "INSERT INTO fruit VALUES (2,'to_change' )", 1, "INSERT INTO fruit VALUES (3, NULL )", 1, "INSERT INTO fruit VALUES (4,'to delete' )", 1, "INSERT INTO fruit VALUES (?,?); #5,via placeholders", 1, "INSERT INTO fruit VALUES (6,'to delete' )", 1, "INSERT INTO fruit VALUES (7,'to_delete' )", 1, "DELETE FROM fruit WHERE dVal='to delete'", 2, "UPDATE fruit SET dVal='apples' WHERE dKey=2", 1, "DELETE FROM fruit WHERE dKey=7", 1, "SELECT * FROM fruit ORDER BY dKey DESC", [ [ 5, 'via placeholders' ], [ 3, '' ], [ 2, 'apples' ], [ 1, 'oranges' ], ], "DELETE FROM fruit", 4, $dbi_sql_nano ? () : ( "SELECT COUNT(*) FROM fruit", [ [ 0 ] ] ), "DROP TABLE fruit", -1, ], 3 => [ "DROP TABLE IF EXISTS multi_fruit", -1, "CREATE TABLE multi_fruit (dKey INT, dVal VARCHAR(10), qux INT)", '0E0', "INSERT INTO multi_fruit VALUES (1,'oranges' , 11 )", 1, "INSERT INTO multi_fruit VALUES (2,'to_change', 0 )", 1, "INSERT INTO multi_fruit VALUES (3, NULL , 13 )", 1, "INSERT INTO multi_fruit VALUES (4,'to_delete', 14 )", 1, "INSERT INTO multi_fruit VALUES (?,?,?); #5,via placeholders,15", 1, "INSERT INTO multi_fruit VALUES (6,'to_delete', 16 )", 1, "INSERT INTO multi_fruit VALUES (7,'to delete', 17 )", 1, "INSERT INTO multi_fruit VALUES (8,'to remove', 18 )", 1, "UPDATE multi_fruit SET dVal='apples', qux='12' WHERE dKey=2", 1, "DELETE FROM multi_fruit WHERE dVal='to_delete'", 2, "DELETE FROM multi_fruit WHERE qux=17", 1, "DELETE FROM multi_fruit WHERE dKey=8", 1, "SELECT * FROM multi_fruit ORDER BY dKey DESC", [ [ 5, 'via placeholders', 15 ], [ 3, undef, 13 ], [ 2, 'apples', 12 ], [ 1, 'oranges', 11 ], ], "DELETE FROM multi_fruit", 4, $dbi_sql_nano ? () : ( "SELECT COUNT(*) FROM multi_fruit", [ [ 0 ] ] ), "DROP TABLE multi_fruit", -1, ], ); print "Using DBM modules: @dbm_types\n"; print "Using MLDBM serializers: @mldbm_types\n" if @mldbm_types; my %test_statements; my %expected_results; for my $columns ( 2 .. 3 ) { my $i = 0; my @tests = part { $i++ % 2 } @{ $tests_statement_results{$columns} }; @{ $test_statements{$columns} } = @{$tests[0]}; @{ $expected_results{$columns} } = @{$tests[1]}; } unless (@dbm_types) { plan skip_all => "No DBM modules available"; } for my $mldbm ( @mldbm_types ) { my $columns = ($mldbm) ? 3 : 2; for my $dbm_type ( @dbm_types ) { print "\n--- Using $dbm_type ($mldbm) ---\n"; eval { do_test( $dbm_type, $mldbm, $columns) } or warn $@; } } done_testing(); sub do_test { my ($dtype, $mldbm, $columns) = @_; #diag ("Starting test: " . $starting_test_no); # The DBI can't test locking here, sadly, because of the risk it'll hang # on systems with broken NFS locking daemons. # (This test script doesn't test that locking actually works anyway.) # use f_lockfile in next release - use it here as test case only my $dsn ="dbi:DBM(RaiseError=0,PrintError=1):dbm_type=$dtype;dbm_mldbm=$mldbm;f_lockfile=.lck"; if ($using_dbd_gofer) { $dsn .= ";f_dir=$dir"; } my $dbh = DBI->connect( $dsn ); my $dbm_versions; if ($DBI::VERSION >= 1.37 # needed for install_method && !$ENV{DBI_AUTOPROXY} # can't transparently proxy driver-private methods ) { $dbm_versions = $dbh->dbm_versions; } else { $dbm_versions = $dbh->func('dbm_versions'); } note $dbm_versions; ok($dbm_versions, 'dbm_versions'); isa_ok($dbh, 'DBI::db'); # test if it correctly accepts valid $dbh attributes SKIP: { skip "Can't set attributes after connect using DBD::Gofer", 2 if $using_dbd_gofer; eval {$dbh->{f_dir}=$dir}; ok(!$@); eval {$dbh->{dbm_mldbm}=$mldbm}; ok(!$@); } # test if it correctly rejects invalid $dbh attributes # eval { local $SIG{__WARN__} = sub { } if $using_dbd_gofer; local $dbh->{RaiseError} = 1; local $dbh->{PrintError} = 0; $dbh->{dbm_bad_name}=1; }; ok($@); my @queries = @{$test_statements{$columns}}; my @results = @{$expected_results{$columns}}; SKIP: for my $idx ( 0 .. $#queries ) { my $sql = $queries[$idx]; $sql =~ s/\S*fruit/${dtype}_fruit/; # include dbm type in table name $sql =~ s/;$//; #diag($sql); # XXX FIX INSERT with NULL VALUE WHEN COLUMN NOT NULLABLE $dtype eq 'BerkeleyDB' and !$mldbm and 0 == index($sql, 'INSERT') and $sql =~ s/NULL/''/; $sql =~ s/\s*;\s*(?:#(.*))//; my $comment = $1; my $sth = $dbh->prepare($sql); ok($sth, "prepare $sql") or diag($dbh->errstr || 'unknown error'); my @bind; if($sth->{NUM_OF_PARAMS}) { @bind = split /,/, $comment; } # if execute errors we will handle it, not PrintError: $sth->{PrintError} = 0; my $n = $sth->execute(@bind); ok($n, 'execute') or diag($sth->errstr || 'unknown error'); next if (!defined($n)); is( $n, $results[$idx], $sql ) unless( 'ARRAY' eq ref $results[$idx] ); TODO: { local $TODO = "AUTOPROXY drivers might throw away sth->rows()" if($ENV{DBI_AUTOPROXY}); is( $n, $sth->rows, '$sth->execute(' . $sql . ') == $sth->rows' ) if( $sql =~ m/^(?:UPDATE|DELETE)/ ); } next unless $sql =~ /SELECT/; my $results=''; my $allrows = $sth->fetchall_arrayref(); my $expected_rows = $results[$idx]; is( $sth->rows, scalar( @{$expected_rows} ), $sql ); is_deeply( $allrows, $expected_rows, 'SELECT results' ); } my $sth = $dbh->table_info(); ok ($sth, "prepare table_info (without tables)"); my @tables = $sth->fetchall_arrayref; is_deeply( \@tables, [ [] ], "No tables delivered by table_info" ); $dbh->disconnect; return 1; } 1; DBI-1.648/t/86gofer_fail.t0000644000031300001440000001334714742423677014322 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- # vim:sw=4:ts=8 $|=1; use strict; use warnings; use DBI; use Data::Dumper; use Test::More; sub between_ok; # here we test the DBI_GOFER_RANDOM mechanism # and how gofer deals with failures plan skip_all => "requires Callbacks which are not supported with PurePerl" if $DBI::PurePerl; if (my $ap = $ENV{DBI_AUTOPROXY}) { # limit the insanity plan skip_all => "Gofer DBI_AUTOPROXY" if $ap =~ /^dbi:Gofer/i; # this means we have DBD::Gofer => DBD::Gofer => DBD::whatever # rather than disable it we let it run because we're twisted # and because it helps find more bugs (though debugging can be painful) warn "\n$0 is running with DBI_AUTOPROXY enabled ($ENV{DBI_AUTOPROXY})\n" unless $0 =~ /\bzv/; # don't warn for t/zvg_85gofer.t } plan 'no_plan'; my $tmp; my $dbh; my $fails; # we'll use the null transport for simplicity and speed # and the rush policy to limit the number of interactions with the gofer executor # silence the "DBI_GOFER_RANDOM..." warnings my @warns; $SIG{__WARN__} = sub { ("@_" =~ /^DBI_GOFER_RANDOM/) ? push(@warns, @_) : warn @_; }; # --- 100% failure rate ($fails, $dbh) = trial_impact("fail=100%,do", 10, "", sub { $_->do("set foo=1") }); is $fails, 100, 'should fail 100% of the time'; ok $@, '$@ should be set'; like $@, '/fake error from do method induced by DBI_GOFER_RANDOM/'; ok $dbh->errstr, 'errstr should be set'; like $dbh->errstr, '/DBI_GOFER_RANDOM/', 'errstr should contain DBI_GOFER_RANDOM'; ok !$dbh->{go_response}->executed_flag_set, 'go_response executed flag should be false'; # XXX randomness can't be predicted, so it's just possible these will fail srand(42); # try to limit occasional failures (effect will vary by platform etc) sub trial_impact { my ($spec, $count, $dsn_attr, $code, $verbose) = @_; local $ENV{DBI_GOFER_RANDOM} = $spec; my $dbh = dbi_connect("policy=rush;$dsn_attr"); local $_ = $dbh; my $fail_percent = percentage_exceptions(200, $code, $verbose); return $fail_percent unless wantarray; return ($fail_percent, $dbh); } # --- 50% failure rate, with no retries $fails = trial_impact("fail=50%,do", 200, "retry_limit=0", sub { $_->do("set foo=1") }); print "target approx 50% random failures, got $fails%\n"; between_ok $fails, 10, 90, "should fail about 50% of the time, but at least between 10% and 90%"; # --- 50% failure rate, with many retries (should yield low failure rate) $fails = trial_impact("fail=50%,prepare", 200, "retry_limit=5", sub { $_->prepare("set foo=1") }); print "target less than 20% effective random failures (ideally 0), got $fails%\n"; cmp_ok $fails, '<', 20, 'should fail < 20%'; # --- 10% failure rate, with many retries (should yield zero failure rate) $fails = trial_impact("fail=10,do", 200, "retry_limit=10", sub { $_->do("set foo=1") }); cmp_ok $fails, '<', 1, 'should fail < 1%'; # --- 50% failure rate, test is_idempotent $ENV{DBI_GOFER_RANDOM} = "fail=50%,do"; # 50% # test go_retry_hook and that ReadOnly => 1 retries a non-idempotent statement ok my $dbh_50r1ro = dbi_connect("policy=rush;retry_limit=1", { go_retry_hook => sub { return ($_[0]->is_idempotent) ? 1 : 0 }, ReadOnly => 1, } ); between_ok percentage_exceptions(100, sub { $dbh_50r1ro->do("set foo=1") }), 10, 40, 'should fail ~25% (ie 50% with one retry)'; between_ok $dbh_50r1ro->{go_transport}->meta->{request_retry_count}, 20, 80, 'transport request_retry_count should be around 50'; # test as above but with ReadOnly => 0 ok my $dbh_50r1rw = dbi_connect("policy=rush;retry_limit=1", { go_retry_hook => sub { return ($_[0]->is_idempotent) ? 1 : 0 }, ReadOnly => 0, } ); between_ok percentage_exceptions(100, sub { $dbh_50r1rw->do("set foo=1") }), 20, 80, 'should fail ~50%, ie no retries'; ok !$dbh_50r1rw->{go_transport}->meta->{request_retry_count}, 'transport request_retry_count should be zero or undef'; # --- check random is random and non-random is non-random my %fail_percents; for (1..5) { $fails = trial_impact("fail=50%,do", 10, "", sub { $_->do("set foo=1") }); ++$fail_percents{$fails}; } cmp_ok scalar keys %fail_percents, '>=', 2, 'positive percentage should fail randomly'; %fail_percents = (); for (1..5) { $fails = trial_impact("fail=-50%,do", 10, "", sub { $_->do("set foo=1") }); ++$fail_percents{$fails}; } is scalar keys %fail_percents, 1, 'negative percentage should fail non-randomly'; # --- print "Testing random delay\n"; $ENV{DBI_GOFER_RANDOM} = "delay0.1=51%,do"; # odd percentage to force warn()s @warns = (); ok $dbh = dbi_connect("policy=rush;retry_limit=0"); is percentage_exceptions(20, sub { $dbh->do("set foo=1") }), 0, "should not fail for DBI_GOFER_RANDOM='$ENV{DBI_GOFER_RANDOM}'"; my $delays = grep { m/delaying execution/ } @warns; between_ok $delays, 1, 19, 'should be delayed around 5 times'; exit 0; # --- subs --- # sub between_ok { my ($got, $min, $max, $label) = @_; local $Test::Builder::Level = 2; cmp_ok $got, '>=', $min, "$label (got $got)"; cmp_ok $got, '<=', $max, "$label (got $got)"; } sub dbi_connect { my ($gdsn, $attr) = @_; return DBI->connect("dbi:Gofer:transport=null;$gdsn;dsn=dbi:ExampleP:", 0, 0, { RaiseError => 1, PrintError => 0, ($attr) ? %$attr : () }); } sub percentage_exceptions { my ($count, $sub, $verbose) = @_; my $i = $count; my $exceptions = 0; while ($i--) { eval { $sub->() }; warn sprintf("percentage_exceptions $i: %s\n", $@|| $DBI::errstr || '') if $verbose; if ($@) { die "Unexpected failure: $@" unless $@ =~ /DBI_GOFER_RANDOM/; ++$exceptions; } } warn sprintf "percentage_exceptions %f/%f*100 = %f\n", $exceptions, $count, $exceptions/$count*100 if $verbose; return $exceptions/$count*100; } DBI-1.648/t/01basics.t0000755000031300001440000003357014742423677013457 0ustar00merijnusers#!perl -w use strict; use Test::More tests => 130; use File::Spec; use Config; $|=1; ## ---------------------------------------------------------------------------- ## 01basic.t - test of some basic DBI functions ## ---------------------------------------------------------------------------- # Mostly this script takes care of testing the items exported by the 3 # tags below (in this order): # - :sql_types # - :squl_cursor_types # - :util # It also then handles some other class methods and functions of DBI, such # as the following: # - $DBI::dbi_debug & its relation to DBI->trace # - DBI->internal # and then tests on that return value: # - $i->debug # - $i->{DebugDispatch} # - $i->{Warn} # - $i->{Attribution} # - $i->{Version} # - $i->{private_test1} # - $i->{cachedKids} # - $i->{Kids} # - $i->{ActiveKids} # - $i->{Active} # - and finally that it will not autovivify # - DBI->available_drivers # - DBI->installed_versions (only for developers) ## ---------------------------------------------------------------------------- ## load DBI and export some symbols BEGIN { diag "--- Perl $] on $Config{archname}"; use_ok('DBI', qw( :sql_types :sql_cursor_types :utils )); } ## ---------------------------------------------------------------------------- ## testing the :sql_types exports cmp_ok(SQL_GUID , '==', -11, '... testing sql_type'); cmp_ok(SQL_WLONGVARCHAR , '==', -10, '... testing sql_type'); cmp_ok(SQL_WVARCHAR , '==', -9, '... testing sql_type'); cmp_ok(SQL_WCHAR , '==', -8, '... testing sql_type'); cmp_ok(SQL_BIT , '==', -7, '... testing sql_type'); cmp_ok(SQL_TINYINT , '==', -6, '... testing sql_type'); cmp_ok(SQL_BIGINT , '==', -5, '... testing sql_type'); cmp_ok(SQL_LONGVARBINARY , '==', -4, '... testing sql_type'); cmp_ok(SQL_VARBINARY , '==', -3, '... testing sql_type'); cmp_ok(SQL_BINARY , '==', -2, '... testing sql_type'); cmp_ok(SQL_LONGVARCHAR , '==', -1, '... testing sql_type'); cmp_ok(SQL_UNKNOWN_TYPE , '==', 0, '... testing sql_type'); cmp_ok(SQL_ALL_TYPES , '==', 0, '... testing sql_type'); cmp_ok(SQL_CHAR , '==', 1, '... testing sql_type'); cmp_ok(SQL_NUMERIC , '==', 2, '... testing sql_type'); cmp_ok(SQL_DECIMAL , '==', 3, '... testing sql_type'); cmp_ok(SQL_INTEGER , '==', 4, '... testing sql_type'); cmp_ok(SQL_SMALLINT , '==', 5, '... testing sql_type'); cmp_ok(SQL_FLOAT , '==', 6, '... testing sql_type'); cmp_ok(SQL_REAL , '==', 7, '... testing sql_type'); cmp_ok(SQL_DOUBLE , '==', 8, '... testing sql_type'); cmp_ok(SQL_DATETIME , '==', 9, '... testing sql_type'); cmp_ok(SQL_DATE , '==', 9, '... testing sql_type'); cmp_ok(SQL_INTERVAL , '==', 10, '... testing sql_type'); cmp_ok(SQL_TIME , '==', 10, '... testing sql_type'); cmp_ok(SQL_TIMESTAMP , '==', 11, '... testing sql_type'); cmp_ok(SQL_VARCHAR , '==', 12, '... testing sql_type'); cmp_ok(SQL_BOOLEAN , '==', 16, '... testing sql_type'); cmp_ok(SQL_UDT , '==', 17, '... testing sql_type'); cmp_ok(SQL_UDT_LOCATOR , '==', 18, '... testing sql_type'); cmp_ok(SQL_ROW , '==', 19, '... testing sql_type'); cmp_ok(SQL_REF , '==', 20, '... testing sql_type'); cmp_ok(SQL_BLOB , '==', 30, '... testing sql_type'); cmp_ok(SQL_BLOB_LOCATOR , '==', 31, '... testing sql_type'); cmp_ok(SQL_CLOB , '==', 40, '... testing sql_type'); cmp_ok(SQL_CLOB_LOCATOR , '==', 41, '... testing sql_type'); cmp_ok(SQL_ARRAY , '==', 50, '... testing sql_type'); cmp_ok(SQL_ARRAY_LOCATOR , '==', 51, '... testing sql_type'); cmp_ok(SQL_MULTISET , '==', 55, '... testing sql_type'); cmp_ok(SQL_MULTISET_LOCATOR , '==', 56, '... testing sql_type'); cmp_ok(SQL_TYPE_DATE , '==', 91, '... testing sql_type'); cmp_ok(SQL_TYPE_TIME , '==', 92, '... testing sql_type'); cmp_ok(SQL_TYPE_TIMESTAMP , '==', 93, '... testing sql_type'); cmp_ok(SQL_TYPE_TIME_WITH_TIMEZONE , '==', 94, '... testing sql_type'); cmp_ok(SQL_TYPE_TIMESTAMP_WITH_TIMEZONE , '==', 95, '... testing sql_type'); cmp_ok(SQL_INTERVAL_YEAR , '==', 101, '... testing sql_type'); cmp_ok(SQL_INTERVAL_MONTH , '==', 102, '... testing sql_type'); cmp_ok(SQL_INTERVAL_DAY , '==', 103, '... testing sql_type'); cmp_ok(SQL_INTERVAL_HOUR , '==', 104, '... testing sql_type'); cmp_ok(SQL_INTERVAL_MINUTE , '==', 105, '... testing sql_type'); cmp_ok(SQL_INTERVAL_SECOND , '==', 106, '... testing sql_type'); cmp_ok(SQL_INTERVAL_YEAR_TO_MONTH , '==', 107, '... testing sql_type'); cmp_ok(SQL_INTERVAL_DAY_TO_HOUR , '==', 108, '... testing sql_type'); cmp_ok(SQL_INTERVAL_DAY_TO_MINUTE , '==', 109, '... testing sql_type'); cmp_ok(SQL_INTERVAL_DAY_TO_SECOND , '==', 110, '... testing sql_type'); cmp_ok(SQL_INTERVAL_HOUR_TO_MINUTE , '==', 111, '... testing sql_type'); cmp_ok(SQL_INTERVAL_HOUR_TO_SECOND , '==', 112, '... testing sql_type'); cmp_ok(SQL_INTERVAL_MINUTE_TO_SECOND , '==', 113, '... testing sql_type'); ## ---------------------------------------------------------------------------- ## testing the :sql_cursor_types exports cmp_ok(SQL_CURSOR_FORWARD_ONLY, '==', 0, '... testing sql_cursor_types'); cmp_ok(SQL_CURSOR_KEYSET_DRIVEN, '==', 1, '... testing sql_cursor_types'); cmp_ok(SQL_CURSOR_DYNAMIC, '==', 2, '... testing sql_cursor_types'); cmp_ok(SQL_CURSOR_STATIC, '==', 3, '... testing sql_cursor_types'); cmp_ok(SQL_CURSOR_TYPE_DEFAULT, '==', 0, '... testing sql_cursor_types'); ## ---------------------------------------------------------------------------- ## test the :util exports ## testing looks_like_number my @is_num = looks_like_number(undef, "", "foo", 1, ".", 2, "2"); ok(!defined $is_num[0], '... looks_like_number : undef -> undef'); ok(!defined $is_num[1], '... looks_like_number : "" -> undef (eg "don\'t know")'); ok( defined $is_num[2], '... looks_like_number : "foo" -> defined false'); ok( !$is_num[2], '... looks_like_number : "foo" -> defined false'); ok( $is_num[3], '... looks_like_number : 1 -> true'); ok( !$is_num[4], '... looks_like_number : "." -> false'); ok( $is_num[5], '... looks_like_number : 1 -> true'); ok( $is_num[6], '... looks_like_number : 1 -> true'); ## testing neat cmp_ok($DBI::neat_maxlen, '==', 1000, "... $DBI::neat_maxlen initial state is 400"); is(neat(1 + 1), "2", '... neat : 1 + 1 -> "2"'); is(neat("2"), "'2'", '... neat : 2 -> "\'2\'"'); is(neat(undef), "undef", '... neat : undef -> "undef"'); ## testing neat_list is(neat_list([ 1 + 1, "2", undef, "foobarbaz"], 8, "|"), "2|'2'|undef|'foo...'", '... test array argument w/separator and maxlen'); is(neat_list([ 1 + 1, "2", undef, "foobarbaz"]), "2, '2', undef, 'foobarbaz'", '... test array argument w/out separator or maxlen'); ## ---------------------------------------------------------------------------- ## testing DBI functions ## test DBI->internal my $switch = DBI->internal; isa_ok($switch, 'DBI::dr'); ## checking attributes of $switch # NOTE: # check too see if this covers all the attributes or not # TO DO: # these three can be improved $switch->debug(0); pass('... test debug'); $switch->{DebugDispatch} = 0; # handled by Switch pass('... test DebugDispatch'); $switch->{Warn} = 1; # handled by DBI core pass('... test Warn'); like($switch->{'Attribution'}, qr/DBI.*? by Tim Bunce/, '... this should say Tim Bunce'); # is this being presumptious? is($switch->{'Version'}, $DBI::VERSION, '... the version should match DBI version'); cmp_ok(($switch->{private_test1} = 1), '==', 1, '... this should work and return 1'); cmp_ok($switch->{private_test1}, '==', 1, '... this should equal 1'); is($switch->{CachedKids}, undef, '... CachedKids should be undef initially'); my $cache = {}; $switch->{CachedKids} = $cache; is($switch->{CachedKids}, $cache, '... CachedKids should be our ref'); cmp_ok($switch->{Kids}, '==', 0, '... this should be zero'); cmp_ok($switch->{ActiveKids}, '==', 0, '... this should be zero'); ok($switch->{Active}, '... Active flag is true'); # test attribute warnings { my $warn = ""; local $SIG{__WARN__} = sub { $warn .= "@_" }; $switch->{FooBarUnknown} = 1; like($warn, qr/Can't set.*FooBarUnknown/, '... we should get a warning here'); $warn = ""; $_ = $switch->{BarFooUnknown}; like($warn, qr/Can't get.*BarFooUnknown/, '... we should get a warning here'); $warn = ""; my $dummy = $switch->{$_} for qw(private_foo dbd_foo dbi_foo); # special cases cmp_ok($warn, 'eq', "", '... we should get no warnings here'); } # is this here for a reason? Are we testing anything? $switch->trace_msg("Test \$h->trace_msg text.\n", 1); DBI->trace_msg("Test DBI->trace_msg text.\n", 1); ## testing DBI->available_drivers my @drivers = DBI->available_drivers(); cmp_ok(scalar(@drivers), '>', 0, '... we at least have one driver installed'); # NOTE: # we lowercase the interpolated @drivers array # so that our reg-exp will match on VMS & Win32 like(lc("@drivers"), qr/examplep/, '... we should at least have ExampleP installed'); # call available_drivers in scalar context my $num_drivers = DBI->available_drivers; cmp_ok($num_drivers, '>', 0, '... we should at least have one driver'); ## testing DBI::hash cmp_ok(DBI::hash("foo1" ), '==', -1077531989, '... should be -1077531989'); cmp_ok(DBI::hash("foo1",0), '==', -1077531989, '... should be -1077531989'); cmp_ok(DBI::hash("foo2",0), '==', -1077531990, '... should be -1077531990'); SKIP: { skip("Math::BigInt < 1.56",2) if $DBI::PurePerl && !eval { require Math::BigInt; require_version Math::BigInt 1.56 }; skip("Math::BigInt $Math::BigInt::VERSION broken",2) if $DBI::PurePerl && $Math::BigInt::VERSION =~ /^1\.8[45]/; my $bigint_vers = $Math::BigInt::VERSION || ""; if (!$DBI::PurePerl) { cmp_ok(DBI::hash("foo1",1), '==', -1263462440); cmp_ok(DBI::hash("foo2",1), '==', -1263462437); } else { # for PurePerl we use Math::BigInt but that's often caused test failures that # aren't DBI's fault. So we just warn (via a skip) if it's not working right. skip("Seems like your Math::BigInt $Math::BigInt::VERSION has a bug",2) unless (DBI::hash("foo1X",1) == -1263462440) && (DBI::hash("foo2",1) == -1263462437); ok(1, "Math::BigInt $Math::BigInt::VERSION worked okay"); ok(1); } } is(data_string_desc(""), "UTF8 off, ASCII, 0 characters 0 bytes"); is(data_string_desc(42), "UTF8 off, ASCII, 2 characters 2 bytes"); is(data_string_desc("foo"), "UTF8 off, ASCII, 3 characters 3 bytes"); is(data_string_desc(undef), "UTF8 off, undef"); is(data_string_desc("bar\x{263a}"), "UTF8 on, non-ASCII, 4 characters 6 bytes"); is(data_string_desc("\xEA"), "UTF8 off, non-ASCII, 1 characters 1 bytes"); is(data_string_diff( "", ""), ""); is(data_string_diff( "",undef), "String b is undef, string a has 0 characters"); is(data_string_diff(undef,undef), ""); is(data_string_diff("aaa","aaa"), ""); is(data_string_diff("aaa","aba"), "Strings differ at index 1: a[1]=a, b[1]=b"); is(data_string_diff("aba","aaa"), "Strings differ at index 1: a[1]=b, b[1]=a"); is(data_string_diff("aa" ,"aaa"), "String a truncated after 2 characters"); is(data_string_diff("aaa","aa" ), "String b truncated after 2 characters"); is(data_diff( "", ""), ""); is(data_diff(undef,undef), ""); is(data_diff("aaa","aaa"), ""); is(data_diff( "",undef), join "","a: UTF8 off, ASCII, 0 characters 0 bytes\n", "b: UTF8 off, undef\n", "String b is undef, string a has 0 characters\n"); is(data_diff("aaa","aba"), join "","a: UTF8 off, ASCII, 3 characters 3 bytes\n", "b: UTF8 off, ASCII, 3 characters 3 bytes\n", "Strings differ at index 1: a[1]=a, b[1]=b\n"); is(data_diff(pack("C",0xEA), pack("U",0xEA)), join "", "a: UTF8 off, non-ASCII, 1 characters 1 bytes\n", "b: UTF8 on, non-ASCII, 1 characters 2 bytes\n", "Strings contain the same sequence of characters\n"); is(data_diff(pack("C",0xEA), pack("U",0xEA), 1), ""); # no logical difference ## ---------------------------------------------------------------------------- # restrict this test to just developers SKIP: { skip 'developer tests', 4 unless -d ".svn" || -d ".git"; if ($^O eq "MSWin32" && eval { require Win32API::File }) { Win32API::File::SetErrorMode(Win32API::File::SEM_FAILCRITICALERRORS()); } print "Test DBI->installed_versions (for @drivers)\n"; print "(If one of those drivers, or the configuration for it, is bad\n"; print "then these tests can kill or freeze the process here. That's not the DBI's fault.)\n"; $SIG{ALRM} = sub { die "Test aborted because a driver (one of: @drivers) hung while loading" ." (almost certainly NOT a DBI problem)"; }; alarm(20); ## ---------------------------------------------------------------------------- ## test installed_versions # scalar context my $installed_versions = DBI->installed_versions; is(ref($installed_versions), 'HASH', '... we got a hash of installed versions'); cmp_ok(scalar(keys(%{$installed_versions})), '>=', 1, '... make sure we have at least one'); # list context my @installed_drivers = DBI->installed_versions; cmp_ok(scalar(@installed_drivers), '>=', 1, '... make sure we got at least one'); like("@installed_drivers", qr/Sponge/, '... make sure at least one of them is DBD::Sponge'); } ## testing dbi_debug cmp_ok($DBI::dbi_debug, '==', 0, "... DBI::dbi_debug's initial state is 0"); SKIP: { my $null = File::Spec->devnull(); skip "cannot find : $null", 2 unless ($^O eq "MSWin32" || -e $null); DBI->trace(15,$null); cmp_ok($DBI::dbi_debug, '==', 15, "... DBI::dbi_debug is 15"); DBI->trace(0, undef); cmp_ok($DBI::dbi_debug, '==', 0, "... DBI::dbi_debug is 0"); } 1; DBI-1.648/t/30subclass.t0000644000031300001440000001010414742423677014015 0ustar00merijnusers#!perl -w use strict; $|=1; $^W=1; my $calls = 0; my %my_methods; # ================================================= # Example code for sub classing the DBI. # # Note that the extra ::db and ::st classes must be set up # as sub classes of the corresponding DBI classes. # # This whole mechanism is new and experimental - it may change! package MyDBI; our @ISA = qw(DBI); # the MyDBI::dr::connect method is NOT called! # you can either override MyDBI::connect() # or use MyDBI::db::connected() package MyDBI::db; our @ISA = qw(DBI::db); sub prepare { my($dbh, @args) = @_; ++$my_methods{prepare}; ++$calls; my $sth = $dbh->SUPER::prepare(@args); return $sth; } package MyDBI::st; our @ISA = qw(DBI::st); sub fetch { my($sth, @args) = @_; ++$my_methods{fetch}; ++$calls; # this is just to trigger (re)STORE on exit to test that the STORE # doesn't clear any erro condition local $sth->{Taint} = 0; my $row = $sth->SUPER::fetch(@args); if ($row) { # modify fetched data as an example $row->[1] = lc($row->[1]); # also demonstrate calling set_err() return $sth->set_err(1,"Don't be so negative",undef,"fetch") if $row->[0] < 0; # ... and providing alternate results # (although typically would trap and hide and error from SUPER::fetch) return $sth->set_err(2,"Don't exaggerate",undef, undef, [ 42,"zz",0 ]) if $row->[0] > 42; } return $row; } # ================================================= package main; use Test::More tests => 43; BEGIN { use_ok( 'DBI' ); } my $tmp; #DBI->trace(2); my $dbh = MyDBI->connect("dbi:Sponge:foo","","", { PrintError => 0, RaiseError => 1, CompatMode => 1, # just for clone test }); isa_ok($dbh, 'MyDBI::db'); is($dbh->{CompatMode}, 1); undef $dbh; $dbh = DBI->connect("dbi:Sponge:foo","","", { PrintError => 0, RaiseError => 1, RootClass => "MyDBI", CompatMode => 1, # just for clone test dbi_foo => 1, # just to help debugging clone etc }); isa_ok( $dbh, 'MyDBI::db'); is($dbh->{CompatMode}, 1); #$dbh->trace(5); my $sth = $dbh->prepare("foo", # data for DBD::Sponge to return via fetch { rows => [ [ 40, "AAA", 9 ], [ 41, "BB", 8 ], [ -1, "C", 7 ], [ 49, "DD", 6 ] ], } ); is($calls, 1); isa_ok($sth, 'MyDBI::st'); my $row = $sth->fetch; is($calls, 2); is($row->[1], "aaa"); $row = $sth->fetch; is($calls, 3); is($row->[1], "bb"); is($DBI::err, undef); $row = eval { $sth->fetch }; my $eval_err = $@; is(!defined $row, 1); is(substr($eval_err,0,50), "DBD::Sponge::st fetch failed: Don't be so negative"); #$sth->trace(5); #$sth->{PrintError} = 1; $sth->{RaiseError} = 0; $row = eval { $sth->fetch }; isa_ok($row, 'ARRAY'); is($row->[0], 42); is($DBI::err, 2); like($DBI::errstr, qr/Don't exaggerate/); is($@ =~ /Don't be so negative/, $@); my $dbh2 = $dbh->clone; isa_ok( $dbh2, 'MyDBI::db', "Clone A" ); is($dbh2 != $dbh, 1); is($dbh2->{CompatMode}, 1); my $dbh3 = $dbh->clone({}); isa_ok( $dbh3, 'MyDBI::db', 'Clone B' ); is($dbh3 != $dbh, 1); is($dbh3 != $dbh2, 1); isa_ok( $dbh3, 'MyDBI::db'); is($dbh3->{CompatMode}, 1); my $dbh2c = $dbh2->clone; isa_ok( $dbh2c, 'MyDBI::db', "Clone of clone A" ); is($dbh2c != $dbh2, 1); is($dbh2c->{CompatMode}, 1); my $dbh3c = $dbh3->clone({ CompatMode => 0 }); isa_ok( $dbh3c, 'MyDBI::db', 'Clone of clone B' ); is((grep { $dbh3c == $_ } $dbh, $dbh2, $dbh3), 0); isa_ok( $dbh3c, 'MyDBI::db'); ok(!$dbh3c->{CompatMode}); $tmp = $dbh->sponge_test_installed_method('foo','bar'); isa_ok( $tmp, "ARRAY", "installed method" ); is_deeply( $tmp, [qw( foo bar )] ); $tmp = eval { $dbh->sponge_test_installed_method() }; is(!$tmp, 1); is($dbh->err, 42); is($dbh->errstr, "not enough parameters"); $dbh = eval { DBI->connect("dbi:Sponge:foo","","", { RootClass => 'nonesuch1', PrintError => 0, RaiseError => 0, }); }; ok( !defined($dbh), "Failed connect #1" ); is(substr($@,0,25), "Can't locate nonesuch1.pm"); $dbh = eval { nonesuch2->connect("dbi:Sponge:foo","","", { PrintError => 0, RaiseError => 0, }); }; ok( !defined($dbh), "Failed connect #2" ); is(substr($@,0,36), q{Can't locate object method "connect"}); print "@{[ %my_methods ]}\n"; 1; DBI-1.648/t/12quote.t0000644000031300001440000000322214742423677013336 0ustar00merijnusers#!perl -w use lib qw(blib/arch blib/lib); # needed since -T ignores PERL5LIB use strict; use Test::More tests => 10; use DBI qw(:sql_types); use Config; use Cwd; $^W = 1; $| = 1; my $dbh = DBI->connect('dbi:ExampleP:', '', ''); sub check_quote { # checking quote is($dbh->quote("quote's"), "'quote''s'", '... quoting strings with embedded single quotes'); is($dbh->quote("42", SQL_VARCHAR), "'42'", '... quoting number as SQL_VARCHAR'); is($dbh->quote("42", SQL_INTEGER), "42", '... quoting number as SQL_INTEGER'); is($dbh->quote(undef), "NULL", '... quoting undef as NULL'); } check_quote(); sub check_quote_identifier { is($dbh->quote_identifier('foo'), '"foo"', '... properly quotes foo as "foo"'); is($dbh->quote_identifier('f"o'), '"f""o"', '... properly quotes f"o as "f""o"'); is($dbh->quote_identifier('foo','bar'), '"foo"."bar"', '... properly quotes foo, bar as "foo"."bar"'); is($dbh->quote_identifier(undef,undef,'bar'), '"bar"', '... properly quotes undef, undef, bar as "bar"'); is($dbh->quote_identifier('foo',undef,'bar'), '"foo"."bar"', '... properly quotes foo, undef, bar as "foo"."bar"'); SKIP: { skip "Can't test alternate quote_identifier logic with DBI_AUTOPROXY", 1 if $ENV{DBI_AUTOPROXY}; my $qi = $dbh->{dbi_quote_identifier_cache} || die "test out of date with dbi internals?"; $qi->[1] = '@'; # SQL_CATALOG_NAME_SEPARATOR $qi->[2] = 2; # SQL_CATALOG_LOCATION is($dbh->quote_identifier('foo',undef,'bar'), '"bar"@"foo"', '... now quotes it as "bar"@"foo" after flushing cache'); } } check_quote_identifier(); 1; DBI-1.648/t/35thrclone.t0000644000031300001440000000446514656646601014034 0ustar00merijnusers#!perl -w $|=1; # --- Test DBI support for threads created after the DBI was loaded BEGIN { eval "use threads;" } # Must be first my $use_threads_err = $@; use strict; use Config qw(%Config); use Test::More; BEGIN { if (!$Config{useithreads}) { plan skip_all => "this $^O perl $] not supported for DBI iThreads"; } die $use_threads_err if $use_threads_err; # need threads } BEGIN { if ($] >= 5.010000 && $] < 5.010001) { plan skip_all => "Threading bug in perl 5.10.0 fixed in 5.10.1"; } } my $threads = 4; plan tests => 4 + 4 * $threads; { package threads_sub; use base qw(threads); } use_ok('DBI'); $DBI::PurePerl = $DBI::PurePerl; # just to silence used only once warning $DBI::neat_maxlen = 12345; cmp_ok($DBI::neat_maxlen, '==', 12345, '... assignment of neat_maxlen was successful'); my @connect_args = ("dbi:ExampleP:", '', ''); my $dbh_parent = DBI->connect_cached(@connect_args); isa_ok( $dbh_parent, 'DBI::db' ); # this our function for the threads to run sub testing { cmp_ok($DBI::neat_maxlen, '==', 12345, '... DBI::neat_maxlen still holding its value'); my $dbh = DBI->connect_cached(@connect_args); isa_ok( $dbh, 'DBI::db' ); isnt($dbh, $dbh_parent, '... new $dbh is not the same instance as $dbh_parent'); SKIP: { # skip seems broken with threads (5.8.3) # skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($dbh->{Driver}->{Kids}, '==', 1, '... the Driver has one Kid') unless $DBI::PurePerl && ok(1); } # RT #77137: a thread created from a thread was crashing the # interpreter my $subthread = threads->new(sub {}); # provide a little insurance against thread scheduling issues (hopefully) # http://www.nntp.perl.org/group/perl.cpan.testers/2009/06/msg4369660.html eval { select undef, undef, undef, 0.2 }; $subthread->join(); } # load up the threads my @thr; push @thr, threads_sub->create( \&testing ) or die "thread->create failed ($!)" foreach (1..$threads); # join all the threads foreach my $thread (@thr) { # provide a little insurance against thread scheduling issues (hopefully) # http://www.nntp.perl.org/group/perl.cpan.testers/2009/06/msg4369660.html eval { select undef, undef, undef, 0.2 }; $thread->join; } pass('... all tests have passed'); 1; DBI-1.648/t/16destroy.t0000644000031300001440000001003314742423677013674 0ustar00merijnusers#!perl -w use strict; use Test::More tests => 20; # use explicit plan to avoid race hazard BEGIN{ use_ok( 'DBI' ) } my $expect_active; ## main Test Driver Package { package DBD::Test; use strict; use warnings; my $drh = undef; sub driver { return $drh if $drh; my ($class, $attr) = @_; $class = "${class}::dr"; ($drh) = DBI::_new_drh($class, { Name => 'Test', Version => '1.0', }, 77 ); return $drh; } sub CLONE { undef $drh } } ## Test Driver { package DBD::Test::dr; use warnings; use Test::More; sub connect { # normally overridden, but a handy default my($drh, $dbname, $user, $auth, $attrs)= @_; my ($outer, $dbh) = DBI::_new_dbh($drh); $dbh->STORE(Active => 1); $dbh->STORE(AutoCommit => 1); $dbh->STORE( $_ => $attrs->{$_}) for keys %$attrs; return $outer; } $DBD::Test::dr::imp_data_size = 0; cmp_ok($DBD::Test::dr::imp_data_size, '==', 0, '... check DBD::Test::dr::imp_data_size to avoid typo'); } ## Test db package { package DBD::Test::db; use strict; use warnings; use Test::More; $DBD::Test::db::imp_data_size = 0; cmp_ok($DBD::Test::db::imp_data_size, '==', 0, '... check DBD::Test::db::imp_data_size to avoid typo'); sub STORE { my ($dbh, $attrib, $value) = @_; # would normally validate and only store known attributes # else pass up to DBI to handle if ($attrib eq 'AutoCommit') { # convert AutoCommit values to magic ones to let DBI # know that the driver has 'handled' the AutoCommit attribute $value = ($value) ? -901 : -900; } return $dbh->{$attrib} = $value if $attrib =~ /^examplep_/; return $dbh->SUPER::STORE($attrib, $value); } sub DESTROY { if ($expect_active < 0) { # inside child my $self = shift; exit ($self->FETCH('Active') || 0) unless $^O eq 'MSWin32'; # On Win32, the forked child is actually a thread. So don't exit, # and report failure directly. fail 'Child should be inactive on DESTROY' if $self->FETCH('Active'); } else { return $expect_active ? ok( shift->FETCH('Active'), 'Should be active in DESTROY') : ok( !shift->FETCH('Active'), 'Should not be active in DESTROY'); } } } my $dsn = 'dbi:ExampleP:dummy'; $INC{'DBD/Test.pm'} = 'dummy'; # required to fool DBI->install_driver() ok my $drh = DBI->install_driver('Test'), 'Install test driver'; NOSETTING: { # Try defaults. ok my $dbh = $drh->connect, 'Connect to test driver'; ok $dbh->{Active}, 'Should start active'; $expect_active = 1; } IAD: { # Try InactiveDestroy. ok my $dbh = $drh->connect($dsn, '', '', { InactiveDestroy => 1 }), 'Create with ActiveDestroy'; ok $dbh->{InactiveDestroy}, 'InactiveDestroy should be set'; ok $dbh->{Active}, 'Should start active'; $expect_active = 0; } AIAD: { # Try AutoInactiveDestroy. ok my $dbh = $drh->connect($dsn, '', '', { AutoInactiveDestroy => 1 }), 'Create with AutoInactiveDestroy'; ok $dbh->{AutoInactiveDestroy}, 'InactiveDestroy should be set'; ok $dbh->{Active}, 'Should start active'; $expect_active = 1; } FORK: { # Try AutoInactiveDestroy and fork. ok my $dbh = $drh->connect($dsn, '', '', { AutoInactiveDestroy => 1 }), 'Create with AutoInactiveDestroy again'; ok $dbh->{AutoInactiveDestroy}, 'InactiveDestroy should be set'; ok $dbh->{Active}, 'Should start active'; my $pid = eval { fork() }; if (not defined $pid) { chomp $@; my $msg = "AutoInactiveDestroy destroy test skipped"; diag "$msg because $@\n"; pass $msg; # in lieu of the child status test } elsif ($pid) { # parent. $expect_active = 1; wait; ok $? == 0, 'Child should be inactive on DESTROY'; } else { # child. $expect_active = -1; } } DBI-1.648/t/40profile.t0000644000031300001440000004022014742423677013641 0ustar00merijnusers#!perl -w $|=1; # # test script for DBI::Profile # use strict; use Config; use DBI::Profile; use DBI qw(dbi_time); use Data::Dumper; use File::Spec; use Storable qw(dclone); use Test::More; BEGIN { plan skip_all => "profiling not supported for DBI::PurePerl" if $DBI::PurePerl; # tie methods (STORE/FETCH etc) get called different number of times plan skip_all => "test results assume perl >= 5.8.2" if $] <= 5.008001; # clock instability on xen systems is a reasonably common cause of failure # http://www.nntp.perl.org/group/perl.cpan.testers/2009/05/msg3828158.html # so we'll skip automated testing on those systems plan skip_all => "skipping profile tests on xen (due to clock instability)" if $Config{osvers} =~ /xen/ # eg 2.6.18-4-xen-amd64 and $ENV{AUTOMATED_TESTING}; plan tests => 60; } $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; # log file to store profile results my $LOG_FILE = "test_output_profile$$.log"; my $orig_dbi_debug = $DBI::dbi_debug; DBI->trace($DBI::dbi_debug, $LOG_FILE); END { return if $orig_dbi_debug; 1 while unlink $LOG_FILE; } print "Test enabling the profile\n"; # make sure profiling starts disabled my $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); ok($dbh, 'connect'); ok(!$dbh->{Profile} && !$ENV{DBI_PROFILE}, 'Profile and DBI_PROFILE not set'); # can turn it on after the fact using a path number $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); $dbh->{Profile} = "4"; is_deeply sanitize_tree($dbh->{Profile}), bless { 'Path' => [ '!MethodName' ], } => 'DBI::Profile'; # using a package name $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); $dbh->{Profile} = "/DBI::Profile"; is_deeply sanitize_tree($dbh->{Profile}), bless { 'Path' => [ ], } => 'DBI::Profile'; # using a combined path and name $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); $dbh->{Profile} = "20/DBI::Profile"; is_deeply sanitize_tree($dbh->{Profile}), bless { 'Path' => [ '!MethodName', '!Caller2' ], } => 'DBI::Profile'; my $t_file = __FILE__; $dbh->do("set foo=1"); my $line = __LINE__; my $expected_caller = "40profile.t line $line"; $expected_caller .= " via ${1}40profile.t line 4" if $0 =~ /(zv\w+_)/; print Dumper($dbh->{Profile}); is_deeply sanitize_tree($dbh->{Profile}), bless { 'Path' => [ '!MethodName', '!Caller2' ], 'Data' => { 'do' => { $expected_caller => [ 1, 0, 0, 0, 0, 0, 0 ] } } } => 'DBI::Profile' or warn Dumper $dbh->{Profile}; # can turn it on at connect $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1, Profile=>6 }); is_deeply $dbh->{Profile}{Path}, [ '!Statement', '!MethodName' ]; cmp_ok(keys %{ $dbh->{Profile}{Data} }, '==', 1, 'on at connect, 1 key'); cmp_ok(keys %{ $dbh->{Profile}{Data}{""} }, '>=', 1, 'on at connect, 1 key'); # at least STORE ok(ref $dbh->{Profile}{Data}{""}{STORE}, 'STORE is ref'); print "dbi_profile\n"; # Try to avoid rounding problem on double precision systems # $got->[5] = '1150962858.01596498' # $expected->[5] = '1150962858.015965' # by treating as a string (because is_deeply stringifies) my $t1 = DBI::dbi_time() . ""; my $dummy_statement = "Hi mom"; my $dummy_methname = "my_method_name"; my $leaf = dbi_profile($dbh, $dummy_statement, $dummy_methname, $t1, $t1 + 1); print Dumper($dbh->{Profile}); cmp_ok(keys %{ $dbh->{Profile}{Data} }, '==', 2, 'avoid rounding, 1 key'); cmp_ok(keys %{ $dbh->{Profile}{Data}{$dummy_statement} }, '==', 1, 'avoid rounding, 1 dummy statement'); is(ref($dbh->{Profile}{Data}{$dummy_statement}{$dummy_methname}), 'ARRAY', 'dummy method name is array'); ok $leaf, "should return ref to leaf node"; is ref $leaf, 'ARRAY', "should return ref to leaf node"; my $mine = $dbh->{Profile}{Data}{$dummy_statement}{$dummy_methname}; is $leaf, $mine, "should return ref to correct leaf node"; print "@$mine\n"; is_deeply $mine, [ 1, 1, 1, 1, 1, $t1, $t1 ]; my $t2 = DBI::dbi_time() . ""; dbi_profile($dbh, $dummy_statement, $dummy_methname, $t2, $t2 + 2); print "@$mine\n"; is_deeply $mine, [ 2, 3, 1, 1, 2, $t1, $t2 ]; print "Test collected profile data\n"; $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1, Profile=>2 }); # do a (hopefully) measurable amount of work my $sql = "select mode,size,name from ?"; my $sth = $dbh->prepare($sql); for my $loop (1..50) { # enough work for low-res timers or v.fast cpus $sth->execute("."); while ( my $hash = $sth->fetchrow_hashref ) {} } $dbh->do("set foo=1"); print Dumper($dbh->{Profile}); # check that the proper key was set in Data my $data = $dbh->{Profile}{Data}{$sql}; ok($data, 'profile data'); is(ref $data, 'ARRAY', 'ARRAY ref'); ok(@$data == 7, '7 elements'); ok((grep { defined($_) } @$data) == 7, 'all 7 defined'); ok((grep { DBI::looks_like_number($_) } @$data) == 7, 'all 7 numeric'); my ($count, $total, $first, $shortest, $longest, $time1, $time2) = @$data; ok($count > 3, 'count is 3'); ok($total > $first, ' total > first'); ok($total > $longest, 'total > longest') or warn "total $total > longest $longest: failed\n"; ok($longest > 0, 'longest > 0') or warn "longest $longest > 0: failed\n"; # XXX theoretically not reliable ok($longest > $shortest, 'longest > shortest'); ok($time1 >= $^T, 'time1 later than start time'); ok($time2 >= $^T, 'time2 later than start time'); ok($time1 <= $time2, 'time1 <= time2'); my $next = int(dbi_time()) + 1; ok($next > $time1, 'next > time1') or warn "next $next > first $time1: failed\n"; ok($next > $time2, 'next > time2') or warn "next $next > last $time2: failed\n"; if ($shortest < 0) { my $sys = "$Config{archname} $Config{osvers}"; # ie sparc-linux 2.4.20-2.3sparcsmp warn < -0.008; } my $tmp = sanitize_tree($dbh->{Profile}); $tmp->{Data}{$sql}[0] = -1; # make test insensitive to local file count is_deeply $tmp, (bless { 'Path' => [ '!Statement' ], 'Data' => { '' => [ 6, 0, 0, 0, 0, 0, 0 ], $sql => [ -1, 0, 0, 0, 0, 0, 0 ], 'set foo=1' => [ 1, 0, 0, 0, 0, 0, 0 ], } } => 'DBI::Profile'), 'profile'; print "Test profile format\n"; my $output = $dbh->{Profile}->format(); print "Profile Output\n$output"; # check that output was produced in the expected format ok(length $output, 'non zero length'); ok($output =~ /^DBI::Profile:/, 'DBI::Profile'); ok($output =~ /\((\d+) calls\)/, 'some calls'); ok($1 >= $count, 'calls >= count'); # ----------------------------------------------------------------------------------- # try statement and method name and reference-to-scalar path my $by_reference = 'foo'; $dbh = DBI->connect("dbi:ExampleP:", 'usrnam', '', { RaiseError => 1, Profile => { Path => [ '{Username}', '!Statement', \$by_reference, '!MethodName' ] } }); $sql = "select name from ."; $sth = $dbh->prepare($sql); $sth->execute(); $sth->fetchrow_hashref; $by_reference = 'bar'; $sth->finish; undef $sth; # DESTROY $tmp = sanitize_tree($dbh->{Profile}); ok $tmp->{Data}{usrnam}{""}{foo}{STORE}, 'username stored'; $tmp->{Data}{usrnam}{""}{foo} = {}; # make test insentitive to number of local files #warn Dumper($tmp); is_deeply $tmp, bless { 'Path' => [ '{Username}', '!Statement', \$by_reference, '!MethodName' ], 'Data' => { '' => { # because Profile was enabled by DBI just before Username was set '' => { 'foo' => { 'STORE' => [ 3, 0, 0, 0, 0, 0, 0 ], } } }, 'usrnam' => { '' => { 'foo' => { }, }, 'select name from .' => { 'foo' => { 'execute' => [ 1, 0, 0, 0, 0, 0, 0 ], 'fetchrow_hashref' => [ 1, 0, 0, 0, 0, 0, 0 ], 'prepare' => [ 1, 0, 0, 0, 0, 0, 0 ], }, 'bar' => { 'DESTROY' => [ 1, 0, 0, 0, 0, 0, 0 ], 'finish' => [ 1, 0, 0, 0, 0, 0, 0 ], }, }, }, }, } => 'DBI::Profile'; $tmp = [ $dbh->{Profile}->as_node_path_list() ]; is @$tmp, 8, 'should have 8 nodes'; sanitize_profile_data_nodes($_->[0]) for @$tmp; #warn Dumper($dbh->{Profile}->{Data}); is_deeply $tmp, [ [ [ 3, 0, 0, 0, 0, 0, 0 ], '', '', 'foo', 'STORE' ], [ [ 2, 0, 0, 0, 0, 0, 0 ], 'usrnam', '', 'foo', 'STORE' ], [ [ 1, 0, 0, 0, 0, 0, 0 ], 'usrnam', '', 'foo', 'connected' ], [ [ 1, 0, 0, 0, 0, 0, 0 ], 'usrnam', 'select name from .', 'bar', 'DESTROY' ], [ [ 1, 0, 0, 0, 0, 0, 0 ], 'usrnam', 'select name from .', 'bar', 'finish' ], [ [ 1, 0, 0, 0, 0, 0, 0 ], 'usrnam', 'select name from .', 'foo', 'execute' ], [ [ 1, 0, 0, 0, 0, 0, 0 ], 'usrnam', 'select name from .', 'foo', 'fetchrow_hashref' ], [ [ 1, 0, 0, 0, 0, 0, 0 ], 'usrnam', 'select name from .', 'foo', 'prepare' ] ]; print "testing '!File', '!Caller' and their variants in Path\n"; $dbh->{Profile}->{Path} = [ '!File', '!File2', '!Caller', '!Caller2' ]; $dbh->{Profile}->{Data} = undef; my $file = (File::Spec->splitpath(__FILE__))[2]; # '40profile.t' my ($line1, $line2); sub a_sub { $sth = $dbh->prepare("select name from ."); $line2 = __LINE__; } a_sub(); $line1 = __LINE__; $tmp = sanitize_profile_data_nodes($dbh->{Profile}{Data}); #warn Dumper($tmp); is_deeply $tmp, { "$file" => { "$file via $file" => { "$file line $line2" => { "$file line $line2 via $file line $line1" => [ 1, 0, 0, 0, 0, 0, 0 ] } } } }; print "testing '!Time' and variants in Path\n"; undef $sth; my $factor = 1_000_000; $dbh->{Profile}->{Path} = [ '!Time', "!Time~$factor", '!MethodName' ]; $dbh->{Profile}->{Data} = undef; # give up a timeslice in the hope that the following few lines # run in well under a second even of slow/overloaded systems $t1 = int(dbi_time())+1; 1 while int(dbi_time()-0.01) < $t1; # spin till just after second starts $t2 = int($t1/$factor)*$factor; $sth = $dbh->prepare("select name from ."); $tmp = sanitize_profile_data_nodes($dbh->{Profile}{Data}); # if actual "!Time" recorded is 'close enough' then we'll pass # the test - it's not worth failing just because a system is slow $t1 = (keys %$tmp)[0] if (abs($t1 - (keys %$tmp)[0]) <= 5); is_deeply $tmp, { $t1 => { $t2 => { prepare => [ 1, 0, 0, 0, 0, 0, 0 ] }} }, "!Time and !Time~$factor should work" or warn Dumper([$t1, $t2, $tmp]); print "testing &norm_std_n3 in Path\n"; $dbh->{Profile} = '&norm_std_n3'; # assign as string to get magic is_deeply $dbh->{Profile}{Path}, [ \&DBI::ProfileSubs::norm_std_n3 ]; $dbh->{Profile}->{Data} = undef; $sql = qq{insert into foo20060726 (a,b) values (42,"foo")}; dbi_profile( { foo => $dbh, bar => undef }, $sql, 'mymethod', 100000000, 100000002); $tmp = $dbh->{Profile}{Data}; #warn Dumper($tmp); is_deeply $tmp, { 'insert into foo (a,b) values (,"")' => [ 1, '2', '2', '2', '2', '100000000', '100000000' ] }, '&norm_std_n3 should normalize statement'; # ----------------------------------------------------------------------------------- print "testing code ref in Path\n"; sub run_test1 { my ($profile) = @_; $dbh = DBI->connect("dbi:ExampleP:", 'usrnam', '', { RaiseError => 1, Profile => $profile, }); $sql = "select name from ."; $sth = $dbh->prepare($sql); $sth->execute(); $sth->fetchrow_hashref; $sth->finish; undef $sth; # DESTROY my $data = sanitize_profile_data_nodes($dbh->{Profile}{Data}, 1); return ($data, $dbh) if wantarray; return $data; } $tmp = run_test1( { Path => [ 'foo', sub { 'bar' }, 'baz' ] }); is_deeply $tmp, { 'foo' => { 'bar' => { 'baz' => [ 11, 0,0,0,0,0,0 ] } } }; $tmp = run_test1( { Path => [ 'foo', sub { 'ping','pong' } ] }); is_deeply $tmp, { 'foo' => { 'ping' => { 'pong' => [ 11, 0,0,0,0,0,0 ] } } }; $tmp = run_test1( { Path => [ 'foo', sub { \undef } ] }); is_deeply $tmp, { 'foo' => undef }, 'should be vetoed'; # check what code ref sees in $_ $tmp = run_test1( { Path => [ sub { $_ } ] }); is_deeply $tmp, { '' => [ 6, 0, 0, 0, 0, 0, 0 ], 'select name from .' => [ 5, 0, 0, 0, 0, 0, 0 ] }, '$_ should contain statement'; # check what code ref sees in @_ $tmp = run_test1( { Path => [ sub { my ($h,$method) = @_; return \undef if $method =~ /^[A-Z]+$/; return (ref $h, $method) } ] }); is_deeply $tmp, { 'DBI::db' => { 'connected' => [ 1, 0, 0, 0, 0, 0, 0 ], 'prepare' => [ 1, 0, 0, 0, 0, 0, 0 ], }, 'DBI::st' => { 'fetchrow_hashref' => [ 1, 0, 0, 0, 0, 0, 0 ], 'execute' => [ 1, 0, 0, 0, 0, 0, 0 ], 'finish' => [ 1, 0, 0, 0, 0, 0, 0 ], }, }, 'should have @_ as keys'; # check we can filter by method $tmp = run_test1( { Path => [ sub { return \undef unless $_[1] =~ /^fetch/; return $_[1] } ] }); #warn Dumper($tmp); is_deeply $tmp, { 'fetchrow_hashref' => [ 1, 0, 0, 0, 0, 0, 0 ], }, 'should be able to filter by method'; DBI->trace(0, "STDOUT"); # close current log to flush it ok(-s $LOG_FILE, 'output should go to log file'); # ----------------------------------------------------------------------------------- print "testing as_text\n"; # check %N$ indices $dbh->{Profile}->{Data} = { P1 => { P2 => [ 100, 400, 42, 43, 44, 45, 46, 47 ] } }; my $as_text = $dbh->{Profile}->as_text({ path => [ 'top' ], separator => ':', format => '%1$s %2$d [ %10$d %11$d %12$d %13$d %14$d %15$d %16$d %17$d ]', }); is($as_text, "top:P1:P2 4 [ 100 400 42 43 44 45 46 47 ]", 'as_text'); # test sortsub $dbh->{Profile}->{Data} = { A => { Z => [ 101, 1, 2, 3, 4, 5, 6, 7 ] }, B => { Y => [ 102, 1, 2, 3, 4, 5, 6, 7 ] }, }; $as_text = $dbh->{Profile}->as_text({ separator => ':', format => '%1$s %10$d ', sortsub => sub { my $ary=shift; @$ary = sort { $a->[2] cmp $b->[2] } @$ary } }); is($as_text, "B:Y 102 A:Z 101 ", 'as_text sortsub'); # general test, including defaults ($tmp, $dbh) = run_test1( { Path => [ 'foo', '!MethodName', 'baz' ] }); $as_text = $dbh->{Profile}->as_text(); $as_text =~ s/\.00+/.0/g; #warn "[$as_text]"; is $as_text, q{foo > DESTROY > baz: 0.0s / 1 = 0.0s avg (first 0.0s, min 0.0s, max 0.0s) foo > STORE > baz: 0.0s / 5 = 0.0s avg (first 0.0s, min 0.0s, max 0.0s) foo > connected > baz: 0.0s / 1 = 0.0s avg (first 0.0s, min 0.0s, max 0.0s) foo > execute > baz: 0.0s / 1 = 0.0s avg (first 0.0s, min 0.0s, max 0.0s) foo > fetchrow_hashref > baz: 0.0s / 1 = 0.0s avg (first 0.0s, min 0.0s, max 0.0s) foo > finish > baz: 0.0s / 1 = 0.0s avg (first 0.0s, min 0.0s, max 0.0s) foo > prepare > baz: 0.0s / 1 = 0.0s avg (first 0.0s, min 0.0s, max 0.0s) }, 'as_text general'; # ----------------------------------------------------------------------------------- print "dbi_profile_merge_nodes\n"; my $total_time = dbi_profile_merge_nodes( my $totals=[], [ 10, 0.51, 0.11, 0.01, 0.22, 1023110000, 1023110010 ], [ 15, 0.42, 0.12, 0.02, 0.23, 1023110005, 1023110009 ], ); $_ = sprintf "%.2f", $_ for @$totals; # avoid precision issues is("@$totals", "25.00 0.93 0.11 0.01 0.23 1023110000.00 1023110010.00", 'merged nodes'); is($total_time, 0.93, 'merged time'); $total_time = dbi_profile_merge_nodes( $totals=[], { foo => [ 10, 1.51, 0.11, 0.01, 0.22, 1023110000, 1023110010 ], bar => [ 17, 1.42, 0.12, 0.02, 0.23, 1023110005, 1023110009 ], } ); $_ = sprintf "%.2f", $_ for @$totals; # avoid precision issues is("@$totals", "27.00 2.93 0.11 0.01 0.23 1023110000.00 1023110010.00", 'merged time foo/bar'); is($total_time, 2.93, 'merged nodes foo/bar time'); exit 0; sub sanitize_tree { my $data = shift; my $skip_clone = shift; return $data unless ref $data; $data = dclone($data) unless $skip_clone; sanitize_profile_data_nodes($data->{Data}) if $data->{Data}; return $data; } sub sanitize_profile_data_nodes { my $node = shift; if (ref $node eq 'HASH') { sanitize_profile_data_nodes($_) for values %$node; } elsif (ref $node eq 'ARRAY') { if (@$node == 7 and DBI::looks_like_number($node->[0])) { # sanitize the profile data node to simplify tests $_ = 0 for @{$node}[1..@$node-1]; # not 0 } } return $node; } DBI-1.648/t/13taint.t0000644000031300001440000000545112127465144013315 0ustar00merijnusers#!perl -wT use lib qw(blib/arch blib/lib); # needed since -T ignores PERL5LIB use DBI qw(:sql_types); use Config; use Cwd; use strict; $^W = 1; $| = 1; require VMS::Filespec if $^O eq 'VMS'; use Test::More; # Check Taint attribute works. This requires this test to be run # manually with the -T flag: "perl -T -Mblib t/examp.t" sub is_tainted { my $foo; return ! eval { ($foo=join('',@_)), kill 0; 1; }; } sub mk_tainted { my $string = shift; return substr($string.$^X, 0, length($string)); } plan skip_all => "Taint attributes not supported with DBI::PurePerl" if $DBI::PurePerl; plan skip_all => "Taint attribute tests require taint mode (perl -T)" unless is_tainted($^X); plan skip_all => "Taint attribute tests not functional with DBI_AUTOPROXY" if $ENV{DBI_AUTOPROXY}; plan tests => 36; # get a dir always readable on all platforms my $dir = getcwd() || cwd(); $dir = VMS::Filespec::unixify($dir) if $^O eq 'VMS'; $dir =~ m/(.*)/; $dir = $1 || die; # untaint $dir my ($r, $dbh); $dbh = DBI->connect('dbi:ExampleP:', '', '', { PrintError=>0, RaiseError=>1, Taint => 1 }); my $std_sql = "select mode,size,name from ?"; my $csr_a = $dbh->prepare($std_sql); ok(ref $csr_a); ok($dbh->{'Taint'}); ok($dbh->{'TaintIn'} == 1); ok($dbh->{'TaintOut'} == 1); $dbh->{'TaintOut'} = 0; ok($dbh->{'Taint'} == 0); ok($dbh->{'TaintIn'} == 1); ok($dbh->{'TaintOut'} == 0); $dbh->{'Taint'} = 0; ok($dbh->{'Taint'} == 0); ok($dbh->{'TaintIn'} == 0); ok($dbh->{'TaintOut'} == 0); $dbh->{'TaintIn'} = 1; ok($dbh->{'Taint'} == 0); ok($dbh->{'TaintIn'} == 1); ok($dbh->{'TaintOut'} == 0); $dbh->{'TaintOut'} = 1; ok($dbh->{'Taint'} == 1); ok($dbh->{'TaintIn'} == 1); ok($dbh->{'TaintOut'} == 1); $dbh->{'Taint'} = 0; my $st; eval { $st = $dbh->prepare($std_sql); }; ok(ref $st); ok($st->{'Taint'} == 0); ok($st->execute( $dir ), 'should execute ok'); my @row = $st->fetchrow_array; ok(@row); ok(!is_tainted($row[0])); ok(!is_tainted($row[1])); ok(!is_tainted($row[2])); print "TaintIn\n"; $st->{'TaintIn'} = 1; @row = $st->fetchrow_array; ok(@row); ok(!is_tainted($row[0])); ok(!is_tainted($row[1])); ok(!is_tainted($row[2])); print "TaintOut\n"; $st->{'TaintOut'} = 1; @row = $st->fetchrow_array; ok(@row); ok(is_tainted($row[0])); ok(is_tainted($row[1])); ok(is_tainted($row[2])); $st->finish; my $tainted_sql = mk_tainted($std_sql); my $tainted_dot = mk_tainted('.'); $dbh->{'Taint'} = $csr_a->{'Taint'} = 1; eval { $dbh->prepare($tainted_sql); 1; }; ok($@ =~ /Insecure dependency/, $@); eval { $csr_a->execute($tainted_dot); 1; }; ok($@ =~ /Insecure dependency/, $@); undef $@; $dbh->{'TaintIn'} = $csr_a->{'TaintIn'} = 0; eval { $dbh->prepare($tainted_sql); 1; }; ok(!$@, $@); eval { $csr_a->execute($tainted_dot); 1; }; ok(!$@, $@); $csr_a->{Taint} = 0; ok($csr_a->{Taint} == 0); $csr_a->finish; $dbh->disconnect; 1; DBI-1.648/t/52dbm_complex.t0000644000031300001440000003440414742423677014504 0ustar00merijnusers#!perl -w $| = 1; use strict; use warnings; require DBD::DBM; use File::Path; use File::Spec; use Test::More; use Cwd; use Config qw(%Config); use Storable qw(dclone); my $using_dbd_gofer = ( $ENV{DBI_AUTOPROXY} || '' ) =~ /^dbi:Gofer.*transport=/i; use DBI; my ( @mldbm_types, @dbm_types ); BEGIN { # 0=SQL::Statement if avail, 1=DBI::SQL::Nano # next line forces use of Nano rather than default behaviour # $ENV{DBI_SQL_NANO}=1; # This is done in zv*n*_50dbm_simple.t if ( eval { require 'MLDBM.pm'; } ) { push @mldbm_types, qw(Data::Dumper Storable); # both in CORE push @mldbm_types, 'FreezeThaw' if eval { require 'FreezeThaw.pm' }; push @mldbm_types, 'YAML' if eval { require MLDBM::Serializer::YAML; }; push @mldbm_types, 'JSON' if eval { require MLDBM::Serializer::JSON; }; } # Potential DBM modules in preference order (SDBM_File first) # skip NDBM and ODBM as they don't support EXISTS my @dbms = qw(SDBM_File GDBM_File DB_File BerkeleyDB NDBM_File ODBM_File); my @use_dbms = @ARGV; if ( !@use_dbms && $ENV{DBD_DBM_TEST_BACKENDS} ) { @use_dbms = split ' ', $ENV{DBD_DBM_TEST_BACKENDS}; } if ( lc "@use_dbms" eq "all" ) { # test with as many of the major DBM types as are available @dbm_types = grep { eval { no warnings; require "$_.pm" } } @dbms; } elsif (@use_dbms) { @dbm_types = @use_dbms; } else { # we only test SDBM_File by default to avoid tripping up # on any broken DBM's that may be installed in odd places. # It's only DBD::DBM we're trying to test here. # (However, if SDBM_File is not available, then use another.) for my $dbm (@dbms) { if ( eval { no warnings; require "$dbm.pm" } ) { @dbm_types = ($dbm); last; } } } if ( eval { require List::MoreUtils; } ) { List::MoreUtils->import("part"); } else { # XXX from PP part of List::MoreUtils eval <<'EOP'; sub part(&@) { my ($code, @list) = @_; my @parts; push @{ $parts[$code->($_)] }, $_ for @list; return @parts; } EOP } } my $haveSS = DBD::DBM::Statement->isa('SQL::Statement'); plan skip_all => "DBI::SQL::Nano is being used" unless ( $haveSS ); plan skip_all => "Not running with MLDBM" unless ( @mldbm_types ); do "./t/lib.pl"; my $dir = test_dir (); my $dbh = DBI->connect( 'dbi:DBM:', undef, undef, { f_dir => $dir, } ); my $suffix; my $tbl_meta; sub break_at_warn { note "break here"; } $SIG{__WARN__} = \&break_at_warn; $SIG{__DIE__} = \&break_at_warn; sub load_tables { my ( $dbmtype, $dbmmldbm ) = @_; my $last_suffix; if ($using_dbd_gofer) { $dbh->disconnect(); $dbh = DBI->connect( "dbi:DBM:", undef, undef, { f_dir => $dir, dbm_type => $dbmtype, dbm_mldbm => $dbmmldbm } ); } else { $last_suffix = $suffix; $dbh->{dbm_type} = $dbmtype; $dbh->{dbm_mldbm} = $dbmmldbm; } (my $serializer = $dbmmldbm ) =~ s/::/_/g; $suffix = join( "_", $$, $dbmtype, $serializer ); if ($last_suffix) { for my $table (qw(APPL_%s PREC_%s NODE_%s LANDSCAPE_%s CONTACT_%s NM_LANDSCAPE_%s APPL_CONTACT_%s)) { my $readsql = sprintf "SELECT * FROM $table", $last_suffix; my $impsql = sprintf "CREATE TABLE $table AS IMPORT (?)", $suffix; my ($readsth); ok( $readsth = $dbh->prepare($readsql), "prepare: $readsql" ); ok( $readsth->execute(), "execute: $readsql" ); ok( $dbh->do( $impsql, {}, $readsth ), $impsql ) or warn $dbh->errstr(); } } else { for my $sql ( split( "\n", join( '', <<'EOD' ) ) ) CREATE TABLE APPL_%s (id INT, applname CHAR, appluniq CHAR, version CHAR, appl_type CHAR) CREATE TABLE PREC_%s (id INT, appl_id INT, node_id INT, precedence INT) CREATE TABLE NODE_%s (id INT, nodename CHAR, os CHAR, version CHAR) CREATE TABLE LANDSCAPE_%s (id INT, landscapename CHAR) CREATE TABLE CONTACT_%s (id INT, surname CHAR, familyname CHAR, phone CHAR, userid CHAR, mailaddr CHAR) CREATE TABLE NM_LANDSCAPE_%s (id INT, ls_id INT, obj_id INT, obj_type INT) CREATE TABLE APPL_CONTACT_%s (id INT, contact_id INT, appl_id INT, contact_type CHAR) INSERT INTO APPL_%s VALUES ( 1, 'ZQF', 'ZFQLIN', '10.2.0.4', 'Oracle DB') INSERT INTO APPL_%s VALUES ( 2, 'YRA', 'YRA-UX', '10.2.0.2', 'Oracle DB') INSERT INTO APPL_%s VALUES ( 3, 'PRN1', 'PRN1-4.B2', '1.1.22', 'CUPS' ) INSERT INTO APPL_%s VALUES ( 4, 'PRN2', 'PRN2-4.B2', '1.1.22', 'CUPS' ) INSERT INTO APPL_%s VALUES ( 5, 'PRN1', 'PRN1-4.B1', '1.1.22', 'CUPS' ) INSERT INTO APPL_%s VALUES ( 7, 'PRN2', 'PRN2-4.B1', '1.1.22', 'CUPS' ) INSERT INTO APPL_%s VALUES ( 8, 'sql-stmt', 'SQL::Statement', '1.21', 'Project Web-Site') INSERT INTO APPL_%s VALUES ( 9, 'cpan.org', 'http://www.cpan.org/', '1.0', 'Web-Site') INSERT INTO APPL_%s VALUES (10, 'httpd', 'cpan-apache', '2.2.13', 'Web-Server') INSERT INTO APPL_%s VALUES (11, 'cpan-mods', 'cpan-mods', '8.4.1', 'PostgreSQL DB') INSERT INTO APPL_%s VALUES (12, 'cpan-authors', 'cpan-authors', '8.4.1', 'PostgreSQL DB') INSERT INTO NODE_%s VALUES ( 1, 'ernie', 'RHEL', '5.2') INSERT INTO NODE_%s VALUES ( 2, 'bert', 'RHEL', '5.2') INSERT INTO NODE_%s VALUES ( 3, 'statler', 'FreeBSD', '7.2') INSERT INTO NODE_%s VALUES ( 4, 'waldorf', 'FreeBSD', '7.2') INSERT INTO NODE_%s VALUES ( 5, 'piggy', 'NetBSD', '5.0.2') INSERT INTO NODE_%s VALUES ( 6, 'kermit', 'NetBSD', '5.0.2') INSERT INTO NODE_%s VALUES ( 7, 'samson', 'NetBSD', '5.0.2') INSERT INTO NODE_%s VALUES ( 8, 'tiffy', 'NetBSD', '5.0.2') INSERT INTO NODE_%s VALUES ( 9, 'rowlf', 'Debian Lenny', '5.0') INSERT INTO NODE_%s VALUES (10, 'fozzy', 'Debian Lenny', '5.0') INSERT INTO PREC_%s VALUES ( 1, 1, 1, 1) INSERT INTO PREC_%s VALUES ( 2, 1, 2, 2) INSERT INTO PREC_%s VALUES ( 3, 2, 2, 1) INSERT INTO PREC_%s VALUES ( 4, 2, 1, 2) INSERT INTO PREC_%s VALUES ( 5, 3, 5, 1) INSERT INTO PREC_%s VALUES ( 6, 3, 7, 2) INSERT INTO PREC_%s VALUES ( 7, 4, 6, 1) INSERT INTO PREC_%s VALUES ( 8, 4, 8, 2) INSERT INTO PREC_%s VALUES ( 9, 5, 7, 1) INSERT INTO PREC_%s VALUES (10, 5, 5, 2) INSERT INTO PREC_%s VALUES (11, 6, 8, 1) INSERT INTO PREC_%s VALUES (12, 7, 6, 2) INSERT INTO PREC_%s VALUES (13, 10, 9, 1) INSERT INTO PREC_%s VALUES (14, 10, 10, 1) INSERT INTO PREC_%s VALUES (15, 8, 9, 1) INSERT INTO PREC_%s VALUES (16, 8, 10, 1) INSERT INTO PREC_%s VALUES (17, 9, 9, 1) INSERT INTO PREC_%s VALUES (18, 9, 10, 1) INSERT INTO PREC_%s VALUES (19, 11, 3, 1) INSERT INTO PREC_%s VALUES (20, 11, 4, 2) INSERT INTO PREC_%s VALUES (21, 12, 4, 1) INSERT INTO PREC_%s VALUES (22, 12, 3, 2) INSERT INTO LANDSCAPE_%s VALUES (1, 'Logistic') INSERT INTO LANDSCAPE_%s VALUES (2, 'Infrastructure') INSERT INTO LANDSCAPE_%s VALUES (3, 'CPAN') INSERT INTO CONTACT_%s VALUES ( 1, 'Hans Peter', 'Mueller', '12345', 'HPMUE', 'hp-mueller@here.com') INSERT INTO CONTACT_%s VALUES ( 2, 'Knut', 'Inge', '54321', 'KINGE', 'k-inge@here.com') INSERT INTO CONTACT_%s VALUES ( 3, 'Lola', 'Nguyen', '+1-123-45678-90', 'LNYUG', 'lola.ngyuen@customer.com') INSERT INTO CONTACT_%s VALUES ( 4, 'Helge', 'Brunft', '+41-123-45678-09', 'HBRUN', 'helge.brunft@external-dc.at') -- TYPE: 1: APPL 2: NODE 3: CONTACT INSERT INTO NM_LANDSCAPE_%s VALUES ( 1, 1, 1, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 2, 1, 2, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 3, 3, 3, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 4, 3, 4, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 5, 2, 5, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 6, 2, 6, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 7, 2, 7, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 8, 2, 8, 2) INSERT INTO NM_LANDSCAPE_%s VALUES ( 9, 3, 9, 2) INSERT INTO NM_LANDSCAPE_%s VALUES (10, 3,10, 2) INSERT INTO NM_LANDSCAPE_%s VALUES (11, 1, 1, 1) INSERT INTO NM_LANDSCAPE_%s VALUES (12, 2, 2, 1) INSERT INTO NM_LANDSCAPE_%s VALUES (13, 2, 2, 3) INSERT INTO NM_LANDSCAPE_%s VALUES (14, 3, 1, 3) INSERT INTO APPL_CONTACT_%s VALUES (1, 3, 1, 'OWNER') INSERT INTO APPL_CONTACT_%s VALUES (2, 3, 2, 'OWNER') INSERT INTO APPL_CONTACT_%s VALUES (3, 4, 3, 'ADMIN') INSERT INTO APPL_CONTACT_%s VALUES (4, 4, 4, 'ADMIN') INSERT INTO APPL_CONTACT_%s VALUES (5, 4, 5, 'ADMIN') INSERT INTO APPL_CONTACT_%s VALUES (6, 4, 6, 'ADMIN') EOD { chomp $sql; $sql =~ s/^\s+//; $sql =~ s/--.*$//; $sql =~ s/\s+$//; next if ( '' eq $sql ); $sql = sprintf $sql, $suffix; ok( $dbh->do($sql), $sql ); } } for my $table (qw(APPL_%s PREC_%s NODE_%s LANDSCAPE_%s CONTACT_%s NM_LANDSCAPE_%s APPL_CONTACT_%s)) { my $tbl_name = lc sprintf($table, $suffix); $tbl_meta->{$tbl_name} = { dbm_type => $dbmtype, dbm_mldbm => $dbmmldbm }; } unless ($using_dbd_gofer) { my $tbl_known_meta = $dbh->dbm_get_meta( "+", [ qw(dbm_type dbm_mldbm) ] ); is_deeply( $tbl_known_meta, $tbl_meta, "Know meta" ); } } sub do_tests { my ( $dbmtype, $serializer ) = @_; note "Running do_tests for $dbmtype + $serializer"; load_tables( $dbmtype, $serializer ); my %joins; my $sql; $sql = join( " ", q{SELECT applname, appluniq, version, nodename }, sprintf( q{FROM APPL_%s, PREC_%s, NODE_%s }, ($suffix) x 3 ), sprintf( q{WHERE appl_type LIKE '%%DB' AND APPL_%s.id=PREC_%s.appl_id AND}, ($suffix) x 2 ), sprintf( q{PREC_%s.node_id=NODE_%s.id}, ($suffix) x 2 ), ); $joins{$sql} = [ 'ZQF~ZFQLIN~10.2.0.4~ernie', 'ZQF~ZFQLIN~10.2.0.4~bert', 'YRA~YRA-UX~10.2.0.2~bert', 'YRA~YRA-UX~10.2.0.2~ernie', 'cpan-mods~cpan-mods~8.4.1~statler', 'cpan-mods~cpan-mods~8.4.1~waldorf', 'cpan-authors~cpan-authors~8.4.1~waldorf', 'cpan-authors~cpan-authors~8.4.1~statler', ]; $sql = join( " ", q{SELECT applname, appluniq, version, landscapename, nodename}, sprintf( q{FROM APPL_%s, PREC_%s, NODE_%s, LANDSCAPE_%s, NM_LANDSCAPE_%s}, ($suffix) x 5 ), sprintf( q{WHERE appl_type LIKE '%%DB' AND APPL_%s.id=PREC_%s.appl_id AND}, ($suffix) x 2 ), sprintf( q{PREC_%s.node_id=NODE_%s.id AND NM_LANDSCAPE_%s.obj_id=APPL_%s.id AND}, ($suffix) x 4 ), sprintf( q{NM_LANDSCAPE_%s.obj_type=1 AND NM_LANDSCAPE_%s.ls_id=LANDSCAPE_%s.id}, ($suffix) x 3 ), ); $joins{$sql} = [ 'ZQF~ZFQLIN~10.2.0.4~Logistic~ernie', 'ZQF~ZFQLIN~10.2.0.4~Logistic~bert', 'YRA~YRA-UX~10.2.0.2~Infrastructure~bert', 'YRA~YRA-UX~10.2.0.2~Infrastructure~ernie', ]; $sql = join( " ", q{SELECT applname, appluniq, version, surname, familyname, phone, nodename}, sprintf( q{FROM APPL_%s, PREC_%s, NODE_%s, CONTACT_%s, APPL_CONTACT_%s}, ($suffix) x 5 ), sprintf( q{WHERE appl_type='CUPS' AND APPL_%s.id=PREC_%s.appl_id AND}, ($suffix) x 2 ), sprintf( q{PREC_%s.node_id=NODE_%s.id AND APPL_CONTACT_%s.appl_id=APPL_%s.id AND}, ($suffix) x 4 ), sprintf( q{APPL_CONTACT_%s.contact_id=CONTACT_%s.id AND PREC_%s.PRECEDENCE=1}, ($suffix) x 3 ), ); $joins{$sql} = [ 'PRN1~PRN1-4.B2~1.1.22~Helge~Brunft~+41-123-45678-09~piggy', 'PRN2~PRN2-4.B2~1.1.22~Helge~Brunft~+41-123-45678-09~kermit', 'PRN1~PRN1-4.B1~1.1.22~Helge~Brunft~+41-123-45678-09~samson', ]; $sql = join( " ", q{SELECT DISTINCT applname, appluniq, version, surname, familyname, phone, nodename}, sprintf( q{FROM APPL_%s, PREC_%s, NODE_%s, CONTACT_%s, APPL_CONTACT_%s}, ($suffix) x 5 ), sprintf( q{WHERE appl_type='CUPS' AND APPL_%s.id=PREC_%s.appl_id AND}, ($suffix) x 2 ), sprintf( q{PREC_%s.node_id=NODE_%s.id AND APPL_CONTACT_%s.appl_id=APPL_%s.id}, ($suffix) x 4 ), sprintf( q{AND APPL_CONTACT_%s.contact_id=CONTACT_%s.id}, ($suffix) x 2 ), ); $joins{$sql} = [ 'PRN1~PRN1-4.B1~1.1.22~Helge~Brunft~+41-123-45678-09~piggy', 'PRN1~PRN1-4.B2~1.1.22~Helge~Brunft~+41-123-45678-09~piggy', 'PRN1~PRN1-4.B1~1.1.22~Helge~Brunft~+41-123-45678-09~samson', 'PRN1~PRN1-4.B2~1.1.22~Helge~Brunft~+41-123-45678-09~samson', 'PRN2~PRN2-4.B2~1.1.22~Helge~Brunft~+41-123-45678-09~kermit', 'PRN2~PRN2-4.B2~1.1.22~Helge~Brunft~+41-123-45678-09~tiffy', ]; $sql = join( " ", q{SELECT CONCAT('[% NOW %]') AS "timestamp", applname, appluniq, version, nodename}, sprintf( q{FROM APPL_%s, PREC_%s, NODE_%s}, ($suffix) x 3 ), sprintf( q{WHERE appl_type LIKE '%%DB' AND APPL_%s.id=PREC_%s.appl_id AND}, ($suffix) x 2 ), sprintf( q{PREC_%s.node_id=NODE_%s.id}, ($suffix) x 2 ), ); $joins{$sql} = [ '[% NOW %]~ZQF~ZFQLIN~10.2.0.4~ernie', '[% NOW %]~ZQF~ZFQLIN~10.2.0.4~bert', '[% NOW %]~YRA~YRA-UX~10.2.0.2~bert', '[% NOW %]~YRA~YRA-UX~10.2.0.2~ernie', '[% NOW %]~cpan-mods~cpan-mods~8.4.1~statler', '[% NOW %]~cpan-mods~cpan-mods~8.4.1~waldorf', '[% NOW %]~cpan-authors~cpan-authors~8.4.1~waldorf', '[% NOW %]~cpan-authors~cpan-authors~8.4.1~statler', ]; while ( my ( $sql, $result ) = each(%joins) ) { my $sth = $dbh->prepare($sql); eval { $sth->execute() }; warn $@ if $@; my @res; while ( my $row = $sth->fetchrow_arrayref() ) { push( @res, join( '~', @{$row} ) ); } is( join( '^', sort @res ), join( '^', sort @{$result} ), $sql ); } } foreach my $dbmtype (@dbm_types) { foreach my $serializer (@mldbm_types) { do_tests( $dbmtype, $serializer ); } } done_testing(); DBI-1.648/t/08keeperr.t0000644000031300001440000002662414742423677013656 0ustar00merijnusers#!perl -w use strict; use Test::More; ## ---------------------------------------------------------------------------- ## 08keeperr.t ## ---------------------------------------------------------------------------- # ## ---------------------------------------------------------------------------- BEGIN { use_ok('DBI'); } $|=1; $^W=1; ## ---------------------------------------------------------------------------- # subclass DBI # DBI subclass package My::DBI; use base 'DBI'; # Database handle subclass package My::DBI::db; use base 'DBI::db'; # Statement handle subclass package My::DBI::st; use base 'DBI::st'; sub execute { my $sth = shift; # we localize an attribute here to check that the corresponding STORE # at scope exit doesn't clear any recorded error local $sth->{Warn} = 0; my $rv = $sth->SUPER::execute(@_); return $rv; } ## ---------------------------------------------------------------------------- # subclass the subclass of DBI package Test; use strict; use base 'My::DBI'; use DBI; my @con_info = ('dbi:ExampleP:.', undef, undef, { PrintError => 0, RaiseError => 1 }); sub test_select { my $dbh = shift; eval { $dbh->selectrow_arrayref('select * from foo') }; $dbh->disconnect; return $@; } my $err1 = test_select( My::DBI->connect(@con_info) ); Test::More::like($err1, qr/^DBD::(ExampleP|Multiplex|Gofer)::db selectrow_arrayref failed: opendir/, '... checking error'); my $err2 = test_select( DBI->connect(@con_info) ); Test::More::like($err2, qr/^DBD::(ExampleP|Multiplex|Gofer)::db selectrow_arrayref failed: opendir/, '... checking error'); package main; my $using_dbd_gofer = ( $ENV{DBI_AUTOPROXY} || '' ) =~ /^dbi:Gofer.*transport=/i; # test ping does not destroy the errstr sub ping_keeps_err { my $dbh = DBI->connect('DBI:ExampleP:', undef, undef, { PrintError => 0 }); $dbh->set_err(42, "ERROR 42"); is $dbh->err, 42; is $dbh->errstr, "ERROR 42"; ok $dbh->ping, "ping returns true"; is $dbh->err, 42, "err unchanged after ping"; is $dbh->errstr, "ERROR 42", "errstr unchanged after ping"; $dbh->disconnect; $dbh->set_err(42, "ERROR 42"); is $dbh->err, 42, "err unchanged after ping"; is $dbh->errstr, "ERROR 42", "errstr unchanged after ping"; ok !$dbh->ping, "ping returns false"; # it's reasonable for ping() to set err/errstr if it fails # so here we just test that there is an error ok $dbh->err, "err true after failed ping"; ok $dbh->errstr, "errstr true after failed ping"; # for a driver which doesn't have its own ping $dbh = DBI->connect('DBI:Sponge:', undef, undef, { PrintError => 0 }); $dbh->STORE(Active => 1); $dbh->set_err(42, "ERROR 42"); is $dbh->err, 42; is $dbh->errstr, "ERROR 42"; ok $dbh->ping, "ping returns true: ".$dbh->ping; is $dbh->err, 42, "err unchanged after ping"; is $dbh->errstr, "ERROR 42", "errstr unchanged after ping"; $dbh->disconnect; $dbh->STORE(Active => 0); $dbh->set_err(42, "ERROR 42"); is $dbh->err, 42, "err unchanged after ping"; is $dbh->errstr, "ERROR 42", "errstr unchanged after ping"; ok !$dbh->ping, "ping returns false"; # it's reasonable for ping() to set err/errstr if it fails # so here we just test that there is an error ok $dbh->err, "err true after failed ping"; ok $dbh->errstr, "errstr true after failed ping"; } ## ---------------------------------------------------------------------------- print "Test HandleSetErr\n"; my $dbh = DBI->connect(@con_info); isa_ok($dbh, "DBI::db"); $dbh->{RaiseError} = 1; $dbh->{PrintError} = 1; $dbh->{RaiseWarn} = 0; $dbh->{PrintWarn} = 1; # warning handler my %warn; my @handlewarn; sub reset_warn_counts { %warn = ( failed => 0, warning => 0 ); @handlewarn = (0,0,0); } reset_warn_counts(); $SIG{__WARN__} = sub { my $msg = shift; if ($msg =~ /^DBD::\w+::\S+\s+(\S+)\s+(\w+)/) { ++$warn{$2}; $msg =~ s/\n/\\n/g; print "warn: '$msg'\n"; return; } warn $msg; }; # HandleSetErr handler $dbh->{HandleSetErr} = sub { my ($h, $err, $errstr, $state) = @_; return 0 unless defined $err; ++$handlewarn[ $err ? 2 : length($err) ]; # count [info, warn, err] calls return 1 if $state && $state eq "return"; # for tests ($_[1], $_[2], $_[3]) = (99, "errstr99", "OV123") if $state && $state eq "override"; # for tests return 0 if $err; # be transparent for errors local $^W; print "HandleSetErr called: h=$h, err=$err, errstr=$errstr, state=$state\n"; return 0; }; # start our tests ok(!defined $DBI::err, '... $DBI::err is not defined'); # ---- $dbh->set_err("", "(got info)"); ok(defined $DBI::err, '... $DBI::err is defined'); # true is($DBI::err, "", '... $DBI::err is an empty string'); is($DBI::errstr, "(got info)", '... $DBI::errstr is as we expected'); is($dbh->errstr, "(got info)", '... $dbh->errstr matches $DBI::errstr'); cmp_ok($warn{failed}, '==', 0, '... $warn{failed} is 0'); cmp_ok($warn{warning}, '==', 0, '... $warn{warning} is 0'); is_deeply(\@handlewarn, [ 1, 0, 0 ], '... the @handlewarn array is (1, 0, 0)'); # ---- $dbh->set_err(0, "(got warn)", "AA001"); # triggers PrintWarn ok(defined $DBI::err, '... $DBI::err is defined'); is($DBI::err, "0", '... $DBI::err is "0"'); is($DBI::errstr, "(got info)\n(got warn)", '... $DBI::errstr is as we expected'); is($dbh->errstr, "(got info)\n(got warn)", '... $dbh->errstr matches $DBI::errstr'); is($DBI::state, "AA001", '... $DBI::state is AA001'); cmp_ok($warn{warning}, '==', 1, '... $warn{warning} is 1'); is_deeply(\@handlewarn, [ 1, 1, 0 ], '... the @handlewarn array is (1, 1, 0)'); # ---- $dbh->set_err("", "(got more info)"); # triggers PrintWarn ok(defined $DBI::err, '... $DBI::err is defined'); is($DBI::err, "0", '... $DBI::err is "0"'); # not "", ie it's still a warn is($dbh->err, "0", '... $dbh->err is "0"'); is($DBI::state, "AA001", '... $DBI::state is AA001'); is($DBI::errstr, "(got info)\n(got warn)\n(got more info)", '... $DBI::errstr is as we expected'); is($dbh->errstr, "(got info)\n(got warn)\n(got more info)", '... $dbh->errstr matches $DBI::errstr'); cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2'); is_deeply(\@handlewarn, [ 2, 1, 0 ], '... the @handlewarn array is (2, 1, 0)'); # ---- $dbh->{RaiseError} = 0; $dbh->{PrintError} = 1; $dbh->{RaiseWarn} = 1; # ---- $dbh->set_err("42", "(got error)", "AA002"); ok(defined $DBI::err, '... $DBI::err is defined'); cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42'); cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2'); is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now AA002]\n(got error)", '... $dbh->errstr is as we expected'); is($DBI::state, "AA002", '... $DBI::state is AA002'); is_deeply(\@handlewarn, [ 2, 1, 1 ], '... the @handlewarn array is (2, 1, 1)'); # ---- $dbh->set_err("", "(got info)"); ok(defined $DBI::err, '... $DBI::err is defined'); cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42'); cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2'); is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now AA002]\n(got error)\n(got info)", '... $dbh->errstr is as we expected'); is_deeply(\@handlewarn, [ 3, 1, 1 ], '... the @handlewarn array is (3, 1, 1)'); # ---- $dbh->set_err("0", "(got warn)"); # no PrintWarn because it's already an err ok(defined $DBI::err, '... $DBI::err is defined'); cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42'); cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2'); is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now AA002]\n(got error)\n(got info)\n(got warn)", '... $dbh->errstr is as we expected'); is_deeply(\@handlewarn, [ 3, 2, 1 ], '... the @handlewarn array is (3, 2, 1)'); # ---- $dbh->set_err("4200", "(got new error)", "AA003"); ok(defined $DBI::err, '... $DBI::err is defined'); cmp_ok($DBI::err, '==', 4200, '... $DBI::err is 4200'); cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2'); is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now AA002]\n(got error)\n(got info)\n(got warn) [err was 42 now 4200] [state was AA002 now AA003]\n(got new error)", '... $dbh->errstr is as we expected'); is_deeply(\@handlewarn, [ 3, 2, 2 ], '... the @handlewarn array is (3, 2, 2)'); # ---- $dbh->set_err(undef, "foo", "bar"); # clear error ok(!defined $dbh->errstr, '... $dbh->errstr is defined'); ok(!defined $dbh->err, '... $dbh->err is defined'); is($dbh->state, "", '... $dbh->state is an empty string'); # ---- reset_warn_counts(); # ---- my @ret; @ret = $dbh->set_err(1, "foo"); # PrintError cmp_ok(scalar(@ret), '==', 1, '... only returned one value'); ok(!defined $ret[0], '... the first value is undefined'); ok(!defined $dbh->set_err(2, "bar"), '... $dbh->set_err returned undefiend'); # PrintError ok(!defined $dbh->set_err(3, "baz"), '... $dbh->set_err returned undefiend'); # PrintError ok(!defined $dbh->set_err(0, "warn"), '... $dbh->set_err returned undefiend'); # PrintError is($dbh->errstr, "foo [err was 1 now 2]\nbar [err was 2 now 3]\nbaz\nwarn", '... $dbh->errstr is as we expected'); is($warn{failed}, 4, '... $warn{failed} is 4'); is_deeply(\@handlewarn, [ 0, 1, 3 ], '... the @handlewarn array is (0, 1, 3)'); # ---- $dbh->set_err(undef, undef, undef); # clear error @ret = $dbh->set_err(1, "foo", "AA123", "method"); cmp_ok(scalar @ret, '==', 1, '... only returned one value'); ok(!defined $ret[0], '... the first value is undefined'); @ret = $dbh->set_err(1, "foo", "AA123", "method", "42"); cmp_ok(scalar @ret, '==', 1, '... only returned one value'); is($ret[0], "42", '... the first value is "42"'); @ret = $dbh->set_err(1, "foo", "return"); cmp_ok(scalar @ret, '==', 0, '... returned no values'); # ---- $dbh->set_err(undef, undef, undef); # clear error @ret = $dbh->set_err("", "info", "override"); cmp_ok(scalar @ret, '==', 1, '... only returned one value'); ok(!defined $ret[0], '... the first value is undefined'); cmp_ok($dbh->err, '==', 99, '... $dbh->err is 99'); is($dbh->errstr, "errstr99", '... $dbh->errstr is as we expected'); is($dbh->state, "OV123", '... $dbh->state is as we expected'); $dbh->disconnect; # --- ping_keeps_err(); # --- reset_warn_counts(); SKIP: { # we could test this with gofer is we used a different keep_err method other than STORE # to trigger the set_err calls skip 'set_err keep_error skipped for Gofer', 2 if $using_dbd_gofer; $dbh->{examplep_set_err} = ""; # set information state cmp_ok($warn{warning}, '==', 0, 'no extra warning generated for set_err("") in STORE'); $dbh->{RaiseWarn} = 0; $dbh->{examplep_set_err} = "0"; # set warning state cmp_ok($warn{warning}, '==', 1, 'warning generated for set_err("0") in STORE'); } # --- # ---- done_testing(); 1; # end DBI-1.648/t/87gofer_cache.t0000644000031300001440000000600514656646601014442 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- # vim:sw=4:ts=8 $|=1; use strict; use warnings; use DBI; use Data::Dumper; use Test::More; use DBI::Util::CacheMemory; plan skip_all => "Gofer DBI_AUTOPROXY" if (($ENV{DBI_AUTOPROXY}||'') =~ /^dbi:Gofer/i); plan 'no_plan'; my $dsn = "dbi:Gofer:transport=null;policy=classic;dsn=dbi:ExampleP:"; my @cache_classes = qw(DBI::Util::CacheMemory); push @cache_classes, "Cache::Memory" if eval { require Cache::Memory }; push @cache_classes, "1"; # test alias for DBI::Util::CacheMemory for my $cache_class (@cache_classes) { my $cache_obj = ($cache_class eq "1") ? $cache_class : $cache_class->new(); run_tests($cache_obj); } sub run_tests { my $cache_obj = shift; my $tmp; print "\n --- using $cache_obj for $dsn\n"; my $dbh = DBI->connect($dsn, undef, undef, { go_cache => $cache_obj, RaiseError => 1, PrintError => 0, ShowErrorStatement => 1, } ); ok my $go_transport = $dbh->{go_transport}; ok my $go_cache = $go_transport->go_cache; # setup $go_cache->clear; is $go_cache->count, 0, 'cache should be empty after clear'; $go_transport->transmit_count(0); is $go_transport->transmit_count, 0, 'transmit_count should be 0'; $go_transport->cache_hit(0); $go_transport->cache_miss(0); $go_transport->cache_store(0); # request 1 ok my $rows1 = $dbh->selectall_arrayref("select name from ?", {}, "."); cmp_ok $go_cache->count, '>', 0, 'cache should not be empty after select'; my $expected = ($ENV{DBI_AUTOPROXY}) ? 2 : 1; is $go_transport->cache_hit, 0; is $go_transport->cache_miss, $expected; is $go_transport->cache_store, $expected; is $go_transport->transmit_count, $expected, "should make $expected round trip"; $go_transport->transmit_count(0); is $go_transport->transmit_count, 0, 'transmit_count should be 0'; # request 2 ok my $rows2 = $dbh->selectall_arrayref("select name from ?", {}, "."); is_deeply $rows2, $rows1; is $go_transport->transmit_count, 0, 'should make 0 round trip'; is $go_transport->cache_hit, $expected, 'cache_hit'; is $go_transport->cache_miss, $expected, 'cache_miss'; is $go_transport->cache_store, $expected, 'cache_store'; } print "test per-sth go_cache\n"; my $dbh = DBI->connect($dsn, undef, undef, { go_cache => 1, RaiseError => 1, PrintError => 0, ShowErrorStatement => 1, } ); ok my $go_transport = $dbh->{go_transport}; ok my $dbh_cache = $go_transport->go_cache; $dbh_cache->clear; # discard ping from connect my $cache2 = DBI::Util::CacheMemory->new( namespace => "foo2" ); ok $cache2; ok $cache2 != $dbh_cache; my $sth1 = $dbh->prepare("select name from ?"); is $sth1->go_cache, $dbh_cache; is $dbh_cache->size, 0; ok $dbh->selectall_arrayref($sth1, undef, "."); ok $dbh_cache->size; my $sth2 = $dbh->prepare("select * from ?", { go_cache => $cache2 }); is $sth2->go_cache, $cache2; is $cache2->size, 0; ok $dbh->selectall_arrayref($sth2, undef, "."); ok $cache2->size; cmp_ok $cache2->size, '>', $dbh_cache->size; 1; DBI-1.648/t/85gofer.t0000644000031300001440000002247614742423677013331 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- # vim:sw=4:ts=8 $|=1; use strict; use warnings; use Cwd; use Config; use Data::Dumper; use Test::More 0.84; use Getopt::Long; use DBI qw(dbi_time); if (my $ap = $ENV{DBI_AUTOPROXY}) { # limit the insanity plan skip_all => "transport+policy tests skipped with non-gofer DBI_AUTOPROXY" if $ap !~ /^dbi:Gofer/i; plan skip_all => "transport+policy tests skipped with non-pedantic policy in DBI_AUTOPROXY" if $ap !~ /policy=pedantic\b/i; } do "./t/lib.pl"; # 0=SQL::Statement if avail, 1=DBI::SQL::Nano # next line forces use of Nano rather than default behaviour # $ENV{DBI_SQL_NANO}=1; # This is done in zvn_50dbm.t GetOptions( 'c|count=i' => \(my $opt_count = (-t STDOUT ? 100 : 0)), 'dbm=s' => \my $opt_dbm, 'v|verbose!' => \my $opt_verbose, 't|transport=s' => \my $opt_transport, 'p|policy=s' => \my $opt_policy, ) or exit 1; # so users can try others from the command line if (!$opt_dbm) { # pick first available, starting with SDBM_File for (qw( SDBM_File GDBM_File DB_File BerkeleyDB )) { if (eval { no warnings; require "$_.pm" }) { $opt_dbm = ($_); last; } } plan skip_all => 'No DBM modules available' if !$opt_dbm; } my @remote_dsns = DBI->data_sources( "dbi:DBM:", { dbm_type => $opt_dbm, f_lock => 0, f_dir => test_dir() } ); my $remote_dsn = $remote_dsns[0]; ( my $remote_driver_dsn = $remote_dsn ) =~ s/dbi:dbm://i; # Long timeout for slow/overloaded systems (incl virtual machines with low priority) my $timeout = 240; if ($ENV{DBI_AUTOPROXY}) { # this means we have DBD::Gofer => DBD::Gofer => DBD::DBM! # rather than disable it we let it run because we're twisted # and because it helps find more bugs (though debugging can be painful) warn "\n$0 is running with DBI_AUTOPROXY enabled ($ENV{DBI_AUTOPROXY})\n" unless $0 =~ /\bzv/; # don't warn for t/zvg_85gofer.t } # ensure subprocess (for pipeone and stream transport) will use the same modules as us, ie ./blib local $ENV{PERL5LIB} = join $Config{path_sep}, @INC; my %durations; my $getcwd = getcwd(); my $username = eval { getpwuid($>) } || ''; # fails on windows my $can_ssh = ($username && $username eq 'timbo' && -d '.svn' && system("sh -c 'echo > /dev/tcp/localhost/22' 2>/dev/null")==0 ); my $perl = "$^X -Mblib=$getcwd/blib"; # ensure sameperl and our blib (note two spaces) my %trials = ( null => {}, pipeone => { perl=>$perl, timeout=>$timeout }, stream => { perl=>$perl, timeout=>$timeout }, stream_ssh => ($can_ssh) ? { perl=>$perl, timeout=>$timeout, url => "ssh:$username\@localhost" } : undef, #http => { url => "http://localhost:8001/gofer" }, ); # too dependent on local config to make a standard test delete $trials{http} unless $username eq 'timbo' && -d '.svn'; my @transports = ($opt_transport) ? ($opt_transport) : (sort keys %trials); note("Transports: @transports"); my @policies = ($opt_policy) ? ($opt_policy) : qw(pedantic classic rush); note("Policies: @policies"); note("Count: $opt_count"); for my $trial (@transports) { (my $transport = $trial) =~ s/_.*//; my $trans_attr = $trials{$trial} or next; # XXX temporary restrictions, hopefully if ( ($^O eq 'MSWin32') || ($^O eq 'VMS') ) { # stream needs Fcntl macro F_GETFL for non-blocking # and pipe seems to hang on some windows systems next if $transport eq 'stream' or $transport eq 'pipeone'; } for my $policy_name (@policies) { eval { run_tests($transport, $trans_attr, $policy_name) }; ($@) ? fail("$trial: $@") : pass(); } } # to get baseline for comparisons if doing performance testing run_tests('no', {}, 'pedantic') if $opt_count; while ( my ($activity, $stats_hash) = each %durations ) { note(""); $stats_hash->{'~baseline~'} = delete $stats_hash->{"no+pedantic"}; for my $perf_tag (reverse sort keys %$stats_hash) { my $dur = $stats_hash->{$perf_tag} || 0.0000001; note sprintf " %6s %-16s: %.6fsec (%5d/sec)", $activity, $perf_tag, $dur/$opt_count, $opt_count/$dur; my $baseline_dur = $stats_hash->{'~baseline~'}; note sprintf " %+5.1fms", (($dur-$baseline_dur)/$opt_count)*1000 unless $perf_tag eq '~baseline~'; note ""; } } sub run_tests { my ($transport, $trans_attr, $policy_name) = @_; my $policy = get_policy($policy_name); my $skip_gofer_checks = ($transport eq 'no'); my $test_run_tag = "Testing $transport transport with $policy_name policy"; note "============="; note "$test_run_tag"; my $driver_dsn = "transport=$transport;policy=$policy_name"; $driver_dsn .= join ";", '', map { "$_=$trans_attr->{$_}" } keys %$trans_attr if %$trans_attr; my $dsn = "dbi:Gofer:$driver_dsn;dsn=$remote_dsn"; $dsn = $remote_dsn if $transport eq 'no'; note " $dsn"; my $dbh = DBI->connect($dsn, undef, undef, { RaiseError => 1, PrintError => 0, ShowErrorStatement => 1 } ); die "$test_run_tag aborted: $DBI::errstr\n" unless $dbh; # no point continuing ok $dbh, sprintf "should connect to %s", $dsn; is $dbh->{Name}, ($policy->skip_connect_check) ? $driver_dsn : $remote_driver_dsn; END { unlink glob "fruit.???" } ok $dbh->do("DROP TABLE IF EXISTS fruit"); ok $dbh->do("CREATE TABLE fruit (dKey INT, dVal VARCHAR(10))"); die "$test_run_tag aborted ($DBI::errstr)\n" if $DBI::err; my $sth = do { local $dbh->{RaiseError} = 0; $dbh->prepare("complete non-sql gibberish"); }; ($policy->skip_prepare_check) ? isa_ok $sth, 'DBI::st' : is $sth, undef, 'should detect prepare failure'; ok my $ins_sth = $dbh->prepare("INSERT INTO fruit VALUES (?,?)"); ok $ins_sth->execute(1, 'oranges'); ok $ins_sth->execute(2, 'oranges'); my $rowset; ok $rowset = $dbh->selectall_arrayref("SELECT dKey, dVal FROM fruit ORDER BY dKey"); is_deeply($rowset, [ [ '1', 'oranges' ], [ '2', 'oranges' ] ]); ok $dbh->do("UPDATE fruit SET dVal='apples' WHERE dVal='oranges'"); ok $dbh->{go_response}->executed_flag_set, 'go_response executed flag should be true' unless $skip_gofer_checks && pass(); ok $sth = $dbh->prepare("SELECT dKey, dVal FROM fruit"); ok $sth->execute; ok $rowset = $sth->fetchall_hashref('dKey'); is_deeply($rowset, { '1' => { dKey=>1, dVal=>'apples' }, 2 => { dKey=>2, dVal=>'apples' } }); if ($opt_count and $transport ne 'pipeone') { note "performance check - $opt_count selects and inserts"; my $start = dbi_time(); $dbh->selectall_arrayref("SELECT dKey, dVal FROM fruit") for (1000..1000+$opt_count); $durations{select}{"$transport+$policy_name"} = dbi_time() - $start; # some rows in to get a (*very* rough) idea of overheads $start = dbi_time(); $ins_sth->execute($_, 'speed') for (1000..1000+$opt_count); $durations{insert}{"$transport+$policy_name"} = dbi_time() - $start; } note "Testing go_request_count and caching of simple values"; my $go_request_count = $dbh->{go_request_count}; ok $go_request_count unless $skip_gofer_checks && pass(); ok $dbh->do("DROP TABLE fruit"); is ++$go_request_count, $dbh->{go_request_count} unless $skip_gofer_checks && pass(); # tests go_request_count, caching, and skip_default_methods policy my $use_remote = ($policy->skip_default_methods) ? 0 : 1; $use_remote = 1; # XXX since DBI::DBD::SqlEngine::db implements own data_sources this is always done remotely note sprintf "use_remote=%s (policy=%s, transport=%s) %s", $use_remote, $policy_name, $transport, DBI::neat($dbh->{dbi_default_methods})||''; SKIP: { skip "skip_default_methods checking doesn't work with Gofer over Gofer", 3 if $ENV{DBI_AUTOPROXY} or $skip_gofer_checks; $dbh->data_sources({ foo_bar => $go_request_count }); is $dbh->{go_request_count}, $go_request_count + 1*$use_remote; $dbh->data_sources({ foo_bar => $go_request_count }); # should use cache is $dbh->{go_request_count}, $go_request_count + 1*$use_remote; @_=$dbh->data_sources({ foo_bar => $go_request_count }); # no cached yet due to wantarray is $dbh->{go_request_count}, $go_request_count + 2*$use_remote; } SKIP: { skip "caching of metadata methods returning sth not yet implemented", 2; note "Testing go_request_count and caching of sth"; $go_request_count = $dbh->{go_request_count}; my $sth_ti1 = $dbh->table_info("%", "%", "%", "TABLE", { foo_bar => $go_request_count }); is $go_request_count + 1, $dbh->{go_request_count}; my $sth_ti2 = $dbh->table_info("%", "%", "%", "TABLE", { foo_bar => $go_request_count }); # should use cache is $go_request_count + 1, $dbh->{go_request_count}; } ok $dbh->disconnect; } sub get_policy { my ($policy_class) = @_; $policy_class = "DBD::Gofer::Policy::$policy_class" unless $policy_class =~ /::/; _load_class($policy_class) or die $@; return $policy_class->new(); } sub _load_class { # return true or false+$@ my $class = shift; (my $pm = $class) =~ s{::}{/}g; $pm .= ".pm"; return 1 if eval { require $pm }; delete $INC{$pm}; # shouldn't be needed (perl bug?) and assigning undef isn't enough undef; # error in $@ } done_testing; 1; DBI-1.648/t/70callbacks.t0000644000031300001440000002266714742423677014142 0ustar00merijnusers#!perl -w # vim:ts=8:sw=4 use strict; use Test::More; use DBI; BEGIN { plan skip_all => '$h->{Callbacks} attribute not supported for DBI::PurePerl' if $DBI::PurePerl && $DBI::PurePerl; # doubled to avoid typo warning } $| = 1; my $dsn = "dbi:ExampleP:drv_foo=drv_bar"; my %called; ok my $dbh = DBI->connect($dsn, '', ''), "Create dbh"; is $dbh->{Callbacks}, undef, "Callbacks initially undef"; ok $dbh->{Callbacks} = my $cb = { }; is ref $dbh->{Callbacks}, 'HASH', "Callbacks can be set to a hash ref"; is $dbh->{Callbacks}, $cb, "Callbacks set to same hash ref"; $dbh->{Callbacks} = undef; is $dbh->{Callbacks}, undef, "Callbacks set to undef again"; ok $dbh->{Callbacks} = { ping => sub { my $m = $_; is $m, 'ping', '$m holds method name'; is $_, 'ping', '$_ holds method name (not stolen)'; is @_, 1, '@_ holds 1 values'; is ref $_[0], 'DBI::db', 'first is $dbh'; ok tied(%{$_[0]}), '$dbh is tied (outer) handle' or DBI::dump_handle($_[0], 'tied?', 10); $called{$_}++; return; }, quote_identifier => sub { is @_, 4, '@_ holds 4 values'; my $dbh = shift; is ref $dbh, 'DBI::db', 'first is $dbh'; is $_[0], 'foo'; is $_[1], 'bar'; is $_[2], undef; $_[2] = { baz => 1 }; $called{$_}++; return (1,2,3); # return something - which is not allowed }, disconnect => sub { # test die from within a callback die "You can't disconnect that easily!\n"; }, "*" => sub { $called{$_}++; return; } }; is keys %{ $dbh->{Callbacks} }, 4; is ref $dbh->{Callbacks}->{ping}, 'CODE'; $_ = 42; ok $dbh->ping; is $called{ping}, 1; is $_, 42, '$_ not altered by callback'; ok $dbh->ping; is $called{ping}, 2; ok $dbh->type_info_all; is $called{type_info_all}, 1, 'fallback callback'; my $attr; eval { $dbh->quote_identifier('foo','bar', $attr) }; is $called{quote_identifier}, 1; ok $@, 'quote_identifier callback caused fatal error'; is ref $attr, 'HASH', 'param modified by callback - not recommended!'; ok !eval { $dbh->disconnect }; ok $@, "You can't disconnect that easily!\n"; $dbh->{Callbacks} = undef; ok $dbh->ping; is $called{ping}, 2; # no change # --- test skipping dispatch and fallback callbacks $dbh->{Callbacks} = { ping => sub { undef $_; # tell dispatch to not call the method return "42 bells"; }, data_sources => sub { my ($h, $values_to_return) = @_; undef $_; # tell dispatch to not call the method my @ret = 11..10+($values_to_return||0); return @ret; }, commit => sub { # test using set_err within a callback my $h = shift; undef $_; # tell dispatch to not call the method return $h->set_err(42, "faked commit failure"); }, }; # these tests are slightly convoluted because messing with the stack is bad for # your mental health my $rv = $dbh->ping; is $rv, "42 bells"; my @rv = $dbh->ping; is scalar @rv, 1, 'should return a single value in list context'; is "@rv", "42 bells"; # test returning lists with different number of args to test # the stack handling in the dispatch code is join(":", $dbh->data_sources()), ""; is join(":", $dbh->data_sources(0)), ""; is join(":", $dbh->data_sources(1)), "11"; is join(":", $dbh->data_sources(2)), "11:12"; { local $dbh->{RaiseError} = 1; local $dbh->{PrintError} = 0; is eval { $dbh->commit }, undef, 'intercepted commit should return undef'; like $@, '/DBD::\w+::db commit failed: faked commit failure/'; is $DBI::err, 42; is $DBI::errstr, "faked commit failure"; } # --- test connect_cached.* =for comment XXX The big problem here is that conceptually the Callbacks attribute is applied to the $dbh _during_ the $drh->connect() call, so you can't set a callback on "connect" on the $dbh because connect isn't called on the dbh, but on the $drh. So a "connect" callback would have to be defined on the $drh, but that's cumbersome for the user and then it would apply to all future connects using that driver. The best thing to do is probably to special-case "connect", "connect_cached" and (the already special-case) "connect_cached.reused". =cut my $driver_dsn = (DBI->parse_dsn($dsn))[4] or die 'panic'; my @args = ( $dsn, 'u', 'p', { Callbacks => { "connect_cached.new" => sub { my ($dbh, $cb_dsn, $user, $auth, $attr) = @_; ok tied(%$dbh), 'connect_cached.new $h is tied (outer) handle' if $dbh; # $dbh is typically undef or a dead/disconnected $dbh like $cb_dsn, qr/\Q$driver_dsn/, 'dsn'; is $user, 'u', 'user'; is $auth, 'p', 'pass'; $called{new}++; return; }, "connect_cached.reused" => sub { my ($dbh, $cb_dsn, $user, $auth, $attr) = @_; ok tied(%$dbh), 'connect_cached.reused $h is tied (outer) handle'; like $cb_dsn, qr/\Q$driver_dsn/, 'dsn'; is $user, 'u', 'user'; is $auth, 'p', 'pass'; $called{cached}++; return; }, "connect_cached.connected" => sub { my ($dbh, $cb_dsn, $user, $auth, $attr) = @_; ok tied(%$dbh), 'connect_cached.connected $h is tied (outer) handle'; like $cb_dsn, qr/\Q$driver_dsn/, 'dsn'; is $user, 'u', 'user'; is $auth, 'p', 'pass'; $called{connected}++; return; }, } } ); %called = (); ok $dbh = DBI->connect(@args), "Create handle with callbacks"; is keys %called, 0, 'no callback for plain connect'; ok $dbh = DBI->connect_cached(@args), "Create handle with callbacks"; is $called{new}, 1, "connect_cached.new called"; is $called{cached}, undef, "connect_cached.reused not yet called"; is $called{connected}, 1, "connect_cached.connected called"; ok $dbh = DBI->connect_cached(@args), "Create handle with callbacks"; is $called{cached}, 1, "connect_cached.reused called"; is $called{new}, 1, "connect_cached.new not called again"; is $called{connected}, 1, "connect_cached.connected not called called"; # --- test ChildCallbacks. %called = (); $args[-1] = { Callbacks => my $dbh_callbacks = { ping => sub { $called{ping}++; return; }, ChildCallbacks => my $sth_callbacks = { execute => sub { $called{execute}++; return; }, fetch => sub { $called{fetch}++; return; }, } } }; ok $dbh = DBI->connect(@args), "Create handle with ChildCallbacks"; ok $dbh->ping, 'Ping'; is $called{ping}, 1, 'Ping callback should have been called'; ok my $sth = $dbh->prepare('SELECT name from t'), 'Prepare a statement handle (child)'; ok $sth->{Callbacks}, 'child should have Callbacks'; is $sth->{Callbacks}, $sth_callbacks, "child Callbacks should be ChildCallbacks of parent" or diag "(dbh Callbacks is $dbh_callbacks)"; ok $sth->execute, 'Execute'; is $called{execute}, 1, 'Execute callback should have been called'; ok $sth->fetch, 'Fetch'; is $called{fetch}, 1, 'Fetch callback should have been called'; # stress test for stack reallocation and mark handling -- RT#86744 my $stress_count = 3000; my $place_holders = join(',', ('?') x $stress_count); my @params = ('t') x $stress_count; my $stress_dbh = DBI->connect( 'DBI:NullP:test'); my $stress_sth = $stress_dbh->prepare("select 1"); $stress_sth->{Callbacks}{execute} = sub { return; }; $stress_sth->execute(@params); { package LeakDetect; our $count = 0; sub new { my $class = shift; $count++; return bless {}, $class; } sub DESTROY { $count--; } } # ensure running a callback does not leak extant $_ $dbh = DBI->connect('DBI:NullP:test'); $dbh->{Callbacks}{ping} = sub {}; # with plain assignment to $_ $_ = LeakDetect->new; if ($] >= 5.008002) { is $LeakDetect::count, 1, "[plain] live object count is 1 after new()"; my $obj = $_; $dbh->ping; is $_, $obj, '[plain] $_ still holds an object reference after the callback'; } $_ = undef; is $_, undef, '[plain] $_ is undef at the end'; is $LeakDetect::count, 0, "[plain] live object count is 0 after all object references are gone"; # with localized $_ if ($] >= 5.008002) { local $_ = LeakDetect->new; is $LeakDetect::count, 1, "[local] live object count is 1 after new()"; my $obj = $_; $dbh->ping; is $_, $obj, '[local] $_ still holds an object reference after the callback'; } is $_, undef, '[local] $_ is undef at the end'; is $LeakDetect::count, 0, "[local] live object count is 0 after all object references are gone"; # with implicit localization of $_ for (LeakDetect->new) { is $LeakDetect::count, 1, "[foreach] live object count is 1 after new()"; my $obj = $_; $] >= 5.008002 or next; $dbh->ping; is $_, $obj, '[foreach] $_ still holds an object reference after the callback'; } is $_, undef, '[foreach] $_ is undef at the end'; is $LeakDetect::count, 0, "[foreach] live object count is 0 after all object references are gone"; done_testing(); __END__ A generic 'transparent' callback looks like this: (this assumes only scalar context will be used) sub { my $h = shift; return if our $avoid_deep_recursion->{"$h $_"}++; my $this = $h->$_(@_); undef $_; # tell DBI not to call original method return $this; # tell DBI to return this instead }; XXX should add a test for this XXX even better would be to run chunks of the test suite with that as a '*' callback. In theory everything should pass (except this test file, naturally).. DBI-1.648/t/03handle.t0000644000031300001440000003520114742423677013436 0ustar00merijnusers#!perl -w $|=1; use strict; use Test::More tests => 137; ## ---------------------------------------------------------------------------- ## 03handle.t - tests handles ## ---------------------------------------------------------------------------- # This set of tests exercises the different handles; Driver, Database and # Statement in various ways, in particular in their interactions with one # another ## ---------------------------------------------------------------------------- BEGIN { use_ok( 'DBI' ); } # installed drivers should start empty my %drivers = DBI->installed_drivers(); is(scalar keys %drivers, 0); ## ---------------------------------------------------------------------------- # get the Driver handle my $driver = "ExampleP"; my $drh = DBI->install_driver($driver); isa_ok( $drh, 'DBI::dr' ); SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 0, '... this Driver does not yet have any Kids'); } # now the driver should be registered %drivers = DBI->installed_drivers(); is(scalar keys %drivers, 1); ok(exists $drivers{ExampleP}); ok($drivers{ExampleP}->isa('DBI::dr')); my $using_dbd_gofer = ($ENV{DBI_AUTOPROXY}||'') =~ /^dbi:Gofer.*transport=/i; ## ---------------------------------------------------------------------------- # do database handle tests inside do BLOCK to capture scope do { my $dbh = DBI->connect("dbi:$driver:", '', ''); isa_ok($dbh, 'DBI::db'); my $drh = $dbh->{Driver}; # (re)get drh here so tests can work using_dbd_gofer SKIP: { skip "Kids and ActiveKids attributes not supported under DBI::PurePerl", 2 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 1, '... our Driver has one Kid'); cmp_ok($drh->{ActiveKids}, '==', 1, '... our Driver has one ActiveKid'); } my $sql = "select name from ?"; my $sth1 = $dbh->prepare_cached($sql); isa_ok($sth1, 'DBI::st'); ok($sth1->execute("."), '... execute ran successfully'); my $ck = $dbh->{CachedKids}; is(ref($ck), "HASH", '... we got the CachedKids hash'); cmp_ok(scalar(keys(%{$ck})), '==', 1, '... there is one CachedKid'); ok(eq_set( [ values %{$ck} ], [ $sth1 ] ), '... our statement handle should be in the CachedKids'); ok($sth1->{Active}, '... our first statement is Active'); { my $warn = 0; # use this to check that we are warned local $SIG{__WARN__} = sub { ++$warn if $_[0] =~ /still active/i }; my $sth2 = $dbh->prepare_cached($sql); isa_ok($sth2, 'DBI::st'); is($sth1, $sth2, '... prepare_cached returned the same statement handle'); cmp_ok($warn,'==', 1, '... we got warned about our first statement handle being still active'); ok(!$sth1->{Active}, '... our first statement is no longer Active since we re-prepared it'); my $sth3 = $dbh->prepare_cached($sql, { foo => 1 }); isa_ok($sth3, 'DBI::st'); isnt($sth1, $sth3, '... prepare_cached returned a different statement handle now'); cmp_ok(scalar(keys(%{$ck})), '==', 2, '... there are two CachedKids'); ok(eq_set( [ values %{$ck} ], [ $sth1, $sth3 ] ), '... both statement handles should be in the CachedKids'); ok($sth1->execute("."), '... executing first statement handle again'); ok($sth1->{Active}, '... first statement handle is now active again'); my $sth4 = $dbh->prepare_cached($sql, undef, 3); isa_ok($sth4, 'DBI::st'); isnt($sth1, $sth4, '... our fourth statement handle is not the same as our first'); ok($sth1->{Active}, '... first statement handle is still active'); cmp_ok(scalar(keys(%{$ck})), '==', 2, '... there are two CachedKids'); ok(eq_set( [ values %{$ck} ], [ $sth2, $sth4 ] ), '... second and fourth statement handles should be in the CachedKids'); $sth1->finish; ok(!$sth1->{Active}, '... first statement handle is no longer active'); ok($sth4->execute("."), '... fourth statement handle executed properly'); ok($sth4->{Active}, '... fourth statement handle is Active'); my $sth5 = $dbh->prepare_cached($sql, undef, 1); isa_ok($sth5, 'DBI::st'); cmp_ok($warn, '==', 1, '... we still only got one warning'); is($sth4, $sth5, '... fourth statement handle and fifth one match'); ok(!$sth4->{Active}, '... fourth statement handle is not Active'); ok(!$sth5->{Active}, '... fifth statement handle is not Active (shouldnt be its the same as fifth)'); cmp_ok(scalar(keys(%{$ck})), '==', 2, '... there are two CachedKids'); ok(eq_set( [ values %{$ck} ], [ $sth2, $sth5 ] ), '... second and fourth/fifth statement handles should be in the CachedKids'); } SKIP: { skip "swap_inner_handle() not supported under DBI::PurePerl", 23 if $DBI::PurePerl; my $sth6 = $dbh->prepare($sql); $sth6->execute("."); my $sth1_driver_name = $sth1->{Database}{Driver}{Name}; ok( $sth6->{Active}, '... sixth statement handle is active'); ok(!$sth1->{Active}, '... first statement handle is not active'); ok($sth1->swap_inner_handle($sth6), '... first statement handle becomes the sixth'); ok(!$sth6->{Active}, '... sixth statement handle is now not active'); ok( $sth1->{Active}, '... first statement handle is now active again'); ok($sth1->swap_inner_handle($sth6), '... first statement handle becomes the sixth'); ok( $sth6->{Active}, '... sixth statement handle is active'); ok(!$sth1->{Active}, '... first statement handle is not active'); ok($sth1->swap_inner_handle($sth6), '... first statement handle becomes the sixth'); ok(!$sth6->{Active}, '... sixth statement handle is now not active'); ok( $sth1->{Active}, '... first statement handle is now active again'); $sth1->{PrintError} = 0; ok(!$sth1->swap_inner_handle($dbh), '... can not swap a sth with a dbh'); cmp_ok( $sth1->errstr, 'eq', "Can't swap_inner_handle between sth and dbh"); ok($sth1->swap_inner_handle($sth6), '... first statement handle becomes the sixth'); ok( $sth6->{Active}, '... sixth statement handle is active'); ok(!$sth1->{Active}, '... first statement handle is not active'); $sth6->finish; ok(my $dbh_nullp = DBI->connect("dbi:NullP:", undef, undef, { go_bypass => 1 })); ok(my $sth7 = $dbh_nullp->prepare("")); $sth1->{PrintError} = 0; ok(!$sth1->swap_inner_handle($sth7), "... can't swap_inner_handle with handle from different parent"); cmp_ok( $sth1->errstr, 'eq', "Can't swap_inner_handle with handle from different parent"); cmp_ok( $sth1->{Database}{Driver}{Name}, 'eq', $sth1_driver_name ); ok( $sth1->swap_inner_handle($sth7,1), "... can swap to different parent if forced"); cmp_ok( $sth1->{Database}{Driver}{Name}, 'eq', "NullP" ); $dbh_nullp->disconnect; } ok( $dbh->ping, 'ping should be true before disconnect'); $dbh->disconnect; $dbh->{PrintError} = 0; # silence 'not connected' warning ok( !$dbh->ping, 'ping should be false after disconnect'); SKIP: { skip "Kids and ActiveKids attributes not supported under DBI::PurePerl", 2 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 1, '... our Driver has one Kid after disconnect'); cmp_ok($drh->{ActiveKids}, '==', 0, '... our Driver has no ActiveKids after disconnect'); } }; if ($using_dbd_gofer) { $drh->{CachedKids} = {}; } # make sure our driver has no more kids after this test # NOTE: # this also assures us that the next test has an empty slate as well SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 0, "... our $drh->{Name} driver should have 0 Kids after dbh was destoryed"); } ## ---------------------------------------------------------------------------- # handle reference leak tests # NOTE: # this test checks for reference leaks by testing the Kids attribute # which is not supported by DBI::PurePerl, so we just do not run this # for DBI::PurePerl all together. Even though some of the tests would # pass, it does not make sense because in the end, what is actually # being tested for will give a false positive sub work { my (%args) = @_; my $dbh = DBI->connect("dbi:$driver:", '', ''); isa_ok( $dbh, 'DBI::db' ); cmp_ok($drh->{Kids}, '==', 1, '... the Driver should have 1 Kid(s) now'); if ( $args{Driver} ) { isa_ok( $dbh->{Driver}, 'DBI::dr' ); } else { pass( "not testing Driver here" ); } my $sth = $dbh->prepare_cached("select name from ?"); isa_ok( $sth, 'DBI::st' ); if ( $args{Database} ) { isa_ok( $sth->{Database}, 'DBI::db' ); } else { pass( "not testing Database here" ); } $dbh->disconnect; # both handles should be freed here } SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 25 if $DBI::PurePerl; skip "drh Kids not testable under DBD::Gofer", 25 if $using_dbd_gofer; foreach my $args ( {}, { Driver => 1 }, { Database => 1 }, { Driver => 1, Database => 1 }, ) { work( %{$args} ); cmp_ok($drh->{Kids}, '==', 0, '... the Driver should have no Kids'); } # make sure we have no kids when we end this cmp_ok($drh->{Kids}, '==', 0, '... the Driver should have no Kids at the end of this test'); } ## ---------------------------------------------------------------------------- # handle take_imp_data test SKIP: { skip "take_imp_data test not supported under DBD::Gofer", 19 if $using_dbd_gofer; my $dbh = DBI->connect("dbi:$driver:", '', ''); isa_ok($dbh, "DBI::db"); my $drh = $dbh->{Driver}; # (re)get drh here so tests can work using_dbd_gofer cmp_ok($drh->{Kids}, '==', 1, '... our Driver should have 1 Kid(s) here') unless $DBI::PurePerl && pass(); $dbh->prepare("select name from ?"); # destroyed at once my $sth2 = $dbh->prepare("select name from ?"); # inactive my $sth3 = $dbh->prepare("select name from ?"); # active: $sth3->execute("."); is $sth3->{Active}, 1; is $dbh->{ActiveKids}, 1 unless $DBI::PurePerl && pass(); my $ChildHandles = $dbh->{ChildHandles}; skip "take_imp_data test needs weakrefs", 15 if not $ChildHandles; ok $ChildHandles, 'we need weakrefs for take_imp_data to work safely with child handles'; is @$ChildHandles, 3, 'should have 3 entries (implementation detail)'; is grep({ defined } @$ChildHandles), 2, 'should have 2 defined handles'; my $imp_data = $dbh->take_imp_data; ok($imp_data, '... we got some imp_data to test'); # generally length($imp_data) = 112 for 32bit, 116 for 64 bit # (as of DBI 1.37) but it can differ on some platforms # depending on structure packing by the compiler # so we just test that it's something reasonable: cmp_ok(length($imp_data), '>=', 80, '... test that our imp_data is greater than or equal to 80, this is reasonable'); cmp_ok($drh->{Kids}, '==', 0, '... our Driver should have 0 Kid(s) after calling take_imp_data'); is ref $sth3, 'DBI::zombie', 'sth should be reblessed'; eval { $sth3->finish }; like $@, qr/Can't locate object method/; { my @warn; local $SIG{__WARN__} = sub { push @warn, $_[0] if $_[0] =~ /after take_imp_data/; print "warn: @_\n"; }; my $drh = $dbh->{Driver}; ok(!defined $drh, '... our Driver should be undefined'); my $trace_level = $dbh->{TraceLevel}; ok(!defined $trace_level, '... our TraceLevel should be undefined'); ok(!defined $dbh->disconnect, '... disconnect should return undef'); ok(!defined $dbh->quote(42), '... quote should return undefined'); cmp_ok(scalar @warn, '==', 4, '... we should have gotten 4 warnings'); } my $dbh2 = DBI->connect("dbi:$driver:", '', '', { dbi_imp_data => $imp_data }); isa_ok($dbh2, "DBI::db"); # need a way to test dbi_imp_data has been used cmp_ok($drh->{Kids}, '==', 1, '... our Driver should have 1 Kid(s) again') unless $DBI::PurePerl && pass(); } # we need this SKIP block on its own since we are testing the # destruction of objects within the scope of the above SKIP # block SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 0, '... our Driver has no Kids after this test'); } ## ---------------------------------------------------------------------------- # NullP statement handle attributes without execute my $driver2 = "NullP"; my $drh2 = DBI->install_driver($driver); isa_ok( $drh2, 'DBI::dr' ); SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh2->{Kids}, '==', 0, '... our Driver (2) has no Kids before this test'); } do { my $dbh = DBI->connect("dbi:$driver2:", '', ''); isa_ok($dbh, "DBI::db"); my $sth = $dbh->prepare("foo bar"); isa_ok($sth, "DBI::st"); cmp_ok($sth->{NUM_OF_PARAMS}, '==', 0, '... NUM_OF_PARAMS is 0'); is($sth->{NUM_OF_FIELDS}, undef, '... NUM_OF_FIELDS should be undef'); is($sth->{Statement}, "foo bar", '... Statement is "foo bar"'); ok(!defined $sth->{NAME}, '... NAME is undefined'); ok(!defined $sth->{TYPE}, '... TYPE is undefined'); ok(!defined $sth->{SCALE}, '... SCALE is undefined'); ok(!defined $sth->{PRECISION}, '... PRECISION is undefined'); ok(!defined $sth->{NULLABLE}, '... NULLABLE is undefined'); ok(!defined $sth->{RowsInCache}, '... RowsInCache is undefined'); ok(!defined $sth->{ParamValues}, '... ParamValues is undefined'); # derived NAME attributes ok(!defined $sth->{NAME_uc}, '... NAME_uc is undefined'); ok(!defined $sth->{NAME_lc}, '... NAME_lc is undefined'); ok(!defined $sth->{NAME_hash}, '... NAME_hash is undefined'); ok(!defined $sth->{NAME_uc_hash}, '... NAME_uc_hash is undefined'); ok(!defined $sth->{NAME_lc_hash}, '... NAME_lc_hash is undefined'); my $dbh_ref = ref($dbh); my $sth_ref = ref($sth); ok($dbh_ref->can("prepare"), '... $dbh can call "prepare"'); ok(!$dbh_ref->can("nonesuch"), '... $dbh cannot call "nonesuch"'); ok($sth_ref->can("execute"), '... $sth can call "execute"'); # what is this test for?? # I don't know why this warning has the "(perhaps ...)" suffix, it shouldn't: # Can't locate object method "nonesuch" via package "DBI::db" (perhaps you forgot to load "DBI::db"?) eval { ref($dbh)->nonesuch; }; $dbh->disconnect; }; SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh2->{Kids}, '==', 0, '... our Driver (2) has no Kids after this test'); } ## ---------------------------------------------------------------------------- 1; DBI-1.648/t/06attrs.t0000644000031300001440000003705414742423677013353 0ustar00merijnusers#!perl -w use strict; use Storable qw(dclone); use Test::More; ## ---------------------------------------------------------------------------- ## 06attrs.t - ... ## ---------------------------------------------------------------------------- # This test checks the parameters and the values associated with them for # the three different handles (Driver, Database, Statement) ## ---------------------------------------------------------------------------- BEGIN { use_ok( 'DBI' ) } $|=1; my $using_autoproxy = ($ENV{DBI_AUTOPROXY}); my $dsn = 'dbi:ExampleP:dummy'; # Connect to the example driver. my $dbh = DBI->connect($dsn, '', '', { PrintError => 0, RaiseError => 1, }); isa_ok( $dbh, 'DBI::db' ); # Clean up when we're done. END { $dbh->disconnect if $dbh }; ## ---------------------------------------------------------------------------- # Check the database handle attributes. # bit flag attr ok( $dbh->{Warn}, '... checking Warn attribute for dbh'); ok( $dbh->{Active}, '... checking Active attribute for dbh'); ok( $dbh->{AutoCommit}, '... checking AutoCommit attribute for dbh'); ok(!$dbh->{CompatMode}, '... checking CompatMode attribute for dbh'); ok(!$dbh->{InactiveDestroy}, '... checking InactiveDestroy attribute for dbh'); ok(!$dbh->{AutoInactiveDestroy}, '... checking AutoInactiveDestroy attribute for dbh'); ok(!$dbh->{PrintError}, '... checking PrintError attribute for dbh'); ok( $dbh->{PrintWarn}, '... checking PrintWarn attribute for dbh'); # true because of perl -w above ok( $dbh->{RaiseError}, '... checking RaiseError attribute for dbh'); ok(!$dbh->{RaiseWarn}, '... checking RaiseWarn attribute for dbh'); ok(!$dbh->{ShowErrorStatement}, '... checking ShowErrorStatement attribute for dbh'); ok(!$dbh->{ChopBlanks}, '... checking ChopBlanks attribute for dbh'); ok(!$dbh->{LongTruncOk}, '... checking LongTrunkOk attribute for dbh'); ok(!$dbh->{TaintIn}, '... checking TaintIn attribute for dbh'); ok(!$dbh->{TaintOut}, '... checking TaintOut attribute for dbh'); ok(!$dbh->{Taint}, '... checking Taint attribute for dbh'); ok(!$dbh->{Executed}, '... checking Executed attribute for dbh'); # other attr cmp_ok($dbh->{ErrCount}, '==', 0, '... checking ErrCount attribute for dbh'); SKIP: { skip "Kids and ActiveKids attribute not supported under DBI::PurePerl", 2 if $DBI::PurePerl; cmp_ok($dbh->{Kids}, '==', 0, '... checking Kids attribute for dbh');; cmp_ok($dbh->{ActiveKids}, '==', 0, '... checking ActiveKids attribute for dbh');; } is($dbh->{CachedKids}, undef, '... checking CachedKids attribute for dbh'); ok(!defined $dbh->{HandleError}, '... checking HandleError attribute for dbh'); ok(!defined $dbh->{Profile}, '... checking Profile attribute for dbh'); ok(!defined $dbh->{Statement}, '... checking Statement attribute for dbh'); ok(!defined $dbh->{RowCacheSize}, '... checking RowCacheSize attribute for dbh'); ok(!defined $dbh->{ReadOnly}, '... checking ReadOnly attribute for dbh'); is($dbh->{FetchHashKeyName}, 'NAME', '... checking FetchHashKeyName attribute for dbh'); is($dbh->{Name}, 'dummy', '... checking Name attribute for dbh') # fails for Multiplex unless $using_autoproxy && ok(1); cmp_ok($dbh->{TraceLevel}, '==', $DBI::dbi_debug & 0xF, '... checking TraceLevel attribute for dbh'); cmp_ok($dbh->{LongReadLen}, '==', 80, '... checking LongReadLen attribute for dbh'); is_deeply [ $dbh->FETCH_many(qw(HandleError FetchHashKeyName LongReadLen ErrCount)) ], [ undef, qw(NAME 80 0) ], 'should be able to FETCH_many'; is $dbh->{examplep_private_dbh_attrib}, 42, 'should see driver-private dbh attribute value'; is delete $dbh->{examplep_private_dbh_attrib}, 42, 'delete on non-private attribute acts like fetch'; is $dbh->{examplep_private_dbh_attrib}, 42, 'value unchanged after delete'; $dbh->{private_foo} = 42; is $dbh->{private_foo}, 42, 'should see private_foo dbh attribute value'; is delete $dbh->{private_foo}, 42, 'delete should return private_foo dbh attribute value'; is $dbh->{private_foo}, undef, 'value of private_foo after delete should be undef'; # Raise an error. eval { $dbh->do('select foo from foo') }; like($@, qr/^DBD::\w+::db do failed: Unknown field names: foo/ , '... catching exception'); ok(defined $dbh->err, '... $dbh->err is undefined'); like($dbh->errstr, qr/^Unknown field names: foo\b/, '... checking $dbh->errstr'); is($dbh->state, 'S1000', '... checking $dbh->state'); ok($dbh->{Executed}, '... checking Executed attribute for dbh'); # even though it failed $dbh->{Executed} = 0; # reset(able) cmp_ok($dbh->{Executed}, '==', 0, '... checking Executed attribute for dbh (after reset)'); cmp_ok($dbh->{ErrCount}, '==', 1, '... checking ErrCount attribute for dbh (after error was generated)'); ## ---------------------------------------------------------------------------- # Test the driver handle attributes. my $drh = $dbh->{Driver}; isa_ok( $drh, 'DBI::dr' ); ok($dbh->err, '... checking $dbh->err'); cmp_ok($drh->{ErrCount}, '==', 0, '... checking ErrCount attribute for drh'); ok( $drh->{Warn}, '... checking Warn attribute for drh'); ok( $drh->{Active}, '... checking Active attribute for drh'); ok( $drh->{AutoCommit}, '... checking AutoCommit attribute for drh'); ok(!$drh->{CompatMode}, '... checking CompatMode attribute for drh'); ok(!$drh->{InactiveDestroy}, '... checking InactiveDestroy attribute for drh'); ok(!$drh->{AutoInactiveDestroy}, '... checking AutoInactiveDestroy attribute for drh'); ok(!$drh->{PrintError}, '... checking PrintError attribute for drh'); ok( $drh->{PrintWarn}, '... checking PrintWarn attribute for drh'); # true because of perl -w above ok(!$drh->{RaiseError}, '... checking RaiseError attribute for drh'); ok(!$dbh->{RaiseWarn}, '... checking RaiseWarn attribute for dbh'); ok(!$drh->{ShowErrorStatement}, '... checking ShowErrorStatement attribute for drh'); ok(!$drh->{ChopBlanks}, '... checking ChopBlanks attribute for drh'); ok(!$drh->{LongTruncOk}, '... checking LongTrunkOk attribute for drh'); ok(!$drh->{TaintIn}, '... checking TaintIn attribute for drh'); ok(!$drh->{TaintOut}, '... checking TaintOut attribute for drh'); ok(!$drh->{Taint}, '... checking Taint attribute for drh'); SKIP: { skip "Executed attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; ok($drh->{Executed}, '... checking Executed attribute for drh') # due to the do() above } SKIP: { skip "Kids and ActiveKids attribute not supported under DBI::PurePerl", 2 if ($DBI::PurePerl or $dbh->{mx_handle_list}); cmp_ok($drh->{Kids}, '==', 1, '... checking Kids attribute for drh'); cmp_ok($drh->{ActiveKids}, '==', 1, '... checking ActiveKids attribute for drh'); } is($drh->{CachedKids}, undef, '... checking CachedKids attribute for drh'); ok(!defined $drh->{HandleError}, '... checking HandleError attribute for drh'); ok(!defined $drh->{Profile}, '... checking Profile attribute for drh'); ok(!defined $drh->{ReadOnly}, '... checking ReadOnly attribute for drh'); cmp_ok($drh->{TraceLevel}, '==', $DBI::dbi_debug & 0xF, '... checking TraceLevel attribute for drh'); cmp_ok($drh->{LongReadLen}, '==', 80, '... checking LongReadLen attribute for drh'); is($drh->{FetchHashKeyName}, 'NAME', '... checking FetchHashKeyName attribute for drh'); is($drh->{Name}, 'ExampleP', '... checking Name attribute for drh') unless $using_autoproxy && ok(1); ## ---------------------------------------------------------------------------- # Test the statement handle attributes. # Create a statement handle. my $sth = $dbh->prepare("select ctime, name from ?"); isa_ok($sth, "DBI::st"); ok(!$sth->{Executed}, '... checking Executed attribute for sth'); ok(!$dbh->{Executed}, '... checking Executed attribute for dbh'); cmp_ok($sth->{ErrCount}, '==', 0, '... checking ErrCount attribute for sth'); # Trigger an exception. eval { $sth->execute("foo") }; # we don't check actual opendir error msg because of locale differences like($@, qr/^DBD::\w+::st execute failed: .*opendir\(foo\): /msi, '... checking exception'); # Test all of the statement handle attributes. like($sth->errstr, qr/opendir\(foo\): /, '... checking $sth->errstr'); is($sth->state, 'S1000', '... checking $sth->state'); ok($sth->{Executed}, '... checking Executed attribute for sth'); # even though it failed ok($dbh->{Executed}, '... checking Exceuted attribute for dbh'); # due to $sth->prepare, even though it failed cmp_ok($sth->{ErrCount}, '==', 1, '... checking ErrCount attribute for sth'); $sth->{ErrCount} = 0; cmp_ok($sth->{ErrCount}, '==', 0, '... checking ErrCount attribute for sth (after reset)'); # booleans ok( $sth->{Warn}, '... checking Warn attribute for sth'); ok(!$sth->{Active}, '... checking Active attribute for sth'); ok(!$sth->{CompatMode}, '... checking CompatMode attribute for sth'); ok(!$sth->{InactiveDestroy}, '... checking InactiveDestroy attribute for sth'); ok(!$sth->{AutoInactiveDestroy}, '... checking AutoInactiveDestroy attribute for sth'); ok(!$sth->{PrintError}, '... checking PrintError attribute for sth'); ok( $sth->{PrintWarn}, '... checking PrintWarn attribute for sth'); ok( $sth->{RaiseError}, '... checking RaiseError attribute for sth'); ok(!$dbh->{RaiseWarn}, '... checking RaiseWarn attribute for dbh'); ok(!$sth->{ShowErrorStatement}, '... checking ShowErrorStatement attribute for sth'); ok(!$sth->{ChopBlanks}, '... checking ChopBlanks attribute for sth'); ok(!$sth->{LongTruncOk}, '... checking LongTrunkOk attribute for sth'); ok(!$sth->{TaintIn}, '... checking TaintIn attribute for sth'); ok(!$sth->{TaintOut}, '... checking TaintOut attribute for sth'); ok(!$sth->{Taint}, '... checking Taint attribute for sth'); # common attr SKIP: { skip "Kids and ActiveKids attribute not supported under DBI::PurePerl", 2 if $DBI::PurePerl; cmp_ok($sth->{Kids}, '==', 0, '... checking Kids attribute for sth'); cmp_ok($sth->{ActiveKids}, '==', 0, '... checking ActiveKids attribute for sth'); } ok(!defined $sth->{CachedKids}, '... checking CachedKids attribute for sth'); ok(!defined $sth->{HandleError}, '... checking HandleError attribute for sth'); ok(!defined $sth->{Profile}, '... checking Profile attribute for sth'); ok(!defined $sth->{ReadOnly}, '... checking ReadOnly attribute for sth'); cmp_ok($sth->{TraceLevel}, '==', $DBI::dbi_debug & 0xF, '... checking TraceLevel attribute for sth'); cmp_ok($sth->{LongReadLen}, '==', 80, '... checking LongReadLen attribute for sth'); is($sth->{FetchHashKeyName}, 'NAME', '... checking FetchHashKeyName attribute for sth'); # sth specific attr ok(!defined $sth->{CursorName}, '... checking CursorName attribute for sth'); cmp_ok($sth->{NUM_OF_FIELDS}, '==', 2, '... checking NUM_OF_FIELDS attribute for sth'); cmp_ok($sth->{NUM_OF_PARAMS}, '==', 1, '... checking NUM_OF_PARAMS attribute for sth'); my $name = $sth->{NAME}; is(ref($name), 'ARRAY', '... checking type of NAME attribute for sth'); cmp_ok(scalar(@{$name}), '==', 2, '... checking number of elements returned'); is_deeply($name, ['ctime', 'name' ], '... checking values returned'); my $name_lc = $sth->{NAME_lc}; is(ref($name_lc), 'ARRAY', '... checking type of NAME_lc attribute for sth'); cmp_ok(scalar(@{$name_lc}), '==', 2, '... checking number of elements returned'); is_deeply($name_lc, ['ctime', 'name' ], '... checking values returned'); my $name_uc = $sth->{NAME_uc}; is(ref($name_uc), 'ARRAY', '... checking type of NAME_uc attribute for sth'); cmp_ok(scalar(@{$name_uc}), '==', 2, '... checking number of elements returned'); is_deeply($name_uc, ['CTIME', 'NAME' ], '... checking values returned'); my $nhash = $sth->{NAME_hash}; is(ref($nhash), 'HASH', '... checking type of NAME_hash attribute for sth'); cmp_ok(scalar(keys(%{$nhash})), '==', 2, '... checking number of keys returned'); cmp_ok($nhash->{ctime}, '==', 0, '... checking values returned'); cmp_ok($nhash->{name}, '==', 1, '... checking values returned'); my $nhash_lc = $sth->{NAME_lc_hash}; is(ref($nhash_lc), 'HASH', '... checking type of NAME_lc_hash attribute for sth'); cmp_ok(scalar(keys(%{$nhash_lc})), '==', 2, '... checking number of keys returned'); cmp_ok($nhash_lc->{ctime}, '==', 0, '... checking values returned'); cmp_ok($nhash_lc->{name}, '==', 1, '... checking values returned'); my $nhash_uc = $sth->{NAME_uc_hash}; is(ref($nhash_uc), 'HASH', '... checking type of NAME_uc_hash attribute for sth'); cmp_ok(scalar(keys(%{$nhash_uc})), '==', 2, '... checking number of keys returned'); cmp_ok($nhash_uc->{CTIME}, '==', 0, '... checking values returned'); cmp_ok($nhash_uc->{NAME}, '==', 1, '... checking values returned'); if ( ! $using_autoproxy and # Older Storable does not work properly with tied handles # Instead of hard-depending on newer Storable, just skip this # particular test outright eval { Storable->VERSION("2.16") } ) { # set ability to set sth attributes that are usually set internally for $a (qw(NAME NAME_lc NAME_uc NAME_hash NAME_lc_hash NAME_uc_hash)) { my $v = $sth->{$a}; ok(eval { $sth->{$a} = dclone($sth->{$a}) }, "Can set sth $a"); is_deeply($sth->{$a}, $v, "Can get set sth $a"); } } my $type = $sth->{TYPE}; is(ref($type), 'ARRAY', '... checking type of TYPE attribute for sth'); cmp_ok(scalar(@{$type}), '==', 2, '... checking number of elements returned'); is_deeply($type, [ 4, 12 ], '... checking values returned'); my $null = $sth->{NULLABLE}; is(ref($null), 'ARRAY', '... checking type of NULLABLE attribute for sth'); cmp_ok(scalar(@{$null}), '==', 2, '... checking number of elements returned'); is_deeply($null, [ 0, 0 ], '... checking values returned'); # Should these work? They don't. my $prec = $sth->{PRECISION}; is(ref($prec), 'ARRAY', '... checking type of PRECISION attribute for sth'); cmp_ok(scalar(@{$prec}), '==', 2, '... checking number of elements returned'); is_deeply($prec, [ 10, 1024 ], '... checking values returned'); my $scale = $sth->{SCALE}; is(ref($scale), 'ARRAY', '... checking type of SCALE attribute for sth'); cmp_ok(scalar(@{$scale}), '==', 2, '... checking number of elements returned'); is_deeply($scale, [ 0, 0 ], '... checking values returned'); my $params = $sth->{ParamValues}; is(ref($params), 'HASH', '... checking type of ParamValues attribute for sth'); is($params->{1}, 'foo', '... checking values returned'); is($sth->{Statement}, "select ctime, name from ?", '... checking Statement attribute for sth'); ok(!defined $sth->{RowsInCache}, '... checking type of RowsInCache attribute for sth'); is $sth->{examplep_private_sth_attrib}, 24, 'should see driver-private sth attribute value'; # $h->{TraceLevel} tests are in t/09trace.t note "Checking inheritance\n"; SKIP: { skip "drh->dbh->sth inheritance test skipped with DBI_AUTOPROXY", 2 if $ENV{DBI_AUTOPROXY}; sub check_inherited { my ($drh, $attr, $value, $skip_sth) = @_; local $drh->{$attr} = $value; local $drh->{PrintError} = 1; my $dbh = $drh->connect("dummy"); is $dbh->{$attr}, $drh->{$attr}, "dbh $attr value should be inherited from drh"; unless ($skip_sth) { my $sth = $dbh->prepare("select name from ."); is $sth->{$attr}, $dbh->{$attr}, "sth $attr value should be inherited from dbh"; } } check_inherited($drh, "ReadOnly", 1, 0); } done_testing(); 1; # end DBI-1.648/t/41prof_dump.t0000644000031300001440000000551314742423677014203 0ustar00merijnusers#!perl -wl # Using -l to ensure ProfileDumper is isolated from changes to $/ and $\ and such $|=1; use strict; # # test script for DBI::ProfileDumper # use DBI; use Config; use Test::More; BEGIN { plan skip_all => 'profiling not supported for DBI::PurePerl' if $DBI::PurePerl; # clock instability on xen systems is a reasonably common cause of failure # http://www.nntp.perl.org/group/perl.cpan.testers/2009/05/msg3828158.html # so we'll skip automated testing on those systems plan skip_all => "skipping profile tests on xen (due to clock instability)" if $Config{osvers} =~ /xen/ # eg 2.6.18-4-xen-amd64 and $ENV{AUTOMATED_TESTING}; plan tests => 15; } BEGIN { use_ok( 'DBI' ); use_ok( 'DBI::ProfileDumper' ); } my $prof_file = "dbi$$.prof"; my $prof_backup = $prof_file . ".prev"; END { 1 while unlink $prof_file; 1 while unlink $prof_backup; } my $dbh = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1, Profile=>"2/DBI::ProfileDumper/File:$prof_file" }); isa_ok( $dbh, 'DBI::db' ); isa_ok( $dbh->{Profile}, "DBI::ProfileDumper" ); isa_ok( $dbh->{Profile}{Data}, 'HASH' ); isa_ok( $dbh->{Profile}{Path}, 'ARRAY' ); # do a little work my $sql = "select mode,size,name from ?"; my $sth = $dbh->prepare($sql); isa_ok( $sth, 'DBI::st' ); $sth->execute("."); # check that flush_to_disk doesn't change Path if Path is undef (it # did before 1.49) { local $dbh->{Profile}->{Path} = undef; $sth->{Profile}->flush_to_disk(); is($dbh->{Profile}->{Path}, undef); } $sth->{Profile}->flush_to_disk(); while ( my $hash = $sth->fetchrow_hashref ) {} # force output undef $sth; $dbh->disconnect; undef $dbh; # wrote the profile to disk? ok( -s $prof_file, 'Profile is on disk and nonzero size' ); # XXX We're breaking encapsulation here open(PROF, $prof_file) or die $!; my @prof = ; close PROF; print @prof; # has a header? like( $prof[0], '/^DBI::ProfileDumper\s+([\d.]+)/', 'Found a version number' ); # version matches VERSION? (DBI::ProfileDumper uses $self->VERSION so # it's a stringified version object that looks like N.N.N) $prof[0] =~ /^DBI::ProfileDumper\s+([\d.]+)/; is( $1, DBI::ProfileDumper->VERSION, "Version numbers match in $prof[0]" ); like( $prof[1], qr{^Path\s+=\s+\[\s+\]}, 'Found the Path'); ok( $prof[2] =~ m{^Program\s+=\s+(\S+)}, 'Found the Program'); # check that expected key is there like(join('', @prof), qr/\+\s+1\s+\Q$sql\E/m); # unlink($prof_file); # now done by 'make clean' # should be able to load DBI::ProfileDumper::Apache outside apache # this also naturally checks for syntax errors etc. SKIP: { skip "developer-only test", 1 unless (-d ".svn" || -d ".git") && -f "MANIFEST.SKIP"; skip "Apache module not installed", 1 unless eval { require Apache }; require_ok('DBI::ProfileDumper::Apache') } 1; DBI-1.648/t/02dbidrv.t0000755000031300001440000001721514742423677013464 0ustar00merijnusers#!perl -w # vim:sw=4:ts=8:et $|=1; use strict; use Test::More tests => 54; ## ---------------------------------------------------------------------------- ## 02dbidrv.t - ... ## ---------------------------------------------------------------------------- # This test creates a Test Driver (DBD::Test) and then exercises it. # NOTE: # There are a number of tests as well that are embedded within the actual # driver code as well ## ---------------------------------------------------------------------------- ## load DBI BEGIN { use_ok('DBI'); } ## DBI::_new_drh had an internal limit on a driver class name and crashed. SKIP: { Test::More::skip "running DBI::PurePerl", 1 if $DBI::PurePerl; eval { DBI::_new_drh('DBD::Test::OverLong' . 'x' x 300, { Name => 'Test', Version => 'Test', _NO_DESTRUCT_WARN => 1}, 42); }; like($@, qr/unknown _mem package/, 'Overlong DBD class name is processed'); } ## ---------------------------------------------------------------------------- ## create a Test Driver (DBD::Test) ## main Test Driver Package { package DBD::Test; use strict; use warnings; my $drh = undef; sub driver { return $drh if $drh; Test::More::pass('... DBD::Test->driver called to getnew Driver handle'); my($class, $attr) = @_; $class = "${class}::dr"; ($drh) = DBI::_new_drh($class, { Name => 'Test', Version => '$Revision: 11.11 $', }, 77 # 'implementors data' ); Test::More::ok($drh, "... new Driver handle ($drh) created successfully"); Test::More::isa_ok($drh, 'DBI::dr'); return $drh; } } ## Test Driver { package DBD::Test::dr; use strict; use warnings; $DBD::Test::dr::imp_data_size = 0; Test::More::cmp_ok($DBD::Test::dr::imp_data_size, '==', 0, '... check DBD::Test::dr::imp_data_size to avoid typo'); sub DESTROY { undef } sub data_sources { my ($h) = @_; Test::More::ok($h, '... Driver object passed to data_sources'); Test::More::isa_ok($h, 'DBI::dr'); Test::More::ok(!tied $h, '... Driver object is not tied'); return ("dbi:Test:foo", "dbi:Test:bar"); } } ## Test db package { package DBD::Test::db; use strict; $DBD::Test::db::imp_data_size = 0; Test::More::cmp_ok($DBD::Test::db::imp_data_size, '==', 0, '... check DBD::Test::db::imp_data_size to avoid typo'); sub do { my $h = shift; Test::More::ok($h, '... Database object passed to do'); Test::More::isa_ok($h, 'DBI::db'); Test::More::ok(!tied $h, '... Database object is not tied'); my $drh_i = $h->{Driver}; Test::More::ok($drh_i, '... got Driver object from Database object with Driver attribute'); Test::More::isa_ok($drh_i, "DBI::dr"); Test::More::ok(!tied %{$drh_i}, '... Driver object is not tied'); my $drh_o = $h->FETCH('Driver'); Test::More::ok($drh_o, '... got Driver object from Database object by FETCH-ing Driver attribute'); Test::More::isa_ok($drh_o, "DBI::dr"); SKIP: { Test::More::skip "running DBI::PurePerl", 1 if $DBI::PurePerl; Test::More::ok(tied %{$drh_o}, '... Driver object is not tied'); } # return this to make our test pass return 1; } sub data_sources { my ($dbh, $attr) = @_; my @ds = $dbh->SUPER::data_sources($attr); Test::More::is_deeply(( \@ds, [ 'dbi:Test:foo', 'dbi:Test:bar' ] ), '... checking fetched datasources from Driver' ); push @ds, "dbi:Test:baz"; return @ds; } sub disconnect { shift->STORE(Active => 0); } } ## ---------------------------------------------------------------------------- ## test the Driver (DBD::Test) $INC{'DBD/Test.pm'} = 'dummy'; # required to fool DBI->install_driver() # Note that install_driver should *not* normally be called directly. # This test does so only because it's a test of install_driver! my $drh = DBI->install_driver('Test'); ok($drh, '... got a Test Driver object back from DBI->install_driver'); isa_ok($drh, 'DBI::dr'); cmp_ok(DBI::_get_imp_data($drh), '==', 77, '... checking the DBI::_get_imp_data function'); my @ds1 = DBI->data_sources("Test"); is_deeply(( [ @ds1 ], [ 'dbi:Test:foo', 'dbi:Test:bar' ] ), '... got correct datasources from DBI->data_sources("Test")' ); SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 0, '... this Driver does not yet have any Kids'); } # create scope to test $dbh DESTROY behaviour do { my $dbh = $drh->connect; ok($dbh, '... got a database handle from calling $drh->connect'); isa_ok($dbh, 'DBI::db'); SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 1, '... this Driver does not yet have any Kids'); } my @ds2 = $dbh->data_sources(); is_deeply(( [ @ds2 ], [ 'dbi:Test:foo', 'dbi:Test:bar', 'dbi:Test:baz' ] ), '... got correct datasources from $dbh->data_sources()' ); ok($dbh->do('dummy'), '... this will trigger more driver internal tests above in DBD::Test::db'); $dbh->disconnect; $drh->set_err("41", "foo 41 drh"); cmp_ok($drh->err, '==', 41, '... checking Driver handle err set with set_err method'); $dbh->set_err("42", "foo 42 dbh"); cmp_ok($dbh->err, '==', 42, '... checking Database handle err set with set_err method'); cmp_ok($drh->err, '==', 41, '... checking Database handle err set with Driver handle set_err method'); }; SKIP: { skip "Kids attribute not supported under DBI::PurePerl", 1 if $DBI::PurePerl; cmp_ok($drh->{Kids}, '==', 0, '... this Driver does not yet have any Kids') or $drh->dump_handle("bad Kids",3); } # copied up to drh from dbh when dbh was DESTROYd cmp_ok($drh->err, '==', 42, '... $dbh->DESTROY should set $drh->err to 42'); $drh->set_err("99", "foo"); cmp_ok($DBI::err, '==', 99, '... checking $DBI::err set with Driver handle set_err method'); is($DBI::errstr, "foo 42 dbh [err was 42 now 99]\nfoo", '... checking $DBI::errstr'); $drh->default_user("",""); # just to reset err etc $drh->set_err(1, "errmsg", "00000"); is($DBI::state, "", '... checking $DBI::state'); $drh->set_err(1, "test error 1"); is($DBI::state, 'S1000', '... checking $DBI::state'); $drh->set_err(2, "test error 2", "IM999"); is($DBI::state, 'IM999', '... checking $DBI::state'); SKIP: { skip "using DBI::PurePerl", 1 if $DBI::PurePerl; eval { $DBI::rows = 1 }; like($@, qr/Can't modify/, '... trying to assign to $DBI::rows should throw an excpetion'); #' } is($drh->{FetchHashKeyName}, 'NAME', '... FetchHashKeyName is NAME'); $drh->{FetchHashKeyName} = 'NAME_lc'; is($drh->{FetchHashKeyName}, 'NAME_lc', '... FetchHashKeyName is now changed to NAME_lc'); ok(!$drh->disconnect_all, '... calling $drh->disconnect_all (not implemented but will fail silently)'); ok defined $drh->dbixs_revision, 'has dbixs_revision'; ok($drh->dbixs_revision =~ m/^\d+$/, 'has integer dbixs_revision'); SKIP: { skip "using DBI::PurePerl", 5 if $DBI::PurePerl; my $can = $drh->can('FETCH'); ok($can, '... $drh can FETCH'); is(ref($can), "CODE", '... and it returned a proper CODE ref'); my $name = $can->($drh, "Name"); ok($name, '... used FETCH returned from can to fetch the Name attribute'); is($name, "Test", '... the Name attribute is equal to Test'); ok(!$drh->can('disconnect_all'), '... '); } 1; DBI-1.648/t/51dbm_file.t0000644000031300001440000001620415206022252013725 0ustar00merijnusers#!perl -w $| = 1; use strict; use warnings; use Cwd (); use File::Copy (); use File::Path; use File::Spec (); use Test::More; my $using_dbd_gofer = ($ENV{DBI_AUTOPROXY} || "") =~ m/^dbi:Gofer.*transport=/i; use DBI; do "./t/lib.pl"; { # test issue reported in RT#99508 my @msg; my $dbh = eval { local $SIG{__WARN__} = sub { push @msg => @_ }; local $SIG{__DIE__} = sub { push @msg => @_ }; DBI->connect ("dbi:DBM:f_dir=./hopefully-doesnt-existst;sql_identifier_case=1;RaiseError=1"); }; is ($dbh, undef, "Connect failed"); like ("@msg", qr{.*hopefully-doesnt-existst.*}, "Cannot open from non-existing directory with attributes in DSN"); @msg = (); $dbh = eval { local $SIG{__WARN__} = sub { push @msg => @_ }; local $SIG{__DIE__} = sub { push @msg => @_ }; DBI->connect ("dbi:DBM:", , undef, undef, { f_dir => "./hopefully-doesnt-existst", sql_identifier_case => 1, RaiseError => 1, }); }; is ($dbh, undef, "Connect failed"); like ("@msg", qr{.*hopefully-doesnt-existst}, "Cannot open from non-existing directory with attributes in HASH"); } my $dir = test_dir (); my $dbh = DBI->connect ("dbi:DBM:", undef, undef, { f_dir => $dir, sql_identifier_case => 1, # SQL_IC_UPPER }); ok ($dbh, "Connect with driver attributes in hash"); ok ($dbh->do ("drop table if exists FRED"), "drop table"); my $dirfext = $^O eq "VMS" ? ".sdbm_dir" : ".dir"; $dbh->do ("create table fred (a integer, b integer)"); ok (-f File::Spec->catfile ($dir, "FRED$dirfext"), "FRED$dirfext exists"); rmtree $dir; mkpath $dir; if ($using_dbd_gofer) { # can't modify attributes when connect through a Gofer instance $dbh->disconnect (); $dbh = DBI->connect ("dbi:DBM:", undef, undef, { f_dir => $dir, sql_identifier_case => 2, # SQL_IC_LOWER }); } else { $dbh->dbm_clear_meta ("fred"); # otherwise the col_names are still known! $dbh->{sql_identifier_case} = 2; # SQL_IC_LOWER } $dbh->do ("create table FRED (a integer, b integer)"); ok (-f File::Spec->catfile ($dir, "fred$dirfext"), "fred$dirfext exists"); my $tblfext; unless ($using_dbd_gofer) { $tblfext = $dbh->{dbm_tables}{fred}{f_ext} || ""; $tblfext =~ s{/r$}{}; ok (-f File::Spec->catfile ($dir, "fred$tblfext"), "fred$tblfext exists"); } ok ($dbh->do ("insert into fRED (a, b) values (1, 2)"), "insert into mixed case table"); # but change fRED to FRED and it works. ok ($dbh->do ("insert into FRED (a, b) values (2, 1)"), "insert into uppercase table"); unless ($using_dbd_gofer) { my $fn_tbl2 = $dbh->{dbm_tables}{fred}{f_fqfn}; $fn_tbl2 =~ s/fred(\.[^.]*)?$/freddy$1/; my @dbfiles = grep { -f $_ } ( $dbh->{dbm_tables}{fred}{f_fqfn}, $dbh->{dbm_tables}{fred}{f_fqln}, $dbh->{dbm_tables}{fred}{f_fqbn} . ".dir" ); foreach my $fn (@dbfiles) { my $tgt_fn = $fn; $tgt_fn =~ s/fred(\.[^.]*)?$/freddy$1/; File::Copy::copy ($fn, $tgt_fn); } $dbh->{dbm_tables}{krueger}{file} = $fn_tbl2; my $r = $dbh->selectall_arrayref ("select * from Krueger"); ok (@$r == 2, "rows found via cloned mixed case table"); ok ($dbh->do ("drop table if exists KRUeGEr"), "drop table"); } my $r = $dbh->selectall_arrayref ("select * from Fred"); ok (@$r == 2, "rows found via mixed case table"); SKIP: { DBD::DBM::Statement->isa ("SQL::Statement") or skip ("quoted identifiers aren't supported by DBI::SQL::Nano", 1); my $abs_tbl = File::Spec->catfile ($dir, "fred"); # work around SQL::Statement bug DBD::DBM::Statement->isa ("SQL::Statement") and SQL::Statement->VERSION () lt "1.32" and $abs_tbl =~ s{\\}{/}g; $r = $dbh->selectall_arrayref (sprintf 'select * from "%s"', $abs_tbl); ok (@$r == 2, "rows found via select via fully qualified path"); } if ($using_dbd_gofer) { ok ($dbh->do ("drop table if exists FRED"), "drop table"); ok (!-f File::Spec->catfile ($dir, "fred$dirfext"), "fred$dirfext removed"); } else { my $tbl_info = {file => "fred$tblfext"}; ok ($dbh->disconnect (), "disconnect"); $dbh = DBI->connect ("dbi:DBM:", undef, undef, { f_dir => $dir, sql_identifier_case => 2, # SQL_IC_LOWER dbm_tables => {fred => $tbl_info}, }); my @tbl; @tbl = $dbh->tables (undef, undef, undef, undef); is (scalar @tbl, 1, "Found 1 tables"); $r = $dbh->selectall_arrayref ("select * from Fred"); ok (@$r == 2, "rows found after reconnect using 'dbm_tables'"); my $deep_dir = File::Spec->catdir ($dir, "deep"); mkpath $deep_dir; $dbh = DBI->connect ("dbi:DBM:", undef, undef, { f_dir => $deep_dir, sql_identifier_case => 2, # SQL_IC_LOWER }); ok ($dbh->do ("create table wilma (a integer, b char (10))"), "Create wilma"); ok ($dbh->do ("insert into wilma values (1, 'Barney')"), "insert Barney"); ok ($dbh->disconnect (), "disconnect"); $dbh = DBI->connect ("dbi:DBM:", undef, undef, { f_dir => $dir, sql_identifier_case => 2, # SQL_IC_LOWER }); # Make sure wilma is not found without f_dir_search @tbl = $dbh->tables (undef, undef, undef, undef); is (scalar @tbl, 1, "Found 1 table"); ok ($dbh->disconnect (), "disconnect"); $dbh = DBI->connect ("dbi:DBM:", undef, undef, { f_dir => $dir, f_dir_search => [ $deep_dir ], sql_identifier_case => 2, # SQL_IC_LOWER }); @tbl = $dbh->tables (undef, undef, undef, undef); is (scalar @tbl, 2, "Found 2 tables"); # f_dir should always appear before f_dir_search like ($tbl[0], qr{(?:^|\.)fred$}i, "Fred first"); like ($tbl[1], qr{(?:^|\.)wilma$}i, "Fred second"); my ($n, $sth); ok ($sth = $dbh->prepare ("select * from fred"), "select from fred"); ok ($sth->execute, "execute fred"); $n = 0; $n++ while $sth->fetch; is ($n, 2, "2 entry in fred"); ok ($sth = $dbh->prepare ("select * from wilma"), "select from wilma"); ok ($sth->execute, "execute wilma"); $n = 0; $n++ while $sth->fetch; is ($n, 1, "1 entry in wilma"); ok ($dbh->do (q/drop table if exists FRED/), "drop table fred"); ok (!-f File::Spec->catfile ($dir, "fred$dirfext"), "fred$dirfext removed"); ok (!-f File::Spec->catfile ($dir, "fred$tblfext"), "fred$tblfext removed"); ok ($dbh->do (q/drop table if exists wilma/), "drop table wilma"); ok (!-f File::Spec->catfile ($deep_dir, "wilma$dirfext"), "wilma$dirfext removed"); ok (!-f File::Spec->catfile ($deep_dir, "wilma$tblfext"), "wilma$tblfext removed"); } unless ($using_dbd_gofer) { ok ($dbh = DBI->connect ("dbi:DBM:", undef, undef, { f_dir => $dir, f_dir_search => [ "t" ], }), "New dbh for CVE"); $dbh->{dbm_tables}{fred}{file} = File::Spec->catdir (Cwd::abs_path ( File::Spec->catdir ($dir, "..")), "fred"); my @msg; eval { local $SIG{__DIE__} = sub { push @msg => @_ }; local $dbh->{PrintError} = 0; $dbh->do ("create table fred (a integer, b integer)"); }; like ("@msg", qr{is unsafe and not allowed}, "unsafe is caught"); } done_testing (); DBI-1.648/t/17handle_error.t0000644000031300001440000001024014656646601014646 0ustar00merijnusers#!perl -w use strict; use warnings; use DBI; use Test::More; my $skip_error; my $skip_warn; my $handled_errstr; sub error_sub { my ($errstr, $dbh, $ret) = @_; $handled_errstr = $errstr; $handled_errstr =~ s/.* set_err (?:failed|warning): //; return $ret unless ($skip_error and $errstr =~ / set_err failed: /) or ($skip_warn and $errstr =~ / set_err warning:/); $dbh->set_err(undef, undef); return 1; } my $dbh = DBI->connect('dbi:ExampleP:.', undef, undef, { PrintError => 0, RaiseError => 0, PrintWarn => 0, RaiseWarn => 0, HandleError => \&error_sub }); sub clear_err { $dbh->set_err(undef, undef); $handled_errstr = undef; } ### ok eval { $dbh->set_err('', 'string 1'); 1 } or diag($@); is $dbh->err, ''; is $dbh->errstr, 'string 1'; is $handled_errstr, undef; clear_err; ok eval { $dbh->set_err(0, 'string 2'); 1 } or diag($@); is $dbh->err, 0; is $dbh->errstr, 'string 2'; is $handled_errstr, undef; clear_err; ok eval { $dbh->set_err(1, 'string 3'); 1 } or diag($@); is $dbh->err, 1; is $dbh->errstr, 'string 3'; is $handled_errstr, 'string 3'; clear_err; ### $dbh->{RaiseError} = 1; ok eval { $dbh->set_err('', 'string 4'); 1 } or diag($@); is $dbh->err, ''; is $dbh->errstr, 'string 4'; is $handled_errstr, undef; clear_err; ok eval { $dbh->set_err(0, 'string 5'); 1 } or diag($@); is $dbh->err, 0; is $dbh->errstr, 'string 5'; is $handled_errstr, undef; clear_err; ok !eval { $dbh->set_err(1, 'string 6'); 1 }; is $dbh->err, 1; is $dbh->errstr, 'string 6'; is $handled_errstr, 'string 6'; clear_err; $dbh->{RaiseError} = 0; ### $dbh->{RaiseWarn} = 1; ok eval { $dbh->set_err('', 'string 7'); 1 } or diag($@); is $dbh->err, ''; is $dbh->errstr, 'string 7'; is $handled_errstr, undef; clear_err; ok !eval { $dbh->set_err(0, 'string 8'); 1 }; is $dbh->err, 0; is $dbh->errstr, 'string 8'; is $handled_errstr, 'string 8'; clear_err; ok eval { $dbh->set_err(1, 'string 9'); 1 } or diag($@); is $dbh->err, 1; is $dbh->errstr, 'string 9'; is $handled_errstr, 'string 9'; clear_err; $dbh->{RaiseWarn} = 0; ### $dbh->{RaiseError} = 1; $dbh->{RaiseWarn} = 1; ok eval { $dbh->set_err('', 'string 10'); 1 } or diag($@); is $dbh->err, ''; is $dbh->errstr, 'string 10'; is $handled_errstr, undef; clear_err; ok !eval { $dbh->set_err(0, 'string 11'); 1 }; is $dbh->err, 0; is $dbh->errstr, 'string 11'; is $handled_errstr, 'string 11'; clear_err; ok !eval { $dbh->set_err(1, 'string 12'); 1 }; is $dbh->err, 1; is $dbh->errstr, 'string 12'; is $handled_errstr, 'string 12'; clear_err; $dbh->{RaiseError} = 0; $dbh->{RaiseWarn} = 0; ### $dbh->{RaiseError} = 1; $skip_error = 1; ok eval { $dbh->set_err('', 'string 13'); 1 } or diag($@); is $dbh->err, ''; is $dbh->errstr, 'string 13'; is $handled_errstr, undef; clear_err; ok eval { $dbh->set_err(0, 'string 14'); 1 } or diag($@); is $dbh->err, 0; is $dbh->errstr, 'string 14'; is $handled_errstr, undef; clear_err; ok eval { $dbh->set_err(1, 'string 15'); 1 } or diag($@); is $dbh->err, undef; is $dbh->errstr, undef; is $handled_errstr, 'string 15'; clear_err; $dbh->{RaiseError} = 0; $skip_error = 0; ### $dbh->{RaiseWarn} = 1; $skip_warn = 1; ok eval { $dbh->set_err('', 'string 16'); 1 } or diag($@); is $dbh->err, ''; is $dbh->errstr, 'string 16'; is $handled_errstr, undef; clear_err; ok eval { $dbh->set_err(0, 'string 17'); 1 } or diag($@); is $dbh->err, undef; is $dbh->errstr, undef; is $handled_errstr, 'string 17'; clear_err; ok eval { $dbh->set_err(1, 'string 18'); 1 } or diag($@); is $dbh->err, 1; is $dbh->errstr, 'string 18'; is $handled_errstr, 'string 18'; clear_err; $dbh->{RaiseWarn} = 0; $skip_error = 0; ### $dbh->{RaiseError} = 1; $dbh->{RaiseWarn} = 1; $skip_error = 1; $skip_warn = 1; ok eval { $dbh->set_err('', 'string 19'); 1 } or diag($@); is $dbh->err, ''; is $dbh->errstr, 'string 19'; is $handled_errstr, undef; clear_err; ok eval { $dbh->set_err(0, 'string 20'); 1 } or diag($@); is $dbh->err, undef; is $dbh->errstr, undef; is $handled_errstr, 'string 20'; clear_err; ok eval { $dbh->set_err(1, 'string 21'); 1 } or diag($@); is $dbh->err, undef; is $dbh->errstr, undef; is $handled_errstr, 'string 21'; clear_err; $dbh->{RaiseError} = 0; $dbh->{RaiseWarn} = 0; $skip_error = 0; ### done_testing; DBI-1.648/t/60preparse.t0000755000031300001440000001067212127465144014025 0ustar00merijnusers#!perl -w use DBI qw(:preparse_flags); $|=1; use Test::More; BEGIN { if ($DBI::PurePerl) { plan skip_all => 'preparse not supported for DBI::PurePerl'; } else { plan tests => 39; } } my $dbh = DBI->connect("dbi:ExampleP:", "", "", { PrintError => 0, }); isa_ok( $dbh, 'DBI::db' ); sub pp { my $dbh = shift; my $rv = $dbh->preparse(@_); return $rv; } # --------------------------------------------------------------------- # # DBIpp_cm_cs /* C style */ # DBIpp_cm_hs /* # */ # DBIpp_cm_dd /* -- */ # DBIpp_cm_br /* {} */ # DBIpp_cm_dw /* '-- ' dash dash whitespace */ # DBIpp_cm_XX /* any of the above */ # DBIpp_ph_qm /* ? */ # DBIpp_ph_cn /* :1 */ # DBIpp_ph_cs /* :name */ # DBIpp_ph_sp /* %s (as return only, not accept) */ # DBIpp_ph_XX /* any of the above */ # DBIpp_st_qq /* '' char escape */ # DBIpp_st_bs /* \ char escape */ # DBIpp_st_XX /* any of the above */ # ===================================================================== # # pp (h input return accept expected) # # ===================================================================== # ## Comments: is( pp($dbh, "a#b\nc", DBIpp_cm_cs, DBIpp_cm_hs), "a/*b*/\nc" ); is( pp($dbh, "a#b\nc", DBIpp_cm_dw, DBIpp_cm_hs), "a-- b\nc" ); is( pp($dbh, "a/*b*/c", DBIpp_cm_hs, DBIpp_cm_cs), "a#b\nc" ); is( pp($dbh, "a{b}c", DBIpp_cm_cs, DBIpp_cm_br), "a/*b*/c" ); is( pp($dbh, "a--b\nc", DBIpp_cm_br, DBIpp_cm_dd), "a{b}\nc" ); is( pp($dbh, "a-- b\n/*c*/d", DBIpp_cm_br, DBIpp_cm_cs|DBIpp_cm_dw), "a{ b}\n{c}d" ); is( pp($dbh, "a/*b*/c#d\ne--f\nh-- i\nj{k}", 0, DBIpp_cm_XX), "a c\ne\nh\nj " ); ## Placeholders: is( pp($dbh, "a = :1", DBIpp_ph_qm, DBIpp_ph_cn), "a = ?" ); is( pp($dbh, "a = :1", DBIpp_ph_sp, DBIpp_ph_cn), "a = %s" ); is( pp($dbh, "a = ?" , DBIpp_ph_cn, DBIpp_ph_qm), "a = :p1" ); is( pp($dbh, "a = ?" , DBIpp_ph_sp, DBIpp_ph_qm), "a = %s" ); is( pp($dbh, "a = :name", DBIpp_ph_qm, DBIpp_ph_cs), "a = ?" ); is( pp($dbh, "a = :name", DBIpp_ph_sp, DBIpp_ph_cs), "a = %s" ); is( pp($dbh, "a = ? b = ? c = ?", DBIpp_ph_cn, DBIpp_ph_XX), "a = :p1 b = :p2 c = :p3" ); ## Placeholders inside comments (should be ignored where comments style is accepted): is( pp( $dbh, "a = ? /*b = :1*/ c = ?", DBIpp_cm_dw|DBIpp_ph_cn, DBIpp_cm_cs|DBIpp_ph_qm), "a = :p1 -- b = :1\n c = :p2" ); ## Placeholders inside single and double quotes (should be ignored): is( pp( $dbh, "a = ? 'b = :1' c = ?", DBIpp_ph_cn, DBIpp_ph_XX), "a = :p1 'b = :1' c = :p2" ); is( pp( $dbh, 'a = ? "b = :1" c = ?', DBIpp_ph_cn, DBIpp_ph_XX), 'a = :p1 "b = :1" c = :p2' ); ## Comments inside single and double quotes (should be ignored): is( pp( $dbh, "a = ? '{b = :1}' c = ?", DBIpp_cm_cs|DBIpp_ph_cn, DBIpp_cm_XX|DBIpp_ph_qm), "a = :p1 '{b = :1}' c = :p2" ); is( pp( $dbh, 'a = ? "/*b = :1*/" c = ?', DBIpp_cm_dw|DBIpp_ph_cn, DBIpp_cm_XX|DBIpp_ph_qm), 'a = :p1 "/*b = :1*/" c = :p2' ); ## Single and double quoted strings starting inside comments (should be ignored): is( pp( $dbh, 'a = ? /*"b = :1 */ c = ?', DBIpp_cm_br|DBIpp_ph_cn, DBIpp_cm_XX|DBIpp_ph_qm), 'a = :p1 {"b = :1 } c = :p2' ); ## Check error conditions are trapped: is( pp($dbh, "a = :value and b = :1", DBIpp_ph_qm, DBIpp_ph_cs|DBIpp_ph_cn), undef ); ok( $DBI::err ); is( $DBI::errstr, "preparse found mixed placeholder styles (:1 / :name)" ); is( pp($dbh, "a = :1 and b = :3", DBIpp_ph_qm, DBIpp_ph_cn), undef ); ok( $DBI::err ); is( $DBI::errstr, "preparse found placeholder :3 out of sequence, expected :2" ); is( pp($dbh, "foo ' comment", 0, 0), "foo ' comment" ); ok( $DBI::err ); is( $DBI::errstr, "preparse found unterminated single-quoted string" ); is( pp($dbh, 'foo " comment', 0, 0), 'foo " comment' ); ok( $DBI::err ); is( $DBI::errstr, "preparse found unterminated double-quoted string" ); is( pp($dbh, 'foo /* comment', DBIpp_cm_XX, DBIpp_cm_XX), 'foo /* comment' ); ok( $DBI::err ); is( $DBI::errstr, "preparse found unterminated bracketed C-style comment" ); is( pp($dbh, 'foo { comment', DBIpp_cm_XX, DBIpp_cm_XX), 'foo { comment' ); ok( $DBI::err ); is( $DBI::errstr, "preparse found unterminated bracketed {...} comment" ); # --------------------------------------------------------------------- # $dbh->disconnect; 1; DBI-1.648/t/19fhtrace.t0000644000031300001440000001470714742423677013636 0ustar00merijnusers#!perl -w # vim:sw=4:ts=8 use strict; use Test::More tests => 27; ## ---------------------------------------------------------------------------- ## 09trace.t ## ---------------------------------------------------------------------------- # ## ---------------------------------------------------------------------------- BEGIN { use_ok( 'DBI' ); } $|=1; our $fancylogfn = "fancylog$$.log"; our $trace_file = "dbitrace$$.log"; # Clean up when we're done. END { 1 while unlink $fancylogfn; 1 while unlink $trace_file; }; package PerlIO::via::TraceDBI; our $logline; sub OPEN { return 1; } sub PUSHED { my ($class,$mode,$fh) = @_; # When writing we buffer the data my $buf = ''; return bless \$buf,$class; } sub FILL { my ($obj,$fh) = @_; return $logline; } sub READLINE { my ($obj,$fh) = @_; return $logline; } sub WRITE { my ($obj,$buf,$fh) = @_; # print "\n*** WRITING $buf\n"; $logline = $buf; return length($buf); } sub FLUSH { my ($obj,$fh) = @_; return 0; } sub CLOSE { # print "\n*** CLOSING!!!\n"; $logline = "**** CERRADO! ***"; return -1; } 1; package PerlIO::via::MyFancyLogLayer; sub OPEN { my ($obj, $path, $mode, $fh) = @_; $$obj = $path; return 1; } sub PUSHED { my ($class,$mode,$fh) = @_; # When writing we buffer the data my $logger; return bless \$logger,$class; } sub WRITE { my ($obj,$buf,$fh) = @_; $$obj->log($buf); return length($buf); } sub FLUSH { my ($obj,$fh) = @_; return 0; } sub CLOSE { my $self = shift; $$self->close(); return 0; } 1; package MyFancyLogger; use Symbol qw(gensym); sub new { my $self = {}; my $fh = gensym(); open $fh, '>', $fancylogfn; $self->{_fh} = $fh; $self->{_buf} = ''; return bless $self, shift; } sub log { my $self = shift; my $fh = $self->{_fh}; $self->{_buf} .= shift; print $fh "At ", scalar localtime(), ':', $self->{_buf}, "\n" and $self->{_buf} = '' if $self->{_buf}=~tr/\n//; } sub close { my $self = shift; return unless exists $self->{_fh}; my $fh = $self->{_fh}; print $fh "At ", scalar localtime(), ':', $self->{_buf}, "\n" and $self->{_buf} = '' if $self->{_buf}; close $fh; delete $self->{_fh}; } 1; package main; ## ---------------------------------------------------------------------------- # Connect to the example driver. my $dbh = DBI->connect('dbi:ExampleP:dummy', '', '', { PrintError => 0, RaiseError => 1, PrintWarn => 0, RaiseWarn => 1, }); isa_ok( $dbh, 'DBI::db' ); # Clean up when we're done. END { $dbh->disconnect if $dbh }; ## ---------------------------------------------------------------------------- # Check the database handle attributes. cmp_ok($dbh->{TraceLevel}, '==', $DBI::dbi_debug & 0xF, '... checking TraceLevel attribute'); 1 while unlink $trace_file; my $tracefd; ## ---------------------------------------------------------------------------- # First use regular filehandle open $tracefd, '>>', $trace_file; my $oldfd = select($tracefd); $| = 1; select $oldfd; ok(-f $trace_file, '... regular fh: trace file successfully created'); $dbh->trace(2, $tracefd); ok( 1, '... regular fh: filehandle successfully set'); # # read current size of file # my $filesz = (stat $tracefd)[7]; $dbh->trace_msg("First logline\n", 1); # # read new file size and verify its different # my $newfsz = (stat $tracefd)[7]; SKIP: { skip 'on VMS autoflush using select does not work', 1 if $^O eq 'VMS'; ok(($filesz != $newfsz), '... regular fh: trace_msg'); } $dbh->trace(undef, "STDOUT"); # close $trace_file ok(-f $trace_file, '... regular fh: file successfully changed'); $filesz = (stat $tracefd)[7]; $dbh->trace_msg("Next logline\n"); # # read new file size and verify its same # $newfsz = (stat $tracefd)[7]; ok(($filesz == $newfsz), '... regular fh: trace_msg after changing trace output'); #1 while unlink $trace_file; $dbh->trace(0); # disable trace { # Open trace to glob. started failing in perl-5.10 my $tf = "foo.log.$$"; 1 while unlink $tf; 1 while unlink "*main::FOO"; 1 while unlink "*main::STDERR"; is (-f $tf, undef, "Tracefile removed"); ok (open (FOO, ">", $tf), "Tracefile FOO opened"); ok (-f $tf, "Tracefile created"); DBI->trace (1, *FOO); is (-f "*main::FOO", undef, "Regression test"); DBI->trace_msg ("foo\n", 1); DBI->trace (0, *STDERR); close FOO; open my $fh, "<", $tf; is ((<$fh>)[-1], "foo\n", "Traced message"); close $fh; is (-f "*main::STDERR", undef, "Regression test"); 1 while unlink $tf; } ## ---------------------------------------------------------------------------- # Then use layered filehandle # open TRACEFD, '+>:via(TraceDBI)', 'layeredtrace.out'; print TRACEFD "*** Test our layer\n"; my $result = ; is $result, "*** Test our layer\n", "... layered fh: file is layered: $result\n"; $dbh->trace(1, \*TRACEFD); ok( 1, '... layered fh: filehandle successfully set'); $dbh->trace_msg("Layered logline\n", 1); $result = ; is $result, "Layered logline\n", "... layered fh: trace_msg: $result\n"; $dbh->trace(1, "STDOUT"); # close $trace_file $result = ; is $result, "Layered logline\n", "... layered fh: close doesn't close: $result\n"; $dbh->trace_msg("Next logline\n", 1); $result = ; is $result, "Layered logline\n", "... layered fh: trace_msg after change trace output: $result\n"; ## ---------------------------------------------------------------------------- # Then use scalar filehandle # my $tracestr; open TRACEFD, '+>:scalar', \$tracestr; print TRACEFD "*** Test our layer\n"; ok 1, "... scalar trace: file is layered: $tracestr\n"; $dbh->trace(1, \*TRACEFD); ok 1, '... scalar trace: filehandle successfully set'; $dbh->trace_msg("Layered logline\n", 1); ok 1, "... scalar trace: $tracestr\n"; $dbh->trace(1, "STDOUT"); # close $trace_file ok 1, "... scalar trace: close doesn't close: $tracestr\n"; $dbh->trace_msg("Next logline\n", 1); ok 1, "... scalar trace: after change trace output: $tracestr\n"; ## ---------------------------------------------------------------------------- # Then use fancy logger # open my $fh, '>:via(MyFancyLogLayer)', MyFancyLogger->new(); $dbh->trace('SQL', $fh); $dbh->trace_msg("Layered logline\n", 1); ok 1, "... logger: trace_msg\n"; $dbh->trace(1, "STDOUT"); # close $trace_file ok 1, "... logger: close doesn't close\n"; $dbh->trace_msg("Next logline\n", 1); ok 1, "... logger: trace_msg after change trace output\n"; close $fh; 1; # end DBI-1.648/t/10examp.t0000644000031300001440000004726114656646601013322 0ustar00merijnusers#!perl -w use lib qw(blib/arch blib/lib); # needed since -T ignores PERL5LIB use DBI qw(:sql_types); use Config; use Cwd; use strict; use Data::Dumper; $^W = 1; $| = 1; require File::Basename; require File::Spec; require VMS::Filespec if $^O eq 'VMS'; use Test::More tests => 242; do { # provide some protection against growth in size of '.' during the test # which was probable cause of this failure # http://www.nntp.perl.org/group/perl.cpan.testers/2009/09/msg5297317.html my $tmpfile = "deleteme_$$"; open my $fh, ">$tmpfile"; close $fh; unlink $tmpfile; }; # "globals" my ($r, $dbh); ok !eval { $dbh = DBI->connect("dbi:NoneSuch:foobar", 1, 1, { RaiseError => 1, AutoCommit => 1 }); }, 'connect should fail'; like($@, qr/install_driver\(NoneSuch\) failed/, '... we should have an exception here'); ok(!$dbh, '... $dbh2 should not be defined'); { my ($error, $tdbh); eval { $tdbh = DBI->connect('dbi:ExampleP:', '', []); } or do { $error= $@ || "Zombie Error"; }; like($error,qr/Usage:/,"connect with unblessed ref password should fail"); ok(!defined($tdbh), '... $dbh should not be defined'); } { package Test::Secret; use overload '""' => sub { return "" }; } { my ($error,$tdbh); eval { $tdbh = DBI->connect('dbi:ExampleP:', '', bless [], "Test::Secret"); } or do { $error= $@ || "Zombie Error"; }; ok(!$error,"connect with blessed ref password should not fail"); ok(defined($tdbh), '... $dbh should be defined'); } $dbh = DBI->connect('dbi:ExampleP:', '', ''); sub check_connect_cached { # connect_cached # ------------------------------------------ # This test checks that connect_cached works # and how it then relates to the CachedKids # attribute for the driver. ok my $dbh_cached_1 = DBI->connect_cached('dbi:ExampleP:', '', '', { TraceLevel=>0, Executed => 0 }); ok my $dbh_cached_2 = DBI->connect_cached('dbi:ExampleP:', '', '', { TraceLevel=>0, Executed => 0 }); is($dbh_cached_1, $dbh_cached_2, '... these 2 handles are cached, so they are the same'); ok my $dbh_cached_3 = DBI->connect_cached('dbi:ExampleP:', '', '', { examplep_foo => 1 }); isnt($dbh_cached_3, $dbh_cached_2, '... this handle was created with different parameters, so it is not the same'); # check that cached_connect applies attributes to handles returned from the cache # (The specific case of Executed is relevant to DBD::Gofer retry-on-error logic) ok $dbh_cached_1->do("select * from ."); # set Executed flag ok $dbh_cached_1->{Executed}, 'Executed should be true'; ok my $dbh_cached_4 = DBI->connect_cached('dbi:ExampleP:', '', '', { TraceLevel=>0, Executed => 0 }); is $dbh_cached_4, $dbh_cached_1, 'should return same handle'; ok !$dbh_cached_4->{Executed}, 'Executed should be false because reset by connect attributes'; my $drh = $dbh->{Driver}; isa_ok($drh, "DBI::dr"); my @cached_kids = values %{$drh->{CachedKids}}; ok(eq_set(\@cached_kids, [ $dbh_cached_1, $dbh_cached_3 ]), '... these are our cached kids'); $drh->{CachedKids} = {}; cmp_ok(scalar(keys %{$drh->{CachedKids}}), '==', 0, '... we have emptied out cache'); } check_connect_cached(); $dbh->{AutoCommit} = 1; $dbh->{PrintError} = 0; ok($dbh->{AutoCommit} == 1); cmp_ok($dbh->{PrintError}, '==', 0, '... PrintError should be 0'); is($dbh->{FetchHashKeyName}, 'NAME', '... FetchHashKey is NAME'); # test access to driver-private attributes like($dbh->{example_driver_path}, qr/DBD\/ExampleP\.pm$/, '... checking the example driver_path'); print "others\n"; eval { $dbh->commit('dummy') }; ok($@ =~ m/DBI commit: invalid number of arguments:/, $@) unless $DBI::PurePerl && ok(1); ok($dbh->ping, "ping should return true"); # --- errors my $cursor_e = $dbh->prepare("select unknown_field_name from ?"); is($cursor_e, undef, "prepare should fail"); ok($dbh->err, "sth->err should be true"); ok($DBI::err, "DBI::err should be true"); cmp_ok($DBI::err, 'eq', $dbh->err , "\$DBI::err should match \$dbh->err"); like($DBI::errstr, qr/Unknown field names: unknown_field_name/, "\$DBI::errstr should contain error string"); cmp_ok($DBI::errstr, 'eq', $dbh->errstr, "\$DBI::errstr should match \$dbh->errstr"); # --- func ok($dbh->errstr eq $dbh->func('errstr')); my $std_sql = "select mode,size,name from ?"; my $csr_a = $dbh->prepare($std_sql); ok(ref $csr_a); ok($csr_a->{NUM_OF_FIELDS} == 3); SKIP: { skip "inner/outer handles not fully supported for DBI::PurePerl", 3 if $DBI::PurePerl; ok(tied %{ $csr_a->{Database} }); # ie is 'outer' handle ok($csr_a->{Database} eq $dbh, "$csr_a->{Database} ne $dbh") unless $dbh->{mx_handle_list} && ok(1); # skip for Multiplex tests ok(tied %{ $csr_a->{Database}->{Driver} }); # ie is 'outer' handle } my $driver_name = $csr_a->{Database}->{Driver}->{Name}; ok($driver_name eq 'ExampleP') unless $ENV{DBI_AUTOPROXY} && ok(1); # --- FetchHashKeyName $dbh->{FetchHashKeyName} = 'NAME_uc'; my $csr_b = $dbh->prepare($std_sql); $csr_b->execute('.'); ok(ref $csr_b); ok($csr_a != $csr_b); ok("@{$csr_b->{NAME_lc}}" eq "mode size name"); # before NAME ok("@{$csr_b->{NAME_uc}}" eq "MODE SIZE NAME"); ok("@{$csr_b->{NAME}}" eq "mode size name"); ok("@{$csr_b->{ $csr_b->{FetchHashKeyName} }}" eq "MODE SIZE NAME"); ok("@{[sort keys %{$csr_b->{NAME_lc_hash}}]}" eq "mode name size"); ok("@{[sort values %{$csr_b->{NAME_lc_hash}}]}" eq "0 1 2"); ok("@{[sort keys %{$csr_b->{NAME_uc_hash}}]}" eq "MODE NAME SIZE"); ok("@{[sort values %{$csr_b->{NAME_uc_hash}}]}" eq "0 1 2"); do "./t/lib.pl"; # get a dir always readable on all platforms #my $dir = getcwd() || cwd(); #$dir = VMS::Filespec::unixify($dir) if $^O eq 'VMS'; # untaint $dir #$dir =~ m/(.*)/; $dir = $1 || die; my $dir = test_dir (); # --- my($col0, $col1, $col2, $col3, $rows); my(@row_a, @row_b); ok($csr_a->bind_columns(undef, \($col0, $col1, $col2)) ); ok($csr_a->execute( $dir ), $DBI::errstr); @row_a = $csr_a->fetchrow_array; ok(@row_a); # check bind_columns is($row_a[0], $col0); is($row_a[1], $col1); is($row_a[2], $col2); ok( ! $csr_a->bind_columns(undef, \($col0, $col1)) ); like $csr_a->errstr, '/bind_columns called with 2 values but 3 are needed/', 'errstr should contain error message'; ok( ! $csr_a->bind_columns(undef, \($col0, $col1, $col2, $col3)) ); like $csr_a->errstr, '/bind_columns called with 4 values but 3 are needed/', 'errstr should contain error message'; ok( $csr_a->bind_col(2, undef, { foo => 42 }) ); ok ! eval { $csr_a->bind_col(0, undef) }; like $@, '/bind_col: column 0 is not a valid column \(1..3\)/', 'errstr should contain error message'; ok ! eval { $csr_a->bind_col(4, undef) }; like $@, '/bind_col: column 4 is not a valid column \(1..3\)/', 'errstr should contain error message'; ok($csr_b->bind_param(1, $dir)); ok($csr_b->execute()); @row_b = @{ $csr_b->fetchrow_arrayref }; ok(@row_b); ok("@row_a" eq "@row_b"); @row_b = $csr_b->fetchrow_array; ok("@row_a" ne "@row_b"); ok($csr_a->finish); ok($csr_b->finish); $csr_a = undef; # force destruction of this cursor now ok(1); print "fetchrow_hashref('NAME_uc')\n"; ok($csr_b->execute()); my $row_b = $csr_b->fetchrow_hashref('NAME_uc'); ok($row_b); ok($row_b->{MODE} == $row_a[0]); ok($row_b->{SIZE} == $row_a[1]); ok($row_b->{NAME} eq $row_a[2]); print "fetchrow_hashref('ParamValues')\n"; ok($csr_b->execute()); ok(!defined eval { $csr_b->fetchrow_hashref('ParamValues') } ); # PurePerl croaks print "FetchHashKeyName\n"; ok($csr_b->execute()); $row_b = $csr_b->fetchrow_hashref(); ok($row_b); ok(keys(%$row_b) == 3); ok($row_b->{MODE} == $row_a[0]); ok($row_b->{SIZE} == $row_a[1]); ok($row_b->{NAME} eq $row_a[2]); print "fetchall_arrayref\n"; ok($csr_b->execute()); $r = $csr_b->fetchall_arrayref; ok($r); ok(@$r); ok($r->[0]->[0] == $row_a[0]); ok($r->[0]->[1] == $row_a[1]); ok($r->[0]->[2] eq $row_a[2]); print "fetchall_arrayref array slice\n"; ok($csr_b->execute()); $r = $csr_b->fetchall_arrayref([2,1]); ok($r && @$r); ok($r->[0]->[1] == $row_a[1]); ok($r->[0]->[0] eq $row_a[2]); print "fetchall_arrayref hash slice\n"; ok($csr_b->execute()); $r = $csr_b->fetchall_arrayref({ SizE=>1, nAMe=>1}); ok($r && @$r); ok($r->[0]->{SizE} == $row_a[1]); ok($r->[0]->{nAMe} eq $row_a[2]); ok ! $csr_b->fetchall_arrayref({ NoneSuch=>1 }); like $DBI::errstr, qr/Invalid column name/; print "fetchall_arrayref renaming hash slice\n"; ok($csr_b->execute()); $r = $csr_b->fetchall_arrayref(\{ 1 => "Koko", 2 => "Nimi"}); ok($r && @$r); ok($r->[0]->{Koko} == $row_a[1]); ok($r->[0]->{Nimi} eq $row_a[2]); ok ! eval { $csr_b->fetchall_arrayref(\{ 9999 => "Koko" }) }; like $@, qr/\Qis not a valid column/; print "fetchall_arrayref empty renaming hash slice\n"; ok($csr_b->execute()); $r = $csr_b->fetchall_arrayref(\{}); ok($r && @$r); ok(keys %{$r->[0]} == 0); ok($csr_b->execute()); ok(!$csr_b->fetchall_arrayref(\[])); like $DBI::errstr, qr/\Qfetchall_arrayref(REF) invalid/; print "fetchall_arrayref hash\n"; ok($csr_b->execute()); $r = $csr_b->fetchall_arrayref({}); ok($r); ok(keys %{$r->[0]} == 3); ok("@{$r->[0]}{qw(MODE SIZE NAME)}" eq "@row_a", "'@{$r->[0]}{qw(MODE SIZE NAME)}' ne '@row_a'"); print "rows()\n"; # assumes previous fetch fetched all rows $rows = $csr_b->rows; ok($rows > 0, "row count $rows"); ok($rows == @$r, "$rows vs ".@$r); ok($rows == $DBI::rows, "$rows vs $DBI::rows"); print "fetchall_arrayref array slice and max rows\n"; ok($csr_b->execute()); $r = $csr_b->fetchall_arrayref([0], 1); ok($r); is_deeply($r, [[$row_a[0]]]); $r = $csr_b->fetchall_arrayref([], 1); is @$r, 1, 'should fetch one row'; $r = $csr_b->fetchall_arrayref([], 99999); ok @$r, 'should fetch all the remaining rows'; $r = $csr_b->fetchall_arrayref([], 99999); is $r, undef, 'should return undef as there are no more rows'; # --- print "selectrow_array\n"; @row_b = $dbh->selectrow_array($std_sql, undef, $dir); ok(@row_b == 3); ok("@row_b" eq "@row_a"); print "selectrow_hashref\n"; $r = $dbh->selectrow_hashref($std_sql, undef, $dir); ok(keys %$r == 3); ok($r->{MODE} eq $row_a[0]); ok($r->{SIZE} eq $row_a[1]); ok($r->{NAME} eq $row_a[2]); print "selectall_arrayref\n"; $r = $dbh->selectall_arrayref($std_sql, undef, $dir); ok($r); ok(@{$r->[0]} == 3); ok("@{$r->[0]}" eq "@row_a"); ok(@$r == $rows); print "selectall_arrayref Slice array slice\n"; $r = $dbh->selectall_arrayref($std_sql, { Slice => [ 2, 0 ] }, $dir); ok($r); ok(@{$r->[0]} == 2); ok("@{$r->[0]}" eq "$row_a[2] $row_a[0]", qq{"@{$r->[0]}" eq "$row_a[2] $row_a[0]"}); ok(@$r == $rows); print "selectall_arrayref Columns array slice\n"; $r = $dbh->selectall_arrayref($std_sql, { Columns => [ 3, 1 ] }, $dir); ok($r); ok(@{$r->[0]} == 2); ok("@{$r->[0]}" eq "$row_a[2] $row_a[0]", qq{"@{$r->[0]}" eq "$row_a[2] $row_a[0]"}); ok(@$r == $rows); print "selectall_arrayref hash slice\n"; $r = $dbh->selectall_arrayref($std_sql, { Columns => { MoDe=>1, NamE=>1 } }, $dir); ok($r); ok(keys %{$r->[0]} == 2); ok(exists $r->[0]{MoDe}); ok(exists $r->[0]{NamE}); ok($r->[0]{MoDe} eq $row_a[0]); ok($r->[0]{NamE} eq $row_a[2]); ok(@$r == $rows); print "selectall_array\n"; $r = [ $dbh->selectall_array($std_sql, undef, $dir) ]; ok($r); ok(@{$r->[0]} == 3); ok("@{$r->[0]}" eq "@row_a"); ok(@$r == $rows); print "selectall_hashref\n"; $r = $dbh->selectall_hashref($std_sql, 'NAME', undef, $dir); ok($r, "selectall_hashref result"); is(ref $r, 'HASH', "selectall_hashref HASH: ".ref $r); is(scalar keys %$r, $rows); is($r->{ $row_a[2] }{SIZE}, $row_a[1], qq{$r->{ $row_a[2] }{SIZE} eq $row_a[1]}); print "selectall_hashref by column number\n"; $r = $dbh->selectall_hashref($std_sql, 3, undef, $dir); ok($r); ok($r->{ $row_a[2] }{SIZE} eq $row_a[1], qq{$r->{ $row_a[2] }{SIZE} eq $row_a[1]}); print "selectcol_arrayref\n"; $r = $dbh->selectcol_arrayref($std_sql, undef, $dir); ok($r); ok(@$r == $rows); ok($r->[0] eq $row_b[0]); print "selectcol_arrayref column slice\n"; $r = $dbh->selectcol_arrayref($std_sql, { Columns => [3,2] }, $dir); ok($r); # warn Dumper([\@row_b, $r]); ok(@$r == $rows * 2); ok($r->[0] eq $row_b[2]); ok($r->[1] eq $row_b[1]); # --- print "others...\n"; my $csr_c; $csr_c = $dbh->prepare("select unknown_field_name1 from ?"); ok(!defined $csr_c); ok($DBI::errstr =~ m/Unknown field names: unknown_field_name1/); print "RaiseError & PrintError & ShowErrorStatement\n"; $dbh->{RaiseError} = 1; ok($dbh->{RaiseError}); $dbh->{ShowErrorStatement} = 1; ok($dbh->{ShowErrorStatement}); my $error_sql = "select unknown_field_name2 from ?"; ok(! eval { $csr_c = $dbh->prepare($error_sql); 1; }); #print "$@\n"; like $@, qr/\Q$error_sql/; # ShowErrorStatement like $@, qr/Unknown field names: unknown_field_name2/; # check attributes are inherited my $se_sth1 = $dbh->prepare("select mode from ?"); ok($se_sth1->{RaiseError}); ok($se_sth1->{ShowErrorStatement}); # check ShowErrorStatement ParamValues are included and sorted $se_sth1->bind_param($_, "val$_") for (1..11); ok( !eval { $se_sth1->execute } ); like $@, qr/\[for Statement "select mode from \?" with ParamValues: 1='val1', 2='val2', 3='val3', 4='val4', 5='val5', 6='val6', 7='val7', 8='val8', 9='val9', 10='val10', 11='val11'\]/; # this test relies on the fact that ShowErrorStatement is set above TODO: { local $TODO = "rt66127 not fixed yet"; eval { local $se_sth1->{PrintError} = 0; $se_sth1->execute(1,2); }; unlike($@, qr/ParamValues:/, 'error string does not contain ParamValues'); is($se_sth1->{ParamValues}, undef, 'ParamValues is empty') or diag(Dumper($se_sth1->{ParamValues})); }; # check that $dbh->{Statement} tracks last _executed_ sth $se_sth1 = $dbh->prepare("select mode from ?"); ok($se_sth1->{Statement} eq "select mode from ?"); ok($dbh->{Statement} eq "select mode from ?") or print "got: $dbh->{Statement}\n"; my $se_sth2 = $dbh->prepare("select name from ?"); ok($se_sth2->{Statement} eq "select name from ?"); ok($dbh->{Statement} eq "select name from ?"); $se_sth1->execute('.'); ok($dbh->{Statement} eq "select mode from ?"); # show error param values ok(! eval { $se_sth1->execute('first','second') }); # too many params ok($@ =~ /\b1='first'/, $@); ok($@ =~ /\b2='second'/, $@); $se_sth1->finish; $se_sth2->finish; $dbh->{RaiseError} = 0; ok(!$dbh->{RaiseError}); $dbh->{ShowErrorStatement} = 0; ok(!$dbh->{ShowErrorStatement}); { my @warn; local($SIG{__WARN__}) = sub { push @warn, @_ }; $dbh->{PrintError} = 1; ok($dbh->{PrintError}); ok(! $dbh->selectall_arrayref("select unknown_field_name3 from ?")); ok("@warn" =~ m/Unknown field names: unknown_field_name3/); $dbh->{PrintError} = 0; ok(!$dbh->{PrintError}); } print "HandleError\n"; my $HandleErrorReturn; my $HandleError = sub { my $msg = sprintf "HandleError: %s [h=%s, rv=%s, #=%d]", $_[0],$_[1],(defined($_[2])?$_[2]:'undef'),scalar(@_); die $msg if $HandleErrorReturn < 0; print "$msg\n"; $_[2] = 42 if $HandleErrorReturn == 2; return $HandleErrorReturn; }; $dbh->{HandleError} = $HandleError; ok($dbh->{HandleError}); ok($dbh->{HandleError} == $HandleError); $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; $error_sql = "select unknown_field_name2 from ?"; print "HandleError -> die\n"; $HandleErrorReturn = -1; ok(! eval { $csr_c = $dbh->prepare($error_sql); 1; }); ok($@ =~ m/^HandleError:/, $@); print "HandleError -> 0 -> RaiseError\n"; $HandleErrorReturn = 0; ok(! eval { $csr_c = $dbh->prepare($error_sql); 1; }); ok($@ =~ m/^DBD::(ExampleP|Multiplex|Gofer)::db prepare failed:/, $@); print "HandleError -> 1 -> return (original)undef\n"; $HandleErrorReturn = 1; $r = eval { $csr_c = $dbh->prepare($error_sql); }; ok(!$@, $@); ok(!defined($r), $r); print "HandleError -> 2 -> return (modified)42\n"; $HandleErrorReturn = 2; $r = eval { $csr_c = $dbh->prepare($error_sql); }; ok(!$@, $@); ok($r==42) unless $dbh->{mx_handle_list} && ok(1); # skip for Multiplex $dbh->{HandleError} = undef; ok(!$dbh->{HandleError}); { # dump_results; my $sth = $dbh->prepare($std_sql); isa_ok($sth, "DBI::st"); if (length(File::Spec->updir)) { ok($sth->execute(File::Spec->updir)); } else { ok($sth->execute('../')); } my $dump_file = "dumpcsr.tst.$$"; SKIP: { skip "# dump_results test skipped: unable to open $dump_file: $!\n", 4 unless open(DUMP_RESULTS, ">$dump_file"); ok($sth->dump_results("10", "\n", ",\t", \*DUMP_RESULTS)); close(DUMP_RESULTS) or warn "close $dump_file: $!"; ok(-s $dump_file > 0); is( unlink( $dump_file ), 1, "Remove $dump_file" ); ok( !-e $dump_file, "Actually gone" ); } } note "table_info\n"; # First generate a list of all subdirectories $dir = File::Basename::dirname( $INC{"DBI.pm"} ); my $dh; ok(opendir($dh, $dir)); my(%dirs, %unexpected, %missing); while (defined(my $file = readdir($dh))) { $dirs{$file} = 1 if -d File::Spec->catdir($dir,$file); } note( "Local $dir subdirs: @{[ keys %dirs ]}" ); closedir($dh); my $sth = $dbh->table_info($dir, undef, "%", "TABLE"); ok($sth); %unexpected = %dirs; %missing = (); while (my $ref = $sth->fetchrow_hashref()) { if (exists($unexpected{$ref->{'TABLE_NAME'}})) { delete $unexpected{$ref->{'TABLE_NAME'}}; } else { $missing{$ref->{'TABLE_NAME'}} = 1; } } ok(keys %unexpected == 0) or diag "Unexpected directories: ", join(",", keys %unexpected), "\n"; ok(keys %missing == 0) or diag "Missing directories: ", join(",", keys %missing), "\n"; note "tables\n"; my @tables_expected = ( q{"schema"."table"}, q{"sch-ema"."table"}, q{"schema"."ta-ble"}, q{"sch ema"."table"}, q{"schema"."ta ble"}, ); my @tables = $dbh->tables(undef, undef, "%", "VIEW"); ok(@tables == @tables_expected, "Table count mismatch".@tables_expected." vs ".@tables); ok($tables[$_] eq $tables_expected[$_], "$tables[$_] ne $tables_expected[$_]") foreach (0..$#tables_expected); for (my $i = 0; $i < 300; $i += 100) { note "Testing the fake directories ($i).\n"; ok($csr_a = $dbh->prepare("SELECT name, mode FROM long_list_$i")); ok($csr_a->execute(), $DBI::errstr); my $ary = $csr_a->fetchall_arrayref; ok(@$ary == $i, @$ary." rows instead of $i"); if ($i) { my @n1 = map { $_->[0] } @$ary; my @n2 = reverse map { "file$_" } 1..$i; ok("@n1" eq "@n2", "'@n1' ne '@n2'"); } else { ok(1); } } SKIP: { skip "test not tested with Multiplex", 1 if $dbh->{mx_handle_list}; note "Testing \$dbh->func().\n"; my %tables; %tables = map { $_ =~ /lib/ ? ($_, 1) : () } $dbh->tables(); my @func_tables = $dbh->func('lib', 'examplep_tables'); foreach my $t (@func_tables) { defined(delete $tables{$t}) or print "Unexpected table: $t\n"; } is(keys(%tables), 0); } { # some tests on special cases for the older tables call # uses DBD::NullP and relies on 2 facts about DBD::NullP: # 1) it has a get_info for for 29 - the quote chr # 2) it has a table_info which returns some types and catalogs my $dbhnp = DBI->connect('dbi:NullP:test'); # this special case should just return a list of table types my @types = $dbhnp->tables('','','','%'); ok(scalar(@types), 'we got some table types'); my $defined = grep {defined($_)} @types; is($defined, scalar(@types), 'all table types are defined'); SKIP: { skip "some table types were not defined", 1 if ($defined != scalar(@types)); my $found_sep = grep {$_ =~ '\.'} @types; is($found_sep, 0, 'no name separators in table types') or diag(Dumper(\@types)); }; # this special case should just return a list of catalogs my @catalogs = $dbhnp->tables('%', '', ''); ok(scalar(@catalogs), 'we got some catalogs'); SKIP: { skip "no catalogs found", 1 if !scalar(@catalogs); my $found_sep = grep {$_ =~ '\.'} @catalogs; is($found_sep, 0, 'no name separators in catalogs') or diag(Dumper(\@catalogs)); }; $dbhnp->disconnect; } $dbh->disconnect; ok(!$dbh->{Active}); ok(!$dbh->ping, "ping should return false after disconnect"); 1; DBI-1.648/t/05concathash.t0000644000031300001440000001251112127465144014305 0ustar00merijnusers# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl CatHash.t' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use strict; use Benchmark qw(:all); use Scalar::Util qw(looks_like_number); no warnings 'uninitialized'; use Test::More tests => 41; BEGIN { use_ok('DBI') }; # null and undefs -- segfaults?; is (DBI::_concat_hash_sorted(undef, "=", ":", 0, undef), undef); is (DBI::_concat_hash_sorted({ }, "=", ":", 0, undef), ""); eval { DBI::_concat_hash_sorted([], "=", ":", 0, undef) }; like ($@ || "", qr/is not a hash reference/); is (DBI::_concat_hash_sorted({ }, undef, ":", 0, undef), ""); is (DBI::_concat_hash_sorted({ }, "=", undef, 0, undef), ""); is (DBI::_concat_hash_sorted({ }, "=", ":", undef, undef),""); # simple cases is (DBI::_concat_hash_sorted({ 1=>"a", 2=>"b" }, "=", ", ", undef, undef), "1='a', 2='b'"); # nul byte in key sep and pair sep # (nul byte in hash not supported) is DBI::_concat_hash_sorted({ 1=>"a", 2=>"b" }, "=\000=", ":\000:", undef, undef), "1=\000='a':\000:2=\000='b'", 'should work with nul bytes in kv_sep and pair_sep'; is DBI::_concat_hash_sorted({ 1=>"a\000a", 2=>"b" }, "=", ":", 1, undef), "1='a.a':2='b'", 'should work with nul bytes in hash value (neat)'; is DBI::_concat_hash_sorted({ 1=>"a\000a", 2=>"b" }, "=", ":", 0, undef), "1='a\000a':2='b'", 'should work with nul bytes in hash value (not neat)'; # Simple stress tests # limit stress when performing automated testing # eg http://www.nntp.perl.org/group/perl.cpan.testers/2009/06/msg4374116.html my $stress = $ENV{AUTOMATED_TESTING} ? 1_000 : 10_000; ok(DBI::_concat_hash_sorted({bob=>'two', fred=>'one' }, "="x$stress, ":", 1, undef)); ok(DBI::_concat_hash_sorted({bob=>'two', fred=>'one' }, "=", ":"x$stress, 1, undef)); ok(DBI::_concat_hash_sorted({map {$_=>undef} (1..1000)}, "="x$stress, ":", 1, undef)); ok(DBI::_concat_hash_sorted({map {$_=>undef} (1..1000)}, "=", ":"x$stress, 1, undef), 'test'); ok(DBI::_concat_hash_sorted({map {$_=>undef} (1..100)}, "="x$stress, ":"x$stress, 1, undef), 'test'); my $simple_hash = { bob=>"there", jack=>12, fred=>"there", norman=>"there", # sam =>undef }; my $simple_numeric = { 1=>"there", 2=>"there", 16 => 'yo', 07 => "buddy", 49 => undef, }; my $simple_mixed = { bob=>"there", jack=>12, fred=>"there", sam =>undef, 1=>"there", 32=>"there", 16 => 'yo', 07 => "buddy", 49 => undef, }; my $simple_float = { 1.12 =>"there", 3.1415926 =>"there", 32=>"there", 1.6 => 'yo', 0.78 => "buddy", 49 => undef, }; #eval { # DBI::_concat_hash_sorted($simple_hash, "=",,":",1,12); #}; ok(1," Unknown sort order"); #like ($@, qr/Unknown sort order/, "Unknown sort order"); ## Loopify and Add Neat my %neats = ( "Neat"=>0, "Not Neat"=> 1 ); my %sort_types = ( guess=>undef, numeric => 1, lexical=> 0 ); my %hashes = ( Numeric=>$simple_numeric, "Simple Hash" => $simple_hash, "Mixed Hash" => $simple_mixed, "Float Hash" => $simple_float ); for my $sort_type (keys %sort_types){ for my $neat (keys %neats) { for my $hash (keys %hashes) { test_concat_hash($hash, $neat, $sort_type); } } } sub test_concat_hash { my ($hash, $neat, $sort_type) = @_; my @args = ($hashes{$hash}, "=", ":",$neats{$neat}, $sort_types{$sort_type}); is ( DBI::_concat_hash_sorted(@args), _concat_hash_sorted(@args), "$hash - $neat $sort_type" ); } if (0) { eval { cmpthese(200_000, { Perl => sub {_concat_hash_sorted($simple_hash, "=", ":",0,undef); }, C=> sub {DBI::_concat_hash_sorted($simple_hash, "=", ":",0,1);} }); print "\n"; cmpthese(200_000, { NotNeat => sub {DBI::_concat_hash_sorted( $simple_hash, "=", ":",1,undef); }, Neat => sub {DBI::_concat_hash_sorted( $simple_hash, "=", ":",0,undef); } }); }; } #CatHash::_concat_hash_values({ }, ":-",,"::",1,1); sub _concat_hash_sorted { my ( $hash_ref, $kv_separator, $pair_separator, $use_neat, $num_sort ) = @_; # $num_sort: 0=lexical, 1=numeric, undef=try to guess return undef unless defined $hash_ref; die "hash is not a hash reference" unless ref $hash_ref eq 'HASH'; my $keys = _get_sorted_hash_keys($hash_ref, $num_sort); my $string = ''; for my $key (@$keys) { $string .= $pair_separator if length $string > 0; my $value = $hash_ref->{$key}; if ($use_neat) { $value = DBI::neat($value, 0); } else { $value = (defined $value) ? "'$value'" : 'undef'; } $string .= $key . $kv_separator . $value; } return $string; } sub _get_sorted_hash_keys { my ($hash_ref, $sort_type) = @_; if (not defined $sort_type) { my $sort_guess = 1; $sort_guess = (not looks_like_number($_)) ? 0 : $sort_guess for keys %$hash_ref; $sort_type = $sort_guess; } my @keys = keys %$hash_ref; no warnings 'numeric'; my @sorted = ($sort_type) ? sort { $a <=> $b or $a cmp $b } @keys : sort @keys; #warn "$sort_type = @sorted\n"; return \@sorted; } 1; DBI-1.648/t/48dbi_dbd_sqlengine.t0000644000031300001440000000540214742423677015630 0ustar00merijnusers#!perl -w $|=1; use strict; use Cwd; use File::Path; use File::Spec; use Test::More; my $using_dbd_gofer = ($ENV{DBI_AUTOPROXY}||"") =~ /^dbi:Gofer.*transport=/i; my $tbl; BEGIN { $tbl = "db_". $$ . "_" }; #END { $tbl and unlink glob "${tbl}*" } use_ok ("DBI"); use_ok ("DBI::DBD::SqlEngine"); use_ok ("DBD::File"); my $sql_statement = DBI::DBD::SqlEngine::Statement->isa('SQL::Statement'); my $dbh = DBI->connect( "DBI:File:", undef, undef, { PrintError => 0, RaiseError => 0, } ); # Can't use DBI::DBD::SqlEngine direct for my $sql ( split "\n", <<"" ) CREATE TABLE foo (id INT, foo TEXT) CREATE TABLE bar (id INT, baz TEXT) INSERT INTO foo VALUES (1, 'Hello world') INSERT INTO bar VALUES (1, 'Bugfixes welcome') INSERT bar VALUES (2, 'Bug reports, too') SELECT foo FROM foo where ID=1 UPDATE bar SET id=5 WHERE baz='Bugfixes welcome' DELETE FROM foo DELETE FROM bar WHERE baz='Bugfixes welcome' { my $sth; $sql =~ s/^\s+//; eval { $sth = $dbh->prepare( $sql ); }; ok( $sth, "prepare '$sql'" ); } for my $line ( split "\n", <<"" ) Junk -- Junk CREATE foo (id INT, foo TEXT) -- missing table INSERT INTO bar (1, 'Bugfixes welcome') -- missing "VALUES" UPDATE bar id=5 WHERE baz="Bugfixes welcome" -- missing "SET" DELETE * FROM foo -- waste between "DELETE" and "FROM" { my $sth; $line =~ s/^\s+//; my ($sql, $test) = ( $line =~ m/^([^-]+)\s+--\s+(.*)$/ ); eval { $sth = $dbh->prepare( $sql ); }; ok( !$sth, "$test: prepare '$sql'" ); } SKIP: { # some SQL::Statement / SQL::Parser related tests skip( "Not running with SQL::Statement", 3 ) unless ($sql_statement); for my $line ( split "\n", <<"" ) Junk -- Junk CREATE TABLE bar (id INT, baz CHARACTER VARYING(255)) -- invalid column type { my $sth; $line =~ s/^\s+//; my ($sql, $test) = ( $line =~ m/^([^-]+)\s+--\s+(.*)$/ ); eval { $sth = $dbh->prepare( $sql ); }; ok( !$sth, "$test: prepare '$sql'" ); } my $dbh2 = DBI->connect( "DBI:File:", undef, undef, { sql_dialect => "ANSI" } ); my $sth; eval { $sth = $dbh2->prepare( "CREATE TABLE foo (id INTEGER PRIMARY KEY, phrase CHARACTER VARYING(40) UNIQUE)" ); }; ok( $sth, "prepared statement using ANSI dialect" ); skip( "Gofer proxy prevents fetching embedded SQL::Parser object", 1 ); my $sql_parser = $dbh2->FETCH("sql_parser_object"); cmp_ok( $sql_parser->dialect(), "eq", "ANSI", "SQL::Parser has 'ANSI' as dialect" ); } SKIP: { skip( 'not running with DBIx::ContextualFetch', 2 ) unless eval { require DBIx::ContextualFetch; 1; }; my $dbh; ok ($dbh = DBI->connect('dbi:File:','','', {RootClass => 'DBIx::ContextualFetch'})); is ref $dbh, 'DBIx::ContextualFetch::db', 'root class is DBIx::ContextualFetch'; } done_testing (); DBI-1.648/t/43prof_env.t0000644000031300001440000000216612127465144014017 0ustar00merijnusers#!perl -w $|=1; use strict; # # test script for using DBI_PROFILE env var to enable DBI::Profile # and testing non-ref assignments to $h->{Profile} # BEGIN { $ENV{DBI_PROFILE} = 6 } # prior to use DBI use DBI; use DBI::Profile; use Config; use Data::Dumper; BEGIN { if ($DBI::PurePerl) { print "1..0 # Skipped: profiling not supported for DBI::PurePerl\n"; exit 0; } } use Test::More tests => 11; DBI->trace(0, "STDOUT"); my $dbh1 = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); is(ref $dbh1->{Profile}, "DBI::Profile"); is(ref $dbh1->{Profile}{Data}, 'HASH'); is(ref $dbh1->{Profile}{Path}, 'ARRAY'); my $dbh2 = DBI->connect("dbi:ExampleP:", '', '', { RaiseError=>1 }); is(ref $dbh2->{Profile}, "DBI::Profile"); is(ref $dbh2->{Profile}{Data}, 'HASH'); is(ref $dbh2->{Profile}{Path}, 'ARRAY'); is $dbh1->{Profile}, $dbh2->{Profile}, '$h->{Profile} should be shared'; $dbh1->do("set dummy=1"); $dbh1->do("set dummy=2"); my $profile = $dbh1->{Profile}; my $p_data = $profile->{Data}; is keys %$p_data, 3; # '', $sql1, $sql2 ok $p_data->{''}; ok $p_data->{"set dummy=1"}; ok $p_data->{"set dummy=2"}; __END__ DBI-1.648/t/lib.pl0000644000031300001440000000150014656646601012747 0ustar00merijnusers#!/usr/bin/perl # lib.pl is the file where database specific things should live, # wherever possible. For example, you define certain constants # here and the like. use strict; use File::Basename; use File::Path; use File::Spec; my $test_dir; END { defined( $test_dir ) and rmtree $test_dir } sub test_dir { unless( defined( $test_dir ) ) { $test_dir = File::Spec->rel2abs( File::Spec->curdir () ); $test_dir = File::Spec->catdir ( $test_dir, "test_output_" . $$ ); $test_dir = VMS::Filespec::unixify($test_dir) if $^O eq 'VMS'; rmtree $test_dir if -d $test_dir; mkpath $test_dir; # There must be at least one directory in the test directory, # and nothing guarantees that dot or dot-dot directories will exist. mkpath ( File::Spec->catdir( $test_dir, '000_just_testing' ) ); } return $test_dir; } 1; DBI-1.648/dbixs_rev.h0000644000031300001440000000015715210302604013521 0ustar00merijnusers/* Thu Jun 4 16:02:44 2026 */ #define DBIXS_RELEASE 1 #define DBIXS_VERSION 648 #define DBIXS_REVISION 1746 DBI-1.648/lib/0000755000031300001440000000000015210302710012124 5ustar00merijnusersDBI-1.648/lib/DBD/0000755000031300001440000000000015210302710012515 5ustar00merijnusersDBI-1.648/lib/DBD/Gofer.pm0000644000031300001440000013771414742423677014163 0ustar00merijnusers{ package DBD::Gofer; use strict; use warnings; require DBI; require DBI::Gofer::Request; require DBI::Gofer::Response; require Carp; our $VERSION = "0.015327"; # $Id: Gofer.pm 15326 2012-06-06 16:32:38Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. # attributes we'll allow local STORE our %xxh_local_store_attrib = map { $_=>1 } qw( Active CachedKids Callbacks DbTypeSubclass ErrCount Executed FetchHashKeyName HandleError HandleSetErr InactiveDestroy AutoInactiveDestroy PrintError PrintWarn Profile RaiseError RaiseWarn RootClass ShowErrorStatement Taint TaintIn TaintOut TraceLevel Warn dbi_quote_identifier_cache dbi_connect_closure dbi_go_execute_unique ); our %xxh_local_store_attrib_if_same_value = map { $_=>1 } qw( Username dbi_connect_method ); our $drh = undef; # holds driver handle once initialized our $methods_already_installed; sub driver{ return $drh if $drh; DBI->setup_driver('DBD::Gofer'); unless ($methods_already_installed++) { my $opts = { O=> 0x0004 }; # IMA_KEEP_ERR DBD::Gofer::db->install_method('go_dbh_method', $opts); DBD::Gofer::st->install_method('go_sth_method', $opts); DBD::Gofer::st->install_method('go_clone_sth', $opts); DBD::Gofer::db->install_method('go_cache', $opts); DBD::Gofer::st->install_method('go_cache', $opts); } my($class, $attr) = @_; $class .= "::dr"; ($drh) = DBI::_new_drh($class, { 'Name' => 'Gofer', 'Version' => $VERSION, 'Attribution' => 'DBD Gofer by Tim Bunce', }); $drh; } sub CLONE { undef $drh; } sub go_cache { my $h = shift; $h->{go_cache} = shift if @_; # return handle's override go_cache, if it has one return $h->{go_cache} if defined $h->{go_cache}; # or else the transports default go_cache return $h->{go_transport}->{go_cache}; } sub set_err_from_response { # set error/warn/info and propagate warnings my $h = shift; my $response = shift; if (my $warnings = $response->warnings) { warn $_ for @$warnings; } my ($err, $errstr, $state) = $response->err_errstr_state; # Only set_err() if there's an error else leave the current values # (The current values will normally be set undef by the DBI dispatcher # except for methods marked KEEPERR such as ping.) $h->set_err($err, $errstr, $state) if defined $err; return undef; } sub install_methods_proxy { my ($installed_methods) = @_; while ( my ($full_method, $attr) = each %$installed_methods ) { # need to install both a DBI dispatch stub and a proxy stub # (the dispatch stub may be already here due to local driver use) DBI->_install_method($full_method, "", $attr||{}) unless defined &{$full_method}; # now install proxy stubs on the driver side $full_method =~ m/^DBI::(\w\w)::(\w+)$/ or die "Invalid method name '$full_method' for install_method"; my ($type, $method) = ($1, $2); my $driver_method = "DBD::Gofer::${type}::${method}"; next if defined &{$driver_method}; my $sub; if ($type eq 'db') { $sub = sub { return shift->go_dbh_method(undef, $method, @_) }; } else { $sub = sub { shift->set_err($DBI::stderr, "Can't call \$${type}h->$method when using DBD::Gofer"); return; }; } no strict 'refs'; *$driver_method = $sub; } } } { package DBD::Gofer::dr; # ====== DRIVER ====== $imp_data_size = 0; use strict; sub connect_cached { my ($drh, $dsn, $user, $auth, $attr)= @_; $attr ||= {}; return $drh->SUPER::connect_cached($dsn, $user, $auth, { (%$attr), go_connect_method => $attr->{go_connect_method} || 'connect_cached', }); } sub connect { my($drh, $dsn, $user, $auth, $attr)= @_; my $orig_dsn = $dsn; # first remove dsn= and everything after it my $remote_dsn = ($dsn =~ s/;?\bdsn=(.*)$// && $1) or return $drh->set_err($DBI::stderr, "No dsn= argument in '$orig_dsn'"); if ($attr->{go_bypass}) { # don't use DBD::Gofer for this connection # useful for testing with DBI_AUTOPROXY, e.g., t/03handle.t return DBI->connect($remote_dsn, $user, $auth, $attr); } my %go_attr; # extract any go_ attributes from the connect() attr arg for my $k (grep { /^go_/ } keys %$attr) { $go_attr{$k} = delete $attr->{$k}; } # then override those with any attributes embedded in our dsn (not remote_dsn) for my $kv (grep /=/, split /;/, $dsn, -1) { my ($k, $v) = split /=/, $kv, 2; $go_attr{ "go_$k" } = $v; } if (not ref $go_attr{go_policy}) { # if not a policy object already my $policy_class = $go_attr{go_policy} || 'classic'; $policy_class = "DBD::Gofer::Policy::$policy_class" unless $policy_class =~ /::/; _load_class($policy_class) or return $drh->set_err($DBI::stderr, "Can't load $policy_class: $@"); # replace policy name in %go_attr with policy object $go_attr{go_policy} = eval { $policy_class->new(\%go_attr) } or return $drh->set_err($DBI::stderr, "Can't instanciate $policy_class: $@"); } # policy object is left in $go_attr{go_policy} so transport can see it my $go_policy = $go_attr{go_policy}; if ($go_attr{go_cache} and not ref $go_attr{go_cache}) { # if not a cache object already my $cache_class = $go_attr{go_cache}; $cache_class = "DBI::Util::CacheMemory" if $cache_class eq '1'; _load_class($cache_class) or return $drh->set_err($DBI::stderr, "Can't load $cache_class $@"); $go_attr{go_cache} = eval { $cache_class->new() } or $drh->set_err(0, "Can't instanciate $cache_class: $@"); # warning } # delete any other attributes that don't apply to transport my $go_connect_method = delete $go_attr{go_connect_method}; my $transport_class = delete $go_attr{go_transport} or return $drh->set_err($DBI::stderr, "No transport= argument in '$orig_dsn'"); $transport_class = "DBD::Gofer::Transport::$transport_class" unless $transport_class =~ /::/; _load_class($transport_class) or return $drh->set_err($DBI::stderr, "Can't load $transport_class: $@"); my $go_transport = eval { $transport_class->new(\%go_attr) } or return $drh->set_err($DBI::stderr, "Can't instanciate $transport_class: $@"); my $request_class = "DBI::Gofer::Request"; my $go_request = eval { my $go_attr = { %$attr }; # XXX user/pass of fwd server vs db server ? also impact of autoproxy if ($user) { $go_attr->{Username} = $user; $go_attr->{Password} = $auth; } # delete any attributes we can't serialize (or don't want to) delete @{$go_attr}{qw(Profile HandleError HandleSetErr Callbacks)}; # delete any attributes that should only apply to the client-side delete @{$go_attr}{qw(RootClass DbTypeSubclass)}; $go_connect_method ||= $go_policy->connect_method($remote_dsn, $go_attr) || 'connect'; $request_class->new({ dbh_connect_call => [ $go_connect_method, $remote_dsn, $user, $auth, $go_attr ], }) } or return $drh->set_err($DBI::stderr, "Can't instanciate $request_class: $@"); my ($dbh, $dbh_inner) = DBI::_new_dbh($drh, { 'Name' => $dsn, 'USER' => $user, go_transport => $go_transport, go_request => $go_request, go_policy => $go_policy, }); # mark as inactive temporarily for STORE. Active not set until connected() called. $dbh->STORE(Active => 0); # should we ping to check the connection # and fetch dbh attributes my $skip_connect_check = $go_policy->skip_connect_check($attr, $dbh); if (not $skip_connect_check) { if (not $dbh->go_dbh_method(undef, 'ping')) { return undef if $dbh->err; # error already recorded, typically return $dbh->set_err($DBI::stderr, "ping failed"); } } return $dbh; } sub _load_class { # return true or false+$@ my $class = shift; (my $pm = $class) =~ s{::}{/}g; $pm .= ".pm"; return 1 if eval { require $pm }; delete $INC{$pm}; # shouldn't be needed (perl bug?) and assigning undef isn't enough undef; # error in $@ } } { package DBD::Gofer::db; # ====== DATABASE ====== $imp_data_size = 0; use strict; use Carp qw(carp croak); my %dbh_local_store_attrib = %DBD::Gofer::xxh_local_store_attrib; sub connected { shift->STORE(Active => 1); } sub go_dbh_method { my $dbh = shift; my $meta = shift; # @_ now contains ($method_name, @args) my $request = $dbh->{go_request}; $request->init_request([ wantarray, @_ ], $dbh); ++$dbh->{go_request_count}; my $go_policy = $dbh->{go_policy}; my $dbh_attribute_update = $go_policy->dbh_attribute_update(); $request->dbh_attributes( $go_policy->dbh_attribute_list() ) if $dbh_attribute_update eq 'every' or $dbh->{go_request_count}==1; $request->dbh_last_insert_id_args($meta->{go_last_insert_id_args}) if $meta->{go_last_insert_id_args}; my $transport = $dbh->{go_transport} or return $dbh->set_err($DBI::stderr, "Not connected (no transport)"); local $transport->{go_cache} = $dbh->{go_cache} if defined $dbh->{go_cache}; my ($response, $retransmit_sub) = $transport->transmit_request($request); $response ||= $transport->receive_response($request, $retransmit_sub); $dbh->{go_response} = $response or die "No response object returned by $transport"; die "response '$response' returned by $transport is not a response object" unless UNIVERSAL::isa($response,"DBI::Gofer::Response"); if (my $dbh_attributes = $response->dbh_attributes) { # XXX installed_methods piggybacks on dbh_attributes for now if (my $installed_methods = delete $dbh_attributes->{dbi_installed_methods}) { DBD::Gofer::install_methods_proxy($installed_methods) if $dbh->{go_request_count}==1; } # XXX we don't STORE here, we just stuff the value into the attribute cache $dbh->{$_} = $dbh_attributes->{$_} for keys %$dbh_attributes; } my $rv = $response->rv; if (my $resultset_list = $response->sth_resultsets) { # dbh method call returned one or more resultsets # (was probably a metadata method like table_info) # # setup an sth but don't execute/forward it my $sth = $dbh->prepare(undef, { go_skip_prepare_check => 1 }); # set the sth response to our dbh response (tied %$sth)->{go_response} = $response; # setup the sth with the results in our response $sth->more_results; # and return that new sth as if it came from original request $rv = [ $sth ]; } elsif (!$rv) { # should only occur for major transport-level error #carp("no rv in response { @{[ %$response ]} }"); $rv = [ ]; } DBD::Gofer::set_err_from_response($dbh, $response); return (wantarray) ? @$rv : $rv->[0]; } # Methods that should be forwarded but can be cached for my $method (qw( tables table_info column_info primary_key_info foreign_key_info statistics_info data_sources type_info_all get_info parse_trace_flags parse_trace_flag func )) { my $policy_name = "cache_$method"; my $super_name = "SUPER::$method"; my $sub = sub { my $dbh = shift; my $rv; # if we know the remote side doesn't override the DBI's default method # then we might as well just call the DBI's default method on the client # (which may, in turn, call other methods that are forwarded, like get_info) if ($dbh->{dbi_default_methods}{$method} && $dbh->{go_policy}->skip_default_methods()) { $dbh->trace_msg(" !! $method: using local default as remote method is also default\n"); return $dbh->$super_name(@_); } my $cache; my $cache_key; if (my $cache_it = $dbh->{go_policy}->$policy_name(undef, $dbh, @_)) { $cache = $dbh->{go_meta_cache} ||= {}; # keep separate from go_cache $cache_key = sprintf "%s_wa%d(%s)", $policy_name, wantarray||0, join(",\t", map { # XXX basic but sufficient for now !ref($_) ? DBI::neat($_,1e6) : ref($_) eq 'ARRAY' ? DBI::neat_list($_,1e6,",\001") : ref($_) eq 'HASH' ? do { my @k = sort keys %$_; DBI::neat_list([@k,@{$_}{@k}],1e6,",\002") } : do { warn "unhandled argument type ($_)"; $_ } } @_); if ($rv = $cache->{$cache_key}) { $dbh->trace_msg("$method(@_) returning previously cached value ($cache_key)\n",4); my @cache_rv = @$rv; # if it's an sth we have to clone it $cache_rv[0] = $cache_rv[0]->go_clone_sth if UNIVERSAL::isa($cache_rv[0],'DBI::st'); return (wantarray) ? @cache_rv : $cache_rv[0]; } } $rv = [ (wantarray) ? ($dbh->go_dbh_method(undef, $method, @_)) : scalar $dbh->go_dbh_method(undef, $method, @_) ]; if ($cache) { $dbh->trace_msg("$method(@_) caching return value ($cache_key)\n",4); my @cache_rv = @$rv; # if it's an sth we have to clone it #$cache_rv[0] = $cache_rv[0]->go_clone_sth # if UNIVERSAL::isa($cache_rv[0],'DBI::st'); $cache->{$cache_key} = \@cache_rv unless UNIVERSAL::isa($cache_rv[0],'DBI::st'); # XXX cloning sth not yet done } return (wantarray) ? @$rv : $rv->[0]; }; no strict 'refs'; *$method = $sub; } # Methods that can use the DBI defaults for some situations/drivers for my $method (qw( quote quote_identifier )) { # XXX keep DBD::Gofer::Policy::Base in sync my $policy_name = "locally_$method"; my $super_name = "SUPER::$method"; my $sub = sub { my $dbh = shift; # if we know the remote side doesn't override the DBI's default method # then we might as well just call the DBI's default method on the client # (which may, in turn, call other methods that are forwarded, like get_info) if ($dbh->{dbi_default_methods}{$method} && $dbh->{go_policy}->skip_default_methods()) { $dbh->trace_msg(" !! $method: using local default as remote method is also default\n"); return $dbh->$super_name(@_); } # false: use remote gofer # 1: use local DBI default method # code ref: use the code ref my $locally = $dbh->{go_policy}->$policy_name($dbh, @_); if ($locally) { return $locally->($dbh, @_) if ref $locally eq 'CODE'; return $dbh->$super_name(@_); } return $dbh->go_dbh_method(undef, $method, @_); # propagate context }; no strict 'refs'; *$method = $sub; } # Methods that should always fail for my $method (qw( begin_work commit rollback )) { no strict 'refs'; *$method = sub { return shift->set_err($DBI::stderr, "$method not available with DBD::Gofer") } } sub do { my ($dbh, $sql, $attr, @args) = @_; delete $dbh->{Statement}; # avoid "Modification of non-creatable hash value attempted" $dbh->{Statement} = $sql; # for profiling and ShowErrorStatement my $meta = { go_last_insert_id_args => $attr->{go_last_insert_id_args} }; return $dbh->go_dbh_method($meta, 'do', $sql, $attr, @args); } sub ping { my $dbh = shift; return $dbh->set_err('', "can't ping while not connected") # info unless $dbh->SUPER::FETCH('Active'); my $skip_ping = $dbh->{go_policy}->skip_ping(); return ($skip_ping) ? 1 : $dbh->go_dbh_method(undef, 'ping', @_); } sub last_insert_id { my $dbh = shift; my $response = $dbh->{go_response} or return undef; return $response->last_insert_id; } sub FETCH { my ($dbh, $attrib) = @_; # FETCH is effectively already cached because the DBI checks the # attribute cache in the handle before calling FETCH # and this FETCH copies the value into the attribute cache # forward driver-private attributes (except ours) if ($attrib =~ m/^[a-z]/ && $attrib !~ /^go_/) { my $value = $dbh->go_dbh_method(undef, 'FETCH', $attrib); $dbh->{$attrib} = $value; # XXX forces caching by DBI return $dbh->{$attrib} = $value; } # else pass up to DBI to handle return $dbh->SUPER::FETCH($attrib); } sub STORE { my ($dbh, $attrib, $value) = @_; if ($attrib eq 'AutoCommit') { croak "Can't enable transactions when using DBD::Gofer" if !$value; return $dbh->SUPER::STORE($attrib => ($value) ? -901 : -900); } return $dbh->SUPER::STORE($attrib => $value) # we handle this attribute locally if $dbh_local_store_attrib{$attrib} # or it's a private_ (application) attribute or $attrib =~ /^private_/ # or not yet connected (ie being called by DBI->connect) or not $dbh->FETCH('Active'); return $dbh->SUPER::STORE($attrib => $value) if $DBD::Gofer::xxh_local_store_attrib_if_same_value{$attrib} && do { # values are the same my $crnt = $dbh->FETCH($attrib); no warnings; (defined($value) ^ defined($crnt)) ? 0 # definedness differs : $value eq $crnt; }; # dbh attributes are set at connect-time - see connect() carp("Can't alter \$dbh->{$attrib} after handle created with DBD::Gofer") if $dbh->FETCH('Warn'); return $dbh->set_err($DBI::stderr, "Can't alter \$dbh->{$attrib} after handle created with DBD::Gofer"); } sub disconnect { my $dbh = shift; $dbh->{go_transport} = undef; $dbh->STORE(Active => 0); } sub prepare { my ($dbh, $statement, $attr)= @_; return $dbh->set_err($DBI::stderr, "Can't prepare when disconnected") unless $dbh->FETCH('Active'); $attr = { %$attr } if $attr; # copy so we can edit my $policy = delete($attr->{go_policy}) || $dbh->{go_policy}; my $lii_args = delete $attr->{go_last_insert_id_args}; my $go_prepare = delete($attr->{go_prepare_method}) || $dbh->{go_prepare_method} || $policy->prepare_method($dbh, $statement, $attr) || 'prepare'; # e.g. for code not using placeholders my $go_cache = delete $attr->{go_cache}; # set to undef if there are no attributes left for the actual prepare call $attr = undef if $attr and not %$attr; my ($sth, $sth_inner) = DBI::_new_sth($dbh, { Statement => $statement, go_prepare_call => [ 0, $go_prepare, $statement, $attr ], # go_method_calls => [], # autovivs if needed go_request => $dbh->{go_request}, go_transport => $dbh->{go_transport}, go_policy => $policy, go_last_insert_id_args => $lii_args, go_cache => $go_cache, }); $sth->STORE(Active => 0); # XXX needed? It should be the default my $skip_prepare_check = $policy->skip_prepare_check($attr, $dbh, $statement, $attr, $sth); if (not $skip_prepare_check) { $sth->go_sth_method() or return undef; } return $sth; } sub prepare_cached { my ($dbh, $sql, $attr, $if_active)= @_; $attr ||= {}; return $dbh->SUPER::prepare_cached($sql, { %$attr, go_prepare_method => $attr->{go_prepare_method} || 'prepare_cached', }, $if_active); } *go_cache = \&DBD::Gofer::go_cache; } { package DBD::Gofer::st; # ====== STATEMENT ====== $imp_data_size = 0; use strict; my %sth_local_store_attrib = (%DBD::Gofer::xxh_local_store_attrib, NUM_OF_FIELDS => 1); sub go_sth_method { my ($sth, $meta) = @_; if (my $ParamValues = $sth->{ParamValues}) { my $ParamAttr = $sth->{ParamAttr}; # XXX the sort here is a hack to work around a DBD::Sybase bug # but only works properly for params 1..9 # (reverse because of the unshift) my @params = reverse sort keys %$ParamValues; if (@params > 9 && ($sth->{Database}{go_dsn}||'') =~ /dbi:Sybase/) { # if more than 9 then we need to do a proper numeric sort # also warn to alert user of this issue warn "Sybase param binding order hack in use"; @params = sort { $b <=> $a } @params; } for my $p (@params) { # unshift to put binds before execute call unshift @{ $sth->{go_method_calls} }, [ 'bind_param', $p, $ParamValues->{$p}, $ParamAttr->{$p} ]; } } my $dbh = $sth->{Database} or die "panic"; ++$dbh->{go_request_count}; my $request = $sth->{go_request}; $request->init_request($sth->{go_prepare_call}, $sth); $request->sth_method_calls(delete $sth->{go_method_calls}) if $sth->{go_method_calls}; $request->sth_result_attr({}); # (currently) also indicates this is an sth request $request->dbh_last_insert_id_args($meta->{go_last_insert_id_args}) if $meta->{go_last_insert_id_args}; my $go_policy = $sth->{go_policy}; my $dbh_attribute_update = $go_policy->dbh_attribute_update(); $request->dbh_attributes( $go_policy->dbh_attribute_list() ) if $dbh_attribute_update eq 'every' or $dbh->{go_request_count}==1; my $transport = $sth->{go_transport} or return $sth->set_err($DBI::stderr, "Not connected (no transport)"); local $transport->{go_cache} = $sth->{go_cache} if defined $sth->{go_cache}; my ($response, $retransmit_sub) = $transport->transmit_request($request); $response ||= $transport->receive_response($request, $retransmit_sub); $sth->{go_response} = $response or die "No response object returned by $transport"; $dbh->{go_response} = $response; # mainly for last_insert_id if (my $dbh_attributes = $response->dbh_attributes) { # XXX we don't STORE here, we just stuff the value into the attribute cache $dbh->{$_} = $dbh_attributes->{$_} for keys %$dbh_attributes; # record the values returned, so we know that we have fetched # values are which we have fetched (see dbh->FETCH method) $dbh->{go_dbh_attributes_fetched} = $dbh_attributes; } my $rv = $response->rv; # may be undef on error if ($response->sth_resultsets) { # setup first resultset - including sth attributes $sth->more_results; } else { $sth->STORE(Active => 0); $sth->{go_rows} = $rv; } # set error/warn/info (after more_results as that'll clear err) DBD::Gofer::set_err_from_response($sth, $response); return $rv; } sub bind_param { my ($sth, $param, $value, $attr) = @_; $sth->{ParamValues}{$param} = $value; $sth->{ParamAttr}{$param} = $attr if defined $attr; # attr is sticky if not explicitly set return 1; } sub execute { my $sth = shift; $sth->bind_param($_, $_[$_-1]) for (1..@_); push @{ $sth->{go_method_calls} }, [ 'execute' ]; my $meta = { go_last_insert_id_args => $sth->{go_last_insert_id_args} }; return $sth->go_sth_method($meta); } sub more_results { my $sth = shift; $sth->finish; my $response = $sth->{go_response} or do { # e.g., we haven't sent a request yet (ie prepare then more_results) $sth->trace_msg(" No response object present", 3); return; }; my $resultset_list = $response->sth_resultsets or return $sth->set_err($DBI::stderr, "No sth_resultsets"); my $meta = shift @$resultset_list or return undef; # no more result sets #warn "more_results: ".Data::Dumper::Dumper($meta); # pull out the special non-attributes first my ($rowset, $err, $errstr, $state) = delete @{$meta}{qw(rowset err errstr state)}; # copy meta attributes into attribute cache my $NUM_OF_FIELDS = delete $meta->{NUM_OF_FIELDS}; $sth->STORE('NUM_OF_FIELDS', $NUM_OF_FIELDS); # XXX need to use STORE for some? $sth->{$_} = $meta->{$_} for keys %$meta; if (($NUM_OF_FIELDS||0) > 0) { $sth->{go_rows} = ($rowset) ? @$rowset : -1; $sth->{go_current_rowset} = $rowset; $sth->{go_current_rowset_err} = [ $err, $errstr, $state ] if defined $err; $sth->STORE(Active => 1) if $rowset; } return $sth; } sub go_clone_sth { my ($sth1) = @_; # clone an (un-fetched-from) sth - effectively undoes the initial more_results # not 100% so just for use in caching returned sth e.g. table_info my $sth2 = $sth1->{Database}->prepare($sth1->{Statement}, { go_skip_prepare_check => 1 }); $sth2->STORE($_, $sth1->{$_}) for qw(NUM_OF_FIELDS Active); my $sth2_inner = tied %$sth2; $sth2_inner->{$_} = $sth1->{$_} for qw(NUM_OF_PARAMS FetchHashKeyName); die "not fully implemented yet"; return $sth2; } sub fetchrow_arrayref { my ($sth) = @_; my $resultset = $sth->{go_current_rowset} || do { # should only happen if fetch called after execute failed my $rowset_err = $sth->{go_current_rowset_err} || [ 1, 'no result set (did execute fail)' ]; return $sth->set_err( @$rowset_err ); }; return $sth->_set_fbav(shift @$resultset) if @$resultset; $sth->finish; # no more data so finish return undef; } *fetch = \&fetchrow_arrayref; # alias sub fetchall_arrayref { my ($sth, $slice, $max_rows) = @_; my $resultset = $sth->{go_current_rowset} || do { # should only happen if fetch called after execute failed my $rowset_err = $sth->{go_current_rowset_err} || [ 1, 'no result set (did execute fail)' ]; return $sth->set_err( @$rowset_err ); }; my $mode = ref($slice) || 'ARRAY'; return $sth->SUPER::fetchall_arrayref($slice, $max_rows) if ref($slice) or defined $max_rows; $sth->finish; # no more data after this so finish return $resultset; } sub rows { return shift->{go_rows}; } sub STORE { my ($sth, $attrib, $value) = @_; return $sth->SUPER::STORE($attrib => $value) if $sth_local_store_attrib{$attrib} # handle locally # or it's a private_ (application) attribute or $attrib =~ /^private_/; # otherwise warn but do it anyway # this will probably need refining later my $msg = "Altering \$sth->{$attrib} won't affect proxied handle"; Carp::carp($msg) if $sth->FETCH('Warn'); # XXX could perhaps do # push @{ $sth->{go_method_calls} }, [ 'STORE', $attrib, $value ] # if not $sth->FETCH('Executed'); # but how to handle repeat executions? How to we know when an # attribute is being set to affect the current resultset or the # next execution? # Could just always use go_method_calls I guess. # do the store locally anyway, just in case $sth->SUPER::STORE($attrib => $value); return $sth->set_err($DBI::stderr, $msg); } # sub bind_param_array # we use DBI's default, which sets $sth->{ParamArrays}{$param} = $value # and calls bind_param($param, undef, $attr) if $attr. sub execute_array { my $sth = shift; my $attr = shift; $sth->bind_param_array($_, $_[$_-1]) for (1..@_); push @{ $sth->{go_method_calls} }, [ 'execute_array', $attr ]; return $sth->go_sth_method($attr); } *go_cache = \&DBD::Gofer::go_cache; } 1; __END__ =head1 NAME DBD::Gofer - A stateless-proxy driver for communicating with a remote DBI =head1 SYNOPSIS use DBI; $original_dsn = "dbi:..."; # your original DBI Data Source Name $dbh = DBI->connect("dbi:Gofer:transport=$transport;...;dsn=$original_dsn", $user, $passwd, \%attributes); ... use $dbh as if it was connected to $original_dsn ... The C part specifies the name of the module to use to transport the requests to the remote DBI. If $transport doesn't contain any double colons then it's prefixed with C. The C part I of the DSN because everything after C is assumed to be the DSN that the remote DBI should use. The C<...> represents attributes that influence the operation of the Gofer driver or transport. These are described below or in the documentation of the transport module being used. =encoding ISO8859-1 =head1 DESCRIPTION DBD::Gofer is a DBI database driver that forwards requests to another DBI driver, usually in a separate process, often on a separate machine. It tries to be as transparent as possible so it appears that you are using the remote driver directly. DBD::Gofer is very similar to DBD::Proxy. The major difference is that with DBD::Gofer no state is maintained on the remote end. That means every request contains all the information needed to create the required state. (So, for example, every request includes the DSN to connect to.) Each request can be sent to any available server. The server executes the request and returns a single response that includes all the data. This is very similar to the way http works as a stateless protocol for the web. Each request from your web browser can be handled by a different web server process. =head2 Use Cases This may seem like pointless overhead but there are situations where this is a very good thing. Let's consider a specific case. Imagine using DBD::Gofer with an http transport. Your application calls connect(), prepare("select * from table where foo=?"), bind_param(), and execute(). At this point DBD::Gofer builds a request containing all the information about the method calls. It then uses the httpd transport to send that request to an apache web server. This 'dbi execute' web server executes the request (using DBI::Gofer::Execute and related modules) and builds a response that contains all the rows of data, if the statement returned any, along with all the attributes that describe the results, such as $sth->{NAME}. This response is sent back to DBD::Gofer which unpacks it and presents it to the application as if it had executed the statement itself. =head2 Advantages Okay, but you still don't see the point? Well let's consider what we've gained: =head3 Connection Pooling and Throttling The 'dbi execute' web server leverages all the functionality of web infrastructure in terms of load balancing, high-availability, firewalls, access management, proxying, caching. At its most basic level you get a configurable pool of persistent database connections. =head3 Simple Scaling Got thousands of processes all trying to connect to the database? You can use DBD::Gofer to connect them to your smaller pool of 'dbi execute' web servers instead. =head3 Caching Client-side caching is as simple as adding "C" to the DSN. This feature alone can be worth using DBD::Gofer for. =head3 Fewer Network Round-trips DBD::Gofer sends as few requests as possible (dependent on the policy being used). =head3 Thin Clients / Unsupported Platforms You no longer need drivers for your database on every system. DBD::Gofer is pure perl. =head1 CONSTRAINTS There are some natural constraints imposed by the DBD::Gofer 'stateless' approach. But not many: =head2 You can't change database handle attributes after connect() You can't change database handle attributes after you've connected. Use the connect() call to specify all the attribute settings you want. This is because it's critical that when a request is complete the database handle is left in the same state it was when first connected. An exception is made for attributes with names starting "C": They can be set after connect() but the change is only applied locally. =head2 You can't change statement handle attributes after prepare() You can't change statement handle attributes after prepare. An exception is made for attributes with names starting "C": They can be set after prepare() but the change is only applied locally. =head2 You can't use transactions AutoCommit only. Transactions aren't supported. (In theory transactions could be supported when using a transport that maintains a connection, like C does. If you're interested in this please get in touch via dbi-dev@perl.org) =head2 You can't call driver-private sth methods But that's rarely needed anyway. =head1 GENERAL CAVEATS A few important things to keep in mind when using DBD::Gofer: =head2 Temporary tables, locks, and other per-connection persistent state You shouldn't expect any per-session state to persist between requests. This includes locks and temporary tables. Because the server-side may execute your requests via a different database connections, you can't rely on any per-connection persistent state, such as temporary tables, being available from one request to the next. This is an easy trap to fall into. A good way to check for this is to test your code with a Gofer policy package that sets the C policy to 'connect' to force a new connection for each request. The C policy does this. =head2 Driver-private Database Handle Attributes Some driver-private dbh attributes may not be available if the driver has not implemented the private_attribute_info() method (added in DBI 1.54). =head2 Driver-private Statement Handle Attributes Driver-private sth attributes can be set in the prepare() call. TODO Some driver-private sth attributes may not be available if the driver has not implemented the private_attribute_info() method (added in DBI 1.54). =head2 Multiple Resultsets Multiple resultsets are supported only if the driver supports the more_results() method (an exception is made for DBD::Sybase). =head2 Statement activity that also updates dbh attributes Some drivers may update one or more dbh attributes after performing activity on a child sth. For example, DBD::mysql provides $dbh->{mysql_insertid} in addition to $sth->{mysql_insertid}. Currently mysql_insertid is supported via a hack but a more general mechanism is needed for other drivers to use. =head2 Methods that report an error always return undef With DBD::Gofer, a method that sets an error always return an undef or empty list. That shouldn't be a problem in practice because the DBI doesn't define any methods that return meaningful values while also reporting an error. =head2 Subclassing only applies to client-side The RootClass and DbTypeSubclass attributes are not passed to the Gofer server. =head1 CAVEATS FOR SPECIFIC METHODS =head2 last_insert_id To enable use of last_insert_id you need to indicate to DBD::Gofer that you'd like to use it. You do that my adding a C attribute to the do() or prepare() method calls. For example: $dbh->do($sql, { go_last_insert_id_args => [...] }); or $sth = $dbh->prepare($sql, { go_last_insert_id_args => [...] }); The array reference should contains the args that you want passed to the last_insert_id() method. =head2 execute_for_fetch The array methods bind_param_array() and execute_array() are supported. When execute_array() is called the data is serialized and executed in a single round-trip to the Gofer server. This makes it very fast, but requires enough memory to store all the serialized data. The execute_for_fetch() method currently isn't optimised, it uses the DBI fallback behaviour of executing each tuple individually. (It could be implemented as a wrapper for execute_array() - patches welcome.) =head1 TRANSPORTS DBD::Gofer doesn't concern itself with transporting requests and responses to and fro. For that it uses special Gofer transport modules. Gofer transport modules usually come in pairs: one for the 'client' DBD::Gofer driver to use and one for the remote 'server' end. They have very similar names: DBD::Gofer::Transport:: DBI::Gofer::Transport:: Sometimes the transports on the DBD and DBI sides may have different names. For example DBD::Gofer::Transport::http is typically used with DBI::Gofer::Transport::mod_perl (DBD::Gofer::Transport::http and DBI::Gofer::Transport::mod_perl modules are part of the GoferTransport-http distribution). =head2 Bundled Transports Several transport modules are provided with DBD::Gofer: =head3 null The null transport is the simplest of them all. It doesn't actually transport the request anywhere. It just serializes (freezes) the request into a string, then thaws it back into a data structure before passing it to DBI::Gofer::Execute to execute. The same freeze and thaw is applied to the results. The null transport is the best way to test if your application will work with Gofer. Just set the DBI_AUTOPROXY environment variable to "C" (see L below) and run your application, or ideally its test suite, as usual. It doesn't take any parameters. =head3 pipeone The pipeone transport launches a subprocess for each request. It passes in the request and reads the response. The fact that a new subprocess is started for each request ensures that the server side is truly stateless. While this does make the transport I slow, it is useful as a way to test that your application doesn't depend on per-connection state, such as temporary tables, persisting between requests. It's also useful both as a proof of concept and as a base class for the stream driver. =head3 stream The stream driver also launches a subprocess and writes requests and reads responses, like the pipeone transport. In this case, however, the subprocess is expected to handle more that one request. (Though it will be automatically restarted if it exits.) This is the first transport that is truly useful because it can launch the subprocess on a remote machine using C. This means you can now use DBD::Gofer to easily access any databases that's accessible from any system you can login to. You also get all the benefits of ssh, including encryption and optional compression. See L below for an example. =head2 Other Transports Implementing a Gofer transport is I simple, and more transports are very welcome. Just take a look at any existing transports that are similar to your needs. =head3 http See the GoferTransport-http distribution on CPAN: http://search.cpan.org/dist/GoferTransport-http/ =head3 Gearman I know Ask Bjørn Hansen has implemented a transport for the C distributed job system, though it's not on CPAN at the time of writing this. =head1 CONNECTING Simply prefix your existing DSN with "C" where $transport is the name of the Gofer transport you want to use (see L). The C and C attributes must be specified and the C attributes must be last. Other attributes can be specified in the DSN to configure DBD::Gofer and/or the Gofer transport module being used. The main attributes after C, are C and C. These and other attributes are described below. =head2 Using DBI_AUTOPROXY The simplest way to try out DBD::Gofer is to set the DBI_AUTOPROXY environment variable. In this case you don't include the C part. For example: export DBI_AUTOPROXY="dbi:Gofer:transport=null" or, for a more useful example, try: export DBI_AUTOPROXY="dbi:Gofer:transport=stream;url=ssh:user@example.com" =head2 Connection Attributes These attributes can be specified in the DSN. They can also be passed in the \%attr parameter of the DBI connect method by adding a "C" prefix to the name. =head3 transport Specifies the Gofer transport class to use. Required. See L above. If the value does not include C<::> then "C" is prefixed. The transport object can be accessed via $h->{go_transport}. =head3 dsn Specifies the DSN for the remote side to connect to. Required, and must be last. =head3 url Used to tell the transport where to connect to. The exact form of the value depends on the transport used. =head3 policy Specifies the policy to use. See L. If the value does not include C<::> then "C" is prefixed. The policy object can be accessed via $h->{go_policy}. =head3 timeout Specifies a timeout, in seconds, to use when waiting for responses from the server side. =head3 retry_limit Specifies the number of times a failed request will be retried. Default is 0. =head3 retry_hook Specifies a code reference to be called to decide if a failed request should be retried. The code reference is called like this: $transport = $h->{go_transport}; $retry = $transport->go_retry_hook->($request, $response, $transport); If it returns true then the request will be retried, up to the C. If it returns a false but defined value then the request will not be retried. If it returns undef then the default behaviour will be used, as if C had not been specified. The default behaviour is to retry requests where $request->is_idempotent is true, or the error message matches C. =head3 cache Specifies that client-side caching should be performed. The value is the name of a cache class to use. Any class implementing get($key) and set($key, $value) methods can be used. That includes a great many powerful caching classes on CPAN, including the Cache and Cache::Cache distributions. You can use "C" is a shortcut for "C". See L for a description of this simple fast default cache. The cache object can be accessed via $h->go_cache. For example: $dbh->go_cache->clear; # free up memory being used by the cache The cache keys are the frozen (serialized) requests, and the values are the frozen responses. The default behaviour is to only use the cache for requests where $request->is_idempotent is true (i.e., the dbh has the ReadOnly attribute set or the SQL statement is obviously a SELECT without a FOR UPDATE clause.) For even more control you can use the C attribute to pass in an instantiated cache object. Individual methods, including prepare(), can also specify alternative caches via the C attribute. For example, to specify no caching for a particular query, you could use $sth = $dbh->prepare( $sql, { go_cache => 0 } ); This can be used to implement different caching policies for different statements. It's interesting to note that DBD::Gofer can be used to add client-side caching to any (gofer compatible) application, with no code changes and no need for a gofer server. Just set the DBI_AUTOPROXY environment variable like this: DBI_AUTOPROXY='dbi:Gofer:transport=null;cache=1' =head1 CONFIGURING BEHAVIOUR POLICY DBD::Gofer supports a 'policy' mechanism that allows you to fine-tune the number of round-trips to the Gofer server. The policies are grouped into classes (which may be subclassed) and referenced by the name of the class. The L class is the base class for all the policy packages and describes all the available policies. Three policy packages are supplied with DBD::Gofer: L is most 'transparent' but slowest because it makes more round-trips to the Gofer server. L is a reasonable compromise - it's the default policy. L is fastest, but may require code changes in your applications. Generally the default C policy is fine. When first testing an existing application with Gofer it is a good idea to start with the C policy first and then switch to C or a custom policy, for final testing. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 ACKNOWLEDGEMENTS The development of DBD::Gofer and related modules was sponsored by Shopzilla.com (L), where I currently work. =head1 SEE ALSO L, L, L. L, L. L =head1 Caveats for specific drivers This section aims to record issues to be aware of when using Gofer with specific drivers. It usually only documents issues that are not natural consequences of the limitations of the Gofer approach - as documented above. =head1 TODO This is just a random brain dump... (There's more in the source of the Changes file, not the pod) Document policy mechanism Add mechanism for transports to list config params and for Gofer to apply any that match (and warn if any left over?) Driver-private sth attributes - set via prepare() - change DBI spec add hooks into transport base class for checking & updating a result set cache ie via a standard cache interface such as: http://search.cpan.org/~robm/Cache-FastMmap/FastMmap.pm http://search.cpan.org/~bradfitz/Cache-Memcached/lib/Cache/Memcached.pm http://search.cpan.org/~dclinton/Cache-Cache/ http://search.cpan.org/~cleishman/Cache/ Also caching instructions could be passed through the httpd transport layer in such a way that appropriate http cache headers are added to the results so that web caches (squid etc) could be used to implement the caching. (MUST require the use of GET rather than POST requests.) Rework handling of installed_methods to not piggyback on dbh_attributes? Perhaps support transactions for transports where it's possible (ie null and stream)? Would make stream transport (ie ssh) more useful to more people. Make sth_result_attr more like dbh_attributes (using '*' etc) Add @val = FETCH_many(@names) to DBI in C and use in Gofer/Execute? Implement _new_sth in C. =cut DBI-1.648/lib/DBD/NullP.pm0000644000031300001440000001366614742423677014152 0ustar00merijnusersuse strict; use warnings; { package DBD::NullP; require DBI; require Carp; our @EXPORT = qw(); # Do NOT @EXPORT anything. our $VERSION = "12.014715"; # $Id: NullP.pm 14714 2011-02-22 17:27:07Z Tim $ # # Copyright (c) 1994-2007 Tim Bunce # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. our $drh = undef; # holds driver handle once initialised sub driver{ return $drh if $drh; my($class, $attr) = @_; $class .= "::dr"; ($drh) = DBI::_new_drh($class, { 'Name' => 'NullP', 'Version' => $VERSION, 'Attribution' => 'DBD Example Null Perl stub by Tim Bunce', }, [ qw'example implementors private data']); $drh; } sub CLONE { undef $drh; } } { package DBD::NullP::dr; # ====== DRIVER ====== our $imp_data_size = 0; use strict; sub connect { # normally overridden, but a handy default my $dbh = shift->SUPER::connect(@_) or return; $dbh->STORE(Active => 1); $dbh; } sub DESTROY { undef } } { package DBD::NullP::db; # ====== DATABASE ====== our $imp_data_size = 0; use strict; use Carp qw(croak); # Added get_info to support tests in 10examp.t sub get_info { my ($dbh, $type) = @_; if ($type == 29) { # identifier quote return '"'; } return; } # Added table_info to support tests in 10examp.t sub table_info { my ($dbh, $catalog, $schema, $table, $type) = @_; my ($outer, $sth) = DBI::_new_sth($dbh, { 'Statement' => 'tables', }); if (defined($type) && $type eq '%' && # special case for tables('','','','%') grep {defined($_) && $_ eq ''} ($catalog, $schema, $table)) { $outer->{dbd_nullp_data} = [[undef, undef, undef, 'TABLE', undef], [undef, undef, undef, 'VIEW', undef], [undef, undef, undef, 'ALIAS', undef]]; } elsif (defined($catalog) && $catalog eq '%' && # special case for tables('%','','') grep {defined($_) && $_ eq ''} ($schema, $table)) { $outer->{dbd_nullp_data} = [['catalog1', undef, undef, undef, undef], ['catalog2', undef, undef, undef, undef]]; } else { $outer->{dbd_nullp_data} = [['catalog', 'schema', 'table1', 'TABLE']]; $outer->{dbd_nullp_data} = [['catalog', 'schema', 'table2', 'TABLE']]; $outer->{dbd_nullp_data} = [['catalog', 'schema', 'table3', 'TABLE']]; } $outer->STORE(NUM_OF_FIELDS => 5); $sth->STORE(Active => 1); return $outer; } sub prepare { my ($dbh, $statement)= @_; my ($outer, $sth) = DBI::_new_sth($dbh, { 'Statement' => $statement, }); return $outer; } sub FETCH { my ($dbh, $attrib) = @_; # In reality this would interrogate the database engine to # either return dynamic values that cannot be precomputed # or fetch and cache attribute values too expensive to prefetch. return $dbh->SUPER::FETCH($attrib); } sub STORE { my ($dbh, $attrib, $value) = @_; # would normally validate and only store known attributes # else pass up to DBI to handle if ($attrib eq 'AutoCommit') { Carp::croak("Can't disable AutoCommit") unless $value; # convert AutoCommit values to magic ones to let DBI # know that the driver has 'handled' the AutoCommit attribute $value = ($value) ? -901 : -900; } elsif ($attrib eq 'nullp_set_err') { # a fake attribute to produce a test case where STORE issues a warning $dbh->set_err($value, $value); } return $dbh->SUPER::STORE($attrib, $value); } sub ping { 1 } sub disconnect { shift->STORE(Active => 0); } } { package DBD::NullP::st; # ====== STATEMENT ====== our $imp_data_size = 0; use strict; sub bind_param { my ($sth, $param, $value, $attr) = @_; $sth->{ParamValues}{$param} = $value; $sth->{ParamAttr}{$param} = $attr if defined $attr; # attr is sticky if not explicitly set return 1; } sub execute { my $sth = shift; $sth->bind_param($_, $_[$_-1]) for (1..@_); if ($sth->{Statement} =~ m/^ \s* SELECT \s+/xmsi) { $sth->STORE(NUM_OF_FIELDS => 1); $sth->{NAME} = [ "fieldname" ]; # just for the sake of returning something, we return the params my $params = $sth->{ParamValues} || {}; $sth->{dbd_nullp_data} = [ @{$params}{ sort keys %$params } ]; $sth->STORE(Active => 1); } # force a sleep - handy for testing elsif ($sth->{Statement} =~ m/^ \s* SLEEP \s+ (\S+) /xmsi) { my $secs = $1; if (eval { require Time::HiRes; defined &Time::HiRes::sleep }) { Time::HiRes::sleep($secs); } else { sleep $secs; } } # force an error - handy for testing elsif ($sth->{Statement} =~ m/^ \s* ERROR \s+ (\d+) \s* (.*) /xmsi) { return $sth->set_err($1, $2); } # anything else is silently ignored, successfully 1; } sub fetchrow_arrayref { my $sth = shift; my $data = shift @{$sth->{dbd_nullp_data}}; if (!$data || !@$data) { $sth->finish; # no more data so finish return undef; } return $sth->_set_fbav($data); } *fetch = \&fetchrow_arrayref; # alias sub FETCH { my ($sth, $attrib) = @_; # would normally validate and only fetch known attributes # else pass up to DBI to handle return $sth->SUPER::FETCH($attrib); } sub STORE { my ($sth, $attrib, $value) = @_; # would normally validate and only store known attributes # else pass up to DBI to handle return $sth->SUPER::STORE($attrib, $value); } } 1; DBI-1.648/lib/DBD/Gofer/0000755000031300001440000000000015210302710013557 5ustar00merijnusersDBI-1.648/lib/DBD/Gofer/Transport/0000755000031300001440000000000015210302710015553 5ustar00merijnusersDBI-1.648/lib/DBD/Gofer/Transport/Base.pm0000644000031300001440000003072414742424460017011 0ustar00merijnuserspackage DBD::Gofer::Transport::Base; # $Id: Base.pm 14120 2010-06-07 19:52:19Z H.Merijn $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; use base qw(DBI::Gofer::Transport::Base); our $VERSION = "0.014121"; __PACKAGE__->mk_accessors(qw( trace go_dsn go_url go_policy go_timeout go_retry_hook go_retry_limit go_cache cache_hit cache_miss cache_store )); __PACKAGE__->mk_accessors_using(make_accessor_autoviv_hashref => qw( meta )); sub new { my ($class, $args) = @_; $args->{$_} = 0 for (qw(cache_hit cache_miss cache_store)); $args->{keep_meta_frozen} ||= 1 if $args->{go_cache}; #warn "args @{[ %$args ]}\n"; return $class->SUPER::new($args); } sub _init_trace { $ENV{DBD_GOFER_TRACE} || 0 } sub new_response { my $self = shift; return DBI::Gofer::Response->new(@_); } sub transmit_request { my ($self, $request) = @_; my $trace = $self->trace; my $response; my ($go_cache, $request_cache_key); if ($go_cache = $self->{go_cache}) { $request_cache_key = $request->{meta}{request_cache_key} = $self->get_cache_key_for_request($request); if ($request_cache_key) { my $frozen_response = eval { $go_cache->get($request_cache_key) }; if ($frozen_response) { $self->_dump("cached response found for ".ref($request), $request) if $trace; $response = $self->thaw_response($frozen_response); $self->trace_msg("transmit_request is returning a response from cache $go_cache\n") if $trace; ++$self->{cache_hit}; return $response; } warn $@ if $@; ++$self->{cache_miss}; $self->trace_msg("transmit_request cache miss\n") if $trace; } } my $to = $self->go_timeout; my $transmit_sub = sub { $self->trace_msg("transmit_request\n") if $trace; local $SIG{ALRM} = sub { die "TIMEOUT\n" } if $to; my $response = eval { local $SIG{PIPE} = sub { my $extra = ($! eq "Broken pipe") ? "" : " ($!)"; die "Unable to send request: Broken pipe$extra\n"; }; alarm($to) if $to; $self->transmit_request_by_transport($request); }; alarm(0) if $to; if ($@) { return $self->transport_timedout("transmit_request", $to) if $@ eq "TIMEOUT\n"; return $self->new_response({ err => 1, errstr => $@ }); } return $response; }; $response = $self->_transmit_request_with_retries($request, $transmit_sub); if ($response) { my $frozen_response = delete $response->{meta}{frozen}; $self->_store_response_in_cache($frozen_response, $request_cache_key) if $request_cache_key; } $self->trace_msg("transmit_request is returning a response itself\n") if $trace && $response; return $response unless wantarray; return ($response, $transmit_sub); } sub _transmit_request_with_retries { my ($self, $request, $transmit_sub) = @_; my $response; do { $response = $transmit_sub->(); } while ( $response && $self->response_needs_retransmit($request, $response) ); return $response; } sub receive_response { my ($self, $request, $retransmit_sub) = @_; my $to = $self->go_timeout; my $receive_sub = sub { $self->trace_msg("receive_response\n"); local $SIG{ALRM} = sub { die "TIMEOUT\n" } if $to; my $response = eval { alarm($to) if $to; $self->receive_response_by_transport($request); }; alarm(0) if $to; if ($@) { return $self->transport_timedout("receive_response", $to) if $@ eq "TIMEOUT\n"; return $self->new_response({ err => 1, errstr => $@ }); } return $response; }; my $response; do { $response = $receive_sub->(); if ($self->response_needs_retransmit($request, $response)) { $response = $self->_transmit_request_with_retries($request, $retransmit_sub); $response ||= $receive_sub->(); } } while ( $self->response_needs_retransmit($request, $response) ); if ($response) { my $frozen_response = delete $response->{meta}{frozen}; my $request_cache_key = $request->{meta}{request_cache_key}; $self->_store_response_in_cache($frozen_response, $request_cache_key) if $request_cache_key && $self->{go_cache}; } return $response; } sub response_retry_preference { my ($self, $request, $response) = @_; # give the user a chance to express a preference (or undef for default) if (my $go_retry_hook = $self->go_retry_hook) { my $retry = $go_retry_hook->($request, $response, $self); $self->trace_msg(sprintf "go_retry_hook returned %s\n", (defined $retry) ? $retry : 'undef'); return $retry if defined $retry; } # This is the main decision point. We don't retry requests that got # as far as executing because the error is probably from the database # (not transport) so retrying is unlikely to help. But note that any # severe transport error occurring after execute is likely to return # a new response object that doesn't have the execute flag set. Beware! return 0 if $response->executed_flag_set; return 1 if ($response->errstr || '') =~ m/induced by DBI_GOFER_RANDOM/; return 1 if $request->is_idempotent; # i.e. is SELECT or ReadOnly was set return undef; # we couldn't make up our mind } sub response_needs_retransmit { my ($self, $request, $response) = @_; my $err = $response->err or return 0; # nothing went wrong my $retry = $self->response_retry_preference($request, $response); if (!$retry) { # false or undef $self->trace_msg("response_needs_retransmit: response not suitable for retry\n"); return 0; } # we'd like to retry but have we retried too much already? my $retry_limit = $self->go_retry_limit; if (!$retry_limit) { $self->trace_msg("response_needs_retransmit: retries disabled (retry_limit not set)\n"); return 0; } my $request_meta = $request->meta; my $retry_count = $request_meta->{retry_count} || 0; if ($retry_count >= $retry_limit) { $self->trace_msg("response_needs_retransmit: $retry_count is too many retries\n"); # XXX should be possible to disable altering the err $response->errstr(sprintf "%s (after %d retries by gofer)", $response->errstr, $retry_count); return 0; } # will retry now, do the admin ++$retry_count; $self->trace_msg("response_needs_retransmit: retry $retry_count\n"); # hook so response_retry_preference can defer some code execution # until we've checked retry_count and retry_limit. if (ref $retry eq 'CODE') { $retry->($retry_count, $retry_limit) and warn "should return false"; # protect future use } ++$request_meta->{retry_count}; # update count for this request object ++$self->meta->{request_retry_count}; # update cumulative transport stats return 1; } sub transport_timedout { my ($self, $method, $timeout) = @_; $timeout ||= $self->go_timeout; return $self->new_response({ err => 1, errstr => "DBD::Gofer $method timed-out after $timeout seconds" }); } # return undef if we don't want to cache this request # subclasses may use more specialized rules sub get_cache_key_for_request { my ($self, $request) = @_; # we only want to cache idempotent requests # is_idempotent() is true if GOf_REQUEST_IDEMPOTENT or GOf_REQUEST_READONLY set return undef if not $request->is_idempotent; # XXX would be nice to avoid the extra freeze here my $key = $self->freeze_request($request, undef, 1); #use Digest::MD5; warn "get_cache_key_for_request: ".Digest::MD5::md5_base64($key)."\n"; return $key; } sub _store_response_in_cache { my ($self, $frozen_response, $request_cache_key) = @_; my $go_cache = $self->{go_cache} or return; # new() ensures that enabling go_cache also enables keep_meta_frozen warn "No meta frozen in response" if !$frozen_response; warn "No request_cache_key" if !$request_cache_key; if ($frozen_response && $request_cache_key) { $self->trace_msg("receive_response added response to cache $go_cache\n"); eval { $go_cache->set($request_cache_key, $frozen_response) }; warn $@ if $@; ++$self->{cache_store}; } } 1; __END__ =head1 NAME DBD::Gofer::Transport::Base - base class for DBD::Gofer client transports =head1 SYNOPSIS my $remote_dsn = "..." DBI->connect("dbi:Gofer:transport=...;url=...;timeout=...;retry_limit=...;dsn=$remote_dsn",...) or, enable by setting the DBI_AUTOPROXY environment variable: export DBI_AUTOPROXY='dbi:Gofer:transport=...;url=...' which will force I DBI connections to be made via that Gofer server. =head1 DESCRIPTION This is the base class for all DBD::Gofer client transports. =head1 ATTRIBUTES Gofer transport attributes can be specified either in the attributes parameter of the connect() method call, or in the DSN string. When used in the DSN string, attribute names don't have the C prefix. =head2 go_dsn The full DBI DSN that the Gofer server should connect to on your behalf. When used in the DSN it must be the last element in the DSN string. =head2 go_timeout A time limit for sending a request and receiving a response. Some drivers may implement sending and receiving as separate steps, in which case (currently) the timeout applies to each separately. If a request needs to be resent then the timeout is restarted for each sending of a request and receiving of a response. =head2 go_retry_limit The maximum number of times an request may be retried. The default is 2. =head2 go_retry_hook This subroutine reference is called, if defined, for each response received where $response->err is true. The subroutine is pass three parameters: the request object, the response object, and the transport object. If it returns an undefined value then the default retry behaviour is used. See L below. If it returns a defined but false value then the request is not resent. If it returns true value then the request is resent, so long as the number of retries does not exceed C. =head1 RETRY ON ERROR The default retry on error behaviour is: - Retry if the error was due to DBI_GOFER_RANDOM. See L. - Retry if $request->is_idempotent returns true. See L. A retry won't be allowed if the number of previous retries has reached C. =head1 TRACING Tracing of gofer requests and responses can be enabled by setting the C environment variable. A value of 1 gives a reasonably compact summary of each request and response. A value of 2 or more gives a detailed, and voluminous, dump. The trace is written using DBI->trace_msg() and so is written to the default DBI trace output, which is usually STDERR. =head1 METHODS I =head2 response_retry_preference $retry = $transport->response_retry_preference($request, $response); The response_retry_preference is called by DBD::Gofer when considering if a request should be retried after an error. Returns true (would like to retry), false (must not retry), undef (no preference). If a true value is returned in the form of a CODE ref then, if DBD::Gofer does decide to retry the request, it calls the code ref passing $retry_count, $retry_limit. Can be used for logging and/or to implement exponential back-off behaviour. Currently the called code must return using C to allow for future extensions. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007-2008, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 SEE ALSO L, L, L, L. and some example transports: L L L =cut DBI-1.648/lib/DBD/Gofer/Transport/corostream.pm0000644000031300001440000000643412127465144020315 0ustar00merijnuserspackage DBD::Gofer::Transport::corostream; use strict; use warnings; use Carp; use Coro::Select; # a slow but coro-aware replacement for CORE::select (global effect!) use Coro; use Coro::Handle; use base qw(DBD::Gofer::Transport::stream); # XXX ensure DBI_PUREPERL for parent doesn't pass to child sub start_pipe_command { local $ENV{DBI_PUREPERL} = $ENV{DBI_PUREPERL_COROCHILD}; # typically undef my $connection = shift->SUPER::start_pipe_command(@_); return $connection; } 1; __END__ =head1 NAME DBD::Gofer::Transport::corostream - Async DBD::Gofer stream transport using Coro and AnyEvent =head1 SYNOPSIS DBI_AUTOPROXY="dbi:Gofer:transport=corostream" perl some-perl-script-using-dbi.pl or $dsn = ...; # the DSN for the driver and database you want to use $dbh = DBI->connect("dbi:Gofer:transport=corostream;dsn=$dsn", ...); =head1 DESCRIPTION The I from using L is that it enables the use of existing DBI frameworks like L. =head1 KNOWN ISSUES AND LIMITATIONS - Uses Coro::Select so alters CORE::select globally Parent class probably needs refactoring to enable a more encapsulated approach. - Doesn't prevent multiple concurrent requests Probably just needs a per-connection semaphore - Coro has many caveats. Caveat emptor. =head1 STATUS THIS IS CURRENTLY JUST A PROOF-OF-CONCEPT IMPLEMENTATION FOR EXPERIMENTATION. Please note that I have no plans to develop this code further myself. I'd very much welcome contributions. Interested? Let me know! =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2010, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 SEE ALSO L L =head1 APPENDIX Example code: #!perl use strict; use warnings; use Time::HiRes qw(time); BEGIN { $ENV{PERL_ANYEVENT_STRICT} = 1; $ENV{PERL_ANYEVENT_VERBOSE} = 1; } use AnyEvent; BEGIN { $ENV{DBI_TRACE} = 0; $ENV{DBI_GOFER_TRACE} = 0; $ENV{DBD_GOFER_TRACE} = 0; }; use DBI; $ENV{DBI_AUTOPROXY} = 'dbi:Gofer:transport=corostream'; my $ticker = AnyEvent->timer( after => 0, interval => 0.1, cb => sub { warn sprintf "-tick- %.2f\n", time } ); warn "connecting...\n"; my $dbh = DBI->connect("dbi:NullP:"); warn "...connected\n"; for (1..3) { warn "entering DBI...\n"; $dbh->do("sleep 0.3"); # pseudo-sql understood by the DBD::NullP driver warn "...returned\n"; } warn "done."; Example output: $ perl corogofer.pl connecting... -tick- 1293631437.14 -tick- 1293631437.14 ...connected entering DBI... -tick- 1293631437.25 -tick- 1293631437.35 -tick- 1293631437.45 -tick- 1293631437.55 ...returned entering DBI... -tick- 1293631437.66 -tick- 1293631437.76 -tick- 1293631437.86 ...returned entering DBI... -tick- 1293631437.96 -tick- 1293631438.06 -tick- 1293631438.16 ...returned done. at corogofer.pl line 39. You can see that the timer callback is firing while the code 'waits' inside the do() method for the response from the database. Normally that would block. =cut DBI-1.648/lib/DBD/Gofer/Transport/null.pm0000644000031300001440000000532212153147453017103 0ustar00merijnuserspackage DBD::Gofer::Transport::null; # $Id: null.pm 10087 2007-10-16 12:42:37Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; use base qw(DBD::Gofer::Transport::Base); use DBI::Gofer::Execute; our $VERSION = "0.010088"; __PACKAGE__->mk_accessors(qw( pending_response transmit_count )); my $executor = DBI::Gofer::Execute->new(); sub transmit_request_by_transport { my ($self, $request) = @_; $self->transmit_count( ($self->transmit_count()||0) + 1 ); # just for tests my $frozen_request = $self->freeze_request($request); # ... # the request is magically transported over to ... ourselves # ... my $response = $executor->execute_request( $self->thaw_request($frozen_request, undef, 1) ); # put response 'on the shelf' ready for receive_response() $self->pending_response( $response ); return undef; } sub receive_response_by_transport { my $self = shift; my $response = $self->pending_response; my $frozen_response = $self->freeze_response($response, undef, 1); # ... # the response is magically transported back to ... ourselves # ... return $self->thaw_response($frozen_response); } 1; __END__ =head1 NAME DBD::Gofer::Transport::null - DBD::Gofer client transport for testing =head1 SYNOPSIS my $original_dsn = "..." DBI->connect("dbi:Gofer:transport=null;dsn=$original_dsn",...) or, enable by setting the DBI_AUTOPROXY environment variable: export DBI_AUTOPROXY="dbi:Gofer:transport=null" =head1 DESCRIPTION Connect via DBD::Gofer but execute the requests within the same process. This is a quick and simple way to test applications for compatibility with the (few) restrictions that DBD::Gofer imposes. It also provides a simple, portable way for the DBI test suite to be used to test DBD::Gofer on all platforms with no setup. Also, by measuring the difference in performance between normal connections and connections via C the basic cost of using DBD::Gofer can be measured. Furthermore, the additional cost of more advanced transports can be isolated by comparing their performance with the null transport. The C script in the DBI distribution includes a comparative benchmark. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 SEE ALSO L L =cut DBI-1.648/lib/DBD/Gofer/Transport/pipeone.pm0000644000031300001440000001620314742423677017603 0ustar00merijnuserspackage DBD::Gofer::Transport::pipeone; # $Id: pipeone.pm 10087 2007-10-16 12:42:37Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; use Carp; use Fcntl; use IO::Select; use IPC::Open3 qw(open3); use Symbol qw(gensym); use base qw(DBD::Gofer::Transport::Base); our $VERSION = "0.010088"; __PACKAGE__->mk_accessors(qw( connection_info go_perl )); sub new { my ($self, $args) = @_; $args->{go_perl} ||= do { ($INC{"blib.pm"}) ? [ $^X, '-Mblib' ] : [ $^X ]; }; if (not ref $args->{go_perl}) { # user can override the perl to be used, either with an array ref # containing the command name and args to use, or with a string # (ie via the DSN) in which case, to enable args to be passed, # we split on two or more consecutive spaces (otherwise the path # to perl couldn't contain a space itself). $args->{go_perl} = [ split /\s{2,}/, $args->{go_perl} ]; } return $self->SUPER::new($args); } # nonblock($fh) puts filehandle into nonblocking mode sub nonblock { my $fh = shift; my $flags = fcntl($fh, F_GETFL, 0) or croak "Can't get flags for filehandle $fh: $!"; fcntl($fh, F_SETFL, $flags | O_NONBLOCK) or croak "Can't make filehandle $fh nonblocking: $!"; } sub start_pipe_command { my ($self, $cmd) = @_; $cmd = [ $cmd ] unless ref $cmd eq 'ARRAY'; # if it's important that the subprocess uses the same # (versions of) modules as us then the caller should # set PERL5LIB itself. # limit various forms of insanity, for now local $ENV{DBI_TRACE}; # use DBI_GOFER_TRACE instead local $ENV{DBI_AUTOPROXY}; local $ENV{DBI_PROFILE}; my ($wfh, $rfh, $efh) = (gensym, gensym, gensym); my $pid = open3($wfh, $rfh, $efh, @$cmd) or die "error starting @$cmd: $!\n"; if ($self->trace) { $self->trace_msg(sprintf("Started pid $pid: @$cmd {fd: w%d r%d e%d, ppid=$$}\n", fileno $wfh, fileno $rfh, fileno $efh),0); } nonblock($rfh); nonblock($efh); my $ios = IO::Select->new($rfh, $efh); return { cmd=>$cmd, pid=>$pid, wfh=>$wfh, rfh=>$rfh, efh=>$efh, ios=>$ios, }; } sub cmd_as_string { my $self = shift; # XXX meant to return a properly shell-escaped string suitable for system # but its only for debugging so that can wait my $connection_info = $self->connection_info; return join " ", map { (m/^[-:\w]*$/) ? $_ : "'$_'" } @{$connection_info->{cmd}}; } sub transmit_request_by_transport { my ($self, $request) = @_; my $frozen_request = $self->freeze_request($request); my $cmd = [ @{$self->go_perl}, qw(-MDBI::Gofer::Transport::pipeone -e run_one_stdio)]; my $info = $self->start_pipe_command($cmd); my $wfh = delete $info->{wfh}; # send frozen request local $\; print $wfh $frozen_request or warn "error writing to @$cmd: $!\n"; # indicate that there's no more close $wfh or die "error closing pipe to @$cmd: $!\n"; $self->connection_info( $info ); return; } sub read_response_from_fh { my ($self, $fh_actions) = @_; my $trace = $self->trace; my $info = $self->connection_info || die; my ($ios) = @{$info}{qw(ios)}; my $errors = 0; my $complete; die "No handles to read response from" unless $ios->count; while ($ios->count) { my @readable = $ios->can_read(); for my $fh (@readable) { local $_; my $actions = $fh_actions->{$fh} || die "panic: no action for $fh"; my $rv = sysread($fh, $_='', 1024*31); # to fit in 32KB slab unless ($rv) { # error (undef) or end of file (0) my $action; unless (defined $rv) { # was an error $self->trace_msg("error on handle $fh: $!\n") if $trace >= 4; $action = $actions->{error} || $actions->{eof}; ++$errors; # XXX an error may be a permenent condition of the handle # if so we'll loop here - not good } else { $action = $actions->{eof}; $self->trace_msg("eof on handle $fh\n") if $trace >= 4; } if ($action->($fh)) { $self->trace_msg("removing $fh from handle set\n") if $trace >= 4; $ios->remove($fh); } next; } # action returns true if the response is now complete # (we finish all handles $actions->{read}->($fh) && ++$complete; } last if $complete; } return $errors; } sub receive_response_by_transport { my $self = shift; my $info = $self->connection_info || die; my ($pid, $rfh, $efh, $ios, $cmd) = @{$info}{qw(pid rfh efh ios cmd)}; my $frozen_response; my $stderr_msg; $self->read_response_from_fh( { $efh => { error => sub { warn "error reading response stderr: $!"; 1 }, eof => sub { warn "eof on stderr" if 0; 1 }, read => sub { $stderr_msg .= $_; 0 }, }, $rfh => { error => sub { warn "error reading response: $!"; 1 }, eof => sub { warn "eof on stdout" if 0; 1 }, read => sub { $frozen_response .= $_; 0 }, }, }); waitpid $info->{pid}, 0 or warn "waitpid: $!"; # XXX do something more useful? die ref($self)." command (@$cmd) failed: $stderr_msg" if not $frozen_response; # no output on stdout at all # XXX need to be able to detect and deal with corruption my $response = $self->thaw_response($frozen_response); if ($stderr_msg) { # add stderr messages as warnings (for PrintWarn) $response->add_err(0, $stderr_msg, undef, $self->trace) # but ignore warning from old version of blib unless $stderr_msg =~ /^Using .*blib/ && "@$cmd" =~ /-Mblib/; } return $response; } 1; __END__ =head1 NAME DBD::Gofer::Transport::pipeone - DBD::Gofer client transport for testing =head1 SYNOPSIS $original_dsn = "..."; DBI->connect("dbi:Gofer:transport=pipeone;dsn=$original_dsn",...) or, enable by setting the DBI_AUTOPROXY environment variable: export DBI_AUTOPROXY="dbi:Gofer:transport=pipeone" =head1 DESCRIPTION Connect via DBD::Gofer and execute each request by starting executing a subprocess. This is, as you might imagine, spectacularly inefficient! It's only intended for testing. Specifically it demonstrates that the server side is completely stateless. It also provides a base class for the much more useful L transport. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 SEE ALSO L L =cut DBI-1.648/lib/DBD/Gofer/Transport/stream.pm0000644000031300001440000002204012153147453017420 0ustar00merijnuserspackage DBD::Gofer::Transport::stream; # $Id: stream.pm 14598 2010-12-21 22:53:25Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; use Carp; use base qw(DBD::Gofer::Transport::pipeone); our $VERSION = "0.014599"; __PACKAGE__->mk_accessors(qw( go_persist )); my $persist_all = 5; my %persist; sub _connection_key { my ($self) = @_; return join "~", $self->go_url||"", @{ $self->go_perl || [] }; } sub _connection_get { my ($self) = @_; my $persist = $self->go_persist; # = 0 can force non-caching $persist = $persist_all if not defined $persist; my $key = ($persist) ? $self->_connection_key : ''; if ($persist{$key} && $self->_connection_check($persist{$key})) { $self->trace_msg("reusing persistent connection $key\n",0) if $self->trace >= 1; return $persist{$key}; } my $connection = $self->_make_connection; if ($key) { %persist = () if keys %persist > $persist_all; # XXX quick hack to limit subprocesses $persist{$key} = $connection; } return $connection; } sub _connection_check { my ($self, $connection) = @_; $connection ||= $self->connection_info; my $pid = $connection->{pid}; my $ok = (kill 0, $pid); $self->trace_msg("_connection_check: $ok (pid $$)\n",0) if $self->trace; return $ok; } sub _connection_kill { my ($self) = @_; my $connection = $self->connection_info; my ($pid, $wfh, $rfh, $efh) = @{$connection}{qw(pid wfh rfh efh)}; $self->trace_msg("_connection_kill: closing write handle\n",0) if $self->trace; # closing the write file handle should be enough, generally close $wfh; # in future we may want to be more aggressive #close $rfh; close $efh; kill 15, $pid # but deleting from the persist cache... delete $persist{ $self->_connection_key }; # ... and removing the connection_info should suffice $self->connection_info( undef ); return; } sub _make_connection { my ($self) = @_; my $go_perl = $self->go_perl; my $cmd = [ @$go_perl, qw(-MDBI::Gofer::Transport::stream -e run_stdio_hex)]; #push @$cmd, "DBI_TRACE=2=/tmp/goferstream.log", "sh", "-c"; if (my $url = $self->go_url) { die "Only 'ssh:user\@host' style url supported by this transport" unless $url =~ s/^ssh://; my $ssh = $url; my $setup_env = join "||", map { "source $_ 2>/dev/null" } qw(.bash_profile .bash_login .profile); my $setup = $setup_env.q{; exec "$@"}; # don't use $^X on remote system by default as it's possibly wrong $cmd->[0] = 'perl' if "@$go_perl" eq $^X; # -x not only 'Disables X11 forwarding' but also makes connections *much* faster unshift @$cmd, qw(ssh -xq), split(' ', $ssh), qw(bash -c), $setup; } $self->trace_msg("new connection: @$cmd\n",0) if $self->trace; # XXX add a handshake - some message from DBI::Gofer::Transport::stream that's # sent as soon as it starts that we can wait for to report success - and soak up # and report useful warnings etc from ssh before we get it? Increases latency though. my $connection = $self->start_pipe_command($cmd); return $connection; } sub transmit_request_by_transport { my ($self, $request) = @_; my $trace = $self->trace; my $connection = $self->connection_info || do { my $con = $self->_connection_get; $self->connection_info( $con ); $con; }; my $encoded_request = unpack("H*", $self->freeze_request($request)); $encoded_request .= "\015\012"; my $wfh = $connection->{wfh}; $self->trace_msg(sprintf("transmit_request_by_transport: to fh %s fd%d\n", $wfh, fileno($wfh)),0) if $trace >= 4; # send frozen request local $\; $wfh->print($encoded_request) # autoflush enabled or do { my $err = $!; # XXX could/should make new connection and retry $self->_connection_kill; die "Error sending request: $err"; }; $self->trace_msg("Request sent: $encoded_request\n",0) if $trace >= 4; return undef; # indicate no response yet (so caller calls receive_response_by_transport) } sub receive_response_by_transport { my $self = shift; my $trace = $self->trace; $self->trace_msg("receive_response_by_transport: awaiting response\n",0) if $trace >= 4; my $connection = $self->connection_info || die; my ($pid, $rfh, $efh, $cmd) = @{$connection}{qw(pid rfh efh cmd)}; my $errno = 0; my $encoded_response; my $stderr_msg; $self->read_response_from_fh( { $efh => { error => sub { warn "error reading response stderr: $!"; $errno||=$!; 1 }, eof => sub { warn "eof reading efh" if $trace >= 4; 1 }, read => sub { $stderr_msg .= $_; 0 }, }, $rfh => { error => sub { warn "error reading response: $!"; $errno||=$!; 1 }, eof => sub { warn "eof reading rfh" if $trace >= 4; 1 }, read => sub { $encoded_response .= $_; ($encoded_response=~s/\015\012$//) ? 1 : 0 }, }, }); # if we got no output on stdout at all then the command has # probably exited, possibly with an error to stderr. # Turn this situation into a reasonably useful DBI error. if (not $encoded_response) { my @msg; push @msg, "error while reading response: $errno" if $errno; if ($stderr_msg) { chomp $stderr_msg; push @msg, sprintf "error reported by \"%s\" (pid %d%s): %s", $self->cmd_as_string, $pid, ((kill 0, $pid) ? "" : ", exited"), $stderr_msg; } die join(", ", "No response received", @msg)."\n"; } $self->trace_msg("Response received: $encoded_response\n",0) if $trace >= 4; $self->trace_msg("Gofer stream stderr message: $stderr_msg\n",0) if $stderr_msg && $trace; my $frozen_response = pack("H*", $encoded_response); # XXX need to be able to detect and deal with corruption my $response = $self->thaw_response($frozen_response); if ($stderr_msg) { # add stderr messages as warnings (for PrintWarn) $response->add_err(0, $stderr_msg, undef, $trace) # but ignore warning from old version of blib unless $stderr_msg =~ /^Using .*blib/ && "@$cmd" =~ /-Mblib/; } return $response; } sub transport_timedout { my $self = shift; $self->_connection_kill; return $self->SUPER::transport_timedout(@_); } 1; __END__ =head1 NAME DBD::Gofer::Transport::stream - DBD::Gofer transport for stdio streaming =head1 SYNOPSIS DBI->connect('dbi:Gofer:transport=stream;url=ssh:username@host.example.com;dsn=dbi:...',...) or, enable by setting the DBI_AUTOPROXY environment variable: export DBI_AUTOPROXY='dbi:Gofer:transport=stream;url=ssh:username@host.example.com' =head1 DESCRIPTION Without the C parameter it launches a subprocess as perl -MDBI::Gofer::Transport::stream -e run_stdio_hex and feeds requests into it and reads responses from it. But that's not very useful. With a C parameter it uses ssh to launch the subprocess on a remote system. That's much more useful! It gives you secure remote access to DBI databases on any system you can login to. Using ssh also gives you optional compression and many other features (see the ssh manual for how to configure that and many other options via ~/.ssh/config file). The actual command invoked is something like: ssh -xq ssh:username@host.example.com bash -c $setup $run where $run is the command shown above, and $command is . .bash_profile 2>/dev/null || . .bash_login 2>/dev/null || . .profile 2>/dev/null; exec "$@" which is trying (in a limited and fairly unportable way) to setup the environment (PATH, PERL5LIB etc) as it would be if you had logged in to that system. The "C" used in the command will default to the value of $^X when not using ssh. On most systems that's the full path to the perl that's currently executing. =head1 PERSISTENCE Currently gofer stream connections persist (remain connected) after all database handles have been disconnected. This makes later connections in the same process very fast. Currently up to 5 different gofer stream connections (based on url) can persist. If more than 5 are in the cache when a new connection is made then the cache is cleared before adding the new connection. Simple but effective. =head1 TO DO Document go_perl attribute Automatically reconnect (within reason) if there's a transport error. Decide on default for persistent connection - on or off? limits? ttl? =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 SEE ALSO L L =cut DBI-1.648/lib/DBD/Gofer/Policy/0000755000031300001440000000000015210302710015016 5ustar00merijnusersDBI-1.648/lib/DBD/Gofer/Policy/Base.pm0000644000031300001440000001174014656646601016260 0ustar00merijnuserspackage DBD::Gofer::Policy::Base; # $Id: Base.pm 10087 2007-10-16 12:42:37Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; use Carp; our $VERSION = "0.010088"; our $AUTOLOAD; my %policy_defaults = ( # force connect method (unless overridden by go_connect_method=>'...' attribute) # if false: call same method on client as on server connect_method => 'connect', # force prepare method (unless overridden by go_prepare_method=>'...' attribute) # if false: call same method on client as on server prepare_method => 'prepare', skip_connect_check => 0, skip_default_methods => 0, skip_prepare_check => 0, skip_ping => 0, dbh_attribute_update => 'every', dbh_attribute_list => ['*'], locally_quote => 0, locally_quote_identifier => 0, cache_parse_trace_flags => 1, cache_parse_trace_flag => 1, cache_data_sources => 1, cache_type_info_all => 1, cache_tables => 0, cache_table_info => 0, cache_column_info => 0, cache_primary_key_info => 0, cache_foreign_key_info => 0, cache_statistics_info => 0, cache_get_info => 0, cache_func => 0, ); my $base_policy_file = $INC{"DBD/Gofer/Policy/Base.pm"}; __PACKAGE__->create_policy_subs(\%policy_defaults); sub create_policy_subs { my ($class, $policy_defaults) = @_; while ( my ($policy_name, $policy_default) = each %$policy_defaults) { my $policy_attr_name = "go_$policy_name"; my $sub = sub { # $policy->foo($attr, ...) #carp "$policy_name($_[1],...)"; # return the policy default value unless an attribute overrides it return (ref $_[1] && exists $_[1]->{$policy_attr_name}) ? $_[1]->{$policy_attr_name} : $policy_default; }; no strict 'refs'; *{$class . '::' . $policy_name} = $sub; } } sub AUTOLOAD { carp "Unknown policy name $AUTOLOAD used"; # only warn once no strict 'refs'; *$AUTOLOAD = sub { undef }; return undef; } sub new { my ($class, $args) = @_; my $policy = {}; bless $policy, $class; } sub DESTROY { }; 1; =head1 NAME DBD::Gofer::Policy::Base - Base class for DBD::Gofer policies =head1 SYNOPSIS $dbh = DBI->connect("dbi:Gofer:transport=...;policy=...", ...) =head1 DESCRIPTION DBD::Gofer can be configured via a 'policy' mechanism that allows you to fine-tune the number of round-trips to the Gofer server. The policies are grouped into classes (which may be subclassed) and referenced by the name of the class. The L class is the base class for all the policy classes and describes all the individual policy items. The Base policy is not used directly. You should use a policy class derived from it. =head1 POLICY CLASSES Three policy classes are supplied with DBD::Gofer: L is most 'transparent' but slowest because it makes more round-trips to the Gofer server. L is a reasonable compromise - it's the default policy. L is fastest, but may require code changes in your applications. Generally the default C policy is fine. When first testing an existing application with Gofer it is a good idea to start with the C policy first and then switch to C or a custom policy, for final testing. =head1 POLICY ITEMS These are temporary docs: See the source code for list of policies and their defaults. In a future version the policies and their defaults will be defined in the pod and parsed out at load-time. See the source code to this module for more details. =head1 POLICY CUSTOMIZATION XXX This area of DBD::Gofer is subject to change. There are three ways to customize policies: Policy classes are designed to influence the overall behaviour of DBD::Gofer with existing, unaltered programs, so they work in a reasonably optimal way without requiring code changes. You can implement new policy classes as subclasses of existing policies. In many cases individual policy items can be overridden on a case-by-case basis within your application code. You do this by passing a corresponding C<>> attribute into DBI methods by your application code. This lets you fine-tune the behaviour for special cases. The policy items are implemented as methods. In many cases the methods are passed parameters relating to the DBD::Gofer code being executed. This means the policy can implement dynamic behaviour that varies depending on the particular circumstances, such as the particular statement being executed. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =cut DBI-1.648/lib/DBD/Gofer/Policy/pedantic.pm0000644000031300001440000000263312153146731017163 0ustar00merijnuserspackage DBD::Gofer::Policy::pedantic; # $Id: pedantic.pm 10087 2007-10-16 12:42:37Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; our $VERSION = "0.010088"; use base qw(DBD::Gofer::Policy::Base); # the 'pedantic' policy is the same as the Base policy 1; =head1 NAME DBD::Gofer::Policy::pedantic - The 'pedantic' policy for DBD::Gofer =head1 SYNOPSIS $dbh = DBI->connect("dbi:Gofer:transport=...;policy=pedantic", ...) =head1 DESCRIPTION The C policy tries to be as transparent as possible. To do this it makes round-trips to the server for almost every DBI method call. This is the best policy to use when first testing existing code with Gofer. Once it's working well you should consider moving to the C policy or defining your own policy class. Temporary docs: See the source code for list of policies and their defaults. In a future version the policies and their defaults will be defined in the pod and parsed out at load-time. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =cut DBI-1.648/lib/DBD/Gofer/Policy/classic.pm0000644000031300001440000000407214742423677017031 0ustar00merijnuserspackage DBD::Gofer::Policy::classic; # $Id: classic.pm 10087 2007-10-16 12:42:37Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; our $VERSION = "0.010088"; use base qw(DBD::Gofer::Policy::Base); __PACKAGE__->create_policy_subs({ # always use connect_cached on server connect_method => 'connect_cached', # use same methods on server as is called on client prepare_method => '', # don't skip the connect check since that also sets dbh attributes # although this makes connect more expensive, that's partly offset # by skip_ping=>1 below, which makes connect_cached very fast. skip_connect_check => 0, # most code doesn't rely on sth attributes being set after prepare skip_prepare_check => 1, # we're happy to use local method if that's the same as the remote skip_default_methods => 1, # ping is not important for DBD::Gofer and most transports skip_ping => 1, # only update dbh attributes on first contact with server dbh_attribute_update => 'first', # we'd like to set locally_* but can't because drivers differ # get_info results usually don't change cache_get_info => 1, }); 1; =head1 NAME DBD::Gofer::Policy::classic - The 'classic' policy for DBD::Gofer =head1 SYNOPSIS $dbh = DBI->connect("dbi:Gofer:transport=...;policy=classic", ...) The C policy is the default DBD::Gofer policy, so need not be included in the DSN. =head1 DESCRIPTION Temporary docs: See the source code for list of policies and their defaults. In a future version the policies and their defaults will be defined in the pod and parsed out at load-time. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =cut DBI-1.648/lib/DBD/Gofer/Policy/rush.pm0000644000031300001440000000504514742423677016372 0ustar00merijnuserspackage DBD::Gofer::Policy::rush; # $Id: rush.pm 10087 2007-10-16 12:42:37Z Tim $ # # Copyright (c) 2007, Tim Bunce, Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. use strict; use warnings; our $VERSION = "0.010088"; use base qw(DBD::Gofer::Policy::Base); __PACKAGE__->create_policy_subs({ # always use connect_cached on server connect_method => 'connect_cached', # use same methods on server as is called on client # (because code not using placeholders would bloat the sth cache) prepare_method => '', # Skipping the connect check is fast, but it also skips # fetching the remote dbh attributes! # Make sure that your application doesn't need access to dbh attributes. skip_connect_check => 1, # most code doesn't rely on sth attributes being set after prepare skip_prepare_check => 1, # we're happy to use local method if that's the same as the remote skip_default_methods => 1, # ping is almost meaningless for DBD::Gofer and most transports anyway skip_ping => 1, # don't update dbh attributes at all # XXX actually we currently need dbh_attribute_update for skip_default_methods to work # and skip_default_methods is more valuable to us than the cost of dbh_attribute_update dbh_attribute_update => 'none', # actually means 'first' currently #dbh_attribute_list => undef, # we'd like to set locally_* but can't because drivers differ # in a rush assume metadata doesn't change cache_tables => 1, cache_table_info => 1, cache_column_info => 1, cache_primary_key_info => 1, cache_foreign_key_info => 1, cache_statistics_info => 1, cache_get_info => 1, }); 1; =head1 NAME DBD::Gofer::Policy::rush - The 'rush' policy for DBD::Gofer =head1 SYNOPSIS $dbh = DBI->connect("dbi:Gofer:transport=...;policy=rush", ...) =head1 DESCRIPTION The C policy tries to make as few round-trips as possible. It's the opposite end of the policy spectrum to the C policy. Temporary docs: See the source code for list of policies and their defaults. In a future version the policies and their defaults will be defined in the pod and parsed out at load-time. =head1 AUTHOR Tim Bunce, L =head1 LICENCE AND COPYRIGHT Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =cut DBI-1.648/lib/DBD/File/0000755000031300001440000000000015210302710013374 5ustar00merijnusersDBI-1.648/lib/DBD/File/Roadmap.pod0000644000031300001440000001347312127465144015512 0ustar00merijnusers=head1 NAME DBD::File::Roadmap - Planned Enhancements for DBD::File and pure Perl DBD's Jens Rehsack - May 2010 =head1 SYNOPSIS This document gives a high level overview of the future of the DBD::File DBI driver and groundwork for pure Perl DBI drivers. The planned enhancements cover features, testing, performance, reliability, extensibility and more. =head1 CHANGES AND ENHANCEMENTS =head2 Features There are some features missing we would like to add, but there is no time plan: =over 4 =item LOCK TABLE The newly implemented internal common table meta storage area would allow us to implement LOCK TABLE support based on file system C support. =item Transaction support While DBD::AnyData recommends explicitly committing by importing and exporting tables, DBD::File might be enhanced in a future version to allow transparent transactions using the temporary tables of SQL::Statement as shadow (dirty) tables. Transaction support will heavily rely on lock table support. =item Data Dictionary Persistence SQL::Statement provides dictionary information when a "CREATE TABLE ..." statement is executed. This dictionary is preserved for some statement handle attribute fetches (as C or C). It is planned to extend DBD::File to support data dictionaries to work on the tables in it. It is not planned to support one table in different dictionaries, but you can have several dictionaries in one directory. =item SQL Engine selecting on connect Currently the SQL engine selected is chosen during the loading of the module L. Ideally end users should be able to select the engine used in C<< DBI->connect () >> with a special DBD::File attribute. =back Other points of view to the planned features (and more features for the SQL::Statement engine) are shown in L. =head2 Testing DBD::File and the dependent DBD::DBM requires a lot more automated tests covering API stability and compatibility with optional modules like SQL::Statement. =head2 Performance Several arguments for support of features like indexes on columns and cursors are made for DBD::CSV (which is a DBD::File based driver, too). Similar arguments could be made for DBD::DBM, DBD::AnyData, DBD::RAM or DBD::PO etc. To improve the performance of the underlying SQL engines, a clean re-implementation seems to be required. Currently both engines are prematurely optimized and therefore it is not trivial to provide further optimization without the risk of breaking existing features. Join the DBI developers IRC channel at L to participate or post to the DBI Developers Mailing List. =head2 Reliability DBD::File currently lacks the following points: =over 4 =item duplicate table names It is currently possible to access a table quoted with a relative path (a) and additionally using an absolute path (b). If (a) and (b) are the same file that is not recognized (except for flock protection handled by the Operating System) and two independent tables are handled. =item invalid table names The current implementation does not prevent someone choosing a directory name as a physical file name for the table to open. =back =head2 Extensibility I (Jens Rehsack) have some (partially for example only) DBD's in mind: =over 4 =item DBD::Sys Derive DBD::Sys from a common code base shared with DBD::File which handles all the emulation DBI needs (as getinfo, SQL engine handling, ...) =item DBD::Dir Provide a DBD::File derived to work with fixed table definitions through the file system to demonstrate how DBI / Pure Perl DBDs could handle databases with hierarchical structures. =item DBD::Join Provide a DBI driver which is able to manage multiple connections to other Databases (as DBD::Multiplex), but allow them to point to different data sources and allow joins between the tables of them: # Example # Let table 'lsof' being a table in DBD::Sys giving a list of open files using lsof utility # Let table 'dir' being a atable from DBD::Dir $sth = $dbh->prepare( "select * from dir,lsof where path='/documents' and dir.entry = lsof.filename" ) $sth->execute(); # gives all open files in '/documents' ... # Let table 'filesys' a DBD::Sys table of known file systems on current host # Let table 'applications' a table of your Configuration Management Database # where current applications (relocatable, with mountpoints for filesystems) # are stored $sth = dbh->prepare( "select * from applications,filesys where " . "application.mountpoint = filesys.mountpoint and ". "filesys.mounted is true" ); $sth->execute(); # gives all currently mounted applications on this host =back =head1 PRIORITIES Our priorities are focused on current issues. Initially many new test cases for DBD::File and DBD::DBM should be added to the DBI test suite. After that some additional documentation on how to use the DBD::File API will be provided. Any additional priorities will come later and can be modified by (paying) users. =head1 RESOURCES AND CONTRIBUTIONS See L for I. If your company has benefited from DBI, please consider if it could make a donation to The Perl Foundation "DBI Development" fund at L to secure future development. Alternatively, if your company would benefit from a specific new DBI feature, please consider sponsoring it's development through the options listed in the section "Commercial Support from the Author" on L. Using such targeted financing allows you to contribute to DBI development and rapidly get something specific and directly valuable to you in return. My company also offers annual support contracts for the DBI, which provide another way to support the DBI and get something specific in return. Contact me for details. Thank you. =cut DBI-1.648/lib/DBD/File/HowTo.pod0000644000031300001440000001135615206260124015155 0ustar00merijnusers=head1 NAME DBD::File::HowTo - Guide to create DBD::File based driver =head1 SYNOPSIS perldoc DBD::File::HowTo perldoc DBI perldoc DBI::DBD perldoc DBD::File::Developers perldoc DBI::DBD::SqlEngine::Developers perldoc DBI::DBD::SqlEngine perldoc SQL::Eval perldoc DBI::DBD::SqlEngine::HowTo perldoc SQL::Statement::Embed perldoc DBD::File perldoc DBD::File::HowTo perldoc DBD::File::Developers =head1 DESCRIPTION This document provides a step-by-step guide, how to create a new C based DBD. It expects that you carefully read the L documentation and that you're familiar with L and had read and understood L. This document addresses experienced developers who are really sure that they need to invest time when writing a new DBI Driver. Writing a DBI Driver is neither a weekend project nor an easy job for hobby coders after work. Expect one or two man-month of time for the first start. Those who are still reading, should be able to sing the rules of L. Of course, DBD::File is a DBI::DBD::SqlEngine and you surely read L before continuing here. =head1 CREATING DRIVER CLASSES Do you have an entry in DBI's DBD registry? For this guide, a prefix of C is assumed. =head2 Sample Skeleton package DBD::Foo; use strict; use warnings; use base qw(DBD::File); use DBI (); our $VERSION = "0.001"; package DBD::Foo::dr; our @ISA = qw(DBD::File::dr); our $imp_data_size = 0; package DBD::Foo::db; our @ISA = qw(DBD::File::db); our $imp_data_size = 0; package DBD::Foo::st; our @ISA = qw(DBD::File::st); our $imp_data_size = 0; package DBD::Foo::Statement; our @ISA = qw(DBD::File::Statement); package DBD::Foo::Table; our @ISA = qw(DBD::File::Table); 1; Tiny, eh? And all you have now is a DBD named foo which will be able to deal with temporary tables, as long as you use L. In L environments, this DBD can do nothing. =head2 Start over Based on L, we're now having a driver which could do basic things. Of course, it should now derive from DBD::File instead of DBI::DBD::SqlEngine, shouldn't it? DBD::File extends DBI::DBD::SqlEngine to deal with any kind of files. In principle, the only extensions required are to the table class: package DBD::Foo::Table; sub bootstrap_table_meta { my ($self, $dbh, $meta, $table) = @_; # initialize all $meta attributes which might be relevant for # file2table return $self->SUPER::bootstrap_table_meta ($dbh, $meta, $table); } sub init_table_meta { my ($self, $dbh, $meta, $table) = @_; # called after $meta contains the results from file2table # initialize all missing $meta attributes $self->SUPER::init_table_meta ($dbh, $meta, $table); } In case C doesn't open the files as the driver needs that, override it! sub open_file { my ($self, $meta, $attrs, $flags) = @_; # ensure that $meta->{f_dontopen} is set $self->SUPER::open_file ($meta, $attrs, $flags); # now do what ever needs to be done } Combined with the methods implemented using the L guide, the table is full working and you could try a start over. =head2 User comfort C since C<0.39> consolidates all persistent meta data of a table into a single structure stored in C<< $dbh->{f_meta} >>. With C version C<0.41> and C version C<0.05>, this consolidation moves to L. It's still the C<< $dbh->{$drv_prefix . "_meta"} >> attribute which cares, so what you learned at this place before, is still valid. sub init_valid_attributes { my $dbh = $_[0]; $dbh->SUPER::init_valid_attributes (); $dbh->{foo_valid_attrs} = { ... }; $dbh->{foo_readonly_attrs} = { ... }; $dbh->{foo_meta} = "foo_tables"; return $dbh; } See updates at L. =head2 Testing Now you should have your own DBD::File based driver. Was easy, wasn't it? But does it work well? Prove it by writing tests and remember to use dbd_edit_mm_attribs from L to ensure testing even rare cases. =head1 AUTHOR This guide is written by Jens Rehsack. DBD::File is written by Jochen Wiedmann and Jeff Zucker. The module DBD::File is currently maintained by H.Merijn Brand < hmbrand at cpan.org > and Jens Rehsack < rehsack at googlemail.com > =head1 COPYRIGHT AND LICENSE Copyright (C) 2010-2026 by H.Merijn Brand & Jens Rehsack All rights reserved. You may freely distribute and/or modify this module under the terms of either the GNU General Public License (GPL) or the Artistic License, as specified in the Perl README file. =cut DBI-1.648/lib/DBD/File/Developers.pod0000644000031300001440000005013315206257704016233 0ustar00merijnusers=head1 NAME DBD::File::Developers - Developers documentation for DBD::File =head1 SYNOPSIS package DBD::myDriver; use base qw( DBD::File ); sub driver { ... my $drh = $proto->SUPER::driver ($attr); ... return $drh->{class}; } sub CLONE { ... } package DBD::myDriver::dr; @ISA = qw( DBD::File::dr ); sub data_sources { ... } ... package DBD::myDriver::db; @ISA = qw( DBD::File::db ); sub init_valid_attributes { ... } sub init_default_attributes { ... } sub set_versions { ... } sub validate_STORE_attr { my ($dbh, $attrib, $value) = @_; ... } sub validate_FETCH_attr { my ($dbh, $attrib) = @_; ... } sub get_myd_versions { ... } package DBD::myDriver::st; @ISA = qw( DBD::File::st ); sub FETCH { ... } sub STORE { ... } package DBD::myDriver::Statement; @ISA = qw( DBD::File::Statement ); package DBD::myDriver::Table; @ISA = qw( DBD::File::Table ); my %reset_on_modify = ( myd_abc => "myd_foo", myd_mno => "myd_bar", ); __PACKAGE__->register_reset_on_modify (\%reset_on_modify); my %compat_map = ( abc => 'foo_abc', xyz => 'foo_xyz', ); __PACKAGE__->register_compat_map (\%compat_map); sub bootstrap_table_meta { ... } sub init_table_meta { ... } sub table_meta_attr_changed { ... } sub open_data { ... } sub fetch_row { ... } sub push_row { ... } sub push_names { ... } # optimize the SQL engine by add one or more of sub update_current_row { ... } # or sub update_specific_row { ... } # or sub update_one_row { ... } # or sub insert_new_row { ... } # or sub delete_current_row { ... } # or sub delete_one_row { ... } =head1 DESCRIPTION This document describes how DBD developers can write DBD::File based DBI drivers. It supplements L and L, which you should read first. =head1 CLASSES Each DBI driver must provide a package global C method and three DBI related classes: =over 4 =item DBD::File::dr Driver package, contains the methods DBI calls indirectly via DBI interface: DBI->connect ('DBI:DBM:', undef, undef, {}) # invokes package DBD::DBM::dr; @DBD::DBM::dr::ISA = qw( DBD::File::dr ); sub connect ($$;$$$) { ... } Similar for C<< data_sources >> and C<< disconnect_all >>. Pure Perl DBI drivers derived from DBD::File do not usually need to override any of the methods provided through the DBD::XXX::dr package however if you need additional initialization in the connect method you may need to. =item DBD::File::db Contains the methods which are called through DBI database handles (C<< $dbh >>). e.g., $sth = $dbh->prepare ("select * from foo"); # returns the f_encoding setting for table foo $dbh->csv_get_meta ("foo", "f_encoding"); DBD::File provides the typical methods required here. Developers who write DBI drivers based on DBD::File need to override the methods C<< set_versions >> and C<< init_valid_attributes >>. =item DBD::File::st Contains the methods to deal with prepared statement handles. e.g., $sth->execute () or die $sth->errstr; =back =head2 DBD::File This is the main package containing the routines to initialize DBD::File based DBI drivers. Primarily the C<< DBD::File::driver >> method is invoked, either directly from DBI when the driver is initialized or from the derived class. package DBD::DBM; use base qw( DBD::File ); sub driver { my ($class, $attr) = @_; ... my $drh = $class->SUPER::driver ($attr); ... return $drh; } It is not necessary to implement your own driver method as long as additional initialization (e.g. installing more private driver methods) is not required. You do not need to call C<< setup_driver >> as DBD::File takes care of it. =head2 DBD::File::dr The driver package contains the methods DBI calls indirectly via the DBI interface (see L). DBD::File based DBI drivers usually do not need to implement anything here, it is enough to do the basic initialization: package DBD:XXX::dr; @DBD::XXX::dr::ISA = qw (DBD::File::dr); $DBD::XXX::dr::imp_data_size = 0; $DBD::XXX::dr::data_sources_attr = undef; $DBD::XXX::ATTRIBUTION = "DBD::XXX $DBD::XXX::VERSION by Hans Mustermann"; =head2 DBD::File::db This package defines the database methods, which are called via the DBI database handle C<< $dbh >>. Methods provided by DBD::File: =over 4 =item ping Simply returns the content of the C<< Active >> attribute. Override when your driver needs more complicated actions here. =item prepare Prepares a new SQL statement to execute. Returns a statement handle, C<< $sth >> - instance of the DBD:XXX::st. It is neither required nor recommended to override this method. =item FETCH Fetches an attribute of a DBI database object. Private handle attributes must have a prefix (this is mandatory). If a requested attribute is detected as a private attribute without a valid prefix, the driver prefix (written as C<$drv_prefix>) is added. The driver prefix is extracted from the attribute name and verified against C<< $dbh->{$drv_prefix . "valid_attrs"} >> (when it exists). If the requested attribute value is not listed as a valid attribute, this method croaks. If the attribute is valid and readonly (listed in C<< $dbh->{ $drv_prefix . "readonly_attrs" } >> when it exists), a real copy of the attribute value is returned. So it's not possible to modify C from outside of DBD::File::db or a derived class. =item STORE Stores a database private attribute. Private handle attributes must have a prefix (this is mandatory). If a requested attribute is detected as a private attribute without a valid prefix, the driver prefix (written as C<$drv_prefix>) is added. If the database handle has an attribute C<${drv_prefix}_valid_attrs> - for attribute names which are not listed in that hash, this method croaks. If the database handle has an attribute C<${drv_prefix}_readonly_attrs>, only attributes which are not listed there can be stored (once they are initialized). Trying to overwrite such an immutable attribute forces this method to croak. An example of a valid attributes list can be found in C<< DBD::File::db::init_valid_attributes >>. =item set_versions This method sets the attribute C with the version of DBD::File. This method is called at the begin of the C phase. When overriding this method, do not forget to invoke the superior one. =item init_valid_attributes This method is called after the database handle is instantiated as the first attribute initialization. C<< DBD::File::db::init_valid_attributes >> initializes the attributes C and C. When overriding this method, do not forget to invoke the superior one, preferably before doing anything else. Compatibility table attribute access must be initialized here to allow DBD::File to instantiate the map tie: # for DBD::CSV $dbh->{csv_meta} = "csv_tables"; # for DBD::DBM $dbh->{dbm_meta} = "dbm_tables"; # for DBD::AnyData $dbh->{ad_meta} = "ad_tables"; =item init_default_attributes This method is called after the database handle is instantiated to initialize the default attributes. C<< DBD::File::db::init_default_attributes >> initializes the attributes C, C, C, C. When the derived implementor class provides the attribute to validate attributes (e.g. C<< $dbh->{dbm_valid_attrs} = {...}; >>) or the attribute containing the immutable attributes (e.g. C<< $dbh->{dbm_readonly_attrs} = {...}; >>), the attributes C, C, C and C are added (when available) to the list of valid and immutable attributes (where C is interpreted as the driver prefix). If C is set, an attribute with the name in C is initialized providing restricted read/write access to the meta data of the tables using C in the first (table) level and C for the meta attribute level. C uses C to initialize the second level tied hash on FETCH/STORE. The C class uses C to FETCH attribute values and C to STORE attribute values. This allows it to map meta attributes for compatibility reasons. =item get_single_table_meta =item get_file_meta Retrieve an attribute from a table's meta information. The method signature is C<< get_file_meta ($dbh, $table, $attr) >>. This method is called by the injected db handle method C<< ${drv_prefix}get_meta >>. While get_file_meta allows C<$table> or C<$attr> to be a list of tables or attributes to retrieve, get_single_table_meta allows only one table name and only one attribute name. A table name of C<'.'> (single dot) is interpreted as the default table and this will retrieve the appropriate attribute globally from the dbh. This has the same restrictions as C<< $dbh->{$attrib} >>. get_file_meta allows C<'+'> and C<'*'> as wildcards for table names and C<$table> being a regular expression matching against the table names (evaluated without the default table). The table name C<'*'> is I. The table name C<'+'> is I (/^[_A-Za-z0-9]+$/). The table meta information is retrieved using the get_table_meta and get_table_meta_attr methods of the table class of the implementation. =item set_single_table_meta =item set_file_meta Sets an attribute in a table's meta information. The method signature is C<< set_file_meta ($dbh, $table, $attr, $value) >>. This method is called by the injected db handle method C<< ${drv_prefix}set_meta >>. While set_file_meta allows C<$table> to be a list of tables and C<$attr> to be a hash of several attributes to set, set_single_table_meta allows only one table name and only one attribute name/value pair. The wildcard characters for the table name are the same as for get_file_meta. The table meta information is updated using the get_table_meta and set_table_meta_attr methods of the table class of the implementation. =item clear_file_meta Clears all meta information cached about a table. The method signature is C<< clear_file_meta ($dbh, $table) >>. This method is called by the injected db handle method C<< ${drv_prefix}clear_meta >>. =back =head2 DBD::File::st Contains the methods to deal with prepared statement handles: =over 4 =item FETCH Fetches statement handle attributes. Supported attributes (for full overview see L) are C, C, C and C in case that SQL::Statement is used as SQL execution engine and a statement is successful prepared. When SQL::Statement has additional information about a table, those information are returned. Otherwise, the same defaults as in L are used. This method usually requires extending in a derived implementation. See L or L for some example. =back =head2 DBD::File::TableSource::FileSystem Provides data sources and table information on database driver and database handle level. package DBD::File::TableSource::FileSystem; sub data_sources ($;$) { my ($class, $drh, $attrs) = @_; ... } sub avail_tables { my ($class, $drh) = @_; ... } The C method is called when the user invokes any of the following: @ary = DBI->data_sources ($driver); @ary = DBI->data_sources ($driver, \%attr); @ary = $dbh->data_sources (); @ary = $dbh->data_sources (\%attr); The C method is called when the user invokes any of the following: @names = $dbh->tables ($catalog, $schema, $table, $type); $sth = $dbh->table_info ($catalog, $schema, $table, $type); $sth = $dbh->table_info ($catalog, $schema, $table, $type, \%attr); $dbh->func ("list_tables"); Every time where an C<\%attr> argument can be specified, this C<\%attr> object's C attribute is preferred over the C<$dbh> attribute or the driver default. =head2 DBD::File::DataSource::Stream package DBD::File::DataSource::Stream; @DBD::File::DataSource::Stream::ISA = 'DBI::DBD::SqlEngine::DataSource'; sub complete_table_name { my ($self, $meta, $file, $respect_case) = @_; ... } Clears all meta attributes identifying a file: C, C and C. The table name is set according to C<$respect_case> and C<< $meta->{sql_identifier_case} >> (SQL_IC_LOWER, SQL_IC_UPPER). package DBD::File::DataSource::Stream; sub apply_encoding { my ($self, $meta, $fn) = @_; ... } Applies the encoding from I (C<< $meta->{f_encoding} >>) to the file handled opened in C. package DBD::File::DataSource::Stream; sub open_data { my ($self, $meta, $attrs, $flags) = @_; ... } Opens (C) the file handle provided in C<< $meta->{f_file} >>. package DBD::File::DataSource::Stream; sub can_flock { ... } Returns whether C is available or not (avoids retesting in subclasses). =head2 DBD::File::DataSource::File package DBD::File::DataSource::File; sub complete_table_name ($$;$) { my ($self, $meta, $table, $respect_case) = @_; ... } The method C tries to map a filename to the associated table name. It is called with a partially filled meta structure for the resulting table containing at least the following attributes: C<< f_ext >>, C<< f_dir >>, C<< f_lockfile >> and C<< sql_identifier_case >>. If a file/table map can be found then this method sets the C<< f_fqfn >>, C<< f_fqbn >>, C<< f_fqln >> and C<< table_name >> attributes in the meta structure. If a map cannot be found the table name will be undef. package DBD::File::DataSource::File; sub open_data ($) { my ($self, $meta, $attrs, $flags) = @_; ... } Depending on the attributes set in the table's meta data, the following steps are performed. Unless C<< f_dontopen >> is set to a true value, C<< f_fqfn >> must contain the full qualified file name for the table to work on (file2table ensures this). The encoding in C<< f_encoding >> is applied if set and the file is opened. If C<> (full qualified lock name) is set, this file is opened, too. Depending on the value in C<< f_lock >>, the appropriate lock is set on the opened data file or lock file. =head2 DBD::File::Statement Derives from DBI::SQL::Nano::Statement to provide following method: =over 4 =item open_table Implements the open_table method required by L and L. All the work for opening the file(s) belonging to the table is handled and parametrized in DBD::File::Table. Unless you intend to add anything to the following implementation, an empty DBD::XXX::Statement package satisfies DBD::File. sub open_table ($$$$$) { my ($self, $data, $table, $createMode, $lockMode) = @_; my $class = ref $self; $class =~ s/::Statement/::Table/; my $flags = { createMode => $createMode, lockMode => $lockMode, }; $self->{command} eq "DROP" and $flags->{dropMode} = 1; return $class->new ($data, { table => $table }, $flags); } # open_table =back =head2 DBD::File::Table Derives from DBI::SQL::Nano::Table and provides physical file access for the table data which are stored in the files. =over 4 =item bootstrap_table_meta Initializes a table meta structure. Can be safely overridden in a derived class, as long as the C<< SUPER >> method is called at the end of the overridden method. It copies the following attributes from the database into the table meta data C<< f_dir >>, C<< f_ext >>, C<< f_encoding >>, C<< f_lock >>, C<< f_schema >> and C<< f_lockfile >> and makes them sticky to the table. This method should be called before you attempt to map between file name and table name to ensure the correct directory, extension etc. are used. =item init_table_meta Initializes more attributes of the table meta data - usually more expensive ones (e.g. those which require class instantiations) - when the file name and the table name could mapped. =item get_table_meta Returns the table meta data. If there are none for the required table, a new one is initialized. When it fails, nothing is returned. On success, the name of the table and the meta data structure is returned. =item get_table_meta_attr Returns a single attribute from the table meta data. If the attribute name appears in C<%compat_map>, the attribute name is updated from there. =item set_table_meta_attr Sets a single attribute in the table meta data. If the attribute name appears in C<%compat_map>, the attribute name is updated from there. =item table_meta_attr_changed Called when an attribute of the meta data is modified. If the modified attribute requires to reset a calculated attribute, the calculated attribute is reset (deleted from meta data structure) and the I flag is removed, too. The decision is made based on C<%register_reset_on_modify>. =item register_reset_on_modify Allows C to reset meta attributes when special attributes are modified. For DBD::File, modifying one of C, C, C or C will reset C. DBD::DBM extends the list for C and C to reset the value of C. If your DBD has calculated values in the meta data area, then call C: my %reset_on_modify = (xxx_foo => "xxx_bar"); __PACKAGE__->register_reset_on_modify (\%reset_on_modify); =item register_compat_map Allows C and C to update the attribute name to the current favored one: # from DBD::DBM my %compat_map = (dbm_ext => "f_ext"); __PACKAGE__->register_compat_map (\%compat_map); =item open_file Called to open the table's data file. Depending on the attributes set in the table's meta data, the following steps are performed. Unless C<< f_dontopen >> is set to a true value, C<< f_fqfn >> must contain the full qualified file name for the table to work on (file2table ensures this). The encoding in C<< f_encoding >> is applied if set and the file is opened. If C<> (full qualified lock name) is set, this file is opened, too. Depending on the value in C<< f_lock >>, the appropriate lock is set on the opened data file or lock file. After this is done, a derived class might add more steps in an overridden C<< open_file >> method. =item new Instantiates the table. This is done in 3 steps: 1. get the table meta data 2. open the data file 3. bless the table data structure using inherited constructor new It is not recommended to override the constructor of the table class. Find a reasonable place to add you extensions in one of the above four methods. =item drop Implements the abstract table method for the C<< DROP >> command. Discards table meta data after all files belonging to the table are closed and unlinked. Overriding this method might be reasonable in very rare cases. =item seek Implements the abstract table method used when accessing the table from the engine. C<< seek >> is called every time the engine uses dumb algorithms for iterating over the table content. =item truncate Implements the abstract table method used when dumb table algorithms for C<< UPDATE >> or C<< DELETE >> need to truncate the table storage after the last written row. =back You should consult the documentation of C<< SQL::Eval::Table >> (see L) to get more information about the abstract methods of the table's base class you have to override and a description of the table meta information expected by the SQL engines. =head1 AUTHOR The module DBD::File is currently maintained by H.Merijn Brand < hmbrand at cpan.org > and Jens Rehsack < rehsack at googlemail.com > The original author is Jochen Wiedmann. =head1 COPYRIGHT AND LICENSE Copyright (C) 2010-2026 by H.Merijn Brand & Jens Rehsack All rights reserved. You may freely distribute and/or modify this module under the terms of either the GNU General Public License (GPL) or the Artistic License, as specified in the Perl README file. =cut DBI-1.648/lib/DBD/ExampleP.pm0000644000031300001440000003021714656646601014620 0ustar00merijnusers{ package DBD::ExampleP; use strict; use warnings; use Symbol; use DBI qw(:sql_types); require File::Spec; our (@EXPORT,$VERSION,@statnames,%statnames,@stattypes,%stattypes, @statprec,%statprec,$drh,); @EXPORT = qw(); # Do NOT @EXPORT anything. $VERSION = "12.014311"; # $Id: ExampleP.pm 14310 2010-08-02 06:35:25Z Jens $ # # Copyright (c) 1994,1997,1998 Tim Bunce # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. @statnames = qw(dev ino mode nlink uid gid rdev size atime mtime ctime blksize blocks name); @statnames{@statnames} = (0 .. @statnames-1); @stattypes = (SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_INTEGER, SQL_VARCHAR); @stattypes{@statnames} = @stattypes; @statprec = ((10) x (@statnames-1), 1024); @statprec{@statnames} = @statprec; die unless @statnames == @stattypes; die unless @statprec == @stattypes; $drh = undef; # holds driver handle once initialised #$gensym = "SYM000"; # used by st::execute() for filehandles sub driver{ return $drh if $drh; my($class, $attr) = @_; $class .= "::dr"; ($drh) = DBI::_new_drh($class, { 'Name' => 'ExampleP', 'Version' => $VERSION, 'Attribution' => 'DBD Example Perl stub by Tim Bunce', }, ['example implementors private data '.__PACKAGE__]); $drh; } sub CLONE { undef $drh; } } { package DBD::ExampleP::dr; # ====== DRIVER ====== $imp_data_size = 0; use strict; sub connect { # normally overridden, but a handy default my($drh, $dbname, $user, $auth)= @_; my ($outer, $dbh) = DBI::_new_dbh($drh, { Name => $dbname, examplep_private_dbh_attrib => 42, # an example, for testing }); $dbh->{examplep_get_info} = { 29 => '"', # SQL_IDENTIFIER_QUOTE_CHAR 41 => '.', # SQL_CATALOG_NAME_SEPARATOR 114 => 1, # SQL_CATALOG_LOCATION }; #$dbh->{Name} = $dbname; $dbh->STORE('Active', 1); return $outer; } sub data_sources { return ("dbi:ExampleP:dir=."); # possibly usefully meaningless } } { package DBD::ExampleP::db; # ====== DATABASE ====== $imp_data_size = 0; use strict; sub prepare { my($dbh, $statement)= @_; my @fields; my($fields, $dir) = $statement =~ m/^\s*select\s+(.*?)\s+from\s+(\S*)/i; if (defined $fields and defined $dir) { @fields = ($fields eq '*') ? keys %DBD::ExampleP::statnames : split(/\s*,\s*/, $fields); } else { return $dbh->set_err($DBI::stderr, "Syntax error in select statement (\"$statement\")") unless $statement =~ m/^\s*set\s+/; # the SET syntax is just a hack so the ExampleP driver can # be used to test non-select statements. # Now we have DBI::DBM etc., ExampleP should be deprecated } my ($outer, $sth) = DBI::_new_sth($dbh, { 'Statement' => $statement, examplep_private_sth_attrib => 24, # an example, for testing }, ['example implementors private data '.__PACKAGE__]); my @bad = map { defined $DBD::ExampleP::statnames{$_} ? () : $_ } @fields; return $dbh->set_err($DBI::stderr, "Unknown field names: @bad") if @bad; $outer->STORE('NUM_OF_FIELDS' => scalar(@fields)); $sth->{examplep_ex_dir} = $dir if defined($dir) && $dir !~ /\?/; $outer->STORE('NUM_OF_PARAMS' => ($dir) ? $dir =~ tr/?/?/ : 0); if (@fields) { $outer->STORE('NAME' => \@fields); $outer->STORE('NULLABLE' => [ (0) x @fields ]); $outer->STORE('SCALE' => [ (0) x @fields ]); } $outer; } sub table_info { my $dbh = shift; my ($catalog, $schema, $table, $type) = @_; my @types = split(/["']*,["']/, $type || 'TABLE'); my %types = map { $_=>$_ } @types; # Return a list of all subdirectories my $dh = Symbol::gensym(); # "DBD::ExampleP::".++$DBD::ExampleP::gensym; my $dir = $catalog || File::Spec->curdir(); my @list; if ($types{VIEW}) { # for use by test harness push @list, [ undef, "schema", "table", 'VIEW', undef ]; push @list, [ undef, "sch-ema", "table", 'VIEW', undef ]; push @list, [ undef, "schema", "ta-ble", 'VIEW', undef ]; push @list, [ undef, "sch ema", "table", 'VIEW', undef ]; push @list, [ undef, "schema", "ta ble", 'VIEW', undef ]; } if ($types{TABLE}) { no strict 'refs'; opendir($dh, $dir) or return $dbh->set_err(int($!), "Failed to open directory $dir: $!"); while (defined(my $item = readdir($dh))) { if ($^O eq 'VMS') { # if on VMS then avoid warnings from catdir if you use a file # (not a dir) as the item below next if $item !~ /\.dir$/oi; } my $file = File::Spec->catdir($dir,$item); next unless -d $file; my($dev, $ino, $mode, $nlink, $uid) = lstat($file); my $pwnam = undef; # eval { scalar(getpwnam($uid)) } || $uid; push @list, [ $dir, $pwnam, $item, 'TABLE', undef ]; } close($dh); } # We would like to simply do a DBI->connect() here. However, # this is wrong if we are in a subclass like DBI::ProxyServer. $dbh->{'dbd_sponge_dbh'} ||= DBI->connect("DBI:Sponge:", '','') or return $dbh->set_err($DBI::err, "Failed to connect to DBI::Sponge: $DBI::errstr"); my $attr = { 'rows' => \@list, 'NUM_OF_FIELDS' => 5, 'NAME' => ['TABLE_CAT', 'TABLE_SCHEM', 'TABLE_NAME', 'TABLE_TYPE', 'REMARKS'], 'TYPE' => [DBI::SQL_VARCHAR(), DBI::SQL_VARCHAR(), DBI::SQL_VARCHAR(), DBI::SQL_VARCHAR(), DBI::SQL_VARCHAR() ], 'NULLABLE' => [1, 1, 1, 1, 1] }; my $sdbh = $dbh->{'dbd_sponge_dbh'}; my $sth = $sdbh->prepare("SHOW TABLES FROM $dir", $attr) or return $dbh->set_err($sdbh->err(), $sdbh->errstr()); $sth; } sub type_info_all { my ($dbh) = @_; my $ti = [ { TYPE_NAME => 0, DATA_TYPE => 1, COLUMN_SIZE => 2, LITERAL_PREFIX => 3, LITERAL_SUFFIX => 4, CREATE_PARAMS => 5, NULLABLE => 6, CASE_SENSITIVE => 7, SEARCHABLE => 8, UNSIGNED_ATTRIBUTE=> 9, FIXED_PREC_SCALE=> 10, AUTO_UNIQUE_VALUE => 11, LOCAL_TYPE_NAME => 12, MINIMUM_SCALE => 13, MAXIMUM_SCALE => 14, }, [ 'VARCHAR', DBI::SQL_VARCHAR, 1024, "'","'", undef, 0, 1, 1, 0, 0,0,undef,0,0 ], [ 'INTEGER', DBI::SQL_INTEGER, 10, "","", undef, 0, 0, 1, 0, 0,0,undef,0,0 ], ]; return $ti; } sub ping { (shift->FETCH('Active')) ? 2 : 0; # the value 2 is checked for by t/80proxy.t } sub disconnect { shift->STORE(Active => 0); return 1; } sub get_info { my ($dbh, $info_type) = @_; return $dbh->{examplep_get_info}->{$info_type}; } sub FETCH { my ($dbh, $attrib) = @_; # In reality this would interrogate the database engine to # either return dynamic values that cannot be precomputed # or fetch and cache attribute values too expensive to prefetch. # else pass up to DBI to handle return $INC{"DBD/ExampleP.pm"} if $attrib eq 'example_driver_path'; return $dbh->SUPER::FETCH($attrib); } sub STORE { my ($dbh, $attrib, $value) = @_; # store only known attributes else pass up to DBI to handle if ($attrib eq 'examplep_set_err') { # a fake attribute to enable a test case where STORE issues a warning $dbh->set_err($value, $value); return; } if ($attrib eq 'AutoCommit') { # convert AutoCommit values to magic ones to let DBI # know that the driver has 'handled' the AutoCommit attribute $value = ($value) ? -901 : -900; } return $dbh->{$attrib} = $value if $attrib =~ /^examplep_/; return $dbh->SUPER::STORE($attrib, $value); } sub DESTROY { my $dbh = shift; $dbh->disconnect if $dbh->FETCH('Active'); undef } # This is an example to demonstrate the use of driver-specific # methods via $dbh->func(). # Use it as follows: # my @tables = $dbh->func($re, 'examplep_tables'); # # Returns all the tables that match the regular expression $re. sub examplep_tables { my $dbh = shift; my $re = shift; grep { $_ =~ /$re/ } $dbh->tables(); } sub parse_trace_flag { my ($h, $name) = @_; return 0x01000000 if $name eq 'foo'; return 0x02000000 if $name eq 'bar'; return 0x04000000 if $name eq 'baz'; return 0x08000000 if $name eq 'boo'; return 0x10000000 if $name eq 'bop'; return $h->SUPER::parse_trace_flag($name); } sub private_attribute_info { return { example_driver_path => undef }; } } { package DBD::ExampleP::st; # ====== STATEMENT ====== $imp_data_size = 0; use strict; no strict 'refs'; # cause problems with filehandles sub bind_param { my($sth, $param, $value, $attribs) = @_; $sth->{'dbd_param'}->[$param-1] = $value; return 1; } sub execute { my($sth, @dir) = @_; my $dir; if (@dir) { $sth->bind_param($_, $dir[$_-1]) or return foreach (1..@dir); } my $dbd_param = $sth->{'dbd_param'} || []; return $sth->set_err(2, @$dbd_param." values bound when $sth->{NUM_OF_PARAMS} expected") unless @$dbd_param == $sth->{NUM_OF_PARAMS}; return 0 unless $sth->{NUM_OF_FIELDS}; # not a select $dir = $dbd_param->[0] || $sth->{examplep_ex_dir}; return $sth->set_err(2, "No bind parameter supplied") unless defined $dir; $sth->finish; # # If the users asks for directory "long_list_4532", then we fake a # directory with files "file4351", "file4350", ..., "file0". # This is a special case used for testing, especially DBD::Proxy. # if ($dir =~ /^long_list_(\d+)$/) { $sth->{dbd_dir} = [ $1 ]; # array ref indicates special mode $sth->{dbd_datahandle} = undef; } else { $sth->{dbd_dir} = $dir; my $sym = Symbol::gensym(); # "DBD::ExampleP::".++$DBD::ExampleP::gensym; opendir($sym, $dir) or return $sth->set_err(2, "opendir($dir): $!"); $sth->{dbd_datahandle} = $sym; } $sth->STORE(Active => 1); return 1; } sub fetch { my $sth = shift; my $dir = $sth->{dbd_dir}; my %s; if (ref $dir) { # special fake-data test mode my $num = $dir->[0]--; unless ($num > 0) { $sth->finish(); return; } my $time = time; @s{@DBD::ExampleP::statnames} = ( 2051, 1000+$num, 0644, 2, $>, $), 0, 1024, $time, $time, $time, 512, 2, "file$num") } else { # normal mode my $dh = $sth->{dbd_datahandle} or return $sth->set_err($DBI::stderr, "fetch without successful execute"); my $f = readdir($dh); unless ($f) { $sth->finish; return; } # untaint $f so that we can use this for DBI taint tests ($f) = ($f =~ m/^(.*)$/); my $file = File::Spec->catfile($dir, $f); # put in all the data fields @s{ @DBD::ExampleP::statnames } = (lstat($file), $f); } # return just what fields the query asks for my @new = @s{ @{$sth->{NAME}} }; return $sth->_set_fbav(\@new); } *fetchrow_arrayref = \&fetch; sub finish { my $sth = shift; closedir($sth->{dbd_datahandle}) if $sth->{dbd_datahandle}; $sth->{dbd_datahandle} = undef; $sth->{dbd_dir} = undef; $sth->SUPER::finish(); return 1; } sub FETCH { my ($sth, $attrib) = @_; # In reality this would interrogate the database engine to # either return dynamic values that cannot be precomputed # or fetch and cache attribute values too expensive to prefetch. if ($attrib eq 'TYPE'){ return [ @DBD::ExampleP::stattypes{ @{ $sth->FETCH(q{NAME_lc}) } } ]; } elsif ($attrib eq 'PRECISION'){ return [ @DBD::ExampleP::statprec{ @{ $sth->FETCH(q{NAME_lc}) } } ]; } elsif ($attrib eq 'ParamValues') { my $dbd_param = $sth->{dbd_param} || []; my %pv = map { $_ => $dbd_param->[$_-1] } 1..@$dbd_param; return \%pv; } # else pass up to DBI to handle return $sth->SUPER::FETCH($attrib); } sub STORE { my ($sth, $attrib, $value) = @_; # would normally validate and only store known attributes # else pass up to DBI to handle return $sth->{$attrib} = $value if $attrib eq 'NAME' or $attrib eq 'NULLABLE' or $attrib eq 'SCALE' or $attrib eq 'PRECISION'; return $sth->SUPER::STORE($attrib, $value); } *parse_trace_flag = \&DBD::ExampleP::db::parse_trace_flag; } 1; # vim: sw=4:ts=8 DBI-1.648/lib/DBD/Sponge.pm0000644000031300001440000002110415206024306014313 0ustar00merijnusersuse strict; use warnings; { package DBD::Sponge; require DBI; require Carp; our @EXPORT = qw(); # Do NOT @EXPORT anything. our $VERSION = "12.010003"; # $Id: Sponge.pm 10002 2007-09-26 21:03:25Z Tim $ # # Copyright (c) 1994-2003 Tim Bunce Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. our $drh = undef; # holds driver handle once initialised my $methods_already_installed; sub driver{ return $drh if $drh; DBD::Sponge::db->install_method("sponge_test_installed_method") unless $methods_already_installed++; my($class, $attr) = @_; $class .= "::dr"; ($drh) = DBI::_new_drh($class, { 'Name' => 'Sponge', 'Version' => $VERSION, 'Attribution' => "DBD::Sponge $VERSION (fake cursor driver) by Tim Bunce", }); $drh; } sub CLONE { undef $drh; } } { package DBD::Sponge::dr; # ====== DRIVER ====== our $imp_data_size = 0; # we use default (dummy) connect method } { package DBD::Sponge::db; # ====== DATABASE ====== our $imp_data_size = 0; use strict; sub prepare { my($dbh, $statement, $attribs) = @_; my $rows = delete $attribs->{'rows'} or return $dbh->set_err($DBI::stderr,"No rows attribute supplied to prepare"); my ($outer, $sth) = DBI::_new_sth($dbh, { 'Statement' => $statement, 'rows' => $rows, (map { exists $attribs->{$_} ? ($_=>$attribs->{$_}) : () } qw(execute_hook) ), }); if (my $behave_like = $attribs->{behave_like}) { $outer->{$_} = $behave_like->{$_} foreach (qw(RaiseError PrintError HandleError ShowErrorStatement)); } if ($statement =~ /^\s*insert\b/) { # very basic, just for testing execute_array() $sth->{is_insert} = 1; my $NUM_OF_PARAMS = $attribs->{NUM_OF_PARAMS} or return $dbh->set_err($DBI::stderr,"NUM_OF_PARAMS not specified for INSERT statement"); $sth->STORE('NUM_OF_PARAMS' => $attribs->{NUM_OF_PARAMS} ); } else { #assume select # we need to set NUM_OF_FIELDS my $numFields; if ($attribs->{'NUM_OF_FIELDS'}) { $numFields = $attribs->{'NUM_OF_FIELDS'}; } elsif ($attribs->{'NAME'}) { $numFields = @{$attribs->{NAME}}; } elsif ($attribs->{'TYPE'}) { $numFields = @{$attribs->{TYPE}}; } elsif (my $firstrow = $rows->[0]) { $numFields = scalar @$firstrow; } else { return $dbh->set_err($DBI::stderr, 'Cannot determine NUM_OF_FIELDS'); } $sth->STORE('NUM_OF_FIELDS' => $numFields); $sth->{NAME} = $attribs->{NAME} || [ map { "col$_" } 1..$numFields ]; $sth->{TYPE} = $attribs->{TYPE} || [ (DBI::SQL_VARCHAR()) x $numFields ]; $sth->{SCALE} = $attribs->{SCALE} || [ (0) x $numFields ]; $sth->{NULLABLE} = $attribs->{NULLABLE} || [ (2) x $numFields ]; # Allow user to specify precision, otherwise # FETCH will lazily compute if needed if ($attribs->{PRECISION}) { $sth->{PRECISION} = $attribs->{PRECISION}; } } $outer; } sub type_info_all { my ($dbh) = @_; my $ti = [ { TYPE_NAME => 0, DATA_TYPE => 1, PRECISION => 2, LITERAL_PREFIX => 3, LITERAL_SUFFIX => 4, CREATE_PARAMS => 5, NULLABLE => 6, CASE_SENSITIVE => 7, SEARCHABLE => 8, UNSIGNED_ATTRIBUTE=> 9, MONEY => 10, AUTO_INCREMENT => 11, LOCAL_TYPE_NAME => 12, MINIMUM_SCALE => 13, MAXIMUM_SCALE => 14, }, [ 'VARCHAR', DBI::SQL_VARCHAR(), undef, "'","'", undef, 0, 1, 1, 0, 0,0,undef,0,0 ], ]; return $ti; } sub FETCH { my ($dbh, $attrib) = @_; # In reality this would interrogate the database engine to # either return dynamic values that cannot be precomputed # or fetch and cache attribute values too expensive to prefetch. return 1 if $attrib eq 'AutoCommit'; # else pass up to DBI to handle return $dbh->SUPER::FETCH($attrib); } sub STORE { my ($dbh, $attrib, $value) = @_; # would normally validate and only store known attributes # else pass up to DBI to handle if ($attrib eq 'AutoCommit') { return 1 if $value; # is already set Carp::croak("Can't disable AutoCommit"); } return $dbh->SUPER::STORE($attrib, $value); } sub sponge_test_installed_method { my ($dbh, @args) = @_; return $dbh->set_err(42, "not enough parameters") unless @args >= 2; return \@args; } } { package DBD::Sponge::st; # ====== STATEMENT ====== our $imp_data_size = 0; use strict; sub execute { my $sth = shift; # hack to support ParamValues (when not using bind_param) $sth->{ParamValues} = (@_) ? { map { $_ => $_[$_-1] } 1..@_ } : undef; if (my $hook = $sth->{execute_hook}) { &$hook($sth, @_) or return; } if ($sth->{is_insert}) { my $row; $row = (@_) ? [ @_ ] : die "bind_param not supported yet" ; my $NUM_OF_PARAMS = $sth->{NUM_OF_PARAMS}; return $sth->set_err($DBI::stderr, @$row." values bound (@$row) but $NUM_OF_PARAMS expected") if @$row != $NUM_OF_PARAMS; { no warnings; $sth->trace_msg("inserting (@$row)\n"); } push @{ $sth->{rows} }, $row; } else { # mark select sth as Active $sth->STORE(Active => 1); } # else do nothing for select as data is already in $sth->{rows} return 1; } sub fetch { my ($sth) = @_; my $row = shift @{$sth->{'rows'}}; unless ($row) { $sth->STORE(Active => 0); return undef; } return $sth->_set_fbav($row); } *fetchrow_arrayref = \&fetch; sub FETCH { my ($sth, $attrib) = @_; # would normally validate and only fetch known attributes # else pass up to DBI to handle if ($attrib eq 'PRECISION') { # prepare() did _not_ specify PRECISION, so lazily compute it now return $sth->{PRECISION} = _max_col_lengths(@{$sth}{'NUM_OF_FIELDS', 'rows'}); } return $sth->SUPER::FETCH($attrib); } sub STORE { my ($sth, $attrib, $value) = @_; # would normally validate and only store known attributes # else pass up to DBI to handle return $sth->SUPER::STORE($attrib, $value); } sub _max_col_lengths { # compute our columns' PRECISION (data length) by looking for the # max lengths of each column's data, row by row my ($num_of_fields, $rows) = @_; my @precision = (0,) x $num_of_fields; my $n = $num_of_fields - 1; my $len; for my $row (@$rows) { for my $i (0 .. $n) { next unless defined($len = length($row->[$i])); $precision[$i] = $len if $len > $precision[$i]; } } return \@precision; } } 1; __END__ =pod =head1 NAME DBD::Sponge - Create a DBI statement handle from Perl data =head1 SYNOPSIS my $sponge = DBI->connect("dbi:Sponge:","","",{ RaiseError => 1 }); my $sth = $sponge->prepare($statement, { rows => $data, NAME => $names, %attr } ); =head1 DESCRIPTION DBD::Sponge is useful for making a Perl data structure accessible through a standard DBI statement handle. This may be useful to DBD module authors who need to transform data in this way. =head1 METHODS =head2 connect() my $sponge = DBI->connect("dbi:Sponge:","","",{ RaiseError => 1 }); Here's a sample syntax for creating a database handle for the Sponge driver. No username and password are needed. =head2 prepare() my $sth = $sponge->prepare($statement, { rows => $data, NAME => $names, %attr } ); =over 4 =item * The C<$statement> here is an arbitrary statement or name you want to provide as identity of your data. If you're using DBI::Profile it will appear in the profile data. Generally it's expected that you are preparing a statement handle as if a C statements (or any other statements that can return many values from the database using a cursor-like mechanism). See C above for more explanations. There plans for a preparse function to be provided by B, but this has not reached fruition yet. Meantime, if you want to know how ugly it can get, try looking at the C in B F and the related functions in F and F. =head3 The dbd_st_fetch method This function fetches a row of data. The row is stored in in an array, of C's that B prepares for you. This has two advantages: it is fast (you even reuse the C's, so they don't have to be created after the first C), and it guarantees that B handles C for you. What you do is the following: AV* av; int numFields = DBIc_NUM_FIELDS(imp_sth); /* Correct, if NUM_FIELDS is constant for this statement. There are drivers where this is not the case! */ int chopBlanks = DBIc_is(imp_sth, DBIcf_ChopBlanks); int i; if (!fetch_new_row_of_data(...)) { ... /* check for error or end-of-data */ DBIc_ACTIVE_off(imp_sth); /* turn off Active flag automatically */ return Nullav; } /* get the fbav (field buffer array value) for this row */ /* it is very important to only call this after you know */ /* that you have a row of data to return. */ av = DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth); for (i = 0; i < numFields; i++) { SV* sv = fetch_a_field(..., i); if (chopBlanks && SvOK(sv) && type_is_blank_padded(field_type[i])) { /* Remove white space from end (only) of sv */ } sv_setsv(AvARRAY(av)[i], sv); /* Note: (re)use! */ } return av; There's no need to use a C function returning an C. It's more common to use your database API functions to fetch the data as character strings and use code like this: sv_setpvn(AvARRAY(av)[i], char_ptr, char_count); C values must be returned as C. You can use code like this: SvOK_off(AvARRAY(av)[i]); The function returns the C prepared by B for success or C otherwise. *FIX ME* Discuss what happens when there's no more data to fetch. Are errors permitted if another fetch occurs after the first fetch that reports no more data. (Permitted, not required.) If an error occurs which leaves the I<$sth> in a state where remaining rows can't be fetched then I should be turned off before the method returns. =head3 The dbd_st_finish3 method The C<$sth-Efinish()> method can be called if the user wishes to indicate that no more rows will be fetched even if the database has more rows to offer, and the B code can call the function when handles are being destroyed. See the B specification for more background details. In both circumstances, the B code ends up calling the C method (if you provide a mapping for C in F), or C otherwise. The difference is that C takes a third argument which is an C with the value 1 if it is being called from a C method and 0 otherwise. Note that B v1.32 and earlier test on C to call C; if you provide C, either define C too, or insist on B v1.33 or later. All it I to do is turn off the I flag for the I. It will only be called by F code, if the driver has set I to on for the I. Outline example: int dbd_st_finish3(SV* sth, imp_sth_t* imp_sth, int from_destroy) { if (DBIc_ACTIVE(imp_sth)) { /* close cursor or equivalent action */ DBIc_ACTIVE_off(imp_sth); } return 1; } The from_destroy parameter is true if C is being called from C - and so the statement is about to be destroyed. For many drivers there is no point in doing anything more than turning off the I flag in this case. The function returns I for success, I otherwise, but there isn't a lot anyone can do to recover if there is an error. =head3 The dbd_st_destroy method This function is the private part of the statement handle destructor. void dbd_st_destroy(SV* sth, imp_sth_t* imp_sth) { ... /* any clean-up that's needed */ DBIc_IMPSET_off(imp_sth); /* let DBI know we've done it */ } The B F code will call C for you, if the I has the I flag set, before calling C. =head3 The dbd_st_STORE_attrib and dbd_st_FETCH_attrib methods These functions correspond to C and C attrib above, except that they are for statement handles. See above. int dbd_st_STORE_attrib(SV* sth, imp_sth_t* imp_sth, SV* keysv, SV* valuesv); SV* dbd_st_FETCH_attrib(SV* sth, imp_sth_t* imp_sth, SV* keysv); =head3 The dbd_bind_ph method This function is internally used by the C method, the C method and by the B F code if C is called with any bind parameters. int dbd_bind_ph (SV *sth, imp_sth_t *imp_sth, SV *param, SV *value, IV sql_type, SV *attribs, int is_inout, IV maxlen); The I argument holds an C with the parameter number (1, 2, ...). The I argument is the parameter value and I is its type. If your driver does not support C then you should ignore I and croak if I is I. If your driver I support C then you should note that I is the C I dereferencing the reference passed to C. In drivers of simple databases the function will, for example, store the value in a parameter array and use it later in C. See the B driver for an example. =head3 Implementing bind_param_inout support To provide support for parameters bound by reference rather than by value, the driver must do a number of things. First, and most importantly, it must note the references and stash them in its own driver structure. Secondly, when a value is bound to a column, the driver must discard any previous reference bound to the column. On each execute, the driver must evaluate the references and internally bind the values resulting from the references. This is only applicable if the user writes: $sth->execute; If the user writes: $sth->execute(@values); then B automatically calls the binding code for each element of I<@values>. These calls are indistinguishable from explicit user calls to C. =head2 C/XS version of Makefile.PL The F file for a C/XS driver is similar to the code needed for a pure Perl driver, but there are a number of extra bits of information needed by the build system. For example, the attributes list passed to C needs to specify the object files that need to be compiled and built into the shared object (DLL). This is often, but not necessarily, just F (unless that should be F because you're building on MS Windows). Note that you can reliably determine the extension of the object files from the I<$Config{obj_ext}> values, and there are many other useful pieces of configuration information lurking in that hash. You get access to it with: use Config; =head2 Methods which do not need to be written The B code implements the majority of the methods which are accessed using the notation Cfunction()>, the only exceptions being Cconnect()> and Cdata_sources()> which require support from the driver. The B code implements the following documented driver, database and statement functions which do not need to be written by the B driver writer. =over 4 =item $dbh->do() The default implementation of this function prepares, executes and destroys the statement. This can be replaced if there is a better way to implement this, such as C which can sometimes be used if there are no parameters. =item $h->errstr() =item $h->err() =item $h->state() =item $h->trace() The B driver does not need to worry about these routines at all. =item $h->{ChopBlanks} This attribute needs to be honored during C operations, but does not need to be handled by the attribute handling code. =item $h->{RaiseError} The B driver does not need to worry about this attribute at all. =item $h->{PrintError} The B driver does not need to worry about this attribute at all. =item $sth->bind_col() Assuming the driver uses the Cget_fbav()> function (C drivers, see below), or the C<$sth-E_set_fbav($data)> method (Perl drivers) the driver does not need to do anything about this routine. =item $sth->bind_columns() Regardless of whether the driver uses Cget_fbav()>, the driver does not need to do anything about this routine as it simply iteratively calls C<$sth-Ebind_col()>. =back The B code implements a default implementation of the following functions which do not need to be written by the B driver writer unless the default implementation is incorrect for the Driver. =over 4 =item $dbh->quote() This should only be written if the database does not accept the ANSI SQL standard for quoting strings, with the string enclosed in single quotes and any embedded single quotes replaced by two consecutive single quotes. For the two argument form of quote, you need to implement the C method to provide the information that quote needs. =item $dbh->ping() This should be implemented as a simple efficient way to determine whether the connection to the database is still alive. Typically code like this: sub ping { my $dbh = shift; $sth = $dbh->prepare_cached(q{ select * from A_TABLE_NAME where 1=0 }) or return 0; $sth->execute or return 0; $sth->finish; return 1; } where I is the name of a table that always exists (such as a database system catalogue). =item $drh->default_user The default implementation of default_user will get the database username and password fields from C<$ENV{DBI_USER}> and C<$ENV{DBI_PASS}>. You can override this method. It is called as follows: ($user, $pass) = $drh->default_user($user, $pass, $attr) =back =head1 METADATA METHODS The exposition above ignores the B MetaData methods. The metadata methods are all associated with a database handle. =head2 Using DBI::DBD::Metadata The B module is a good semi-automatic way for the developer of a B module to write the C and C functions quickly and accurately. =head3 Generating the get_info method Prior to B v1.33, this existed as the method C in the B module. From B v1.33, it exists as the method C in the B module. This discussion assumes you have B v1.33 or later. You examine the documentation for C using: perldoc DBI::DBD::Metadata To use it, you need a Perl B driver for your database which implements the C method. In practice, this means you need to install B, an ODBC driver manager, and an ODBC driver for your database. With the pre-requisites in place, you might type: perl -MDBI::DBD::Metadata -we \ "write_getinfo_pm (qw{ dbi:ODBC:foo_db username password Driver })" The procedure writes to standard output the code that should be added to your F file and the code that should be written to F. You should review the output to ensure that it is sensible. =head3 Generating the type_info method Given the idea of the C method, it was not hard to devise a parallel method, C, which does the analogous job for the B C metadata method. The C method was added to B v1.33. You examine the documentation for C using: perldoc DBI::DBD::Metadata The setup is exactly analogous to the mechanism described in L. With the pre-requisites in place, you might type: perl -MDBI::DBD::Metadata -we \ "write_typeinfo_pm (qw{ dbi:ODBC:foo_db username password Driver })" The procedure writes to standard output the code that should be added to your F file and the code that should be written to F. You should review the output to ensure that it is sensible. =head2 Writing DBD::Driver::db::get_info If you use the B module, then the code you need is generated for you. If you decide not to use the B module, you should probably borrow the code from a driver that has done so (e.g. B from version 1.05 onwards) and crib the code from there, or look at the code that generates that module and follow that. The method in F will be very simple; the method in F is not very much more complex unless your DBMS itself is much more complex. Note that some of the B utility methods rely on information from the C method to perform their operations correctly. See, for example, the C and quote methods, discussed below. =head2 Writing DBD::Driver::db::type_info_all If you use the C module, then the code you need is generated for you. If you decide not to use the C module, you should probably borrow the code from a driver that has done so (e.g. C from version 1.05 onwards) and crib the code from there, or look at the code that generates that module and follow that. The method in F will be very simple; the method in F is not very much more complex unless your DBMS itself is much more complex. =head2 Writing DBD::Driver::db::type_info The guidelines on writing this method are still not really clear. No sample implementation is available. =head2 Writing DBD::Driver::db::table_info *FIX ME* The guidelines on writing this method have not been written yet. No sample implementation is available. =head2 Writing DBD::Driver::db::column_info *FIX ME* The guidelines on writing this method have not been written yet. No sample implementation is available. =head2 Writing DBD::Driver::db::primary_key_info *FIX ME* The guidelines on writing this method have not been written yet. No sample implementation is available. =head2 Writing DBD::Driver::db::primary_key *FIX ME* The guidelines on writing this method have not been written yet. No sample implementation is available. =head2 Writing DBD::Driver::db::foreign_key_info *FIX ME* The guidelines on writing this method have not been written yet. No sample implementation is available. =head2 Writing DBD::Driver::db::tables This method generates an array of names in a format suitable for being embedded in SQL statements in places where a table name is expected. If your database hews close enough to the SQL standard or if you have implemented an appropriate C function and and the appropriate C function, then the B default version of this method will work for your driver too. Otherwise, you have to write a function yourself, such as: sub tables { my($dbh, $cat, $sch, $tab, $typ) = @_; my(@res); my($sth) = $dbh->table_info($cat, $sch, $tab, $typ); my(@arr); while (@arr = $sth->fetchrow_array) { push @res, $dbh->quote_identifier($arr[0], $arr[1], $arr[2]); } return @res; } See also the default implementation in F. =head2 Writing DBD::Driver::db::quote This method takes a value and converts it into a string suitable for embedding in an SQL statement as a string literal. If your DBMS accepts the SQL standard notation for strings (single quotes around the string as a whole with any embedded single quotes doubled up), then you do not need to write this method as B provides a default method that does it for you. If your DBMS uses an alternative notation or escape mechanism, then you need to provide an equivalent function. For example, suppose your DBMS used C notation with double quotes around the string and backslashes escaping both double quotes and backslashes themselves. Then you might write the function as: sub quote { my($dbh, $str) = @_; $str =~ s/["\\]/\\$&/gmo; return qq{"$str"}; } Handling newlines and other control characters is left as an exercise for the reader. This sample method ignores the I<$data_type> indicator which is the optional second argument to the method. =head2 Writing DBD::Driver::db::quote_identifier This method is called to ensure that the name of the given table (or other database object) can be embedded into an SQL statement without danger of misinterpretation. The result string should be usable in the text of an SQL statement as the identifier for a table. If your DBMS accepts the SQL standard notation for quoted identifiers (which uses double quotes around the identifier as a whole, with any embedded double quotes doubled up) and accepts I<"schema"."identifier"> (and I<"catalog"."schema"."identifier"> when a catalog is specified), then you do not need to write this method as B provides a default method that does it for you. In fact, even if your DBMS does not handle exactly that notation but you have implemented the C method and it gives the correct responses, then it will work for you. If your database is fussier, then you need to implement your own version of the function. For example, B has to deal with an environment variable I. If it is not set, then the DBMS treats names enclosed in double quotes as strings rather than names, which is usually a syntax error. Additionally, the catalog portion of the name is separated from the schema and table by a different delimiter (colon instead of dot), and the catalog portion is never enclosed in quotes. (Fortunately, valid strings for the catalog will never contain weird characters that might need to be escaped, unless you count dots, dashes, slashes and at-signs as weird.) Finally, an Informix database can contain objects that cannot be accessed because they were created by a user with the I environment variable set, but the current user does not have it set. By design choice, the C method encloses those identifiers in double quotes anyway, which generally triggers a syntax error, and the metadata methods which generate lists of tables etc omit those identifiers from the result sets. sub quote_identifier { my($dbh, $cat, $sch, $obj) = @_; my($rv) = ""; my($qq) = (defined $ENV{DELIMIDENT}) ? '"' : ''; $rv .= qq{$cat:} if (defined $cat); if (defined $sch) { if ($sch !~ m/^\w+$/o) { $qq = '"'; $sch =~ s/$qq/$qq$qq/gm; } $rv .= qq{$qq$sch$qq.}; } if (defined $obj) { if ($obj !~ m/^\w+$/o) { $qq = '"'; $obj =~ s/$qq/$qq$qq/gm; } $rv .= qq{$qq$obj$qq}; } return $rv; } Handling newlines and other control characters is left as an exercise for the reader. Note that there is an optional fourth parameter to this function which is a reference to a hash of attributes; this sample implementation ignores that. This sample implementation also ignores the single-argument variant of the method. =head1 TRACING Tracing in DBI is controlled with a combination of a trace level and a set of flags which together are known as the trace settings. The trace settings are stored in a single integer and divided into levels and flags by a set of masks (C and C). Each handle has it's own trace settings and so does the DBI. When you call a method the DBI merges the handles settings into its own for the duration of the call: the trace flags of the handle are OR'd into the trace flags of the DBI, and if the handle has a higher trace level then the DBI trace level is raised to match it. The previous DBI trace settings are restored when the called method returns. =head2 Trace Level The trace level is the first 4 bits of the trace settings (masked by C) and represents trace levels of 1 to 15. Do not output anything at trace levels less than 3 as they are reserved for DBI. For advice on what to output at each level see "Trace Levels" in L. To test for a trace level you can use the C macro like this: if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) { PerlIO_printf(DBIc_LOGPIO(imp_xxh), "foobar"); } Also B the use of PerlIO_printf which you should always use for tracing and never the C C I/O functions. =head2 Trace Flags Trace flags are used to enable tracing of specific activities within the DBI and drivers. The DBI defines some trace flags and drivers can define others. DBI trace flag names begin with a capital letter and driver specific names begin with a lowercase letter. For a list of DBI defined trace flags see "Trace Flags" in L. If you want to use private trace flags you'll probably want to be able to set them by name. Drivers are expected to override the parse_trace_flag (note the singular) and check if $trace_flag_name is a driver specific trace flags and, if not, then call the DBIs default parse_trace_flag(). To do that you'll need to define a parse_trace_flag() method like this: sub parse_trace_flag { my ($h, $name) = @_; return 0x01000000 if $name eq 'foo'; return 0x02000000 if $name eq 'bar'; return 0x04000000 if $name eq 'baz'; return 0x08000000 if $name eq 'boo'; return 0x10000000 if $name eq 'bop'; return $h->SUPER::parse_trace_flag($name); } All private flag names must be lowercase, and all private flags must be in the top 8 of the 32 bits of C i.e., 0xFF000000. If you've defined a parse_trace_flag() method in ::db you'll also want it in ::st, so just alias it in: *parse_trace_flag = \&DBD::foo:db::parse_trace_flag; You may want to act on the current 'SQL' trace flag that DBI defines to output SQL prepared/executed as DBI currently does not do SQL tracing. =head2 Trace Macros Access to the trace level and trace flags is via a set of macros. DBIc_TRACE_SETTINGS(imp) returns the trace settings DBIc_TRACE_LEVEL(imp) returns the trace level DBIc_TRACE_FLAGS(imp) returns the trace flags DBIc_TRACE(imp, flags, flaglevel, level) e.g., DBIc_TRACE(imp, 0, 0, 4) if level >= 4 DBIc_TRACE(imp, DBDtf_FOO, 2, 4) if tracing DBDtf_FOO & level>=2 or level>=4 DBIc_TRACE(imp, DBDtf_FOO, 2, 0) as above but never trace just due to level =head1 WRITING AN EMULATION LAYER FOR AN OLD PERL INTERFACE Study F (supplied with B) and F (supplied with B) and the corresponding I files for ideas. Note that the emulation code sets C<$dbh-E{CompatMode} = 1;> for each connection so that the internals of the driver can implement behaviour compatible with the old interface when dealing with those handles. =head2 Setting emulation perl variables For example, ingperl has a I<$sql_rowcount> variable. Rather than try to manually update this in F it can be done faster in C code. In C: sql_rowcount = perl_get_sv("Ingperl::sql_rowcount", GV_ADDMULTI); In the relevant places do: if (DBIc_COMPAT(imp_sth)) /* only do this for compatibility mode handles */ sv_setiv(sql_rowcount, the_row_count); =head1 OTHER MISCELLANEOUS INFORMATION =head2 The imp_xyz_t types Any handle has a corresponding C structure filled with private data. Some of this data is reserved for use by B (except for using the DBIc macros below), some is for you. See the description of the F file above for examples. Most functions in F are passed both the handle C and a pointer to C. In rare cases, however, you may use the following macros: =over 4 =item D_imp_dbh(dbh) Given a function argument I, declare a variable I and initialize it with a pointer to the handles private data. Note: This must be a part of the function header, because it declares a variable. =item D_imp_sth(sth) Likewise for statement handles. =item D_imp_xxx(h) Given any handle, declare a variable I and initialize it with a pointer to the handles private data. It is safe, for example, to cast I to C, if C. (You can also call C, but that's much slower.) =item D_imp_dbh_from_sth Given a I, declare a variable I and initialize it with a pointer to the parent database handle's implementors structure. =back =head2 Using DBIc_IMPSET_on The driver code which initializes a handle should use C as soon as its state is such that the cleanup code must be called. When this happens is determined by your driver code. B For example, B maintains a linked list of database handles in the driver, and within each handle, a linked list of statements. Once a statement is added to the linked list, it is crucial that it is cleaned up (removed from the list). When I was being called too late, it was able to cause all sorts of problems. =head2 Using DBIc_is(), DBIc_has(), DBIc_on() and DBIc_off() Once upon a long time ago, the only way of handling the internal B boolean flags/attributes was through macros such as: DBIc_WARN DBIc_WARN_on DBIc_WARN_off DBIc_COMPAT DBIc_COMPAT_on DBIc_COMPAT_off Each of these took an I pointer as an argument. Since then, new attributes have been added such as I, I and I, and these do not have the full set of macros. The approved method for handling these is now the four macros: DBIc_is(imp, flag) DBIc_has(imp, flag) an alias for DBIc_is DBIc_on(imp, flag) DBIc_off(imp, flag) DBIc_set(imp, flag, on) set if on is true, else clear Consequently, the C family of macros is now mostly deprecated and new drivers should avoid using them, even though the older drivers will probably continue to do so for quite a while yet. However... There is an I to that. The I and I flags should be set via the C and C macros, and unset via the C and C macros. =head2 Using the get_fbav() method B. The C<$sth-Ebind_col()> and C<$sth-Ebind_columns()> documented in the B specification do not have to be implemented by the driver writer because B takes care of the details for you. However, the key to ensuring that bound columns work is to call the function Cget_fbav()> in the code which fetches a row of data. This returns an C, and each element of the C contains the C which should be set to contain the returned data. The pure Perl equivalent is the C<$sth-E_set_fbav($data)> method, as described in the part on pure Perl drivers. =head2 Casting strings to Perl types based on a SQL type DBI from 1.611 (and DBIXS_REVISION 13606) defines the sql_type_cast_svpv method which may be used to cast a string representation of a value to a more specific Perl type based on a SQL type. You should consider using this method when processing bound column data as it provides some support for the TYPE bind_col attribute which is rarely used in drivers. int sql_type_cast_svpv(pTHX_ SV *sv, int sql_type, U32 flags, void *v) C is what you would like cast, C is one of the DBI defined SQL types (e.g., C) and C is a bitmask as follows: =over =item DBIstcf_STRICT If set this indicates you want an error state returned if the cast cannot be performed. =item DBIstcf_DISCARD_STRING If set and the pv portion of the C is cast then this will cause sv's pv to be freed up. =back sql_type_cast_svpv returns the following states: -2 sql_type is not handled - sv not changed -1 sv is undef, sv not changed 0 sv could not be cast cleanly and DBIstcf_STRICT was specified 1 sv could not be case cleanly and DBIstcf_STRICT was not specified 2 sv was cast ok The current implementation of sql_type_cast_svpv supports C, C and C. C uses sv_2iv and hence may set IV, UV or NV depending on the number. C uses sv_2nv so may set NV and C will set IV or UV or NV. DBIstcf_STRICT should be implemented as the StrictlyTyped attribute and DBIstcf_DISCARD_STRING implemented as the DiscardString attribute to the bind_col method and both default to off. See DBD::Oracle for an example of how this is used. =head1 SUBCLASSING DBI DRIVERS This is definitely an open subject. It can be done, as demonstrated by the B driver, but it is not as simple as one might think. (Note that this topic is different from subclassing the B. For an example of that, see the F file supplied with the B.) The main problem is that the I's and I's that your C and C methods return are not instances of your B or B packages, they are not even derived from it. Instead they are instances of the B or B classes or a derived subclass. Thus, if you write a method C and do a $dbh->mymethod() then the autoloader will search for that method in the package B. Of course you can instead to a $dbh->func('mymethod') and that will indeed work, even if C is inherited, but not without additional work. Setting I<@ISA> is not sufficient. =head2 Overwriting methods The first problem is, that the C method has no idea of subclasses. For example, you cannot implement base class and subclass in the same file: The C method wants to do a require DBD::Driver; In particular, your subclass B to be a separate driver, from the view of B, and you cannot share driver handles. Of course that's not much of a problem. You should even be able to inherit the base classes C method. But you cannot simply overwrite the method, unless you do something like this, quoted from B: sub connect ($$;$$$) { my ($drh, $dbname, $user, $auth, $attr) = @_; my $this = $drh->DBD::File::dr::connect($dbname, $user, $auth, $attr); if (!exists($this->{csv_tables})) { $this->{csv_tables} = {}; } $this; } Note that we cannot do a $drh->SUPER::connect($dbname, $user, $auth, $attr); as we would usually do in a an OO environment, because I<$drh> is an instance of B. And note, that the C method of B is able to handle subclass attributes. See the description of Pure Perl drivers above. It is essential that you always call superclass method in the above manner. However, that should do. =head2 Attribute handling Fortunately the B specifications allow a simple, but still performant way of handling attributes. The idea is based on the convention that any driver uses a prefix I for its private methods. Thus it's always clear whether to pass attributes to the super class or not. For example, consider this C method from the B class: sub STORE { my ($dbh, $attr, $val) = @_; if ($attr !~ /^driver_/) { return $dbh->DBD::File::db::STORE($attr, $val); } if ($attr eq 'driver_foo') { ... } =cut use Exporter (); use Config qw(%Config); use Carp; use Cwd; use File::Spec; use strict; BEGIN { if ($^O eq 'VMS') { require vmsish; import vmsish; require VMS::Filespec; import VMS::Filespec; } else { *vmsify = sub { return $_[0] }; *unixify = sub { return $_[0] }; } } our @ISA = qw(Exporter); our @EXPORT = qw( dbd_dbi_dir dbd_dbi_arch_dir dbd_edit_mm_attribs dbd_postamble ); our $is_dbi; BEGIN { $is_dbi = (-r 'DBI.pm' && -r 'DBI.xs' && -r 'DBIXS.h'); require DBI unless $is_dbi; } my $done_inst_checks; sub _inst_checks { return if $done_inst_checks++; my $cwd = cwd(); if ($cwd =~ /\Q$Config{path_sep}/) { warn "*** Warning: Path separator characters (`$Config{path_sep}') ", "in the current directory path ($cwd) may cause problems\a\n\n"; sleep 2; } if ($cwd =~ /\s/) { warn "*** Warning: whitespace characters ", "in the current directory path ($cwd) may cause problems\a\n\n"; sleep 2; } if ( $^O eq 'MSWin32' && $Config{cc} eq 'cl' && !(exists $ENV{'LIB'} && exists $ENV{'INCLUDE'})) { die < { name => "DBI::PurePerl", match => qr/^\d/, add => [ '$ENV{DBI_PUREPERL} = 2', 'END { delete $ENV{DBI_PUREPERL}; }' ], }, g => { name => "DBD::Gofer", match => qr/^\d/, add => [ q{$ENV{DBI_AUTOPROXY} = 'dbi:Gofer:transport=null;policy=pedantic'}, q|END { delete $ENV{DBI_AUTOPROXY}; }| ], }, n => { name => "DBI::SQL::Nano", match => qr/^(?:48dbi_dbd_sqlengine|49dbd_file|5\ddbm_\w+|85gofer)\.t$/, add => [ q{$ENV{DBI_SQL_NANO} = 1}, q|END { delete $ENV{DBI_SQL_NANO}; }| ], }, # mx => { name => "DBD::Multiplex", # add => [ q{local $ENV{DBI_AUTOPROXY} = 'dbi:Multiplex:';} ], # } # px => { name => "DBD::Proxy", # need mechanism for starting/stopping the proxy server # add => [ q{local $ENV{DBI_AUTOPROXY} = 'dbi:Proxy:XXX';} ], # } ); # decide what needs doing $dbd_attr->{create_pp_tests} or delete $test_variants{p}; $dbd_attr->{create_nano_tests} or delete $test_variants{n}; $dbd_attr->{create_gap_tests} or delete $test_variants{g}; # expand for all combinations my @all_keys = my @tv_keys = sort keys %test_variants; while( @tv_keys ) { my $cur_key = shift @tv_keys; last if( 1 < length $cur_key ); my @new_keys; foreach my $remain (@tv_keys) { push @new_keys, $cur_key . $remain unless $remain =~ /$cur_key/; } push @tv_keys, @new_keys; push @all_keys, @new_keys; } my %uniq_keys; foreach my $key (@all_keys) { @tv_keys = sort split //, $key; my $ordered = join( '', @tv_keys ); $uniq_keys{$ordered} = 1; } @all_keys = sort { length $a <=> length $b or $a cmp $b } keys %uniq_keys; # do whatever needs doing if( keys %test_variants ) { # XXX need to convert this to work within the generated Makefile # so 'make' creates them and 'make clean' deletes them opendir DIR, 't' or die "Can't read 't' directory: $!"; my @tests = grep { /\.t$/ } readdir DIR; closedir DIR; foreach my $test_combo (@all_keys) { @tv_keys = split //, $test_combo; my @test_names = map { $test_variants{$_}->{name} } @tv_keys; printf "Creating test wrappers for " . join( " + ", @test_names ) . ":\n"; my @test_matches = map { $test_variants{$_}->{match} } @tv_keys; my @test_adds; foreach my $test_add ( map { $test_variants{$_}->{add} } @tv_keys) { push @test_adds, @$test_add; } my $v_type = $test_combo; $v_type = 'x' . $v_type if length( $v_type ) > 1; TEST: foreach my $test (sort @tests) { foreach my $match (@test_matches) { next TEST if $test !~ $match; } my $usethr = ($test =~ /(\d+|\b)thr/ && $] >= 5.008 && $Config{useithreads}); my $v_test = "t/zv${v_type}_$test"; my $v_perl = ($test =~ /taint/) ? "perl -wT" : "perl -w"; printf "%s %s\n", $v_test, ($usethr) ? "(use threads)" : ""; open PPT, ">$v_test" or warn "Can't create $v_test: $!"; print PPT "#!$v_perl\n"; print PPT "use threads;\n" if $usethr; print PPT "$_;\n" foreach @test_adds; print PPT "require './t/$test'; # or warn \$!;\n"; close PPT or warn "Error writing $v_test: $!"; } } } return %$mm_attr; } sub dbd_dbi_dir { _inst_checks(); return '.' if $is_dbi; my $dbidir = $INC{'DBI.pm'} || die "DBI.pm not in %INC!"; $dbidir =~ s:/DBI\.pm$::; return $dbidir; } sub dbd_dbi_arch_dir { _inst_checks(); return '$(INST_ARCHAUTODIR)' if $is_dbi; my $dbidir = dbd_dbi_dir(); my %seen; my @try = grep { not $seen{$_}++ } map { vmsify( unixify($_) . "/auto/DBI/" ) } @INC; my @xst = grep { -f vmsify( unixify($_) . "/Driver.xst" ) } @try; Carp::croak("Unable to locate Driver.xst in @try") unless @xst; Carp::carp( "Multiple copies of Driver.xst found in: @xst") if @xst > 1; print "Using DBI $DBI::VERSION (for perl $] on $Config{archname}) installed in $xst[0]\n"; return File::Spec->canonpath($xst[0]); } sub dbd_postamble { my $self = shift; _inst_checks(); my $dbi_instarch_dir = ($is_dbi) ? "." : dbd_dbi_arch_dir(); my $dbi_driver_xst= File::Spec->catfile($dbi_instarch_dir, 'Driver.xst'); my $xstf_h = File::Spec->catfile($dbi_instarch_dir, 'Driver_xst.h'); # we must be careful of quotes, especially for Win32 here. return ' # --- This section was generated by DBI::DBD::dbd_postamble() DBI_INSTARCH_DIR='.$dbi_instarch_dir.' DBI_DRIVER_XST='.$dbi_driver_xst.' # The main dependency (technically correct but probably not used) $(BASEEXT).c: $(BASEEXT).xsi # This dependency is needed since MakeMaker uses the .xs.o rule $(BASEEXT)$(OBJ_EXT): $(BASEEXT).xsi $(BASEEXT).xsi: $(DBI_DRIVER_XST) '.$xstf_h.' $(PERL) -p -e "s/~DRIVER~/$(BASEEXT)/g" $(DBI_DRIVER_XST) > $(BASEEXT).xsi # --- '; } package DBDI; # just to reserve it via PAUSE for the future 1; __END__ =head1 AUTHORS Jonathan Leffler (previously ), Jochen Wiedmann , Steffen Goeldner , and Tim Bunce . =cut DBI-1.648/lib/Win32/0000755000031300001440000000000015210302710013026 5ustar00merijnusersDBI-1.648/lib/Win32/DBIODBC.pm0000644000031300001440000001060214742423677014442 0ustar00merijnuserspackage # hide this package from CPAN indexer Win32::ODBC; use strict; use warnings; use DBI; # once we've been loaded we don't want perl to load the real Win32::ODBC $INC{'Win32/ODBC.pm'} = $INC{'Win32/DBIODBC.pm'} || 1; #my $db = new Win32::ODBC("DSN=$self->{'DSN'};UID=$self->{'UID'};PWD=$self->{'PWD'};"); #EMU --- my $db = new Win32::ODBC("DSN=$DSN;UID=$login;PWD=$password;"); sub new { shift; my $connect_line= shift; # [R] self-hack to allow empty UID and PWD my $temp_connect_line; $connect_line=~/DSN=\w+/; $temp_connect_line="$&;"; if ($connect_line=~/UID=\w?/) {$temp_connect_line.="$&;";} else {$temp_connect_line.="UID=;";}; if ($connect_line=~/PWD=\w?/) {$temp_connect_line.="$&;";} else {$temp_connect_line.="PWD=;";}; $connect_line=$temp_connect_line; # -[R]- my $self= {}; $_=$connect_line; /^(DSN=)(.*)(;UID=)(.*)(;PWD=)(.*)(;)$/; #---- DBI CONNECTION VARIABLES $self->{ODBC_DSN}=$2; $self->{ODBC_UID}=$4; $self->{ODBC_PWD}=$6; #---- DBI CONNECTION VARIABLES $self->{DBI_DBNAME}=$self->{ODBC_DSN}; $self->{DBI_USER}=$self->{ODBC_UID}; $self->{DBI_PASSWORD}=$self->{ODBC_PWD}; $self->{DBI_DBD}='ODBC'; #---- DBI CONNECTION $self->{'DBI_DBH'}=DBI->connect($self->{'DBI_DBNAME'}, $self->{'DBI_USER'},$self->{'DBI_PASSWORD'},$self->{'DBI_DBD'}); warn "Error($DBI::err) : $DBI::errstr\n" if ! $self->{'DBI_DBH'}; #---- RETURN bless $self; } #EMU --- $db->Sql('SELECT * FROM DUAL'); sub Sql { my $self= shift; my $SQL_statment=shift; # print " SQL : $SQL_statment \n"; $self->{'DBI_SQL_STATMENT'}=$SQL_statment; my $dbh=$self->{'DBI_DBH'}; # print " DBH : $dbh \n"; my $sth=$dbh->prepare("$SQL_statment"); # print " STH : $sth \n"; $self->{'DBI_STH'}=$sth; if ($sth) { $sth->execute(); } #--- GET ERROR MESSAGES $self->{DBI_ERR}=$DBI::err; $self->{DBI_ERRSTR}=$DBI::errstr; if ($sth) { #--- GET COLUMNS NAMES $self->{'DBI_NAME'} = $sth->{NAME}; } # [R] provide compatibility with Win32::ODBC's way of identifying erroneous SQL statements return ($self->{'DBI_ERR'})?1:undef; # -[R]- } #EMU --- $db->FetchRow()) sub FetchRow { my $self= shift; my $sth=$self->{'DBI_STH'}; if ($sth) { my @row=$sth->fetchrow_array; $self->{'DBI_ROW'}=\@row; if (scalar(@row)>0) { #-- the row of result is not nul #-- return something nothing will be return else return 1; } } return undef; } # [R] provide compatibility with Win32::ODBC's Data() method. sub Data { my $self=shift; my @array=@{$self->{'DBI_ROW'}}; foreach my $element (@array) { # remove padding of spaces by DBI $element=~s/(\s*$)//; }; return (wantarray())?@array:join('', @array); }; # -[R]- #EMU --- %record = $db->DataHash; sub DataHash { my $self= shift; my $p_name=$self->{'DBI_NAME'}; my $p_row=$self->{'DBI_ROW'}; my @name=@$p_name; my @row=@$p_row; my %DataHash; #print @name; print "\n"; print @row; # [R] new code that seems to work consistent with Win32::ODBC while (@name) { my $name=shift(@name); my $value=shift(@row); # remove padding of spaces by DBI $name=~s/(\s*$)//; $value=~s/(\s*$)//; $DataHash{$name}=$value; }; # -[R]- # [R] old code that didn't appear to work # foreach my $name (@name) # { # $name=~s/(^\s*)|(\s*$)//; # my @arr=@$name; # foreach (@arr) # { # print "lot $name name col $_ or ROW= 0 $row[0] 1 $row[1] 2 $row[2] \n "; # $DataHash{$name}=shift(@row); # } # } # -[R]- #--- Return Hash return %DataHash; } #EMU --- $db->Error() sub Error { my $self= shift; if ($self->{'DBI_ERR'} ne '') { #--- Return error message $self->{'DBI_ERRSTR'}; } #-- else good no error message } # [R] provide compatibility with Win32::ODBC's Close() method. sub Close { my $self=shift; my $dbh=$self->{'DBI_DBH'}; $dbh->disconnect; } # -[R]- 1; __END__ # [R] to -[R]- indicate sections edited by me, Roy Lee =head1 NAME Win32::DBIODBC - Win32::ODBC emulation layer for the DBI =head1 SYNOPSIS use Win32::DBIODBC; # instead of use Win32::ODBC =head1 DESCRIPTION This is a I basic I alpha quality Win32::ODBC emulation for the DBI. To use it just replace use Win32::ODBC; in your scripts with use Win32::DBIODBC; or, while experimenting, you can pre-load this module without changing your scripts by doing perl -MWin32::DBIODBC your_script_name =head1 TO DO Error handling is virtually non-existent. =head1 AUTHOR Tom Horen =cut DBI-1.648/lib/Bundle/0000755000031300001440000000000015210302710013335 5ustar00merijnusersDBI-1.648/lib/Bundle/DBI.pm0000644000031300001440000000227014656646601014321 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- package Bundle::DBI; use strict; use warnings; our $VERSION = "12.008696"; 1; __END__ =head1 NAME Bundle::DBI - A bundle to install DBI and required modules. =head1 SYNOPSIS perl -MCPAN -e 'install Bundle::DBI' =head1 CONTENTS DBI - for to get to know thyself DBI::Shell 11.91 - the DBI command line shell Storable 2.06 - for DBD::Proxy, DBI::ProxyServer, DBD::Forward Net::Daemon 0.37 - for DBD::Proxy and DBI::ProxyServer RPC::PlServer 0.2016 - for DBD::Proxy and DBI::ProxyServer DBD::Multiplex 1.19 - treat multiple db handles as one =head1 DESCRIPTION This bundle includes all the modules used by the Perl Database Interface (DBI) module, created by Tim Bunce. A I is a module that simply defines a collection of other modules. It is used by the L module to automate the fetching, building and installing of modules from the CPAN ftp archive sites. This bundle does not deal with the various database drivers (e.g. DBD::Informix, DBD::Oracle etc), most of which require software from sources other than CPAN. You'll need to fetch and build those drivers yourself. =head1 AUTHORS Jonathan Leffler, Jochen Wiedmann and Tim Bunce. =cut DBI-1.648/MANIFEST0000644000031300001440000001265515210302710012520 0ustar00merijnusersChangeLog History of significant changes to the DBI DBI.pm The Database Interface Module Perl code DBI.xs The Database Interface Module XS code DBIXS.h The DBI XS public interface for Drivers (DBD::...) Driver.xst Template driver xs file Driver_xst.h Template driver xs support code INSTALL LICENSE MANIFEST Makefile.PL The Makefile generator cpanfile Perl.xs Test harness (currently) for Driver.xst README.md dbd_xsh.h Prototypes for standard Driver.xst interface dbi_sql.h Definitions based on SQL CLI / ODBC (#inc'd by DBIXS.h) dbipport.h Perl portability macros (from Devel::PPort) dbilogstrip.PL Utility to normalise DBI logs so they can be compared with diff dbiprof.PL dbiproxy.PL Frontend for DBI::ProxyServer dbivport.h DBI version portability macros (for drivers to copy) dbixs_rev.h Defines DBIXS_REVISION macro holding DBIXS.h subversion revision number dbixs_rev.pl Utility to write dbixs_rev.h ex/perl_dbi_nulls_test.pl A test script for forms of IS NULL qualification in SQL ex/profile.pl A test script for DBI::Profile ex/corogofer.pl A test script for DBD::Gofer::Transport::corostream ex/unicode_test.pl lib/Bundle/DBI.pm A bundle for automatic installation via CPAN. lib/DBD/DBM.pm A driver for DBM files (uses DBD::File) lib/DBD/ExampleP.pm A very simple example Driver module lib/DBD/File.pm A driver base class for simple drivers lib/DBD/File/Developers.pod Developer documentation for DBD::File lib/DBD/File/Roadmap.pod Roadmap for DBD::File and other Pure Perl DBD's lib/DBD/File/HowTo.pod Guide to write a DBD::File based DBI driver lib/DBD/Gofer.pm DBD::Gofer 'stateless proxy' driver lib/DBD/Gofer/Policy/Base.pm lib/DBD/Gofer/Policy/pedantic.pm Safest and most transparent, but also slowest lib/DBD/Gofer/Policy/classic.pm Reasonable policy for typical usage lib/DBD/Gofer/Policy/rush.pm Raw speed, fewest round trips, least transparent lib/DBD/Gofer/Transport/Base.pm Base class for DBD::Gofer driver transport classes lib/DBD/Gofer/Transport/corostream.pm Async Gofer transport using Coro and AnyEvent lib/DBD/Gofer/Transport/null.pm DBD::Gofer transport that executes in same process (for testing) lib/DBD/Gofer/Transport/pipeone.pm DBD::Gofer transport to new subprocess for each request lib/DBD/Gofer/Transport/stream.pm DBD::Gofer transport for ssh etc lib/DBD/Mem.pm A pure-perl in-memory driver using DBI::DBD::SqlEngine lib/DBD/NullP.pm An empty example Driver module lib/DBD/Proxy.pm Proxy driver lib/DBD/Sponge.pm A driver for fake cursors (precached data) lib/DBI/Changes.pm lib/DBI/Const/GetInfo/ANSI.pm GetInfo data based on ANSI standard lib/DBI/Const/GetInfo/ODBC.pm GetInfo data based on ODBC standard lib/DBI/Const/GetInfoReturn.pm GetInfo return values plus tools based on standards lib/DBI/Const/GetInfoType.pm GetInfo type code data based on standards lib/DBI/DBD.pm Some basic help for people writing DBI drivers lib/DBI/DBD/Metadata.pm Metadata tools for people writing DBI drivers lib/DBI/DBD/SqlEngine.pm SQL Engine for drivers without an own lib/DBI/DBD/SqlEngine/Developers.pod DBI::DBD::SqlEngine API Documentation lib/DBI/DBD/SqlEngine/HowTo.pod HowTo ... write a DBI::DBD::SqlEngine based driver lib/DBI/Gofer/Execute.pm Execution logic for DBD::Gofer server lib/DBI/Gofer/Request.pm Request object from DBD::Gofer lib/DBI/Gofer/Response.pm Response object for DBD::Gofer lib/DBI/Gofer/Serializer/Base.pm lib/DBI/Gofer/Serializer/DataDumper.pm lib/DBI/Gofer/Serializer/Storable.pm lib/DBI/Gofer/Transport/Base.pm Base class for DBD::Gofer server transport classes lib/DBI/Gofer/Transport/pipeone.pm DBD::Gofer transport for single requests lib/DBI/Gofer/Transport/stream.pm DBI::Gofer transport for ssh etc lib/DBI/Profile.pm Manage DBI usage profile data lib/DBI/ProfileData.pm lib/DBI/ProfileDumper.pm lib/DBI/ProfileDumper/Apache.pm lib/DBI/ProfileSubs.pm lib/DBI/ProxyServer.pm The proxy drivers server lib/DBI/PurePerl.pm A DBI.xs emulation in Perl lib/DBI/SQL/Nano.pm A 'smaller than micro' SQL parser lib/DBI/Util/_accessor.pm A very cut-down version of Class::Accessor::Fast lib/DBI/Util/CacheMemory.pm A very cut-down version of Cache::Memory lib/DBI/W32ODBC.pm An experimental DBI emulation layer for Win32::ODBC lib/Win32/DBIODBC.pm An experimental Win32::ODBC emulation layer for DBI t/01basics.t t/02dbidrv.t t/03handle.t t/04mods.t t/05concathash.t t/06attrs.t t/07kids.t t/08keeperr.t t/09trace.t t/10examp.t t/11fetch.t t/12quote.t t/13taint.t t/14utf8.t t/15array.t t/16destroy.t t/17handle_error.t t/19fhtrace.t t/20meta.t t/30subclass.t t/31methcache.t Test caching of inner methods t/35thrclone.t t/40profile.t t/41prof_dump.t t/42prof_data.t t/43prof_env.t t/48dbi_dbd_sqlengine.t Tests for DBI::DBD::SqlEngine t/49dbd_file.t DBD::File API and very basic tests t/50dbm_simple.t simple DBD::DBM tests t/51dbm_file.t extended DBD::File tests (through DBD::DBM) t/52dbm_complex.t Complex DBD::DBM tests with SQL::Statement t/53sqlengine_adv.t t/54_dbd_mem.t t/60preparse.t t/65transact.t t/70callbacks.t t/72childhandles.t t/73cachedkids.t t/80proxy.t t/82sponge.t t/85gofer.t t/86gofer_fail.t t/87gofer_cache.t t/90sql_type_cast.t t/91_store_warning.t t/lib.pl Utility functions for test scripts typemap META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) DBI-1.648/dbivport.h0000644000031300001440000000374012127465144013403 0ustar00merijnusers/* dbivport.h Provides macros that enable greater portability between DBI versions. This file should be *copied* and included in driver distributions and #included into the source, after #include DBIXS.h New driver releases should include an updated copy of dbivport.h from the most recent DBI release. */ #ifndef DBI_VPORT_H #define DBI_VPORT_H #ifndef DBIh_SET_ERR_CHAR /* Emulate DBIh_SET_ERR_CHAR Only uses the err_i, errstr and state parameters. */ #define DBIh_SET_ERR_CHAR(h, imp_xxh, err_c, err_i, errstr, state, method) \ sv_setiv(DBIc_ERR(imp_xxh), err_i); \ (state) ? (void)sv_setpv(DBIc_STATE(imp_xxh), state) : (void)SvOK_off(DBIc_STATE(imp_xxh)); \ sv_setpv(DBIc_ERRSTR(imp_xxh), errstr) #endif #ifndef DBIcf_Executed #define DBIcf_Executed 0x080000 #endif #ifndef DBIc_TRACE_LEVEL_MASK #define DBIc_TRACE_LEVEL_MASK 0x0000000F #define DBIc_TRACE_FLAGS_MASK 0xFFFFFF00 #define DBIc_TRACE_SETTINGS(imp) (DBIc_DBISTATE(imp)->debug) #define DBIc_TRACE_LEVEL(imp) (DBIc_TRACE_SETTINGS(imp) & DBIc_TRACE_LEVEL_MASK) #define DBIc_TRACE_FLAGS(imp) (DBIc_TRACE_SETTINGS(imp) & DBIc_TRACE_FLAGS_MASK) /* DBIc_TRACE_MATCHES - true if s1 'matches' s2 (c.f. trace_msg()) DBIc_TRACE_MATCHES(foo, DBIc_TRACE_SETTINGS(imp)) */ #define DBIc_TRACE_MATCHES(s1, s2) \ ( ((s1 & DBIc_TRACE_LEVEL_MASK) >= (s2 & DBIc_TRACE_LEVEL_MASK)) \ || ((s1 & DBIc_TRACE_FLAGS_MASK) & (s2 & DBIc_TRACE_FLAGS_MASK)) ) /* DBIc_TRACE - true if flags match & DBI level>=flaglevel, or if DBI level>level DBIc_TRACE(imp, 0, 0, 4) = if level >= 4 DBIc_TRACE(imp, DBDtf_FOO, 2, 4) = if tracing DBDtf_FOO & level>=2 or level>=4 DBIc_TRACE(imp, DBDtf_FOO, 2, 0) = as above but never trace just due to level */ #define DBIc_TRACE(imp, flags, flaglevel, level) \ ( (flags && (DBIc_TRACE_FLAGS(imp) & flags) && (DBIc_TRACE_LEVEL(imp) >= flaglevel)) \ || (level && DBIc_TRACE_LEVEL(imp) >= level) ) #endif #endif /* !DBI_VPORT_H */ DBI-1.648/Perl.xs0000644000031300001440000000322114734777452012667 0ustar00merijnusers/* This is a skeleton driver that only serves as a basic sanity check that the Driver.xst mechansim doesn't have compile-time errors in it. vim: ts=8:sw=4:expandtab */ #define PERL_NO_GET_CONTEXT #include "DBIXS.h" #include "dbd_xsh.h" #undef DBIh_SET_ERR_CHAR /* to syntax check emulation */ #include "dbivport.h" DBISTATE_DECLARE; struct imp_drh_st { dbih_drc_t com; /* MUST be first element in structure */ }; struct imp_dbh_st { dbih_dbc_t com; /* MUST be first element in structure */ }; struct imp_sth_st { dbih_stc_t com; /* MUST be first element in structure */ }; #define dbd_discon_all(drh, imp_drh) (drh=drh,imp_drh=imp_drh,1) #define dbd_dr_data_sources(drh, imp_drh, attr) (drh=drh,imp_drh=imp_drh,attr=attr,Nullav) #define dbd_db_do4_iv(dbh,imp_dbh,p3,p4) (dbh=dbh,imp_dbh=imp_dbh,(void*)p3,p4=p4,-2) #define dbd_db_last_insert_id(dbh, imp_dbh, p3,p4,p5,p6, attr) \ (dbh=dbh,imp_dbh=imp_dbh,p3=p3,p4=p4,p5=p5,p6=p6,attr=attr,&PL_sv_undef) #define dbd_take_imp_data(h, imp_xxh, p3) (h=h,imp_xxh=imp_xxh,&PL_sv_undef) #define dbd_st_execute_for_fetch(sth, imp_sth, p3, p4) \ (sth=sth,imp_sth=imp_sth,p3=p3,p4=p4,&PL_sv_undef) #define dbd_st_bind_col(sth, imp_sth, param, ref, sql_type, attribs) \ (sth=sth,imp_sth=imp_sth,param=param,ref=ref,sql_type=sql_type,attribs=attribs,1) int /* just to test syntax of macros etc */ dbd_st_rows(SV *h, imp_sth_t *imp_sth) { dTHX; PERL_UNUSED_VAR(h); DBIh_SET_ERR_CHAR(h, imp_sth, 0, 1, "err msg", "12345", Nullch); return -1; } MODULE = DBD::Perl PACKAGE = DBD::Perl INCLUDE: Perl.xsi # vim:sw=4:ts=8 DBI-1.648/ChangeLog0000644000031300001440000036636515210300667013164 0ustar00merijnusers1.648 - 2026-06-04, H.Merijn Brand * Correct sprintf usage for trace_msg (issue#132) * Add DBIXS_VERSION & DBIXS_RELEASE to dbixs_rev.h * Remove -Wbad-function-cast * Fix possible stack overflow (old issue already noted by Tim) (CVE-2026-9698) * Do not allow table source locations outside explicit given folders * DBD::Sponge PRECISION handling (pr#12, pilcrow) * Fix possible buffer overflow in preparse * Skip mismatching .so's (Greg, PR#81) * Fix cast warning in dbi_get_state (Greg, PR#182) 1.647 - 2025-01-20, H.Merijn Brand * Spellcheck * Fix Makefile rules for Changes (Windows case issue) * Another example to bind columns (issue#159) * Fix fetchall_arrayref for undefined NAME (issue#156) 1.646 - 2025-01-11, H.Merijn Brand * Remove "experimental" tag from statistics_info () (issue#134) * RT tickets moved to github issues (rwfranks++) - All RT tickets now marked as resolved with reference to GitHub issue * Fix install issue (issue #168) 1.645 - 2024-09-03, H.Merijn Brand * Move developer tests to xt/ * Make Changes match CPAN::Changes::Spec and regen DBI::Changes from that * Fixes for modern gcc i.c.w. recent perl (Daniël) * Small code & doc cleanups for recent perl * See TODO in `perldoc DBI` to see where you can help with documentation! 1.644 - 2024-08-23, DBI-Team Update Devel::PPPort, thanks to H.Merijn Brand Fix CVE-2014-10401 and CVE-2014-10402 - f_dir might not exist in DBD::File connections thanks to Jens Rehsack & H.Merijn Brand Do not check gccversion on clang thanks to Daniël van Eeden Upgrade GIMME to GIMME_V thanks to Daniël van Eeden Do not check with JSON::XS with perl-5.022 and later thanks to H.Merijn Brand Makefile.PL allows gcc-10 and up now thanks to H.Merijn Brand (noted by XSven) Do not leak $_ after callback execution (rt#144526, PR#117) thanks to Mauke Switch from Dynaloader to XSLoader (PR#94) thanks to Todd Tim handed the project to the team Merge Pull Requests, resolve RT tickets, & resolve GH issues thanks to many! Please check gitlog 1.643 - 2020-01-31, Tim Bunce Fix memory corruption in XS functions when Perl stack is reallocated thanks to Pali Fix calling dbd_db_do6 API function thanks to Pali Fix potentially calling newSV(0) in malloc_using_sv() thanks to Pali Fix order of XS preparse() ps_accept and ps_return argument names thanks to Petr PísaÅ™ Fix a potential NULL profile dereference in dbi_profile() thanks to Petr PísaÅ™ Fix a buffer overflow on an overlong DBD class name thanks to Petr PísaÅ™ Remove remnants of support for perl <= v5.8.0 thanks to Pali and H.Merijn Brand Update Devel::PPPort and remove redundant compatibility macros thanks to Pali and H.Merijn Brand Correct minor typo in documentation thanks to Mohammad Anwar Correct documentation introducing $dbh->selectall_array() thanks to Pali Introduce select and do wrappers earlier in the documentation thanks to Dan Book Mark as deprecated old API functions which overflow or are affected by Unicode issues, thanks to Pali Add new attribute RaiseWarn, similar to RaiseError, thanks to Pali 1.642 - 2018-10-28, Tim Bunce Fix '.' in @INC for proxy test under parallel load thanks to H.Merijn Brand. Fix driver-related croak() in DBI->connect to report the original DSN thanks to maxatome #67 Introduce a new statement DBI method $sth->last_insert_id() thanks to pali #64 Allow to call $dbh->last_insert_id() method without arguments thanks to pali #64 Added a new XS API function variant dbd_db_do6() thanks to Pali #61 Fix misprints in doc of selectall_hashref thanks to Perlover #69 Remove outdated links to DBI related training resources. RT#125999 1.641 - 2018-03-19, Tim Bunce Remove dependency on Storable 2.16 introduced in DBI 1.639 thanks to Ribasushi #60 Avoid compiler warnings in Driver.xst #59 thanks to pali #59 1.640 - 2018-01-28, Tim Bunce Fix test t/91_store_warning.t for perl 5.10.0 thanks to pali #57 Add Perl 5.10.0 and 5.8.1 specific versions to Travis testing thanks to pali #57 Add registration of mariadb_ prefix for new DBD::MariaDB driver thanks to pali #56 1.639 - 2017-12-28, Tim Bunce Fix UTF-8 support for warn/croak calls within DBI internals, thanks to pali #53 Fix dependency on Storable for perl older than 5.8.9, thanks to H.Merijn Brand. Add DBD::Mem driver, a pure-perl in-memory driver using DBI::DBD::SqlEngine, thanks to Jens Rehsack #42 Corrected missing semicolon in example in documentation, thanks to pali #55 1.637 - 2017-08-16, Tim Bunce Fix use of externally controlled format string (CWE-134) thanks to pali #44 This could cause a crash if, for example, a db error contained a %. https://cwe.mitre.org/data/definitions/134.html Fix extension detection for DBD::File related drivers Fix tests for perl without dot in @INC RT#120443 Fix loss of error message on parent handle, thanks to charsbar #34 Fix disappearing $_ inside callbacks, thanks to robschaber #47 Fix dependency on Storable for perl older than 5.8.9 Allow objects to be used as passwords without throwing an error, thanks to demerphq #40 Allow $sth NAME_* attributes to be set from Perl code, re #45 Added support for DBD::XMLSimple thanks to nigelhorne #38 Documentation updates: Improve examples using eval to be more correct, thanks to pali #39 Add cautionary note to prepare_cached docs re refs in %attr #46 Small POD changes (Getting Help -> Online) thanks to openstrike #33 Adds links to more module names and fix typo, thanks to oalders #43 Typo fix thanks to bor #37 1.636 - 2016-04-24, Tim Bunce Fix compilation for threaded perl <= 5.12 broken in 1.635 RT#113955 Revert change to DBI::PurePerl DESTROY in 1.635 Change t/16destroy.t to avoid race hazard RT#113951 Output perl version and archname in t/01basics.t Add perl 5.22 and 5.22-extras to travis-ci config 1.635 - 2016-04-24, Tim Bunce Fixed RaiseError/PrintError for UTF-8 errors/warnings. RT#102404 Fixed cases where ShowErrorStatement might show incorrect Statement RT#97434 Fixed DBD::Gofer for UTF-8-enabled STDIN/STDOUT thanks to mauke PR#32 Fixed fetchall_arrayref({}) behavior with no columns thanks to Dan McGee PR#31 Fixed tied CachedKids ref leak in attribute cache by weakening thanks to Michael Conrad RT#113852 Fixed "panic: attempt to copy freed scalar" upon commit() or rollback() thanks to fbriere for detailed bug report RT#102791 Ceased to ignore DESTROY of outer handle in DBI::PurePerl Treat undef in DBI::Profile Path as string "undef" thanks to fREW Schmidt RT#113298 Fix SQL::Nano parser to ignore trailing semicolon thanks to H.Merijn Brand. Added @ary = $dbh->selectall_array(...) method thanks to Ed Avis RT#106411 Added appveyor support (Travis like CI for windows) thanks to mbeijen PR#30 Corrected spelling errors in pod thanks to Gregor Herrmann RT#107838 Corrected and/or removed broken links to SQL standards thanks to David Pottage RT#111437 Corrected doc example to use dbi: instead of DBI: in DSN thanks to Michael R. Davis RT#101181 Removed/updated broken links in docs thanks to mbeijen PR#29 Clarified docs for DBI::hash($string) Removed the ancient DBI::FAQ module RT#102714 Fixed t/pod.t to require Test::Pod >= 1.41 RT#101769 This release was developed at the Perl QA Hackathon 2016 L which was made possible by the generosity of many sponsors: L FastMail, L ZipRecruiter, L ActiveState, L OpusVL, L Strato, L SureVoIP, L CV-Library, L Infinity, L Perl Careers, L MongoDB, L thinkproject!, L Dreamhost, L Perl 6, L Perl Services, L Evozon, L Booking, L Eligo, L Oetiker+Partner, L CAPSiDE, L Procura, L Constructor.io, L Robbie Bow, L Ron Savage, L Charlie Gonzalez, L Justin Cook. 1.634 - 2015-08-03, Tim Bunce Enabled strictures on all modules (Jose Luis Perez Diez) #22 Note that this might cause new exceptions in existing code. Please take time for extra testing before deploying to production. Improved handling of row counts for compiled drivers and enable them to return larger row counts (IV type) by defining new *_iv macros. Fixed quote_identifier that was adding a trailing separator when there was only a catalog (Martin J. Evans) Removed redundant keys() call in fetchall_arrayref with hash slice (ilmari) #24 Corrected pod xref to Placeholders section (Matthew D. Fuller) Corrected pod grammar (Nick Tonkin) #25 Added support for tables('', '', '', '%') special case (Martin J. Evans) Added support for DBD prefixes with numbers (Jens Rehsack) #19 Added extra initializer for DBI::DBD::SqlEngine based DBD's (Jens Rehsack) Added Memory Leaks section to the DBI docs (Tim) Added Artistic v1 & GPL v1 LICENSE file (Jose Luis Perez Diez) #21 1.633 - 2015-01-11, Tim Bunce Fixed selectrow_*ref to return undef on error in list context instead if an empty list. Changed t/42prof_data.t more informative Changed $sth->{TYPE} to be NUMERIC in DBD::File drivers as per the DBI docs. Note TYPE_NAME is now also available. [H.Merijn Brand] Fixed compilation error on bleadperl due DEFSV no longer being an lvalue [Dagfinn Ilmari MannsÃ¥ker] Added docs for escaping placeholders using a backslash. Added docs for get_info(9000) indicating ability to escape placeholders. Added multi_ prefix for DBD::Multi (Dan Wright) and ad2_ prefix for DBD::AnyData2 1.632 - 2014-11-09, Tim Bunce Fixed risk of memory corruption with many arguments to methods originally reported by OSCHWALD for Callbacks but may apply to other functionality in DBI method dispatch RT#86744. Fixed DBD::PurePerl to not set $sth->{Active} true by default drivers are expected to set it true as needed. Fixed DBI::DBD::SqlEngine to complain loudly when prerequite driver_prefix is not fulfilled (RT#93204) [Jens Rehsack] Fixed redundant sprintf argument warning RT#97062 [Reini Urban] Fixed security issue where DBD::File drivers would open files from folders other than specifically passed using the f_dir attribute RT#99508 [H.Merijn Brand] Changed delete $h->{$key} to work for keys with 'private_' prefix per request in RT#83156. local $h->{$key} works as before. Added security notice to DBD::Proxy and DBI::ProxyServer because they use Storable which is insecure. Thanks to ppisar@redhat.com RT#90475 Added note to AutoInactiveDestroy docs strongly recommending that it is enabled in all new code. 1.631 - 2014-01-20, Tim Bunce NOTE: This release changes the handle passed to Callbacks from being an 'inner' handle to being an 'outer' handle. If you have code that makes use of Callbacks, ensure that you understand what this change means and review your callback code. Fixed err_hash handling of integer err RT#92172 [Dagfinn Ilmari] Fixed use of \Q vs \E in t/70callbacks.t Changed the handle passed to Callbacks from being an 'inner' handle to being an 'outer' handle. Improved reliability of concurrent testing PR#8 [Peter Rabbitson] Changed optional dependencies to "suggest" PR#9 [Karen Etheridge] Changed to avoid mg_get in neatsvpv during global destruction PR#10 [Matt Phillips] 1.630 - 2013-10-28, Tim Bunce NOTE: This release enables PrintWarn by default regardless of $^W. Your applications may generate more log messages than before. Fixed err for new drh to be undef not to 0 [Martin J. Evans] Fixed RT#83132 - moved DBIstcf* constants to util export tag [Martin J. Evans] PrintWarn is now triggered by warnings recorded in methods like STORE that don't clear err RT#89015 [Tim Bunce] Changed tracing to no longer show quote and quote_identifier calls at trace level 1. Changed DBD::Gofer ping while disconnected set_err from warn to info. Clarified wording of log message when err is cleared. Changed bootstrap to use $XS_VERSION RT#89618 [Andreas Koenig] Added connect_cached.connected Callback PR#3 [David E. Wheeler] Clarified effect of refs in connect_cached attributes [David E. Wheeler] Extended ReadOnly attribute docs for when the driver cannot ensure read only [Martin J. Evans] Corrected SQL_BIGINT docs to say ODBC value is used PR#5 [ilmari] There was no DBI 1.629 release. 1.628 - 2013-07-22, Tim Bunce Fixed missing fields on partial insert via DBI::DBD::SqlEngine engines (DBD::CSV, DBD::DBM etc.) [H.Merijn Brand, Jens Rehsack] Fixed stack corruption on callbacks RT#85562 RT#84974 [Aaron Schweiger] Fixed DBI::SQL::Nano_::Statement handling of "0" [Jens Rehsack] Fixed exit op precedence in test RT#87029 [Reni Urban] Added support for finding tables in multiple directories via new DBD::File f_dir_search attribute [H.Merijn Brand] Enable compiling by C++ RT#84285 [Kurt Jaeger] Typo fixes in pod and comment [David Steinbrunner] Change DBI's docs to refer to git not svn [H.Merijn Brand] Clarify bind_col TYPE attribute is sticky [Martin J. Evans] Fixed reference to $sth in selectall_arrayref docs RT#84873 Spelling fixes [Ville Skyttä] Changed $VERSIONs to hardcoded strings [H.Merijn Brand] 1.627 - 2013-05-16, Tim Bunce Fixed VERSION regression in DBI::SQL::Nano [Tim Bunce] 1.626 - 2013-05-15, Tim Bunce Fixed pod text/link was reversed in a few cases RT#85168 [H.Merijn Brand] Handle aliasing of STORE'd attributes in DBI::DBD::SqlEngine [Jens Rehsack] Updated repository URI to git [Jens Rehsack] Fixed skip() count arg in t/48dbi_dbd_sqlengine.t [Tim Bunce] 1.625 - 2013-03-28, Tim Bunce (svn r15595) Fixed heap-use-after-free during global destruction RT#75614 thanks to Reini Urban. Fixed ignoring RootClass attribute during connect() by DBI::DBD::SqlEngine reported in RT#84260 by Michael Schout 1.624 - 2013-03-22, Tim Bunce (svn r15576) Fixed Gofer for hash randomization in perl 5.17.10+ RT#84146 Clarify docs for can() re RT#83207 1.623 - 2013-01-02, Tim Bunce (svn r15547) Fixed RT#64330 - ping wipes out errstr (Martin J. Evans). Fixed RT#75868 - DBD::Proxy shouldn't call connected() on the server. Fixed RT#80474 - segfault in DESTROY with threads. Fixed RT#81516 - Test failures due to hash randomisation in perl 5.17.6 thanks to Jens Rehsack and H.Merijn Brand and feedback on IRC Fixed RT#81724 - Handle copy-on-write scalars (sprout) Fixed unused variable / self-assignment compiler warnings. Fixed default table_info in DBI::DBD::SqlEngine which passed NAMES attribute instead of NAME to DBD::Sponge RT72343 (Martin J. Evans) Corrected a spelling error thanks to Chris Sanders. Corrected typo in DBI->installed_versions docs RT#78825 thanks to Jan Dubois. Refactored table meta information management from DBD::File into DBI::DBD::SqlEngine (H.Merijn Brand, Jens Rehsack) Prevent undefined f_dir being used in opendir (H.Merijn Brand) Added logic to force destruction of children before parents during global destruction. See RT#75614. Added DBD::File Plugin-Support for table names and data sources (Jens Rehsack, #dbi Team) Added new tests to 08keeperr for RT#64330 thanks to Kenichi Ishigaki. Added extra internal handle type check, RT#79952 thanks to Reini Urban. Added cubrid_ registered prefix for DBD::cubrid, RT#78453 Removed internal _not_impl method (Martin J. Evans). NOTE: The "old-style" DBD::DBM attributes 'dbm_ext' and 'dbm_lockfile' have been deprecated for several years and their use will now generate a warning. 1.622 - 2012-06-06, Tim Bunce (svn r15327) Fixed lack of =encoding in non-ASCII pod docs. RT#77588 Corrected typo in DBI::ProfileDumper thanks to Finn Hakansson. 1.621 - 2012-05-21, Tim Bunce (svn r15315) Fixed segmentation fault when a thread is created from within another thread RT#77137, thanks to Dave Mitchell. Updated previous Changes to credit Booking.com for sponsoring Dave Mitchell's recent DBI optimization work. 1.620 - 2012-04-25, Tim Bunce (svn r15300) Modified column renaming in fetchall_arrayref, added in 1.619, to work on column index numbers not names (an incompatible change). Reworked the fetchall_arrayref documentation. Hash slices in fetchall_arrayref now detect invalid column names. 1.619 - 2012-04-23, Tim Bunce (svn r15294) Fixed the connected method to stop showing the password in trace file (Martin J. Evans). Fixed _install_method to set CvFILE correctly thanks to sprout RT#76296 Fixed SqlEngine "list_tables" thanks to David McMath and Norbert Gruener. RT#67223 RT#69260 Optimized DBI method dispatch thanks to Dave Mitchell. Optimized driver access to DBI internal state thanks to Dave Mitchell. Optimized driver access to handle data thanks to Dave Mitchell. Dave's work on these optimizations was sponsored by Booking.com. Optimized fetchall_arrayref with hash slice thanks to Dagfinn Ilmari MannsÃ¥ker. RT#76520 Allow renaming columns in fetchall_arrayref hash slices thanks to Dagfinn Ilmari MannsÃ¥ker. RT#76572 Reserved snmp_ and tree_ for DBD::SNMP and DBD::TreeData 1.618 - 2012-02-25, Tim Bunce (svn r15170) Fixed compiler warnings in Driver_xst.h (Martin J. Evans) Fixed compiler warning in DBI.xs (H.Merijn Brand) Fixed Gofer tests failing on Windows RT74975 (Manoj Kumar) Fixed my_ctx compile errors on Windows (Dave Mitchell) Significantly optimized method dispatch via cache (Dave Mitchell) Significantly optimized DBI internals for threads (Dave Mitchell) Dave's work on these optimizations was sponsored by Booking.com. Xsub to xsub calling optimization now enabled for threaded perls. Corrected typo in example in docs (David Precious) Added note that calling clone() without an arg may warn in future. Minor changes to the install_method() docs in DBI::DBD. Updated dbipport.h from Devel::PPPort 3.20 1.617 - 2012-01-30, Tim Bunce (svn r15107) NOTE: The officially supported minimum perl version will change from perl 5.8.1 (2003) to perl 5.8.3 (2004) in a future release. (The last change, from perl 5.6 to 5.8.1, was announced in July 2008 and implemented in DBI 1.611 in April 2010.) Fixed ParamTypes example in the pod (Martin J. Evans) Fixed the definition of ArrayTupleStatus and remove confusion over rows affected in list context of execute_array (Martin J. Evans) Fixed sql_type_cast example and typo in errors (Martin J. Evans) Fixed Gofer error handling for keeperr methods like ping (Tim Bunce) Fixed $dbh->clone({}) RT73250 (Tim Bunce) Fixed is_nested_call logic error RT73118 (Reini Urban) Enhanced performance for threaded perls (Dave Mitchell, Tim Bunce) Dave's work on this optimization was sponsored by Booking.com. Enhanced and standardized driver trace level mechanism (Tim Bunce) Removed old code that was an inneffective attempt to detect people doing DBI->{Attrib}. Clear ParamValues on bind_param param count error RT66127 (Tim Bunce) Changed DBI::ProxyServer to require DBI at compile-time RT62672 (Tim Bunce) Added pod for default_user to DBI::DBD (Martin J. Evans) Added CON, ENC and DBD trace flags and extended 09trace.t (Martin J. Evans) Added TXN trace flags and applied CON and TXN to relevant methods (Tim Bunce) Added some more fetchall_arrayref(..., $maxrows) tests (Tim Bunce) Clarified docs for fetchall_arrayref called on an inactive handle. Clarified docs for clone method (Tim Bunce) Added note to DBI::Profile about async queries (Marcel Grünauer). Reserved spatialite_ as a driver prefix for DBD::Spatialite Reserved mo_ as a driver prefix for DBD::MO Updated link to the SQL Reunion 95 docs, RT69577 (Ash Daminato) Changed links for DBI recipes. RT73286 (Martin J. Evans) 1.616 - 2010-12-30, Tim Bunce (svn r14616) Fixed spurious dbi_profile lines written to the log when profiling is enabled and a trace flag, like SQL, is used. Fixed to recognize SQL::Statement errors even if instantiated with RaiseError=0 (Jens Rehsack) Fixed RT#61513 by catching attribute assignment to tied table access interface (Jens Rehsack) Fixing some misbehavior of DBD::File when running within the Gofer server. Fixed compiler warnings RT#62640 Optimized connect() to remove redundant FETCH of \%attrib values. Improved initialization phases in DBI::DBD::SqlEngine (Jens Rehsack) Added DBD::Gofer::Transport::corostream. An experimental proof-of-concept transport that enables asynchronous database calls with few code changes. It enables asynchronous use of DBI frameworks like DBIx::Class. Added additional notes on DBDs which avoid creating a statement in the do() method and the effects on error handlers (Martin J. Evans) Adding new attribute "sql_dialect" to DBI::DBD::SqlEngine to allow users control used SQL dialect (ANSI, CSV or AnyData), defaults to CSV (Jens Rehsack) Add documentation for DBI::DBD::SqlEngine attributes (Jens Rehsack) Documented dbd_st_execute return (Martin J. Evans) Fixed typo in InactiveDestroy thanks to Emmanuel Rodriguez. 1.615 - 2010-09-21, Tim Bunce (svn r14438) Fixed t/51dbm_file for file/directory names with whitespaces in them RT#61445 (Jens Rehsack) Fixed compiler warnings from ignored hv_store result (Martin J. Evans) Fixed portability to VMS (Craig A. Berry) 1.614 - 2010-09-17, Tim Bunce (svn r14408) Fixed bind_param () in DBI::DBD::SqlEngine (rt#61281) Fixed internals to not refer to old perl symbols that will no longer be visible in perl >5.13.3 (Andreas Koenig) Many compiled drivers are likely to need updating. Fixed issue in DBD::File when absolute filename is used as table name (Jens Rehsack) Croak manually when file after tie doesn't exists in DBD::DBM when it have to exists (Jens Rehsack) Fixed issue in DBD::File when users set individual file name for tables via f_meta compatibility interface - reported by H.Merijn Brand while working on RT#61168 (Jens Rehsack) Changed 50dbm_simple to simplify and fix problems (Martin J. Evans) Changed 50dbm_simple to skip aggregation tests when not using SQL::Statement (Jens Rehsack) Minor speed improvements in DBD::File (Jens Rehsack) Added $h->{AutoInactiveDestroy} as simpler safer form of $h->{InactiveDestroy} (David E. Wheeler) Added ability for parallel testing "prove -j4 ..." (Jens Rehsack) Added tests for delete in DBM (H.Merijn Brand) Added test for absolute filename as table to 51dbm_file (Jens Rehsack) Added two initialization phases to DBI::DBD::SqlEngine (Jens Rehsack) Added improved developers documentation for DBI::DBD::SqlEngine (Jens Rehsack) Added guides how to write DBI drivers using DBI::DBD::SqlEngine or DBD::File (Jens Rehsack) Added register_compat_map() and table_meta_attr_changed() to DBD::File::Table to support clean fix of RT#61168 (Jens Rehsack) 1.613 - 2010-07-22, Tim Bunce (svn r14271) Fixed Win32 prerequisite module from PathTools to File::Spec. Changed attribute headings and fixed references in DBI pod (Martin J. Evans) Corrected typos in DBI::FAQ and DBI::ProxyServer (Ansgar Burchardt) 1.612 - 2010-07-16, Tim Bunce (svn r14254) NOTE: This is a minor release for the DBI core but a major release for DBD::File and drivers that depend on it, like DBD::DBM and DBD::CSV. This is also the first release where the bulk of the development work has been done by other people. I'd like to thank (in no particular order) Jens Rehsack, Martin J. Evans, and H.Merijn Brand for all their contributions. Fixed DBD::File's {ChopBlank} handling (it stripped \s instead of space only as documented in DBI) (H.Merijn Brand) Fixed DBD::DBM breakage with SQL::Statement (Jens Rehsack, fixes RT#56561) Fixed DBD::File file handle leak (Jens Rehsack) Fixed problems in 50dbm.t when running tests with multiple dbms (Martin J. Evans) Fixed DBD::DBM bugs found during tests (Jens Rehsack) Fixed DBD::File doesn't find files without extensions under some circumstances (Jens Rehsack, H.Merijn Brand, fixes RT#59038) Changed Makefile.PL to modernize with CONFLICTS, recommended dependencies and resources (Jens Rehsack) Changed DBI::ProfileDumper to rename any existing profile file by appending .prev, instead of overwriting it. Changed DBI::ProfileDumper::Apache to work in more configurations including vhosts using PerlOptions +Parent. Add driver_prefix method to DBI (Jens Rehsack) Added more tests to 50dbm_simple.t to prove optimizations in DBI::SQL::Nano and SQL::Statement (Jens Rehsack) Updated tests to cover optional installed SQL::Statement (Jens Rehsack) Synchronize API between SQL::Statement and DBI::SQL::Nano (Jens Rehsack) Merged some optimizations from SQL::Statement into DBI::SQL::Nano (Jens Rehsack) Added basic test for DBD::File (H.Merijn Brand, Jens Rehsack) Extract dealing with Perl SQL engines from DBD::File into DBI::DBD::SqlEngine for better subclassing of 3rd party non-db DBDs (Jens Rehsack) Updated and clarified documentation for finish method (Tim Bunce). Changes to DBD::File for better English and hopefully better explanation (Martin J. Evans) Update documentation of DBD::DBM to cover current implementation, tried to explain some things better and changes most examples to preferred style of Merijn and myself (Jens Rehsack) Added developer documentation (including a roadmap of future plans) for DBD::File 1.611 - 2010-04-29, Tim Bunce (svn r13935) NOTE: minimum perl version is now 5.8.1 (as announced in DBI 1.607) Fixed selectcol_arrayref MaxRows attribute to count rows not values thanks to Vernon Lyon. Fixed DBI->trace(0, *STDERR); (H.Merijn Brand) which tried to open a file named "*main::STDERR" in perl-5.10.x Fixes in DBD::DBM for use under threads (Jens Rehsack) Changed "Issuing rollback() due to DESTROY without explicit disconnect" warning to not be issued if ReadOnly set for that dbh. Added f_lock and f_encoding support to DBD::File (H.Merijn Brand) Added ChildCallbacks => { ... } to Callbacks as a way to specify Callbacks for child handles. With tests added by David E. Wheeler. Added DBI::sql_type_cast($value, $type, $flags) to cast a string value to an SQL type. e.g. SQL_INTEGER effectively does $value += 0; Has other options plus an internal interface for drivers. Documentation changes: Small fixes in the documentation of DBD::DBM (H.Merijn Brand) Documented specification of type casting behaviour for bind_col() based on DBI::sql_type_cast() and two new bind_col attributes StrictlyTyped and DiscardString. Thanks to Martin Evans. Document fetchrow_hashref() behaviour for functions, aliases and duplicate names (H.Merijn Brand) Updated DBI::Profile and DBD::File docs to fix pod nits thanks to Frank Wiegand. Corrected typos in Gopher documentation reported by Jan Krynicky. Documented the Callbacks attribute thanks to David E. Wheeler. Corrected the Timeout examples as per rt 50621 (Martin J. Evans). Removed some internal broken links in the pod (Martin J. Evans) Added Note to column_info for drivers which do not support it (Martin J. Evans) Updated dbipport.h to Devel::PPPort 3.19 (H.Merijn Brand) 1.609 - 2009-06-08, Tim Bunce (svn r12816) Fixes to DBD::File (H.Merijn Brand) added f_schema attribute table names case sensitive when quoted, insensitive when unquoted workaround a bug in SQL::Statement (temporary fix) related to the "You passed x parameters where y required" error Added ImplementorClass and Name info to the "Issuing rollback() due to DESTROY without explicit disconnect" warning to identify the handle. Applies to compiled drivers when they are recompiled. Added DBI->visit_handles($coderef) method. Added $h->visit_child_handles($coderef) method. Added docs for column_info()'s COLUMN_DEF value. Clarified docs on stickyness of data type via bind_param(). Clarified docs on stickyness of data type via bind_col(). 1.608 - 2009-05-05, Tim Bunce (svn r12742) Fixes to DBD::File (H.Merijn Brand) bind_param () now honors the attribute argument added f_ext attribute File::Spec is always required. (CORE since 5.00405) Fail and set errstr on parameter count mismatch in execute () Fixed two small memory leaks when running in mod_perl one in DBI->connect and one in DBI::Gofer::Execute. Both due to "local $ENV{...};" leaking memory. Fixed DBD_ATTRIB_DELETE macro for driver authors and updated DBI::DBD docs thanks to Martin J. Evans. Fixed 64bit issues in trace messages thanks to Charles Jardine. Fixed FETCH_many() method to work with drivers that incorrectly return an empty list from $h->FETCH. Affected gofer. Added 'sqlite_' as registered prefix for DBD::SQLite. Corrected many typos in DBI docs thanks to Martin J. Evans. Improved DBI::DBD docs thanks to H.Merijn Brand. 1.607 - 2008-07-22, Tim Bunce (svn r11571) NOTE: Perl 5.8.1 is now the minimum supported version. If you need support for earlier versions send me a patch. Fixed missing import of carp in DBI::Gofer::Execute. Added note to docs about effect of execute(@empty_array). Clarified docs for ReadOnly thanks to Martin Evans. 1.605 - 2008-06-16, Tim Bunce (svn r11434) Fixed broken DBIS macro with threads on big-endian machines with 64bit ints but 32bit pointers. Ticket #32309. Fixed the selectall_arrayref, selectrow_arrayref, and selectrow_array methods that get embedded into compiled drivers to use the inner sth handle when passed a $sth instead of an sql string. Drivers will need to be recompiled to pick up this change. Fixed leak in neat() for some kinds of values thanks to Rudolf Lippan. Fixed DBI::PurePerl neat() to behave more like XS neat(). Increased default $DBI::neat_maxlen from 400 to 1000. Increased timeout on tests to accommodate very slow systems. Changed behaviour of trace levels 1..4 to show less information at lower levels. Changed the format of the key used for $h->{CachedKids} (which is undocumented so you shouldn't depend on it anyway) Changed gofer error handling to avoid duplicate error text in errstr. Clarified docs re ":N" style placeholders. Improved gofer retry-on-error logic and refactored to aid subclassing. Improved gofer trace output in assorted ways. Removed the beeps "\a" from Makefile.PL warnings. Removed check for PlRPC-modules from Makefile.PL Added sorting of ParamValues reported by ShowErrorStatement thanks to to Rudolf Lippan. Added cache miss trace message to DBD::Gofer transport class. Added $drh->dbixs_revision method. Added explicit LICENSE specification (perl) to META.yaml 1.604 - 2008-03-24, Tim Bunce (svn r10994) Fixed fetchall_arrayref with $max_rows argument broken in 1.603, thanks to Greg Sabino Mullane. Fixed a few harmless compiler warnings on cygwin. 1.603 - 2008-03-22, Tim Bunce Fixed pure-perl fetchall_arrayref with $max_rows argument to not error when fetching after all rows already fetched. (Was fixed for compiled drivers back in DBI 1.31.) Thanks to Mark Overmeer. Fixed C sprintf formats and casts, fixing compiler warnings. Changed dbi_profile() to accept a hash of profiles and apply to all. Changed gofer stream transport to improve error reporting. Changed gofer test timeout to avoid spurious failures on slow systems. Added options to t/85gofer.t so it's more useful for manual testing. 1.602 - 2008-02-08, Tim Bunce (svn r10706) Fixed potential coredump if stack reallocated while calling back into perl from XS code. Thanks to John Gardiner Myers. Fixed DBI::Util::CacheMemory->new to not clear the cache. Fixed avg in DBI::Profile as_text() thanks to Abe Ingersoll. Fixed DBD::DBM bug in push_names thanks to J M Davitt. Fixed take_imp_data for some platforms thanks to Jeffrey Klein. Fixed docs tie'ing CacheKids (ie LRU cache) thanks to Peter John Edwards. Expanded DBI::DBD docs for driver authors thanks to Martin Evans. Enhanced t/80proxy.t test script. Enhanced t/85gofer.t test script thanks to Stig. Enhanced t/10examp.t test script thanks to David Cantrell. Documented $DBI::stderr as the default value of err for internal errors. Gofer changes: track_recent now also keeps track of N most recent errors. The connect method is now also counted in stats. 1.601 - 2007-10-21, Tim Bunce (svn r10103) Fixed t/05thrclone.t to work with Test::More >= 0.71 thanks to Jerry D. Hedden and Michael G Schwern. Fixed DBI for VMS thanks to Peter (Stig) Edwards. Added client-side caching to DBD::Gofer. Can use any cache with get($k)/set($k,$v) methods, including all the Cache and Cache::Cache distribution modules plus Cache::Memcached, Cache::FastMmap etc. Works for all transports. Overridable per handle. Added DBI::Util::CacheMemory for use with DBD::Gofer caching. It's a very fast and small strict subset of Cache::Memory. 1.59 - 2007-08-23, Tim Bunce (svn r9874) Fixed DBI::ProfileData to unescape headers lines read from data file. Fixed DBI::ProfileData to not clobber $_, thanks to Alexey Tourbin. Fixed DBI::SQL::Nano to not clobber $_, thanks to Alexey Tourbin. Fixed DBI::PurePerl to return undef for ChildHandles if weaken not available. Fixed DBD::Proxy disconnect error thanks to Philip Dye. Fixed DBD::Gofer::Transport::Base bug (typo) in timeout code. Fixed DBD::Proxy rows method thanks to Philip Dye. Fixed dbiprof compile errors, thanks to Alexey Tourbin. Fixed t/03handle.t to skip some tests if ChildHandles not available. Added check_response_sub to DBI::Gofer::Execute 1.58 - 2007-06-25, Tim Bunce (svn r9678) Fixed code triggering fatal error in bleadperl, thanks to Steve Hay. Fixed compiler warning thanks to Jerry D. Hedden. Fixed t/40profile.t to use int(dbi_time()) for systems like Cygwin where time() seems to be rounded not truncated from the high resolution time. Removed dump_results() test from t/80proxy.t. 1.57 - 2007-06-13, Tim Bunce (svn r9639) Note: this release includes a change to the DBI::hash() function which will now produce different values than before *if* your perl was built with 64-bit 'int' type (i.e. "perl -V:intsize" says intsize='8'). It's relatively rare for perl to be configured that way, even on 64-bit systems. Fixed XS versions of select*_*() methods to call execute() fetch() etc., with inner handle instead of outer. Fixed execute_for_fetch() to not cache errstr values thanks to Bart Degryse. Fixed unused var compiler warning thanks to JDHEDDEN. Fixed t/86gofer_fail tests to be less likely to fail falsely. Changed DBI::hash to return 'I32' type instead of 'int' so results are portable/consistent regardless of size of the int type. Corrected timeout example in docs thanks to Egmont Koblinger. Changed t/01basic.t to warn instead of failing when it detects a problem with Math::BigInt (some recent versions had problems). Added support for !Time and !Time~N to DBI::Profile Path. See docs. Added extra trace info to connect_cached thanks to Walery Studennikov. Added non-random (deterministic) mode to DBI_GOFER_RANDOM mechanism. Added DBIXS_REVISION macro that drivers can use. Added more docs for private_attribute_info() method. DBI::Profile changes: dbi_profile() now returns ref to relevant leaf node. Don't profile DESTROY during global destruction. Added as_node_path_list() and as_text() methods. DBI::ProfileDumper changes: Don't write file if there's no profile data. Uses full natural precision when saving data (was using %.6f) Optimized flush_to_disk(). Locks the data file while writing. Enabled filename to be a code ref for dynamic names. DBI::ProfileDumper::Apache changes: Added Quiet=>1 to avoid write to STDERR in flush_to_disk(). Added Dir=>... to specify a writable destination directory. Enabled DBI_PROFILE_APACHE_LOG_DIR for mod_perl 1 as well as 2. Added parent pid to default data file name. DBI::ProfileData changes: Added DeleteFiles option to rename & delete files once read. Locks the data files while reading. Added ability to sort by Path elements. dbiprof changes: Added --dumpnodes and --delete options. Added/updated docs for both DBI::ProfileDumper && ::Apache. 1.56 - 2007-06-18, Tim Bunce (svn r9660) Fixed printf arg warnings thanks to JDHEDDEN. Fixed returning driver-private sth attributes via gofer. Changed pod docs docs to use =head3 instead of =item so now in html you get links to individual methods etc. Changed default gofer retry_limit from 2 to 0. Changed tests to workaround Math::BigInt broken versions. Changed dbi_profile_merge() to dbi_profile_merge_nodes() old name still works as an alias for the new one. Removed old DBI internal sanity check that's no longer valid causing "panic: DESTROY (dbih_clearcom)" when tracing enabled Added DBI_GOFER_RANDOM env var that can be use to trigger random failures and delays when executing gofer requests. Designed to help test automatic retry on failures and timeout handling. Added lots more docs to all the DBD::Gofer and DBI::Gofer classes. 1.55 - 2007-05-04, Tim Bunce (svn r9504) Fixed set_err() so HandleSetErr hook is executed reliably, if set. Fixed accuracy of profiling when perl configured to use long doubles. Fixed 42prof_data.t on fast systems with poor timers thanks to Malcolm Nooning. Fixed potential corruption in selectall_arrayref and selectrow_arrayref for compiled drivers, thanks to Rob Davies. Rebuild your compiled drivers after installing DBI. Changed some handle creation code from perl to C code, to reduce handle creation cost by ~20%. Changed internal implementation of the CachedKids attribute so it's a normal handle attribute (and initially undef). Changed connect_cached and prepare_cached to avoid a FETCH method call, and thereby reduced cost by ~5% and ~30% respectively. Changed _set_fbav to not croak when given a wrongly sized array, it now warns and adjusts the row buffer to match. Changed some internals to improve performance with threaded perls. Changed DBD::NullP to be slightly more useful for testing. Changed File::Spec prerequisite to not require a minimum version. Changed tests to work with other DBMs thanks to ZMAN. Changed ex/perl_dbi_nulls_test.pl to be more descriptive. Added more functionality to the (undocumented) Callback mechanism. Callbacks can now elect to provide a value to be returned, in which case the method won't be called. A callback for "*" is applied to all methods that don't have their own callback. Added $h->{ReadOnly} attribute. Added support for DBI Profile Path to contain refs to scalars which will be de-ref'd for each profile sample. Added dbilogstrip utility to edit DBI logs for diff'ing (gets installed) Added details for SQLite 3.3 to NULL handling docs thanks to Alex Teslik. Added take_imp_data() to DBI::PurePerl. Gofer related changes: Fixed gofer pipeone & stream transports to avoid risk of hanging. Improved error handling and tracing significantly. Added way to generate random 1-in-N failures for methods. Added automatic retry-on-error mechanism to gofer transport base class. Added tests to show automatic retry mechanism works a treat! Added go_retry_hook callback hook so apps can fine-tune retry behaviour. Added header to request and response packets for sanity checking and to enable version skew between client and server. Added forced_single_resultset, max_cached_sth_per_dbh and max_cached_dbh_per_drh to gofer executor config. Driver-private methods installed with install_method are now proxied. No longer does a round-trip to the server for methods it knows have not been overridden by the remote driver. Most significant aspects of gofer behaviour are controlled by policy mechanism. Added policy-controlled caching of results for some methods, such as schema metadata. The connect_cached and prepare_cached methods cache on client and server. The bind_param_array and execute_array methods are now supported. Worked around a DBD::Sybase bind_param bug (which is fixed in DBD::Sybase 1.07) Added goferperf.pl utility (doesn't get installed). Many other assorted Gofer related bug fixes, enhancements and docs. The http and mod_perl transports have been remove to their own distribution. Client and server will need upgrading together for this release. 1.54 - 2007-02-23, Tim Bunce (svn r9157) NOTE: This release includes the 'next big thing': DBD::Gofer. Take a look! WARNING: This version has some subtle changes in DBI internals. It's possible, though doubtful, that some may affect your code. I recommend some extra testing before using this release. Or perhaps I'm just being over cautious... Fixed type_info when called for multiple dbh thanks to Cosimo Streppone. Fixed compile warnings in bleadperl on freebsd-6.1-release and solaris 10g thanks to Philip M. Gollucci. Fixed to compile for perl built with -DNO_MATHOMS thanks to Jerry D. Hedden. Fixed to work for bleadperl (r29544) thanks to Nicholas Clark. Users of Perl >= 5.9.5 will require DBI >= 1.54. Fixed rare error when profiling access to $DBI::err etc tied variables. Fixed DBI::ProfileDumper to not be affected by changes to $/ and $, thanks to Michael Schwern. Changed t/40profile.t to skip tests for perl < 5.8.0. Changed setting trace file to no longer write "Trace file set" to new file. Changed 'handle cleared whilst still active' warning for dbh to only be given for dbh that have active sth or are not AutoCommit. Changed take_imp_data to call finish on all Active child sth. Changed DBI::PurePerl trace() method to be more consistent. Changed set_err method to effectively not append to errstr if the new errstr is the same as the current one. Changed handle factory methods, like connect, prepare, and table_info, to copy any error/warn/info state of the handle being returned up into the handle the method was called on. Changed row buffer handling to not alter NUM_OF_FIELDS if it's inconsistent with number of elements in row buffer array. Updated DBI::DBD docs re handling multiple result sets. Updated DBI::DBD docs for driver authors thanks to Ammon Riley and Dean Arnold. Updated column_info docs to note that if a table doesn't exist you get an sth for an empty result set and not an error. Added new DBD::Gofer 'stateless proxy' driver and framework, and the DBI test suite is now also executed via DBD::Gofer, and DBD::Gofer+DBI::PurePerl, in addition to DBI::PurePerl. Added ability for trace() to support filehandle argument, including tracing into a string, thanks to Dean Arnold. Added ability for drivers to implement func() method so proxy drivers can proxy the func method itself. Added SQL_BIGINT type code (resolved to the ODBC/JDBC value (-5)) Added $h->private_attribute_info method. 1.53 - 2006-10-31, Tim Bunce (svn r7995) Fixed checks for weaken to work with early 5.8.x versions Fixed DBD::Proxy handling of some methods, including commit and rollback. Fixed t/40profile.t to be more insensitive to long double precision. Fixed t/40profile.t to be insensitive to small negative shifts in time thanks to Jamie McCarthy. Fixed t/40profile.t to skip tests for perl < 5.8.0. Fixed to work with current 'bleadperl' (~5.9.5) thanks to Steve Peters. Users of Perl >= 5.9.5 will require DBI >= 1.53. Fixed to be more robust against drivers not handling multiple result sets properly, thanks to Gisle Aas. Added array context support to execute_array and execute_for_fetch methods which returns executed tuples and rows affected. Added Tie::Cache::LRU example to docs thanks to Brandon Black. 1.52 - 2006-07-30, Tim Bunce (svn r6840) Fixed memory leak (per handle) thanks to Nicholas Clark and Ephraim Dan. Fixed memory leak (16 bytes per sth) thanks to Doru Theodor Petrescu. Fixed execute_for_fetch/execute_array to RaiseError thanks to Martin J. Evans. Fixed for perl 5.9.4. Users of Perl >= 5.9.4 will require DBI >= 1.52. Updated DBD::File to 0.35 to match the latest release on CPAN. Added $dbh->statistics_info specification thanks to Brandon Black. Many changes and additions to profiling: Profile Path can now uses sane strings instead of obscure numbers, can refer to attributes, assorted magical values, and even code refs! Parsing of non-numeric DBI_PROFILE env var values has changed. Changed DBI::Profile docs extensively - many new features. See DBI::Profile docs for more information. 1.51 - 2006-06-06, Tim Bunce (svn r6475) Fixed $dbh->clone method 'signature' thanks to Jeffrey Klein. Fixed default ping() method to return false if !$dbh->{Active}. Fixed t/40profile.t to be insensitive to long double precision. Fixed for perl 5.8.0's more limited weaken() function. Fixed DBD::Proxy to not alter $@ in disconnect or AUTOLOADd methods. Fixed bind_columns() to use return set_err(...) instead of die() to report incorrect number of parameters, thanks to Ben Thul. Fixed bind_col() to ignore undef as bind location, thanks to David Wheeler. Fixed for perl 5.9.x for non-threaded builds thanks to Nicholas Clark. Users of Perl >= 5.9.x will require DBI >= 1.51. Fixed fetching of rows as hash refs to preserve utf8 on field names from $sth->{NAME} thanks to Alexey Gaidukov. Fixed build on Win32 (dbd_postamble) thanks to David Golden. Improved performance for thread-enabled perls thanks to Gisle Aas. Drivers can now use PERL_NO_GET_CONTEXT thanks to Gisle Aas. Driver authors please read the notes in the DBI::DBD docs. Changed DBI::Profile format to always include a percentage, if not exiting then uses time between the first and last DBI call. Changed DBI::ProfileData to be more forgiving of systems with unstable clocks (where time may go backwards occasionally). Clarified the 'Subclassing the DBI' docs. Assorted minor changes to docs from comments on annocpan.org. Changed Makefile.PL to avoid incompatible options for old gcc. Added 'fetch array of hash refs' example to selectall_arrayref docs thanks to Tom Schindl. Added docs for $sth->{ParamArrays} thanks to Martin J. Evans. Added reference to $DBI::neat_maxlen in TRACING section of docs. Added ability for DBI::Profile Path to include attributes and a summary of where the code was called from. 1.50 - 2005-12-13, Tim Bunce (svn r2307) Fixed Makefile.PL options for gcc bug introduced in 1.49. Fixed handle magic order to keep DBD::Oracle happy. Fixed selectrow_array to return empty list on error. Changed dbi_profile_merge() to be able to recurse and merge sub-trees of profile data. Added documentation for dbi_profile_merge(), including how to measure the time spent inside the DBI for an http request. 1.49 - 2005-11-29, Tim Bunce (svn r2287) Fixed assorted attribute handling bugs in DBD::Proxy. Fixed croak() in DBD::NullP thanks to Sergey Skvortsov. Fixed handling of take_imp_data() and dbi_imp_data attribute. Fixed bugs in DBD::DBM thanks to Jeff Zucker. Fixed bug in DBI::ProfileDumper thanks to Sam Tregar. Fixed ping in DBD::Proxy thanks to George Campbell. Fixed dangling ref in $sth after parent $dbh destroyed with thanks to il@rol.ru for the bug report #13151 Fixed prerequisites to include Storable thanks to Michael Schwern. Fixed take_imp_data to be more practical. Change to require perl 5.6.1 (as advertised in 2003) not 5.6.0. Changed internals to be more strictly coded thanks to Andy Lester. Changed warning about multiple copies of Driver.xst found in @INC to ignore duplicated directories thanks to Ed Avis. Changed Driver.xst to enable drivers to define an dbd_st_prepare_sv function where the statement parameter is an SV. That enables compiled drivers to support SQL strings that are UTF-8. Changed "use DBI" to only set $DBI::connect_via if not already set. Changed docs to clarify pre-method clearing of err values. Added ability for DBI::ProfileData to edit profile path on loading. This enables aggregation of different SQL statements into the same profile node - very handy when not using placeholders or when working multiple separate tables for the same thing (ie logtable_2005_11_28) Added $sth->{ParamTypes} specification thanks to Dean Arnold. Added $h->{Callbacks} attribute to enable code hooks to be invoked when certain methods are called. For example: $dbh->{Callbacks}->{prepare} = sub { ... }; With thanks to David Wheeler for the kick start. Added $h->{ChildHandles} (using weakrefs) thanks to Sam Tregar I've recoded it in C so there's no significant performance impact. Added $h->{Type} docs (returns 'dr', 'db', or 'st') Adding trace message in DESTROY if InactiveDestroy enabled. Added %drhs = DBI->installed_drivers(); Ported DBI::ProfileDumper::Apache to mod_perl2 RC5+ thanks to Philip M. Golluci 1.48 - 2005-03-14, Tim Bunce (svn r928) Fixed DBI::DBD::Metadata generation of type_info_all thanks to Steffen Goeldner (driver authors who have used it should rerun it). Updated docs for NULL Value placeholders thanks to Brian Campbell. Added multi-keyfield nested hash fetching to fetchall_hashref() thanks to Zhuang (John) Li for polishing up my draft. Added registered driver prefixes: amzn_ for DBD::Amazon and yaswi_ for DBD::Yaswi. 1.47 - 2005-02-02, Tim Bunce (svn r854) Fixed DBI::ProxyServer to not create pid files by default. References: Ubuntu Security Notice USN-70-1, CAN-2005-0077 Thanks to Javier Fernández-Sanguino Peña from the Debian Security Audit Project, and Jonathan Leffler. Fixed some tests to work with older Test::More versions. Fixed setting $DBI::err/errstr in DBI::PurePerl. Fixed potential undef warning from connect_cached(). Fixed $DBI::lasth handling for DESTROY so lasth points to parent even if DESTROY called other methods. Fixed DBD::Proxy method calls to not alter $@. Fixed DBD::File problem with encoding pragma thanks to Erik Rijkers. Changed error handling so undef errstr doesn't cause warning. Changed DBI::DBD docs to use =head3/=head4 pod thanks to Jonathan Leffler. This may generate warnings for perl 5.6. Changed DBI::PurePerl to set autoflush on trace filehandle. Changed DBD::Proxy to treat Username as a local attribute so recent DBI version can be used with old DBI::ProxyServer. Changed driver handle caching in DBD::File. Added $GetInfoType{SQL_DATABASE_NAME} thanks to Steffen Goeldner. Updated docs to recommend some common DSN string attributes. Updated connect_cached() docs with issues and suggestions. Updated docs for NULL Value placeholders thanks to Brian Campbell. Updated docs for primary_key_info and primary_keys. Updated docs to clarify that the default fetchrow_hashref behaviour, of returning a ref to a new hash for each row, will not change. Updated err/errstr/state docs for DBD authors thanks to Steffen Goeldner. Updated handle/attribute docs for DBD authors thanks to Steffen Goeldner. Corrected and updated LongReadLen docs thanks to Bart Lateur. Added DBD::JDBC as a registered driver. 1.46 - 2004-11-16, Tim Bunce (svn r584) Fixed parsing bugs in DBI::SQL::Nano thanks to Jeff Zucker. Fixed a couple of bad links in docs thanks to Graham Barr. Fixed test.pl Win32 undef warning thanks to H.Merijn Brand & David Repko. Fixed minor issues in DBI::DBD::Metadata thanks to Steffen Goeldner. Fixed DBI::PurePerl neat() to use double quotes for utf8. Changed execute_array() definition, and default implementation, to not consider scalar values for execute tuple count. See docs. Changed DBD::File to enable ShowErrorStatement by default, which affects DBD::File subclasses such as DBD::CSV and DBD::DBM. Changed use DBI qw(:utils) tag to include $neat_maxlen. Updated Roadmap and ToDo. Added data_string_diff() data_string_desc() and data_diff() utility functions to help diagnose Unicode issues. All can be imported via the use DBI qw(:utils) tag. 1.45 - 2004-10-06, Tim Bunce (svn r480) Fixed DBI::DBD code for drivers broken in 1.44. Fixed "Free to wrong pool"/"Attempt to free unreferenced scalar" in FETCH. 1.44 - 2004-10-05, Tim Bunce (svn r478) Fixed build issues on VMS thanks to Jakob Snoer. Fixed DBD::File finish() method to return 1 thanks to Jan Dubois. Fixed rare core dump during global destruction thanks to Mark Jason Dominus. Fixed risk of utf8 flag persisting from one row to the next. Changed bind_param_array() so it doesn't require all bind arrays to have the same number of elements. Changed bind_param_array() to error if placeholder number <= 0. Changed execute_array() definition, and default implementation, to effectively NULL-pad shorter bind arrays. Changed execute_array() to return "0E0" for 0 as per the docs. Changed execute_for_fetch() definition, and default implementation, to return "0E0" for 0 like execute() and execute_array(). Changed Test::More prerequisite to Test::Simple (which is also the name of the distribution both are packaged in) to work around ppm behaviour. Corrected docs to say that get/set of unknown attribute generates a warning and is no longer fatal. Thanks to Vadim. Corrected fetchall_arrayref() docs example thanks to Drew Broadley. Added $h1->swap_inner_handle($h2) sponsored by BizRate.com 1.43 - 2004-07-02, Tim Bunce (svn r377) Fixed connect() and connect_cached() RaiseError/PrintError which would sometimes show "(no error string)" as the error. Fixed compiler warning thanks to Paul Marquess. Fixed "trace level set to" trace message thanks to H.Merijn Brand. Fixed DBD::DBM $dbh->{dbm_tables}->{...} to be keyed by the table name not the file name thanks to Jeff Zucker. Fixed last_insert_id(...) thanks to Rudy Lippan. Fixed propagation of scalar/list context into proxied methods. Fixed DBI::Profile::DESTROY to not alter $@. Fixed DBI::ProfileDumper new() docs thanks to Michael Schwern. Fixed _load_class to propagate $@ thanks to Drew Taylor. Fixed compile warnings on Win32 thanks to Robert Baron. Fixed problem building with recent versions of MakeMaker. Fixed DBD::Sponge not to generate warning with threads. Fixed DBI_AUTOPROXY to work more than once thanks to Steven Hirsch. Changed TraceLevel 1 to not show recursive/nested calls. Changed getting or setting an invalid attribute to no longer be a fatal error but generate a warning instead. Changed selectall_arrayref() to call finish() if $attr->{MaxRows} is defined. Changed all tests to use Test::More and enhanced the tests thanks to Stevan Little and Andy Lester. See http://qa.perl.org/phalanx/ Changed Test::More minimum prerequisite version to 0.40 (2001). Changed DBI::Profile header to include the date and time. Added DBI->parse_dsn($dsn) method. Added warning if build directory path contains white space. Added docs for parse_trace_flags() and parse_trace_flag(). Removed "may change" warnings from the docs for table_info(), primary_key_info(), and foreign_key_info() methods. 1.42 - 2004-03-12, Tim Bunce (svn r222) Fixed $sth->{NUM_OF_FIELDS} of non-executed statement handle to be undef as per the docs (it was 0). Fixed t/41prof_dump.t to work with perl5.9.1. Fixed DBD_ATTRIB_DELETE macro thanks to Marco Paskamp. Fixed DBI::PurePerl looks_like_number() and $DBI::rows. Fixed ref($h)->can("foo") to not croak. Changed attributes (NAME, TYPE etc) of non-executed statement handle to be undef instead of triggering an error. Changed ShowErrorStatement to apply to more $dbh methods. Changed DBI_TRACE env var so just does this at load time: DBI->trace(split '=', $ENV{DBI_TRACE}, 2); Improved "invalid number of parameters" error message. Added DBI::common as base class for DBI::db, DBD::st etc. Moved methods common to all handles into DBI::common. Major tracing enhancement: Added $h->parse_trace_flags("foo|SQL|7") to map a group of trace flags into the corresponding trace flag bits. Added automatic calling of parse_trace_flags() if setting the trace level to a non-numeric value: $h->{TraceLevel}="foo|SQL|7"; $h->trace("foo|SQL|7"); DBI->connect("dbi:Driver(TraceLevel=SQL|foo):...", ...); Currently no trace flags have been defined. Added to, and reworked, the trace documentation. Added dbivport.h for driver authors to use. Major driver additions that Jeff Zucker and I have been working on: Added DBI::SQL::Nano a 'smaller than micro' SQL parser with an SQL::Statement compatible API. If SQL::Statement is installed then DBI::SQL::Nano becomes an empty subclass of SQL::Statement, unless the DBI_SQL_NANO env var is true. Added DBD::File, modified to use DBI::SQL::Nano. Added DBD::DBM, an SQL interface to DBM files using DBD::File. Documentation changes: Corrected typos in docs thanks to Steffen Goeldner. Corrected execute_for_fetch example thanks to Dean Arnold. 1.41 - 2004-02-22, Tim Bunce (svn r130) Fixed execute_for_array() so tuple_status parameter is optional as per docs, thanks to Ed Avis. Fixed execute_for_array() docs to say that it returns undef if any of the execute() calls fail. Fixed take_imp_data() test on m68k reported by Christian Hammers. Fixed write_typeinfo_pm inconsistencies in DBI::DBD::Metadata thanks to Andy Hassall. Fixed $h->{TraceLevel} to not return DBI->trace trace level which it used to if DBI->trace trace level was higher. Changed set_err() to append to errstr, with a leading "\n" if it's not empty, so that multiple error/warning messages are recorded. Changed trace to limit elements dumped when an array reference is returned from a method to the max(40, $DBI::neat_maxlen/10) so that fetchall_arrayref(), for example, doesn't flood the trace. Changed trace level to be a four bit integer (levels 0 thru 15) and a set of topic flags (no topics have been assigned yet). Changed column_info() to check argument count. Extended bind_param() TYPE attribute specification to imply standard formating of value, eg SQL_DATE implies 'YYYY-MM-DD'. Added way for drivers to indicate 'success with info' or 'warning' by setting err to "0" for warning and "" for information. Both values are false and so don't trigger RaiseError etc. Thanks to Steffen Goeldner for the original idea. Added $h->{HandleSetErr} = sub { ... } to be called at the point that an error, warn, or info state is recorded. The code can alter the err, errstr, and state values (e.g., to promote an error to a warning, or the reverse). Added $h->{PrintWarn} attribute to enable printing of warnings recorded by the driver. Defaults to same value as $^W (perl -w). Added $h->{ErrCount} attribute, incremented whenever an error is recorded by the driver via set_err(). Added $h->{Executed} attribute, set if do()/execute() called. Added \%attr parameter to foreign_key_info() method. Added ref count of inner handle to "DESTROY ignored for outer" msg. Added Win32 build config checks to DBI::DBD thanks to Andy Hassall. Added bind_col to Driver.xst so drivers can define their own. Added TYPE attribute to bind_col and specified the expected driver behaviour. Major update to signal handling docs thanks to Lincoln Baxter. Corrected dbiproxy usage doc thanks to Christian Hammers. Corrected type_info_all index hash docs thanks to Steffen Goeldner. Corrected type_info COLUMN_SIZE to chars not bytes thanks to Dean Arnold. Corrected get_info() docs to include details of DBI::Const::GetInfoType. Clarified that $sth->{PRECISION} is OCTET_LENGTH for char types. 1.40 - 2004-01-07, Tim Bunce Fixed handling of CachedKids when DESTROYing threaded handles. Fixed sql_user_name() in DBI::DBD::Metadata (used by write_getinfo_pm) to use $dbh->{Username}. Driver authors please update your code. Changed connect_cached() when running under Apache::DBI to route calls to Apache::DBI::connect(). Added CLONE() to DBD::Sponge and DBD::ExampleP. Added warning when starting a new thread about any loaded driver which does not have a CLONE() function. Added new prepare_cache($sql, \%attr, 3) option to manage Active handles. Added SCALE and NULLABLE support to DBD::Sponge. Added missing execute() in fetchall_hashref docs thanks to Iain Truskett. Added a CONTRIBUTING section to the docs with notes on creating patches. 1.39 - 2003-11-27, Tim Bunce Fixed STORE to not clear error during nested DBI call, again/better, thanks to Tony Bowden for the report and helpful test case. Fixed DBI dispatch to not try to use AUTOLOAD for driver methods unless the method has been declared (as methods should be when using AUTOLOAD). This fixes a problem when the Attribute::Handlers module is loaded. Fixed cwd check code to use $Config{path_sep} thanks to Steve Hay. Fixed unqualified croak() calls thanks to Steffen Goeldner. Fixed DBD::ExampleP TYPE and PRECISION attributes thanks to Tom Lowery. Fixed tracing of methods that only get traced at high trace levels. The level 1 trace no longer includes nested method calls so it generally just shows the methods the application explicitly calls. Added line to trace log (level>=4) when err/errstr is cleared. Updated docs for InactiveDestroy and point out where and when the trace includes the process id. Update DBI::DBD docs thanks to Steffen Goeldner. Removed docs saying that the DBI->data_sources method could be passed a $dbh. The $dbh->data_sources method should be used instead. Added link to 'DBI recipes' thanks to Giuseppe Maxia: http://gmax.oltrelinux.com/dbirecipes.html (note that this is not an endorsement that the recipies are 'optimal') Note: There is a bug in perl 5.8.2 when configured with threads and debugging enabled (bug #24463) which causes a DBI test to fail. 1.38 - 2003-08-21, Tim Bunce NOTE: The DBI now requires perl version 5.6.0 or later. (As per notice in DBI 1.33 released 27th February 2003) Fixed spurious t/03handles failure on 64bit perls reported by H.Merijn Brand. Fixed spurious t/15array failure on some perl versions thanks to Ed Avis. Fixed build using dmake on windows thanks to Steffen Goeldner. Fixed build on using some shells thanks to Gurusamy Sarathy. Fixed ParamValues to only be appended to ShowErrorStatement if not empty. Fixed $dbh->{Statement} not being writable by drivers in some cases. Fixed occasional undef warnings on connect failures thanks to Ed Avis. Fixed small memory leak when using $sth->{NAME..._hash}. Fixed 64bit warnings thanks to Marian Jancar. Fixed DBD::Proxy::db::DESTROY to not alter $@ thanks to Keith Chapman. Fixed Makefile.PL status from WriteMakefile() thanks to Leon Brocard. Changed "Can't set ...->{Foo}: unrecognised attribute" from an error to a warning when running with DBI::ProxyServer to simplify upgrades. Changed execute_array() to no longer require ArrayTupleStatus attribute. Changed DBI->available_drivers to not hide DBD::Sponge. Updated/moved placeholder docs to a better place thanks to Johan Vromans. Changed dbd_db_do4 api in Driver.xst to match dbd_st_execute (return int, not bool), relevant only to driver authors. Changed neat(), and thus trace(), so strings marked as utf8 are presented in double quotes instead of single quotes and are not sanitized. Added $dbh->data_sources method. Added $dbh->last_insert_id method. Added $sth->execute_for_fetch($fetch_tuple_sub, \@tuple_status) method. Added DBI->installed_versions thanks to Jeff Zucker. Added $DBI::Profile::ON_DESTROY_DUMP variable. Added docs for DBD::Sponge thanks to Mark Stosberg. 1.37 - 2003-05-15, Tim Bunce Fixed "Can't get dbh->{Statement}: unrecognised attribute" error in test caused by change to perl internals in 5.8.0 Fixed to build with latest development perl (5.8.1@19525). Fixed C code to use all ANSI declarations thanks to Steven Lembark. 1.36 - 2003-05-11, Tim Bunce Fixed DBI->connect to carp instead of croak on 'old-style' usage. Fixed connect(,,, { RootClass => $foo }) to not croak if module not found. Fixed code generated by DBI::DBD::Metadata thanks to DARREN@cpan.org (#2270) Fixed DBI::PurePerl to not reset $@ during method dispatch. Fixed VMS build thanks to Michael Schwern. Fixed Proxy disconnect thanks to Steven Hirsch. Fixed error in DBI::DBD docs thanks to Andy Hassall. Changed t/40profile.t to not require Time::HiRes. Changed DBI::ProxyServer to load DBI only on first request, which helps threaded server mode, thanks to Bob Showalter. Changed execute_array() return value from row count to executed tuple count, and now the ArrayTupleStatus attribute is mandatory. NOTE: That is an API definition change that may affect your code. Changed CompatMode attribute to also disable attribute 'quick FETCH'. Changed attribute FETCH to be slightly faster thanks to Stas Bekman. Added workaround for perl bug #17575 tied hash nested FETCH thanks to Silvio Wanka. Added Username and Password attributes to connect(..., \%attr) and so also embedded in DSN like "dbi:Driver(Username=user,Password=pass):..." Username and Password can't contain ")", ",", or "=" characters. The predence is DSN first, then \%attr, then $user & $pass parameters, and finally the DBI_USER & DBI_PASS environment variables. The Username attribute is stored in the $dbh but the Password is not. Added ProxyServer HOWTO configure restrictions docs thanks to Jochen Wiedmann. Added MaxRows attribute to selectcol_arrayref prompted by Wojciech Pietron. Added dump_handle as a method not just a DBI:: utility function. Added on-demand by-row data feed into execute_array() using code ref, or statement handle. For example, to insert from a select: $insert_sth->execute_array( { ArrayTupleFetch => $select_sth, ... } ) Added warning to trace log when $h->{foo}=... is ignored due to invalid prefix (e.g., not 'private_'). 1.35 - 2003-03-07, Tim Bunce Fixed memory leak in fetchrow_hashref introduced in DBI 1.33. Fixed various DBD::Proxy errors introduced in DBI 1.33. Fixed to ANSI C in dbd_dr_data_sources thanks to Jonathan Leffler. Fixed $h->can($method_name) to return correct code ref. Removed DBI::Format from distribution as it's now part of the separate DBI::Shell distribution by Tom Lowery. Updated DBI::DBD docs with a note about the CLONE method. Updated DBI::DBD docs thanks to Jonathan Leffler. Updated DBI::DBD::Metadata for perl 5.5.3 thanks to Jonathan Leffler. Added note to install_method docs about setup_driver() method. 1.34 - 2003-02-28, Tim Bunce Fixed DBI::DBD docs to refer to DBI::DBD::Metadata thanks to Jonathan Leffler. Fixed dbi_time() compile using BorlandC on Windows thanks to Steffen Goeldner. Fixed profile tests to do enough work to measure on Windows. Fixed disconnect_all() to not be required by drivers. Added $okay = $h->can($method_name) to check if a method exists. Added DBD::*::*->install_method($method_name, \%attr) so driver private methods can be 'installed' into the DBI dispatcher and no longer need to be called using $h->func(..., $method_name). Enhanced $dbh->clone() and documentation. Enhanced docs to note that dbi_time(), and thus profiling, is limited to only millisecond (seconds/1000) resolution on Windows. Removed old DBI::Shell from distribution and added Tom Lowery's improved version to the Bundle::DBI file. Updated minimum version numbers for modules in Bundle::DBI. 1.33 - 2003-02-27, Tim Bunce NOTE: Future versions of the DBI *will not* support perl 5.6.0 or earlier. : Perl 5.6.1 will be the minimum supported version. NOTE: The "old-style" connect: DBI->connect($database, $user, $pass, $driver); : has been deprecated for several years and will now generate a warning. : It will be removed in a later release. Please change any old connect() calls. Added $dbh2 = $dbh1->clone to make a new connection to the database that is identical to the original one. clone() can be called even after the original handle has been disconnected. See the docs for more details. Fixed merging of profile data to not sum DBIprof_FIRST_TIME values. Fixed unescaping of newlines in DBI::ProfileData thanks to Sam Tregar. Fixed Taint bug with fetchrow_hashref with help from Bradley Baetz. Fixed $dbh->{Active} for DBD::Proxy, reported by Bob Showalter. Fixed STORE to not clear error during nested DBI call, thanks to Tony Bowden for the report and helpful test case. Fixed DBI::PurePerl error clearing behaviour. Fixed dbi_time() and thus DBI::Profile on Windows thanks to Smejkal Petr. Fixed problem that meant ShowErrorStatement could show wrong statement, thanks to Ron Savage for the report and test case. Changed Apache::DBI hook to check for $ENV{MOD_PERL} instead of $ENV{GATEWAY_INTERFACE} thanks to Ask Bjoern Hansen. No longer tries to dup trace logfp when an interpreter is being cloned. Database handles no longer inherit shared $h->err/errstr/state storage from their drivers, so each $dbh has it's own $h->err etc. values and is no longer affected by calls made on other dbh's. Now when a dbh is destroyed it's err/errstr/state values are copied up to the driver so checking $DBI::errstr still works as expected. Build / portability fixes: Fixed t/40profile.t to not use Time::HiRes. Fixed t/06attrs.t to not be locale sensitive, reported by Christian Hammers. Fixed sgi compiler warnings, reported by Paul Blake. Fixed build using make -j4, reported by Jonathan Leffler. Fixed build and tests under VMS thanks to Craig A. Berry. Documentation changes: Documented $high_resolution_time = dbi_time() function. Documented that bind_col() can take an attribute hash. Clarified documentation for ParamValues attribute hash keys. Many good DBI documentation tweaks from Jonathan Leffler, including a major update to the DBI::DBD driver author guide. Clarified that execute() should itself call finish() if it's called on a statement handle that's still active. Clarified $sth->{ParamValues}. Driver authors please note. Removed "NEW" markers on some methods and attributes and added text to each giving the DBI version it was added in, if it was added after DBI 1.21 (Feb 2002). Changes of note for authors of all drivers: Added SQL_DATA_TYPE, SQL_DATETIME_SUB, NUM_PREC_RADIX, and INTERVAL_PRECISION fields to docs for type_info_all. There were already in type_info(), but type_info_all() didn't specify the index values. Please check and update your type_info_all() code. Added DBI::DBD::Metadata module that auto-generates your drivers get_info and type_info_all data and code, thanks mainly to Jonathan Leffler and Steffen Goeldner. If you've not implemented get_info and type_info_all methods and your database has an ODBC driver available then this will do all the hard work for you! Drivers should no longer pass Err, Errstr, or State to _new_drh or _new_dbh functions. Please check that you support the slightly modified behaviour of $sth->{ParamValues}, e.g., always return hash with keys if possible. Changes of note for authors of compiled drivers: Added dbd_db_login6 & dbd_st_finish3 prototypes thanks to Jonathan Leffler. All dbd_*_*() functions implemented by drivers must have a corresponding #define dbd_*_* _*_* otherwise the driver may not work with a future release of the DBI. Changes of note for authors of drivers which use Driver.xst: Some new method hooks have been added are are enabled by defining corresponding macros: $drh->data_sources() - dbd_dr_data_sources $dbh->do() - dbd_db_do4 The following methods won't be compiled into the driver unless the corresponding macro has been #defined: $drh->disconnect_all() - dbd_discon_all 1.32 - 2002-12-01, Tim Bunce Fixed to work with 5.005_03 thanks to Tatsuhiko Miyagawa (I've not tested it). Reenabled taint tests (accidentally left disabled) spotted by Bradley Baetz. Improved docs for FetchHashKeyName attribute thanks to Ian Barwick. Fixed core dump if fetchrow_hashref given bad argument (name of attribute with a value that wasn't an array reference), spotted by Ian Barwick. Fixed some compiler warnings thanks to David Wheeler. Updated Steven Hirsch's enhanced proxy work (seems I left out a bit). Made t/40profile.t tests more reliable, reported by Randy, who is part of the excellent CPAN testers team: http://testers.cpan.org/ (Please visit, see the valuable work they do and, ideally, join in!) 1.31 - 2002-11-29, Tim Bunce The fetchall_arrayref method, when called with a $maxrows parameter, no longer gives an error if called again after all rows have been fetched. This simplifies application logic when fetching in batches. Also added batch-fetch while() loop example to the docs. The proxy now supports non-lazy (synchronous) prepare, positioned updates (for selects containing 'for update'), PlRPC config set via attributes, and accurate propagation of errors, all thanks to Steven Hirsch (plus a minor fix from Sean McMurray and doc tweaks from Michael A Chase). The DBI_AUTOPROXY env var can now hold the full dsn of the proxy driver plus attributes, like "dbi:Proxy(proxy_foo=>1):host=...". Added TaintIn & TaintOut attributes to give finer control over tainting thanks to Bradley Baetz. The RootClass attribute no longer ignores failure to load a module, but also doesn't try to load a module if the class already exists, with thanks to James FitzGibbon. HandleError attribute works for connect failures thanks to David Wheeler. The connect() RaiseError/PrintError message now includes the username. Changed "last handle unknown or destroyed" warning to be a trace message. Removed undocumented $h->event() method. Further enhancements to DBD::PurePerl accuracy. The CursorName attribute now defaults to undef and not an error. DBI::Profile changes: New DBI::ProfileDumper, DBI::ProfileDumper::Apache, and DBI::ProfileData modules (to manage the storage and processing of profile data), plus dbiprof program for analyzing profile data - with many thanks to Sam Tregar. Added $DBI::err (etc) tied variable lookup time to profile. Added time for DESTROY method into parent handles profile (used to be ignored). Documentation changes: Documented $dbh = $sth->{Database} attribute. Documented $dbh->connected(...) post-connection call when subclassing. Updated some minor doc issues thanks to H.Merijn Brand. Updated Makefile.PL example in DBI::DBD thanks to KAWAI,Takanori. Fixed execute_array() example thanks to Peter van Hardenberg. Changes for driver authors, not required but strongly recommended: Change DBIS to DBIc_DBISTATE(imp_xxh) [or imp_dbh, imp_sth etc] Change DBILOGFP to DBIc_LOGPIO(imp_xxh) [or imp_dbh, imp_sth etc] Any function from which all instances of DBIS and DBILOGFP are removed can also have dPERLINTERP removed (a good thing). All use of the DBIh_EVENT* macros should be removed. Major update to DBI::DBD docs thanks largely to Jonathan Leffler. Add these key values: 'Err' => \my $err, 'Errstr' => \my $errstr, to the hash passed to DBI::_new_dbh() in your driver source code. That will make each $dbh have it's own $h->err and $h->errstr values separate from other $dbh belonging to the same driver. If you have a ::db or ::st DESTROY methods that do nothing you can now remove them - which speeds up handle destruction. 1.30 - 2002-07-18, Tim Bunce Fixed problems with selectrow_array, selectrow_arrayref, and selectall_arrayref introduced in DBI 1.29. Fixed FETCHing a handle attribute to not clear $DBI::err etc (broken in 1.29). Fixed core dump at trace level 9 or above. Fixed compilation with perl 5.6.1 + ithreads (i.e. Windows). Changed definition of behaviour of selectrow_array when called in a scalar context to match fetchrow_array. Corrected selectrow_arrayref docs which showed selectrow_array thanks to Paul DuBois. 1.29 - 2002-07-15, Tim Bunce NOTE: This release changes the specified behaviour for the : fetchrow_array method when called in a scalar context: : The DBI spec used to say that it would return the FIRST field. : Which field it returns (i.e., the first or the last) is now undefined. : This does not affect statements that only select one column, which is : usually the case when fetchrow_array is called in a scalar context. : FYI, this change was triggered by discovering that the fetchrow_array : implementation in Driver.xst (used by most compiled drivers) : didn't match the DBI specification. Rather than change the code : to match, and risk breaking existing applications, I've changed the : specification (that part was always of dubious value anyway). NOTE: Future versions of the DBI may not support for perl 5.5 much longer. : If you are still using perl 5.005_03 you should be making plans to : upgrade to at least perl 5.6.1, or 5.8.0. Perl 5.8.0 is due to be : released in the next week or so. (Although it's a "point 0" release, : it is the most thoroughly tested release ever.) Added XS/C implementations of selectrow_array, selectrow_arrayref, and selectall_arrayref to Driver.xst. See DBI 1.26 Changes for more info. Removed support for the old (fatally flawed) "5005" threading model. Added support for new perl 5.8 iThreads thanks to Gerald Richter. (Threading support and safety should still be regarded as beta quality until further notice. But it's much better than it was.) Updated the "Threads and Thread Safety" section of the docs. The trace output can be sent to STDOUT instead of STDERR by using "STDOUT" as the name of the file, i.e., $h->trace(..., "STDOUT") Added pointer to perlreftut, perldsc, perllol, and perlboot manuals into the intro section of the docs, suggested by Brian McCain. Fixed DBI::Const::GetInfo::* pod docs thanks to Zack Weinberg. Some changes to how $dbh method calls are treated by DBI::Profile: Meta-data methods now clear $dbh->{Statement} on entry. Some $dbh methods are now profiled as if $dbh->{Statement} was empty (because thet're unlikely to actually relate to its contents). Updated dbiport.h to ppport.h from perl 5.8.0. Tested with perl 5.5.3 (vanilla, Solaris), 5.6.1 (vanilla, Solaris), and perl 5.8.0 (RC3@17527 with iThreads & Multiplicity on Solaris and FreeBSD). 1.28 - 2002-06-14, Tim Bunce Added $sth->{ParamValues} to return a hash of the most recent values bound to placeholders via bind_param() or execute(). Individual drivers need to be updated to support it. Enhanced ShowErrorStatement to include ParamValues if available: "DBD::foo::st execute failed: errstr [for statement ``...'' with params: 1='foo']" Further enhancements to DBD::PurePerl accuracy. 1.27 - 2002-06-13, Tim Bunce Fixed missing column in C implementation of fetchall_arrayref() thanks to Philip Molter for the prompt reporting of the problem. 1.26 - 2002-06-13, Tim Bunce Fixed t/40profile.t to work on Windows thanks to Smejkal Petr. Fixed $h->{Profile} to return undef, not error, if not set. Fixed DBI->available_drivers in scalar context thanks to Michael Schwern. Added C implementations of selectrow_arrayref() and fetchall_arrayref() in Driver.xst. All compiled drivers using Driver.xst will now be faster making those calls. Most noticeable with fetchall_arrayref for many rows or selectrow_arrayref with a fast query. For example, using DBD::mysql a selectrow_arrayref for a single row using a primary key is ~20% faster, and fetchall_arrayref for 20000 rows is twice as fast! Drivers just need to be recompiled and reinstalled to enable it. The fetchall_arrayref speed up only applies if $slice parameter is not used. Added $max_rows parameter to fetchall_arrayref() to optionally limit the number of rows returned. Can now fetch batches of rows. Added MaxRows attribute to selectall_arrayref() which then passes it to fetchall_arrayref(). Changed selectrow_array to make use of selectrow_arrayref. Trace level 1 now shows first two parameters of all methods (used to only for that for some, like prepare,execute,do etc) Trace indicator for recursive calls (first char on trace lines) now starts at 1 not 2. Documented that $h->func() does not trigger RaiseError etc so applications must explicitly check for errors. DBI::Profile with DBI_PROFILE now shows percentage time inside DBI. HandleError docs updated to show that handler can edit error message. HandleError subroutine interface is now regarded as stable. 1.25 - 2002-06-05, Tim Bunce Fixed build problem on Windows and some compiler warnings. Fixed $dbh->{Driver} and $sth->{Statement} for driver internals These are 'inner' handles as per behaviour prior to DBI 1.16. Further minor improvements to DBI::PurePerl accuracy. 1.24 - 2002-06-04, Tim Bunce Fixed reference loop causing a handle/memory leak that was introduced in DBI 1.16. Fixed DBI::Format to work with 'filehandles' from IO::Scalar and similar modules thanks to report by Jeff Boes. Fixed $h->func for DBI::PurePerl thanks to Jeff Zucker. Fixed $dbh->{Name} for DBI::PurePerl thanks to Dean Arnold. Added DBI method call profiling and benchmarking. This is a major new addition to the DBI. See $h->{Profile} attribute and DBI::Profile module. For a quick trial, set the DBI_PROFILE environment variable and run your favourite DBI script. Try it with DBI_PROFILE set to 1, then try 2, 4, 8, 10, and -10. Have fun! Added execute_array() and bind_param_array() documentation with thanks to Dean Arnold. Added notes about the DBI having not yet been tested with iThreads (testing and patches for SvLOCK etc welcome). Removed undocumented Handlers attribute (replaced by HandleError). Tested with 5.5.3 and 5.8.0 RC1. 1.23 - 2002-05-25, Tim Bunce Greatly improved DBI::PurePerl in performance and accuracy. Added more detail to DBI::PurePerl docs about what's not supported. Fixed undef warnings from t/15array.t and DBD::Sponge. 1.22 - 2002-05-22, Tim Bunce Added execute_array() and bind_param_array() with special thanks to Dean Arnold. Not yet documented. See t/15array.t for examples. All drivers now automatically support these methods. Added DBI::PurePerl, a transparent DBI emulation for pure-perl drivers with special thanks to Jeff Zucker. Perldoc DBI::PurePerl for details. Added DBI::Const::GetInfo* modules thanks to Steffen Goeldner. Added write_getinfo_pm utility to DBI::DBD thanks to Steffen Goeldner. Added $allow_active==2 mode for prepare_cached() thanks to Stephen Clouse. Updated DBI::Format to Revision 11.4 thanks to Tom Lowery. Use File::Spec in Makefile.PL (helps VMS etc) thanks to Craig Berry. Extend $h->{Warn} to commit/rollback ineffective warning thanks to Jeff Baker. Extended t/preparse.t and removed "use Devel::Peek" thanks to Scott Hildreth. Only copy Changes to blib/lib/Changes.pm once thanks to Jonathan Leffler. Updated internals for modern perls thanks to Jonathan Leffler and Jeff Urlwin. Tested with perl 5.7.3 (just using default perl config). Documentation changes: Added 'Catalog Methods' section to docs thanks to Steffen Goeldner. Updated README thanks to Michael Schwern. Clarified that driver may choose not to start new transaction until next use of $dbh after commit/rollback. Clarified docs for finish method. Clarified potentials problems with prepare_cached() thanks to Stephen Clouse. 1.21 - 2002-02-07, Tim Bunce The minimum supported perl version is now 5.005_03. Fixed DBD::Proxy support for AutoCommit thanks to Jochen Wiedmann. Fixed DBI::ProxyServer bind_param(_inout) handing thanks to Oleg Mechtcheriakov. Fixed DBI::ProxyServer fetch loop thanks to nobull@mail.com. Fixed install_driver do-the-right-thing with $@ on error. It, and connect(), will leave $@ empty on success and holding the error message on error. Thanks to Jay Lawrence, Gavin Sherlock and others for the bug report. Fixed fetchrow_hashref to assign columns to the hash left-to-right so later fields with the same name overwrite earlier ones as per DBI < 1.15, thanks to Kay Roepke. Changed tables() to use quote_indentifier() if the driver returns a true value for $dbh->get_info(29) # SQL_IDENTIFIER_QUOTE_CHAR Changed ping() so it no longer triggers RaiseError/PrintError. Changed connect() to not call $class->install_driver unless needed. Changed DESTROY to catch fatal exceptions and append to $@. Added ISO SQL/CLI & ODBCv3 data type definitions thanks to Steffen Goeldner. Removed the definition of SQL_BIGINT data type constant as the value is inconsistent between standards (ODBC=-5, SQL/CLI=25). Added $dbh->column_info(...) thanks to Steffen Goeldner. Added $dbh->foreign_key_info(...) thanks to Steffen Goeldner. Added $dbh->quote_identifier(...) insipred by Simon Oliver. Added $dbh->set_err(...) for DBD authors and DBI subclasses (actually been there for a while, now expanded and documented). Added $h->{HandleError} = sub { ... } addition and/or alternative to RaiseError/PrintError. See the docs for more info. Added $h->{TraceLevel} = N attribute to set/get trace level of handle thus can set trace level via an (eg externally specified) DSN using the embedded attribute syntax: $dsn = 'dbi:DB2(PrintError=1,TraceLevel=2):dbname'; Plus, you can also now do: local($h->{TraceLevel}) = N; (but that leaks a little memory in some versions of perl). Added some call tree information to trace output if trace level >= 3 With thanks to Graham Barr for the stack walking code. Added experimental undocumented $dbh->preparse(), see t/preparse.t With thanks to Scott T. Hildreth for much of the work. Added Fowler/Noll/Vo hash type as an option to DBI::hash(). Documentation changes: Added DBI::Changes so now you can "perldoc DBI::Changes", yeah! Added selectrow_arrayref & selectrow_hashref docs thanks to Doug Wilson. Added 'Standards Reference Information' section to docs to gather together all references to relevant on-line standards. Added link to poop.sourceforge.net into the docs thanks to Dave Rolsky. Added link to hyperlinked BNF for SQL92 thanks to Jeff Zucker. Added 'Subclassing the DBI' docs thanks to Stephen Clouse, and then changed some of them to reflect the new approach to subclassing. Added stronger wording to description of $h->{private_*} attributes. Added docs for DBI::hash. Driver API changes: Now a COPY of the DBI->connect() attributes is passed to the driver connect() method, so it can process and delete any elements it wants. Deleting elements reduces/avoids the explicit $dbh->{$_} = $attr->{$_} foreach keys %$attr; that DBI->connect does after the driver connect() method returns. 1.20 - 2001-08-24, Tim Bunce WARNING: This release contains two changes that may affect your code. : Any code using selectall_hashref(), which was added in March 2001, WILL : need to be changed. Any code using fetchall_arrayref() with a non-empty : hash slice parameter may, in a few rare cases, need to be changed. : See the change list below for more information about the changes. : See the DBI documentation for a description of current behaviour. Fixed memory leak thanks to Toni Andjelkovic. Changed fetchall_arrayref({ foo=>1, ...}) specification again (sorry): The key names of the returned hashes is identical to the letter case of the names in the parameter hash, regardless of the L attribute. The letter case is ignored for matching. Changed fetchall_arrayref([...]) array slice syntax specification to clarify that the numbers in the array slice are perl index numbers (which start at 0) and not column numbers (which start at 1). Added { Columns=>... } and { Slice =>... } attributes to selectall_arrayref() which is passed to fetchall_arrayref() so it can fetch hashes now. Added a { Columns => [...] } attribute to selectcol_arrayref() so that the list it returns can be built from more than one column per row. Why? Consider my %hash = @{$dbh->selectcol_arrayref($sql,{ Columns=>[1,2]})} to return id-value pairs which can be used directly to build a hash. Added $hash_ref = $sth->fetchall_hashref( $key_field ) which returns a ref to a hash with, typically, one element per row. $key_field is the name of the field to get the key for each row from. The value of the hash for each row is a hash returned by fetchrow_hashref. Changed selectall_hashref to return a hash ref (from fetchall_hashref) and not an array of hashes as it has since DBI 1.15 (end March 2001). WARNING: THIS CHANGE WILL BREAK ANY CODE USING selectall_hashref()! Sorry, but I think this is an important regularization of the API. To get previous selectall_hashref() behaviour (an array of hash refs) change $ary_ref = $dbh->selectall_hashref( $statement, undef, @bind); to $ary_ref = $dbh->selectall_arrayref($statement, { Columns=>{} }, @bind); Added NAME_lc_hash, NAME_uc_hash, NAME_hash statement handle attributes. which return a ref to a hash of field_name => field_index (0..n-1) pairs. Fixed select_hash() example thanks to Doug Wilson. Removed (unbundled) DBD::ADO and DBD::Multiplex from the DBI distribution. The latest versions of those modules are available from CPAN sites. Added $dbh->begin_work. This method causes AutoCommit to be turned off just until the next commit() or rollback(). Driver authors: if the DBIcf_BegunWork flag is set when your commit or rollback method is called then please turn AutoCommit on and clear the DBIcf_BegunWork flag. If you don't then the DBI will but it'll be much less efficient and won't handle error conditions very cleanly. Retested on perl 5.4.4, but the DBI won't support 5.4.x much longer. Added text to SUPPORT section of the docs: For direct DBI and DBD::Oracle support, enhancement, and related work I am available for consultancy on standard commercial terms. Added text to ACKNOWLEDGEMENTS section of the docs: Much of the DBI and DBD::Oracle was developed while I was Technical Director (CTO) of the Paul Ingram Group (www.ig.co.uk). So I'd especially like to thank Paul for his generosity and vision in supporting this work for many years. 1.19 - 2001-07-20, Tim Bunce Made fetchall_arrayref({ foo=>1, ...}) be more strict to the specification in relation to wanting hash slice keys to be lowercase names. WARNING: If you've used fetchall_arrayref({...}) with a hash slice that contains keys with uppercase letters then your code will break. (As far as I recall the spec has always said don't do that.) Fixed $sth->execute() to update $dbh->{Statement} to $sth->{Statement}. Added row number to trace output for fetch method calls. Trace level 1 no longer shows fetches with row>1 (to reduce output volume). Added $h->{FetchHashKeyName} = 'NAME_lc' or 'NAME_uc' to alter behaviour of fetchrow_hashref() method. See docs. Added type_info quote caching to quote() method thanks to Dean Kopesky. Makes using quote() with second data type param much much faster. Added type_into_all() caching to type_info(), spotted by Dean Kopesky. Added new API definition for table_info() and tables(), driver authors please note! Added primary_key_info() to DBI API thanks to Steffen Goeldner. Added primary_key() to DBI API as simpler interface to primary_key_info(). Indent and other fixes for DBI::DBD doc thanks to H.Merijn Brand. Added prepare_cached() insert_hash() example thanks to Doug Wilson. Removed false docs for fetchall_hashref(), use fetchall_arrayref({}). 1.18 - 2001-06-04, Tim Bunce Fixed that altering ShowErrorStatement also altered AutoCommit! Thanks to Jeff Boes for spotting that clanger. Fixed DBD::Proxy to handle commit() and rollback(). Long overdue, sorry. Fixed incompatibility with perl 5.004 (but no one's using that right? :) Fixed connect_cached and prepare_cached to not be affected by the order of elements in the attribute hash. Spotted by Mitch Helle-Morrissey. Fixed version number of DBI::Shell reported by Stuhlpfarrer Gerhard and others. Defined and documented table_info() attribute semantics (ODBC compatible) thanks to Olga Voronova, who also implemented then in DBD::Oracle. Updated Win32::DBIODBC (Win32::ODBC emulation) thanks to Roy Lee. 1.16 - 2001-05-30, Tim Bunce Reimplemented fetchrow_hashref in C, now fetches about 25% faster! Changed behaviour if both PrintError and RaiseError are enabled to simply do both (in that order, obviously :) Slight reduction in DBI handle creation overhead. Fixed $dbh->{Driver} & $sth->{Database} to return 'outer' handles. Fixed execute param count check to honour RaiseError spotted by Belinda Giardie. Fixed build for perl5.6.1 with PERLIO thanks to H.Merijn Brand. Fixed client sql restrictions in ProxyServer.pm thanks to Jochen Wiedmann. Fixed batch mode command parsing in Shell thanks to Christian Lemburg. Fixed typo in selectcol_arrayref docs thanks to Jonathan Leffler. Fixed selectrow_hashref to be available to callers thanks to T.J.Mather. Fixed core dump if statement handle didn't define Statement attribute. Added bind_param_inout docs to DBI::DBD thanks to Jonathan Leffler. Added note to data_sources() method docs that some drivers may require a connected database handle to be supplied as an attribute. Trace of install_driver method now shows path of driver file loaded. Changed many '||' to 'or' in the docs thanks to H.Merijn Brand. Updated DBD::ADO again (improvements in error handling) from Tom Lowery. Updated Win32::DBIODBC (Win32::ODBC emulation) thanks to Roy Lee. Updated email and web addresses in DBI::FAQ thanks to Michael A Chase. 1.15 - 2001-03-28, Tim Bunce Added selectrow_arrayref Added selectrow_hashref Added selectall_hashref thanks to Leon Brocard. Added DBI->connect(..., { dbi_connect_method => 'method' }) Added $dbh->{Statement} aliased to most recent child $sth->{Statement}. Added $h->{ShowErrorStatement}=1 to cause the appending of the relevant Statement text to the RaiseError/PrintError text. Modified type_info to always return hash keys in uppercase and to not require uppercase 'DATA_TYPE' key from type_info_all. Thanks to Jennifer Tong and Rob Douglas. Added \%attr param to tables() and table_info() methods. Trace method uses warn() if it can't open the new file. Trace shows source line and filename during global destruction. Updated packages: Updated Win32::DBIODBC (Win32::ODBC emulation) thanks to Roy Lee. Updated DBD::ADO to much improved version 0.4 from Tom Lowery. Updated DBD::Sponge to include $sth->{PRECISION} thanks to Tom Lowery. Changed DBD::ExampleP to use lstat() instead of stat(). Documentation: Documented $DBI::lasth (which has been there since day 1). Documented SQL_* names. Clarified and extended docs for $h->state thanks to Masaaki Hirose. Clarified fetchall_arrayref({}) docs (thanks to, er, someone!). Clarified type_info_all re lettercase and index values. Updated DBI::FAQ to 0.38 thanks to Alligator Descartes. Added cute bind_columns example thanks to H.Merijn Brand. Extended docs on \%attr arg to data_sources method. Makefile.PL Removed obscure potential 'rm -rf /' (thanks to Ulrich Pfeifer). Removed use of glob and find (thanks to Michael A. Chase). Proxy: Removed debug messages from DBD::Proxy AUTOLOAD thanks to Brian McCauley. Added fix for problem using table_info thanks to Tom Lowery. Added better determination of where to put the pid file, and... Added KNOWN ISSUES section to DBD::Proxy docs thanks to Jochen Wiedmann. Shell: Updated DBI::Format to include DBI::Format::String thanks to Tom Lowery. Added describe command thanks to Tom Lowery. Added columnseparator option thanks to Tom Lowery (I think). Added 'raw' format thanks to, er, someone, maybe Tom again. Known issues: Perl 5.005 and 5.006 both leak memory doing local($handle->{Foo}). Perl 5.004 doesn't. The leak is not a DBI or driver bug. 1.14 - 2000-06-14, Tim Bunce NOTE: This version is the one the DBI book is based on. NOTE: This version requires at least Perl 5.004. Perl 5.6 ithreads changes with thanks to Doug MacEachern. Changed trace output to use PerlIO thanks to Paul Moore. Fixed bug in RaiseError/PrintError handling. (% chars in the error string could cause a core dump.) Fixed Win32 PerlEx IIS concurrency bugs thanks to Murray Nesbitt. Major documentation polishing thanks to Linda Mui at O'Reilly. Password parameter now shown as **** in trace output. Added two fields to type_info and type_info_all. Added $dsn to PrintError/RaiseError message from DBI->connect(). Changed prepare_cached() croak to carp if sth still Active. Added prepare_cached() example to the docs. Added further DBD::ADO enhancements from Thomas Lowery. 1.13 - 1999-07-11, Tim Bunce Fixed Win32 PerlEx IIS concurrency bugs thanks to Murray Nesbitt. Fixed problems with DBD::ExampleP long_list test mode. Added SQL_WCHAR SQL_WVARCHAR SQL_WLONGVARCHAR and SQL_BIT to list of known and exportable SQL types. Improved data fetch performance of DBD::ADO. Added GetTypeInfo to DBD::ADO thanks to Thomas Lowery. Actually documented connect_cached thanks to Michael Schwern. Fixed user/key/cipher bug in ProxyServer thanks to Joshua Pincus. 1.12 - 1999-06-29, Tim Bunce Fixed significant DBD::ADO bug (fetch skipped first row). Fixed ProxyServer bug handling non-select statements. Fixed VMS problem with t/examp.t thanks to Craig Berry. Trace only shows calls to trace_msg and _set_fbav at high levels. Modified t/examp.t to workaround Cygwin buffering bug. 1.11 - 1999-06-17, Tim Bunce Fixed bind_columns argument checking to allow a single arg. Fixed problems with internal default_user method. Fixed broken DBD::ADO. Made default $DBI::rows more robust for some obscure cases. 1.10 - 1999-06-14, Tim Bunce Fixed trace_msg.al error when using Apache. Fixed dbd_st_finish enhancement in Driver.xst (internals). Enable drivers to define default username and password and temporarily disabled warning added in 1.09. Thread safety optimised for single thread case. 1.09 - 1999-06-09, Tim Bunce Added optional minimum trace level parameter to trace_msg(). Added warning in Makefile.PL that DBI will require 5.004 soon. Added $dbh->selectcol_arrayref($statement) method. Fixed fetchall_arrayref hash-slice mode undef NAME problem. Fixed problem with tainted parameter checking and t/examp.t. Fixed problem with thread safety code, including 64 bit machines. Thread safety now enabled by default for threaded perls. Enhanced code for MULTIPLICITY/PERL_OBJECT from ActiveState. Enhanced prepare_cached() method. Minor changes to trace levels (less internal info at level 2). Trace log now shows "!! ERROR..." before the "<- method" line. DBI->connect() now warn's if user / password is undefined and DBI_USER / DBI_PASS environment variables are not defined. The t/proxy.t test now ignores any /etc/dbiproxy.conf file. Added portability fixes for MacOS from Chris Nandor. Updated mailing list address from fugue.com to isc.org. 1.08 - 1999-05-12, Tim Bunce Much improved DBD::ADO driver thanks to Phlip Plumlee and others. Connect now allows you to specify attribute settings within the DSN E.g., "dbi:Driver(RaiseError=>1,Taint=>1,AutoCommit=>0):dbname" The $h->{Taint} attribute now also enables taint checking of arguments to almost all DBI methods. Improved trace output in various ways. Fixed bug where $sth->{NAME_xx} was undef in some situations. Fixed code for MULTIPLICITY/PERL_OBJECT thanks to Alex Smishlajev. Fixed and documented DBI->connect_cached. Workaround for Cygwin32 build problem with help from Jong-Pork Park. bind_columns no longer needs undef or hash ref as first parameter. 1.07 - 1999-05-06, Tim Bunce Trace output now shows contents of array refs returned by DBI. Changed names of some result columns from type_info, type_info_all, tables and table_info to match ODBC 3.5 / ISO/IEC standards. Many fixes for DBD::Proxy and ProxyServer. Fixed error reporting in install_driver. Major enhancement to DBI::W32ODBC from Patrick Hollins. Added $h->{Taint} to taint fetched data if tainting (perl -T). Added code for MULTIPLICITY/PERL_OBJECT contributed by ActiveState. Added $sth->more_results (undocumented for now). 1.06 - 1999-01-06, Tim Bunce Fixed Win32 Makefile.PL problem in 1.04 and 1.05. Significant DBD::Proxy enhancements and fixes including support for bind_param_inout (Jochen and I) Added experimental DBI->connect_cached method. Added $sth->{NAME_uc} and $sth->{NAME_lc} attributes. Enhanced fetchrow_hashref to take an attribute name arg. 1.05 - 1999-01-04, Tim Bunce Improved DBD::ADO connect (thanks to Phlip Plumlee). Improved thread safety (thanks to Jochen Wiedmann). [Quick release prompted by truncation of copies on CPAN] 1.04 - 1999-01-03, Tim Bunce Fixed error in Driver.xst. DBI build now tests Driver.xst. Removed unused variable compiler warnings in Driver.xst. DBI::DBD module now tested during DBI build. Further clarification in the DBI::DBD driver writers manual. Added optional name parameter to $sth->fetchrow_hashref. 1.03 - 1999-01-01, Tim Bunce Now builds with Perl>=5.005_54 (PERL_POLLUTE in DBIXS.h) DBI trace trims path from "at yourfile.pl line nnn". Trace level 1 now shows statement passed to prepare. Assorted improvements to the DBI manual. Assorted improvements to the DBI::DBD driver writers manual. Fixed $dbh->quote prototype to include optional $data_type. Fixed $dbh->prepare_cached problems. $dbh->selectrow_array behaves better in scalar context. Added a (very) experimental DBD::ADO driver for Win32 ADO. Added experimental thread support (perl Makefile.PL -thread). Updated the DBI::FAQ - thanks to Alligator Descartes. The following changes were implemented and/or packaged by Jochen Wiedmann - thanks Jochen: Added a Bundle for CPAN installation of DBI, the DBI proxy server and prerequisites (lib/Bundle/DBI.pm). DBI->available_drivers uses File::Spec, if available. This makes it work on MacOS. (DBI.pm) Modified type_info to work with read-only values returned by type_info_all. (DBI.pm) Added handling of magic values in $sth->execute, $sth->bind_param and other methods (Driver.xst) Added Perl's CORE directory to the linkers path on Win32, required by recent versions of ActiveState Perl. Fixed DBD::Sponge to work with empty result sets. Complete rewrite of DBI::ProxyServer and DBD::Proxy. 1.02 - 1998-09-02, Tim Bunce Fixed DBI::Shell including @ARGV and /current. Added basic DBI::Shell test. Renamed DBI::Shell /display to /format. 1.01 - 1998-09-02, Tim Bunce Many enhancements to Shell (with many contributions from Jochen Wiedmann, Tom Lowery and Adam Marks). Assorted fixes to DBD::Proxy and DBI::ProxyServer. Tidied up trace messages - trace(2) much cleaner now. Added $dbh->{RowCacheSize} and $sth->{RowsInCache}. Added experimental DBI::Format (mainly for DBI::Shell). Fixed fetchall_arrayref($slice_hash). DBI->connect now honours PrintError=1 if connect fails. Assorted clarifications to the docs. 1.00 - 1998-08-14, Tim Bunce The DBI is no longer 'alpha' software! Added $dbh->tables and $dbh->table_info. Documented \%attr arg to data_sources method. Added $sth->{TYPE}, $sth->{PRECISION} and $sth->{SCALE}. Added $sth->{Statement}. DBI::Shell now uses neat_list to print results It also escapes "'" chars and converts newlines to spaces. 0.95 - 1998-08-10, Tim Bunce WARNING: THIS IS AN EXPERIMENTAL RELEASE! Fixed 0.94 slip so it will build on pre-5.005 again. Added DBI_AUTOPROXY environment variable. Array ref returned from fetch/fetchrow_arrayref now readonly. Improved connect error reporting by DBD::Proxy. All trace/debug messages from DBI now go to trace file. 0.94 - 1998-08-09, Tim Bunce WARNING: THIS IS AN EXPERIMENTAL RELEASE! Added DBD::Shell and dbish interactive DBI shell. Try it! Any database attribs can be set via DBI->connect(,,, \%attr). Added _get_fbav and _set_fbav methods for Perl driver developers (see ExampleP driver for perl usage). Drivers which don't use one of these methods (either via XS or Perl) are not compliant. DBI trace now shows adds " at yourfile.pl line nnn"! PrintError and RaiseError now prepend driver and method name. The available_drivers method no longer returns NullP or Sponge. Added $dbh->{Name}. Added $dbh->quote($value, $data_type). Added more hints to install_driver failure message. Added DBD::Proxy and DBI::ProxyServer (from Jochen Wiedmann). Added $DBI::neat_maxlen to control truncation of trace output. Added $dbh->selectall_arrayref and $dbh->selectrow_array methods. Added $dbh->tables. Added $dbh->type_info and $dbh->type_info_all. Added $h->trace_msg($msg) to write to trace log. Added @bool = DBI::looks_like_number(@ary). Many assorted improvements to the DBI docs. 0.93 - 1998-02-13, Tim Bunce Fixed DBI::DBD::dbd_postamble bug causing 'Driver.xsi not found' errors. Changes to handling of 'magic' values in neatsvpv (used by trace). execute (in Driver.xst) stops binding after first bind error. This release requires drivers to be rebuilt. 0.92 - 1998-02-03, Tim Bunce Fixed per-handle memory leak (with many thanks to Irving Reid). Added $dbh->prepare_cached() caching variant of $dbh->prepare. Added some attributes: $h->{Active} is the handle 'Active' (vague concept) (boolean) $h->{Kids} e.g. number of sth's associated with a dbh $h->{ActiveKids} number of the above which are 'Active' $dbh->{CachedKids} ref to prepare_cached sth cache Added support for general-purpose 'private_' attributes. Added experimental support for subclassing the DBI: see t/subclass.t Added SQL_ALL_TYPES to exported :sql_types. Added dbd_dbi_dir() and dbd_dbi_arch_dir() to DBI::DBD module so that DBD Makefile.PLs can work with the DBI installed in non-standard locations. Fixed 'Undefined value' warning and &sv_no output from neatsvpv/trace. Fixed small 'once per interpreter' leak. Assorted minor documentation fixes. 0.91 - 1997-12-10, Tim Bunce NOTE: This fix may break some existing scripts: DBI->connect("dbi:...",$user,$pass) was not setting AutoCommit and PrintError! DBI->connect(..., { ... }) no longer sets AutoCommit or PrintError twice. DBI->connect(..., { RaiseError=>1 }) now croaks if connect fails. Fixed $fh parameter of $sth->dump_results; Added default statement DESTROY method which carps. Added default driver DESTROY method to silence AUTOLOAD/__DIE__/CGI::Carp Added more SQL_* types to %EXPORT_TAGS and @EXPORT_OK. Assorted documentation updates (mainly clarifications). Added workaround for perl's 'sticky lvalue' bug. Added better warning for bind_col(umns) where fields==0. Fixed to build okay with 5.004_54 with or without USE_THREADS. Note that the DBI has not been tested for thread safety yet. 0.90 - 1997-09-06, Tim Bunce Can once again be built with Perl 5.003. The DBI class can be subclassed more easily now. InactiveDestroy fixed for drivers using the *.xst template. Slightly faster handle creation. Changed prototype for dbd_*_*_attrib() to add extra param. Note: 0.90, 0.89 and possibly some other recent versions have a small memory leak. This will be fixed in the next release. 0.89 - 1997-07-25, Tim Bunce Minor fix to neatsvpv (mainly used for debug trace) to workaround bug in perl where SvPV removes IOK flag from an SV. Minor updates to the docs. 0.88 - 1997-07-22, Tim Bunce Fixed build for perl5.003 and Win32 with Borland. Fixed documentation formatting. Fixed DBI_DSN ignored for old-style connect (with explicit driver). Fixed AutoCommit in DBD::ExampleP Fixed $h->trace. The DBI can now export SQL type values: use DBI ':sql_types'; Modified Driver.xst and renamed DBDI.h to dbd_xsh.h 0.87 - 1997-07-18, Tim Bunce Fixed minor type clashes. Added more docs about placeholders and bind values. 0.86 - 1997-07-16, Tim Bunce Fixed failed connect causing 'unblessed ref' and other errors. Drivers must handle AutoCommit FETCH and STORE else DBI croaks. Added $h->{LongReadLen} and $h->{LongTruncOk} attributes for BLOBS. Added DBI_USER and DBI_PASS env vars. See connect docs for usage. Added DBI->trace() to set global trace level (like per-handle $h->trace). PERL_DBI_DEBUG env var renamed DBI_DEBUG (old name still works for now). Updated docs, including commit, rollback, AutoCommit and Transactions sections. Added bind_param method and execute(@bind_values) to docs. Fixed fetchall_arrayref. Since the DBIS structure has change the internal version numbers have also changed (DBIXS_VERSION == 9 and DBISTATE_VERSION == 9) so drivers will have to be recompiled. The test is also now more sensitive and the version mismatch error message now more clear about what to do. Old drivers are likely to core dump (this time) until recompiled for this DBI. In future DBI/DBD version mismatch will always produce a clear error message. Note that this DBI release contains and documents many new features that won't appear in drivers for some time. Driver writers might like to read perldoc DBI::DBD and comment on or apply the information given. 0.85 - 1997-06-25, Tim Bunce NOTE: New-style connect now defaults to AutoCommit mode unless { AutoCommit => 0 } specified in connect attributes. See the docs. AutoCommit attribute now defined and tracked by DBI core. Drivers should use/honour this and not implement their own. Added pod doc changes from Andreas and Jonathan. New DBI_DSN env var default for connect method. See docs. Documented the func method. Fixed "Usage: DBD::_::common::DESTROY" error. Fixed bug which set some attributes true when there value was fetched. Added new internal DBIc_set() macro for drivers to use. 0.84 - 1997-06-20, Tim Bunce Added $h->{PrintError} attribute which, if set true, causes all errors to trigger a warn(). New-style DBI->connect call now automatically sets PrintError=1 unless { PrintError => 0 } specified in the connect attributes. See the docs. The old-style connect with a separate driver parameter is deprecated. Fixed fetchrow_hashref. Renamed $h->debug to $h->trace() and added a trace filename arg. Assorted other minor tidy-ups. 0.83 - 1997-06-11, Tim Bunce Added driver specification syntax to DBI->connect data_source parameter: DBI->connect('dbi:driver:...', $user, $passwd); The DBI->data_sources method should return data_source names with the appropriate 'dbi:driver:' prefix. DBI->connect will warn if \%attr is true but not a hash ref. Added the new fetchrow methods: @row_ary = $sth->fetchrow_array; $ary_ref = $sth->fetchrow_arrayref; $hash_ref = $sth->fetchrow_hashref; The old fetch and fetchrow methods still work. Driver implementors should implement the new names for fetchrow_array and fetchrow_arrayref ASAP (use the xs ALIAS: directive to define aliases for fetch and fetchrow). Fixed occasional problems with t/examp.t test. Added automatic errstr reporting to the debug trace output. Added the DBI FAQ from Alligator Descartes in module form for easy reading via "perldoc DBI::FAQ". Needs reformatting. Unknown driver specific attribute names no longer croak. Fixed problem with internal neatsvpv macro. 0.82 - 1997-05-23, Tim Bunce Added $h->{RaiseError} attribute which, if set true, causes all errors to trigger a die(). This makes it much easier to implement robust applications in terms of higher level eval { ... } blocks and rollbacks. Added DBI->data_sources($driver) method for implementation by drivers. The quote method now returns the string NULL (without quotes) for undef. Added VMS support thanks to Dan Sugalski. Added a 'quick start guide' to the README. Added neatsvpv function pointer to DBIS structure to make it available for use by drivers. A macro defines neatsvpv(sv,len) as (DBIS->neatsvpv(sv,len)). Old XS macro SV_YES_NO changes to standard boolSV. Since the DBIS structure has change the internal version numbers have also changed (DBIXS_VERSION == 8 and DBISTATE_VERSION == 8) so drivers will have to be recompiled. 0.81 - 1997-05-07, Tim Bunce Minor fix to let DBI build using less modern perls. Fixed a suprious typo warning. 0.80 - 1997-05-06, Tim Bunce Builds with no changes on NT using perl5.003_99 (with thanks to Jeffrey Urlwin). Automatically supports Apache::DBI (with thanks to Edmund Mergl). DBI scripts no longer need to be modified to make use of Apache::DBI. Added a ping method and an experimental connect_test_perf method. Added a fetchhash and fetch_all methods. The func method no longer pre-clears err and errstr. Added ChopBlanks attribute (currently defaults to off, that may change). Support for the attribute needs to be implemented by individual drivers. Reworked tests into standard t/*.t form. Added more pod text. Fixed assorted bugs. 0.79 - 1997-04-07, Tim Bunce Minor release. Tidied up pod text and added some more descriptions (especially disconnect). Minor changes to DBI.xs to remove compiler warnings. 0.78 - 1997-03-28, Tim Bunce Greatly extended the pod documentation in DBI.pm, including the under used bind_columns method. Use 'perldoc DBI' to read after installing. Fixed $h->err. Fetching an attribute value no longer resets err. Added $h->{InactiveDestroy}, see documentation for details. Improved debugging of cached ('quick') attribute fetches. errstr will return err code value if there is no string value. Added DBI/W32ODBC to the distribution. This is a pure-perl experimental DBI emulation layer for Win32::ODBC. Note that it's unsupported, your mileage will vary, and bug reports without fixes will probably be ignored. 0.77 - 1997-02-21, Tim Bunce Removed erroneous $h->errstate and $h->errmsg methods from DBI.pm. Added $h->err, $h->errstr and $h->state default methods in DBI.xs. Updated informal DBI API notes in DBI.pm. Updated README slightly. DBIXS.h now correctly installed into INST_ARCHAUTODIR. (DBD authors will need to edit their Makefile.PL's to use -I$(INSTALLSITEARCH)/auto/DBI -I$(INSTALLSITEARCH)/DBI) 0.76 - 1997-02-03, Tim Bunce Fixed a compiler type warnings (pedantic IRIX again). 0.75 - 1997-01-27, Tim Bunce Fix problem introduced by a change in Perl5.003_XX. Updated README and DBI.pm docs. 0.74 - 1997-01-14, Tim Bunce Dispatch now sets dbi_debug to the level of the current handle (this makes tracing/debugging individual handles much easier). The '>> DISPATCH' log line now only logged at debug >= 3 (was 2). The $csr->NUM_OF_FIELDS attribute can be set if not >0 already. You can log to a file using the env var PERL_DBI_DEBUG=/tmp/dbi.log. Added a type cast needed by IRIX. No longer sets perl_destruct_level unless debug set >= 4. Make compatible with PerlIO and sfio. 0.73 - 1996-10-10, Tim Bunce Fixed some compiler type warnings (IRIX). Fixed DBI->internal->{DebugLog} = $filename. Made debug log file unbuffered. Added experimental bind_param_inout method to interface. Usage: $dbh->bind_param_inout($param, \$value, $maxlen [, \%attribs ]) (only currently used by DBD::Oracle at this time.) 0.72 - 1996-09-23, Tim Bunce Using an undefined value as a handle now gives a better error message (mainly useful for emulators like Oraperl). $dbh->do($sql, @params) now works for binding placeholders. 0.71 - 1996-07-10, Tim Bunce Removed spurious abort() from invalid handle check. Added quote method to DBI interface and added test. 0.70 - 1996-06-16, Tim Bunce Added extra invalid handle check (dbih_getcom) Fixed broken $dbh->quote method. Added check for old GCC in Makefile.PL 0.69 - 1996-05-07, Tim Bunce Fixed small memory leak. Clarified the behaviour of DBI->connect. $dbh->do now returns '0E0' instead of 'OK'. Fixed "Can't read $DBI::errstr, lost last handle" problem. 0.68 - 1996-03-02, Tim Bunce Changes to suit perl5.002 and site_lib directories. Detects old versions ahead of new in @INC. 0.67 - 1996-02-15, Tim Bunce Trivial change to test suite to fix a problem shown up by the Perl5.002gamma release Test::Harness. 0.66 - 1996-01-29, Tim Bunce Minor changes to bring the DBI into line with 5.002 mechanisms, specifically the xs/pm VERSION checking mechanism. No functionality changes. One no-last-handle bug fix (rare problem). Requires 5.002 (beta2 or later). 0.65 - 1995-10-23, Tim Bunce Added $DBI::state to hold SQL CLI / ODBC SQLSTATE value. SQLSTATE "00000" (success) is returned as "" (false), all else is true. If a driver does not explicitly initialise it (via $h->{State} or DBIc_STATE(imp_xxh) then $DBI::state will automatically return "" if $DBI::err is false otherwise "S1000" (general error). As always, this is a new feature and liable to change. The is *no longer* a default error handler! You can add your own using push(@{$h->{Handlers}}, sub { ... }) but be aware that this interface may change (or go away). The DBI now automatically clears $DBI::err, errstr and state before calling most DBI methods. Previously error conditions would persist. Added DBIh_CLEAR_ERROR(imp_xxh) macro. DBI now EXPORT_OK's some utility functions, neat($value), neat_list(@values) and dump_results($sth). Slightly enhanced t/min.t minimal test script in an effort to help narrow down the few stray core dumps that some porters still report. Renamed readblob to blob_read (old name still works but warns). Added default blob_copy_to_file method. Added $sth = $dbh->tables method. This returns an $sth for a query which has these columns: TABLE_CATALOGUE, TABLE_OWNER, TABLE_NAME, TABLE_TYPE, REMARKS in that order. The TABLE_CATALOGUE column should be ignored for now. 0.64 - 1995-10-23, Tim Bunce Fixed 'disconnect invalidates 1 associated cursor(s)' problem. Drivers using DBIc_ACTIVE_on/off() macros should not need any changes other than to test for DBIc_ACTIVE_KIDS() instead of DBIc_KIDS(). Fixed possible core dump in dbih_clearcom during global destruction. 0.63 - 1995-09-01, Tim Bunce Minor update. Fixed uninitialised memory bug in method attribute handling and streamlined processing and debugging. Revised usage definitions for bind_* methods and readblob. 0.62 - 1995-08-26, Tim Bunce Added method redirection method $h->func(..., $method_name). This is now the official way to call private driver methods that are not part of the DBI standard. E.g.: @ary = $sth->func('ora_types'); It can also be used to call existing methods. Has very low cost. $sth->bind_col columns now start from 1 (not 0) to match SQL. $sth->bind_columns now takes a leading attribute parameter (or undef), e.g., $sth->bind_columns($attribs, \$col1 [, \$col2 , ...]); Added handy DBD_ATTRIBS_CHECK macro to vet attribs in XS. Added handy DBD_ATTRIB_GET_SVP, DBD_ATTRIB_GET_BOOL and DBD_ATTRIB_GET_IV macros for handling attributes. Fixed STORE for NUM_OF_FIELDS and NUM_OF_PARAMS. Added FETCH for NUM_OF_FIELDS and NUM_OF_PARAMS. Dispatch no longer bothers to call _untie(). Faster startup via install_method/_add_dispatch changes. 0.61 - 1995-08-22, Tim Bunce Added $sth->bind_col($column, \$var [, \%attribs ]); This method enables perl variable to be directly and automatically updated when a row is fetched. It requires no driver support (if the driver has been written to use DBIS->get_fbav). Currently \%attribs is unused. Added $sth->bind_columns(\$var [, \$var , ...]); This method is a short-cut for bind_col which binds all the columns of a query in one go (with no attributes). It also requires no driver support. Added $sth->bind_param($parameter, $var [, \%attribs ]); This method enables attributes to be specified when values are bound to placeholders. It also enables binding to occur away from the execute method to improve execute efficiency. The DBI does not provide a default implementation of this. See the DBD::Oracle module for a detailed example. The DBI now provides default implementations of both fetch and fetchrow. Each is written in terms of the other. A driver is expected to implement at least one of them. More macro and assorted structure changes in DBDXS.h. Sorry! The old dbihcom definitions have gone. All fields have macros. The imp_xxh_t type is now used within the DBI as well as drivers. Drivers must set DBIc_NUM_FIELDS(imp_sth) and DBIc_NUM_PARAMS(imp_sth). test.pl includes a trivial test of bind_param and bind_columns. 0.60 - 1995-08-17, Tim Bunce This release has significant code changes but much less dramatic than the previous release. The new implementors data handling mechanism has matured significantly (don't be put off by all the struct typedefs in DBIXS.h, there's just to make it easier for drivers while keeping things type-safe). The DBI now includes two new methods: do $dbh->do($statement) This method prepares, executes and finishes a statement. It is designed to be used for executing one-off non-select statements where there is no benefit in reusing a prepared statement handle. fetch $array_ref = $sth->fetch; This method is the new 'lowest-level' row fetching method. The previous @row = $sth->fetchrow method now defaults to calling the fetch method and expanding the returned array reference. The DBI now provides fallback attribute FETCH and STORE functions which drivers should call if they don't recognise an attribute. THIS RELEASE IS A GOOD STARTING POINT FOR DRIVER DEVELOPERS! Study DBIXS.h from the DBI and Oracle.xs etc from DBD::Oracle. There will be further changes in the interface but nothing as dramatic as these last two releases! (I hope :-) 0.59 - 1995-08-15, Tim Bunce NOTE: THIS IS AN UNSTABLE RELEASE! Major reworking of internal data management! Performance improvements and memory leaks fixed. Added a new NullP (empty) driver and a -m flag to test.pl to help check for memory leaks. Study DBD::Oracle version 0.21 for more details. (Comparing parts of v0.21 with v0.20 may be useful.) 0.58 - 1995-06-21, Tim Bunce Added DBI->internal->{DebugLog} = $filename; Reworked internal logging. Added $VERSION. Made disconnect_all a compulsory method for drivers. DBI-1.648/ex/0000755000031300001440000000000015210302710011772 5ustar00merijnusersDBI-1.648/ex/profile.pl0000644000031300001440000000112212127465144014002 0ustar00merijnusers#!/usr/bin/perl -w use DBI; $dbh = DBI->connect('dbi:SQLite:dbname=ex_profile.db', '', '', { RaiseError => 1 }); $dbh->do("DROP TABLE IF EXISTS ex_profile"); $dbh->do("CREATE TABLE ex_profile (a int)"); $dbh->do("INSERT INTO ex_profile (a) VALUES ($_)", undef) for 1..100; #$dbh->do("INSERT INTO ex_profile (a) VALUES (?)", undef, $_) for 1..100; my $select_sql = "SELECT a FROM ex_profile"; $dbh->selectall_arrayref($select_sql); $dbh->selectall_hashref($select_sql, 'a'); my $sth = $dbh->prepare($select_sql); $sth->execute; while ( @row = $sth->fetchrow_array ) { } __DATA__ DBI-1.648/ex/corogofer.pl0000644000031300001440000000130014656646601014335 0ustar00merijnusers#!/usr/bin/perl use strict; use warnings; use Time::HiRes qw(time); BEGIN { $ENV{PERL_ANYEVENT_STRICT} = 1; $ENV{PERL_ANYEVENT_VERBOSE} = 1; } use AnyEvent; BEGIN { $ENV{DBI_TRACE} = 0; $ENV{DBI_PUREPERL} = 0; $ENV{DBI_GOFER_TRACE} = 0; $ENV{DBD_GOFER_TRACE} = 0; }; use DBI; $ENV{DBI_AUTOPROXY} = 'dbi:Gofer:transport=corostream'; my $ticker = AnyEvent->timer( after => 0, interval => 0.1, cb => sub { warn sprintf "-tick- %.2f\n", time } ); warn "connecting...\n"; my $dbh = DBI->connect("dbi:NullP:"); warn "...connected\n"; for (1..5) { warn "entering DBI...\n"; $dbh->do("sleep 0.3"); # pseudo-sql understood by the DBD::NullP driver warn "...returned\n"; } warn "done."; DBI-1.648/ex/perl_dbi_nulls_test.pl0000644000031300001440000001422514656646601016416 0ustar00merijnusers#!/usr/bin/perl # This script checks which style of WHERE clause(s) will support both # null and non-null values. Refer to the NULL Values sub-section # of the "Placeholders and Bind Values" section in the DBI # documention for more information on this issue. The clause styles # and their numbering (0-6) map directly to the examples in the # documentation. # # To use this script: # # 1) If you are not using the DBI_DSN env variable, then update the # connect method arguments to support your database engine and # database, and remove the nearby check for DBI_DSN. # 2) Set PrintError to 1 in the connect method if you want see the # engine's reason WHY your engine won't support a particular # style. # 3) If your database does not support NULL columns by default # (e.g. Sybase) find and edit the CREATE TABLE statement # accordingly. # 4) To properly test style #5, you need the capability to create the # stored procedure SP_ISNULL that acts as a function: it tests its # argument and returns 1 if it is null, 0 otherwise. For example, # using Informix IDS engine, a definition would look like: # # CREATE PROCEDURE SP_ISNULL (arg VARCHAR(32)) RETURNING INTEGER; # IF arg IS NULL THEN RETURN 1; # ELSE RETURN 0; # END IF; # END PROCEDURE; # # Warning: This script will attempt to create a table named by the # $tablename variable (default dbi__null_test_tmp) and WILL DESTROY # any pre-existing table so named. use strict; use warnings; use DBI; # The array represents the values that will be stored in the char column of our table. # One array element per row. # We expect the non-null test to return row 3 (Marge) # and the null test to return rows 2 and 4 (the undefs). my $homer = "Homer"; my $marge = "Marge"; my @char_column_values = ( $homer, # 1 undef, # 2 $marge, # 3 undef, # 4 ); # Define the SQL statements with the various WHERE clause styles we want to test # and the parameters we'll substitute. my @select_clauses = ( {clause=>qq{WHERE mycol = ?}, nonnull=>[$marge], null=>[undef]}, {clause=>qq{WHERE NVL(mycol, '-') = NVL(?, '-')}, nonnull=>[$marge], null=>[undef]}, {clause=>qq{WHERE ISNULL(mycol, '-') = ISNULL(?, '-')}, nonnull=>[$marge], null=>[undef]}, {clause=>qq{WHERE DECODE(mycol, ?, 1, 0) = 1}, nonnull=>[$marge], null=>[undef]}, {clause=>qq{WHERE mycol = ? OR (mycol IS NULL AND ? IS NULL)}, nonnull=>[$marge,$marge], null=>[undef,undef]}, {clause=>qq{WHERE mycol = ? OR (mycol IS NULL AND SP_ISNULL(?) = 1)}, nonnull=>[$marge,$marge], null=>[undef,undef]}, {clause=>qq{WHERE mycol = ? OR (mycol IS NULL AND ? = 1)}, nonnull=>[$marge,0], null=>[undef,1]}, ); # This is the table we'll create and use for these tests. # If it exists, we'll DESTROY it too. So the name must be obscure. my $tablename = "dbi__null_test_tmp"; # Remove this if you are not using the DBI_DSN env variable, # and update the connect statement below. die "DBI_DSN environment variable not defined" unless $ENV{DBI_DSN}; my $dbh = DBI->connect(undef, undef, undef, { RaiseError => 0, PrintError => 1 } ) || die DBI->errstr; printf "Using %s, db version: %s\n", $ENV{DBI_DSN} || "connect arguments", $dbh->get_info(18) || "(unknown)"; my $sth; my @ok; print "=> Drop table '$tablename', if it already exists...\n"; do { local $dbh->{PrintError}=0; $dbh->do("DROP TABLE $tablename"); }; print "=> Create table '$tablename'...\n"; $dbh->do("CREATE TABLE $tablename (myid int NOT NULL, mycol char(5))"); # Use this if your database does not support NULL columns by default: #$dbh->do("CREATE TABLE $tablename (myid int NOT NULL, mycol char(5) NULL)"); print "=> Insert 4 rows into the table...\n"; $sth = $dbh->prepare("INSERT INTO $tablename (myid, mycol) VALUES (?,?)"); for my $i (0..$#char_column_values) { my $val = $char_column_values[$i]; printf " Inserting values (%d, %s)\n", $i+1, $dbh->quote($val); $sth->execute($i+1, $val); } print "(Driver bug: statement handle should not be Active after an INSERT.)\n" if $sth->{Active}; # Run the tests... for my $i (0..$#select_clauses) { my $sel = $select_clauses[$i]; print "\n=> Testing clause style $i: ".$sel->{clause}."...\n"; $sth = $dbh->prepare("SELECT myid,mycol FROM $tablename ".$sel->{clause}) or next; print " Selecting row with $marge\n"; $sth->execute(@{$sel->{nonnull}}) or next; my $r1 = $sth->fetchall_arrayref(); my $n1_rows = $sth->rows; my $n1 = @$r1; print " Selecting rows with NULL\n"; $sth->execute(@{$sel->{null}}) or next; my $r2 = $sth->fetchall_arrayref(); my $n2_rows = $sth->rows; my $n2 = @$r2; # Complain a bit... print "\n=>Your DBD driver doesn't support the 'rows' method very well.\n\n" unless ($n1_rows == $n1 && $n2_rows == $n2); # Did we get back the expected "n"umber of rows? # Did we get back the specific "r"ows we expected as identifed by the myid column? if ( $n1 == 1 # one row for Marge && $n2 == 2 # two rows for nulls && $r1->[0][0] == 3 # Marge is myid 3 && $r2->[0][0] == 2 # NULL for myid 2 && $r2->[1][0] == 4 # NULL for myid 4 ) { print "=> WHERE clause style $i is supported.\n"; push @ok, "\tStyle $i: ".$sel->{clause}; } else { print "=> WHERE clause style $i returned incorrect results.\n"; if ($n1 > 0 || $n2 > 0) { print " Non-NULL test rows returned these row ids: ". join(", ", map { $r1->[$_][0] } (0..$#{$r1}))."\n"; print " The NULL test rows returned these row ids: ". join(", ", map { $r2->[$_][0] } (0..$#{$r2}))."\n"; } } } $dbh->disconnect(); print "\n"; print "-" x 72, "\n"; printf "%d styles are supported:\n", scalar @ok; print "$_\n" for @ok; print "-" x 72, "\n"; print "\n"; print "If these results don't match what's in the 'Placeholders and Bind Values'\n"; print "section of the DBI documentation, or are for a database that not already\n"; print "listed, please email the results to dbi-users\@perl.org. Thank you.\n"; exit 0; DBI-1.648/ex/unicode_test.pl0000644000031300001440000004014014656646601015042 0ustar00merijnusers#!/usr/bin/perl # # Copyright Martin J. Evans # # Test unicode in a DBD - written for DBD::ODBC but should work for other # DBDs if you change the column types at the start of this script. # # Usage: # unicode_test.pl DSN USERNAME PASSWORD # # NOTE: will attempt to create tables called fred and # fredÄ€ (LATIN CAPITAL LETTER A WITH MACRON) # # NOTE: there are multiple ways of doing named parameter markers in DBDs. # some do: # insert into sometable (a_column) values(:fred); # bind_param(':fred', x); # some do: # insert into sometable (a_column) values(:fred); # bind_param('fred', x); # This script does the latter by default except for DBD::SQLite # - see unicode_param_markers and $param_marker_style where you can set the : # # DBD::ODBC currently fails: # not ok 3 - unicode table found by qualified table_info # not ok 6 - unicode column found by qualified column_info # not ok 18 - bind parameter with unicode parameter marker # All of which is documented in the DBD::ODBC pod. The first 2 are because # table_info/column_info XS code uses char * instead of Perl scalars and # the latter is because DBD::ODBC parses the SQL looking for placeholders # and it does this as bytes not UTF-8 encoded strings. # use DBI qw(:sql_types data_diff neat); use strict; use warnings; use Data::Dumper; use utf8; use Test::More; use Test::More::UTF8; # set utf8 mode on failure,out and todo handles use Test::Exception; use List::Util qw(first); use Encode; # unicode to use in tests for insert/select # the simley ("\x{263A}") is useful because it always has a multibyte encoding my $unicode_sample = "\x{263A}"; # short binary string that is invalid utf8 and includes nul bytes my $binary_sample = "\xFF\x01\x00" x 20; # This script tries to guess the types for unicode columns and binary columns # using type_info_all - it may fail (e.g., if you don't support type_info_all # or if your type_info_all does not return column types this script can # identify as char/binary columns. If it does set the types below or change # the possible SQL types in the calls to find_types below. # my $unicode_column_type; # 'nvarchar for MS SQL Server' my $blob_column_type; # = 'image' for MS SQL Server my $blob_bind_type; # type to pass to bind_param for blobs my $param_marker_style; # some DBDs need a column in front of param names in bind_param_call # may be different in different SQL support # if your DBD/db needs a different function to return the length in # characters of a column redefine $length_fn in a DBD specific section later # in this script my $length_fn = 'length'; my $h = do_connect(); # output a load of data my $driver = $h->{Driver}->{Name}; #note("Driver being used is $driver"); my $dbd="DBD::$h->{Driver}{Name}"; note("Driver " . $dbd,"-",$dbd->VERSION); my $dbms_name = $h->get_info(17); my $dbms_ver = $h->get_info(18); my $driver_name = $h->get_info(6); my $driver_ver = $h->get_info(7); my $identifier_case = $h->get_info(28); note("Using DBMS_NAME " . DBI::neat($dbms_name)); note("Using DBMS_VER " . DBI::neat($dbms_ver)); note("Using DRIVER_NAME " . DBI::neat($driver_name)); note("Using DRIVER_VER " . DBI::neat($driver_ver)); # annoyingly some databases take lowercase table names but create # them uppercase (if unquoted) and so when you ask for a list # of table they come back uppercase. Problem is pattern matching # with unicode and /i is dodgy unless you've got a really recent Perl. note("SQL_IDENTIFIER_CASE " . DBI::neat($identifier_case)); # dump entire env - some people might end up wanting to remove some of this # so changed to specific env vars #note("Environment:\n" . Dumper(\%ENV)); foreach my $env (qw(LANG LC_ NLS_)) { note(map {"$_ = $ENV{$_}\n"} grep(/$env/, keys %ENV)); } # the following sets the "magic" unicode/utf8 flag for each DBD # and sets the column types for DBDs which do not support type_info_all # which is pretty much all of them if ($driver eq 'SQLite') { # does not support type_info_all $blob_column_type = 'blob'; $blob_bind_type = SQL_BLOB; $unicode_column_type = 'varchar'; $h->{sqlite_unicode} = 1; $param_marker_style = ':'; } elsif ($driver eq 'CSV') { # does not support column_info #####$blob_column_type = 'blob'; #####$blob_bind_type = SQL_BLOB; #####$unicode_column_type = 'varchar'; $h->{f_encoding} = 'UTF-8'; $h->{f_ext} = '.csv/r'; $length_fn = 'char_length'; } elsif ($driver eq 'Pg') { $unicode_column_type = 'varchar'; } elsif ($driver eq 'mysql') { # does not support type_info_all $h->{mysql_enable_utf8} = 1; #####$blob_column_type = 'blob'; #####$blob_bind_type = SQL_BLOB; #####$unicode_column_type = 'varchar'; $length_fn = 'char_length'; } elsif ($driver eq 'ODBC') { # DBD::ODBC has type_info_all and column_info support $length_fn = 'len'; } elsif ($driver eq 'Unify') { $blob_column_type = 'binary'; $unicode_column_type = 'char'; # or text $h->{ChopBlanks} = 1; # Unify does not have varchar so we use char and ChopBlanks $h->{uni_unicode} = 1; # Available in the upcoming 0.81 $length_fn = 'undefined'; # I don't think Unify has a function like this } if (!defined($blob_column_type)) { ($blob_column_type, $blob_bind_type) = # -98 for DB2 which gets true blob column type find_type($h, [30, -98, SQL_LONGVARBINARY, SQL_BINARY, SQL_VARBINARY], length($binary_sample)); } BAIL_OUT("Could not find an image/blob type in type_info_all - you will need to change this script to specify the type") if !defined($blob_column_type); if (!defined($unicode_column_type)) { ($unicode_column_type) = find_type($h, [SQL_WVARCHAR, SQL_VARCHAR]); } BAIL_OUT("Could not find a unicode type in type_info_all - you will need to change this script to specify the type") if !defined($unicode_column_type); unicode_data($h); mixed_lob_unicode_data($h); # Without disconnecting after the above test DBD::CSV gets upset # refusing to create fred.csv as it already exists when it certainly # does not exist. # disconnect($h); $h = do_connect(); unicode_param_markers($h); unicode_in_column_name($h); unicode_in_table_name($h); $h->disconnect; unlink 'unitest_8.db' if $driver eq "SQLite"; done_testing; exit 0; # ====== sub do_connect { # eg unicode_test.pl "dbi:Pg(AutoCommit=0):host=example.com;port=6000;db=name" user pass my ($dsn, $user, $pass, %attr) = @ARGV; $user ||= $ENV{DBI_USER}; $pass ||= $ENV{DBI_PASS}; # A (semi)sane set of defaults my %dsn = ( csv => [ "dbi:CSV:", $user, $pass ], mysql => [ "dbi:mysql:database=test", $user, $pass ], odbc => [ "dbi:ODBC:DSN=asus2", $user, $pass ], oracle => [ "dbi:Oracle:host=xxx.easysoft.local;sid=devel", 'xxx', 'yyy' ], pg => [ "dbi:Pg:dbname=test", $user, $pass ], sqlite => [ "dbi:SQLite:dbname=unitest_8.db", "", "" ], unify => [ "dbi:Unify:", $ENV{USCHEMA}, undef ], ); # Either pass a fully qualified DSN or use the default shortcuts # eg unicode_test.pl CSV $dsn ||= "SQLite"; $dsn =~ m/:/ or ($dsn, $user, $pass) = @{$dsn{lc $dsn} || die "No connect info\n"}; if ($dsn =~ /^dbi:SQLite/) { # The pod for SQLite is confusing and has changed. Initially it said sqlite_unicode # must be set at connect time and cannot be set later on the connection handle # and now it says # "but this only works if the sqlite_unicode attribute is set before the first call to a perl collation sequence" # so we set it here $attr{sqlite_unicode} = 1; } my $h = DBI->connect($dsn, $user, $pass, { RaiseError => 1, %attr }); return $h; } sub disconnect { my $h = shift; $h->disconnect; } sub drop_table { my ($h, $table) = @_; eval { local $h->{PrintError} = 0; $table = $h->quote_identifier ($table); my $s = $h->prepare(qq/drop table $table/); $s->execute; }; $h->commit if $driver eq 'Unify'; # DBD::CSV seems to get upset by the mixed_lob_unicode_data test # and fails to drop the table with: # Execution ERROR: utf8 "\x89" does not map to Unicode at /usr/lib/perl/5.10/IO/Handle.pm line 167. unlink 'fred.csv' if $driver eq 'CSV'; #diag($@) if $@; } # create the named table with columns specified in $columns which is # an arrayref with each element a hash of name and type sub create_table { my ($h, $testmsg, $table, $columns) = @_; $table = $h->quote_identifier ($table); my $sql = qq/create table $table ( / . join(",", map {join " " => $h->quote_identifier ($_->{name}), $_->{type}} @$columns) . ')'; return lives_ok { diag ($sql); my $s = $h->prepare($sql); $s->execute; $dbd eq "DBD::Unify" and $h->commit; } $testmsg; } sub unicode_in_table_name { my $h = shift; my $table = "fred\x{0100}"; drop_table($h, $table); my $created = create_table($h, 'unicode table name supported', $table, [{name => 'a', type => 'int'}]); SKIP: { skip "Failed to create unicode table name", 2 unless $created; find_table($h, $table); drop_table($h, $table); } } # NOTE: some DBs may uppercase table names sub find_table { my ($h, $table) = @_; # won't find a match if the returned data is not utf8 decoded my $s = $h->table_info(undef, undef, undef, 'TABLE'); my $r = $s->fetchall_arrayref; my $found = first { $_->[2] =~ /$table/i} @$r; ok($found, 'unicode table found in unqualified table_info'); SKIP: { skip "table found via table_info", 1 if $found; $found = first { Encode::decode_utf8($_->[2]) =~ /$table/i} @$r; ok(!$found, "Table not found initially but when table name decoded it was found as $table"); }; my $found_some_utf8_tables; foreach ($r) { $found_some_utf8_tables++ if Encode::is_utf8($_->[2]); } note(($found_some_utf8_tables ? 'Found' : 'Did not find') , ' tables with utf8 on'); $s = $h->table_info(undef, undef, $table, 'TABLE'); $r = $s->fetchall_arrayref; $found = first {$_->[2] =~ /$table/i} @$r; ok($found, 'unicode table found by qualified table_info'); SKIP: { skip "table not found", 1 if !$found; ok(Encode::is_utf8($found->[2]), 'utf8 flag set on unicode table name'); } } sub find_column { my ($h, $table, $column) = @_; my $s = $h->column_info(undef, undef, $table, undef); if (!$s) { note("This driver does not seem to support column_info"); note("Skipping this test"); return; } my $r = $s->fetchall_arrayref; my $found = first {$_->[3] =~ /$column/i} @$r; ok($found, 'unicode column found in unqualified column_info'); $s = $h->column_info(undef, undef, $table, $column); $r = $s->fetchall_arrayref; $found = first {$_->[3] =~ /$column/i} @$r; ok($found, 'unicode column found by qualified column_info'); } sub unicode_in_column_name { my $h = shift; my $table = 'fred'; my $column = "dave\x{0100}"; drop_table($h, $table); my $created = create_table($h, 'unicode column name supported', $table, [{name => $column, type => 'int'}]); SKIP: { skip "table with unicode column not created", 2 unless $created; find_column($h, $table, $column); drop_table($h, $table); }; } sub unicode_data { my $h = shift; my $table = 'fred'; my $column = 'a'; drop_table($h, $table); create_table($h, 'table for unicode data', $table, [{name => $column, type => $unicode_column_type . "(20)"}]); lives_ok { my $s = $h->prepare(qq/insert into $table ($column) values (?)/); $s->execute($unicode_sample); } 'insert unicode data into table'; my $s = $h->prepare(qq/select $column from $table/); $s->execute; my $r = $s->fetchall_arrayref; is($r->[0][0], $unicode_sample, 'unicode data out = unicode data in, no where') or diag(data_diff($r->[0][0]), $unicode_sample); # probably redundant but does not hurt: is(length($r->[0][0]), length($unicode_sample), 'length of output data the same') or diag(data_diff($r->[0][0], $unicode_sample)); # check db thinks the chr is 1 chr eval { # we might not have the correct length fn $s = $h->prepare(qq/select $length_fn($column) from $table/); $s->execute; }; if ($@) { note "!!db probably does not have length function!! - $@"; } else { $r = $s->fetchall_arrayref; is($r->[0][0], length($unicode_sample), 'db length of unicode data correct'); } $s = $h->prepare(qq/select $column from $table where $column = ?/); $s->execute($unicode_sample); $r = $s->fetchall_arrayref; is(scalar(@$r), 1, 'select unicode data via parameterised where'); $s = $h->prepare(qq/select $column from $table where $column = / . $h->quote($unicode_sample)); $s->execute; $r = $s->fetchall_arrayref; is(scalar(@$r), 1, 'select unicode data via inline where'); drop_table($h, $table); } sub mixed_lob_unicode_data { my $h = shift; my $table = 'fred'; my $column1 = 'a'; my $column2 = 'b'; drop_table($h, $table); create_table($h, 'table for unicode data', $table, [{name => $column1, type => $unicode_column_type . "(20)"}, {name => $column2, type => $blob_column_type}]); lives_ok { my $s = $h->prepare(qq/insert into $table ($column1, $column2) values (?,?)/); $s->bind_param(1, $unicode_sample); $s->bind_param(2, $binary_sample, {TYPE => $blob_bind_type}); #$s->execute($unicode_sample, $binary_sample); $s->execute; } 'insert unicode data and blob into table'; # argh - have to set LongReadLen before doing a prepare in DBD::Oracle # because it picks a LongReadLen value when it describes the result-set $h->{LongReadLen} = length($binary_sample) * 2; my $s = $h->prepare(qq/select $column1, $column2 from $table/, {ora_pers_lob => 1}); $s->execute; my $r = $s->fetchall_arrayref; is($r->[0][0], $unicode_sample, 'unicode data out = unicode data in, no where with blob'); ok(!Encode::is_utf8($r->[0][1]), 'utf8 flag not set on blob data'); ok($binary_sample eq $r->[0][1], 'retrieved blob = inserted blob'); drop_table($h, $table); } sub unicode_param_markers { my $h = shift; my $table = 'fred'; drop_table($h, $table); create_table($h, 'test table for unicode parameter markers', $table, [{name => 'a', type => 'int'}]); my $param_marker = "fred\x{20ac}"; lives_ok { my $s = $h->prepare(qq/insert into $table (a) values (:$param_marker)/); $s->bind_param($param_marker_style . $param_marker, 1); $s->execute; } 'bind parameter with unicode parameter marker'; drop_table($h, $table); } sub find_type { my ($h, $types, $minsize) = @_; my $r = $h->type_info_all; #print Dumper($r); my $indexes = shift @$r; my $sql_type_idx = $indexes->{SQL_DATA_TYPE}; my $type_name_idx = $indexes->{TYPE_NAME}; my $column_size_idx = $indexes->{COLUMN_SIZE}; if (!defined($sql_type_idx)) { note("type_info_all has no key for SQL_DATA_TYPE - falling back on DATA_TYPE"); $sql_type_idx = $indexes->{DATA_TYPE}; } if (!$column_size_idx) { note("type_info_all has no key for COLUMN_SIZE so not performing size checks"); } BAIL_OUT("DBD does not seem to support type_info_all - you will need to edit this script to specify column types") if !$r || (scalar(@$r) == 0); foreach my $type (@$types) { foreach (@$r) { note("Found type $_->[$sql_type_idx] ($_->[$type_name_idx]) size=" . ($column_size_idx ? neat($_->[$column_size_idx]) : 'undef')); if ($_->[$sql_type_idx] eq $type) { if ((!defined($minsize)) || (!defined($column_size_idx)) || ($minsize && ($_->[$column_size_idx] > $minsize))) { note("Found $type type which is $_->[$type_name_idx] and max size of " . ($column_size_idx ? $_->[$column_size_idx] : 'undef')); return ($_->[$type_name_idx], $_->[$sql_type_idx]); } else { note("$type type ($_->[$type_name_idx]) but the max length of $_->[$column_size_idx] is less than the required length $minsize"); } } } } return; # no type found } # vim:ts=8:sw=4:et DBI-1.648/dbiprof.PL0000644000031300001440000001520614656646601013273 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- my $file = $ARGV[0] || 'dbiprof'; my $script = <<'SCRIPT'; ~startperl~ use strict; my $VERSION = sprintf("1.%06d", q$Revision$ =~ /(\d+)/o); use Data::Dumper; use DBI::ProfileData; use Getopt::Long; # default options my $number = 10; my $sort = 'total'; my $filename = 'dbi.prof'; my $reverse = 0; my $case_sensitive = 0; my (%match, %exclude); # get options from command line GetOptions( 'version' => sub { die "dbiprof $VERSION\n" }, 'help' => sub { exit usage() }, 'number=i' => \$number, 'sort=s' => \$sort, 'dumpnodes!' => \my $dumpnodes, 'reverse' => \$reverse, 'match=s' => \%match, 'exclude=s' => \%exclude, 'case-sensitive' => \$case_sensitive, 'delete!' => \my $opt_delete, ) or exit usage(); sub usage { print <new( Files => \@files, DeleteFiles => $opt_delete, ); }; die "Unable to load profile data: $@\n" if $@; if (%match) { # handle matches while (my ($key, $val) = each %match) { if ($val =~ m!^/(.+)/$!) { $val = $case_sensitive ? qr/$1/ : qr/$1/i; } $prof->match($key, $val, case_sensitive => $case_sensitive); } } if (%exclude) { # handle excludes while (my ($key, $val) = each %exclude) { if ($val =~ m!^/(.+)/$!) { $val = $case_sensitive ? qr/$1/ : qr/$1/i; } $prof->exclude($key, $val, case_sensitive => $case_sensitive); } } # sort the data $prof->sort(field => $sort, reverse => $reverse); # all done, print it out if ($dumpnodes) { $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; $Data::Dumper::Useqq = 1; $Data::Dumper::Deparse = 0; print Dumper($prof->nodes); } else { print $prof->report(number => $number); } exit 0; __END__ =head1 NAME dbiprof - command-line client for DBI::ProfileData =head1 SYNOPSIS See a report of the ten queries with the longest total runtime in the profile dump file F: dbiprof prof1.out See the top 10 most frequently run queries in the profile file F (the default): dbiprof --sort count See the same report with 15 entries: dbiprof --sort count --number 15 =head1 DESCRIPTION This tool is a command-line client for the DBI::ProfileData. It allows you to analyze the profile data file produced by DBI::ProfileDumper and produce various useful reports. =head1 OPTIONS This program accepts the following options: =over 4 =item --number N Produce this many items in the report. Defaults to 10. If set to "all" then all results are shown. =item --sort field Sort results by the given field. Sorting by multiple fields isn't currently supported (patches welcome). The available sort fields are: =over 4 =item total Sorts by total time run time across all runs. This is the default sort. =item longest Sorts by the longest single run. =item count Sorts by total number of runs. =item first Sorts by the time taken in the first run. =item shortest Sorts by the shortest single run. =item key1 Sorts by the value of the first element in the Path, which should be numeric. You can also sort by C and C. =back =item --reverse Reverses the selected sort. For example, to see a report of the shortest overall time: dbiprof --sort total --reverse =item --match keyN=value Consider only items where the specified key matches the given value. Keys are numbered from 1. For example, let's say you used a DBI::Profile Path of: [ DBIprofile_Statement, DBIprofile_Methodname ] And called dbiprof as in: dbiprof --match key2=execute Your report would only show execute queries, leaving out prepares, fetches, etc. If the value given starts and ends with slashes (C) then it will be treated as a regular expression. For example, to only include SELECT queries where key1 is the statement: dbiprof --match key1=/^SELECT/ By default the match expression is matched case-insensitively, but this can be changed with the --case-sensitive option. =item --exclude keyN=value Remove items for where the specified key matches the given value. For example, to exclude all prepare entries where key2 is the method name: dbiprof --exclude key2=prepare Like C<--match>, If the value given starts and ends with slashes (C) then it will be treated as a regular expression. For example, to exclude UPDATE queries where key1 is the statement: dbiprof --match key1=/^UPDATE/ By default the exclude expression is matched case-insensitively, but this can be changed with the --case-sensitive option. =item --case-sensitive Using this option causes --match and --exclude to work case-sensitively. Defaults to off. =item --delete Sets the C option to L which causes the files to be deleted after reading. See L for more details. =item --dumpnodes Print the list of nodes in the form of a perl data structure. Use the C<-sort> option if you want the list sorted. =item --version Print the dbiprof version number and exit. =back =head1 AUTHOR Sam Tregar =head1 COPYRIGHT AND LICENSE Copyright (C) 2002 Sam Tregar This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself. =head1 SEE ALSO L, L, L. =cut SCRIPT require Config; my $config = {}; $config->{'startperl'} = $Config::Config{'startperl'}; $script =~ s/\~(\w+)\~/$config->{$1}/eg; if (!(open(FILE, ">$file")) || !(print FILE $script) || !(close(FILE))) { die "Error while writing $file: $!\n"; } chmod 0755, $file; print "Extracted $file from ",__FILE__," with variable substitutions.\n"; # syntax check resulting file, but only for developers exit 1 if -d ".svn"|| -d ".git" and system($^X, '-wc', '-Mblib', $file) != 0; DBI-1.648/dbd_xsh.h0000644000031300001440000000705614656646601013201 0ustar00merijnusers/* @(#)$Id$ * * Copyright 2000-2002 Tim Bunce * Copyright 2002 Jonathan Leffler * * These prototypes are for dbdimp.c funcs used in the XS file. * These names are #defined to driver specific names by the * dbdimp.h file in the driver source. */ #ifndef DBI_DBD_XSH_H #define DBI_DBD_XSH_H void dbd_init _((dbistate_t *dbistate)); int dbd_discon_all _((SV *drh, imp_drh_t *imp_drh)); SV *dbd_take_imp_data _((SV *h, imp_xxh_t *imp_xxh, void *foo)); /* Support for dbd_dr_data_sources and dbd_db_do added to Driver.xst in DBI v1.33 */ /* dbd_dr_data_sources: optional: defined by a driver that calls a C */ /* function to get the list of data sources */ AV *dbd_dr_data_sources(SV *drh, imp_drh_t *imp_drh, SV *attrs); int dbd_db_login6_sv _((SV *dbh, imp_dbh_t *imp_dbh, SV *dbname, SV *uid, SV *pwd, SV*attribs)); int dbd_db_login6 _((SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *uid, char *pwd, SV*attribs)); /* deprecated */ int dbd_db_login _((SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *uid, char *pwd)); /* deprecated */ /* Note: interface of dbd_db_do changed in v1.33 */ /* Old prototype: dbd_db_do _((SV *sv, char *statement)); */ /* dbd_db_do: optional: defined by a driver if the DBI default version is too slow */ int dbd_db_do4 _((SV *dbh, imp_dbh_t *imp_dbh, char *statement, SV *params)); /* deprecated */ IV dbd_db_do4_iv _((SV *dbh, imp_dbh_t *imp_dbh, char *statement, SV *params)); /* deprecated */ IV dbd_db_do6 _((SV *dbh, imp_dbh_t *imp_dbh, SV *statement, SV *params, I32 items, I32 ax)); int dbd_db_commit _((SV *dbh, imp_dbh_t *imp_dbh)); int dbd_db_rollback _((SV *dbh, imp_dbh_t *imp_dbh)); int dbd_db_disconnect _((SV *dbh, imp_dbh_t *imp_dbh)); void dbd_db_destroy _((SV *dbh, imp_dbh_t *imp_dbh)); int dbd_db_STORE_attrib _((SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv)); SV *dbd_db_FETCH_attrib _((SV *dbh, imp_dbh_t *imp_dbh, SV *keysv)); SV *dbd_db_last_insert_id _((SV *dbh, imp_dbh_t *imp_dbh, SV *catalog, SV *schema, SV *table, SV *field, SV *attr)); AV *dbd_db_data_sources _((SV *dbh, imp_dbh_t *imp_dbh, SV *attr)); int dbd_st_prepare _((SV *sth, imp_sth_t *imp_sth, char *statement, SV *attribs)); /* deprecated */ int dbd_st_prepare_sv _((SV *sth, imp_sth_t *imp_sth, SV *statement, SV *attribs)); int dbd_st_rows _((SV *sth, imp_sth_t *imp_sth)); /* deprecated */ IV dbd_st_rows_iv _((SV *sth, imp_sth_t *imp_sth)); int dbd_st_execute _((SV *sth, imp_sth_t *imp_sth)); /* deprecated */ IV dbd_st_execute_iv _((SV *sth, imp_sth_t *imp_sth)); SV *dbd_st_last_insert_id _((SV *sth, imp_sth_t *imp_sth, SV *catalog, SV *schema, SV *table, SV *field, SV *attr)); AV *dbd_st_fetch _((SV *sth, imp_sth_t *imp_sth)); int dbd_st_finish3 _((SV *sth, imp_sth_t *imp_sth, int from_destroy)); int dbd_st_finish _((SV *sth, imp_sth_t *imp_sth)); /* deprecated */ void dbd_st_destroy _((SV *sth, imp_sth_t *imp_sth)); int dbd_st_blob_read _((SV *sth, imp_sth_t *imp_sth, int field, long offset, long len, SV *destrv, long destoffset)); int dbd_st_STORE_attrib _((SV *sth, imp_sth_t *imp_sth, SV *keysv, SV *valuesv)); SV *dbd_st_FETCH_attrib _((SV *sth, imp_sth_t *imp_sth, SV *keysv)); SV *dbd_st_execute_for_fetch _((SV *sth, imp_sth_t *imp_sth, SV *fetch_tuple_sub, SV *tuple_status)); int dbd_bind_ph _((SV *sth, imp_sth_t *imp_sth, SV *param, SV *value, IV sql_type, SV *attribs, int is_inout, IV maxlen)); #endif /* end of dbd_xsh.h */ DBI-1.648/DBI.xs0000644000031300001440000062205315206027573012360 0ustar00merijnusers/* vim: ts=8:sw=4:expandtab * * $Id$ * * Copyright (c) 2024-2026 DBI Team * Copyright (c) 1994-2024 Tim Bunce Ireland. * * See COPYRIGHT section in DBI.pm for usage and distribution rights. */ #define IN_DBI_XS 1 /* see DBIXS.h */ #define PERL_NO_GET_CONTEXT #include "DBIXS.h" /* DBI public interface for DBD's written in C */ # if (defined(_WIN32) && (! defined(HAS_GETTIMEOFDAY))) #include # endif /* The XS dispatcher code can optimize calls to XS driver methods, * bypassing the usual call_sv() and argument handling overheads. * Just-in-case it causes problems there's an (undocumented) way * to disable it by setting an env var. */ static int use_xsbypass = 1; /* set in dbi_bootinit() */ #ifndef CvISXSUB #define CvISXSUB(sv) CvXSUB(sv) #endif #define DBI_MAGIC '~' /* HvMROMETA introduced in 5.9.5, but mro_meta_init not exported in 5.10.0 */ #if (PERL_REVISION == 5) # if (PERL_VERSION < 10) # define MY_cache_gen(stash) 0 # else # if ((PERL_VERSION == 10) && (PERL_SUBVERSION == 0)) # define MY_cache_gen(stash) \ (HvAUX(stash)->xhv_mro_meta \ ? HvAUX(stash)->xhv_mro_meta->cache_gen \ : 0) # else # define MY_cache_gen(stash) HvMROMETA(stash)->cache_gen # endif # endif #endif /* If the tests fail with errors about 'setlinebuf' then try */ /* deleting the lines in the block below except the setvbuf one */ #ifndef PerlIO_setlinebuf # ifdef HAS_SETLINEBUF # define PerlIO_setlinebuf(f) setlinebuf(f) # else # ifndef USE_PERLIO # define PerlIO_setlinebuf(f) setvbuf(f, Nullch, _IOLBF, 0) # endif # endif #endif #if (PERL_REVISION == 5) # if (PERL_VERSION < 8) || ((PERL_VERSION == 8) && (PERL_SUBVERSION == 0)) # define DBI_save_hv_fetch_ent # endif /* prior to 5.8.9: when a CV is duped, the mg dup method is called, * then *afterwards*, any_ptr is copied from the old CV to the new CV. * This wipes out anything which the dup method did to any_ptr. * This needs working around */ # if defined(USE_ITHREADS) && (PERL_VERSION == 8) && (PERL_SUBVERSION < 9) # define BROKEN_DUP_ANY_PTR # endif #endif /* types of method name */ typedef enum { methtype_ordinary, /* nothing special about this method name */ methtype_DESTROY, methtype_FETCH, methtype_can, methtype_fetch_star, /* fetch*, i.e. fetch() or fetch_...() */ methtype_set_err } meth_types; static imp_xxh_t *dbih_getcom _((SV *h)); static imp_xxh_t *dbih_getcom2 _((pTHX_ SV *h, MAGIC **mgp)); static void dbih_clearcom _((imp_xxh_t *imp_xxh)); static int dbih_logmsg _((imp_xxh_t *imp_xxh, const char *fmt, ...)); static SV *dbih_make_com _((SV *parent_h, imp_xxh_t *p_imp_xxh, const char *imp_class, STRLEN imp_size, STRLEN extra, SV *copy)); static SV *dbih_make_fdsv _((SV *sth, const char *imp_class, STRLEN imp_size, const char *col_name)); static AV *dbih_get_fbav _((imp_sth_t *imp_sth)); static SV *dbih_event _((SV *h, const char *name, SV*, SV*)); static int dbih_set_attr_k _((SV *h, SV *keysv, int dbikey, SV *valuesv)); static SV *dbih_get_attr_k _((SV *h, SV *keysv, int dbikey)); static int dbih_sth_bind_col _((SV *sth, SV *col, SV *ref, SV *attribs)); static int set_err_char _((SV *h, imp_xxh_t *imp_xxh, const char *err_c, IV err_i, const char *errstr, const char *state, const char *method)); static int set_err_sv _((SV *h, imp_xxh_t *imp_xxh, SV *err, SV *errstr, SV *state, SV *method)); static int quote_type _((int sql_type, int p, int s, int *base_type, void *v)); static int sql_type_cast_svpv _((pTHX_ SV *sv, int sql_type, U32 flags, void *v)); static I32 dbi_hash _((const char *string, long i)); static void dbih_dumphandle _((pTHX_ SV *h, const char *msg, int level)); static int dbih_dumpcom _((pTHX_ imp_xxh_t *imp_xxh, const char *msg, int level)); static int dbi_ima_free(pTHX_ SV* sv, MAGIC* mg); #if defined(USE_ITHREADS) && !defined(BROKEN_DUP_ANY_PTR) static int dbi_ima_dup(pTHX_ MAGIC* mg, CLONE_PARAMS *param); #endif char *neatsvpv _((SV *sv, STRLEN maxlen)); SV * preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo); static meth_types get_meth_type(const char * const name); struct imp_drh_st { dbih_drc_t com; }; struct imp_dbh_st { dbih_dbc_t com; }; struct imp_sth_st { dbih_stc_t com; }; struct imp_fdh_st { dbih_fdc_t com; }; /* identify the type of a method name for dispatch behaviour */ /* (should probably be folded into the IMA flags mechanism) */ static meth_types get_meth_type(const char * const name) { switch (name[0]) { case 'D': if strEQ(name,"DESTROY") return methtype_DESTROY; break; case 'F': if strEQ(name,"FETCH") return methtype_FETCH; break; case 'c': if strEQ(name,"can") return methtype_can; break; case 'f': if strnEQ(name,"fetch", 5) /* fetch* */ return methtype_fetch_star; break; case 's': if strEQ(name,"set_err") return methtype_set_err; break; } return methtype_ordinary; } /* Internal Method Attributes (attached to dispatch methods when installed) */ /* NOTE: when adding SVs to dbi_ima_t, update dbi_ima_dup() dbi_ima_free() * to ensure that they are duped and correctly ref-counted */ typedef struct dbi_ima_st { U8 minargs; U8 maxargs; IV hidearg; /* method_trace controls tracing of method calls in the dispatcher: - if the current trace flags include a trace flag in method_trace then set trace_level to min(2,trace_level) for duration of the call. - else, if trace_level < (method_trace & DBIc_TRACE_LEVEL_MASK) then don't trace the call */ U32 method_trace; const char *usage_msg; U32 flags; meth_types meth_type; /* cached outer to inner method mapping */ HV *stash; /* the stash we found the GV in */ GV *gv; /* the GV containing the inner sub */ U32 generation; /* cache invalidation */ #ifdef BROKEN_DUP_ANY_PTR PerlInterpreter *my_perl; /* who owns this struct */ #endif } dbi_ima_t; /* These values are embedded in the data passed to install_method */ #define IMA_HAS_USAGE 0x00000001 /* check parameter usage */ #define IMA_FUNC_REDIRECT 0x00000002 /* is $h->func(..., "method") */ #define IMA_KEEP_ERR 0x00000004 /* don't reset err & errstr */ #define IMA_KEEP_ERR_SUB 0x00000008 /* '' if in a nested call */ #define IMA_NO_TAINT_IN 0x00000010 /* don't check for PL_tainted args */ #define IMA_NO_TAINT_OUT 0x00000020 /* don't taint results */ #define IMA_COPY_UP_STMT 0x00000040 /* copy sth Statement to dbh */ #define IMA_END_WORK 0x00000080 /* method is commit or rollback */ #define IMA_STUB 0x00000100 /* donothing eg $dbh->connected */ #define IMA_CLEAR_STMT 0x00000200 /* clear Statement before call */ #define IMA_UNRELATED_TO_STMT 0x00000400 /* profile as empty Statement */ #define IMA_NOT_FOUND_OKAY 0x00000800 /* no error if not found */ #define IMA_EXECUTE 0x00001000 /* do/execute: DBIcf_Executed */ #define IMA_SHOW_ERR_STMT 0x00002000 /* dbh meth relates to Statement*/ #define IMA_HIDE_ERR_PARAMVALUES 0x00004000 /* ParamValues are not relevant */ #define IMA_IS_FACTORY 0x00008000 /* new h ie connect and prepare */ #define IMA_CLEAR_CACHED_KIDS 0x00010000 /* clear CachedKids before call */ #define DBIc_STATE_adjust(imp_xxh, state) \ (SvOK(state) /* SQLSTATE is implemented by driver */ \ ? (strEQ(SvPV_nolen(state),"00000") ? &PL_sv_no : sv_mortalcopy(state))\ : (SvTRUE(DBIc_ERR(imp_xxh)) \ ? sv_2mortal(newSVpvs("S1000")) /* General error */ \ : &PL_sv_no) /* Success ("00000") */ \ ) #define DBI_LAST_HANDLE g_dbi_last_h /* special fake inner handle */ #define DBI_IS_LAST_HANDLE(h) ((DBI_LAST_HANDLE) == SvRV(h)) #define DBI_SET_LAST_HANDLE(h) ((DBI_LAST_HANDLE) = SvRV(h)) #define DBI_UNSET_LAST_HANDLE ((DBI_LAST_HANDLE) = &PL_sv_undef) #define DBI_LAST_HANDLE_OK ((DBI_LAST_HANDLE) != &PL_sv_undef) #define DBIS_TRACE_LEVEL (DBIS->debug & DBIc_TRACE_LEVEL_MASK) #define DBIS_TRACE_FLAGS (DBIS->debug) /* includes level */ #ifdef PERL_LONG_MAX #define MAX_LongReadLen PERL_LONG_MAX #else #define MAX_LongReadLen 2147483647L #endif #ifdef DBI_USE_THREADS static char *dbi_build_opt = "-ithread"; #else static char *dbi_build_opt = "-nothread"; #endif /* 32 bit magic FNV-0 and FNV-1 prime */ #define FNV_32_PRIME ((UV)0x01000193) /* perl doesn't know anything about the dbi_ima_t struct attached to the * CvXSUBANY(cv).any_ptr slot, so add some magic to the CV to handle * duping and freeing. */ static MGVTBL dbi_ima_vtbl = { 0, 0, 0, 0, dbi_ima_free, 0, #if defined(USE_ITHREADS) && !defined(BROKEN_DUP_ANY_PTR) dbi_ima_dup #else 0 #endif #if (PERL_REVISION == 5) # if (PERL_VERSION > 8) || ((PERL_VERSION == 8) && (PERL_SUBVERSION >= 9)) , 0 # endif #endif }; static int dbi_ima_free(pTHX_ SV* sv, PERL_UNUSED_DECL MAGIC* mg) { dbi_ima_t *ima = (dbi_ima_t *)(CvXSUBANY((CV*)sv).any_ptr); #ifdef BROKEN_DUP_ANY_PTR if (ima->my_perl != my_perl) return 0; #endif SvREFCNT_dec(ima->stash); SvREFCNT_dec(ima->gv); Safefree(ima); return 0; } #if defined(USE_ITHREADS) && !defined(BROKEN_DUP_ANY_PTR) static int dbi_ima_dup(pTHX_ MAGIC* mg, CLONE_PARAMS *param) { dbi_ima_t *ima, *nima; CV *cv = (CV*) mg->mg_ptr; CV *ncv = (CV*)ptr_table_fetch(PL_ptr_table, (cv)); PERL_UNUSED_VAR(param); mg->mg_ptr = (char *)ncv; ima = (dbi_ima_t*) CvXSUBANY(cv).any_ptr; Newx(nima, 1, dbi_ima_t); *nima = *ima; /* structure copy */ CvXSUBANY(ncv).any_ptr = nima; nima->stash = NULL; nima->gv = NULL; return 0; } #endif /* --- make DBI safe for multiple perl interpreters --- */ /* Originally contributed by Murray Nesbitt of ActiveState, */ /* but later updated to use MY_CTX */ #define MY_CXT_KEY "DBI::_guts" XS_VERSION typedef struct { SV *dbi_last_h; /* maybe better moved into dbistate_t? */ dbistate_t* dbi_state; } my_cxt_t; START_MY_CXT #undef DBIS #define DBIS (MY_CXT.dbi_state) #define g_dbi_last_h (MY_CXT.dbi_last_h) /* allow the 'static' dbi_state struct to be accessed from other files */ dbistate_t** _dbi_state_lval(pTHX) { dMY_CXT; return &(MY_CXT.dbi_state); } /* --- */ static void * malloc_using_sv(STRLEN len) { dTHX; SV *sv = newSV(len ? len : 1); void *p = SvPVX(sv); memzero(p, len); return p; } static char * savepv_using_sv(char *str) { char *buf = malloc_using_sv(strlen(str)); strcpy(buf, str); return buf; } /* --- support functions for concat_hash_sorted --- */ typedef struct str_uv_sort_pair_st { char *key; UV numeric; } str_uv_sort_pair_t; static int _cmp_number(const void *val1, const void *val2) { UV first = ((str_uv_sort_pair_t *)val1)->numeric; UV second = ((str_uv_sort_pair_t *)val2)->numeric; if (first > second) return 1; if (first < second) return -1; /* only likely to reach here if numeric sort forced for non-numeric keys */ /* fallback to comparing the key strings */ return strcmp( ((str_uv_sort_pair_t *)val1)->key, ((str_uv_sort_pair_t *)val2)->key ); } static int _cmp_str (const void *val1, const void *val2) { return strcmp( *(char **)val1, *(char **)val2); } static char ** _sort_hash_keys (HV *hash, int num_sort, STRLEN *total_length) { dTHX; I32 hv_len, key_len; HE *entry; char **keys; unsigned int idx = 0; STRLEN tot_len = 0; bool has_non_numerics = 0; str_uv_sort_pair_t *numbers; hv_len = hv_iterinit(hash); if (!hv_len) return 0; Newz(0, keys, hv_len, char *); Newz(0, numbers, hv_len, str_uv_sort_pair_t); while ((entry = hv_iternext(hash))) { *(keys+idx) = hv_iterkey(entry, &key_len); tot_len += key_len; if (grok_number(*(keys+idx), key_len, &(numbers+idx)->numeric) != IS_NUMBER_IN_UV) { has_non_numerics = 1; (numbers+idx)->numeric = 0; } (numbers+idx)->key = *(keys+idx); ++idx; } if (total_length) *total_length = tot_len; if (num_sort < 0) num_sort = (has_non_numerics) ? 0 : 1; if (!num_sort) { qsort(keys, hv_len, sizeof(char*), _cmp_str); } else { qsort(numbers, hv_len, sizeof(str_uv_sort_pair_t), _cmp_number); for (idx = 0; idx < hv_len; ++idx) *(keys+idx) = (numbers+idx)->key; } Safefree(numbers); return keys; } static SV * _join_hash_sorted(HV *hash, char *kv_sep, STRLEN kv_sep_len, char *pair_sep, STRLEN pair_sep_len, int use_neat, int num_sort) { dTHX; I32 hv_len; STRLEN total_len = 0; char **keys; unsigned int i = 0; SV *return_sv; keys = _sort_hash_keys(hash, num_sort, &total_len); if (!keys) return newSVpvs(""); if (!kv_sep_len) kv_sep_len = strlen(kv_sep); if (!pair_sep_len) pair_sep_len = strlen(pair_sep); hv_len = hv_iterinit(hash); /* total_len += Separators + quotes + term null */ total_len += kv_sep_len*hv_len + pair_sep_len*hv_len+2*hv_len+1; return_sv = newSV(total_len); sv_setpv(return_sv, ""); /* quell undef warnings */ for (i=0; icheck_version = check_version; DBIS->version = DBISTATE_VERSION; DBIS->size = sizeof(*DBIS); DBIS->xs_version = DBIXS_VERSION; DBIS->logmsg = dbih_logmsg; DBIS->logfp = PerlIO_stderr(); DBIS->debug = (parent_dbis) ? parent_dbis->debug : SvIV(get_sv("DBI::dbi_debug",0x5)); DBIS->neatsvpvlen = (parent_dbis) ? parent_dbis->neatsvpvlen : get_sv("DBI::neat_maxlen", GV_ADDMULTI); #ifdef DBI_USE_THREADS DBIS->thr_owner = PERL_GET_THX; #endif /* store some function pointers so DBD's can call our functions */ DBIS->getcom = dbih_getcom; DBIS->clearcom = dbih_clearcom; DBIS->event = dbih_event; DBIS->set_attr_k = dbih_set_attr_k; DBIS->get_attr_k = dbih_get_attr_k; DBIS->get_fbav = dbih_get_fbav; DBIS->make_fdsv = dbih_make_fdsv; DBIS->neat_svpv = neatsvpv; DBIS->bind_as_num = quote_type; /* XXX deprecated */ DBIS->hash = dbi_hash; DBIS->set_err_sv = set_err_sv; DBIS->set_err_char= set_err_char; DBIS->bind_col = dbih_sth_bind_col; DBIS->sql_type_cast_svpv = sql_type_cast_svpv; /* Remember the last handle used. BEWARE! Sneaky stuff here! */ /* We want a handle reference but we don't want to increment */ /* the handle's reference count and we don't want perl to try */ /* to destroy it during global destruction. Take care! */ DBI_UNSET_LAST_HANDLE; /* ensure setup the correct way */ /* trick to avoid 'possible typo' warnings */ gv_fetchpv("DBI::state", GV_ADDMULTI, SVt_PV); gv_fetchpv("DBI::err", GV_ADDMULTI, SVt_PV); gv_fetchpv("DBI::errstr", GV_ADDMULTI, SVt_PV); gv_fetchpv("DBI::lasth", GV_ADDMULTI, SVt_PV); gv_fetchpv("DBI::rows", GV_ADDMULTI, SVt_PV); /* we only need to check the env var on the initial boot * which is handy because it can core dump during CLONE on windows */ if (!parent_dbis && getenv("PERL_DBI_XSBYPASS")) use_xsbypass = atoi(getenv("PERL_DBI_XSBYPASS")); } /* ----------------------------------------------------------------- */ /* Utility functions */ static char * dbih_htype_name(int htype) { switch(htype) { case DBIt_DR: return "dr"; case DBIt_DB: return "db"; case DBIt_ST: return "st"; case DBIt_FD: return "fd"; default: return "??"; } } char * neatsvpv(SV *sv, STRLEN maxlen) /* return a tidy ascii value, for debugging only */ { dTHX; dMY_CXT; STRLEN len; SV *nsv = Nullsv; SV *infosv = Nullsv; char *v, *quote; /* We take care not to alter the supplied sv in any way at all. */ /* (but if it is SvGMAGICAL we have to call mg_get and that can */ /* have side effects, especially as it may be called twice overall.) */ if (!sv) return "Null!"; /* should never happen */ /* try to do the right thing with magical values */ if (SvMAGICAL(sv)) { if (DBIS_TRACE_LEVEL >= 5) { /* add magic details to help debugging */ MAGIC* mg; infosv = sv_2mortal(newSVpvs(" (magic-")); if (SvSMAGICAL(sv)) sv_catpvs(infosv, "s"); if (SvGMAGICAL(sv)) sv_catpvs(infosv, "g"); if (SvRMAGICAL(sv)) sv_catpvs(infosv, "r"); sv_catpvs(infosv, ":"); for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) sv_catpvn(infosv, &mg->mg_type, 1); sv_catpvs(infosv, ")"); } if (SvGMAGICAL(sv) && !PL_dirty) mg_get(sv); /* trigger magic to FETCH the value */ } if (!SvOK(sv)) { if (SvTYPE(sv) >= SVt_PVAV) return (char *)sv_reftype(sv,0); /* raw AV/HV etc, not via a ref */ if (!infosv) return "undef"; sv_insert(infosv, 0,0, "undef",5); return SvPVX(infosv); } if (SvNIOK(sv)) { /* is a numeric value - so no surrounding quotes */ if (SvPOK(sv)) { /* already has string version of the value, so use it */ v = SvPV(sv,len); if (len == 0) { v="''"; len=2; } /* catch &sv_no style special case */ if (!infosv) return v; sv_insert(infosv, 0,0, v, len); return SvPVX(infosv); } /* we don't use SvPV here since we don't want to alter sv in _any_ way */ if (SvUOK(sv)) nsv = newSVpvf("%"UVuf, SvUVX(sv)); else if (SvIOK(sv)) nsv = newSVpvf("%"IVdf, SvIVX(sv)); else nsv = newSVpvf("%"NVgf, SvNVX(sv)); if (infosv) sv_catsv(nsv, infosv); return SvPVX(sv_2mortal(nsv)); } nsv = sv_newmortal(); sv_upgrade(nsv, SVt_PV); if (SvROK(sv)) { if (!SvAMAGIC(sv)) /* (un-amagic'd) refs get no special treatment */ v = SvPV(sv,len); else { /* handle Overload magic refs */ (void)SvAMAGIC_off(sv); /* should really be done via local scoping */ v = SvPV(sv,len); /* XXX how does this relate to SvGMAGIC? */ SvAMAGIC_on(sv); } sv_setpvn(nsv, v, len); if (infosv) sv_catsv(nsv, infosv); return SvPV(nsv, len); } if (SvPOK(sv)) /* usual simple string case */ v = SvPV(sv,len); else /* handles all else via sv_2pv() */ v = SvPV(sv,len); /* XXX how does this relate to SvGMAGIC? */ /* for strings we limit the length and translate codes */ if (maxlen == 0) maxlen = SvIV(DBIS->neatsvpvlen); if (maxlen < 6) /* handle daft values */ maxlen = 6; maxlen -= 2; /* account for quotes */ quote = (SvUTF8(sv)) ? "\"" : "'"; if (len > maxlen) { SvGROW(nsv, (1+maxlen+1+1)); sv_setpvn(nsv, quote, 1); sv_catpvn(nsv, v, maxlen-3); /* account for three dots */ sv_catpvs(nsv, "..."); } else { SvGROW(nsv, (1+len+1+1)); sv_setpvn(nsv, quote, 1); sv_catpvn(nsv, v, len); } sv_catpvn(nsv, quote, 1); if (infosv) sv_catsv(nsv, infosv); v = SvPV(nsv, len); if (!SvUTF8(sv)) { while(len-- > 0) { /* cleanup string (map control chars to ascii etc) */ const char c = v[len] & 0x7F; /* ignore top bit for multinational chars */ if (!isPRINT(c) && !isSPACE(c)) v[len] = '.'; } } return v; } static void copy_statement_to_parent(pTHX_ SV *h, imp_xxh_t *imp_xxh) { SV *parent; if (PL_dirty) return; parent = DBIc_PARENT_H(imp_xxh); if (parent && SvROK(parent)) { SV *tmp_sv = *hv_fetchs((HV*)SvRV(h), "Statement", 1); if (SvOK(tmp_sv)) (void)hv_stores((HV*)SvRV(parent), "Statement", SvREFCNT_inc(tmp_sv)); } } static int set_err_char(SV *h, imp_xxh_t *imp_xxh, const char *err_c, IV err_i, const char *errstr, const char *state, const char *method) { dTHX; char err_buf[28]; SV *err_sv, *errstr_sv, *state_sv, *method_sv; if (!err_c) { sprintf(err_buf, "%ld", (long)err_i); err_c = &err_buf[0]; } err_sv = (strEQ(err_c,"1")) ? &PL_sv_yes : sv_2mortal(newSVpvn(err_c, strlen(err_c))); errstr_sv = sv_2mortal(newSVpvn(errstr, strlen(errstr))); state_sv = (state && *state) ? sv_2mortal(newSVpvn(state, strlen(state))) : &PL_sv_undef; method_sv = (method && *method) ? sv_2mortal(newSVpvn(method, strlen(method))) : &PL_sv_undef; return set_err_sv(h, imp_xxh, err_sv, errstr_sv, state_sv, method_sv); } static int set_err_sv(SV *h, imp_xxh_t *imp_xxh, SV *err, SV *errstr, SV *state, SV *method) { dTHX; SV *h_err; SV *h_errstr; SV *h_state; SV **hook_svp; int err_changed = 0; if ( DBIc_has(imp_xxh, DBIcf_HandleSetErr) && (hook_svp = hv_fetchs((HV*)SvRV(h),"HandleSetErr",0)) && hook_svp && ((void)(SvGMAGICAL(*hook_svp) && mg_get(*hook_svp)), SvOK(*hook_svp)) ) { dSP; IV items; SV *response_sv; if (SvREADONLY(err)) err = sv_mortalcopy(err); if (SvREADONLY(errstr)) errstr = sv_mortalcopy(errstr); if (SvREADONLY(state)) state = sv_mortalcopy(state); if (SvREADONLY(method)) method = sv_mortalcopy(method); if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) PerlIO_printf(DBIc_LOGPIO(imp_xxh)," -> HandleSetErr(%s, err=%s, errstr=%s, state=%s, %s)\n", neatsvpv(h,0), neatsvpv(err,0), neatsvpv(errstr,0), neatsvpv(state,0), neatsvpv(method,0) ); PUSHMARK(SP); mXPUSHs(newRV_inc((SV*)DBIc_MY_H(imp_xxh))); XPUSHs(err); XPUSHs(errstr); XPUSHs(state); XPUSHs(method); PUTBACK; items = call_sv(*hook_svp, G_SCALAR); SPAGAIN; response_sv = (items) ? POPs : &PL_sv_undef; PUTBACK; if (DBIc_TRACE_LEVEL(imp_xxh) >= 1) PerlIO_printf(DBIc_LOGPIO(imp_xxh)," <- HandleSetErr= %s (err=%s, errstr=%s, state=%s, %s)\n", neatsvpv(response_sv,0), neatsvpv(err,0), neatsvpv(errstr,0), neatsvpv(state,0), neatsvpv(method,0) ); if (SvTRUE(response_sv)) /* handler says it has handled it, so... */ return 0; } else { if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) PerlIO_printf(DBIc_LOGPIO(imp_xxh)," -- HandleSetErr err=%s, errstr=%s, state=%s, %s\n", neatsvpv(err,0), neatsvpv(errstr,0), neatsvpv(state,0), neatsvpv(method,0) ); } if (!SvOK(err)) { /* clear err / errstr / state */ DBIh_CLEAR_ERROR(imp_xxh); return 1; } /* fetch these after calling HandleSetErr */ h_err = DBIc_ERR(imp_xxh); h_errstr = DBIc_ERRSTR(imp_xxh); h_state = DBIc_STATE(imp_xxh); if (SvTRUE(h_errstr)) { /* append current err, if any, to errstr if it's going to change */ if (SvTRUE(h_err) && SvTRUE(err) && strNE(SvPV_nolen(h_err), SvPV_nolen(err))) sv_catpvf(h_errstr, " [err was %s now %s]", SvPV_nolen(h_err), SvPV_nolen(err)); if (SvTRUE(h_state) && SvTRUE(state) && strNE(SvPV_nolen(h_state), SvPV_nolen(state))) sv_catpvf(h_errstr, " [state was %s now %s]", SvPV_nolen(h_state), SvPV_nolen(state)); if (strNE(SvPV_nolen(h_errstr), SvPV_nolen(errstr))) { sv_catpvs(h_errstr, "\n"); sv_catsv(h_errstr, errstr); } } else sv_setsv(h_errstr, errstr); /* SvTRUE(err) > "0" > "" > undef */ if (SvTRUE(err) /* new error: so assign */ || !SvOK(h_err) /* no existing warn/info: so assign */ /* new warn ("0" len 1) > info ("" len 0): so assign */ || (SvOK(err) && strlen(SvPV_nolen(err)) > strlen(SvPV_nolen(h_err))) ) { sv_setsv(h_err, err); err_changed = 1; if (SvTRUE(h_err)) /* new error */ ++DBIc_ErrCount(imp_xxh); } if (err_changed) { if (SvTRUE(state)) { if (strlen(SvPV_nolen(state)) != 5) { warn("set_err: state (%s) is not a 5 character string, using 'S1000' instead", neatsvpv(state,0)); sv_setpv(h_state, "S1000"); } else sv_setsv(h_state, state); } else (void)SvOK_off(h_state); /* see DBIc_STATE_adjust */ /* ensure that the parent's Statement attribute reflects the latest error */ /* so that ShowErrorStatement is reliable */ copy_statement_to_parent(aTHX_ h, imp_xxh); } return 1; } /* err_hash returns a U32 'hash' value representing the current err 'level' * (err/warn/info) and errstr. It's used by the dispatcher as a way to detect * a new or changed warning during a 'keep err' method like STORE. Always returns >0. * The value is 1 for no err/warn/info and guarantees that err > warn > info. * (It's a bit of a hack but the original approach in 70fe6bd76 using a new * ErrChangeCount attribute would break binary compatibility with drivers.) * The chance that two realistic errstr values would hash the same, even with * only 30 bits, is deemed to small to even bother documenting. */ static U32 err_hash(pTHX_ imp_xxh_t *imp_xxh) { SV *err_sv = DBIc_ERR(imp_xxh); SV *errstr_sv; I32 hash = 1; if (SvOK(err_sv)) { errstr_sv = DBIc_ERRSTR(imp_xxh); if (SvOK(errstr_sv)) hash = -dbi_hash(SvPV_nolen(errstr_sv), 0); /* make positive */ else hash = 0; hash >>= 1; /* free up extra bit (top bit is already free) */ hash |= (SvTRUE(err_sv)) ? 0x80000000 /* err */ : (SvPOK(err_sv) && !SvCUR(err_sv)) ? 0x20000000 /* '' = info */ : 0x40000000;/* 0 or '0' = warn */ } return hash; } static char * mkvname(pTHX_ HV *stash, const char *item, int uplevel) /* construct a variable name */ { SV *sv = sv_newmortal(); sv_setpv(sv, HvNAME(stash)); if(uplevel) { while(SvCUR(sv) && *SvEND(sv)!=':') --SvCUR(sv); if (SvCUR(sv)) --SvCUR(sv); } sv_catpv(sv, "::"); sv_catpv(sv, item); return SvPV_nolen(sv); } /* 32 bit magic FNV-0 and FNV-1 prime */ #define FNV_32_PRIME ((UV)0x01000193) static I32 dbi_hash(const char *key, long type) { if (type == 0) { STRLEN klen = strlen(key); U32 hash = 0; while (klen--) hash = hash * 33 + *key++; hash &= 0x7FFFFFFF; /* limit to 31 bits */ hash |= 0x40000000; /* set bit 31 */ return -(I32)hash; /* return negative int */ } else if (type == 1) { /* Fowler/Noll/Vo hash */ /* see http://www.isthe.com/chongo/tech/comp/fnv/ */ U32 hash = 0x811c9dc5; const unsigned char *s = (unsigned char *)key; /* unsigned string */ while (*s) { /* multiply by the 32 bit FNV magic prime mod 2^32 */ hash *= FNV_32_PRIME; /* xor the bottom with the current octet */ hash ^= (U32)*s++; } return hash; } croak("DBI::hash(%ld): invalid type", type); return 0; /* NOT REACHED */ } static int dbih_logmsg(imp_xxh_t *imp_xxh, const char *fmt, ...) { dTHX; va_list args; #ifdef I_STDARG va_start(args, fmt); #else va_start(args); #endif (void) PerlIO_vprintf(DBIc_DBISTATE(imp_xxh)->logfp, fmt, args); va_end(args); (void)imp_xxh; return 1; } static void close_trace_file(pTHX) { dMY_CXT; if (DBILOGFP == PerlIO_stderr() || DBILOGFP == PerlIO_stdout()) return; if (DBIS->logfp_ref == NULL) PerlIO_close(DBILOGFP); else { /* DAA dec refcount and discard */ SvREFCNT_dec(DBIS->logfp_ref); DBIS->logfp_ref = NULL; } } static int set_trace_file(SV *file) { dTHX; dMY_CXT; const char *filename; PerlIO *fp = Nullfp; IO *io; if (!file) /* no arg == no change */ return 0; /* DAA check for a filehandle */ if (SvROK(file)) { io = sv_2io(file); if (!io || !(fp = IoOFP(io))) { warn("DBI trace filehandle is not valid"); return 0; } close_trace_file(aTHX); (void)SvREFCNT_inc(io); DBIS->logfp_ref = io; } else if (isGV_with_GP(file)) { io = GvIO(file); if (!io || !(fp = IoOFP(io))) { warn("DBI trace filehandle from GLOB is not valid"); return 0; } close_trace_file(aTHX); (void)SvREFCNT_inc(io); DBIS->logfp_ref = io; } else { filename = (SvOK(file)) ? SvPV_nolen(file) : Nullch; /* undef arg == reset back to stderr */ if (!filename || strEQ(filename,"STDERR") || strEQ(filename,"*main::STDERR")) { close_trace_file(aTHX); DBILOGFP = PerlIO_stderr(); return 1; } if (strEQ(filename,"STDOUT")) { close_trace_file(aTHX); DBILOGFP = PerlIO_stdout(); return 1; } fp = PerlIO_open(filename, "a+"); if (fp == Nullfp) { warn("Can't open trace file %s: %s", filename, Strerror(errno)); return 0; } close_trace_file(aTHX); } DBILOGFP = fp; /* if this line causes your compiler or linker to choke */ /* then just comment it out, it's not essential. */ PerlIO_setlinebuf(fp); /* force line buffered output */ return 1; } static IV parse_trace_flags(SV *h, SV *level_sv, IV old_level) { dTHX; IV level; if (!level_sv || !SvOK(level_sv)) level = old_level; /* undef: no change */ else if (SvTRUE(level_sv)) { if (looks_like_number(level_sv)) level = SvIV(level_sv); /* number: number */ else { /* string: parse it */ dSP; PUSHMARK(sp); XPUSHs(h); XPUSHs(level_sv); PUTBACK; if (call_method("parse_trace_flags", G_SCALAR) != 1) croak("panic: parse_trace_flags");/* should never happen */ SPAGAIN; level = POPi; PUTBACK; } } else /* defined but false: 0 */ level = 0; return level; } static int set_trace(SV *h, SV *level_sv, SV *file) { dTHX; D_imp_xxh(h); int RETVAL = DBIc_DBISTATE(imp_xxh)->debug; /* Return trace level in effect now */ IV level = parse_trace_flags(h, level_sv, RETVAL); set_trace_file(file); if (level != RETVAL) { /* set value */ if ((level & DBIc_TRACE_LEVEL_MASK) > 0) { PerlIO_printf(DBIc_LOGPIO(imp_xxh), " %s trace level set to 0x%lx/%ld (DBI @ 0x%lx/%ld) in DBI %s%s (pid %d)\n", neatsvpv(h,0), (long)(level & DBIc_TRACE_FLAGS_MASK), (long)(level & DBIc_TRACE_LEVEL_MASK), (long)DBIc_TRACE_FLAGS(imp_xxh), (long)DBIc_TRACE_LEVEL(imp_xxh), XS_VERSION, dbi_build_opt, (int)PerlProc_getpid()); if (!PL_dowarn) PerlIO_printf(DBIc_LOGPIO(imp_xxh)," Note: perl is running without the recommended perl -w option\n"); PerlIO_flush(DBIc_LOGPIO(imp_xxh)); } sv_setiv(DBIc_DEBUG(imp_xxh), level); } return RETVAL; } static SV * dbih_inner(pTHX_ SV *orv, const char *what) { /* convert outer to inner handle else croak(what) if what is not NULL */ /* if what is NULL then return NULL for invalid handles */ MAGIC *mg; SV *ohv; /* outer HV after derefing the RV */ SV *hrv; /* dbi inner handle RV-to-HV */ /* enable a raw HV (not ref-to-HV) to be passed in, eg DBIc_MY_H */ ohv = SvROK(orv) ? SvRV(orv) : orv; if (!ohv || SvTYPE(ohv) != SVt_PVHV) { if (!what) return NULL; if (1) { dMY_CXT; if (DBIS_TRACE_LEVEL) sv_dump(orv); } if (!SvOK(orv)) croak("%s given an undefined handle %s", what, "(perhaps returned from a previous call which failed)"); croak("%s handle %s is not a DBI handle", what, neatsvpv(orv,0)); } if (!SvMAGICAL(ohv)) { if (!what) return NULL; if (!hv_fetchs((HV*)ohv,"_NO_DESTRUCT_WARN",0)) sv_dump(orv); croak("%s handle %s is not a DBI handle (has no magic)", what, neatsvpv(orv,0)); } if ( (mg=mg_find(ohv,'P')) == NULL) { /* hash tie magic */ /* not tied, maybe it's already an inner handle... */ if (mg_find(ohv, DBI_MAGIC) == NULL) { if (!what) return NULL; sv_dump(orv); croak("%s handle %s is not a valid DBI handle", what, neatsvpv(orv,0)); } hrv = orv; /* was already a DBI handle inner hash */ } else { hrv = mg->mg_obj; /* inner hash of tie */ } return hrv; } /* -------------------------------------------------------------------- */ /* Functions to manage a DBI handle (magic and attributes etc). */ static imp_xxh_t * dbih_getcom(SV *hrv) /* used by drivers via DBIS func ptr */ { MAGIC *mg; SV *sv; /* short-cut common case */ if ( SvROK(hrv) && (sv = SvRV(hrv)) && SvRMAGICAL(sv) && (mg = SvMAGIC(sv)) && mg->mg_type == DBI_MAGIC && mg->mg_ptr ) return (imp_xxh_t *) mg->mg_ptr; { dTHX; imp_xxh_t *imp_xxh = dbih_getcom2(aTHX_ hrv, 0); if (!imp_xxh) /* eg after take_imp_data */ croak("Invalid DBI handle %s, has no dbi_imp_data", neatsvpv(hrv,0)); return imp_xxh; } } static imp_xxh_t * dbih_getcom2(pTHX_ SV *hrv, MAGIC **mgp) /* Get com struct for handle. Must be fast. */ { MAGIC *mg; SV *sv; /* important and quick sanity check (esp non-'safe' Oraperl) */ if (SvROK(hrv)) /* must at least be a ref */ sv = SvRV(hrv); else { dMY_CXT; if (hrv == DBI_LAST_HANDLE) /* special for var::FETCH */ sv = DBI_LAST_HANDLE; else if (sv_derived_from(hrv, "DBI::common")) { /* probably a class name, if ref($h)->foo() */ return 0; } else { sv_dump(hrv); croak("Invalid DBI handle %s", neatsvpv(hrv,0)); sv = &PL_sv_undef; /* avoid "might be used uninitialized" warning */ } } /* Short cut for common case. We assume that a magic var always */ /* has magic and that DBI_MAGIC, if present, will be the first. */ if (SvRMAGICAL(sv) && (mg=SvMAGIC(sv))->mg_type == DBI_MAGIC) { /* nothing to do here */ } else { /* Validate handle (convert outer to inner if required) */ hrv = dbih_inner(aTHX_ hrv, "dbih_getcom"); mg = mg_find(SvRV(hrv), DBI_MAGIC); } if (mgp) /* let caller pickup magic struct for this handle */ *mgp = mg; if (!mg) /* may happen during global destruction */ return (imp_xxh_t *) 0; return (imp_xxh_t *) mg->mg_ptr; } static SV * dbih_setup_attrib(pTHX_ SV *h, imp_xxh_t *imp_xxh, char *attrib, SV *parent, int read_only, int optional) { STRLEN len = strlen(attrib); SV **asvp; asvp = hv_fetch((HV*)SvRV(h), attrib, len, !optional); /* we assume that we won't have any existing 'undef' attributes here */ /* (or, alternately, we take undef to mean 'copy from parent') */ if (!(asvp && SvOK(*asvp))) { /* attribute doesn't already exists (the common case) */ SV **psvp; if ((!parent || !SvROK(parent)) && !optional) { croak("dbih_setup_attrib(%s): %s not set and no parent supplied", neatsvpv(h,0), attrib); } psvp = hv_fetch((HV*)SvRV(parent), attrib, len, 0); if (psvp) { if (!asvp) asvp = hv_fetch((HV*)SvRV(h), attrib, len, 1); sv_setsv(*asvp, *psvp); /* copy attribute from parent to handle */ } else { if (!optional) croak("dbih_setup_attrib(%s): %s not set and not in parent", neatsvpv(h,0), attrib); } } if (DBIc_TRACE_LEVEL(imp_xxh) >= 5) { PerlIO *logfp = DBIc_LOGPIO(imp_xxh); PerlIO_printf(logfp," dbih_setup_attrib(%s, %s, %s)", neatsvpv(h,0), attrib, neatsvpv(parent,0)); if (!asvp) PerlIO_printf(logfp," undef (not defined)\n"); else if (SvOK(*asvp)) PerlIO_printf(logfp," %s (already defined)\n", neatsvpv(*asvp,0)); else PerlIO_printf(logfp," %s (copied from parent)\n", neatsvpv(*asvp,0)); } if (read_only && asvp) SvREADONLY_on(*asvp); return asvp ? *asvp : &PL_sv_undef; } static SV * dbih_make_fdsv(SV *sth, const char *imp_class, STRLEN imp_size, const char *col_name) { dTHX; D_imp_sth(sth); const STRLEN cn_len = strlen(col_name); imp_fdh_t *imp_fdh; SV *fdsv; if (imp_size < sizeof(imp_fdh_t) || cn_len<10 || strNE("::fd",&col_name[cn_len-4])) croak("panic: dbih_makefdsv %s '%s' imp_size %ld invalid", imp_class, col_name, (long)imp_size); if (DBIc_TRACE_LEVEL(imp_sth) >= 5) PerlIO_printf(DBIc_LOGPIO(imp_sth)," dbih_make_fdsv(%s, %s, %ld, '%s')\n", neatsvpv(sth,0), imp_class, (long)imp_size, col_name); fdsv = dbih_make_com(sth, (imp_xxh_t*)imp_sth, imp_class, imp_size, cn_len+2, 0); imp_fdh = (imp_fdh_t*)(void*)SvPVX(fdsv); imp_fdh->com.col_name = ((char*)imp_fdh) + imp_size; strcpy(imp_fdh->com.col_name, col_name); return fdsv; } static SV * dbih_make_com(SV *p_h, imp_xxh_t *p_imp_xxh, const char *imp_class, STRLEN imp_size, STRLEN extra, SV* imp_templ) { dTHX; static const char *errmsg = "Can't make DBI com handle for %s: %s"; HV *imp_stash; SV *dbih_imp_sv; imp_xxh_t *imp; int trace_level; PERL_UNUSED_VAR(extra); if ( (imp_stash = gv_stashpv(imp_class, FALSE)) == NULL) croak(errmsg, imp_class, "unknown package"); if (imp_size == 0) { /* get size of structure to allocate for common and imp specific data */ const char *imp_size_name = mkvname(aTHX_ imp_stash, "imp_data_size", 0); imp_size = SvIV(get_sv(imp_size_name, 0x05)); if (imp_size == 0) { imp_size = sizeof(imp_sth_t); if (sizeof(imp_dbh_t) > imp_size) imp_size = sizeof(imp_dbh_t); if (sizeof(imp_drh_t) > imp_size) imp_size = sizeof(imp_drh_t); imp_size += 4; } } if (p_imp_xxh) { trace_level = DBIc_TRACE_LEVEL(p_imp_xxh); } else { dMY_CXT; trace_level = DBIS_TRACE_LEVEL; } if (trace_level >= 5) { dMY_CXT; PerlIO_printf(DBILOGFP," dbih_make_com(%s, %p, %s, %ld, %p) thr#%p\n", neatsvpv(p_h,0), (void*)p_imp_xxh, imp_class, (long)imp_size, (void*)imp_templ, (void*)PERL_GET_THX); } if (imp_templ && SvOK(imp_templ)) { U32 imp_templ_flags; /* validate the supplied dbi_imp_data looks reasonable, */ if (SvCUR(imp_templ) != imp_size) croak("Can't use dbi_imp_data of wrong size (%ld not %ld)", (long)SvCUR(imp_templ), (long)imp_size); /* copy the whole template */ dbih_imp_sv = newSVsv(imp_templ); imp = (imp_xxh_t*)(void*)SvPVX(dbih_imp_sv); /* sanity checks on the supplied imp_data */ if (DBIc_TYPE(imp) != ((p_imp_xxh) ? DBIc_TYPE(p_imp_xxh)+1 :1) ) croak("Can't use dbi_imp_data from different type of handle"); if (!DBIc_has(imp, DBIcf_IMPSET)) croak("Can't use dbi_imp_data that not from a setup handle"); /* copy flags, zero out our imp_xxh struct, restore some flags */ imp_templ_flags = DBIc_FLAGS(imp); switch ( (p_imp_xxh) ? DBIc_TYPE(p_imp_xxh)+1 : DBIt_DR ) { case DBIt_DR: memzero((char*)imp, sizeof(imp_drh_t)); break; case DBIt_DB: memzero((char*)imp, sizeof(imp_dbh_t)); break; case DBIt_ST: memzero((char*)imp, sizeof(imp_sth_t)); break; default: croak("dbih_make_com dbi_imp_data bad h type"); } /* Only pass on DBIcf_IMPSET to indicate to driver that the imp */ /* structure has been copied and it doesn't need to reconnect. */ /* Similarly DBIcf_ACTIVE is also passed along but isn't key. */ DBIc_FLAGS(imp) = imp_templ_flags & (DBIcf_IMPSET|DBIcf_ACTIVE); } else { dbih_imp_sv = newSV(imp_size); /* is grown to at least imp_size+1 */ imp = (imp_xxh_t*)(void*)SvPVX(dbih_imp_sv); memzero((char*)imp, imp_size); /* set up SV with SvCUR set ready for take_imp_data */ SvCUR_set(dbih_imp_sv, imp_size); *SvEND(dbih_imp_sv) = '\0'; } if (p_imp_xxh) { DBIc_DBISTATE(imp) = DBIc_DBISTATE(p_imp_xxh); } else { dMY_CXT; DBIc_DBISTATE(imp) = DBIS; } DBIc_IMP_STASH(imp) = imp_stash; if (!p_h) { /* only a driver (drh) has no parent */ DBIc_PARENT_H(imp) = &PL_sv_undef; DBIc_PARENT_COM(imp) = NULL; DBIc_TYPE(imp) = DBIt_DR; DBIc_on(imp,DBIcf_WARN /* set only here, children inherit */ |DBIcf_ACTIVE /* drivers are 'Active' by default */ |DBIcf_AutoCommit /* advisory, driver must manage this */ ); DBIc_set(imp, DBIcf_PrintWarn, 1); } else { DBIc_PARENT_H(imp) = (SV*)SvREFCNT_inc(p_h); /* ensure it lives */ DBIc_PARENT_COM(imp) = p_imp_xxh; /* shortcut for speed */ DBIc_TYPE(imp) = DBIc_TYPE(p_imp_xxh) + 1; /* inherit some flags from parent and carry forward some from template */ DBIc_FLAGS(imp) = (DBIc_FLAGS(p_imp_xxh) & ~DBIcf_INHERITMASK) | (DBIc_FLAGS(imp) & (DBIcf_IMPSET|DBIcf_ACTIVE)); ++DBIc_KIDS(p_imp_xxh); } #ifdef DBI_USE_THREADS DBIc_THR_USER(imp) = PERL_GET_THX ; #endif if (DBIc_TYPE(imp) == DBIt_ST) { imp_sth_t *imp_sth = (imp_sth_t*)imp; DBIc_ROW_COUNT(imp_sth) = -1; } DBIc_COMSET_on(imp); /* common data now set up */ /* The implementor should DBIc_IMPSET_on(imp) when setting up */ /* any private data which will need clearing/freeing later. */ return dbih_imp_sv; } static void dbih_setup_handle(pTHX_ SV *orv, char *imp_class, SV *parent, SV *imp_datasv) { SV *h; char *errmsg = "Can't setup DBI handle of %s to %s: %s"; SV *dbih_imp_sv; SV *dbih_imp_rv; SV *dbi_imp_data = Nullsv; SV **svp; SV *imp_mem_name; HV *imp_mem_stash; imp_xxh_t *imp; imp_xxh_t *parent_imp; int trace_level; h = dbih_inner(aTHX_ orv, "dbih_setup_handle"); parent = dbih_inner(aTHX_ parent, NULL); /* check parent valid (& inner) */ if (parent) { parent_imp = DBIh_COM(parent); trace_level = DBIc_TRACE_LEVEL(parent_imp); } else { dMY_CXT; parent_imp = NULL; trace_level = DBIS_TRACE_LEVEL; } if (trace_level >= 5) { dMY_CXT; PerlIO_printf(DBILOGFP," dbih_setup_handle(%s=>%s, %s, %lx, %s)\n", neatsvpv(orv,0), neatsvpv(h,0), imp_class, (long)parent, neatsvpv(imp_datasv,0)); } if (mg_find(SvRV(h), DBI_MAGIC) != NULL) croak(errmsg, neatsvpv(orv,0), imp_class, "already a DBI (or ~magic) handle"); imp_mem_name = sv_2mortal(newSVpvf("%s_mem", imp_class)); if ( (imp_mem_stash = gv_stashsv(imp_mem_name, FALSE)) == NULL) croak(errmsg, neatsvpv(orv,0), SvPVbyte_nolen(imp_mem_name), "unknown _mem package"); if ((svp = hv_fetchs((HV*)SvRV(h), "dbi_imp_data", 0))) { dbi_imp_data = *svp; if (SvGMAGICAL(dbi_imp_data)) /* call FETCH via magic */ mg_get(dbi_imp_data); } DBI_LOCK; dbih_imp_sv = dbih_make_com(parent, parent_imp, imp_class, 0, 0, dbi_imp_data); imp = (imp_xxh_t*)(void*)SvPVX(dbih_imp_sv); dbih_imp_rv = newRV_inc(dbih_imp_sv); /* just needed for sv_bless */ sv_bless(dbih_imp_rv, imp_mem_stash); sv_free(dbih_imp_rv); DBIc_MY_H(imp) = (HV*)SvRV(orv); /* take _copy_ of pointer, not new ref */ DBIc_IMP_DATA(imp) = (imp_datasv) ? newSVsv(imp_datasv) : &PL_sv_undef; _imp2com(imp, std.pid) = (U32)PerlProc_getpid(); if (DBIc_TYPE(imp) <= DBIt_ST) { SV **tmp_svp; /* Copy some attributes from parent if not defined locally and */ /* also take address of attributes for speed of direct access. */ /* parent is null for drh, in which case h must hold the values */ #define COPY_PARENT(name,ro,opt) SvREFCNT_inc(dbih_setup_attrib(aTHX_ h,imp,(name),parent,ro,opt)) #define DBIc_ATTR(imp, f) _imp2com(imp, attr.f) /* XXX we should validate that these are the right type (refs etc) */ DBIc_ATTR(imp, Err) = COPY_PARENT("Err",1,0); /* scalar ref */ DBIc_ATTR(imp, State) = COPY_PARENT("State",1,0); /* scalar ref */ DBIc_ATTR(imp, Errstr) = COPY_PARENT("Errstr",1,0); /* scalar ref */ DBIc_ATTR(imp, TraceLevel)=COPY_PARENT("TraceLevel",0,0);/* scalar (int)*/ DBIc_ATTR(imp, FetchHashKeyName) = COPY_PARENT("FetchHashKeyName",0,0); /* scalar ref */ if (parent) { dbih_setup_attrib(aTHX_ h,imp,"HandleSetErr",parent,0,1); dbih_setup_attrib(aTHX_ h,imp,"HandleError",parent,0,1); dbih_setup_attrib(aTHX_ h,imp,"ReadOnly",parent,0,1); dbih_setup_attrib(aTHX_ h,imp,"Profile",parent,0,1); /* setup Callbacks from parents' ChildCallbacks */ if (DBIc_has(parent_imp, DBIcf_Callbacks) && (tmp_svp = hv_fetchs((HV*)SvRV(parent), "Callbacks", 0)) && SvROK(*tmp_svp) && SvTYPE(SvRV(*tmp_svp)) == SVt_PVHV && (tmp_svp = hv_fetchs((HV*)SvRV(*tmp_svp), "ChildCallbacks", 0)) && SvROK(*tmp_svp) && SvTYPE(SvRV(*tmp_svp)) == SVt_PVHV ) { /* XXX mirrors behaviour of dbih_set_attr_k() of Callbacks */ (void)hv_stores((HV*)SvRV(h), "Callbacks", newRV_inc(SvRV(*tmp_svp))); DBIc_set(imp, DBIcf_Callbacks, 1); } DBIc_LongReadLen(imp) = DBIc_LongReadLen(parent_imp); #ifdef sv_rvweaken if (1) { AV *av; /* add weakref to new (outer) handle into parents ChildHandles array */ tmp_svp = hv_fetchs((HV*)SvRV(parent), "ChildHandles", 1); if (!SvROK(*tmp_svp)) { SV *ChildHandles_rvav = newRV_noinc((SV*)newAV()); sv_setsv(*tmp_svp, ChildHandles_rvav); sv_free(ChildHandles_rvav); } av = (AV*)SvRV(*tmp_svp); av_push(av, (SV*)sv_rvweaken(newRV_inc((SV*)SvRV(orv)))); if (av_len(av) % 120 == 0) { /* time to do some housekeeping to remove dead handles */ I32 i = av_len(av); /* 0 = 1 element */ while (i-- >= 0) { SV *sv = av_shift(av); if (SvOK(sv)) av_push(av, sv); else sv_free(sv); /* keep it leak-free by Doru Petrescu pdoru.dbi@from.ro */ } } } #endif } else { DBIc_LongReadLen(imp) = DBIc_LongReadLen_init; } switch (DBIc_TYPE(imp)) { case DBIt_DB: /* cache _inner_ handle, but also see quick_FETCH */ (void)hv_stores((HV*)SvRV(h), "Driver", newRV_inc(SvRV(parent))); (void)hv_fetchs((HV*)SvRV(h), "Statement", 1); /* store writable undef */ break; case DBIt_ST: DBIc_NUM_FIELDS((imp_sth_t*)imp) = -1; /* cache _inner_ handle, but also see quick_FETCH */ (void)hv_stores((HV*)SvRV(h), "Database", newRV_inc(SvRV(parent))); /* copy (alias) Statement from the sth up into the dbh */ tmp_svp = hv_fetchs((HV*)SvRV(h), "Statement", 1); (void)hv_stores((HV*)SvRV(parent), "Statement", SvREFCNT_inc(*tmp_svp)); break; } } else die("panic: invalid DBIc_TYPE"); /* Use DBI magic on inner handle to carry handle attributes */ /* Note that we store the imp_sv in mg_obj, but as a shortcut, */ /* also store a direct pointer to imp, aka PVX(dbih_imp_sv), */ /* in mg_ptr (with mg_len set to null, so it wont be freed) */ sv_magic(SvRV(h), dbih_imp_sv, DBI_MAGIC, (char*)imp, 0); SvREFCNT_dec(dbih_imp_sv); /* since sv_magic() incremented it */ SvRMAGICAL_on(SvRV(h)); /* so DBI magic gets sv_clear'd ok */ { dMY_CXT; /* XXX would be nice to get rid of this */ DBI_SET_LAST_HANDLE(h); } if (1) { /* This is a hack to work-around the fast but poor way old versions of * DBD::Oracle (and possibly other drivers) check for a valid handle * using (SvMAGIC(SvRV(h)))->mg_type == 'P'). That doesn't work now * because the weakref magic is inserted ahead of the tie magic. * So here we swap the tie and weakref magic so the tie comes first. */ MAGIC *tie_mg = mg_find(SvRV(orv),'P'); MAGIC *first = SvMAGIC(SvRV(orv)); if (tie_mg && first->mg_moremagic == tie_mg && !tie_mg->mg_moremagic) { MAGIC *next = tie_mg->mg_moremagic; SvMAGIC(SvRV(orv)) = tie_mg; tie_mg->mg_moremagic = first; first->mg_moremagic = next; } } DBI_UNLOCK; } static void dbih_dumphandle(pTHX_ SV *h, const char *msg, int level) { D_imp_xxh(h); if (level >= 9) { sv_dump(h); } dbih_dumpcom(aTHX_ imp_xxh, msg, level); } static int dbih_dumpcom(pTHX_ imp_xxh_t *imp_xxh, const char *msg, int level) { dMY_CXT; SV *flags = sv_2mortal(newSVpvs("")); SV *inner; static const char pad[] = " "; if (!msg) msg = "dbih_dumpcom"; PerlIO_printf(DBILOGFP," %s (%sh 0x%lx, com 0x%lx, imp %s):\n", msg, dbih_htype_name(DBIc_TYPE(imp_xxh)), (long)DBIc_MY_H(imp_xxh), (long)imp_xxh, (PL_dirty) ? "global destruction" : HvNAME(DBIc_IMP_STASH(imp_xxh))); if (DBIc_COMSET(imp_xxh)) sv_catpv(flags,"COMSET "); if (DBIc_IMPSET(imp_xxh)) sv_catpv(flags,"IMPSET "); if (DBIc_ACTIVE(imp_xxh)) sv_catpv(flags,"Active "); if (DBIc_WARN(imp_xxh)) sv_catpv(flags,"Warn "); if (DBIc_COMPAT(imp_xxh)) sv_catpv(flags,"CompatMode "); if (DBIc_is(imp_xxh, DBIcf_ChopBlanks)) sv_catpv(flags,"ChopBlanks "); if (DBIc_is(imp_xxh, DBIcf_HandleSetErr)) sv_catpv(flags,"HandleSetErr "); if (DBIc_is(imp_xxh, DBIcf_HandleError)) sv_catpv(flags,"HandleError "); if (DBIc_is(imp_xxh, DBIcf_RaiseError)) sv_catpv(flags,"RaiseError "); if (DBIc_is(imp_xxh, DBIcf_PrintError)) sv_catpv(flags,"PrintError "); if (DBIc_is(imp_xxh, DBIcf_RaiseWarn)) sv_catpv(flags,"RaiseWarn "); if (DBIc_is(imp_xxh, DBIcf_PrintWarn)) sv_catpv(flags,"PrintWarn "); if (DBIc_is(imp_xxh, DBIcf_ShowErrorStatement)) sv_catpv(flags,"ShowErrorStatement "); if (DBIc_is(imp_xxh, DBIcf_AutoCommit)) sv_catpv(flags,"AutoCommit "); if (DBIc_is(imp_xxh, DBIcf_BegunWork)) sv_catpv(flags,"BegunWork "); if (DBIc_is(imp_xxh, DBIcf_LongTruncOk)) sv_catpv(flags,"LongTruncOk "); if (DBIc_is(imp_xxh, DBIcf_MultiThread)) sv_catpv(flags,"MultiThread "); if (DBIc_is(imp_xxh, DBIcf_TaintIn)) sv_catpv(flags,"TaintIn "); if (DBIc_is(imp_xxh, DBIcf_TaintOut)) sv_catpv(flags,"TaintOut "); if (DBIc_is(imp_xxh, DBIcf_Profile)) sv_catpv(flags,"Profile "); if (DBIc_is(imp_xxh, DBIcf_Callbacks)) sv_catpv(flags,"Callbacks "); PerlIO_printf(DBILOGFP,"%s FLAGS 0x%lx: %s\n", pad, (long)DBIc_FLAGS(imp_xxh), SvPV_nolen(flags)); if (SvOK(DBIc_ERR(imp_xxh))) PerlIO_printf(DBILOGFP,"%s ERR %s\n", pad, neatsvpv((SV*)DBIc_ERR(imp_xxh),0)); if (SvOK(DBIc_ERR(imp_xxh))) PerlIO_printf(DBILOGFP,"%s ERRSTR %s\n", pad, neatsvpv((SV*)DBIc_ERRSTR(imp_xxh),0)); PerlIO_printf(DBILOGFP,"%s PARENT %s\n", pad, neatsvpv((SV*)DBIc_PARENT_H(imp_xxh),0)); PerlIO_printf(DBILOGFP,"%s KIDS %ld (%ld Active)\n", pad, (long)DBIc_KIDS(imp_xxh), (long)DBIc_ACTIVE_KIDS(imp_xxh)); if (DBIc_IMP_DATA(imp_xxh) && SvOK(DBIc_IMP_DATA(imp_xxh))) PerlIO_printf(DBILOGFP,"%s IMP_DATA %s\n", pad, neatsvpv(DBIc_IMP_DATA(imp_xxh),0)); if (DBIc_LongReadLen(imp_xxh) != DBIc_LongReadLen_init) PerlIO_printf(DBILOGFP,"%s LongReadLen %ld\n", pad, (long)DBIc_LongReadLen(imp_xxh)); if (DBIc_TYPE(imp_xxh) == DBIt_ST) { const imp_sth_t *imp_sth = (imp_sth_t*)imp_xxh; PerlIO_printf(DBILOGFP,"%s NUM_OF_FIELDS %d\n", pad, DBIc_NUM_FIELDS(imp_sth)); PerlIO_printf(DBILOGFP,"%s NUM_OF_PARAMS %d\n", pad, DBIc_NUM_PARAMS(imp_sth)); } inner = dbih_inner(aTHX_ (SV*)DBIc_MY_H(imp_xxh), msg); if (!inner || !SvROK(inner)) return 1; if (DBIc_TYPE(imp_xxh) <= DBIt_DB) { SV **svp = hv_fetchs((HV*)SvRV(inner), "CachedKids", 0); if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { HV *hv = (HV*)SvRV(*svp); PerlIO_printf(DBILOGFP,"%s CachedKids %d\n", pad, (int)HvKEYS(hv)); } } if (level > 0) { SV* value; char *key; I32 keylen; PerlIO_printf(DBILOGFP,"%s cached attributes:\n", pad); while ( (value = hv_iternextsv((HV*)SvRV(inner), &key, &keylen)) ) { PerlIO_printf(DBILOGFP,"%s '%s' => %s\n", pad, key, neatsvpv(value,0)); } } else if (DBIc_TYPE(imp_xxh) == DBIt_DB) { SV **svp = hv_fetchs((HV*)SvRV(inner), "Name", 0); if (svp && SvOK(*svp)) PerlIO_printf(DBILOGFP,"%s Name %s\n", pad, neatsvpv(*svp,0)); } else if (DBIc_TYPE(imp_xxh) == DBIt_ST) { SV **svp = hv_fetchs((HV*)SvRV(inner), "Statement", 0); if (svp && SvOK(*svp)) PerlIO_printf(DBILOGFP,"%s Statement %s\n", pad, neatsvpv(*svp,0)); } return 1; } static void dbih_clearcom(imp_xxh_t *imp_xxh) { dTHX; dTHR; int dump = FALSE; int debug = DBIc_TRACE_LEVEL(imp_xxh); int auto_dump = (debug >= 6); imp_xxh_t * const parent_xxh = DBIc_PARENT_COM(imp_xxh); /* Note that we're very much on our own here. DBIc_MY_H(imp_xxh) almost */ /* certainly points to memory which has been freed. Don't use it! */ /* --- pre-clearing sanity checks --- */ #ifdef DBI_USE_THREADS if (DBIc_THR_USER(imp_xxh) != my_perl) { /* don't clear handle that belongs to another thread */ if (debug >= 3) { PerlIO_printf(DBIc_LOGPIO(imp_xxh)," skipped dbih_clearcom: DBI handle (type=%d, %s) is owned by thread %p not current thread %p\n", DBIc_TYPE(imp_xxh), HvNAME(DBIc_IMP_STASH(imp_xxh)), (void*)DBIc_THR_USER(imp_xxh), (void*)my_perl) ; PerlIO_flush(DBIc_LOGPIO(imp_xxh)); } return; } #endif if (!DBIc_COMSET(imp_xxh)) { /* should never happen */ dbih_dumpcom(aTHX_ imp_xxh, "dbih_clearcom: DBI handle already cleared", 0); return; } if (auto_dump) dbih_dumpcom(aTHX_ imp_xxh,"DESTROY (dbih_clearcom)", 0); if (!PL_dirty) { if (DBIc_ACTIVE(imp_xxh)) { /* bad news, potentially */ /* warn for sth, warn for dbh only if it has active sth or isn't AutoCommit */ if (DBIc_TYPE(imp_xxh) >= DBIt_ST || (DBIc_ACTIVE_KIDS(imp_xxh) || !DBIc_has(imp_xxh, DBIcf_AutoCommit)) ) { warn("DBI %s handle 0x%lx cleared whilst still active", dbih_htype_name(DBIc_TYPE(imp_xxh)), (unsigned long)DBIc_MY_H(imp_xxh)); dump = TRUE; } } /* check that the implementor has done its own housekeeping */ if (DBIc_IMPSET(imp_xxh)) { warn("DBI %s handle 0x%lx has uncleared implementors data", dbih_htype_name(DBIc_TYPE(imp_xxh)), (unsigned long)DBIc_MY_H(imp_xxh)); dump = TRUE; } if (DBIc_KIDS(imp_xxh)) { warn("DBI %s handle 0x%lx has %d uncleared child handles", dbih_htype_name(DBIc_TYPE(imp_xxh)), (unsigned long)DBIc_MY_H(imp_xxh), (int)DBIc_KIDS(imp_xxh)); dump = TRUE; } } if (dump && !auto_dump) /* else was already dumped above */ dbih_dumpcom(aTHX_ imp_xxh, "dbih_clearcom", 0); /* --- pre-clearing adjustments --- */ if (!PL_dirty) { if (parent_xxh) { if (DBIc_ACTIVE(imp_xxh)) /* see also DBIc_ACTIVE_off */ --DBIc_ACTIVE_KIDS(parent_xxh); --DBIc_KIDS(parent_xxh); } } /* --- clear fields (may invoke object destructors) --- */ if (DBIc_TYPE(imp_xxh) == DBIt_ST) { imp_sth_t *imp_sth = (imp_sth_t*)imp_xxh; sv_free((SV*)DBIc_FIELDS_AV(imp_sth)); } sv_free(DBIc_IMP_DATA(imp_xxh)); /* do this first */ if (DBIc_TYPE(imp_xxh) <= DBIt_ST) { /* DBIt_FD doesn't have attr */ sv_free(_imp2com(imp_xxh, attr.TraceLevel)); sv_free(_imp2com(imp_xxh, attr.State)); sv_free(_imp2com(imp_xxh, attr.Err)); sv_free(_imp2com(imp_xxh, attr.Errstr)); sv_free(_imp2com(imp_xxh, attr.FetchHashKeyName)); } sv_free((SV*)DBIc_PARENT_H(imp_xxh)); /* do this last */ DBIc_COMSET_off(imp_xxh); if (debug >= 4) PerlIO_printf(DBIc_LOGPIO(imp_xxh)," dbih_clearcom 0x%lx (com 0x%lx, type %d) done.\n\n", (long)DBIc_MY_H(imp_xxh), (long)imp_xxh, DBIc_TYPE(imp_xxh)); } /* --- Functions for handling field buffer arrays --- */ static AV * dbih_setup_fbav(imp_sth_t *imp_sth) { /* Usually called to setup the row buffer for new sth. * Also called if the value of NUM_OF_FIELDS is altered, * in which case it adjusts the row buffer to match NUM_OF_FIELDS. */ dTHX; I32 i = DBIc_NUM_FIELDS(imp_sth); AV *av = DBIc_FIELDS_AV(imp_sth); if (i < 0) i = 0; if (av) { if (av_len(av)+1 == i) /* is existing array the right size? */ return av; /* we need to adjust the size of the array */ if (DBIc_TRACE_LEVEL(imp_sth) >= 2) PerlIO_printf(DBIc_LOGPIO(imp_sth)," dbih_setup_fbav realloc from %ld to %ld fields\n", (long)(av_len(av)+1), (long)i); SvREADONLY_off(av); if (i < av_len(av)+1) /* trim to size if too big */ av_fill(av, i-1); } else { if (DBIc_TRACE_LEVEL(imp_sth) >= 5) PerlIO_printf(DBIc_LOGPIO(imp_sth)," dbih_setup_fbav alloc for %ld fields\n", (long)i); av = newAV(); DBIc_FIELDS_AV(imp_sth) = av; /* row_count will need to be manually reset by the driver if the */ /* sth is re-executed (since this code won't get rerun) */ DBIc_ROW_COUNT(imp_sth) = 0; } /* load array with writeable SV's. Do this backwards so */ /* the array only gets extended once. */ while(i--) /* field 1 stored at index 0 */ av_store(av, i, newSV(0)); if (DBIc_TRACE_LEVEL(imp_sth) >= 6) PerlIO_printf(DBIc_LOGPIO(imp_sth)," dbih_setup_fbav now %ld fields\n", (long)(av_len(av)+1)); SvREADONLY_on(av); /* protect against shift @$row etc */ return av; } static AV * dbih_get_fbav(imp_sth_t *imp_sth) { AV *av; if ( (av = DBIc_FIELDS_AV(imp_sth)) == Nullav) { av = dbih_setup_fbav(imp_sth); } else { dTHX; int i = av_len(av) + 1; if (i != DBIc_NUM_FIELDS(imp_sth)) { /*SV *sth = dbih_inner(aTHX_ (SV*)DBIc_MY_H(imp_sth), "_get_fbav");*/ /* warn via PrintWarn */ set_err_char(SvRV(DBIc_MY_H(imp_sth)), (imp_xxh_t*)imp_sth, "0", 0, "Number of row fields inconsistent with NUM_OF_FIELDS (driver bug)", "", "_get_fbav"); /* DBIc_NUM_FIELDS(imp_sth) = i; hv_deletes((HV*)SvRV(sth), "NUM_OF_FIELDS", G_DISCARD); */ } /* don't let SvUTF8 flag persist from one row to the next */ /* (only affects drivers that use sv_setpv, but most XS do) */ /* XXX turn into option later (force on/force off/ignore) */ while(i--) /* field 1 stored at index 0 */ SvUTF8_off(AvARRAY(av)[i]); } if (DBIc_is(imp_sth, DBIcf_TaintOut)) { dTHX; dTHR; TAINT; /* affects sv_setsv()'s called within same perl statement */ } /* XXX fancy stuff to happen here later (re scrolling etc) */ ++DBIc_ROW_COUNT(imp_sth); return av; } static int dbih_sth_bind_col(SV *sth, SV *col, SV *ref, SV *attribs) { dTHX; D_imp_sth(sth); AV *av; int idx = SvIV(col); int fields = DBIc_NUM_FIELDS(imp_sth); if (fields <= 0) { PERL_UNUSED_VAR(attribs); croak("Statement has no result columns to bind%s", DBIc_ACTIVE(imp_sth) ? "" : " (perhaps you need to successfully call execute first, or again)"); } if ( (av = DBIc_FIELDS_AV(imp_sth)) == Nullav) av = dbih_setup_fbav(imp_sth); if (DBIc_TRACE_LEVEL(imp_sth) >= 5) PerlIO_printf(DBIc_LOGPIO(imp_sth)," dbih_sth_bind_col %s => %s %s\n", neatsvpv(col,0), neatsvpv(ref,0), neatsvpv(attribs,0)); if (idx < 1 || idx > fields) croak("bind_col: column %d is not a valid column (1..%d)", idx, fields); if (!SvOK(ref) && SvREADONLY(ref)) { /* binding to literal undef */ /* presumably the call is just setting the TYPE or other atribs */ /* but this default method ignores attribs, so we just return */ return 1; } /* Write this as > SVt_PVMG because in 5.8.x the next type */ /* is SVt_PVBM, whereas in 5.9.x it's SVt_PVGV. */ if (!SvROK(ref) || SvTYPE(SvRV(ref)) > SVt_PVMG) /* XXX LV */ croak("Can't %s->bind_col(%s, %s,...), need a reference to a scalar", neatsvpv(sth,0), neatsvpv(col,0), neatsvpv(ref,0)); /* use supplied scalar as storage for this column */ SvREADONLY_off(av); av_store(av, idx-1, SvREFCNT_inc(SvRV(ref)) ); SvREADONLY_on(av); return 1; } static int quote_type(int sql_type, int p, int s, int *t, void *v) { /* Returns true if type should be bound as a number else */ /* false implying that binding as a string should be okay. */ /* The true value is either SQL_INTEGER or SQL_DOUBLE which */ /* can be used as a hint if desired. */ (void)p; (void)s; (void)t; (void)v; /* looks like it's never been used, and doesn't make much sense anyway */ warn("Use of DBI internal bind_as_num/quote_type function is deprecated"); switch(sql_type) { case SQL_INTEGER: case SQL_SMALLINT: case SQL_TINYINT: case SQL_BIGINT: return 0; case SQL_FLOAT: case SQL_REAL: case SQL_DOUBLE: return 0; case SQL_NUMERIC: case SQL_DECIMAL: return 0; /* bind as string to attempt to retain precision */ } return 1; } /* Convert a simple string representation of a value into a more specific * perl type based on an sql_type value. * The semantics of SQL standard TYPE values are interpreted _very_ loosely * on the basis of "be liberal in what you accept and let's throw in some * extra semantics while we're here" :) * Returns: * -2: sql_type isn't handled, value unchanged * -1: sv is undef, value unchanged * 0: sv couldn't be cast cleanly and DBIstcf_STRICT was used * 1: sv couldn't be cast cleanly and DBIstcf_STRICT was not used * 2: sv was cast ok */ int sql_type_cast_svpv(pTHX_ SV *sv, int sql_type, U32 flags, PERL_UNUSED_DECL void *v) { int cast_ok = 0; int grok_flags; UV uv; /* do nothing for undef (NULL) or non-string values */ if (!sv || !SvOK(sv)) return -1; switch(sql_type) { default: return -2; /* not a recognised SQL TYPE, value unchanged */ case SQL_INTEGER: /* sv_2iv is liberal, may return SvIV, SvUV, or SvNV */ sv_2iv(sv); /* SvNOK will be set if value is out of range for IV/UV. * SvIOK should be set but won't if sv is not numeric (in which * case perl would have warn'd already if -w or warnings are in effect) */ cast_ok = (SvIOK(sv) && !SvNOK(sv)); break; case SQL_DOUBLE: sv_2nv(sv); /* SvNOK should be set but won't if sv is not numeric (in which * case perl would have warn'd already if -w or warnings are in effect) */ cast_ok = SvNOK(sv); break; /* caller would like IV else UV else NV */ /* else no error and sv is untouched */ case SQL_NUMERIC: /* based on the code in perl's toke.c */ uv = 0; grok_flags = grok_number(SvPVX(sv), SvCUR(sv), &uv); cast_ok = 1; if (grok_flags == IS_NUMBER_IN_UV) { /* +ve int */ if (uv <= IV_MAX) /* prefer IV over UV */ sv_2iv(sv); else sv_2uv(sv); } else if (grok_flags == (IS_NUMBER_IN_UV | IS_NUMBER_NEG) && uv <= IV_MAX ) { sv_2iv(sv); } else if (grok_flags) { /* is numeric */ sv_2nv(sv); } else cast_ok = 0; break; #if 0 /* XXX future possibilities */ case SQL_BIGINT: /* use Math::BigInt if too large for IV/UV */ #endif } if (cast_ok) { if (flags & DBIstcf_DISCARD_STRING && SvNIOK(sv) /* we set a numeric value */ && SvPVX(sv) /* we have a buffer to discard */ ) { SvOOK_off(sv); sv_force_normal(sv); if (SvLEN(sv)) Safefree(SvPVX(sv)); SvPOK_off(sv); SvPV_set(sv, NULL); SvLEN_set(sv, 0); SvCUR_set(sv, 0); } } if (cast_ok) return 2; else if (flags & DBIstcf_STRICT) return 0; else return 1; } /* --- Generic Handle Attributes (for all handle types) --- */ static int dbih_set_attr_k(SV *h, SV *keysv, int dbikey, SV *valuesv) { dTHX; dTHR; D_imp_xxh(h); STRLEN keylen; const char *key = SvPV(keysv, keylen); const int htype = DBIc_TYPE(imp_xxh); int on = (SvTRUE(valuesv)); int internal = 1; /* DBIh_IN_PERL_DBD(imp_xxh); -- for DBD's in perl */ int cacheit = 0; int weakenit = 0; /* eg for CachedKids ref */ (void)dbikey; if (DBIc_TRACE_LEVEL(imp_xxh) >= 3) PerlIO_printf(DBIc_LOGPIO(imp_xxh)," STORE %s %s => %s\n", neatsvpv(h,0), neatsvpv(keysv,0), neatsvpv(valuesv,0)); if (internal && strEQ(key, "Active")) { if (on) { D_imp_sth(h); DBIc_ACTIVE_on(imp_xxh); /* for pure-perl drivers on second and subsequent */ /* execute()'s, else row count keeps rising. */ if (htype==DBIt_ST && DBIc_FIELDS_AV(imp_sth)) DBIc_ROW_COUNT(imp_sth) = 0; } else { DBIc_ACTIVE_off(imp_xxh); } } else if (strEQ(key, "FetchHashKeyName")) { if (htype >= DBIt_ST) croak("Can't set FetchHashKeyName for a statement handle, set in parent before prepare()"); cacheit = 1; /* just save it */ } else if (strEQ(key, "CompatMode")) { (on) ? DBIc_COMPAT_on(imp_xxh) : DBIc_COMPAT_off(imp_xxh); } else if (strEQ(key, "Warn")) { (on) ? DBIc_WARN_on(imp_xxh) : DBIc_WARN_off(imp_xxh); } else if (strEQ(key, "AutoInactiveDestroy")) { (on) ? DBIc_AIADESTROY_on(imp_xxh) : DBIc_AIADESTROY_off(imp_xxh); } else if (strEQ(key, "InactiveDestroy")) { (on) ? DBIc_IADESTROY_on(imp_xxh) : DBIc_IADESTROY_off(imp_xxh); } else if (strEQ(key, "RootClass")) { cacheit = 1; /* just save it */ } else if (strEQ(key, "RowCacheSize")) { cacheit = 0; /* ignore it */ } else if (strEQ(key, "Executed")) { DBIc_set(imp_xxh, DBIcf_Executed, on); } else if (strEQ(key, "ChopBlanks")) { DBIc_set(imp_xxh, DBIcf_ChopBlanks, on); } else if (strEQ(key, "ErrCount")) { DBIc_ErrCount(imp_xxh) = SvUV(valuesv); } else if (strEQ(key, "LongReadLen")) { if (SvNV(valuesv) < 0 || SvNV(valuesv) > MAX_LongReadLen) croak("Can't set LongReadLen < 0 or > %ld",MAX_LongReadLen); DBIc_LongReadLen(imp_xxh) = SvIV(valuesv); cacheit = 1; /* save it for clone */ } else if (strEQ(key, "LongTruncOk")) { DBIc_set(imp_xxh,DBIcf_LongTruncOk, on); } else if (strEQ(key, "RaiseError")) { DBIc_set(imp_xxh,DBIcf_RaiseError, on); } else if (strEQ(key, "PrintError")) { DBIc_set(imp_xxh,DBIcf_PrintError, on); } else if (strEQ(key, "RaiseWarn")) { DBIc_set(imp_xxh,DBIcf_RaiseWarn, on); } else if (strEQ(key, "PrintWarn")) { DBIc_set(imp_xxh,DBIcf_PrintWarn, on); } else if (strEQ(key, "HandleError")) { if ( on && (!SvROK(valuesv) || (SvTYPE(SvRV(valuesv)) != SVt_PVCV)) ) { croak("Can't set %s to '%s'", "HandleError", neatsvpv(valuesv,0)); } DBIc_set(imp_xxh,DBIcf_HandleError, on); cacheit = 1; /* child copy setup by dbih_setup_handle() */ } else if (strEQ(key, "HandleSetErr")) { if ( on && (!SvROK(valuesv) || (SvTYPE(SvRV(valuesv)) != SVt_PVCV)) ) { croak("Can't set %s to '%s'","HandleSetErr",neatsvpv(valuesv,0)); } DBIc_set(imp_xxh,DBIcf_HandleSetErr, on); cacheit = 1; /* child copy setup by dbih_setup_handle() */ } else if (strEQ(key, "ChildHandles")) { if ( on && (!SvROK(valuesv) || (SvTYPE(SvRV(valuesv)) != SVt_PVAV)) ) { croak("Can't set %s to '%s'", "ChildHandles", neatsvpv(valuesv,0)); } cacheit = 1; /* just save it in the hash */ } else if (strEQ(key, "Profile")) { static const char profile_class[] = "DBI::Profile"; if (on && (!SvROK(valuesv) || (SvTYPE(SvRV(valuesv)) != SVt_PVHV)) ) { /* not a hash ref so use DBI::Profile to work out what to do */ dTHR; dSP; I32 returns; TAINT_NOT; /* the require is presumed innocent till proven guilty */ require_pv("DBI/Profile.pm"); if (SvTRUE(ERRSV)) { warn("Can't load %s: %s", profile_class, SvPV_nolen(ERRSV)); valuesv = &PL_sv_undef; } else { PUSHMARK(SP); mXPUSHs(newSVpv(profile_class, 0)); XPUSHs(valuesv); PUTBACK; returns = call_method("_auto_new", G_SCALAR); if (returns != 1) croak("%s _auto_new", profile_class); SPAGAIN; valuesv = POPs; PUTBACK; } on = SvTRUE(valuesv); /* in case it returns undef */ } if (on && !sv_isobject(valuesv)) { /* not blessed already - so default to DBI::Profile */ HV *stash; require_pv(profile_class); stash = gv_stashpv(profile_class, GV_ADDWARN); sv_bless(valuesv, stash); } DBIc_set(imp_xxh,DBIcf_Profile, on); cacheit = 1; /* child copy setup by dbih_setup_handle() */ } else if (strEQ(key, "ShowErrorStatement")) { DBIc_set(imp_xxh,DBIcf_ShowErrorStatement, on); } else if (strEQ(key, "MultiThread") && internal) { /* here to allow pure-perl drivers to set MultiThread */ DBIc_set(imp_xxh,DBIcf_MultiThread, on); if (on && DBIc_WARN(imp_xxh)) { warn("MultiThread support not yet implemented in DBI"); } } else if (strEQ(key, "Taint")) { /* 'Taint' is a shortcut for both in and out mode */ DBIc_set(imp_xxh,DBIcf_TaintIn|DBIcf_TaintOut, on); } else if (strEQ(key, "TaintIn")) { DBIc_set(imp_xxh,DBIcf_TaintIn, on); } else if (strEQ(key, "TaintOut")) { DBIc_set(imp_xxh,DBIcf_TaintOut, on); } else if (htype<=DBIt_DB && keylen==10 && strEQ(key, "CachedKids") /* only allow hash refs */ && SvROK(valuesv) && SvTYPE(SvRV(valuesv))==SVt_PVHV ) { cacheit = 1; weakenit = 1; } else if (keylen==9 && strEQ(key, "Callbacks")) { if ( on && (!SvROK(valuesv) || (SvTYPE(SvRV(valuesv)) != SVt_PVHV)) ) croak("Can't set Callbacks to '%s'",neatsvpv(valuesv,0)); /* see also dbih_setup_handle for ChildCallbacks handling */ DBIc_set(imp_xxh, DBIcf_Callbacks, on); cacheit = 1; } else if (htype<=DBIt_DB && keylen==10 && strEQ(key, "AutoCommit")) { /* driver should have intercepted this and either handled it */ /* or set valuesv to either the 'magic' on or off value. */ if (SvIV(valuesv) != -900 && SvIV(valuesv) != -901) croak("DBD driver has not implemented the AutoCommit attribute"); DBIc_set(imp_xxh,DBIcf_AutoCommit, (SvIV(valuesv)==-901)); } else if (htype==DBIt_DB && keylen==9 && strEQ(key, "BegunWork")) { DBIc_set(imp_xxh,DBIcf_BegunWork, on); } else if (keylen==10 && strEQ(key, "TraceLevel")) { set_trace(h, valuesv, Nullsv); } else if (keylen==9 && strEQ(key, "TraceFile")) { /* XXX undocumented and readonly */ set_trace_file(valuesv); } else if (htype==DBIt_ST && strEQ(key, "NUM_OF_FIELDS")) { D_imp_sth(h); int new_num_fields = (SvOK(valuesv)) ? SvIV(valuesv) : -1; DBIc_NUM_FIELDS(imp_sth) = new_num_fields; if (DBIc_FIELDS_AV(imp_sth)) { /* modify existing fbav */ dbih_setup_fbav(imp_sth); } cacheit = 1; } else if (htype==DBIt_ST && strEQ(key, "NUM_OF_PARAMS")) { D_imp_sth(h); DBIc_NUM_PARAMS(imp_sth) = SvIV(valuesv); cacheit = 1; } /* these are here due to clone() needing to set attribs through a public api */ else if (htype<=DBIt_DB && (strEQ(key, "Name") || strEQ(key,"ImplementorClass") || strEQ(key,"ReadOnly") || strEQ(key,"Statement") || strEQ(key,"Username") /* these are here for backwards histerical raisons */ || strEQ(key,"USER") || strEQ(key,"CURRENT_USER") ) ) { cacheit = 1; } /* deal with: NAME_(uc|lc), NAME_hash, NAME_(uc|lc)_hash */ else if ((keylen==7 || keylen==9 || keylen==12) && strnEQ(key, "NAME_", 5) && ( (keylen==9 && strEQ(key, "NAME_hash")) || ((key[5]=='u' || key[5]=='l') && key[6] == 'c' && (!key[7] || strnEQ(&key[7], "_hash", 5))) ) ) { cacheit = 1; } else { /* XXX should really be an event ? */ if (isUPPER(*key)) { char *msg = "Can't set %s->{%s}: unrecognised attribute name or invalid value%s"; char *hint = ""; if (strEQ(key, "NUM_FIELDS")) hint = ", perhaps you meant NUM_OF_FIELDS"; warn(msg, neatsvpv(h,0), key, hint); return FALSE; /* don't store it */ } /* Allow private_* attributes to be stored in the cache. */ /* This is designed to make life easier for people subclassing */ /* the DBI classes and may be of use to simple perl DBD's. */ if (strnNE(key,"private_",8) && strnNE(key,"dbd_",4) && strnNE(key,"dbi_",4)) { if (DBIc_TRACE_LEVEL(imp_xxh)) { /* change to DBIc_WARN(imp_xxh) once we can validate prefix against registry */ PerlIO_printf(DBIc_LOGPIO(imp_xxh),"$h->{%s}=%s ignored for invalid driver-specific attribute\n", neatsvpv(keysv,0), neatsvpv(valuesv,0)); } return FALSE; } cacheit = 1; } if (cacheit) { SV *sv_for_cache = newSVsv(valuesv); (void)hv_store((HV*)SvRV(h), key, keylen, sv_for_cache, 0); if (weakenit) { #ifdef sv_rvweaken sv_rvweaken(sv_for_cache); #endif } } return TRUE; } static SV * dbih_get_attr_k(SV *h, SV *keysv, int dbikey) { dTHX; dTHR; D_imp_xxh(h); STRLEN keylen; char *key = SvPV(keysv, keylen); int htype = DBIc_TYPE(imp_xxh); SV *valuesv = Nullsv; int cacheit = FALSE; char *p; int i; SV *sv; SV **svp; (void)dbikey; /* DBI quick_FETCH will service some requests (e.g., cached values) */ if (htype == DBIt_ST) { switch (*key) { case 'D': if (keylen==8 && strEQ(key, "Database")) { D_imp_from_child(imp_dbh, imp_dbh_t, imp_xxh); valuesv = newRV_inc((SV*)DBIc_MY_H(imp_dbh)); cacheit = FALSE; /* else creates ref loop */ } break; case 'N': if (keylen==8 && strEQ(key, "NULLABLE")) { valuesv = &PL_sv_undef; break; } if (keylen==4 && strEQ(key, "NAME")) { valuesv = &PL_sv_undef; break; } /* deal with: NAME_(uc|lc), NAME_hash, NAME_(uc|lc)_hash */ if ((keylen==7 || keylen==9 || keylen==12) && strnEQ(key, "NAME_", 5) && ( (keylen==9 && strEQ(key, "NAME_hash")) || ((key[5]=='u' || key[5]=='l') && key[6] == 'c' && (!key[7] || strnEQ(&key[7], "_hash", 5))) ) ) { D_imp_sth(h); valuesv = &PL_sv_undef; /* fetch from tied outer handle to trigger FETCH magic */ svp = hv_fetchs((HV*)DBIc_MY_H(imp_sth), "NAME", FALSE); sv = (svp) ? *svp : &PL_sv_undef; if (SvGMAGICAL(sv)) /* call FETCH via magic */ mg_get(sv); if (SvROK(sv)) { AV *name_av = (AV*)SvRV(sv); char *name; int upcase = (key[5] == 'u'); AV *av = Nullav; HV *hv = Nullhv; int num_fields_mismatch = 0; if (strEQ(&key[strlen(key)-5], "_hash")) hv = newHV(); else av = newAV(); i = DBIc_NUM_FIELDS(imp_sth); /* catch invalid NUM_FIELDS */ if (i != AvFILL(name_av)+1) { /* flag as mismatch, except for "-1 and empty" case */ if ( ! (i == -1 && 0 == AvFILL(name_av)+1) ) num_fields_mismatch = 1; i = AvFILL(name_av)+1; /* limit for safe iteration over array */ } if (DBIc_TRACE_LEVEL(imp_sth) >= 10 || (num_fields_mismatch && DBIc_WARN(imp_xxh))) { PerlIO_printf(DBIc_LOGPIO(imp_sth)," FETCH $h->{%s} from $h->{NAME} with $h->{NUM_OF_FIELDS} = %d" " and %ld entries in $h->{NAME}%s\n", neatsvpv(keysv,0), DBIc_NUM_FIELDS(imp_sth), AvFILL(name_av)+1, (num_fields_mismatch) ? " (possible bug in driver)" : ""); } while (--i >= 0) { sv = newSVsv(AvARRAY(name_av)[i]); name = SvPV_nolen(sv); if (key[5] != 'h') { /* "NAME_hash" */ for (p = name; p && *p; ++p) { #ifdef toUPPER_LC *p = (upcase) ? toUPPER_LC(*p) : toLOWER_LC(*p); #else *p = (upcase) ? toUPPER(*p) : toLOWER(*p); #endif } } if (av) av_store(av, i, sv); else { (void)hv_store(hv, name, SvCUR(sv), newSViv(i), 0); sv_free(sv); } } valuesv = newRV_noinc( (av ? (SV*)av : (SV*)hv) ); cacheit = TRUE; /* can't change */ } } else if (keylen==13 && strEQ(key, "NUM_OF_FIELDS")) { D_imp_sth(h); IV num_fields = DBIc_NUM_FIELDS(imp_sth); valuesv = (num_fields < 0) ? &PL_sv_undef : newSViv(num_fields); if (num_fields > 0) cacheit = TRUE; /* can't change once set (XXX except for multiple result sets) */ } else if (keylen==13 && strEQ(key, "NUM_OF_PARAMS")) { D_imp_sth(h); valuesv = newSViv(DBIc_NUM_PARAMS(imp_sth)); cacheit = TRUE; /* can't change */ } break; case 'P': if (strEQ(key, "PRECISION")) valuesv = &PL_sv_undef; else if (strEQ(key, "ParamValues")) valuesv = &PL_sv_undef; else if (strEQ(key, "ParamTypes")) valuesv = &PL_sv_undef; break; case 'R': if (strEQ(key, "RowsInCache")) valuesv = &PL_sv_undef; break; case 'S': if (strEQ(key, "SCALE")) valuesv = &PL_sv_undef; break; case 'T': if (strEQ(key, "TYPE")) valuesv = &PL_sv_undef; break; } } else if (htype == DBIt_DB) { /* this is here but is, sadly, not called because * not-preloading them into the handle attrib cache caused * wierdness in t/proxy.t that I never got to the bottom * of. One day maybe. */ if (keylen==6 && strEQ(key, "Driver")) { D_imp_from_child(imp_dbh, imp_dbh_t, imp_xxh); valuesv = newRV_inc((SV*)DBIc_MY_H(imp_dbh)); cacheit = FALSE; /* else creates ref loop */ } } if (valuesv == Nullsv && htype <= DBIt_DB) { if (keylen==10 && strEQ(key, "AutoCommit")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_AutoCommit)); } } if (valuesv == Nullsv) { switch (*key) { case 'A': if (keylen==6 && strEQ(key, "Active")) { valuesv = boolSV(DBIc_ACTIVE(imp_xxh)); } else if (keylen==10 && strEQ(key, "ActiveKids")) { valuesv = newSViv(DBIc_ACTIVE_KIDS(imp_xxh)); } else if (strEQ(key, "AutoInactiveDestroy")) { valuesv = boolSV(DBIc_AIADESTROY(imp_xxh)); } break; case 'B': if (keylen==9 && strEQ(key, "BegunWork")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_BegunWork)); } break; case 'C': if (strEQ(key, "ChildHandles")) { svp = hv_fetch((HV*)SvRV(h), key, keylen, FALSE); /* if something has been stored then return it. * otherwise return a dummy empty array if weakrefs are * available, else an undef to indicate that they're not */ if (svp) { valuesv = newSVsv(*svp); } else { #ifdef sv_rvweaken valuesv = newRV_noinc((SV*)newAV()); #else valuesv = &PL_sv_undef; #endif } } else if (strEQ(key, "ChopBlanks")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_ChopBlanks)); } else if (strEQ(key, "CachedKids")) { valuesv = &PL_sv_undef; } else if (strEQ(key, "CompatMode")) { valuesv = boolSV(DBIc_COMPAT(imp_xxh)); } break; case 'E': if (strEQ(key, "Executed")) { valuesv = boolSV(DBIc_is(imp_xxh, DBIcf_Executed)); } else if (strEQ(key, "ErrCount")) { valuesv = newSVuv(DBIc_ErrCount(imp_xxh)); } break; case 'I': if (strEQ(key, "InactiveDestroy")) { valuesv = boolSV(DBIc_IADESTROY(imp_xxh)); } break; case 'K': if (keylen==4 && strEQ(key, "Kids")) { valuesv = newSViv(DBIc_KIDS(imp_xxh)); } break; case 'L': if (keylen==11 && strEQ(key, "LongReadLen")) { valuesv = newSVnv((NV)DBIc_LongReadLen(imp_xxh)); } else if (keylen==11 && strEQ(key, "LongTruncOk")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_LongTruncOk)); } break; case 'M': if (keylen==10 && strEQ(key, "MultiThread")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_MultiThread)); } break; case 'P': if (keylen==10 && strEQ(key, "PrintError")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_PrintError)); } else if (keylen==9 && strEQ(key, "PrintWarn")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_PrintWarn)); } break; case 'R': if (keylen==10 && strEQ(key, "RaiseError")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_RaiseError)); } else if (keylen==9 && strEQ(key, "RaiseWarn")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_RaiseWarn)); } else if (keylen==12 && strEQ(key, "RowCacheSize")) { valuesv = &PL_sv_undef; } break; case 'S': if (keylen==18 && strEQ(key, "ShowErrorStatement")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_ShowErrorStatement)); } break; case 'T': if (keylen==4 && strEQ(key, "Type")) { char *type = dbih_htype_name(htype); valuesv = newSVpv(type,0); cacheit = TRUE; /* can't change */ } else if (keylen==10 && strEQ(key, "TraceLevel")) { valuesv = newSViv( DBIc_DEBUGIV(imp_xxh) ); } else if (keylen==5 && strEQ(key, "Taint")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_TaintIn) && DBIc_has(imp_xxh,DBIcf_TaintOut)); } else if (keylen==7 && strEQ(key, "TaintIn")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_TaintIn)); } else if (keylen==8 && strEQ(key, "TaintOut")) { valuesv = boolSV(DBIc_has(imp_xxh,DBIcf_TaintOut)); } break; case 'W': if (keylen==4 && strEQ(key, "Warn")) { valuesv = boolSV(DBIc_WARN(imp_xxh)); } break; } } /* finally check the actual hash */ if (valuesv == Nullsv) { valuesv = &PL_sv_undef; cacheit = 0; svp = hv_fetch((HV*)SvRV(h), key, keylen, FALSE); if (svp) valuesv = newSVsv(*svp); /* take copy to mortalize */ else /* warn unless it's known attribute name */ if ( !( (*key=='H' && strEQ(key, "HandleError")) || (*key=='H' && strEQ(key, "HandleSetErr")) || (*key=='S' && strEQ(key, "Statement")) || (*key=='P' && strEQ(key, "ParamArrays")) || (*key=='P' && strEQ(key, "ParamValues")) || (*key=='P' && strEQ(key, "Profile")) || (*key=='R' && strEQ(key, "ReadOnly")) || (*key=='C' && strEQ(key, "CursorName")) || (*key=='C' && strEQ(key, "Callbacks")) || (*key=='U' && strEQ(key, "Username")) || !isUPPER(*key) /* dbd_*, private_* etc */ )) warn("Can't get %s->{%s}: unrecognised attribute name",neatsvpv(h,0),key); } if (cacheit) { (void)hv_store((HV*)SvRV(h), key, keylen, newSVsv(valuesv), 0); } if (DBIc_TRACE_LEVEL(imp_xxh) >= 3) PerlIO_printf(DBIc_LOGPIO(imp_xxh)," .. FETCH %s %s = %s%s\n", neatsvpv(h,0), neatsvpv(keysv,0), neatsvpv(valuesv,0), cacheit?" (cached)":""); if (valuesv == &PL_sv_yes || valuesv == &PL_sv_no || valuesv == &PL_sv_undef) return valuesv; /* no need to mortalize yes or no */ return sv_2mortal(valuesv); } /* -------------------------------------------------------------------- */ /* Functions implementing Error and Event Handling. */ static SV * dbih_event(SV *hrv, const char *evtype, SV *a1, SV *a2) { dTHX; /* We arrive here via DBIh_EVENT* macros (see DBIXS.h) called from */ /* DBD driver C code OR $h->event() method (in DBD::_::common) */ /* XXX VERY OLD INTERFACE/CONCEPT MAY GO SOON */ /* OR MAY EVOLVE INTO A WAY TO HANDLE 'SUCCESS_WITH_INFO'/'WARNINGS' from db */ (void)hrv; (void)evtype; (void)a1; (void)a2; return &PL_sv_undef; } /* ----------------------------------------------------------------- */ STATIC I32 dbi_dopoptosub_at(PERL_CONTEXT *cxstk, I32 startingblock) { dTHX; I32 i; register PERL_CONTEXT *cx; for (i = startingblock; i >= 0; i--) { cx = &cxstk[i]; switch (CxTYPE(cx)) { default: continue; case CXt_EVAL: case CXt_SUB: #ifdef CXt_FORMAT case CXt_FORMAT: #endif DEBUG_l( Perl_deb(aTHX_ "(Found sub #%ld)\n", (long)i)); return i; } } return i; } static COP * dbi_caller_cop() { dTHX; register I32 cxix; register PERL_CONTEXT *cx; register PERL_CONTEXT *ccstack = cxstack; PERL_SI *top_si = PL_curstackinfo; char *stashname; for ( cxix = dbi_dopoptosub_at(ccstack, cxstack_ix) ;; cxix = dbi_dopoptosub_at(ccstack, cxix - 1)) { /* we may be in a higher stacklevel, so dig down deeper */ while (cxix < 0 && top_si->si_type != PERLSI_MAIN) { top_si = top_si->si_prev; ccstack = top_si->si_cxstack; cxix = dbi_dopoptosub_at(ccstack, top_si->si_cxix); } if (cxix < 0) { break; } if (PL_DBsub && cxix >= 0 && ccstack[cxix].blk_sub.cv == GvCV(PL_DBsub)) continue; cx = &ccstack[cxix]; stashname = CopSTASHPV(cx->blk_oldcop); if (!stashname) continue; if (!(stashname[0] == 'D' && stashname[1] == 'B' && strchr("DI", stashname[2]) && (!stashname[3] || (stashname[3] == ':' && stashname[4] == ':')))) { return cx->blk_oldcop; } cxix = dbi_dopoptosub_at(ccstack, cxix - 1); } return NULL; } static void dbi_caller_string(SV *buf, COP *cop, char *prefix, int show_line, int show_path) { dTHX; STRLEN len; long line = CopLINE(cop); char *file = SvPV(GvSV(CopFILEGV(cop)), len); if (!show_path) { char *sep; if ( (sep=strrchr(file,'/')) || (sep=strrchr(file,'\\'))) file = sep+1; } if (show_line) { sv_catpvf(buf, "%s%s line %ld", (prefix) ? prefix : "", file, line); } else { sv_catpvf(buf, "%s%s", (prefix) ? prefix : "", file); } } static char * log_where(SV *buf, int append, char *prefix, char *suffix, int show_line, int show_caller, int show_path) { dTHX; dTHR; if (!buf) buf = sv_2mortal(newSVpvs("")); else if (!append) sv_setpv(buf,""); if (CopLINE(PL_curcop)) { COP *cop; dbi_caller_string(buf, PL_curcop, prefix, show_line, show_path); if (show_caller && (cop = dbi_caller_cop())) { SV *via = sv_2mortal(newSVpvs("")); dbi_caller_string(via, cop, prefix, show_line, show_path); sv_catpvf(buf, " via %s", SvPV_nolen(via)); } } if (PL_dirty) sv_catpvf(buf, " during global destruction"); if (suffix) sv_catpv(buf, suffix); return SvPVX(buf); } static void clear_cached_kids(pTHX_ SV *h, imp_xxh_t *imp_xxh, const char *meth_name, int trace_level) { if (DBIc_TYPE(imp_xxh) <= DBIt_DB) { SV **svp = hv_fetchs((HV*)SvRV(h), "CachedKids", 0); if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { HV *hv = (HV*)SvRV(*svp); if (HvKEYS(hv)) { if (DBIc_TRACE_LEVEL(imp_xxh) > trace_level) trace_level = DBIc_TRACE_LEVEL(imp_xxh); if (trace_level >= 2) { PerlIO_printf(DBIc_LOGPIO(imp_xxh)," >> %s %s clearing %d CachedKids\n", meth_name, neatsvpv(h,0), (int)HvKEYS(hv)); PerlIO_flush(DBIc_LOGPIO(imp_xxh)); } /* This will probably recurse through dispatch to DESTROY the kids */ /* For drh we should probably explicitly do dbh disconnects */ hv_clear(hv); } } } } static NV dbi_time() { # ifdef HAS_GETTIMEOFDAY # ifdef PERL_IMPLICIT_SYS dTHX; # endif struct timeval when; gettimeofday(&when, (struct timezone *) 0); return when.tv_sec + (when.tv_usec / 1000000.0); # else /* per-second is almost useless */ # ifdef _WIN32 /* use _ftime() on Win32 (MS Visual C++ 6.0) */ # if defined(__BORLANDC__) # define _timeb timeb # define _ftime ftime # endif struct _timeb when; _ftime( &when ); return when.time + (when.millitm / 1000.0); # else return time(NULL); # endif # endif } static SV * _profile_next_node(SV *node, const char *name) { /* step one level down profile Data tree and auto-vivify if required */ dTHX; SV *orig_node = node; if (SvROK(node)) node = SvRV(node); if (SvTYPE(node) != SVt_PVHV) { HV *hv = newHV(); if (SvOK(node)) { char *key = "(demoted)"; warn("Profile data element %s replaced with new hash ref (for %s) and original value stored with key '%s'", neatsvpv(orig_node,0), name, key); (void)hv_store(hv, key, strlen(key), SvREFCNT_inc(orig_node), 0); } sv_setsv(node, newRV_noinc((SV*)hv)); node = (SV*)hv; } node = *hv_fetch((HV*)node, name, strlen(name), 1); return node; } static SV* dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV t2) { #define DBIprof_MAX_PATH_ELEM 100 #define DBIprof_COUNT 0 #define DBIprof_TOTAL_TIME 1 #define DBIprof_FIRST_TIME 2 #define DBIprof_MIN_TIME 3 #define DBIprof_MAX_TIME 4 #define DBIprof_FIRST_CALLED 5 #define DBIprof_LAST_CALLED 6 #define DBIprof_max_index 6 dTHX; NV ti = t2 - t1; int src_idx = 0; HV *dbh_outer_hv = NULL; HV *dbh_inner_hv = NULL; char *statement_pv; char *method_pv; SV *profile; SV *tmp; SV *dest_node; AV *av; HV *h_hv; const int call_depth = DBIc_CALL_DEPTH(imp_xxh); const int parent_call_depth = DBIc_PARENT_COM(imp_xxh) ? DBIc_CALL_DEPTH(DBIc_PARENT_COM(imp_xxh)) : 0; /* Only count calls originating from the application code */ if (call_depth > 1 || parent_call_depth > 0) return &PL_sv_undef; if (!DBIc_has(imp_xxh, DBIcf_Profile)) return &PL_sv_undef; method_pv = (SvTYPE(method)==SVt_PVCV) ? GvNAME(CvGV(method)) : isGV(method) ? GvNAME(method) : SvOK(method) ? SvPV_nolen(method) : ""; /* we don't profile DESTROY during global destruction */ if (PL_dirty && instr(method_pv, "DESTROY")) return &PL_sv_undef; h_hv = (HV*)SvRV(dbih_inner(aTHX_ h, "dbi_profile")); profile = *hv_fetchs(h_hv, "Profile", 1); if (profile && SvMAGICAL(profile)) mg_get(profile); /* FETCH */ if (!profile || !SvROK(profile)) { DBIc_set(imp_xxh, DBIcf_Profile, 0); /* disable */ if (!PL_dirty) { if (!profile) warn("Profile attribute does not exist"); else if (SvOK(profile)) warn("Profile attribute isn't a hash ref (%s,%ld)", neatsvpv(profile,0), (long)SvTYPE(profile)); } return &PL_sv_undef; } /* statement_sv: undef = use $h->{Statement}, "" (&sv_no) = use empty string */ if (!SvOK(statement_sv)) { SV **psv = hv_fetchs(h_hv, "Statement", 0); statement_sv = (psv && SvOK(*psv)) ? *psv : &PL_sv_no; } statement_pv = SvPV_nolen(statement_sv); if (DBIc_TRACE_LEVEL(imp_xxh) >= 4) PerlIO_printf(DBIc_LOGPIO(imp_xxh), " dbi_profile +%" NVff "s %s %s\n", ti, method_pv, neatsvpv(statement_sv,0)); dest_node = _profile_next_node(profile, "Data"); tmp = *hv_fetchs((HV*)SvRV(profile), "Path", 1); if (SvROK(tmp) && SvTYPE(SvRV(tmp))==SVt_PVAV) { int len; av = (AV*)SvRV(tmp); len = av_len(av); /* -1=empty, 0=one element */ while ( src_idx <= len ) { SV *pathsv = AvARRAY(av)[src_idx++]; if (SvROK(pathsv) && SvTYPE(SvRV(pathsv))==SVt_PVCV) { /* call sub, use returned list of values as path */ /* returning a ref to undef vetos this profile data */ dSP; I32 ax; SV *code_sv = SvRV(pathsv); I32 items; I32 item_idx; EXTEND(SP, 4); PUSHMARK(SP); PUSHs(h); /* push inner handle, then others params */ mPUSHs(newSVpv(method_pv, 0)); PUTBACK; SAVE_DEFSV; /* local($_) = $statement */ DEFSV_set(statement_sv); items = call_sv(code_sv, G_LIST); SPAGAIN; SP -= items ; ax = (SP - PL_stack_base) + 1 ; for (item_idx=0; item_idx < items; ++item_idx) { SV *item_sv = ST(item_idx); if (SvROK(item_sv)) { if (!SvOK(SvRV(item_sv))) items = -2; /* flag that we're rejecting this profile data */ else /* other refs reserved */ warn("Ignored ref returned by code ref in Profile Path"); break; } dest_node = _profile_next_node(dest_node, (SvOK(item_sv) ? SvPV_nolen(item_sv) : "undef")); } PUTBACK; if (items == -2) /* this profile data was vetoed */ return &PL_sv_undef; } else if (SvROK(pathsv)) { /* only meant for refs to scalars currently */ const char *p = SvPV_nolen(SvRV(pathsv)); dest_node = _profile_next_node(dest_node, p); } else if (SvOK(pathsv)) { STRLEN len; const char *p = SvPV(pathsv,len); if (p[0] == '!') { /* special cases */ if (p[1] == 'S' && strEQ(p, "!Statement")) { dest_node = _profile_next_node(dest_node, statement_pv); } else if (p[1] == 'M' && strEQ(p, "!MethodName")) { dest_node = _profile_next_node(dest_node, method_pv); } else if (p[1] == 'M' && strEQ(p, "!MethodClass")) { if (SvTYPE(method) == SVt_PVCV) { p = SvPV_nolen((SV*)CvGV(method)); } else if (isGV(method)) { /* just using SvPV_nolen(method) sometimes causes an error: */ /* "Can't coerce GLOB to string" so we use gv_efullname() */ SV *tmpsv = sv_2mortal(newSVpvs("")); gv_efullname4(tmpsv, (GV*)method, "", TRUE); p = SvPV_nolen(tmpsv); if (*p == '*') ++p; /* skip past leading '*' glob sigil */ } else { p = method_pv; } dest_node = _profile_next_node(dest_node, p); } else if (p[1] == 'F' && strEQ(p, "!File")) { dest_node = _profile_next_node(dest_node, log_where(0, 0, "", "", 0, 0, 0)); } else if (p[1] == 'F' && strEQ(p, "!File2")) { dest_node = _profile_next_node(dest_node, log_where(0, 0, "", "", 0, 1, 0)); } else if (p[1] == 'C' && strEQ(p, "!Caller")) { dest_node = _profile_next_node(dest_node, log_where(0, 0, "", "", 1, 0, 0)); } else if (p[1] == 'C' && strEQ(p, "!Caller2")) { dest_node = _profile_next_node(dest_node, log_where(0, 0, "", "", 1, 1, 0)); } else if (p[1] == 'T' && (strEQ(p, "!Time") || strnEQ(p, "!Time~", 6))) { char timebuf[20]; int factor = 1; if (p[5] == '~') { factor = atoi(&p[6]); if (factor == 0) /* sanity check to avoid div by zero error */ factor = 3600; } sprintf(timebuf, "%ld", ((long)(dbi_time()/factor))*factor); dest_node = _profile_next_node(dest_node, timebuf); } else { warn("Unknown ! element in DBI::Profile Path: %s", p); dest_node = _profile_next_node(dest_node, p); } } else if (p[0] == '{' && p[len-1] == '}') { /* treat as name of dbh attribute to use */ SV **attr_svp; if (!dbh_inner_hv) { /* cache dbh handles the first time we need them */ imp_dbh_t *imp_dbh = (DBIc_TYPE(imp_xxh) <= DBIt_DB) ? (imp_dbh_t*)imp_xxh : (imp_dbh_t*)DBIc_PARENT_COM(imp_xxh); dbh_outer_hv = DBIc_MY_H(imp_dbh); if (SvTYPE(dbh_outer_hv) != SVt_PVHV) return &PL_sv_undef; /* presumably global destruction - bail */ dbh_inner_hv = (HV*)SvRV(dbih_inner(aTHX_ (SV*)dbh_outer_hv, "profile")); if (SvTYPE(dbh_inner_hv) != SVt_PVHV) return &PL_sv_undef; /* presumably global destruction - bail */ } /* fetch from inner first, then outer if key doesn't exist */ /* (yes, this is an evil premature optimization) */ p += 1; len -= 2; /* ignore the braces */ if ((attr_svp = hv_fetch(dbh_inner_hv, p, len, 0)) == NULL) { /* try outer (tied) hash - for things like AutoCommit */ /* (will always return something even for unknowns) */ if ((attr_svp = hv_fetch(dbh_outer_hv, p, len, 0))) { if (SvGMAGICAL(*attr_svp)) mg_get(*attr_svp); /* FETCH */ } } if (!attr_svp) p -= 1; /* unignore the braces */ else if (!SvOK(*attr_svp)) p = ""; else if (!SvTRUE(*attr_svp) && SvPOK(*attr_svp) && SvNIOK(*attr_svp)) p = "0"; /* catch &sv_no style special case */ else p = SvPV_nolen(*attr_svp); dest_node = _profile_next_node(dest_node, p); } else { dest_node = _profile_next_node(dest_node, p); } } /* else undef, so ignore */ } } else { /* a bad Path value is treated as a Path of just Statement */ dest_node = _profile_next_node(dest_node, statement_pv); } if (!SvOK(dest_node)) { av = newAV(); sv_setsv(dest_node, newRV_noinc((SV*)av)); av_store(av, DBIprof_COUNT, newSViv(1)); av_store(av, DBIprof_TOTAL_TIME, newSVnv(ti)); av_store(av, DBIprof_FIRST_TIME, newSVnv(ti)); av_store(av, DBIprof_MIN_TIME, newSVnv(ti)); av_store(av, DBIprof_MAX_TIME, newSVnv(ti)); av_store(av, DBIprof_FIRST_CALLED, newSVnv(t1)); av_store(av, DBIprof_LAST_CALLED, newSVnv(t1)); } else { tmp = dest_node; if (SvROK(tmp)) tmp = SvRV(tmp); if (SvTYPE(tmp) != SVt_PVAV) croak("Invalid Profile data leaf element: %s (type %ld)", neatsvpv(tmp,0), (long)SvTYPE(tmp)); av = (AV*)tmp; sv_inc( *av_fetch(av, DBIprof_COUNT, 1)); tmp = *av_fetch(av, DBIprof_TOTAL_TIME, 1); sv_setnv(tmp, SvNV(tmp) + ti); tmp = *av_fetch(av, DBIprof_MIN_TIME, 1); if (ti < SvNV(tmp)) sv_setnv(tmp, ti); tmp = *av_fetch(av, DBIprof_MAX_TIME, 1); if (ti > SvNV(tmp)) sv_setnv(tmp, ti); sv_setnv( *av_fetch(av, DBIprof_LAST_CALLED, 1), t1); } return dest_node; /* use with caution - copy first, ie sv_mortalcopy() */ } static void dbi_profile_merge_nodes(SV *dest, SV *increment) { dTHX; AV *d_av, *i_av; SV *tmp; SV *tmp2; NV i_nv; int i_is_earlier; if (!SvROK(dest) || SvTYPE(SvRV(dest)) != SVt_PVAV) croak("dbi_profile_merge_nodes(%s, ...) requires array ref", neatsvpv(dest,0)); d_av = (AV*)SvRV(dest); if (av_len(d_av) < DBIprof_max_index) { int idx; av_extend(d_av, DBIprof_max_index); for(idx=0; idx<=DBIprof_max_index; ++idx) { tmp = *av_fetch(d_av, idx, 1); if (!SvOK(tmp) && idx != DBIprof_MIN_TIME && idx != DBIprof_FIRST_CALLED) sv_setnv(tmp, 0.0); /* leave 'min' values as undef */ } } if (!SvOK(increment)) return; if (SvROK(increment) && SvTYPE(SvRV(increment)) == SVt_PVHV) { HV *hv = (HV*)SvRV(increment); char *key; I32 keylen = 0; hv_iterinit(hv); while ( (tmp = hv_iternextsv(hv, &key, &keylen)) != NULL ) { dbi_profile_merge_nodes(dest, tmp); }; return; } if (!SvROK(increment) || SvTYPE(SvRV(increment)) != SVt_PVAV) croak("dbi_profile_merge_nodes: increment %s not an array or hash ref", neatsvpv(increment,0)); i_av = (AV*)SvRV(increment); tmp = *av_fetch(d_av, DBIprof_COUNT, 1); tmp2 = *av_fetch(i_av, DBIprof_COUNT, 1); if (SvIOK(tmp) && SvIOK(tmp2)) sv_setiv( tmp, SvIV(tmp) + SvIV(tmp2) ); else sv_setnv( tmp, SvNV(tmp) + SvNV(tmp2) ); tmp = *av_fetch(d_av, DBIprof_TOTAL_TIME, 1); sv_setnv( tmp, SvNV(tmp) + SvNV( *av_fetch(i_av, DBIprof_TOTAL_TIME, 1)) ); i_nv = SvNV(*av_fetch(i_av, DBIprof_MIN_TIME, 1)); tmp = *av_fetch(d_av, DBIprof_MIN_TIME, 1); if (!SvOK(tmp) || i_nv < SvNV(tmp)) sv_setnv(tmp, i_nv); i_nv = SvNV(*av_fetch(i_av, DBIprof_MAX_TIME, 1)); tmp = *av_fetch(d_av, DBIprof_MAX_TIME, 1); if (i_nv > SvNV(tmp)) sv_setnv(tmp, i_nv); i_nv = SvNV(*av_fetch(i_av, DBIprof_FIRST_CALLED, 1)); tmp = *av_fetch(d_av, DBIprof_FIRST_CALLED, 1); i_is_earlier = (!SvOK(tmp) || i_nv < SvNV(tmp)); if (i_is_earlier) sv_setnv(tmp, i_nv); i_nv = SvNV(*av_fetch(i_av, DBIprof_FIRST_TIME, 1)); tmp = *av_fetch(d_av, DBIprof_FIRST_TIME, 1); if (i_is_earlier || !SvOK(tmp)) { /* If the increment has an earlier DBIprof_FIRST_CALLED then we set the DBIprof_FIRST_TIME from the increment */ sv_setnv(tmp, i_nv); } i_nv = SvNV(*av_fetch(i_av, DBIprof_LAST_CALLED, 1)); tmp = *av_fetch(d_av, DBIprof_LAST_CALLED, 1); if (i_nv > SvNV(tmp)) sv_setnv(tmp, i_nv); } /* ----------------------------------------------------------------- */ /* --- The DBI dispatcher. The heart of the perl DBI. --- */ XS(XS_DBI_dispatch); /* prototype to pass -Wmissing-prototypes */ XS(XS_DBI_dispatch) { dXSARGS; dORIGMARK; dMY_CXT; SV *h = ST(0); /* the DBI handle we are working with */ SV *st1 = ST(1); /* used in debugging */ SV *st2 = ST(2); /* used in debugging */ SV *orig_h = h; SV *err_sv; SV **tmp_svp; SV **hook_svp = 0; MAGIC *mg; I32 gimme = GIMME_V; I32 trace_flags = DBIS->debug; /* local copy may change during dispatch */ I32 trace_level = (trace_flags & DBIc_TRACE_LEVEL_MASK); int is_DESTROY; meth_types meth_type; int is_unrelated_to_Statement = 0; U32 keep_error = FALSE; UV ErrCount = UV_MAX; int i, outitems; int call_depth; int is_nested_call; NV profile_t1 = 0.0; int is_orig_method_name = 1; const char *meth_name = GvNAME(CvGV(cv)); dbi_ima_t *ima = (dbi_ima_t*)CvXSUBANY(cv).any_ptr; U32 ima_flags; imp_xxh_t *imp_xxh = NULL; SV *imp_msv = Nullsv; SV *qsv = Nullsv; /* quick result from a shortcut method */ #ifdef BROKEN_DUP_ANY_PTR if (ima->my_perl != my_perl) { /* we couldn't dup the ima struct at clone time, so do it now */ dbi_ima_t *nima; Newx(nima, 1, dbi_ima_t); *nima = *ima; /* structure copy */ CvXSUBANY(cv).any_ptr = nima; nima->stash = NULL; nima->gv = NULL; nima->my_perl = my_perl; ima = nima; } #endif ima_flags = ima->flags; meth_type = ima->meth_type; if (trace_level >= 9) { PerlIO *logfp = DBILOGFP; PerlIO_printf(logfp,"%c >> %-11s DISPATCH (%s rc%ld/%ld @%ld g%x ima%lx pid#%ld)", (PL_dirty?'!':' '), meth_name, neatsvpv(h,0), (long)SvREFCNT(h), (SvROK(h) ? (long)SvREFCNT(SvRV(h)) : (long)-1), (long)items, (int)gimme, (long)ima_flags, (long)PerlProc_getpid()); PerlIO_puts(logfp, log_where(0, 0, " at ","\n", 1, (trace_level >= 3), (trace_level >= 4))); PerlIO_flush(logfp); } if ( ( (is_DESTROY=(meth_type == methtype_DESTROY))) ) { /* note that croak()'s won't propagate, only append to $@ */ keep_error = TRUE; } /* If h is a tied hash ref, switch to the inner ref 'behind' the tie. This means *all* DBI methods work with the inner (non-tied) ref. This makes it much easier for methods to access the real hash data (without having to go through FETCH and STORE methods) and for tie and non-tie methods to call each other. */ if (SvROK(h) && SvRMAGICAL(SvRV(h)) && ( ((mg=SvMAGIC(SvRV(h)))->mg_type == 'P') || ((mg=mg_find(SvRV(h),'P')) != NULL) ) ) { if (mg->mg_obj==NULL || !SvOK(mg->mg_obj) || SvRV(mg->mg_obj)==NULL) { /* maybe global destruction */ if (trace_level >= 3) PerlIO_printf(DBILOGFP, "%c <> %s for %s ignored (inner handle gone)\n", (PL_dirty?'!':' '), meth_name, neatsvpv(h,0)); XSRETURN(0); } /* Distinguish DESTROY of tie (outer) from DESTROY of inner ref */ /* This may one day be used to manually destroy extra internal */ /* refs if the application ceases to use the handle. */ if (is_DESTROY) { imp_xxh = DBIh_COM(mg->mg_obj); #ifdef DBI_USE_THREADS if (imp_xxh && DBIc_THR_USER(imp_xxh) != my_perl) { goto is_DESTROY_wrong_thread; } #endif if (imp_xxh && DBIc_TYPE(imp_xxh) <= DBIt_DB) clear_cached_kids(aTHX_ mg->mg_obj, imp_xxh, meth_name, trace_level); /* XXX might be better to move this down to after call_depth has been * incremented and then also SvREFCNT_dec(mg->mg_obj) to force an immediate * DESTROY of the inner handle if there are no other refs to it. * That way the inner DESTROY is properly flagged as a nested call, * and the outer DESTROY gets profiled more accurately, and callbacks work. */ if (trace_level >= 3) { PerlIO_printf(DBILOGFP, "%c <> DESTROY(%s) ignored for outer handle (inner %s has ref cnt %ld)\n", (PL_dirty?'!':' '), neatsvpv(h,0), neatsvpv(mg->mg_obj,0), (long)SvREFCNT(SvRV(mg->mg_obj)) ); } /* for now we ignore it since it'll be followed soon by */ /* a destroy of the inner hash and that'll do the real work */ /* However, we must at least modify DBIc_MY_H() as that is */ /* pointing (without a refcnt inc) to the scalar that is */ /* being destroyed, so it'll contain random values later. */ if (imp_xxh) DBIc_MY_H(imp_xxh) = (HV*)SvRV(mg->mg_obj); /* inner (untied) HV */ XSRETURN(0); } h = mg->mg_obj; /* switch h to inner ref */ ST(0) = h; /* switch handle on stack to inner ref */ } imp_xxh = dbih_getcom2(aTHX_ h, 0); /* get common Internal Handle Attributes */ if (!imp_xxh) { if (meth_type == methtype_can) { /* ref($h)->can("foo") */ const char *can_meth = SvPV_nolen(st1); SV *rv = &PL_sv_undef; GV *gv = gv_fetchmethod_autoload(gv_stashsv(orig_h,FALSE), can_meth, FALSE); if (gv && isGV(gv)) rv = sv_2mortal(newRV_inc((SV*)GvCV(gv))); if (trace_level >= 1) { PerlIO_printf(DBILOGFP," <- %s(%s) = %p\n", meth_name, can_meth, neatsvpv(rv,0)); } ST(0) = rv; XSRETURN(1); } if (trace_level) PerlIO_printf(DBILOGFP, "%c <> %s for %s ignored (no imp_data)\n", (PL_dirty?'!':' '), meth_name, neatsvpv(h,0)); if (!is_DESTROY) warn("Can't call %s method on handle %s%s", meth_name, neatsvpv(h,0), SvROK(h) ? " after take_imp_data()" : " (not a reference)"); XSRETURN(0); } if (DBIc_has(imp_xxh,DBIcf_Profile)) { profile_t1 = dbi_time(); /* just get start time here */ } #ifdef DBI_USE_THREADS { PerlInterpreter * h_perl; is_DESTROY_wrong_thread: h_perl = DBIc_THR_USER(imp_xxh) ; if (h_perl != my_perl) { /* XXX could call a 'handle clone' method here?, for dbh's at least */ if (is_DESTROY) { if (trace_level >= 3) { PerlIO_printf(DBILOGFP," DESTROY ignored because DBI %sh handle (%s) is owned by thread %p not current thread %p\n", dbih_htype_name(DBIc_TYPE(imp_xxh)), HvNAME(DBIc_IMP_STASH(imp_xxh)), (void*)DBIc_THR_USER(imp_xxh), (void*)my_perl) ; PerlIO_flush(DBILOGFP); } XSRETURN(0); /* don't DESTROY handle, if it is not our's !*/ } croak("%s %s failed: handle %d is owned by thread %lx not current thread %lx (%s)", HvNAME(DBIc_IMP_STASH(imp_xxh)), meth_name, DBIc_TYPE(imp_xxh), (unsigned long)h_perl, (unsigned long)my_perl, "handles can't be shared between threads and your driver may need a CLONE method added"); } } #endif if ((i = DBIc_DEBUGIV(imp_xxh))) { /* merge handle into global */ I32 h_trace_level = (i & DBIc_TRACE_LEVEL_MASK); if ( h_trace_level > trace_level ) trace_level = h_trace_level; trace_flags = (trace_flags & ~DBIc_TRACE_LEVEL_MASK) | ( i & ~DBIc_TRACE_LEVEL_MASK) | trace_level; } /* Check method call against Internal Method Attributes */ if (ima_flags) { if (ima_flags & (IMA_STUB|IMA_FUNC_REDIRECT|IMA_KEEP_ERR|IMA_KEEP_ERR_SUB|IMA_CLEAR_STMT)) { if (ima_flags & IMA_STUB) { if (meth_type == methtype_can) { const char *can_meth = SvPV_nolen(st1); SV *dbi_msv = Nullsv; /* find handle implementors method (GV or CV) */ if ( (imp_msv = (SV*)gv_fetchmethod_autoload(DBIc_IMP_STASH(imp_xxh), can_meth, FALSE)) ) { /* return DBI's CV, not the implementors CV (else we'd bypass dispatch) */ /* and anyway, we may have hit a private method not part of the DBI */ GV *gv = gv_fetchmethod_autoload(SvSTASH(SvRV(orig_h)), can_meth, FALSE); if (gv && isGV(gv)) dbi_msv = (SV*)GvCV(gv); } if (trace_level >= 1) { PerlIO *logfp = DBILOGFP; PerlIO_printf(logfp," <- %s(%s) = %p (%s %p)\n", meth_name, can_meth, (void*)dbi_msv, (imp_msv && isGV(imp_msv)) ? HvNAME(GvSTASH(imp_msv)) : "?", (void*)imp_msv); } ST(0) = (dbi_msv) ? sv_2mortal(newRV_inc(dbi_msv)) : &PL_sv_undef; XSRETURN(1); } XSRETURN(0); } if (ima_flags & IMA_FUNC_REDIRECT) { /* XXX this doesn't redispatch, nor consider the IMA of the new method */ SV *meth_name_sv = POPs; PUTBACK; --items; if (!SvPOK(meth_name_sv) || SvNIOK(meth_name_sv)) croak("%s->%s() invalid redirect method name %s", neatsvpv(h,0), meth_name, neatsvpv(meth_name_sv,0)); meth_name = SvPV_nolen(meth_name_sv); meth_type = get_meth_type(meth_name); is_orig_method_name = 0; } if (ima_flags & IMA_KEEP_ERR) keep_error = TRUE; if ((ima_flags & IMA_KEEP_ERR_SUB) && !PL_dirty && DBIc_PARENT_COM(imp_xxh) && DBIc_CALL_DEPTH(DBIc_PARENT_COM(imp_xxh)) > 0) keep_error = TRUE; if (ima_flags & IMA_CLEAR_STMT) { /* don't use SvOK_off: dbh's Statement may be ref to sth's */ (void)hv_stores((HV*)SvRV(h), "Statement", &PL_sv_undef); } if (ima_flags & IMA_CLEAR_CACHED_KIDS) clear_cached_kids(aTHX_ h, imp_xxh, meth_name, trace_flags); } if (ima_flags & IMA_HAS_USAGE) { const char *err = NULL; char msg[200]; if (ima->minargs && (items < ima->minargs || (ima->maxargs>0 && items > ima->maxargs))) { sprintf(msg, "DBI %s: invalid number of arguments: got handle + %ld, expected handle + between %d and %d\n", meth_name, (long)items-1, (int)ima->minargs-1, (int)ima->maxargs-1); err = msg; } /* arg type checking could be added here later */ if (err) { croak("%sUsage: %s->%s(%s)", err, "$h", meth_name, (ima->usage_msg) ? ima->usage_msg : "...?"); } } } is_unrelated_to_Statement = ( (DBIc_TYPE(imp_xxh) == DBIt_ST) ? 0 : (DBIc_TYPE(imp_xxh) == DBIt_DR) ? 1 : (ima_flags & IMA_UNRELATED_TO_STMT) ); if (PL_tainting && items > 1 /* method call has args */ && DBIc_is(imp_xxh, DBIcf_TaintIn) /* taint checks requested */ && !(ima_flags & IMA_NO_TAINT_IN) ) { for(i=1; i < items; ++i) { if (SvTAINTED(ST(i))) { char buf[100]; sprintf(buf,"parameter %d of %s->%s method call", i, SvPV_nolen(h), meth_name); PL_tainted = 1; /* needed for TAINT_PROPER to work */ TAINT_PROPER(buf); /* die's */ } } } /* record this inner handle for use by DBI::var::FETCH */ if (is_DESTROY) { /* force destruction of any outstanding children */ if ((tmp_svp = hv_fetchs((HV*)SvRV(h), "ChildHandles", FALSE)) && SvROK(*tmp_svp)) { AV *av = (AV*)SvRV(*tmp_svp); I32 kidslots; PerlIO *logfp = DBILOGFP; for (kidslots = AvFILL(av); kidslots >= 0; --kidslots) { SV **hp = av_fetch(av, kidslots, FALSE); if (!hp || !SvROK(*hp) || SvTYPE(SvRV(*hp))!=SVt_PVHV) break; if (trace_level >= 1) { PerlIO_printf(logfp, "on DESTROY handle %s still has child %s (refcnt %ld, obj %d, dirty=%d)\n", neatsvpv(h,0), neatsvpv(*hp, 0), (long)SvREFCNT(*hp), !!sv_isobject(*hp), PL_dirty); if (trace_level >= 9) sv_dump(SvRV(*hp)); } if (sv_isobject(*hp)) { /* call DESTROY on the handle */ PUSHMARK(SP); XPUSHs(*hp); PUTBACK; call_method("DESTROY", G_VOID|G_EVAL|G_KEEPERR); MSPAGAIN; } else { imp_xxh_t *imp_xxh = dbih_getcom2(aTHX_ *hp, 0); if (imp_xxh && DBIc_COMSET(imp_xxh)) { dbih_clearcom(imp_xxh); sv_setsv(*hp, &PL_sv_undef); } } } } if (DBIc_TYPE(imp_xxh) <= DBIt_DB ) { /* is dbh or drh */ imp_xxh_t *parent_imp; if (SvOK(DBIc_ERR(imp_xxh)) && (parent_imp = DBIc_PARENT_COM(imp_xxh)) && !PL_dirty /* XXX - remove? */ ) { /* copy err/errstr/state values to $DBI::err etc still work */ sv_setsv(DBIc_ERR(parent_imp), DBIc_ERR(imp_xxh)); sv_setsv(DBIc_ERRSTR(parent_imp), DBIc_ERRSTR(imp_xxh)); sv_setsv(DBIc_STATE(parent_imp), DBIc_STATE(imp_xxh)); } } if (DBIc_AIADESTROY(imp_xxh)) { /* wants ineffective destroy after fork */ if ((U32)PerlProc_getpid() != _imp2com(imp_xxh, std.pid)) DBIc_set(imp_xxh, DBIcf_IADESTROY, 1); } if (DBIc_IADESTROY(imp_xxh)) { /* wants ineffective destroy */ DBIc_ACTIVE_off(imp_xxh); } call_depth = 0; is_nested_call = 0; } else { DBI_SET_LAST_HANDLE(h); SAVEINT(DBIc_CALL_DEPTH(imp_xxh)); call_depth = ++DBIc_CALL_DEPTH(imp_xxh); if (ima_flags & IMA_COPY_UP_STMT) { /* execute() */ copy_statement_to_parent(aTHX_ h, imp_xxh); } is_nested_call = (call_depth > 1 || (!PL_dirty /* not in global destruction [CPAN #75614] */ && DBIc_PARENT_COM(imp_xxh) && DBIc_CALL_DEPTH(DBIc_PARENT_COM(imp_xxh))) >= 1); } /* --- dispatch --- */ if (!keep_error && meth_type != methtype_set_err) { SV *err_sv; if (trace_level && SvOK(err_sv=DBIc_ERR(imp_xxh))) { PerlIO *logfp = DBILOGFP; PerlIO_printf(logfp, " !! The %s '%s' was CLEARED by call to %s method\n", SvTRUE(err_sv) ? "ERROR" : strlen(SvPV_nolen(err_sv)) ? "warn" : "info", neatsvpv(DBIc_ERR(imp_xxh),0), meth_name); } DBIh_CLEAR_ERROR(imp_xxh); } else { /* we check for change in ErrCount/err_hash during call */ ErrCount = DBIc_ErrCount(imp_xxh); if (keep_error) keep_error = err_hash(aTHX_ imp_xxh); } if (DBIc_has(imp_xxh,DBIcf_Callbacks) && (tmp_svp = hv_fetchs((HV*)SvRV(h), "Callbacks", 0)) && ( (hook_svp = hv_fetch((HV*)SvRV(*tmp_svp), meth_name, strlen(meth_name), 0)) /* the "*" fallback callback only applies to non-nested calls * and also doesn't apply to the 'set_err' or DESTROY methods. * Nor during global destruction. * Other restrictions may be added over time. * It's an undocumented hack. */ || (!is_nested_call && !PL_dirty && meth_type != methtype_set_err && meth_type != methtype_DESTROY && (hook_svp = hv_fetchs((HV*)SvRV(*tmp_svp), "*", 0)) ) ) && SvROK(*hook_svp) ) { SV *orig_defsv; SV *temp_defsv; SV *code = SvRV(*hook_svp); I32 skip_dispatch = 0; if (trace_level) PerlIO_printf(DBILOGFP, "%c {{ %s callback %s being invoked with %ld args\n", (PL_dirty?'!':' '), meth_name, neatsvpv(*hook_svp,0), (long)items); /* we don't use ENTER,SAVETMPS & FREETMPS,LEAVE because we may need mortal * results to live long enough to be returned to our caller */ /* we want to localize $_ for the callback but can't just do that alone * because we're not using SAVETMPS & FREETMPS, so we have to get sneaky. * We still localize, so we're safe from the callback die-ing, * but after the callback we manually restore the original $_. */ orig_defsv = DEFSV; /* remember the current $_ */ SAVE_DEFSV; /* local($_) = $method_name */ temp_defsv = sv_2mortal(newSVpv(meth_name,0)); # ifdef SvTEMP_off SvTEMP_off(temp_defsv); # endif DEFSV_set(temp_defsv); EXTEND(SP, items+1); PUSHMARK(SP); PUSHs(orig_h); /* push outer handle, then others params */ for (i=1; i < items; ++i) { /* start at 1 to skip handle */ PUSHs( ST(i) ); } PUTBACK; outitems = call_sv(code, G_LIST); /* call the callback code */ MSPAGAIN; /* The callback code can undef $_ to indicate to skip dispatch */ skip_dispatch = !SvOK(DEFSV); /* put $_ back now */ DEFSV_set(orig_defsv); if (trace_level) PerlIO_printf(DBILOGFP, "%c }} %s callback %s returned%s\n", (PL_dirty?'!':' '), meth_name, neatsvpv(*hook_svp,0), skip_dispatch ? ", actual method will not be called" : "" ); if (skip_dispatch) { /* XXX experimental */ int ix = outitems; /* copy the new items down to the destination list */ while (ix-- > 0) { if(0)warn("\tcopy down %d: %s overwriting %s\n", ix, SvPV_nolen(TOPs), SvPV_nolen(ST(ix)) ); ST(ix) = POPs; } imp_msv = *hook_svp; /* for trace and profile */ goto post_dispatch; } else { if (outitems != 0) die("Callback for %s returned %d values but must not return any (temporary restriction in current version)", meth_name, (int)outitems); /* POP's and PUTBACK? to clear stack */ } } /* set Executed after Callbacks so it's not set if callback elects to skip the method */ if (ima_flags & IMA_EXECUTE) { imp_xxh_t *parent = DBIc_PARENT_COM(imp_xxh); DBIc_on(imp_xxh, DBIcf_Executed); if (parent) DBIc_on(parent, DBIcf_Executed); } /* The "quick_FETCH" logic... */ /* Shortcut for fetching attributes to bypass method call overheads */ if (meth_type == methtype_FETCH && !DBIc_COMPAT(imp_xxh)) { STRLEN kl; const char *key = SvPV(st1, kl); SV **attr_svp; if (*key != '_' && (attr_svp=hv_fetch((HV*)SvRV(h), key, kl, 0))) { qsv = *attr_svp; /* disable FETCH from cache for special attributes */ if (SvROK(qsv) && SvTYPE(SvRV(qsv))==SVt_PVHV && *key=='D' && ( (kl==6 && DBIc_TYPE(imp_xxh)==DBIt_DB && strEQ(key,"Driver")) || (kl==8 && DBIc_TYPE(imp_xxh)==DBIt_ST && strEQ(key,"Database")) ) ) { qsv = Nullsv; } /* disable profiling of FETCH of Profile data */ if (*key == 'P' && strEQ(key, "Profile")) profile_t1 = 0.0; } if (qsv) { /* skip real method call if we already have a 'quick' value */ ST(0) = sv_mortalcopy(qsv); outitems = 1; goto post_dispatch; } } { CV *meth_cv; #ifdef DBI_save_hv_fetch_ent HE save_mh; if (meth_type == methtype_FETCH) save_mh = PL_hv_fetch_ent_mh; /* XXX nested tied FETCH bug17575 workaround */ #endif if (trace_flags) { SAVEI32(DBIS->debug); /* fall back to orig value later */ DBIS->debug = trace_flags; /* make new value global (for now) */ if (ima) { /* enabling trace via flags takes precedence over disabling due to min level */ if ((trace_flags & DBIc_TRACE_FLAGS_MASK) & (ima->method_trace & DBIc_TRACE_FLAGS_MASK)) trace_level = (trace_level < 2) ? 2 : trace_level; /* min */ else if (trace_level < (DBIc_TRACE_LEVEL_MASK & ima->method_trace)) trace_level = 0; /* silence dispatch log for this method */ } } if (is_orig_method_name && ima->stash == DBIc_IMP_STASH(imp_xxh) && ima->generation == PL_sub_generation + MY_cache_gen(DBIc_IMP_STASH(imp_xxh)) ) imp_msv = (SV*)ima->gv; else { imp_msv = (SV*)gv_fetchmethod_autoload(DBIc_IMP_STASH(imp_xxh), meth_name, FALSE); if (is_orig_method_name) { /* clear stale entry, if any */ SvREFCNT_dec(ima->stash); SvREFCNT_dec(ima->gv); if (!imp_msv) { ima->stash = NULL; ima->gv = NULL; } else { ima->stash = (HV*)SvREFCNT_inc(DBIc_IMP_STASH(imp_xxh)); ima->gv = (GV*)SvREFCNT_inc(imp_msv); ima->generation = PL_sub_generation + MY_cache_gen(DBIc_IMP_STASH(imp_xxh)); } } } /* if method was a 'func' then try falling back to real 'func' method */ if (!imp_msv && (ima_flags & IMA_FUNC_REDIRECT)) { imp_msv = (SV*)gv_fetchmethod_autoload(DBIc_IMP_STASH(imp_xxh), "func", FALSE); if (imp_msv) { /* driver does have func method so undo the earlier 'func' stack changes */ mPUSHs(newSVpv(meth_name, 0)); PUTBACK; ++items; meth_name = "func"; meth_type = methtype_ordinary; } } if (trace_level >= (is_nested_call ? 4 : 2)) { PerlIO *logfp = DBILOGFP; /* Full pkg method name (or just meth_name for ANON CODE) */ const char *imp_meth_name = (imp_msv && isGV(imp_msv)) ? GvNAME(imp_msv) : meth_name; HV *imp_stash = DBIc_IMP_STASH(imp_xxh); PerlIO_printf(logfp, "%c -> %s ", call_depth>1 ? '0'+call_depth-1 : (PL_dirty?'!':' '), imp_meth_name); if (imp_meth_name[0] == 'A' && strEQ(imp_meth_name,"AUTOLOAD")) PerlIO_printf(logfp, "\"%s\" ", meth_name); if (imp_msv && isGV(imp_msv) && GvSTASH(imp_msv) != imp_stash) PerlIO_printf(logfp, "in %s ", HvNAME(GvSTASH(imp_msv))); PerlIO_printf(logfp, "for %s (%s", HvNAME(imp_stash), SvPV_nolen(orig_h)); if (h != orig_h) /* show inner handle to aid tracing */ PerlIO_printf(logfp, "~0x%lx", (long)SvRV(h)); else PerlIO_printf(logfp, "~INNER"); for(i=1; ihidearg) ? "****" : neatsvpv(ST(i),0)); } #ifdef DBI_USE_THREADS PerlIO_printf(logfp, ") thr#%p\n", (void*)DBIc_THR_USER(imp_xxh)); #else PerlIO_printf(logfp, ")\n"); #endif PerlIO_flush(logfp); } if (!imp_msv || ! ((meth_cv = GvCV(imp_msv))) ) { if (PL_dirty || is_DESTROY) { outitems = 0; goto post_dispatch; } if (ima_flags & IMA_NOT_FOUND_OKAY) { outitems = 0; goto post_dispatch; } croak("Can't locate DBI object method \"%s\" via package \"%s\"", meth_name, HvNAME(DBIc_IMP_STASH(imp_xxh))); } PUSHMARK(mark); /* mark arguments again so we can pass them on */ /* Note: the handle on the stack is still an object blessed into a * DBI::* class and not the DBD::*::* class whose method is being * invoked. This is correct and should be largely transparent. */ /* SHORT-CUT ALERT! */ if (use_xsbypass && CvISXSUB(meth_cv) && CvXSUB(meth_cv)) { /* If we are calling an XSUB we jump directly to its C code and * bypass perl_call_sv(), pp_entersub() etc. This is fast. * This code is based on a small section of pp_entersub(). */ (void)(*CvXSUB(meth_cv))(aTHXo_ meth_cv); /* Call the C code directly */ if (gimme == G_SCALAR) { /* Enforce sanity in scalar context */ if (ax != PL_stack_sp - PL_stack_base ) { /* outitems != 1 */ ST(0) = (ax > PL_stack_sp - PL_stack_base) ? &PL_sv_undef /* outitems == 0 */ : *PL_stack_sp; /* outitems > 1 */ PL_stack_sp = PL_stack_base + ax; } outitems = 1; } else { outitems = PL_stack_sp - (PL_stack_base + ax - 1); } } else { /* sv_dump(imp_msv); */ outitems = call_sv((SV*)meth_cv, (is_DESTROY ? gimme | G_EVAL | G_KEEPERR : gimme) ); } XSprePUSH; /* reset SP to base of stack frame */ #ifdef DBI_save_hv_fetch_ent if (meth_type == methtype_FETCH) PL_hv_fetch_ent_mh = save_mh; /* see start of block */ #endif } post_dispatch: if (is_DESTROY && DBI_IS_LAST_HANDLE(h)) { /* if destroying _this_ handle */ SV *lhp = DBIc_PARENT_H(imp_xxh); if (lhp && SvROK(lhp)) { DBI_SET_LAST_HANDLE(lhp); } else { DBI_UNSET_LAST_HANDLE; } } if (keep_error) { /* if we didn't clear err before the call, check to see if a new error * or warning has been recorded. If so, turn off keep_error so it gets acted on */ if (DBIc_ErrCount(imp_xxh) > ErrCount || err_hash(aTHX_ imp_xxh) != keep_error) { keep_error = 0; } } err_sv = DBIc_ERR(imp_xxh); if (trace_level >= (is_nested_call ? 3 : 1)) { PerlIO *logfp = DBILOGFP; const int is_fetch = (meth_type == methtype_fetch_star && DBIc_TYPE(imp_xxh)==DBIt_ST); const IV row_count = (is_fetch) ? DBIc_ROW_COUNT((imp_sth_t*)imp_xxh) : 0; if (is_fetch && row_count>=2 && trace_level<=4 && SvOK(ST(0))) { /* skip the 'middle' rows to reduce output */ goto skip_meth_return_trace; } if (SvOK(err_sv)) { PerlIO_printf(logfp, " %s %s %s %s (err#%ld)\n", (keep_error) ? " " : "!!", SvTRUE(err_sv) ? "ERROR:" : strlen(SvPV_nolen(err_sv)) ? "warn:" : "info:", neatsvpv(err_sv,0), neatsvpv(DBIc_ERRSTR(imp_xxh),0), (long)DBIc_ErrCount(imp_xxh)); } PerlIO_printf(logfp,"%c%c <%c %s", (call_depth > 1) ? '0'+call_depth-1 : (PL_dirty?'!':' '), (DBIc_is(imp_xxh, DBIcf_TaintIn|DBIcf_TaintOut)) ? 'T' : ' ', (qsv) ? '>' : '-', meth_name); if (trace_level==1 && (items>=2||is_DESTROY)) { /* make level 1 more useful */ /* we only have the first two parameters available here */ if (is_DESTROY) /* show handle as first arg to DESTROY */ /* want to show outer handle so trace makes sense */ /* but outer handle has been destroyed so we fake it */ PerlIO_printf(logfp,"(%s=HASH(0x%p)", HvNAME(SvSTASH(SvRV(orig_h))), (void*)DBIc_MY_H(imp_xxh)); else PerlIO_printf(logfp,"(%s", neatsvpv(st1,0)); if (items >= 3) PerlIO_printf(logfp,", %s", neatsvpv(st2,0)); PerlIO_printf(logfp,"%s)", (items > 3) ? ", ..." : ""); } if (gimme & G_LIST) PerlIO_printf(logfp,"= ("); else PerlIO_printf(logfp,"="); for(i=0; i < outitems; ++i) { SV *s = ST(i); if ( SvROK(s) && SvTYPE(SvRV(s))==SVt_PVAV) { AV *av = (AV*)SvRV(s); int avi; int avi_last = SvIV(DBIS->neatsvpvlen) / 10; if (avi_last < 39) avi_last = 39; PerlIO_printf(logfp, " ["); for (avi=0; avi <= AvFILL(av); ++avi) { PerlIO_printf(logfp, " %s", neatsvpv(AvARRAY(av)[avi],0)); if (avi >= avi_last && AvFILL(av) - avi > 1) { PerlIO_printf(logfp, " ... %ld others skipped", AvFILL(av) - avi); break; } } PerlIO_printf(logfp, " ]"); } else { PerlIO_printf(logfp, " %s", neatsvpv(s,0)); if ( SvROK(s) && SvTYPE(SvRV(s))==SVt_PVHV && !SvOBJECT(SvRV(s)) ) PerlIO_printf(logfp, "%ldkeys", (long)HvKEYS(SvRV(s))); } } if (gimme & G_LIST) { PerlIO_printf(logfp," ) [%d items]", outitems); } if (is_fetch && row_count) { PerlIO_printf(logfp," row%"IVdf, row_count); } if (qsv) /* flag as quick and peek at the first arg (still on the stack) */ PerlIO_printf(logfp," (%s from cache)", neatsvpv(st1,0)); else if (!imp_msv) PerlIO_printf(logfp," (not implemented)"); /* XXX add flag to show pid here? */ /* add file and line number information */ PerlIO_puts(logfp, log_where(0, 0, " at ", "\n", 1, (trace_level >= 3), (trace_level >= 4))); skip_meth_return_trace: PerlIO_flush(logfp); } if (ima_flags & IMA_END_WORK) { /* commit() or rollback() */ /* XXX does not consider if the method call actually worked or not */ DBIc_off(imp_xxh, DBIcf_Executed); if (DBIc_has(imp_xxh, DBIcf_BegunWork)) { DBIc_off(imp_xxh, DBIcf_BegunWork); if (!DBIc_has(imp_xxh, DBIcf_AutoCommit)) { /* We only get here if the driver hasn't implemented their own code */ /* for begin_work, or has but hasn't correctly turned AutoCommit */ /* back on in their commit or rollback code. So we have to do it. */ /* This is bad because it'll probably trigger a spurious commit() */ /* and may mess up the error handling below for the commit/rollback */ PUSHMARK(SP); XPUSHs(h); mXPUSHs(newSVpvs("AutoCommit")); XPUSHs(&PL_sv_yes); PUTBACK; call_method("STORE", G_VOID); MSPAGAIN; } } } if (PL_tainting && DBIc_is(imp_xxh, DBIcf_TaintOut) /* taint checks requested */ /* XXX this would taint *everything* being returned from *any* */ /* method that doesn't have IMA_NO_TAINT_OUT set. */ /* DISABLED: just tainting fetched data in get_fbav seems ok */ && 0/* XXX disabled*/ /* !(ima_flags & IMA_NO_TAINT_OUT) */ ) { dTHR; TAINT; /* affects sv_setsv()'s within same perl statement */ for(i=0; i < outitems; ++i) { I32 avi; char *p; SV *s; SV *agg = ST(i); if ( !SvROK(agg) ) continue; agg = SvRV(agg); #define DBI_OUT_TAINTABLE(s) (!SvREADONLY(s) && !SvTAINTED(s)) switch (SvTYPE(agg)) { case SVt_PVAV: for(avi=0; avi <= AvFILL((AV*)agg); ++avi) { s = AvARRAY((AV*)agg)[avi]; if (DBI_OUT_TAINTABLE(s)) SvTAINTED_on(s); } break; case SVt_PVHV: hv_iterinit((HV*)agg); while( (s = hv_iternextsv((HV*)agg, &p, &avi)) ) { if (DBI_OUT_TAINTABLE(s)) SvTAINTED_on(s); } break; default: if (DBIc_WARN(imp_xxh)) { PerlIO_printf(DBILOGFP,"Don't know how to taint contents of returned %s (type %d)\n", neatsvpv(agg,0), (int)SvTYPE(agg)); } } } } /* if method returned a new handle, and that handle has an error on it * then copy the error up into the parent handle */ if (ima_flags & IMA_IS_FACTORY && SvROK(ST(0))) { SV *h_new = ST(0); D_impdata(imp_xxh_new, imp_xxh_t, h_new); if (SvOK(DBIc_ERR(imp_xxh_new))) { set_err_sv(h, imp_xxh, DBIc_ERR(imp_xxh_new), DBIc_ERRSTR(imp_xxh_new), DBIc_STATE(imp_xxh_new), &PL_sv_no); } } if ( !keep_error /* is a new err/warn/info */ && !is_nested_call /* skip nested (internal) calls */ && ( /* is an error and has RaiseError|PrintError|HandleError set */ (SvTRUE(err_sv) && DBIc_has(imp_xxh, DBIcf_RaiseError|DBIcf_PrintError|DBIcf_HandleError)) /* is a warn (not info) and has RaiseWarn|PrintWarn set */ || ( SvOK(err_sv) && strlen(SvPV_nolen(err_sv)) && DBIc_has(imp_xxh, DBIcf_RaiseWarn|DBIcf_PrintWarn)) ) ) { SV *msg; SV **statement_svp = NULL; const int is_warning = (!SvTRUE(err_sv) && strlen(SvPV_nolen(err_sv))==1); const char *err_meth_name = meth_name; if (meth_type == methtype_set_err) { SV **sem_svp = hv_fetchs((HV*)SvRV(h), "dbi_set_err_method", GV_ADDWARN); if (SvOK(*sem_svp)) err_meth_name = SvPV_nolen(*sem_svp); } msg = sv_2mortal(newSVpvf("%s %s %s: ", HvNAME(DBIc_IMP_STASH(imp_xxh)), err_meth_name, SvTRUE(err_sv) ? "failed" : is_warning ? "warning" : "information")); if (SvOK(DBIc_ERRSTR(imp_xxh))) sv_catsv(msg, DBIc_ERRSTR(imp_xxh)); else sv_catpvf(msg, "(err=%s, errstr=undef, state=%s)", neatsvpv(DBIc_ERR(imp_xxh),0), neatsvpv(DBIc_STATE(imp_xxh),0) ); if ( DBIc_has(imp_xxh, DBIcf_ShowErrorStatement) && !is_unrelated_to_Statement && (DBIc_TYPE(imp_xxh) == DBIt_ST || ima_flags & IMA_SHOW_ERR_STMT) && (statement_svp = hv_fetchs((HV*)SvRV(h), "Statement", 0)) && statement_svp && SvOK(*statement_svp) ) { SV **svp = 0; sv_catpv(msg, " [for Statement \""); sv_catsv(msg, *statement_svp); /* fetch from tied outer handle to trigger FETCH magic */ /* could add DBIcf_ShowErrorParams (default to on?) */ if (!(ima_flags & IMA_HIDE_ERR_PARAMVALUES)) { svp = hv_fetchs((HV*)DBIc_MY_H(imp_xxh),"ParamValues",FALSE); if (svp && SvMAGICAL(*svp)) mg_get(*svp); /* XXX may recurse, may croak. could use eval */ } if (svp && SvRV(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV && HvKEYS(SvRV(*svp))>0 ) { SV *param_values_sv = sv_2mortal(_join_hash_sorted((HV*)SvRV(*svp), "=",1, ", ",2, 1, -1)); sv_catpv(msg, "\" with ParamValues: "); sv_catsv(msg, param_values_sv); sv_catpvn(msg, "]", 1); } else { sv_catpv(msg, "\"]"); } } if (0) { COP *cop = dbi_caller_cop(); if (cop && (CopLINE(cop) != CopLINE(PL_curcop) || CopFILEGV(cop) != CopFILEGV(PL_curcop))) { dbi_caller_string(msg, cop, " called via ", 1, 0); } } hook_svp = NULL; if ( (SvTRUE(err_sv) || (is_warning && DBIc_has(imp_xxh, DBIcf_RaiseWarn))) && DBIc_has(imp_xxh, DBIcf_HandleError) && (hook_svp = hv_fetchs((HV*)SvRV(h),"HandleError",0)) && hook_svp && SvOK(*hook_svp) ) { dSP; PerlIO *logfp = DBILOGFP; IV items; SV *status; SV *result; /* point to result SV that's pointed to by the stack */ if (outitems) { result = *(sp-outitems+1); if (SvREADONLY(result)) { *(sp-outitems+1) = result = sv_2mortal(newSVsv(result)); } } else { result = sv_newmortal(); } if (trace_level) PerlIO_printf(logfp," -> HandleError on %s via %s%s%s%s\n", neatsvpv(h,0), neatsvpv(*hook_svp,0), (!outitems ? "" : " ("), (!outitems ? "" : neatsvpv(result ,0)), (!outitems ? "" : ")") ); PUSHMARK(SP); XPUSHs(msg); mXPUSHs(newRV_inc((SV*)DBIc_MY_H(imp_xxh))); XPUSHs( result ); PUTBACK; items = call_sv(*hook_svp, G_SCALAR); MSPAGAIN; status = (items) ? POPs : &PL_sv_undef; PUTBACK; if (trace_level) PerlIO_printf(logfp," <- HandleError= %s%s%s%s\n", neatsvpv(status,0), (!outitems ? "" : " ("), (!outitems ? "" : neatsvpv(result,0)), (!outitems ? "" : ")") ); if (!SvTRUE(status)) /* handler says it didn't handle it, so... */ hook_svp = 0; /* pretend we didn't have a handler... */ } if (profile_t1) { /* see also dbi_profile() call a few lines below */ SV *statement_sv = (is_unrelated_to_Statement) ? &PL_sv_no : &PL_sv_undef; dbi_profile(h, imp_xxh, statement_sv, imp_msv ? imp_msv : (SV*)cv, profile_t1, dbi_time()); } if (!hook_svp && is_warning) { if (DBIc_has(imp_xxh, DBIcf_PrintWarn)) warn_sv(msg); if (DBIc_has(imp_xxh, DBIcf_RaiseWarn)) croak_sv(msg); } else if (!hook_svp && SvTRUE(err_sv)) { if (DBIc_has(imp_xxh, DBIcf_PrintError)) warn_sv(msg); if (DBIc_has(imp_xxh, DBIcf_RaiseError)) croak_sv(msg); } } else if (profile_t1) { /* see also dbi_profile() call a few lines above */ SV *statement_sv = (is_unrelated_to_Statement) ? &PL_sv_no : &PL_sv_undef; dbi_profile(h, imp_xxh, statement_sv, imp_msv ? imp_msv : (SV*)cv, profile_t1, dbi_time()); } XSRETURN(outitems); } /* -------------------------------------------------------------------- */ /* comment and placeholder styles to accept and return */ #define DBIpp_cm_cs 0x000001 /* C style */ #define DBIpp_cm_hs 0x000002 /* # */ #define DBIpp_cm_dd 0x000004 /* -- */ #define DBIpp_cm_br 0x000008 /* {} */ #define DBIpp_cm_dw 0x000010 /* '-- ' dash dash whitespace */ #define DBIpp_cm_XX 0x00001F /* any of the above */ #define DBIpp_ph_qm 0x000100 /* ? */ #define DBIpp_ph_cn 0x000200 /* :1 */ #define DBIpp_ph_cs 0x000400 /* :name */ #define DBIpp_ph_sp 0x000800 /* %s (as return only, not accept) */ #define DBIpp_ph_XX 0x000F00 /* any of the above */ #define DBIpp_st_qq 0x010000 /* '' char escape */ #define DBIpp_st_bs 0x020000 /* \ char escape */ #define DBIpp_st_XX 0x030000 /* any of the above */ #define DBIpp_L_BRACE '{' #define DBIpp_R_BRACE '}' #define PS_accept(flag) DBIbf_has(ps_accept,(flag)) #define PS_return(flag) DBIbf_has(ps_return,(flag)) SV * preparse(SV *dbh, const char *statement, IV ps_return, IV ps_accept, void *foo) { dTHX; D_imp_xxh(dbh); /* The idea here is that ps_accept defines which constructs to recognize (accept) as valid in the source string (other constructs are ignored), and ps_return defines which constructs are valid to return in the result string. If a construct that is valid in the input is also valid in the output then it's simply copied. If it's not valid in the output then it's editied into one of the valid forms (ideally the most 'standard' and/or information preserving one). For example, if ps_accept includes '--' style comments but ps_return doesn't, but ps_return does include '#' style comments then any '--' style comments would be rewritten as '#' style comments. Similarly for placeholders. DBD::Oracle, for example, would say '?', ':1' and ':name' are all acceptable input, but only ':name' should be returned. (There's a tricky issue with the '--' comment style because it can clash with valid syntax, i.e., "... set foo=foo--1 ..." so it would be *bad* to misinterpret that as the start of a comment. Perhaps we need a DBIpp_cm_dw (for dash-dash-whitespace) style to allow for that.) Also, we'll only support DBIpp_cm_br as an input style. And even then, only with reluctance. We may (need to) drop it when we add support for odbc escape sequences. */ int idx = 1; char in_quote = '\0'; char in_comment = '\0'; char rt_comment = '\0'; char *dest, *start; const char *src; const char *style = "", *laststyle = NULL; SV *new_stmt_sv; (void)foo; if (!(ps_return | DBIpp_ph_XX)) { /* no return ph type specified */ ps_return |= ps_accept | DBIpp_ph_XX; /* so copy from ps_accept */ } /* XXX this allocation strategy won't work when we get to more advanced stuff */ new_stmt_sv = newSV(strlen(statement) * 6 + 16); sv_setpv(new_stmt_sv,""); src = statement; dest = SvPVX(new_stmt_sv); while( *src ) { if (*src == '%' && PS_return(DBIpp_ph_sp)) *dest++ = '%'; if (in_comment) { if ( (in_comment == '-' && (*src == '\n' || *(src+1) == '\0')) || (in_comment == '#' && (*src == '\n' || *(src+1) == '\0')) || (in_comment == DBIpp_L_BRACE && *src == DBIpp_R_BRACE) /* XXX nesting? */ || (in_comment == '/' && *src == '*' && *(src+1) == '/') ) { switch (rt_comment) { case '/': *dest++ = '*'; *dest++ = '/'; break; case '-': *dest++ = '\n'; break; case '#': *dest++ = '\n'; break; case DBIpp_L_BRACE: *dest++ = DBIpp_R_BRACE; break; case '\0': /* ensure deleting a comment doesn't join two tokens */ if (in_comment=='/' || in_comment==DBIpp_L_BRACE) *dest++ = ' '; /* ('-' and '#' styles use the newline) */ break; } if (in_comment == '/') src++; src += (*src != '\n' || *(dest-1)=='\n') ? 1 : 0; in_comment = '\0'; rt_comment = '\0'; } else if (rt_comment) *dest++ = *src++; else src++; /* delete (don't copy) the comment */ continue; } if (in_quote) { if (*src == in_quote) { in_quote = 0; } *dest++ = *src++; continue; } /* Look for comments */ if (*src == '-' && *(src+1) == '-' && (PS_accept(DBIpp_cm_dd) || (*(src+2) == ' ' && PS_accept(DBIpp_cm_dw))) ) { in_comment = *src; src += 2; /* skip past 2nd char of double char delimiters */ if (PS_return(DBIpp_cm_dd) || PS_return(DBIpp_cm_dw)) { *dest++ = rt_comment = '-'; *dest++ = '-'; if (PS_return(DBIpp_cm_dw) && *src!=' ') *dest++ = ' '; /* insert needed white space */ } else if (PS_return(DBIpp_cm_cs)) { *dest++ = rt_comment = '/'; *dest++ = '*'; } else if (PS_return(DBIpp_cm_hs)) { *dest++ = rt_comment = '#'; } else if (PS_return(DBIpp_cm_br)) { *dest++ = rt_comment = DBIpp_L_BRACE; } continue; } else if (*src == '/' && *(src+1) == '*' && PS_accept(DBIpp_cm_cs)) { in_comment = *src; src += 2; /* skip past 2nd char of double char delimiters */ if (PS_return(DBIpp_cm_cs)) { *dest++ = rt_comment = '/'; *dest++ = '*'; } else if (PS_return(DBIpp_cm_dd) || PS_return(DBIpp_cm_dw)) { *dest++ = rt_comment = '-'; *dest++ = '-'; if (PS_return(DBIpp_cm_dw)) *dest++ = ' '; } else if (PS_return(DBIpp_cm_hs)) { *dest++ = rt_comment = '#'; } else if (PS_return(DBIpp_cm_br)) { *dest++ = rt_comment = DBIpp_L_BRACE; } continue; } else if (*src == '#' && PS_accept(DBIpp_cm_hs)) { in_comment = *src; src++; if (PS_return(DBIpp_cm_hs)) { *dest++ = rt_comment = '#'; } else if (PS_return(DBIpp_cm_dd) || PS_return(DBIpp_cm_dw)) { *dest++ = rt_comment = '-'; *dest++ = '-'; if (PS_return(DBIpp_cm_dw)) *dest++ = ' '; } else if (PS_return(DBIpp_cm_cs)) { *dest++ = rt_comment = '/'; *dest++ = '*'; } else if (PS_return(DBIpp_cm_br)) { *dest++ = rt_comment = DBIpp_L_BRACE; } continue; } else if (*src == DBIpp_L_BRACE && PS_accept(DBIpp_cm_br)) { in_comment = *src; src++; if (PS_return(DBIpp_cm_br)) { *dest++ = rt_comment = DBIpp_L_BRACE; } else if (PS_return(DBIpp_cm_dd) || PS_return(DBIpp_cm_dw)) { *dest++ = rt_comment = '-'; *dest++ = '-'; if (PS_return(DBIpp_cm_dw)) *dest++ = ' '; } else if (PS_return(DBIpp_cm_cs)) { *dest++ = rt_comment = '/'; *dest++ = '*'; } else if (PS_return(DBIpp_cm_hs)) { *dest++ = rt_comment = '#'; } continue; } if ( !(*src==':' && (PS_accept(DBIpp_ph_cn) || PS_accept(DBIpp_ph_cs))) && !(*src=='?' && PS_accept(DBIpp_ph_qm)) ){ if (*src == '\'' || *src == '"') in_quote = *src; *dest++ = *src++; continue; } /* only here for : or ? outside of a comment or literal */ start = dest; /* save name inc colon */ *dest++ = *src++; /* copy and move past first char */ if (*start == '?') /* X/Open Standard */ { style = "?"; if (PS_return(DBIpp_ph_qm)) ; else if (PS_return(DBIpp_ph_cn)) { /* '?' -> ':p1' (etc) */ sprintf(start,":p%d", idx++); dest = start+strlen(start); } else if (PS_return(DBIpp_ph_sp)) { /* '?' -> '%s' */ *start = '%'; *dest++ = 's'; } } else if (isDIGIT(*src)) { /* :1 */ const int pln = atoi(src); style = ":1"; if (PS_return(DBIpp_ph_cn)) { /* ':1'->':p1' */ idx = pln; *dest++ = 'p'; while(isDIGIT(*src)) *dest++ = *src++; } else if (PS_return(DBIpp_ph_qm) /* ':1' -> '?' */ || PS_return(DBIpp_ph_sp) /* ':1' -> '%s' */ ) { PS_return(DBIpp_ph_qm) ? sprintf(start,"?") : sprintf(start,"%%s"); dest = start + strlen(start); if (pln != idx) { char buf[99]; sprintf(buf, "preparse found placeholder :%d out of sequence, expected :%d", pln, idx); set_err_char(dbh, imp_xxh, "1", 1, buf, 0, "preparse"); return &PL_sv_undef; } while(isDIGIT(*src)) src++; idx++; } } else if (isALNUM(*src)) /* :name */ { style = ":name"; if (PS_return(DBIpp_ph_cs)) { ; } else if (PS_return(DBIpp_ph_qm) /* ':name' -> '?' */ || PS_return(DBIpp_ph_sp) /* ':name' -> '%s' */ ) { PS_return(DBIpp_ph_qm) ? sprintf(start,"?") : sprintf(start,"%%s"); dest = start + strlen(start); while (isALNUM(*src)) /* consume name, includes '_' */ src++; } } /* perhaps ':=' PL/SQL construct */ else { continue; } *dest = '\0'; /* handy for debugging */ if (laststyle && style != laststyle) { char buf[99]; sprintf(buf, "preparse found mixed placeholder styles (%s / %s)", style, laststyle); set_err_char(dbh, imp_xxh, "1", 1, buf, 0, "preparse"); return &PL_sv_undef; } laststyle = style; } *dest = '\0'; /* warn about probable parsing errors, but continue anyway (returning processed string) */ switch (in_quote) { case '\'': set_err_char(dbh, imp_xxh, "1", 1, "preparse found unterminated single-quoted string", 0, "preparse"); break; case '\"': set_err_char(dbh, imp_xxh, "1", 1, "preparse found unterminated double-quoted string", 0, "preparse"); break; } switch (in_comment) { case DBIpp_L_BRACE: set_err_char(dbh, imp_xxh, "1", 1, "preparse found unterminated bracketed {...} comment", 0, "preparse"); break; case '/': set_err_char(dbh, imp_xxh, "1", 1, "preparse found unterminated bracketed C-style comment", 0, "preparse"); break; } SvCUR_set(new_stmt_sv, strlen(SvPVX(new_stmt_sv))); *SvEND(new_stmt_sv) = '\0'; return new_stmt_sv; } /* -------------------------------------------------------------------- */ /* The DBI Perl interface (via XS) starts here. Currently these are */ /* all internal support functions. Note install_method and see DBI.pm */ MODULE = DBI PACKAGE = DBI REQUIRE: 1.929 PROTOTYPES: DISABLE BOOT: { MY_CXT_INIT; PERL_UNUSED_VAR(MY_CXT); } PERL_UNUSED_VAR(cv); PERL_UNUSED_VAR(items); dbi_bootinit(NULL); /* make this sub into a fake XS so it can bee seen by DBD::* modules; * never actually call it as an XS sub, or it will crash and burn! */ (void) newXS("DBI::_dbi_state_lval", (XSUBADDR_t)(void (*) (void))_dbi_state_lval, __FILE__); I32 constant() PROTOTYPE: ALIAS: SQL_ALL_TYPES = SQL_ALL_TYPES SQL_ARRAY = SQL_ARRAY SQL_ARRAY_LOCATOR = SQL_ARRAY_LOCATOR SQL_BIGINT = SQL_BIGINT SQL_BINARY = SQL_BINARY SQL_BIT = SQL_BIT SQL_BLOB = SQL_BLOB SQL_BLOB_LOCATOR = SQL_BLOB_LOCATOR SQL_BOOLEAN = SQL_BOOLEAN SQL_CHAR = SQL_CHAR SQL_CLOB = SQL_CLOB SQL_CLOB_LOCATOR = SQL_CLOB_LOCATOR SQL_DATE = SQL_DATE SQL_DATETIME = SQL_DATETIME SQL_DECIMAL = SQL_DECIMAL SQL_DOUBLE = SQL_DOUBLE SQL_FLOAT = SQL_FLOAT SQL_GUID = SQL_GUID SQL_INTEGER = SQL_INTEGER SQL_INTERVAL = SQL_INTERVAL SQL_INTERVAL_DAY = SQL_INTERVAL_DAY SQL_INTERVAL_DAY_TO_HOUR = SQL_INTERVAL_DAY_TO_HOUR SQL_INTERVAL_DAY_TO_MINUTE = SQL_INTERVAL_DAY_TO_MINUTE SQL_INTERVAL_DAY_TO_SECOND = SQL_INTERVAL_DAY_TO_SECOND SQL_INTERVAL_HOUR = SQL_INTERVAL_HOUR SQL_INTERVAL_HOUR_TO_MINUTE = SQL_INTERVAL_HOUR_TO_MINUTE SQL_INTERVAL_HOUR_TO_SECOND = SQL_INTERVAL_HOUR_TO_SECOND SQL_INTERVAL_MINUTE = SQL_INTERVAL_MINUTE SQL_INTERVAL_MINUTE_TO_SECOND = SQL_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MONTH = SQL_INTERVAL_MONTH SQL_INTERVAL_SECOND = SQL_INTERVAL_SECOND SQL_INTERVAL_YEAR = SQL_INTERVAL_YEAR SQL_INTERVAL_YEAR_TO_MONTH = SQL_INTERVAL_YEAR_TO_MONTH SQL_LONGVARBINARY = SQL_LONGVARBINARY SQL_LONGVARCHAR = SQL_LONGVARCHAR SQL_MULTISET = SQL_MULTISET SQL_MULTISET_LOCATOR = SQL_MULTISET_LOCATOR SQL_NUMERIC = SQL_NUMERIC SQL_REAL = SQL_REAL SQL_REF = SQL_REF SQL_ROW = SQL_ROW SQL_SMALLINT = SQL_SMALLINT SQL_TIME = SQL_TIME SQL_TIMESTAMP = SQL_TIMESTAMP SQL_TINYINT = SQL_TINYINT SQL_TYPE_DATE = SQL_TYPE_DATE SQL_TYPE_TIME = SQL_TYPE_TIME SQL_TYPE_TIMESTAMP = SQL_TYPE_TIMESTAMP SQL_TYPE_TIMESTAMP_WITH_TIMEZONE = SQL_TYPE_TIMESTAMP_WITH_TIMEZONE SQL_TYPE_TIME_WITH_TIMEZONE = SQL_TYPE_TIME_WITH_TIMEZONE SQL_UDT = SQL_UDT SQL_UDT_LOCATOR = SQL_UDT_LOCATOR SQL_UNKNOWN_TYPE = SQL_UNKNOWN_TYPE SQL_VARBINARY = SQL_VARBINARY SQL_VARCHAR = SQL_VARCHAR SQL_WCHAR = SQL_WCHAR SQL_WLONGVARCHAR = SQL_WLONGVARCHAR SQL_WVARCHAR = SQL_WVARCHAR SQL_CURSOR_FORWARD_ONLY = SQL_CURSOR_FORWARD_ONLY SQL_CURSOR_KEYSET_DRIVEN = SQL_CURSOR_KEYSET_DRIVEN SQL_CURSOR_DYNAMIC = SQL_CURSOR_DYNAMIC SQL_CURSOR_STATIC = SQL_CURSOR_STATIC SQL_CURSOR_TYPE_DEFAULT = SQL_CURSOR_TYPE_DEFAULT DBIpp_cm_cs = DBIpp_cm_cs DBIpp_cm_hs = DBIpp_cm_hs DBIpp_cm_dd = DBIpp_cm_dd DBIpp_cm_dw = DBIpp_cm_dw DBIpp_cm_br = DBIpp_cm_br DBIpp_cm_XX = DBIpp_cm_XX DBIpp_ph_qm = DBIpp_ph_qm DBIpp_ph_cn = DBIpp_ph_cn DBIpp_ph_cs = DBIpp_ph_cs DBIpp_ph_sp = DBIpp_ph_sp DBIpp_ph_XX = DBIpp_ph_XX DBIpp_st_qq = DBIpp_st_qq DBIpp_st_bs = DBIpp_st_bs DBIpp_st_XX = DBIpp_st_XX DBIstcf_DISCARD_STRING = DBIstcf_DISCARD_STRING DBIstcf_STRICT = DBIstcf_STRICT DBIf_TRACE_SQL = DBIf_TRACE_SQL DBIf_TRACE_CON = DBIf_TRACE_CON DBIf_TRACE_ENC = DBIf_TRACE_ENC DBIf_TRACE_DBD = DBIf_TRACE_DBD DBIf_TRACE_TXN = DBIf_TRACE_TXN CODE: RETVAL = ix; OUTPUT: RETVAL void _clone_dbis() CODE: dMY_CXT; dbistate_t * parent_dbis = DBIS; (void)cv; { MY_CXT_CLONE; } dbi_bootinit(parent_dbis); void _new_handle(class, parent, attr_ref, imp_datasv, imp_class) SV * class SV * parent SV * attr_ref SV * imp_datasv SV * imp_class PPCODE: dMY_CXT; HV *outer; SV *outer_ref; HV *class_stash = gv_stashsv(class, GV_ADDWARN); if (DBIS_TRACE_LEVEL >= 5) { PerlIO_printf(DBILOGFP, " New %s (for %s, parent=%s, id=%s)\n", neatsvpv(class,0), SvPV_nolen(imp_class), neatsvpv(parent,0), neatsvpv(imp_datasv,0)); PERL_UNUSED_VAR(cv); } (void)hv_stores((HV*)SvRV(attr_ref), "ImplementorClass", SvREFCNT_inc(imp_class)); /* make attr into inner handle by blessing it into class */ sv_bless(attr_ref, class_stash); /* tie new outer hash to inner handle */ outer = newHV(); /* create new hash to be outer handle */ outer_ref = newRV_noinc((SV*)outer); /* make outer hash into a handle by blessing it into class */ sv_bless(outer_ref, class_stash); /* tie outer handle to inner handle */ sv_magic((SV*)outer, attr_ref, PERL_MAGIC_tied, Nullch, 0); dbih_setup_handle(aTHX_ outer_ref, SvPV_nolen(imp_class), parent, SvOK(imp_datasv) ? imp_datasv : Nullsv); /* return outer handle, plus inner handle if not in scalar context */ sv_2mortal(outer_ref); EXTEND(SP, 2); PUSHs(outer_ref); if (GIMME_V != G_SCALAR) { PUSHs(attr_ref); } void _setup_handle(sv, imp_class, parent, imp_datasv) SV * sv char * imp_class SV * parent SV * imp_datasv CODE: (void)cv; dbih_setup_handle(aTHX_ sv, imp_class, parent, SvOK(imp_datasv) ? imp_datasv : Nullsv); ST(0) = &PL_sv_undef; void _get_imp_data(sv) SV * sv CODE: D_imp_xxh(sv); (void)cv; ST(0) = sv_mortalcopy(DBIc_IMP_DATA(imp_xxh)); /* okay if NULL */ void _handles(sv) SV * sv PPCODE: /* return the outer and inner handle for any given handle */ D_imp_xxh(sv); SV *ih = sv_mortalcopy( dbih_inner(aTHX_ sv, "_handles") ); SV *oh = sv_2mortal(newRV_inc((SV*)DBIc_MY_H(imp_xxh))); /* XXX dangerous */ (void)cv; EXTEND(SP, 2); PUSHs(oh); /* returns outer handle then inner */ if (GIMME_V != G_SCALAR) { PUSHs(ih); } void neat(sv, maxlen=0) SV * sv U32 maxlen CODE: ST(0) = sv_2mortal(newSVpv(neatsvpv(sv, maxlen), 0)); (void)cv; I32 hash(key, type=0) const char *key long type CODE: (void)cv; RETVAL = dbi_hash(key, type); OUTPUT: RETVAL void looks_like_number(...) PPCODE: int i; EXTEND(SP, items); (void)cv; for(i=0; i < items ; ++i) { SV *sv = ST(i); if (!SvOK(sv) || (SvPOK(sv) && SvCUR(sv)==0)) PUSHs(&PL_sv_undef); else if ( looks_like_number(sv) ) PUSHs(&PL_sv_yes); else PUSHs(&PL_sv_no); } void _install_method(dbi_class, meth_name, file, attribs=Nullsv) const char * dbi_class char * meth_name char * file SV * attribs CODE: { dMY_CXT; /* install another method name/interface for the DBI dispatcher */ SV *trace_msg = (DBIS_TRACE_LEVEL >= 10) ? sv_2mortal(newSVpvs("")) : Nullsv; CV *cv; SV **svp; dbi_ima_t *ima; MAGIC *mg; (void)dbi_class; if (strnNE(meth_name, "DBI::", 5)) /* XXX m/^DBI::\w+::\w+$/ */ croak("install_method %s: invalid class", meth_name); if (trace_msg) sv_catpvf(trace_msg, "install_method %-21s", meth_name); Newxz(ima, 1, dbi_ima_t); if (attribs && SvOK(attribs)) { /* convert and store method attributes in a fast access form */ if (SvTYPE(SvRV(attribs)) != SVt_PVHV) croak("install_method %s: bad attribs", meth_name); DBD_ATTRIB_GET_IV(attribs, "O",1, svp, ima->flags); DBD_ATTRIB_GET_UV(attribs, "T",1, svp, ima->method_trace); DBD_ATTRIB_GET_IV(attribs, "H",1, svp, ima->hidearg); if (trace_msg) { if (ima->flags) sv_catpvf(trace_msg, ", flags 0x%04x", (unsigned)ima->flags); if (ima->method_trace)sv_catpvf(trace_msg, ", T 0x%08lx", (unsigned long)ima->method_trace); if (ima->hidearg) sv_catpvf(trace_msg, ", H %u", (unsigned)ima->hidearg); } if ( (svp=DBD_ATTRIB_GET_SVP(attribs, "U",1)) != NULL) { AV *av = (AV*)SvRV(*svp); ima->minargs = (U8)SvIV(*av_fetch(av, 0, 1)); ima->maxargs = (U8)SvIV(*av_fetch(av, 1, 1)); svp = av_fetch(av, 2, 0); ima->usage_msg = (svp) ? savepv_using_sv(SvPV_nolen(*svp)) : ""; ima->flags |= IMA_HAS_USAGE; if (trace_msg && DBIS_TRACE_LEVEL >= 11) sv_catpvf(trace_msg, ",\n usage: min %d, max %d, '%s'", ima->minargs, ima->maxargs, ima->usage_msg); } } if (trace_msg) PerlIO_printf(DBILOGFP,"%s\n", SvPV_nolen(trace_msg)); file = savepv(file); cv = newXS(meth_name, XS_DBI_dispatch, file); SvPVX((SV *)cv) = file; SvLEN((SV *)cv) = 1; CvXSUBANY(cv).any_ptr = ima; ima->meth_type = get_meth_type(GvNAME(CvGV(cv))); /* Attach magic to handle duping and freeing of the dbi_ima_t struct. * Due to the poor interface of the mg dup function, sneak a pointer * to the original CV in the mg_ptr field (we get called with a * pointer to the mg, but not the SV) */ mg = sv_magicext((SV*)cv, NULL, DBI_MAGIC, &dbi_ima_vtbl, (char *)cv, 0); #ifdef BROKEN_DUP_ANY_PTR ima->my_perl = my_perl; /* who owns this struct */ #else mg->mg_flags |= MGf_DUP; #endif ST(0) = &PL_sv_yes; } int trace(class, level_sv=&PL_sv_undef, file=Nullsv) SV * class SV * level_sv SV * file ALIAS: _debug_dispatch = 1 CODE: { dMY_CXT; IV level; if (!DBIS) { PERL_UNUSED_VAR(ix); croak("DBI not initialised"); } /* Return old/current value. No change if new value not given. */ RETVAL = (DBIS) ? DBIS->debug : 0; level = parse_trace_flags(class, level_sv, RETVAL); if (level) /* call before or after altering DBI trace level */ set_trace_file(file); if (level != RETVAL) { if ((level & DBIc_TRACE_LEVEL_MASK) > 0) { PerlIO_printf(DBILOGFP," DBI %s%s default trace level set to 0x%lx/%ld (pid %d pi %p) at %s\n", XS_VERSION, dbi_build_opt, (long)(level & DBIc_TRACE_FLAGS_MASK), (long)(level & DBIc_TRACE_LEVEL_MASK), (int)PerlProc_getpid(), #ifdef MULTIPLICITY (void *)my_perl, #else (void*)NULL, #endif log_where(Nullsv, 0, "", "", 1, 1, 0) ); if (!PL_dowarn) PerlIO_printf(DBILOGFP," Note: perl is running without the recommended perl -w option\n"); PerlIO_flush(DBILOGFP); } DBIS->debug = level; sv_setiv(get_sv("DBI::dbi_debug",0x5), level); } if (!level) /* call before or after altering DBI trace level */ set_trace_file(file); } OUTPUT: RETVAL void dump_handle(sv, msg="DBI::dump_handle", level=0) SV * sv const char *msg int level CODE: (void)cv; dbih_dumphandle(aTHX_ sv, msg, level); void _svdump(sv) SV * sv CODE: { dMY_CXT; (void)cv; PerlIO_printf(DBILOGFP, "DBI::_svdump(%s)", neatsvpv(sv,0)); #ifdef DEBUGGING sv_dump(sv); #endif } NV dbi_time() void dbi_profile(h, statement, method, t1, t2) SV *h SV *statement SV *method NV t1 NV t2 CODE: SV *leaf = &PL_sv_undef; PERL_UNUSED_VAR(cv); if (SvROK(method)) method = SvRV(method); if (dbih_inner(aTHX_ h, NULL)) { /* is a DBI handle */ D_imp_xxh(h); leaf = dbi_profile(h, imp_xxh, statement, method, t1, t2); } else if (SvROK(h) && SvTYPE(SvRV(h)) == SVt_PVHV) { /* iterate over values %$h */ HV *hv = (HV*)SvRV(h); SV *tmp; char *key; I32 keylen = 0; hv_iterinit(hv); while ( (tmp = hv_iternextsv(hv, &key, &keylen)) != NULL ) { if (SvOK(tmp)) { D_imp_xxh(tmp); leaf = dbi_profile(tmp, imp_xxh, statement, method, t1, t2); } }; } else { croak("dbi_profile(%s,...) invalid handle argument", neatsvpv(h,0)); } if (GIMME_V == G_VOID) ST(0) = &PL_sv_undef; /* skip sv_mortalcopy if not needed */ else ST(0) = sv_mortalcopy(leaf); SV * dbi_profile_merge_nodes(dest, ...) SV * dest ALIAS: dbi_profile_merge = 1 CODE: { if (!SvROK(dest) || SvTYPE(SvRV(dest)) != SVt_PVAV) croak("dbi_profile_merge_nodes(%s,...) destination is not an array reference", neatsvpv(dest,0)); if (items <= 1) { PERL_UNUSED_VAR(cv); PERL_UNUSED_VAR(ix); RETVAL = 0; } else { /* items==2 for dest + 1 arg, ST(0) is dest, ST(1) is first arg */ while (--items >= 1) { SV *thingy = ST(items); dbi_profile_merge_nodes(dest, thingy); } RETVAL = newSVsv(*av_fetch((AV*)SvRV(dest), DBIprof_TOTAL_TIME, 1)); } } OUTPUT: RETVAL SV * _concat_hash_sorted(hash_sv, kv_sep_sv, pair_sep_sv, use_neat_sv, num_sort_sv) SV *hash_sv SV *kv_sep_sv SV *pair_sep_sv SV *use_neat_sv SV *num_sort_sv PREINIT: char *kv_sep, *pair_sep; STRLEN kv_sep_len, pair_sep_len; CODE: if (!SvOK(hash_sv)) XSRETURN_UNDEF; if (!SvROK(hash_sv) || SvTYPE(SvRV(hash_sv))!=SVt_PVHV) croak("hash is not a hash reference"); kv_sep = SvPV(kv_sep_sv, kv_sep_len); pair_sep = SvPV(pair_sep_sv, pair_sep_len); RETVAL = _join_hash_sorted( (HV*)SvRV(hash_sv), kv_sep, kv_sep_len, pair_sep, pair_sep_len, /* use_neat should be undef, 0 or 1, may allow sprintf format strings later */ (SvOK(use_neat_sv)) ? SvIV(use_neat_sv) : 0, (SvOK(num_sort_sv)) ? SvIV(num_sort_sv) : -1 ); OUTPUT: RETVAL int sql_type_cast(sv, sql_type, flags=0) SV * sv int sql_type U32 flags CODE: RETVAL = sql_type_cast_svpv(aTHX_ sv, sql_type, flags, 0); OUTPUT: RETVAL MODULE = DBI PACKAGE = DBI::var void FETCH(sv) SV * sv CODE: dMY_CXT; /* Note that we do not come through the dispatcher to get here. */ char *meth = SvPV_nolen(SvRV(sv)); /* what should this tie do ? */ char type = *meth++; /* is this a $ or & style */ imp_xxh_t *imp_xxh = (DBI_LAST_HANDLE_OK) ? DBIh_COM(DBI_LAST_HANDLE) : NULL; int trace_level = (imp_xxh ? DBIc_TRACE_LEVEL(imp_xxh) : DBIS_TRACE_LEVEL); NV profile_t1 = 0.0; if (imp_xxh && DBIc_has(imp_xxh,DBIcf_Profile)) profile_t1 = dbi_time(); if (trace_level >= 2) { PerlIO_printf(DBILOGFP," -> $DBI::%s (%c) FETCH from lasth=%s\n", meth, type, (imp_xxh) ? neatsvpv(DBI_LAST_HANDLE,0): "none"); } if (type == '!') { /* special case for $DBI::lasth */ /* Currently we can only return the INNER handle. */ /* This handle should only be used for true/false tests */ ST(0) = (imp_xxh) ? sv_2mortal(newRV_inc(DBI_LAST_HANDLE)) : &PL_sv_undef; } else if ( !imp_xxh ) { if (trace_level) warn("Can't read $DBI::%s, last handle unknown or destroyed", meth); ST(0) = &PL_sv_undef; } else if (type == '*') { /* special case for $DBI::err, see also err method */ SV *errsv = DBIc_ERR(imp_xxh); ST(0) = sv_mortalcopy(errsv); } else if (type == '"') { /* special case for $DBI::state */ SV *state = DBIc_STATE(imp_xxh); ST(0) = DBIc_STATE_adjust(imp_xxh, state); } else if (type == '$') { /* lookup scalar variable in implementors stash */ const char *vname = mkvname(aTHX_ DBIc_IMP_STASH(imp_xxh), meth, 0); SV *vsv = get_sv(vname, 1); ST(0) = sv_mortalcopy(vsv); } else { /* default to method call via stash of implementor of DBI_LAST_HANDLE */ GV *imp_gv; HV *imp_stash = DBIc_IMP_STASH(imp_xxh); #ifdef DBI_save_hv_fetch_ent HE save_mh = PL_hv_fetch_ent_mh; /* XXX nested tied FETCH bug17575 workaround */ #endif profile_t1 = 0.0; /* profile this via dispatch only (else we'll double count) */ if (trace_level >= 3) PerlIO_printf(DBILOGFP," >> %s::%s\n", HvNAME(imp_stash), meth); ST(0) = sv_2mortal(newRV_inc(DBI_LAST_HANDLE)); if ((imp_gv = gv_fetchmethod(imp_stash,meth)) == NULL) { croak("Can't locate $DBI::%s object method \"%s\" via package \"%s\"", meth, meth, HvNAME(imp_stash)); } PUSHMARK(mark); /* reset mark (implies one arg as we were called with one arg?) */ call_sv((SV*)GvCV(imp_gv), GIMME_V); SPAGAIN; #ifdef DBI_save_hv_fetch_ent PL_hv_fetch_ent_mh = save_mh; #endif } if (trace_level) PerlIO_printf(DBILOGFP," <- $DBI::%s= %s\n", meth, neatsvpv(ST(0),0)); if (profile_t1) { SV *h = sv_2mortal(newRV_inc(DBI_LAST_HANDLE)); dbi_profile(h, imp_xxh, &PL_sv_undef, (SV*)cv, profile_t1, dbi_time()); } MODULE = DBI PACKAGE = DBD::_::dr void dbixs_revision(h) SV * h CODE: PERL_UNUSED_VAR(h); ST(0) = sv_2mortal(newSViv(DBIXS_REVISION)); MODULE = DBI PACKAGE = DBD::_::db void connected(...) CODE: /* defined here just to avoid AUTOLOAD */ (void)cv; (void)items; ST(0) = &PL_sv_undef; SV * preparse(dbh, statement, ps_return, ps_accept, foo=Nullch) SV * dbh char * statement IV ps_return IV ps_accept void *foo void take_imp_data(h) SV * h PREINIT: /* take_imp_data currently in DBD::_::db not DBD::_::common, so for dbh's only */ D_imp_xxh(h); MAGIC *mg; SV *imp_xxh_sv; SV **tmp_svp; CODE: PERL_UNUSED_VAR(cv); /* * Remove and return the imp_xxh_t structure that's attached to the inner * hash of the handle. Effectively this removes the 'brain' of the handle * leaving it as an empty shell - brain dead. All method calls on it fail. * * The imp_xxh_t structure that's removed and returned is a plain scalar * (containing binary data). It can be passed to a new DBI->connect call * in order to have the new $dbh use the same 'connection' as the original * handle. In this way a multi-threaded connection pool can be implemented. * * If the drivers imp_xxh_t structure contains SV*'s, or other interpreter * specific items, they should be freed by the drivers own take_imp_data() * method before it then calls SUPER::take_imp_data() to finalize removal * of the imp_xxh_t structure. * * The driver needs to view the take_imp_data method as being nearly the * same as disconnect+DESTROY only not actually calling the database API to * disconnect. All that needs to remain valid in the imp_xxh_t structure * is the underlying database API connection data. Everything else should * in a 'clean' state such that if the drivers own DESTROY method was * called it would be able to properly handle the contents of the * structure. This is important in case a new handle created using this * imp_data, possibly in a new thread, might end up being DESTROY'd before * the driver has had a chance to 're-setup' the data. See dbih_setup_handle() * * All the above relates to the 'typical use case' for a compiled driver. * For a pure-perl driver using a socket pair, for example, the drivers * take_imp_data method might just return a string containing the fileno() * values of the sockets (without calling this SUPER::take_imp_data() code). * The key point is that the take_imp_data() method returns an opaque buffer * containing whatever the driver would need to reuse the same underlying * 'connection to the database' in a new handle. * * In all cases, care should be taken that driver attributes (such as * AutoCommit) match the state of the underlying connection. */ if (!DBIc_ACTIVE(imp_xxh)) {/* sanity check, may be relaxed later */ set_err_char(h, imp_xxh, "1", 1, "Can't take_imp_data from handle that's not Active", 0, "take_imp_data"); XSRETURN(0); } /* Ideally there should be no child statement handles existing when * take_imp_data is called because when those statement handles are * destroyed they may need to interact with the 'zombie' parent dbh. * So we do our best to neautralize them (finish & rebless) */ if ((tmp_svp = hv_fetchs((HV*)SvRV(h), "ChildHandles", FALSE)) && SvROK(*tmp_svp)) { AV *av = (AV*)SvRV(*tmp_svp); HV *zombie_stash = gv_stashpv("DBI::zombie", GV_ADDWARN); I32 kidslots; for (kidslots = AvFILL(av); kidslots >= 0; --kidslots) { SV **hp = av_fetch(av, kidslots, FALSE); if (hp && SvROK(*hp) && SvMAGICAL(SvRV(*hp))) { PUSHMARK(sp); XPUSHs(*hp); PUTBACK; call_method("finish", G_VOID); SPAGAIN; PUTBACK; sv_unmagic(SvRV(*hp), 'P'); /* untie */ sv_bless(*hp, zombie_stash); /* neutralise */ } } } /* The above measures may not be sufficient if weakrefs aren't available * or something has a reference to the inner-handle of an sth. * We'll require no Active kids, but just warn about others. */ if (DBIc_ACTIVE_KIDS(imp_xxh)) { set_err_char(h, imp_xxh, "1", 1, "Can't take_imp_data from handle while it still has Active kids", 0, "take_imp_data"); XSRETURN(0); } if (DBIc_KIDS(imp_xxh)) warn("take_imp_data from handle while it still has kids"); /* it may be better here to return a copy and poison the original * rather than detatching and returning the original */ /* --- perform the surgery */ dbih_getcom2(aTHX_ h, &mg); /* get the MAGIC so we can change it */ imp_xxh_sv = mg->mg_obj; /* take local copy of the imp_data pointer */ mg->mg_obj = Nullsv; /* sever the link from handle to imp_xxh */ mg->mg_ptr = NULL; /* and sever the shortcut too */ if (DBIc_TRACE_LEVEL(imp_xxh) >= 9) sv_dump(imp_xxh_sv); /* --- housekeeping */ DBIc_ACTIVE_off(imp_xxh); /* silence warning from dbih_clearcom */ DBIc_IMPSET_off(imp_xxh); /* silence warning from dbih_clearcom */ dbih_clearcom(imp_xxh); /* free SVs like DBD::_mem::common::DESTROY */ SvOBJECT_off(imp_xxh_sv); /* no longer needs DESTROY via dbih_clearcom */ /* restore flags to mark fact imp data holds active connection */ /* (don't use magical DBIc_ACTIVE_on here) */ DBIc_FLAGS(imp_xxh) |= DBIcf_IMPSET | DBIcf_ACTIVE; /* --- tidy up the raw PV for life as a more normal string */ SvPOK_on(imp_xxh_sv); /* SvCUR & SvEND were set at creation */ /* --- return the actual imp_xxh_sv on the stack */ ST(0) = imp_xxh_sv; MODULE = DBI PACKAGE = DBD::_::st void _get_fbav(sth) SV * sth CODE: D_imp_sth(sth); AV *av = dbih_get_fbav(imp_sth); (void)cv; ST(0) = sv_2mortal(newRV_inc((SV*)av)); void _set_fbav(sth, src_rv) SV * sth SV * src_rv CODE: D_imp_sth(sth); int i; AV *src_av; AV *dst_av = dbih_get_fbav(imp_sth); int dst_fields = AvFILL(dst_av)+1; int src_fields; (void)cv; if (!SvROK(src_rv) || SvTYPE(SvRV(src_rv)) != SVt_PVAV) croak("_set_fbav(%s): not an array ref", neatsvpv(src_rv,0)); src_av = (AV*)SvRV(src_rv); src_fields = AvFILL(src_av)+1; if (src_fields != dst_fields) { warn("_set_fbav(%s): array has %d elements, the statement handle row buffer has %d (and NUM_OF_FIELDS is %d)", neatsvpv(src_rv,0), src_fields, dst_fields, DBIc_NUM_FIELDS(imp_sth)); SvREADONLY_off(dst_av); if (src_fields < dst_fields) { /* shrink the array - sadly this looses column bindings for the lost columns */ av_fill(dst_av, src_fields-1); dst_fields = src_fields; } else { av_fill(dst_av, src_fields-1); /* av_fill pads with immutable undefs which we need to change */ for(i=dst_fields-1; i < src_fields; ++i) { sv_setsv(AvARRAY(dst_av)[i], newSV(0)); } } SvREADONLY_on(dst_av); } for(i=0; i < dst_fields; ++i) { /* copy over the row */ /* If we're given the values, then taint them if required */ if (DBIc_is(imp_sth, DBIcf_TaintOut)) SvTAINT(AvARRAY(src_av)[i]); sv_setsv(AvARRAY(dst_av)[i], AvARRAY(src_av)[i]); } ST(0) = sv_2mortal(newRV_inc((SV*)dst_av)); void bind_col(sth, col, ref, attribs=Nullsv) SV * sth SV * col SV * ref SV * attribs PREINIT: SV *ret; CODE: DBD_ATTRIBS_CHECK("bind_col", sth, attribs); ret = boolSV(dbih_sth_bind_col(sth, col, ref, attribs)); ST(0) = ret; (void)cv; void fetchrow_array(sth) SV * sth ALIAS: fetchrow = 1 PPCODE: SV *retsv; if (CvDEPTH(cv) == 99) { PERL_UNUSED_VAR(ix); croak("Deep recursion, probably fetchrow-fetch-fetchrow loop"); } PUSHMARK(sp); XPUSHs(sth); PUTBACK; if (call_method("fetch", G_SCALAR) != 1) croak("panic: DBI fetch"); /* should never happen */ SPAGAIN; retsv = POPs; PUTBACK; if (SvROK(retsv) && SvTYPE(SvRV(retsv)) == SVt_PVAV) { D_imp_sth(sth); int num_fields, i; AV *bound_av; AV *av = (AV*)SvRV(retsv); num_fields = AvFILL(av)+1; EXTEND(sp, num_fields+1); /* We now check for bind_col() having been called but fetch */ /* not returning the fields_svav array. Probably because the */ /* driver is implemented in perl. XXX This logic may change later. */ bound_av = DBIc_FIELDS_AV(imp_sth); /* bind_col() called ? */ if (bound_av && av != bound_av) { /* let dbih_get_fbav know what's going on */ bound_av = dbih_get_fbav(imp_sth); if (DBIc_TRACE_LEVEL(imp_sth) >= 3) { PerlIO_printf(DBIc_LOGPIO(imp_sth), "fetchrow: updating fbav 0x%lx from 0x%lx\n", (long)bound_av, (long)av); } for(i=0; i < num_fields; ++i) { /* copy over the row */ sv_setsv(AvARRAY(bound_av)[i], AvARRAY(av)[i]); } } for(i=0; i < num_fields; ++i) { PUSHs(AvARRAY(av)[i]); } } SV * fetchrow_hashref(sth, keyattrib=Nullch) SV * sth const char *keyattrib PREINIT: SV *rowavr; SV *ka_rv; D_imp_sth(sth); CODE: (void)cv; PUSHMARK(sp); XPUSHs(sth); PUTBACK; if (!keyattrib || !*keyattrib) { SV *kn = DBIc_FetchHashKeyName(imp_sth); if (kn && SvOK(kn)) keyattrib = SvPVX(kn); else keyattrib = "NAME"; } ka_rv = *hv_fetch((HV*)DBIc_MY_H(imp_sth), keyattrib,strlen(keyattrib), TRUE); /* we copy to invoke FETCH magic, and we do that before fetch() so if tainting */ /* then the taint triggered by the fetch won't then apply to the fetched name */ ka_rv = newSVsv(ka_rv); if (call_method("fetch", G_SCALAR) != 1) croak("panic: DBI fetch"); /* should never happen */ SPAGAIN; rowavr = POPs; PUTBACK; /* have we got an array ref in rowavr */ if (SvROK(rowavr) && SvTYPE(SvRV(rowavr)) == SVt_PVAV) { int i; AV *rowav = (AV*)SvRV(rowavr); const int num_fields = AvFILL(rowav)+1; HV *hv; AV *ka_av; if (!(SvROK(ka_rv) && SvTYPE(SvRV(ka_rv))==SVt_PVAV)) { sv_setiv(DBIc_ERR(imp_sth), 1); sv_setpvf(DBIc_ERRSTR(imp_sth), "Can't use attribute '%s' because it doesn't contain a reference to an array (%s)", keyattrib, neatsvpv(ka_rv,0)); XSRETURN_UNDEF; } ka_av = (AV*)SvRV(ka_rv); hv = newHV(); for (i=0; i < num_fields; ++i) { /* honor the original order as sent by the database */ SV **field_name_svp = av_fetch(ka_av, i, 1); (void)hv_store_ent(hv, *field_name_svp, newSVsv((SV*)(AvARRAY(rowav)[i])), 0); } RETVAL = newRV_inc((SV*)hv); SvREFCNT_dec(hv); /* since newRV incremented it */ } else { RETVAL = &PL_sv_undef; } SvREFCNT_dec(ka_rv); /* since we created it */ OUTPUT: RETVAL void fetch(sth) SV * sth ALIAS: fetchrow_arrayref = 1 CODE: int num_fields; if (CvDEPTH(cv) == 99) { PERL_UNUSED_VAR(ix); croak("Deep recursion. Probably fetch-fetchrow-fetch loop."); } PUSHMARK(sp); XPUSHs(sth); PUTBACK; num_fields = call_method("fetchrow", G_LIST); /* XXX change the name later */ SPAGAIN; if (num_fields == 0) { ST(0) = &PL_sv_undef; } else { D_imp_sth(sth); AV *av = dbih_get_fbav(imp_sth); if (num_fields != AvFILL(av)+1) croak("fetchrow returned %d fields, expected %d", num_fields, (int)AvFILL(av)+1); SPAGAIN; while(--num_fields >= 0) sv_setsv(AvARRAY(av)[num_fields], POPs); PUTBACK; ST(0) = sv_2mortal(newRV_inc((SV*)av)); } void rows(sth) SV * sth CODE: D_imp_sth(sth); const IV rows = DBIc_ROW_COUNT(imp_sth); ST(0) = sv_2mortal(newSViv(rows)); (void)cv; void finish(sth) SV * sth CODE: D_imp_sth(sth); DBIc_ACTIVE_off(imp_sth); ST(0) = &PL_sv_yes; (void)cv; void DESTROY(sth) SV * sth PPCODE: /* keep in sync with DESTROY in Driver.xst */ D_imp_sth(sth); ST(0) = &PL_sv_yes; /* we don't test IMPSET here because this code applies to pure-perl drivers */ if (DBIc_IADESTROY(imp_sth)) { /* want's ineffective destroy */ DBIc_ACTIVE_off(imp_sth); if (DBIc_TRACE_LEVEL(imp_sth)) PerlIO_printf(DBIc_LOGPIO(imp_sth), " DESTROY %s skipped due to InactiveDestroy\n", SvPV_nolen(sth)); } if (DBIc_ACTIVE(imp_sth)) { D_imp_dbh_from_sth; if (!PL_dirty && DBIc_ACTIVE(imp_dbh)) { dSP; PUSHMARK(sp); XPUSHs(sth); PUTBACK; call_method("finish", G_SCALAR); SPAGAIN; PUTBACK; } else { DBIc_ACTIVE_off(imp_sth); } } MODULE = DBI PACKAGE = DBI::st void TIEHASH(class, inner_ref) SV * class SV * inner_ref CODE: HV *stash = gv_stashsv(class, GV_ADDWARN); /* a new hash is supplied to us, we just need to bless and apply tie magic */ sv_bless(inner_ref, stash); ST(0) = inner_ref; MODULE = DBI PACKAGE = DBD::_::common void DESTROY(h) SV * h CODE: /* DESTROY defined here just to avoid AUTOLOAD */ (void)cv; (void)h; ST(0) = &PL_sv_undef; void STORE(h, keysv, valuesv) SV * h SV * keysv SV * valuesv CODE: ST(0) = &PL_sv_yes; if (!dbih_set_attr_k(h, keysv, 0, valuesv)) ST(0) = &PL_sv_no; (void)cv; void FETCH(h, keysv) SV * h SV * keysv PREINIT: SV *ret; CODE: ret = dbih_get_attr_k(h, keysv, 0); ST(0) = ret; (void)cv; void DELETE(h, keysv) SV * h SV * keysv PREINIT: SV *ret; CODE: /* only private_* keys can be deleted, for others DELETE acts like FETCH */ /* because the DBI internals rely on certain handle attributes existing */ if (strnEQ(SvPV_nolen(keysv),"private_",8)) ret = hv_delete_ent((HV*)SvRV(h), keysv, 0, 0); else ret = dbih_get_attr_k(h, keysv, 0); ST(0) = ret; (void)cv; void private_data(h) SV * h CODE: D_imp_xxh(h); (void)cv; ST(0) = sv_mortalcopy(DBIc_IMP_DATA(imp_xxh)); void err(h) SV * h CODE: D_imp_xxh(h); SV *errsv = DBIc_ERR(imp_xxh); (void)cv; ST(0) = sv_mortalcopy(errsv); void state(h) SV * h CODE: D_imp_xxh(h); SV *state = DBIc_STATE(imp_xxh); (void)cv; ST(0) = DBIc_STATE_adjust(imp_xxh, state); void errstr(h) SV * h CODE: D_imp_xxh(h); SV *errstr = DBIc_ERRSTR(imp_xxh); SV *err; /* If there's no errstr but there is an err then use err */ (void)cv; if (!SvTRUE(errstr) && (err=DBIc_ERR(imp_xxh)) && SvTRUE(err)) errstr = err; ST(0) = sv_mortalcopy(errstr); void set_err(h, err, errstr=&PL_sv_no, state=&PL_sv_undef, method=&PL_sv_undef, result=Nullsv) SV * h SV * err SV * errstr SV * state SV * method SV * result PPCODE: { D_imp_xxh(h); SV **sem_svp; (void)cv; if (DBIc_has(imp_xxh, DBIcf_HandleSetErr) && SvREADONLY(method)) method = sv_mortalcopy(method); /* HandleSetErr may want to change it */ if (!set_err_sv(h, imp_xxh, err, errstr, state, method)) { /* set_err was canceled by HandleSetErr, */ /* don't set "dbi_set_err_method", return an empty list */ } else { /* store provided method name so handler code can find it */ sem_svp = hv_fetchs((HV*)SvRV(h), "dbi_set_err_method", 1); if (SvOK(method)) { sv_setpv(*sem_svp, SvPV_nolen(method)); } else (void)SvOK_off(*sem_svp); XPUSHs( result ? result : &PL_sv_undef ); } /* We don't check RaiseError and call die here because that must be */ /* done by returning through dispatch and letting the DBI handle it */ } int trace(h, level=&PL_sv_undef, file=Nullsv) SV *h SV *level SV *file ALIAS: debug = 1 CODE: RETVAL = set_trace(h, level, file); (void)cv; /* Unused variables */ (void)ix; OUTPUT: RETVAL void trace_msg(sv, msg, this_trace=1) SV *sv const char *msg int this_trace PREINIT: int current_trace; PerlIO *pio; CODE: { dMY_CXT; (void)cv; if (SvROK(sv)) { D_imp_xxh(sv); current_trace = DBIc_TRACE_LEVEL(imp_xxh); pio = DBIc_LOGPIO(imp_xxh); } else { /* called as a static method */ current_trace = DBIS_TRACE_FLAGS; pio = DBILOGFP; } if (DBIc_TRACE_MATCHES(this_trace, current_trace)) { PerlIO_puts(pio, msg); ST(0) = &PL_sv_yes; } else { ST(0) = &PL_sv_no; } } void rows(h) SV * h CODE: /* fallback esp for $DBI::rows after $drh was last used */ ST(0) = sv_2mortal(newSViv(-1)); (void)h; (void)cv; void swap_inner_handle(rh1, rh2, allow_reparent=0) SV * rh1 SV * rh2 IV allow_reparent CODE: { D_impdata(imp_xxh1, imp_xxh_t, rh1); D_impdata(imp_xxh2, imp_xxh_t, rh2); SV *h1i = dbih_inner(aTHX_ rh1, "swap_inner_handle"); SV *h2i = dbih_inner(aTHX_ rh2, "swap_inner_handle"); SV *h1 = (rh1 == h1i) ? (SV*)DBIc_MY_H(imp_xxh1) : SvRV(rh1); SV *h2 = (rh2 == h2i) ? (SV*)DBIc_MY_H(imp_xxh2) : SvRV(rh2); (void)cv; if (DBIc_TYPE(imp_xxh1) != DBIc_TYPE(imp_xxh2)) { char buf[99]; sprintf(buf, "Can't swap_inner_handle between %sh and %sh", dbih_htype_name(DBIc_TYPE(imp_xxh1)), dbih_htype_name(DBIc_TYPE(imp_xxh2))); DBIh_SET_ERR_CHAR(rh1, imp_xxh1, "1", 1, buf, Nullch, Nullch); XSRETURN_NO; } if (!allow_reparent && DBIc_PARENT_COM(imp_xxh1) != DBIc_PARENT_COM(imp_xxh2)) { DBIh_SET_ERR_CHAR(rh1, imp_xxh1, "1", 1, "Can't swap_inner_handle with handle from different parent", Nullch, Nullch); XSRETURN_NO; } (void)SvREFCNT_inc(h1i); (void)SvREFCNT_inc(h2i); sv_unmagic(h1, 'P'); /* untie(%$h1) */ sv_unmagic(h2, 'P'); /* untie(%$h2) */ sv_magic(h1, h2i, 'P', Nullch, 0); /* tie %$h1, $h2i */ DBIc_MY_H(imp_xxh2) = (HV*)h1; sv_magic(h2, h1i, 'P', Nullch, 0); /* tie %$h2, $h1i */ DBIc_MY_H(imp_xxh1) = (HV*)h2; SvREFCNT_dec(h1i); SvREFCNT_dec(h2i); ST(0) = &PL_sv_yes; } MODULE = DBI PACKAGE = DBD::_mem::common void DESTROY(imp_xxh_rv) SV * imp_xxh_rv CODE: /* ignore 'cast increases required alignment' warning */ imp_xxh_t *imp_xxh = (imp_xxh_t*)SvPVX(SvRV(imp_xxh_rv)); DBIc_DBISTATE(imp_xxh)->clearcom(imp_xxh); (void)cv; # end DBI-1.648/Driver.xst0000644000031300001440000005655415206027371013404 0ustar00merijnusers# $Id$ # Copyright (c) 2024-2026 DBI Team # Copyright (c) 1997-2024 Tim Bunce Ireland # Copyright (c) 2002 Jonathan Leffler # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. #include "Driver_xst.h" # Historically dbd_db_do4, dbd_st_execute, and dbd_st_rows returned an 'int' type. # That's only 32 bits (31+sign) so isn't sufficient for very large row counts # So now instead of defining those macros, drivers can define dbd_db_do4_iv, # dbd_st_execute_iv, and dbd_st_rows_iv to be the names of functions that # return an 'IV' type. They could also set DBIc_ROW_COUNT(imp_sth). # # To save a mess of #ifdef's we arrange for dbd_st_execute (etc) to work # as dbd_st_execute_iv if that's defined # #if defined(dbd_st_execute_iv) #undef dbd_st_execute #define dbd_st_execute dbd_st_execute_iv #endif #if defined(dbd_st_rows_iv) #undef dbd_st_rows #define dbd_st_rows dbd_st_rows_iv #endif #if defined(dbd_db_do4_iv) #undef dbd_db_do4 #define dbd_db_do4 dbd_db_do4_iv #endif MODULE = DBD::~DRIVER~ PACKAGE = DBD::~DRIVER~ REQUIRE: 1.929 PROTOTYPES: DISABLE BOOT: PERL_UNUSED_VAR(items); DBISTATE_INIT; /* XXX this interface will change: */ DBI_IMP_SIZE("DBD::~DRIVER~::dr::imp_data_size", sizeof(imp_drh_t)); DBI_IMP_SIZE("DBD::~DRIVER~::db::imp_data_size", sizeof(imp_dbh_t)); DBI_IMP_SIZE("DBD::~DRIVER~::st::imp_data_size", sizeof(imp_sth_t)); dbd_init(DBIS); # ------------------------------------------------------------ # driver level interface # ------------------------------------------------------------ MODULE = DBD::~DRIVER~ PACKAGE = DBD::~DRIVER~::dr void dbixs_revision(...) PPCODE: ST(0) = sv_2mortal(newSViv(DBIXS_REVISION)); #ifdef dbd_discon_all # disconnect_all renamed and ALIAS'd to avoid length clash on VMS :-( bool discon_all_(drh) SV * drh ALIAS: disconnect_all = 1 CODE: D_imp_drh(drh); PERL_UNUSED_VAR(ix); RETVAL = dbd_discon_all(drh, imp_drh); OUTPUT: RETVAL #endif /* dbd_discon_all */ #ifdef dbd_dr_data_sources void data_sources(drh, attr = Nullsv) SV *drh SV *attr PPCODE: { D_imp_drh(drh); AV *av = dbd_dr_data_sources(drh, imp_drh, attr); if (av) { int i; int n = AvFILL(av)+1; EXTEND(sp, n); for (i = 0; i < n; ++i) { PUSHs(AvARRAY(av)[i]); } } } #endif # ------------------------------------------------------------ # database level interface # ------------------------------------------------------------ MODULE = DBD::~DRIVER~ PACKAGE = DBD::~DRIVER~::db bool _login(dbh, dbname, username, password, attribs=Nullsv) SV * dbh SV * dbname SV * username SV * password SV * attribs CODE: { D_imp_dbh(dbh); #if !defined(dbd_db_login6_sv) STRLEN lna; char *u = (SvOK(username)) ? SvPV(username,lna) : (char*)""; char *p = (SvOK(password)) ? SvPV(password,lna) : (char*)""; #endif #ifdef dbd_db_login6_sv RETVAL = dbd_db_login6_sv(dbh, imp_dbh, dbname, username, password, attribs); #elif defined(dbd_db_login6) RETVAL = dbd_db_login6(dbh, imp_dbh, SvPV_nolen(dbname), u, p, attribs); #else PERL_UNUSED_ARG(attribs); RETVAL = dbd_db_login( dbh, imp_dbh, SvPV_nolen(dbname), u, p); #endif } OUTPUT: RETVAL void selectall_arrayref(...) PREINIT: SV *sth; SV **maxrows_svp; SV **tmp_svp; SV *tmp_sv; SV *attr = &PL_sv_undef; imp_sth_t *imp_sth; CODE: if (items > 2) { attr = ST(2); if (SvROK(attr) && (DBD_ATTRIB_TRUE(attr,"Slice",5,tmp_svp) || DBD_ATTRIB_TRUE(attr,"Columns",7,tmp_svp)) ) { /* fallback to perl implementation */ SV *tmp =dbixst_bounce_method("DBD::~DRIVER~::db::SUPER::selectall_arrayref", items); SPAGAIN; ST(0) = tmp; XSRETURN(1); } } /* --- prepare --- */ if (SvROK(ST(1))) { MAGIC *mg; sth = ST(1); /* switch to inner handle if not already */ if ( (mg = mg_find(SvRV(sth),'P')) ) sth = mg->mg_obj; } else { sth = dbixst_bounce_method("prepare", 3); SPAGAIN; SP -= items; /* because stack might have been realloc'd */ if (!SvROK(sth)) XSRETURN_UNDEF; /* switch to inner handle */ sth = mg_find(SvRV(sth),'P')->mg_obj; } imp_sth = (imp_sth_t*)(DBIh_COM(sth)); /* --- bind_param --- */ if (items > 3) { /* need to bind params before execute */ if (!dbdxst_bind_params(sth, imp_sth, items-2, ax+2) ) { XSRETURN_UNDEF; } } /* --- execute --- */ DBIc_ROW_COUNT(imp_sth) = 0; if ( dbd_st_execute(sth, imp_sth) <= -2 ) { /* -2 == error */ XSRETURN_UNDEF; } /* --- fetchall --- */ maxrows_svp = DBD_ATTRIB_GET_SVP(attr, "MaxRows", 7); tmp_sv = dbdxst_fetchall_arrayref(sth, &PL_sv_undef, (maxrows_svp) ? *maxrows_svp : &PL_sv_undef); SPAGAIN; ST(0) = tmp_sv; void selectrow_arrayref(...) ALIAS: selectrow_array = 1 PREINIT: int is_selectrow_array = (ix == 1); imp_sth_t *imp_sth; SV *sth; AV *row_av; PPCODE: if (SvROK(ST(1))) { MAGIC *mg; sth = ST(1); /* switch to inner handle if not already */ if ( (mg = mg_find(SvRV(sth),'P')) ) sth = mg->mg_obj; } else { /* --- prepare --- */ sth = dbixst_bounce_method("prepare", 3); SPAGAIN; SP -= items; /* because stack might have been realloc'd */ if (!SvROK(sth)) { if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } } /* switch to inner handle */ sth = mg_find(SvRV(sth),'P')->mg_obj; } imp_sth = (imp_sth_t*)(DBIh_COM(sth)); /* --- bind_param --- */ if (items > 3) { /* need to bind params before execute */ if (!dbdxst_bind_params(sth, imp_sth, items-2, ax+2) ) { if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } } } /* --- execute --- */ DBIc_ROW_COUNT(imp_sth) = 0; if ( dbd_st_execute(sth, imp_sth) <= -2 ) { /* -2 == error */ if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; } } /* --- fetchrow_arrayref --- */ row_av = dbd_st_fetch(sth, imp_sth); if (!row_av) { if (GIMME_V == G_SCALAR) PUSHs(&PL_sv_undef); } else if (is_selectrow_array) { int i; int num_fields = AvFILL(row_av)+1; if (GIMME_V == G_SCALAR) num_fields = 1; /* return just first field */ EXTEND(sp, num_fields); for(i=0; i < num_fields; ++i) { PUSHs(AvARRAY(row_av)[i]); } } else { PUSHs( sv_2mortal(newRV((SV *)row_av)) ); } /* --- finish --- */ #ifdef dbd_st_finish3 dbd_st_finish3(sth, imp_sth, 0); #else dbd_st_finish(sth, imp_sth); #endif #if defined(dbd_db_do6) || defined(dbd_db_do4) void do(dbh, statement, params = Nullsv, ...) SV * dbh SV * statement SV * params CODE: { D_imp_dbh(dbh); IV retval; #ifdef dbd_db_do6 /* items is a number of arguments passed to XSUB, supplied by xsubpp compiler */ /* ax contains stack base offset used by ST() macro, supplied by xsubpp compiler */ I32 offset = (items >= 3) ? 3 : items; retval = dbd_db_do6(dbh, imp_dbh, statement, params, items-offset, ax+offset); #else if (items > 3) croak_xs_usage(cv, "dbh, statement, params = Nullsv"); retval = dbd_db_do4(dbh, imp_dbh, SvPV_nolen(statement), params); /* might be dbd_db_do4_iv via macro */ #endif /* remember that dbd_db_do* must return <= -2 for error */ if (retval == 0) /* ok with no rows affected */ XST_mPV(0, "0E0"); /* (true but zero) */ else if (retval < -1) /* -1 == unknown number of rows */ XST_mUNDEF(0); /* <= -2 means error */ else XST_mIV(0, retval); /* typically 1, rowcount or -1 */ } #endif #ifdef dbd_db_last_insert_id void last_insert_id(dbh, catalog=&PL_sv_undef, schema=&PL_sv_undef, table=&PL_sv_undef, field=&PL_sv_undef, attr=Nullsv) SV * dbh SV * catalog SV * schema SV * table SV * field SV * attr CODE: { D_imp_dbh(dbh); SV *ret = dbd_db_last_insert_id(dbh, imp_dbh, catalog, schema, table, field, attr); ST(0) = ret; } #endif bool commit(dbh) SV * dbh CODE: D_imp_dbh(dbh); if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) warn("commit ineffective with AutoCommit enabled"); RETVAL = dbd_db_commit(dbh, imp_dbh); OUTPUT: RETVAL bool rollback(dbh) SV * dbh CODE: D_imp_dbh(dbh); if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh)) warn("rollback ineffective with AutoCommit enabled"); RETVAL = dbd_db_rollback(dbh, imp_dbh); OUTPUT: RETVAL bool disconnect(dbh) SV * dbh CODE: D_imp_dbh(dbh); if ( !DBIc_ACTIVE(imp_dbh) ) { XSRETURN_YES; } /* Check for disconnect() being called whilst refs to cursors */ /* still exists. This possibly needs some more thought. */ if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) { STRLEN lna; char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? (char*)"" : (char*)"s"; warn("%s->disconnect invalidates %d active statement handle%s %s", SvPV(dbh,lna), (int)DBIc_ACTIVE_KIDS(imp_dbh), plural, "(either destroy statement handles or call finish on them before disconnecting)"); } RETVAL = dbd_db_disconnect(dbh, imp_dbh); DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ OUTPUT: RETVAL void STORE(dbh, keysv, valuesv) SV * dbh SV * keysv SV * valuesv CODE: D_imp_dbh(dbh); if (SvGMAGICAL(valuesv)) mg_get(valuesv); ST(0) = &PL_sv_yes; if (!dbd_db_STORE_attrib(dbh, imp_dbh, keysv, valuesv)) if (!DBIc_DBISTATE(imp_dbh)->set_attr(dbh, keysv, valuesv)) ST(0) = &PL_sv_no; void FETCH(dbh, keysv) SV * dbh SV * keysv CODE: D_imp_dbh(dbh); SV *valuesv = dbd_db_FETCH_attrib(dbh, imp_dbh, keysv); if (!valuesv) valuesv = DBIc_DBISTATE(imp_dbh)->get_attr(dbh, keysv); ST(0) = valuesv; /* dbd_db_FETCH_attrib did sv_2mortal */ void DESTROY(dbh) SV * dbh PPCODE: /* keep in sync with default DESTROY in DBI.xs */ D_imp_dbh(dbh); ST(0) = &PL_sv_yes; if (!DBIc_IMPSET(imp_dbh)) { /* was never fully set up */ STRLEN lna; if (DBIc_WARN(imp_dbh) && !PL_dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2) PerlIO_printf(DBIc_LOGPIO(imp_dbh), " DESTROY for %s ignored - handle not initialised\n", SvPV(dbh,lna)); } else { if (DBIc_IADESTROY(imp_dbh)) { /* wants ineffective destroy */ DBIc_ACTIVE_off(imp_dbh); if (DBIc_DBISTATE(imp_dbh)->debug) PerlIO_printf(DBIc_LOGPIO(imp_dbh), " DESTROY %s skipped due to InactiveDestroy\n", SvPV_nolen(dbh)); } if (DBIc_ACTIVE(imp_dbh)) { if (!DBIc_has(imp_dbh,DBIcf_AutoCommit)) { /* Application is using transactions and hasn't explicitly disconnected. Some databases will automatically commit on graceful disconnect. Since we're about to gracefully disconnect as part of the DESTROY we want to be sure we're not about to implicitly commit changes that are incomplete and should be rolled back. (The DESTROY may be due to a RaiseError, for example.) So we rollback here. This will be harmless if the application has issued a commit, XXX Could add an attribute flag to indicate that the driver doesn't have this problem. Patches welcome. */ if (DBIc_WARN(imp_dbh) /* only warn if likely to be useful... */ && DBIc_is(imp_dbh, DBIcf_Executed) /* has not just called commit/rollback */ /* && !DBIc_is(imp_dbh, DBIcf_ReadOnly) -- is not read only */ && (!PL_dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3) ) { warn("Issuing rollback() due to DESTROY without explicit disconnect() of %s handle %s", SvPV_nolen(*hv_fetchs((HV*)SvRV(dbh), "ImplementorClass", 1)), SvPV_nolen(*hv_fetchs((HV*)SvRV(dbh), "Name", 1)) ); } dbd_db_rollback(dbh, imp_dbh); /* ROLLBACK! */ } dbd_db_disconnect(dbh, imp_dbh); DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ } dbd_db_destroy(dbh, imp_dbh); } #ifdef dbd_take_imp_data void take_imp_data(h) SV * h CODE: D_imp_xxh(h); /* dbd_take_imp_data() returns &sv_no (or other defined but false value) * to indicate "preparations complete, now call SUPER::take_imp_data" for me. * Anything else is returned to the caller via sv_2mortal(sv), typically that * would be &sv_undef for error or an SV holding the imp_data. */ SV *sv = dbd_take_imp_data(h, imp_xxh, NULL); if (SvOK(sv) && !SvTRUE(sv)) { SV *tmp = dbixst_bounce_method("DBD::~DRIVER~::db::SUPER::take_imp_data", items); SPAGAIN; ST(0) = tmp; } else { ST(0) = sv_2mortal(sv); } #endif #ifdef dbd_db_data_sources void data_sources(dbh, attr = Nullsv) SV *dbh SV *attr PPCODE: { D_imp_dbh(dbh); AV *av = dbd_db_data_sources(dbh, imp_dbh, attr); if (av) { int i; int n = AvFILL(av)+1; EXTEND(sp, n); for (i = 0; i < n; ++i) { PUSHs(AvARRAY(av)[i]); } } } #endif # -- end of DBD::~DRIVER~::db # ------------------------------------------------------------ # statement interface # ------------------------------------------------------------ MODULE = DBD::~DRIVER~ PACKAGE = DBD::~DRIVER~::st bool _prepare(sth, statement, attribs=Nullsv) SV * sth SV * statement SV * attribs CODE: { D_imp_sth(sth); DBD_ATTRIBS_CHECK("_prepare", sth, attribs); #ifdef dbd_st_prepare_sv RETVAL = dbd_st_prepare_sv(sth, imp_sth, statement, attribs); #else RETVAL = dbd_st_prepare(sth, imp_sth, SvPV_nolen(statement), attribs); #endif } OUTPUT: RETVAL #ifdef dbd_st_rows void rows(sth) SV * sth CODE: D_imp_sth(sth); XST_mIV(0, dbd_st_rows(sth, imp_sth)); #endif /* dbd_st_rows */ #ifdef dbd_st_bind_col bool bind_col(sth, col, ref, attribs=Nullsv) SV * sth SV * col SV * ref SV * attribs CODE: { IV sql_type = 0; D_imp_sth(sth); if (SvGMAGICAL(ref)) mg_get(ref); if (attribs) { if (SvNIOK(attribs)) { sql_type = SvIV(attribs); attribs = Nullsv; } else { SV **svp; DBD_ATTRIBS_CHECK("bind_col", sth, attribs); /* XXX we should perhaps complain if TYPE is not SvNIOK */ DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); } } switch(dbd_st_bind_col(sth, imp_sth, col, ref, sql_type, attribs)) { case 2: RETVAL = TRUE; /* job done completely */ break; case 1: /* fallback to DBI default */ RETVAL = DBIc_DBISTATE(imp_sth)->bind_col(sth, col, ref, attribs); break; default: RETVAL = FALSE; /* dbd_st_bind_col has called set_err */ break; } } OUTPUT: RETVAL #endif /* dbd_st_bind_col */ bool bind_param(sth, param, value, attribs=Nullsv) SV * sth SV * param SV * value SV * attribs CODE: { IV sql_type = 0; D_imp_sth(sth); if (SvGMAGICAL(value)) mg_get(value); if (attribs) { if (SvNIOK(attribs)) { sql_type = SvIV(attribs); attribs = Nullsv; } else { SV **svp; DBD_ATTRIBS_CHECK("bind_param", sth, attribs); /* XXX we should perhaps complain if TYPE is not SvNIOK */ DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); } } RETVAL = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, FALSE, 0); } OUTPUT: RETVAL bool bind_param_inout(sth, param, value_ref, maxlen, attribs=Nullsv) SV * sth SV * param SV * value_ref IV maxlen SV * attribs CODE: { IV sql_type = 0; D_imp_sth(sth); SV *value; if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG) croak("bind_param_inout needs a reference to a scalar value"); value = SvRV(value_ref); if (SvREADONLY(value)) croak("Modification of a read-only value attempted"); if (SvGMAGICAL(value)) mg_get(value); if (attribs) { if (SvNIOK(attribs)) { sql_type = SvIV(attribs); attribs = Nullsv; } else { SV **svp; DBD_ATTRIBS_CHECK("bind_param", sth, attribs); DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); } } RETVAL = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, TRUE, maxlen); } OUTPUT: RETVAL void execute(sth, ...) SV * sth CODE: D_imp_sth(sth); IV retval; if (items > 1) { /* need to bind params */ if (!dbdxst_bind_params(sth, imp_sth, items, ax) ) { XSRETURN_UNDEF; } } /* XXX this code is duplicated in selectrow_arrayref above */ DBIc_ROW_COUNT(imp_sth) = 0; retval = dbd_st_execute(sth, imp_sth); /* might be dbd_st_execute_iv via macro */ /* remember that dbd_st_execute must return <= -2 for error */ if (retval == 0) /* ok with no rows affected */ XST_mPV(0, "0E0"); /* (true but zero) */ else if (retval < -1) /* -1 == unknown number of rows */ XST_mUNDEF(0); /* <= -2 means error */ else XST_mIV(0, retval); /* typically 1, rowcount or -1 */ #ifdef dbd_st_execute_for_fetch void execute_for_fetch(sth, fetch_tuple_sub, tuple_status = Nullsv) SV * sth SV * fetch_tuple_sub SV * tuple_status CODE: { D_imp_sth(sth); SV *ret = dbd_st_execute_for_fetch(sth, imp_sth, fetch_tuple_sub, tuple_status); ST(0) = ret; } #endif #ifdef dbd_st_last_insert_id void last_insert_id(sth, catalog=&PL_sv_undef, schema=&PL_sv_undef, table=&PL_sv_undef, field=&PL_sv_undef, attr=Nullsv) SV * sth SV * catalog SV * schema SV * table SV * field SV * attr CODE: { D_imp_sth(sth); SV *ret = dbd_st_last_insert_id(sth, imp_sth, catalog, schema, table, field, attr); ST(0) = ret; } #endif void fetchrow_arrayref(sth) SV * sth ALIAS: fetch = 1 CODE: D_imp_sth(sth); AV *av; PERL_UNUSED_VAR(ix); av = dbd_st_fetch(sth, imp_sth); ST(0) = (av) ? sv_2mortal(newRV((SV *)av)) : &PL_sv_undef; void fetchrow_array(sth) SV * sth ALIAS: fetchrow = 1 PPCODE: D_imp_sth(sth); AV *av; av = dbd_st_fetch(sth, imp_sth); if (av) { int i; int num_fields = AvFILL(av)+1; EXTEND(sp, num_fields); for(i=0; i < num_fields; ++i) { PUSHs(AvARRAY(av)[i]); } PERL_UNUSED_VAR(ix); } void fetchall_arrayref(sth, slice=&PL_sv_undef, batch_row_count=&PL_sv_undef) SV * sth SV * slice SV * batch_row_count CODE: if (SvOK(slice)) { /* fallback to perl implementation */ SV *tmp = dbixst_bounce_method("DBD::~DRIVER~::st::SUPER::fetchall_arrayref", 3); SPAGAIN; ST(0) = tmp; } else { SV *tmp = dbdxst_fetchall_arrayref(sth, slice, batch_row_count); SPAGAIN; ST(0) = tmp; } bool finish(sth) SV * sth CODE: D_imp_sth(sth); D_imp_dbh_from_sth; if (!DBIc_ACTIVE(imp_sth)) { /* No active statement to finish */ XSRETURN_YES; } if (!DBIc_ACTIVE(imp_dbh)) { /* Either an explicit disconnect() or global destruction */ /* has disconnected us from the database. Finish is meaningless */ DBIc_ACTIVE_off(imp_sth); XSRETURN_YES; } #ifdef dbd_st_finish3 RETVAL = dbd_st_finish3(sth, imp_sth, 0); #else RETVAL = dbd_st_finish(sth, imp_sth); #endif OUTPUT: RETVAL void blob_read(sth, field, offset, len, destrv=Nullsv, destoffset=0) SV * sth int field long offset long len SV * destrv long destoffset CODE: { D_imp_sth(sth); if (!destrv) destrv = sv_2mortal(newRV(sv_2mortal(newSV(0)))); if (dbd_st_blob_read(sth, imp_sth, field, offset, len, destrv, destoffset)) ST(0) = SvRV(destrv); else ST(0) = &PL_sv_undef; } void STORE(sth, keysv, valuesv) SV * sth SV * keysv SV * valuesv CODE: D_imp_sth(sth); if (SvGMAGICAL(valuesv)) mg_get(valuesv); ST(0) = &PL_sv_yes; if (!dbd_st_STORE_attrib(sth, imp_sth, keysv, valuesv)) if (!DBIc_DBISTATE(imp_sth)->set_attr(sth, keysv, valuesv)) ST(0) = &PL_sv_no; # FETCH renamed and ALIAS'd to avoid case clash on VMS :-( void FETCH_attrib(sth, keysv) SV * sth SV * keysv ALIAS: FETCH = 1 CODE: D_imp_sth(sth); SV *valuesv; PERL_UNUSED_VAR(ix); valuesv = dbd_st_FETCH_attrib(sth, imp_sth, keysv); if (!valuesv) valuesv = DBIc_DBISTATE(imp_sth)->get_attr(sth, keysv); ST(0) = valuesv; /* dbd_st_FETCH_attrib did sv_2mortal */ void DESTROY(sth) SV * sth PPCODE: /* keep in sync with default DESTROY in DBI.xs */ D_imp_sth(sth); ST(0) = &PL_sv_yes; if (!DBIc_IMPSET(imp_sth)) { /* was never fully set up */ STRLEN lna; if (DBIc_WARN(imp_sth) && !PL_dirty && DBIc_DBISTATE(imp_sth)->debug >= 2) PerlIO_printf(DBIc_LOGPIO(imp_sth), " DESTROY for %s ignored - handle not initialised\n", SvPV(sth,lna)); } else { if (DBIc_IADESTROY(imp_sth)) { /* wants ineffective destroy */ DBIc_ACTIVE_off(imp_sth); if (DBIc_DBISTATE(imp_sth)->debug) PerlIO_printf(DBIc_LOGPIO(imp_sth), " DESTROY %s skipped due to InactiveDestroy\n", SvPV_nolen(sth)); } if (DBIc_ACTIVE(imp_sth)) { D_imp_dbh_from_sth; if (!PL_dirty && DBIc_ACTIVE(imp_dbh)) { #ifdef dbd_st_finish3 dbd_st_finish3(sth, imp_sth, 1); #else dbd_st_finish(sth, imp_sth); #endif } else { DBIc_ACTIVE_off(imp_sth); } } dbd_st_destroy(sth, imp_sth); } # end of ~DRIVER~.xst # vim:ts=8:sw=4:et DBI-1.648/DBIXS.h0000644000031300001440000006313415207245733012430 0ustar00merijnusers/* vim: ts=8:sw=4:expandtab * * $Id$ * * Copyright (c) 2024-2026 DBI Team * Copyright (c) 1994-2024 Tim Bunce Ireland * * See COPYRIGHT section in DBI.pm for usage and distribution rights. */ /* DBI Interface Definitions for DBD Modules */ #ifndef DBIXS_VERSION /* prevent multiple inclusion */ /* define DBIXS_VERSION & DBIXS_REVISION */ #include "dbixs_rev.h" #ifndef DBIS #define DBIS dbis /* default name for dbistate_t variable */ #endif /* Here for backwards compat. PERL_POLLUTE was removed in perl 5.13.3 */ #define PERL_POLLUTE /* first pull in the standard Perl header files for extensions */ #include #include #include #ifdef debug /* causes problems with DBIS->debug */ #undef debug #endif #ifdef std /* causes problems with STLport */ #undef std #endif /* Perl backwards compatibility definitions */ #define NEED_sv_2pv_flags #define NEED_croak_xs_usage #include "dbipport.h" /* DBI SQL_* type definitions */ #include "dbi_sql.h" #ifdef NEED_DBIXS_VERSION #if NEED_DBIXS_VERSION > DBIXS_VERSION error You_need_to_upgrade_your_DBI_module_before_building_this_driver #endif #else #define NEED_DBIXS_VERSION DBIXS_VERSION #endif #define DBI_LOCK #define DBI_UNLOCK #ifndef DBI_NO_THREADS #ifdef USE_ITHREADS #define DBI_USE_THREADS #endif /* USE_ITHREADS */ #endif /* DBI_NO_THREADS */ /* forward struct declarations */ typedef struct dbistate_st dbistate_t; /* implementor needs to define actual struct { dbih_??c_t com; ... }*/ typedef struct imp_drh_st imp_drh_t; /* driver */ typedef struct imp_dbh_st imp_dbh_t; /* database */ typedef struct imp_sth_st imp_sth_t; /* statement */ typedef struct imp_fdh_st imp_fdh_t; /* field descriptor */ typedef struct imp_xxh_st imp_xxh_t; /* any (defined below) */ #define DBI_imp_data_ imp_xxh_t /* friendly for take_imp_data */ /* --- DBI Handle Common Data Structure (all handles have one) --- */ /* Handle types. Code currently assumes child = parent + 1. */ #define DBIt_DR 1 #define DBIt_DB 2 #define DBIt_ST 3 #define DBIt_FD 4 /* component structures */ typedef struct dbih_com_std_st { U32 flags; int call_depth; /* used by DBI to track nested calls (int) */ U16 type; /* DBIt_DR, DBIt_DB, DBIt_ST */ HV *my_h; /* copy of outer handle HV (not refcounted) */ SV *parent_h; /* parent inner handle (ref to hv) (r.c.inc) */ imp_xxh_t *parent_com; /* parent com struct shortcut */ PerlInterpreter * thr_user; /* thread that owns the handle */ HV *imp_stash; /* who is the implementor for this handle */ SV *imp_data; /* optional implementors data (for perl imp's) */ I32 kids; /* count of db's for dr's, st's for db's etc */ I32 active_kids; /* kids which are currently DBIc_ACTIVE */ U32 pid; /* pid of process that created handle */ dbistate_t *dbistate; } dbih_com_std_t; typedef struct dbih_com_attr_st { /* These are copies of the Hash values (ref.cnt.inc'd) */ /* Many of the hash values are themselves references */ SV *TraceLevel; SV *State; /* Standard SQLSTATE, 5 char string */ SV *Err; /* Native engine error code */ SV *Errstr; /* Native engine error message */ UV ErrCount; U32 LongReadLen; /* auto read length for long/blob types */ SV *FetchHashKeyName; /* for fetchrow_hashref */ /* (NEW FIELDS?... DON'T FORGET TO UPDATE dbih_clearcom()!) */ } dbih_com_attr_t; struct dbih_com_st { /* complete core structure (typedef'd above) */ dbih_com_std_t std; dbih_com_attr_t attr; }; /* This 'implementors' type the DBI defines by default as a way to */ /* refer to the imp_??h data of a handle without considering its type. */ struct imp_xxh_st { struct dbih_com_st com; }; /* Define handle-type specific structures for implementors to include */ /* at the start of their private structures. */ typedef struct { /* -- DRIVER -- */ dbih_com_std_t std; dbih_com_attr_t attr; HV *_old_cached_kids; /* not used, here for binary compat */ } dbih_drc_t; typedef struct { /* -- DATABASE -- */ dbih_com_std_t std; /* \__ standard structure */ dbih_com_attr_t attr; /* / plus... (nothing else right now) */ HV *_old_cached_kids; /* not used, here for binary compat */ } dbih_dbc_t; typedef struct { /* -- STATEMENT -- */ dbih_com_std_t std; /* \__ standard structure */ dbih_com_attr_t attr; /* / plus ... */ int num_params; /* number of placeholders */ int num_fields; /* NUM_OF_FIELDS, must be set */ AV *fields_svav; /* special row buffer (inc bind_cols) */ IV row_count; /* incremented by get_fbav() */ AV *fields_fdav; /* not used yet, may change */ I32 spare1; void *spare2; } dbih_stc_t; /* XXX THIS STRUCTURE SHOULD NOT BE USED */ typedef struct { /* -- FIELD DESCRIPTOR -- */ dbih_com_std_t std; /* standard structure (not fully setup) */ /* core attributes (from DescribeCol in ODBC) */ char *col_name; /* see dbih_make_fdsv */ I16 col_name_len; I16 col_sql_type; I16 col_precision; I16 col_scale; I16 col_nullable; /* additional attributes (from ColAttributes in ODBC) */ I32 col_length; I32 col_disp_size; I32 spare1; void *spare2; } dbih_fdc_t; #define _imp2com(p,f) ((p)->com.f) /* private */ #define DBIc_FLAGS(imp) _imp2com(imp, std.flags) #define DBIc_TYPE(imp) _imp2com(imp, std.type) #define DBIc_CALL_DEPTH(imp) _imp2com(imp, std.call_depth) #define DBIc_MY_H(imp) _imp2com(imp, std.my_h) #define DBIc_PARENT_H(imp) _imp2com(imp, std.parent_h) #define DBIc_PARENT_COM(imp) _imp2com(imp, std.parent_com) #define DBIc_THR_COND(imp) _imp2com(imp, std.thr_cond) #define DBIc_THR_USER(imp) _imp2com(imp, std.thr_user) #define DBIc_THR_USER_NONE (0xFFFF) #define DBIc_IMP_STASH(imp) _imp2com(imp, std.imp_stash) #define DBIc_IMP_DATA(imp) _imp2com(imp, std.imp_data) #define DBIc_DBISTATE(imp) _imp2com(imp, std.dbistate) #define DBIc_LOGPIO(imp) DBIc_DBISTATE(imp)->logfp #define DBIc_KIDS(imp) _imp2com(imp, std.kids) #define DBIc_ACTIVE_KIDS(imp) _imp2com(imp, std.active_kids) #define DBIc_LAST_METHOD(imp) _imp2com(imp, std.last_method) /* d = DBD flags, l = DBD level (needs to be shifted down) * D - DBI flags, r = reserved, L = DBI trace level * Trace level bit allocation: 0xddlDDDrL */ #define DBIc_TRACE_LEVEL_MASK 0x0000000F #define DBIc_TRACE_FLAGS_MASK 0xFF0FFF00 /* includes DBD flag bits for DBIc_TRACE */ #define DBIc_TRACE_SETTINGS(imp) (DBIc_DBISTATE(imp)->debug) #define DBIc_TRACE_LEVEL(imp) (DBIc_TRACE_SETTINGS(imp) & DBIc_TRACE_LEVEL_MASK) #define DBIc_TRACE_FLAGS(imp) (DBIc_TRACE_SETTINGS(imp) & DBIc_TRACE_FLAGS_MASK) /* DBI defined trace flags */ #define DBIf_TRACE_SQL 0x00000100 #define DBIf_TRACE_CON 0x00000200 #define DBIf_TRACE_ENC 0x00000400 #define DBIf_TRACE_DBD 0x00000800 #define DBIf_TRACE_TXN 0x00001000 #define DBDc_TRACE_LEVEL_MASK 0x00F00000 #define DBDc_TRACE_LEVEL_SHIFT 20 #define DBDc_TRACE_LEVEL(imp) ( (DBIc_TRACE_SETTINGS(imp) & DBDc_TRACE_LEVEL_MASK) >> DBDc_TRACE_LEVEL_SHIFT ) #define DBDc_TRACE_LEVEL_set(imp, l) ( DBIc_TRACE_SETTINGS(imp) |= (((l) << DBDc_TRACE_LEVEL_SHIFT) & DBDc_TRACE_LEVEL_MASK )) /* DBIc_TRACE_MATCHES(this, crnt): true if this 'matches' (is within) crnt DBIc_TRACE_MATCHES(foo, DBIc_TRACE_SETTINGS(imp)) */ #define DBIc_TRACE_MATCHES(this, crnt) \ ( ((crnt & DBIc_TRACE_LEVEL_MASK) >= (this & DBIc_TRACE_LEVEL_MASK)) \ || ((crnt & DBIc_TRACE_FLAGS_MASK) & (this & DBIc_TRACE_FLAGS_MASK)) ) /* DBIc_TRACE(imp, flags, flag_level, fallback_level) True if flags match the handle trace flags & handle trace level >= flag_level, OR if handle trace_level > fallback_level (typically > flag_level). This is the main trace testing macro to be used by drivers. (Drivers should define their own DBDf_TRACE_* macros for the top 8 bits: 0xFF000000) DBIc_TRACE(imp, 0, 0, 4) = if trace level >= 4 DBIc_TRACE(imp, DBDf_TRACE_FOO, 2, 4) = if tracing DBDf_FOO & level>=2 or level>=4 DBIc_TRACE(imp, DBDf_TRACE_FOO, 2, 0) = as above but never trace just due to level e.g. if (DBIc_TRACE(imp_xxh, DBIf_TRACE_SQL|DBIf_TRACE_xxx, 2, 0)) { PerlIO_printf(DBIc_LOGPIO(imp_sth), "\tThe %s wibbled the %s\n", ...); } */ #define DBIc_TRACE(imp, flags, flaglevel, level) \ ( (flags && (DBIc_TRACE_FLAGS(imp) & flags) && (DBIc_TRACE_LEVEL(imp) >= flaglevel)) \ || (level && DBIc_TRACE_LEVEL(imp) >= level) ) /* Deprecated, but cannot be removed, becaused used in e.g. DBD::Oracle :( */ #define DBIc_DEBUG(imp) (_imp2com(imp, attr.TraceLevel)) /* deprecated */ #define DBIc_DEBUGIV(imp) SvIV(DBIc_DEBUG(imp)) /* deprecated */ #define DBIc_STATE(imp) SvRV(_imp2com(imp, attr.State)) #define DBIc_ERR(imp) SvRV(_imp2com(imp, attr.Err)) #define DBIc_ERRSTR(imp) SvRV(_imp2com(imp, attr.Errstr)) #define DBIc_ErrCount(imp) _imp2com(imp, attr.ErrCount) #define DBIc_LongReadLen(imp) _imp2com(imp, attr.LongReadLen) #define DBIc_LongReadLen_init 80 /* may change */ #define DBIc_FetchHashKeyName(imp) (_imp2com(imp, attr.FetchHashKeyName)) /* handle sub-type specific fields */ /* dbh & drh */ #define DBIc_CACHED_KIDS(imp) Nullhv /* no longer used, here for src compat */ /* sth */ #define DBIc_NUM_FIELDS(imp) _imp2com(imp, num_fields) #define DBIc_NUM_PARAMS(imp) _imp2com(imp, num_params) #define DBIc_NUM_PARAMS_AT_EXECUTE -9 /* see Driver.xst */ #define DBIc_ROW_COUNT(imp) _imp2com(imp, row_count) #define DBIc_FIELDS_AV(imp) _imp2com(imp, fields_svav) #define DBIc_FDESC_AV(imp) _imp2com(imp, fields_fdav) #define DBIc_FDESC(imp, i) ((imp_fdh_t*)(void*)SvPVX(AvARRAY(DBIc_FDESC_AV(imp))[i])) /* XXX --- DO NOT CHANGE THESE VALUES AS THEY ARE COMPILED INTO DRIVERS --- XXX */ #define DBIcf_COMSET 0x000001 /* needs to be clear'd before free'd */ #define DBIcf_IMPSET 0x000002 /* has implementor data to be clear'd */ #define DBIcf_ACTIVE 0x000004 /* needs finish/disconnect before clear */ #define DBIcf_IADESTROY 0x000008 /* do DBIc_ACTIVE_off before DESTROY */ #define DBIcf_WARN 0x000010 /* warn about poor practice etc */ #define DBIcf_COMPAT 0x000020 /* compat/emulation mode (eg oraperl) */ #define DBIcf_ChopBlanks 0x000040 /* rtrim spaces from fetch char columns */ #define DBIcf_RaiseError 0x000080 /* throw exception (croak) on error */ #define DBIcf_PrintError 0x000100 /* warn() on error */ #define DBIcf_AutoCommit 0x000200 /* dbh only. used by drivers */ #define DBIcf_LongTruncOk 0x000400 /* truncation to LongReadLen is okay */ #define DBIcf_MultiThread 0x000800 /* allow multiple threads to enter */ #define DBIcf_HandleSetErr 0x001000 /* has coderef HandleSetErr attribute */ #define DBIcf_ShowErrorStatement 0x002000 /* include Statement in error */ #define DBIcf_BegunWork 0x004000 /* between begin_work & commit/rollback */ #define DBIcf_HandleError 0x008000 /* has coderef in HandleError attribute */ #define DBIcf_Profile 0x010000 /* profile activity on this handle */ #define DBIcf_TaintIn 0x020000 /* check inputs for taintedness */ #define DBIcf_TaintOut 0x040000 /* taint outgoing data */ #define DBIcf_Executed 0x080000 /* do/execute called since commit/rollb */ #define DBIcf_PrintWarn 0x100000 /* warn() on warning (err="0") */ #define DBIcf_Callbacks 0x200000 /* has Callbacks attribute hash */ #define DBIcf_AIADESTROY 0x400000 /* auto DBIcf_IADESTROY if pid changes */ #define DBIcf_RaiseWarn 0x800000 /* throw exception (croak) on warn */ /* NOTE: new flags may require clone() to be updated */ #define DBIcf_INHERITMASK /* what NOT to pass on to children */ \ (U32)( DBIcf_COMSET | DBIcf_IMPSET | DBIcf_ACTIVE | DBIcf_IADESTROY \ | DBIcf_AutoCommit | DBIcf_BegunWork | DBIcf_Executed | DBIcf_Callbacks ) /* general purpose bit setting and testing macros */ #define DBIbf_is( bitset,flag) ((bitset) & (flag)) #define DBIbf_has(bitset,flag) DBIbf_is(bitset, flag) /* alias for _is */ #define DBIbf_on( bitset,flag) ((bitset) |= (flag)) #define DBIbf_off(bitset,flag) ((bitset) &= ~(flag)) #define DBIbf_set(bitset,flag,on) ((on) ? DBIbf_on(bitset, flag) : DBIbf_off(bitset,flag)) /* as above, but specifically for DBIc_FLAGS imp flags (except ACTIVE) */ #define DBIc_is(imp, flag) DBIbf_is( DBIc_FLAGS(imp), flag) #define DBIc_has(imp,flag) DBIc_is(imp, flag) /* alias for DBIc_is */ #define DBIc_on(imp, flag) DBIbf_on( DBIc_FLAGS(imp), flag) #define DBIc_off(imp,flag) DBIbf_off(DBIc_FLAGS(imp), flag) #define DBIc_set(imp,flag,on) DBIbf_set(DBIc_FLAGS(imp), flag, on) #define DBIc_COMSET(imp) DBIc_is(imp, DBIcf_COMSET) #define DBIc_COMSET_on(imp) DBIc_on(imp, DBIcf_COMSET) #define DBIc_COMSET_off(imp) DBIc_off(imp,DBIcf_COMSET) #define DBIc_IMPSET(imp) DBIc_is(imp, DBIcf_IMPSET) #define DBIc_IMPSET_on(imp) DBIc_on(imp, DBIcf_IMPSET) #define DBIc_IMPSET_off(imp) DBIc_off(imp,DBIcf_IMPSET) #define DBIc_ACTIVE(imp) (DBIc_FLAGS(imp) & DBIcf_ACTIVE) #define DBIc_ACTIVE_on(imp) /* adjust parent's active kid count */ \ do { \ imp_xxh_t *ph_com = DBIc_PARENT_COM(imp); \ if (!DBIc_ACTIVE(imp) && ph_com && !PL_dirty \ && ++DBIc_ACTIVE_KIDS(ph_com) > DBIc_KIDS(ph_com)) \ croak("panic: DBI active kids (%ld) > kids (%ld)", \ (long)DBIc_ACTIVE_KIDS(ph_com), \ (long)DBIc_KIDS(ph_com)); \ DBIc_FLAGS(imp) |= DBIcf_ACTIVE; \ } while(0) #define DBIc_ACTIVE_off(imp) /* adjust parent's active kid count */ \ do { \ imp_xxh_t *ph_com = DBIc_PARENT_COM(imp); \ if (DBIc_ACTIVE(imp) && ph_com && !PL_dirty \ && (--DBIc_ACTIVE_KIDS(ph_com) > DBIc_KIDS(ph_com) \ || DBIc_ACTIVE_KIDS(ph_com) < 0) ) \ croak("panic: DBI active kids (%ld) < 0 or > kids (%ld)", \ (long)DBIc_ACTIVE_KIDS(ph_com), \ (long)DBIc_KIDS(ph_com)); \ DBIc_FLAGS(imp) &= ~DBIcf_ACTIVE; \ } while(0) #define DBIc_IADESTROY(imp) (DBIc_FLAGS(imp) & DBIcf_IADESTROY) #define DBIc_IADESTROY_on(imp) (DBIc_FLAGS(imp) |= DBIcf_IADESTROY) #define DBIc_IADESTROY_off(imp) (DBIc_FLAGS(imp) &= ~DBIcf_IADESTROY) #define DBIc_AIADESTROY(imp) (DBIc_FLAGS(imp) & DBIcf_AIADESTROY) #define DBIc_AIADESTROY_on(imp) (DBIc_FLAGS(imp) |= DBIcf_AIADESTROY) #define DBIc_AIADESTROY_off(imp) (DBIc_FLAGS(imp) &= ~DBIcf_AIADESTROY) #define DBIc_WARN(imp) (DBIc_FLAGS(imp) & DBIcf_WARN) #define DBIc_WARN_on(imp) (DBIc_FLAGS(imp) |= DBIcf_WARN) #define DBIc_WARN_off(imp) (DBIc_FLAGS(imp) &= ~DBIcf_WARN) #define DBIc_COMPAT(imp) (DBIc_FLAGS(imp) & DBIcf_COMPAT) #define DBIc_COMPAT_on(imp) (DBIc_FLAGS(imp) |= DBIcf_COMPAT) #define DBIc_COMPAT_off(imp) (DBIc_FLAGS(imp) &= ~DBIcf_COMPAT) #ifdef IN_DBI_XS /* get Handle Common Data Structure */ #define DBIh_COM(h) (dbih_getcom2(aTHX_ h, 0)) #else #define DBIh_COM(h) (DBIS->getcom(h)) #define neatsvpv(sv,len) (DBIS->neat_svpv(sv,len)) #endif /* --- For sql_type_cast_svpv() --- */ #define DBIstcf_DISCARD_STRING 0x0001 #define DBIstcf_STRICT 0x0002 /* --- Implementors Private Data Support --- */ #define D_impdata(name,type,h) type *name = (type*)(DBIh_COM(h)) #define D_imp_drh(h) D_impdata(imp_drh, imp_drh_t, h) #define D_imp_dbh(h) D_impdata(imp_dbh, imp_dbh_t, h) #define D_imp_sth(h) D_impdata(imp_sth, imp_sth_t, h) #define D_imp_xxh(h) D_impdata(imp_xxh, imp_xxh_t, h) #define D_imp_from_child(name,type,child) \ type *name = (type*)(DBIc_PARENT_COM(child)) #define D_imp_drh_from_dbh D_imp_from_child(imp_drh, imp_drh_t, imp_dbh) #define D_imp_dbh_from_sth D_imp_from_child(imp_dbh, imp_dbh_t, imp_sth) #define DBI_IMP_SIZE(n,s) sv_setiv(get_sv((n), GV_ADDMULTI), (s)) /* XXX */ /* --- Event Support (VERY LIABLE TO CHANGE) --- */ #define DBIh_EVENTx(h,t,a1,a2) /* deprecated XXX */ &PL_sv_no #define DBIh_EVENT0(h,t) DBIh_EVENTx((h), (t), &PL_sv_undef, &PL_sv_undef) #define DBIh_EVENT1(h,t, a1) DBIh_EVENTx((h), (t), (a1), &PL_sv_undef) #define DBIh_EVENT2(h,t, a1,a2) DBIh_EVENTx((h), (t), (a1), (a2)) #define ERROR_event "ERROR" #define WARN_event "WARN" #define MSG_event "MESSAGE" #define DBEVENT_event "DBEVENT" #define UNKNOWN_event "UNKNOWN" #define DBIh_SET_ERR_SV(h,i, err, errstr, state, method) \ (DBIc_DBISTATE(i)->set_err_sv(h,i, err, errstr, state, method)) #define DBIh_SET_ERR_CHAR(h,i, err_c, err_i, errstr, state, method) \ (DBIc_DBISTATE(i)->set_err_char(h,i, err_c, err_i, errstr, state, method)) /* --- Handy Macros --- */ #define DBIh_CLEAR_ERROR(imp_xxh) (void)( \ (void)SvOK_off(DBIc_ERR(imp_xxh)), \ (void)SvOK_off(DBIc_ERRSTR(imp_xxh)), \ (void)SvOK_off(DBIc_STATE(imp_xxh)) \ ) /* --- DBI State Structure --- */ struct dbistate_st { /* DBISTATE_VERSION is checked at runtime via DBISTATE_INIT and check_version. * It should be incremented on incompatible changes to dbistate_t structure. * Additional function pointers being assigned from spare padding, where the * size of the structure doesn't change, doesn't require an increment. * Incrementing forces all XS drivers to need to be recompiled. * (See also DBIXS_REVISION as a driver source compatibility tool.) */ #define DBISTATE_VERSION 94 /* ++ on incompatible dbistate_t changes */ /* this must be the first member in structure */ void (*check_version) _((const char *name, int dbis_cv, int dbis_cs, int need_dbixs_cv, int drc_s, int dbc_s, int stc_s, int fdc_s)); /* version and size are used to check for DBI/DBD version mis-match */ U16 version; /* version of this structure */ U16 size; U16 xs_version; /* version of the overall DBIXS / DBD interface */ U16 spare_pad; I32 debug; PerlIO *logfp; /* pointers to DBI functions which the DBD's will want to use */ char * (*neat_svpv) _((SV *sv, STRLEN maxlen)); imp_xxh_t * (*getcom) _((SV *h)); /* see DBIh_COM macro */ void (*clearcom) _((imp_xxh_t *imp_xxh)); SV * (*event) _((SV *h, const char *name, SV*, SV*)); int (*set_attr_k) _((SV *h, SV *keysv, int dbikey, SV *valuesv)); SV * (*get_attr_k) _((SV *h, SV *keysv, int dbikey)); AV * (*get_fbav) _((imp_sth_t *imp_sth)); SV * (*make_fdsv) _((SV *sth, const char *imp_class, STRLEN imp_size, const char *col_name)); int (*bind_as_num) _((int sql_type, int p, int s, int *t, void *v)); /* XXX deprecated */ I32 (*hash) _((const char *string, long i)); SV * (*preparse) _((SV *sth, char *statement, IV ps_return, IV ps_accept, void *foo)); SV *neatsvpvlen; /* only show dbgpvlen chars when debugging pv's */ PerlInterpreter * thr_owner; /* thread that owns this dbistate */ int (*logmsg) _((imp_xxh_t *imp_xxh, const char *fmt, ...)); int (*set_err_sv) _((SV *h, imp_xxh_t *imp_xxh, SV *err, SV *errstr, SV *state, SV *method)); int (*set_err_char) _((SV *h, imp_xxh_t *imp_xxh, const char *err, IV err_i, const char *errstr, const char *state, const char *method)); int (*bind_col) _((SV *sth, SV *col, SV *ref, SV *attribs)); IO *logfp_ref; /* keep ptr to filehandle for refcounting */ int (*sql_type_cast_svpv) _((pTHX_ SV *sv, int sql_type, U32 flags, void *v)); /* WARNING: Only add new structure members here, and reduce pad2 to keep */ /* the memory footprint exactly the same */ void *pad2[3]; }; /* macros for backwards compatibility */ #define set_attr(h, k, v) set_attr_k(h, k, 0, v) #define get_attr(h, k) get_attr_k(h, k, 0) #define DBILOGFP (DBIS->logfp) #ifdef IN_DBI_XS #define DBILOGMSG (dbih_logmsg) #else #define DBILOGMSG (DBIS->logmsg) #endif /* --- perl object (ActiveState) / multiplicity hooks and hoops --- */ /* note that USE_ITHREADS implies MULTIPLICITY */ typedef dbistate_t** (*_dbi_state_lval_t)(pTHX); # define _DBISTATE_DECLARE_COMMON \ static _dbi_state_lval_t dbi_state_lval_p = 0; \ static dbistate_t** dbi_get_state(pTHX) { \ if (!dbi_state_lval_p) { \ CV *cv = get_cv("DBI::_dbi_state_lval", 0); \ if (!cv) \ croak("Unable to get DBI state function. DBI not loaded."); \ dbi_state_lval_p = (_dbi_state_lval_t)(void *)CvXSUB(cv); \ } \ return dbi_state_lval_p(aTHX); \ } \ typedef int dummy_dbistate /* keep semicolon from feeling lonely */ #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || defined(PERL_CAPI) # define DBISTATE_DECLARE _DBISTATE_DECLARE_COMMON # define _DBISTATE_INIT_DBIS # undef DBIS # define DBIS (*dbi_get_state(aTHX)) # define dbis DBIS /* temp for old drivers using 'dbis' instead of 'DBIS' */ #else /* plain and simple non perl object / multiplicity case */ # define DBISTATE_DECLARE \ static dbistate_t *DBIS; \ _DBISTATE_DECLARE_COMMON # define _DBISTATE_INIT_DBIS DBIS = *dbi_get_state(aTHX); #endif # define DBISTATE_INIT { /* typically use in BOOT: of XS file */ \ _DBISTATE_INIT_DBIS \ if (DBIS == NULL) \ croak("Unable to get DBI state. DBI not loaded."); \ DBIS->check_version(__FILE__, DBISTATE_VERSION, sizeof(*DBIS), NEED_DBIXS_VERSION, \ sizeof(dbih_drc_t), sizeof(dbih_dbc_t), sizeof(dbih_stc_t), sizeof(dbih_fdc_t) \ ); \ } /* --- Assorted Utility Macros --- */ #define DBD_ATTRIB_OK(attribs) /* is this a usable attrib value */ \ (attribs && SvROK(attribs) && SvTYPE(SvRV(attribs))==SVt_PVHV) /* If attribs value supplied then croak if it's not a hash ref. */ /* Also map undef to Null. Should always be called to pre-process the */ /* attribs value. One day we may add some extra magic in here. */ #define DBD_ATTRIBS_CHECK(func, h, attribs) \ if ((attribs) && SvOK(attribs)) { \ if (!SvROK(attribs) || SvTYPE(SvRV(attribs))!=SVt_PVHV) \ croak("%s->%s(...): attribute parameter '%s' is not a hash ref", \ SvPV_nolen(h), func, SvPV_nolen(attribs)); \ } else (attribs) = Nullsv #define DBD_ATTRIB_GET_SVP(attribs, key,klen) \ (DBD_ATTRIB_OK(attribs) \ ? hv_fetch((HV*)SvRV(attribs), key,klen, 0) \ : (SV **)Nullsv) #define DBD_ATTRIB_GET_IV(attribs, key,klen, svp, var) \ if ((svp=DBD_ATTRIB_GET_SVP(attribs, key,klen)) != NULL) \ var = SvIV(*svp) #define DBD_ATTRIB_GET_UV(attribs, key,klen, svp, var) \ if ((svp=DBD_ATTRIB_GET_SVP(attribs, key,klen)) != NULL) \ var = SvUV(*svp) #define DBD_ATTRIB_GET_BOOL(attribs, key,klen, svp, var) \ if ((svp=DBD_ATTRIB_GET_SVP(attribs, key,klen)) != NULL) \ var = SvTRUE(*svp) #define DBD_ATTRIB_TRUE(attribs, key,klen, svp) \ ( ((svp=DBD_ATTRIB_GET_SVP(attribs, key,klen)) != NULL) \ ? SvTRUE(*svp) : 0 ) #define DBD_ATTRIB_GET_PV(attribs, key,klen, svp, dflt) \ (((svp=DBD_ATTRIB_GET_SVP(attribs, key,klen)) != NULL) \ ? SvPV_nolen(*svp) : (dflt)) #define DBD_ATTRIB_DELETE(attribs, key, klen) \ hv_delete((HV*)SvRV(attribs), key, klen, G_DISCARD) #endif /* DBIXS_VERSION */ /* end of DBIXS.h */ DBI-1.648/dbiproxy.PL0000644000031300001440000001353414656646601013510 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- my $file = $ARGV[0] || 'dbiproxy'; my $script = <<'SCRIPT'; ~startperl~ use strict; my $VERSION = sprintf("1.%06d", q$Revision$ =~ /(\d+)/o); my $arg_test = shift(@ARGV) if $ARGV[0] eq '--test'; $ENV{DBI_TRACE} = shift(@ARGV) || 2 if $ARGV[0] =~ s/^--dbitrace=?//; require DBI::ProxyServer; # XXX these should probably be moved into DBI::ProxyServer delete $ENV{IFS}; delete $ENV{CDPATH}; delete $ENV{ENV}; delete $ENV{BASH_ENV}; if ($arg_test) { require RPC::PlServer::Test; @DBI::ProxyServer::ISA = qw(RPC::PlServer::Test DBI); } DBI::ProxyServer::main(@ARGV); exit(0); __END__ =head1 NAME dbiproxy - A proxy server for the DBD::Proxy driver =head1 SYNOPSIS dbiproxy --localport= =head1 DESCRIPTION This tool is just a front end for the DBI::ProxyServer package. All it does is picking options from the command line and calling DBI::ProxyServer::main(). See L for details. Available options include: =over 4 =item B<--chroot=dir> (UNIX only) After doing a bind(), change root directory to the given directory by doing a chroot(). This is useful for security, but it restricts the environment a lot. For example, you need to load DBI drivers in the config file or you have to create hard links to Unix sockets, if your drivers are using them. For example, with MySQL, a config file might contain the following lines: my $rootdir = '/var/dbiproxy'; my $unixsockdir = '/tmp'; my $unixsockfile = 'mysql.sock'; foreach $dir ($rootdir, "$rootdir$unixsockdir") { mkdir 0755, $dir; } link("$unixsockdir/$unixsockfile", "$rootdir$unixsockdir/$unixsockfile"); require DBD::mysql; { 'chroot' => $rootdir, ... } If you don't know chroot(), think of an FTP server where you can see a certain directory tree only after logging in. See also the --group and --user options. =item B<--configfile=file> Config files are assumed to return a single hash ref that overrides the arguments of the new method. However, command line arguments in turn take precedence over the config file. See the "CONFIGURATION FILE" section in the L documentation for details on the config file. =item B<--debug> Turn debugging mode on. Mainly this asserts that logging messages of level "debug" are created. =item B<--facility=mode> (UNIX only) Facility to use for L. The default is B. =item B<--group=gid> After doing a bind(), change the real and effective GID to the given. This is useful, if you want your server to bind to a privileged port (<1024), but don't want the server to execute as root. See also the --user option. GID's can be passed as group names or numeric values. =item B<--localaddr=ip> By default a daemon is listening to any IP number that a machine has. This attribute allows one to restrict the server to the given IP number. =item B<--localport=port> This attribute sets the port on which the daemon is listening. It must be given somehow, as there's no default. =item B<--logfile=file> Be default logging messages will be written to the syslog (Unix) or to the event log (Windows NT). On other operating systems you need to specify a log file. The special value "STDERR" forces logging to stderr. See L for details. =item B<--mode=modename> The server can run in three different modes, depending on the environment. If you are running Perl 5.005 and did compile it for threads, then the server will create a new thread for each connection. The thread will execute the server's Run() method and then terminate. This mode is the default, you can force it with "--mode=threads". If threads are not available, but you have a working fork(), then the server will behave similar by creating a new process for each connection. This mode will be used automatically in the absence of threads or if you use the "--mode=fork" option. Finally there's a single-connection mode: If the server has accepted a connection, he will enter the Run() method. No other connections are accepted until the Run() method returns (if the client disconnects). This operation mode is useful if you have neither threads nor fork(), for example on the Macintosh. For debugging purposes you can force this mode with "--mode=single". =item B<--pidfile=file> (UNIX only) If this option is present, a PID file will be created at the given location. Default is to not create a pidfile. =item B<--user=uid> After doing a bind(), change the real and effective UID to the given. This is useful, if you want your server to bind to a privileged port (<1024), but don't want the server to execute as root. See also the --group and the --chroot options. UID's can be passed as group names or numeric values. =item B<--version> Suppresses startup of the server; instead the version string will be printed and the program exits immediately. =back =head1 AUTHOR Copyright (c) 1997 Jochen Wiedmann Am Eisteich 9 72555 Metzingen Germany Email: joe@ispsoft.de Phone: +49 7123 14881 The DBI::ProxyServer module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. In particular permission is granted to Tim Bunce for distributing this as a part of the DBI. =head1 SEE ALSO L, L, L =cut SCRIPT require Config; my $config = {}; $config->{'startperl'} = $Config::Config{'startperl'}; $script =~ s/\~(\w+)\~/$config->{$1}/eg; if (!(open(FILE, ">$file")) || !(print FILE $script) || !(close(FILE))) { die "Error while writing $file: $!\n"; } chmod 0755, $file; print "Extracted $file from ",__FILE__," with variable substitutions.\n"; # syntax check resulting file, but only for developers exit 1 if -d ".svn" || -d ".git" and system($^X, '-wc', '-Mblib', $file) != 0; DBI-1.648/Makefile.PL0000644000031300001440000003177715207245733013370 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- # # $Id$ # # Copyright (c) 2024-2026 DBI Team # Copyright (c) 1994-2024 Tim Bunce Ireland # # See COPYRIGHT section in DBI.pm for usage and distribution rights. use 5.008_001; use ExtUtils::MakeMaker 5.16, qw(WriteMakefile $Verbose prompt); use Getopt::Long; use Config; use File::Find; use File::Spec; use strict; use lib "lib"; # for use DBI::DBD use DBI::DBD; $| = 1; $^W = 1; my $os = $^O; my $osvers = $Config{osvers}; $osvers =~ s/^\s*(\d+\.\d+).*/$1/; # drop sub-sub-version: 2.5.1 -> 2.5 my $ext_pl = $^O eq "VMS" ? ".pl" : ""; my $is_developer = (-d ".git" && -f "MANIFEST.SKIP"); $::opt_v = 0; $::opt_thread = $Config{useithreads}; # thread if we can, use "-nothread" to disable $::opt_g = 0; $::opt_g = 1 if $is_developer && $ENV{LOGNAME} && $ENV{LOGNAME} eq "timbo"; # it's me! (probably) GetOptions (qw(v! g! thread!)) or die "Invalid arguments\n"; $::opt_g &&= "-g"; # convert to actual string if (($ENV{LANG}||"") =~ m/utf-?8/i) { print "\n"; print "*** Your LANG environment variable is set to '$ENV{LANG}'\n"; print "*** This may cause problems for some perl installations.\n"; print "*** If you get test failures, please try again with LANG unset.\n"; print "*** If that then works, please email dbi-dev\@perl.org with details\n"; print "*** including the output of 'perl -V'\n"; print "\n"; sleep 1; } if ($^O eq "MSWin32" && $] < 5.012 && $File::Spec::VERSION < 3.31) { warn "Windows requires File::Spec-3.31, which is CORE as of perl-5.11.3\n"; warn "As this is just perl-$] with File::Spec-$File::Spec::VERSION\n"; exit 1; } my %opts = ( NAME => "DBI", AUTHOR => 'DBI team (dbi-users@perl.org)', VERSION_FROM => "DBI.pm", ABSTRACT_FROM => "DBI.pm", MIN_PERL_VERSION => "5.008001", BUILD_REQUIRES => { "ExtUtils::MakeMaker" => "6.48", "Test::Simple" => "0.90", }, META_MERGE => { resources => { repository => "https://github.com/perl5-dbi/dbi", bugtracker => "https://github.com/perl5-dbi/dbi/issues", MailingList => 'mailto:dbi-dev@perl.org', license => "http://dev.perl.org/licenses/", homepage => "http://dbi.perl.org/", IRC => "irc://irc.perl.org/#dbi", }, suggests => { "RPC::PlServer" => 0.2020, "Net::Daemon" => 0, "SQL::Statement" => 1.414, "Clone" => 0.47, "MLDBM" => 0, "DB_File" => 0, }, }, LICENSE => "perl", EXE_FILES => [ "dbiproxy$ext_pl", "dbiprof$ext_pl", "dbilogstrip$ext_pl" ], DIR => [ ], dynamic_lib => { OTHERLDFLAGS => "$::opt_g", }, clean => { FILES => "\$(DISTVNAME) Perl.xsi t/zv*_*.t dbi__null_test_tmp* test_output_*" ." dbiproxy$ext_pl dbiprof$ext_pl dbilogstrip$ext_pl dbiproxy.*log dbitrace.log dbi*.prof ndtest.prt" }, dist => { DIST_DEFAULT => "clean distcheck disttest tardist", PREOP => '$(MAKE) -f Makefile.old distdir', COMPRESS => "gzip -v9", SUFFIX => "gz", }, macro => { TARFLAGS => "--format=ustar -c -v -f", }, ); $opts{CAPI} = "TRUE" if $Config{archname} =~ /-object\b/i; if (my $gccversion = $Config{gccversion}) { # ask gcc to be more pedantic if ($gccversion =~ m/ clang ([0-9][-0-9.]*)/i) { print "Your perl was compiled with Clang (version $1). As this is not GCC, version checking is skipped.\n"; # https://clang.llvm.org/docs/DiagnosticsReference.html $opts{DEFINE} .= " -W -Wall -Wpointer-arith"; $opts{DEFINE} .= " -Wno-comment -Wno-sign-compare -Wno-cast-qual"; $opts{DEFINE} .= " -Wmissing-noreturn -Wno-unused-parameter"; $opts{DEFINE} .= " -Wno-compound-token-split-by-macro -Wno-constant-conversion"; $opts{DEFINE} .= " -Wno-implicit-const-int-float-conversion"; if ($is_developer && $::opt_g) { $opts{DEFINE} .= " -Wmissing-prototypes"; } } else { warn "WARNING: Your GNU C $gccversion compiler is very old. Please upgrade it and rebuild perl.\n" if $gccversion =~ m/^\D*(1|2\.[1-8])\b/; print "Your perl was compiled with gcc (version $Config{gccversion}), okay.\n"; $gccversion =~ s/[^\d\.]//g; # just a number please $opts{DEFINE} .= " -W -Wall -Wpointer-arith"; $opts{DEFINE} .= " -Wno-comment -Wno-sign-compare -Wno-cast-qual"; $opts{DEFINE} .= " -Wmissing-noreturn -Wno-unused-parameter" if $gccversion ge "3.0"; if ($is_developer && $::opt_g) { $opts{DEFINE} .= " -DPERL_GCC_PEDANTIC -ansi -pedantic" if $gccversion ge "3.0"; $opts{DEFINE} .= " -Wdisabled-optimization -Wformat" if $gccversion ge "3.0"; $opts{DEFINE} .= " -Wmissing-prototypes"; } } } $opts{DEFINE} .= " -DDBI_NO_THREADS" unless $::opt_thread; # HP-UX 9 cannot link a non-PIC object file into a shared library. # Since the # .a libs that Oracle supplies contain non-PIC object # files, we sadly have to build static on HP-UX 9 :( if ($os eq "hpux" and $osvers < 10) { $opts{LINKTYPE} = "static"; print "Warning: Forced to build static not dynamic on $os $osvers.\a\n"; print "** Note: DBI will be built *into* a NEW perl binary. You MUST use that new perl.\n"; print " See README and Makefile.PL for more information.\a\n"; } if ($os eq "MSWin32" && $Config{libs} =~ /\bPerlCRT.lib\b/ && -f "$Config{archlib}/CORE/PerlCRT.lib") { # ActiveState Perl needs this; should better be done in MakeMaker, but # as a temporary workaround it seems ok. $opts{LIBS} = "-L$Config{archlib}/CORE"; } # Set aside some values for post_initialize() in package MY my ($cfg_privlibexp, $cfg_archlibexp, $cfg_sitelibexp, $cfg_sitearchexp, $cfg_man3direxp) = @Config{qw( privlibexp archlibexp sitelibexp sitearchexp man3direxp )}; for ($cfg_privlibexp, $cfg_archlibexp, $cfg_sitelibexp, $cfg_sitearchexp, $cfg_man3direxp) { $_ = "" unless defined $_; } my $conflictMsg = < 1, create_nano_tests => 1, create_gap_tests => 1, }) ); # WriteMakefile call is last thing executed # so return value is propagated # ===================================================================== package MY; sub postamble { warn <= 5.024 && -d "xt" && -d "sandbox" && ($ENV{AUTOMATED_TESTING} || 0) != 1) ? join "\n" => 'test ::', ' -@env TEST_FILES="xt/*.t" make -e test_dynamic', '' : ""; return join "\n" => $min_vsn; } # postamble sub libscan { my ($self, $path) = @_; ($path =~ /\~$|\B\.git\b/) ? undef : $path; } # libscan sub const_cccmd { my $self = shift; local ($_) = $self->SUPER::const_cccmd (@_); # If perl Makefile.PL *-g* then switch on debugging if ($::opt_g) { s/\s-O\d?\b//; # delete optimise option s/\s-/ -g -/; # add -g option } $_; } # const_cccmd sub post_initialize { my $self = shift; if ($cfg_privlibexp ne $cfg_sitelibexp) { # this block could probably be removed now my %old; File::Find::find (sub { local $_ = $File::Find::name; s{\\}{/}g if $os eq "MSWin32"; $File::Find::prune = 1, return if -d $_ && ($_ eq $cfg_sitelibexp || $_ eq $cfg_sitearchexp || $_ eq $cfg_man3direxp); ++$old{$_} if m{\bDB(I|D$)}; # DBI files, but just DBD dirs }, $cfg_privlibexp, $cfg_archlibexp); if (%old) { warn " Warning: By default new modules are installed into your 'site_lib' directories. Since site_lib directories come after the normal library directories you must delete old DBI files and directories from your 'privlib' and 'archlib' directories and their auto subdirectories. Reinstall DBI and your DBD::* drivers after deleting the old directories. Here's a list of probable old files and directories: " . join ("\n ", (sort keys %old), "\n" ); } } # install files that DBD's may need File::Find::find (sub { # may be '.' or '[]' depending on File::Find version $_ = "." if $^O eq "VMS" && $_ eq File::Spec->curdir; $File::Find::prune = 1, return if -d $_ && "." ne $_; $self->{PM}->{$_} = File::Spec->catfile ($self->{INST_ARCHAUTODIR}, $_) if ".h" eq substr ($_, -2) || ".xst" eq substr ($_, -4); }, "."); delete $self->{$_}{"git-svn-vsn.pl"} for qw( PM MAN3PODS ); return ""; } # post_initialize sub post_constants { my $self = shift; # ensure that Driver.xst and related code gets tested my $xst = main::dbd_postamble (); $xst =~ s/\$\(BASEEXT\)/Perl/g; $xst .= ' dbixs_rev.h: DBIXS.h Driver_xst.h dbipport.h dbivport.h dbixs_rev.pl $(PERL) dbixs_rev.pl DBI.c: Perl$(OBJ_EXT) # make Changes file available as installed pod docs "perldoc DBI::Changes" inst_libdbi = ' . File::Spec->catdir ($self->{INST_LIB}, 'DBI') . ' changes_pm1 = ' . File::Spec->catfile ('lib', 'DBI', 'Changes.pm') . ' changes_pm2 = ' . File::Spec->catfile ($self->{INST_LIB}, 'DBI', 'Changes.pm') . ' '.q{ config :: $(changes_pm1) $(NOECHO) $(NOOP) $(changes_pm1): ChangeLog $(MKPATH) $(inst_libdbi) $(RM_F) $(changes_pm1) $(changes_pm2) perl changes2pm.pl $(changes_pm2): $(changes_pm1) $(CP) $(changes_pm1) $(changes_pm2) ptest: all prove --blib --jobs 8 --shuffle .PHONY: doc change changes spellcheck checkpod newdist changes: $(changes_pm1) doc: perl dbixs_rev.pl perl doc/make-doc.pl --pod spellcheck checkpod: doc pod-spell-check -i -a doc/*.pod dbipport: perl sandbox/genPPPort_h.pl ppport: dbipport.h perl dbipport.h --compat-version=5.8.1 DBI.xs # make dist does not remove existing .tar.gz causing questions newdist: -@rm -f $(DISTVNAME).tar.gz $(DISTVNAME).tgz tgzdist: changes spellcheck newdist dist -@mv -f $(DISTVNAME).tar.gz $(DISTVNAME).tgz -@cpants_lint.pl $(DISTVNAME).tgz -@rm -f Debian_CPANTS.txt }; return $xst; } # post_constants sub processPL { my $super = shift->SUPER::processPL (@_); $super =~ s/^(dbi\w+ :: dbi\w+\.PL pm_to_blib)/$1 \$(INST_DYNAMIC)/gm; return $super; } # processPL 1; DBI-1.648/LICENSE0000644000031300001440000004707715206027377012424 0ustar00merijnusersDBI is Copyright (c) 1994-2026 by Tim Bunce, the DBI Team and others. See LICENSE included with this distribution. All rights reserved. This is free software; you can redistribute it and/or modify it under the same terms as the Perl5 (v5.0.0 ~ v5.20.0) programming language system itself: under the terms of either: a) the "Artistic License 1.0" as published by The Perl Foundation http://www.perlfoundation.org/artistic_license_1_0 b) the GNU General Public License as published by the Free Software Foundation; either version 1 http://www.gnu.org/licenses/gpl-1.0.html or (at your option) any later version PLEASE NOTE: It is the current maintainers intention to keep the dual licensing intact. Until this notice is removed, releases will continue to be available under both the standard GPL and the less restrictive Artistic licenses. Verbatim copies of both licenses are included below: --- The Artistic License 1.0 --- The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. --- end of The Artistic License 1.0 --- --- The GNU General Public License, Version 1, February 1989 --- GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- end of The GNU General Public License, Version 1, February 1989 --- DBI-1.648/dbi_sql.h0000644000031300001440000000716712127465144013176 0ustar00merijnusers/* $Id$ * * Copyright (c) 1997,1998,1999 Tim Bunce England * * See COPYRIGHT section in DBI.pm for usage and distribution rights. */ /* Some core SQL CLI standard (ODBC) declarations */ #ifndef SQL_SUCCESS /* don't clash with ODBC based drivers */ /* SQL datatype codes */ #define SQL_GUID (-11) #define SQL_WLONGVARCHAR (-10) #define SQL_WVARCHAR (-9) #define SQL_WCHAR (-8) #define SQL_BIT (-7) #define SQL_TINYINT (-6) #define SQL_BIGINT (-5) #define SQL_LONGVARBINARY (-4) #define SQL_VARBINARY (-3) #define SQL_BINARY (-2) #define SQL_LONGVARCHAR (-1) #define SQL_UNKNOWN_TYPE 0 #define SQL_ALL_TYPES 0 #define SQL_CHAR 1 #define SQL_NUMERIC 2 #define SQL_DECIMAL 3 #define SQL_INTEGER 4 #define SQL_SMALLINT 5 #define SQL_FLOAT 6 #define SQL_REAL 7 #define SQL_DOUBLE 8 #define SQL_DATETIME 9 #define SQL_DATE 9 #define SQL_INTERVAL 10 #define SQL_TIME 10 #define SQL_TIMESTAMP 11 #define SQL_VARCHAR 12 #define SQL_BOOLEAN 16 #define SQL_UDT 17 #define SQL_UDT_LOCATOR 18 #define SQL_ROW 19 #define SQL_REF 20 #define SQL_BLOB 30 #define SQL_BLOB_LOCATOR 31 #define SQL_CLOB 40 #define SQL_CLOB_LOCATOR 41 #define SQL_ARRAY 50 #define SQL_ARRAY_LOCATOR 51 #define SQL_MULTISET 55 #define SQL_MULTISET_LOCATOR 56 #define SQL_TYPE_DATE 91 #define SQL_TYPE_TIME 92 #define SQL_TYPE_TIMESTAMP 93 #define SQL_TYPE_TIME_WITH_TIMEZONE 94 #define SQL_TYPE_TIMESTAMP_WITH_TIMEZONE 95 #define SQL_INTERVAL_YEAR 101 #define SQL_INTERVAL_MONTH 102 #define SQL_INTERVAL_DAY 103 #define SQL_INTERVAL_HOUR 104 #define SQL_INTERVAL_MINUTE 105 #define SQL_INTERVAL_SECOND 106 #define SQL_INTERVAL_YEAR_TO_MONTH 107 #define SQL_INTERVAL_DAY_TO_HOUR 108 #define SQL_INTERVAL_DAY_TO_MINUTE 109 #define SQL_INTERVAL_DAY_TO_SECOND 110 #define SQL_INTERVAL_HOUR_TO_MINUTE 111 #define SQL_INTERVAL_HOUR_TO_SECOND 112 #define SQL_INTERVAL_MINUTE_TO_SECOND 113 /* Main return codes */ #define SQL_ERROR (-1) #define SQL_SUCCESS 0 #define SQL_SUCCESS_WITH_INFO 1 #define SQL_NO_DATA_FOUND 100 /* * for ODBC SQL Cursor Types */ #define SQL_CURSOR_FORWARD_ONLY 0UL #define SQL_CURSOR_KEYSET_DRIVEN 1UL #define SQL_CURSOR_DYNAMIC 2UL #define SQL_CURSOR_STATIC 3UL #define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY #endif /* SQL_SUCCESS */ /* Handy macro for testing for success and success with info. */ /* BEWARE that this macro can have side effects since rc appears twice! */ /* So DONT use it as if(SQL_ok(func(...))) { ... } */ #define SQL_ok(rc) ((rc)==SQL_SUCCESS || (rc)==SQL_SUCCESS_WITH_INFO) /* end of dbi_sql.h */ DBI-1.648/typemap0000644000031300001440000000010012127465144012766 0ustar00merijnusersconst char * T_PV imp_xxh_t * T_PTROBJ DBI_imp_data_ * T_PTROBJ DBI-1.648/Driver_xst.h0000644000031300001440000000755615046577337013727 0ustar00merijnusers/* # $Id$ # Copyright (c) 2002 Tim Bunce Ireland # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the Perl README file. */ /* This is really just a workaround for SUPER:: not working right for XS code. * It would be better if we setup perl's context so SUPER:: did the right thing * (borrowing the relevant magic from pp_entersub in perl pp_hot.c). * Then we could just use call_method("SUPER::foo") instead. * XXX remember to call SPAGAIN in the calling code after calling this! */ static SV * dbixst_bounce_method(char *methname, int params) { dTHX; /* XXX this 'magic' undoes the dMARK embedded in the dXSARGS of our caller */ /* so that the dXSARGS below can set things up as they were for our caller */ void *xxx = PL_markstack_ptr++; dXSARGS; /* declares sp, ax, mark, items */ int i; SV *sv; int debug = 0; D_imp_xxh(ST(0)); if (debug >= 3) { PerlIO_printf(DBIc_LOGPIO(imp_xxh), " -> %s (trampoline call with %d (%ld) params)\n", methname, params, (long)items); PERL_UNUSED_VAR(xxx); } EXTEND(SP, params); PUSHMARK(SP); for (i=0; i < params; ++i) { sv = (i >= items) ? &PL_sv_undef : ST(i); PUSHs(sv); } PUTBACK; i = call_method(methname, G_SCALAR); SPAGAIN; sv = (i) ? POPs : &PL_sv_undef; PUTBACK; if (debug >= 3) PerlIO_printf(DBIc_LOGPIO(imp_xxh), " <- %s= %s (trampoline call return)\n", methname, neatsvpv(sv,0)); return sv; } static int dbdxst_bind_params(SV *sth, imp_sth_t *imp_sth, I32 items, I32 ax) { /* Handle binding supplied values to placeholders. */ /* items = one greater than the number of params */ /* ax = ax from calling sub, maybe adjusted to match items */ dTHX; int i; SV *idx; if (items-1 != DBIc_NUM_PARAMS(imp_sth) && DBIc_NUM_PARAMS(imp_sth) != DBIc_NUM_PARAMS_AT_EXECUTE ) { char errmsg[99]; /* clear any previous ParamValues before error is generated */ SV **svp = hv_fetchs((HV*)DBIc_MY_H(imp_sth),"ParamValues",FALSE); if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { HV *hv = (HV*)SvRV(*svp); hv_clear(hv); } sprintf(errmsg,"called with %d bind variables when %d are needed", (int)items-1, DBIc_NUM_PARAMS(imp_sth)); DBIh_SET_ERR_CHAR(sth, (imp_xxh_t*)imp_sth, "-1", -1, errmsg, Nullch, Nullch); return 0; } idx = sv_2mortal(newSViv(0)); for(i=1; i < items ; ++i) { SV* value = ST(i); if (SvGMAGICAL(value)) mg_get(value); /* trigger magic to FETCH the value */ sv_setiv(idx, i); if (!dbd_bind_ph(sth, imp_sth, idx, value, 0, Nullsv, FALSE, 0)) { return 0; /* dbd_bind_ph already registered error */ } } return 1; } #ifndef dbd_fetchall_arrayref static SV * dbdxst_fetchall_arrayref(SV *sth, SV *slice, SV *batch_row_count) { dTHX; D_imp_sth(sth); SV *rows_rvav; if (SvOK(slice)) { /* should never get here */ char errmsg[99]; sprintf(errmsg,"slice param not supported by XS version of fetchall_arrayref"); DBIh_SET_ERR_CHAR(sth, (imp_xxh_t*)imp_sth, "-1", -1, errmsg, Nullch, Nullch); return &PL_sv_undef; } else { IV maxrows = SvOK(batch_row_count) ? SvIV(batch_row_count) : -1; AV *fetched_av; AV *rows_av = newAV(); if ( !DBIc_ACTIVE(imp_sth) && maxrows>0 ) { /* to simplify application logic we return undef without an error */ /* if we've fetched all the rows and called with a batch_row_count */ return &PL_sv_undef; } av_extend(rows_av, (maxrows>0) ? maxrows : 31); while ( (maxrows < 0 || maxrows-- > 0) && (fetched_av = dbd_st_fetch(sth, imp_sth)) ) { AV *copy_row_av = av_make(AvFILL(fetched_av)+1, AvARRAY(fetched_av)); av_push(rows_av, newRV_noinc((SV*)copy_row_av)); } rows_rvav = sv_2mortal(newRV_noinc((SV *)rows_av)); } return rows_rvav; } #endif DBI-1.648/cpanfile0000644000031300001440000000107114734777370013115 0ustar00merijnusersrequires "XSLoader"; recommends "Encode" => "3.21"; suggests "Clone" => "0.47"; suggests "DB_File"; suggests "MLDBM"; suggests "Net::Daemon"; suggests "RPC::PlServer" => "0.2020"; suggests "SQL::Statement" => "1.414"; on "configure" => sub { requires "ExtUtils::MakeMaker" => "6.48"; recommends "ExtUtils::MakeMaker" => "7.70"; }; on "test" => sub { requires "Test::More" => "0.90"; recommends "Test::More" => "1.302207"; }; DBI-1.648/dbixs_rev.pl0000644000031300001440000000231214765034600013714 0ustar00merijnusers#!/usr/bin/perl use strict; use warnings; my $dbixs_rev_file = "dbixs_rev.h"; sub skip_update { my $reason = shift; print "Skipping regeneration of $dbixs_rev_file: ", $reason, "\n"; utime (time (), time (), $dbixs_rev_file); # update modification time exit 0; } # skip_update -d ".git" or skip_update ("No git env"); my ($dbir, $dbiv); open my $fh, "<", "DBI.pm" or die "DBI.pm: $!\n"; while (<$fh>) { m/\b VERSION \s*=\s* (["']) ([0-9]+) \. ([0-9]+) \1/x or next; ($dbir, $dbiv) = ($2, $3); close $fh; last; } $dbir or die "Cannot fetch DBI version from DBI.pm\n"; my @n = eval { qx{git log --pretty=oneline} }; @n or skip_update ("Git log was empty"); open $fh, ">$dbixs_rev_file" or die "Can't open $dbixs_rev_file: $!\n"; print $fh "/* ", scalar localtime, " */\n"; chomp (my @st = qx{git status -s --show-stash}); print $fh "/* $_ */\n" for grep { !m/\b$dbixs_rev_file\b/ } @st; my $def = "DBIXS_REVISION"; my $rev = scalar @n; print $fh "#define DBIXS_RELEASE $dbir\n"; print $fh "#define DBIXS_VERSION $dbiv\n"; print $fh "#define $def $rev\n"; close $fh or die "Error closing $dbixs_rev_file: $!\n"; print "Wrote $def $rev to $dbixs_rev_file for DBI-$dbir.$dbiv\n"; DBI-1.648/dbipport.h0000644000031300001440000211034514735000616013373 0ustar00merijnusers#if 0 my $void = <<'SKIP'; #endif /* ---------------------------------------------------------------------- dbipport.h -- Perl/Pollution/Portability Version 3.72 Automatically created by Devel::PPPort running under perl 5.040000. Do NOT edit this file directly! -- Edit PPPort_pm.PL and the includes in parts/inc/ instead. Use 'perldoc dbipport.h' to view the documentation below. ---------------------------------------------------------------------- SKIP =pod =head1 NAME dbipport.h - Perl/Pollution/Portability version 3.72 =head1 SYNOPSIS perl dbipport.h [options] [source files] Searches current directory for files if no [source files] are given --help show short help --version show version --patch=file write one patch file with changes --copy=suffix write changed copies with suffix --diff=program use diff program and options --compat-version=version provide compatibility with Perl version --cplusplus accept C++ comments --quiet don't output anything except fatal errors --nodiag don't show diagnostics --nohints don't show hints --nochanges don't suggest changes --nofilter don't filter input files --strip strip all script and doc functionality from dbipport.h --list-provided list provided API --list-unsupported list API that isn't supported all the way back --api-info=name show Perl API portability information =head1 COMPATIBILITY This version of F is designed to support operation with Perl installations back to 5.003_07, and has been tested up to 5.35.9. =head1 OPTIONS =head2 --help Display a brief usage summary. =head2 --version Display the version of F. =head2 --patch=I If this option is given, a single patch file will be created if any changes are suggested. This requires a working diff program to be installed on your system. =head2 --copy=I If this option is given, a copy of each file will be saved with the given suffix that contains the suggested changes. This does not require any external programs. Note that this does not automagically add a dot between the original filename and the suffix. If you want the dot, you have to include it in the option argument. If neither C<--patch> or C<--copy> are given, the default is to simply print the diffs for each file. This requires either C or a C program to be installed. =head2 --diff=I Manually set the diff program and options to use. The default is to use C, when installed, and output unified context diffs. =head2 --compat-version=I Tell F to check for compatibility with the given Perl version. The default is to check for compatibility with Perl version 5.003_07. You can use this option to reduce the output of F if you intend to be backward compatible only down to a certain Perl version. =head2 --cplusplus Usually, F will detect C++ style comments and replace them with C style comments for portability reasons. Using this option instructs F to leave C++ comments untouched. =head2 --quiet Be quiet. Don't print anything except fatal errors. =head2 --nodiag Don't output any diagnostic messages. Only portability alerts will be printed. =head2 --nohints Don't output any hints. Hints often contain useful portability notes. Warnings will still be displayed. =head2 --nochanges Don't suggest any changes. Only give diagnostic output and hints unless these are also deactivated. =head2 --nofilter Don't filter the list of input files. By default, files not looking like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. =head2 --strip Strip all script and documentation functionality from F. This reduces the size of F dramatically and may be useful if you want to include F in smaller modules without increasing their distribution size too much. The stripped F will have a C<--unstrip> option that allows you to undo the stripping, but only if an appropriate C module is installed. =head2 --list-provided Lists the API elements for which compatibility is provided by F. Also lists if it must be explicitly requested, if it has dependencies, and if there are hints or warnings for it. =head2 --list-unsupported Lists the API elements that are known not to be FULLY supported by F, and below which version of Perl they probably won't be available or work. By FULLY, we mean that support isn't provided all the way back to the first version of Perl that F supports at all. =head2 --api-info=I Show portability information for elements matching I. If I is surrounded by slashes, it is interpreted as a regular expression. Normally, only API elements are shown, but if there are no matching API elements but there are some other matching elements, those are shown. This allows you to conveniently find when functions internal to the core implementation were added; only people working on the core are likely to find this last part useful. =head1 DESCRIPTION In order for a Perl extension (XS) module to be as portable as possible across differing versions of Perl itself, certain steps need to be taken. =over 4 =item * Including this header is the first major one. This alone will give you access to a large part of the Perl API that hasn't been available in earlier Perl releases. Use perl dbipport.h --list-provided to see which API elements are provided by dbipport.h. =item * You should avoid using deprecated parts of the API. For example, using global Perl variables without the C prefix is deprecated. Also, some API functions used to have a C prefix. Using this form is also deprecated. You can safely use the supported API, as F will provide wrappers for older Perl versions. =item * Although the purpose of F is to keep you from having to concern yourself with what version you are running under, there may arise instances where you have to do so. These macros, the same ones as in base Perl, are available to you in all versions, and are what you should use: =over 4 =item C(major, minor, patch)> Returns whether or not the perl currently being compiled has the specified relationship I to the perl given by the parameters. I is one of C, C, C, C, C, C. For example, #if PERL_VERSION_GT(5,24,2) code that will only be compiled on perls after v5.24.2 #else fallback code #endif Note that this is usable in making compile-time decisions You may use the special value '*' for the final number to mean ALL possible values for it. Thus, #if PERL_VERSION_EQ(5,31,'*') means all perls in the 5.31 series. And #if PERL_VERSION_NE(5,24,'*') means all perls EXCEPT 5.24 ones. And #if PERL_VERSION_LE(5,9,'*') is effectively #if PERL_VERSION_LT(5,10,0) =back =item * If you use one of a few functions or variables that were not present in earlier versions of Perl, and that can't be provided using a macro, you have to explicitly request support for these functions by adding one or more C<#define>s in your source code before the inclusion of F. These functions or variables will be marked C in the list shown by C<--list-provided>. Depending on whether you module has a single or multiple files that use such functions or variables, you want either C or global variants. For a C function or variable (used only in a single source file), use: #define NEED_function #define NEED_variable For a global function or variable (used in multiple source files), use: #define NEED_function_GLOBAL #define NEED_variable_GLOBAL Note that you mustn't have more than one global request for the same function or variable in your project. Function / Variable Static Request Global Request ----------------------------------------------------------------------------------------- caller_cx() NEED_caller_cx NEED_caller_cx_GLOBAL ck_warner() NEED_ck_warner NEED_ck_warner_GLOBAL ck_warner_d() NEED_ck_warner_d NEED_ck_warner_d_GLOBAL croak_xs_usage() NEED_croak_xs_usage NEED_croak_xs_usage_GLOBAL die_sv() NEED_die_sv NEED_die_sv_GLOBAL eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL grok_number() NEED_grok_number NEED_grok_number_GLOBAL grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL load_module() NEED_load_module NEED_load_module_GLOBAL mess() NEED_mess NEED_mess_GLOBAL mess_nocontext() NEED_mess_nocontext NEED_mess_nocontext_GLOBAL mess_sv() NEED_mess_sv NEED_mess_sv_GLOBAL mg_findext() NEED_mg_findext NEED_mg_findext_GLOBAL my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL my_strnlen() NEED_my_strnlen NEED_my_strnlen_GLOBAL newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL pv_display() NEED_pv_display NEED_pv_display_GLOBAL pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL sv_unmagicext() NEED_sv_unmagicext NEED_sv_unmagicext_GLOBAL utf8_to_uvchr_buf() NEED_utf8_to_uvchr_buf NEED_utf8_to_uvchr_buf_GLOBAL vload_module() NEED_vload_module NEED_vload_module_GLOBAL vmess() NEED_vmess NEED_vmess_GLOBAL warner() NEED_warner NEED_warner_GLOBAL To avoid namespace conflicts, you can change the namespace of the explicitly exported functions / variables using the C macro. Just C<#define> the macro before including C: #define DPPP_NAMESPACE MyOwnNamespace_ #include "dbipport.h" The default namespace is C. =back The good thing is that most of the above can be checked by running F on your source code. See the next section for details. =head1 EXAMPLES To verify whether F is needed for your module, whether you should make any changes to your code, and whether any special defines should be used, F can be run as a Perl script to check your source code. Simply say: perl dbipport.h The result will usually be a list of patches suggesting changes that should at least be acceptable, if not necessarily the most efficient solution, or a fix for all possible problems. If you know that your XS module uses features only available in newer Perl releases, if you're aware that it uses C++ comments, and if you want all suggestions as a single patch file, you could use something like this: perl dbipport.h --compat-version=5.6.0 --cplusplus --patch=test.diff If you only want your code to be scanned without any suggestions for changes, use: perl dbipport.h --nochanges You can specify a different C program or options, using the C<--diff> option: perl dbipport.h --diff='diff -C 10' This would output context diffs with 10 lines of context. If you want to create patched copies of your files instead, use: perl dbipport.h --copy=.new To display portability information for the C function, use: perl dbipport.h --api-info=newSVpvn Since the argument to C<--api-info> can be a regular expression, you can use perl dbipport.h --api-info=/_nomg$/ to display portability information for all C<_nomg> functions or perl dbipport.h --api-info=/./ to display information for all known API elements. =head1 BUGS Some of the suggested edits and/or generated patches may not compile as-is without tweaking manually. This is generally due to the need for an extra parameter to be added to the call to prevent buffer overflow. If this version of F is causing failure during the compilation of this module, please check if newer versions of either this module or C are available on CPAN before sending a bug report. If F was generated using the latest version of C and is causing failure of this module, please file a bug report at L Please include the following information: =over 4 =item 1. The complete output from running "perl -V" =item 2. This file. =item 3. The name and version of the module you were trying to build. =item 4. A full log of the build that failed. =item 5. Any other information that you think could be relevant. =back For the latest version of this code, please get the C module from CPAN. =head1 COPYRIGHT Version 3.x, Copyright (c) 2004-2013, Marcus Holland-Moritz. Version 2.x, Copyright (C) 2001, Paul Marquess. Version 1.x, Copyright (C) 1999, Kenneth Albanowski. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO See L. =cut # These are tools that must be included in dbipport.h. It doesn't work if given # a .pl suffix. # # WARNING: Use only constructs that are legal as far back as D:P handles, as # this is run in the perl version being tested. # What revisions are legal, to be output as-is and converted into a pattern # that matches them precisely my $r_pat = "[57]"; sub format_version { # Given an input version that is acceptable to parse_version(), return a # string of the standard representation of it. my($r,$v,$s) = parse_version(shift); if ($r < 5 || ($r == 5 && $v < 6)) { my $ver = sprintf "%d.%03d", $r, $v; $s > 0 and $ver .= sprintf "_%02d", $s; return $ver; } return sprintf "%d.%d.%d", $r, $v, $s; } sub parse_version { # Returns a triplet, (revision, major, minor) from the input, treated as a # string, which can be in any of several typical formats. my $ver = shift; $ver = "" unless defined $ver; my($r,$v,$s); if ( ($r, $v, $s) = $ver =~ /^([0-9]+)([0-9]{3})([0-9]{3})$/ # 5029010, from the file # names in our # parts/base/ and # parts/todo directories or ($r, $v, $s) = $ver =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)$/ # 5.25.7 or ($r, $v, $s) = $ver =~ /^([0-9]+)\.([0-9]{3})([0-9]{3})$/ # 5.025008, from the # output of $] or ($r, $v, $s) = $ver =~ /^([0-9]+)\.([0-9]{1,3})()$/ # 5.24, 5.004 or ($r, $v, $s) = $ver =~ /^([0-9]+)\.(00[1-5])_?([0-9]{2})$/ # 5.003_07 ) { $s = 0 unless $s; die "Only Perl $r_pat are supported '$ver'\n" unless $r =~ / ^ $r_pat $ /x; die "Invalid version number: $ver\n" if $v >= 1000 || $s >= 1000; return (0 +$r, 0 + $v, 0 + $s); } # For some safety, don't assume something is a version number if it has a # literal dot as one of the three characters. This will have to be fixed # when we reach x.46 (since 46 is ord('.')) if ($ver !~ /\./ && (($r, $v, $s) = $ver =~ /^(.)(.)(.)$/)) # vstring 5.25.7 { $r = ord $r; $v = ord $v; $s = ord $s; die "Only Perl $r_pat are supported '$ver'\n" unless $r =~ / ^ $r_pat $ /x; return ($r, $v, $s); } my $mesg = ""; $mesg = ". (In 5.00x_yz, x must be 1-5.)" if $ver =~ /_/; die "Invalid version number format: '$ver'$mesg\n"; } sub int_parse_version { # Returns integer 7 digit human-readable version, suitable for use in file # names in parts/todo parts/base. return 0 + join "", map { sprintf("%03d", $_) } parse_version(shift); } sub ivers # Shorter name for int_parse_version { return int_parse_version(shift); } sub format_version_line { # Returns a floating point representation of the input version my $version = int_parse_version(shift); $version =~ s/ ^ ( $r_pat ) \B /$1./x; return $version; } BEGIN { if ("$]" < "5.006" ) { # On early perls, the implicit pass by reference doesn't work, so we have # to use the globals to initialize. eval q[sub dictionary_order($$) { _dictionary_order($a, $b) } ]; } elsif ("$]" < "5.022" ) { eval q[sub dictionary_order($$) { _dictionary_order(@_) } ]; } else { eval q[sub dictionary_order :prototype($$) { _dictionary_order(@_) } ]; } } sub _dictionary_order { # Sort caselessly, ignoring punct my ($valid_a, $valid_b) = @_; my ($lc_a, $lc_b); my ($squeezed_a, $squeezed_b); $valid_a = '' unless defined $valid_a; $valid_b = '' unless defined $valid_b; $lc_a = lc $valid_a; $lc_b = lc $valid_b; $squeezed_a = $lc_a; $squeezed_a =~ s/^_+//g; # No leading underscores $squeezed_a =~ s/\B_+\B//g; # No connecting underscores $squeezed_a =~ s/[\W]//g; # No punct $squeezed_b = $lc_b; $squeezed_b =~ s/^_+//g; $squeezed_b =~ s/\B_+\B//g; $squeezed_b =~ s/[\W]//g; return( $squeezed_a cmp $squeezed_b or $lc_a cmp $lc_b or $valid_a cmp $valid_b); } sub sort_api_lines # Sort lines of the form flags|return|name|args... # by 'name' { $a =~ / ^ [^|]* \| [^|]* \| ( [^|]* ) /x; # 3rd field '|' is sep my $a_name = $1; $b =~ / ^ [^|]* \| [^|]* \| ( [^|]* ) /x; my $b_name = $1; return dictionary_order($a_name, $b_name); } 1; use strict; BEGIN { require warnings if "$]" > '5.006' } # Disable broken TRIE-optimization BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if "$]" >= "5.009004" && "$]" <= "5.009005"} my $VERSION = 3.72; my %opt = ( quiet => 0, diag => 1, hints => 1, changes => 1, cplusplus => 0, filter => 1, strip => 0, version => 0, ); my($ppport) = $0 =~ /([\w.]+)$/; my $LF = '(?:\r\n|[\r\n])'; # line feed my $HS = "[ \t]"; # horizontal whitespace # Never use C comments in this file! my $ccs = '/'.'*'; my $cce = '*'.'/'; my $rccs = quotemeta $ccs; my $rcce = quotemeta $cce; eval { require Getopt::Long; Getopt::Long::GetOptions(\%opt, qw( help quiet diag! filter! hints! changes! cplusplus strip version patch=s copy=s diff=s compat-version=s list-provided list-unsupported api-info=s )) or usage(); }; if ($@ and grep /^-/, @ARGV) { usage() if "@ARGV" =~ /^--?h(?:elp)?$/; die "Getopt::Long not found. Please don't use any options.\n"; } if ($opt{version}) { print "This is $0 $VERSION.\n"; exit 0; } usage() if $opt{help}; strip() if $opt{strip}; $opt{'compat-version'} = 5.003_07 unless exists $opt{'compat-version'}; $opt{'compat-version'} = int_parse_version($opt{'compat-version'}); my $int_min_perl = int_parse_version(5.003_07); # Each element of this hash looks something like: # 'Poison' => { # 'base' => '5.008000', # 'provided' => 1, # 'todo' => '5.003007' # }, my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ ? ( $1 => { ($2 ? ( base => $2 ) : ()), ($3 ? ( todo => $3 ) : ()), (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), (index($4, 'n') >= 0 ? ( noTHXarg => 1 ) : ()), (index($4, 'c') >= 0 ? ( core_only => 1 ) : ()), (index($4, 'd') >= 0 ? ( deprecated => 1 ) : ()), (index($4, 'i') >= 0 ? ( inaccessible => 1 ) : ()), (index($4, 'x') >= 0 ? ( experimental => 1 ) : ()), (index($4, 'u') >= 0 ? ( undocumented => 1 ) : ()), (index($4, 'o') >= 0 ? ( ppport_fnc => 1 ) : ()), (index($4, 'V') >= 0 ? ( unverified => 1 ) : ()), } ) : die "invalid spec: $_" } qw( ABDAY_1|5.027010||Viu ABDAY_2|5.027010||Viu ABDAY_3|5.027010||Viu ABDAY_4|5.027010||Viu ABDAY_5|5.027010||Viu ABDAY_6|5.027010||Viu ABDAY_7|5.027010||Viu ABMON_10|5.027010||Viu ABMON_11|5.027010||Viu ABMON_12|5.027010||Viu ABMON_1|5.027010||Viu ABMON_2|5.027010||Viu ABMON_3|5.027010||Viu ABMON_4|5.027010||Viu ABMON_5|5.027010||Viu ABMON_6|5.027010||Viu ABMON_7|5.027010||Viu ABMON_8|5.027010||Viu ABMON_9|5.027010||Viu ABORT|5.003007||Viu abort|5.005000||Viu abort_execution|5.025010||Viu accept|5.005000||Viu ACCEPT|5.009005||Viu ACCEPT_t8|5.035004||Viu ACCEPT_t8_p8|5.033003||Viu ACCEPT_t8_pb|5.033003||Viu ACCEPT_tb|5.035004||Viu ACCEPT_tb_p8|5.033003||Viu ACCEPT_tb_pb|5.033003||Viu access|5.005000||Viu add_above_Latin1_folds|5.021001||Viu add_cp_to_invlist|5.013011||Viu add_data|5.005000||Vniu add_multi_match|5.021004||Viu _add_range_to_invlist|5.016000||cViu add_utf16_textfilter|5.011001||Viu adjust_size_and_find_bucket|5.019003||Vniu advance_one_LB|5.023007||Viu advance_one_SB|5.021009||Viu advance_one_WB|5.021009||Viu AHOCORASICK|5.009005||Viu AHOCORASICKC|5.009005||Viu AHOCORASICKC_t8|5.035004||Viu AHOCORASICKC_t8_p8|5.033003||Viu AHOCORASICKC_t8_pb|5.033003||Viu AHOCORASICKC_tb|5.035004||Viu AHOCORASICKC_tb_p8|5.033003||Viu AHOCORASICKC_tb_pb|5.033003||Viu AHOCORASICK_t8|5.035004||Viu AHOCORASICK_t8_p8|5.033003||Viu AHOCORASICK_t8_pb|5.033003||Viu AHOCORASICK_tb|5.035004||Viu AHOCORASICK_tb_p8|5.033003||Viu AHOCORASICK_tb_pb|5.033003||Viu ALIGNED_TYPE_NAME|||Viu ALIGNED_TYPE|||Viu alloccopstash|5.017001|5.017001|x alloc_LOGOP|5.025004||xViu allocmy|5.008001||Viu ALLOC_THREAD_KEY|5.005003||Viu ALT_DIGITS|5.027010||Viu amagic_call|5.003007|5.003007|u amagic_cmp|5.009003||Viu amagic_cmp_desc|5.031011||Viu amagic_cmp_locale|5.009003||Viu amagic_cmp_locale_desc|5.031011||Viu amagic_deref_call|5.013007|5.013007|u amagic_i_ncmp|5.009003||Viu amagic_i_ncmp_desc|5.031011||Viu amagic_is_enabled|5.015008||Viu amagic_ncmp|5.009003||Viu amagic_ncmp_desc|5.031011||Viu AMG_CALLun|5.003007||Viu AMG_CALLunary|5.013009||Viu AMGfallNEVER|5.003007||Viu AMGfallNO|5.003007||Viu AMGfallYES|5.003007||Viu AMGf_assign|5.003007||Viu AMGf_noleft|5.003007||Viu AMGf_noright|5.003007||Viu AMGf_numarg|5.021009||Viu AMGf_numeric|5.013002||Viu AMGf_unary|5.003007||Viu AMGf_want_list|5.017002||Viu AM_STR|5.027010||Viu AMT_AMAGIC|5.004000||Viu AMT_AMAGIC_off|5.004000||Viu AMT_AMAGIC_on|5.004000||Viu AMTf_AMAGIC|5.004000||Viu _aMY_CXT|5.009000|5.009000|p aMY_CXT|5.009000|5.009000|p aMY_CXT_|5.009000|5.009000|p anchored_end_shift|5.009005||Viu anchored_offset|5.005000||Viu anchored_substr|5.005000||Viu anchored_utf8|5.008000||Viu ANGSTROM_SIGN|5.017003||Viu anonymise_cv_maybe|5.013003||Viu any_dup|5.006000||Vu ANYOF|5.003007||Viu ANYOF_ALNUM|5.006000||Viu ANYOF_ALNUML|5.004000||Viu ANYOF_ALPHA|5.006000||Viu ANYOF_ALPHANUMERIC|5.017008||Viu ANYOF_ASCII|5.006000||Viu ANYOF_BIT|5.004005||Viu ANYOF_BITMAP|5.006000||Viu ANYOF_BITMAP_BYTE|5.006000||Viu ANYOF_BITMAP_CLEAR|5.006000||Viu ANYOF_BITMAP_CLEARALL|5.007003||Viu ANYOF_BITMAP_SET|5.006000||Viu ANYOF_BITMAP_SETALL|5.007003||Viu ANYOF_BITMAP_SIZE|5.006000||Viu ANYOF_BITMAP_TEST|5.006000||Viu ANYOF_BITMAP_ZERO|5.006000||Viu ANYOF_BLANK|5.006001||Viu ANYOF_CASED|5.017008||Viu ANYOF_CLASS_OR|5.017007||Viu ANYOF_CLASS_SETALL|5.013011||Viu ANYOF_CLASS_TEST_ANY_SET|5.013008||Viu ANYOF_CNTRL|5.006000||Viu ANYOF_COMMON_FLAGS|5.019008||Viu ANYOFD|5.023003||Viu ANYOF_DIGIT|5.006000||Viu ANYOFD_t8|5.035004||Viu ANYOFD_t8_p8|5.033003||Viu ANYOFD_t8_pb|5.033003||Viu ANYOFD_tb|5.035004||Viu ANYOFD_tb_p8|5.033003||Viu ANYOFD_tb_pb|5.033003||Viu ANYOF_FLAGS|5.006000||Viu ANYOF_FLAGS_ALL|5.006000||Viu ANYOF_GRAPH|5.006000||Viu ANYOFH|5.029007||Viu ANYOFHb|5.031001||Viu ANYOFHb_t8|5.035004||Viu ANYOFHb_t8_p8|5.033003||Viu ANYOFHb_t8_pb|5.033003||Viu ANYOFHb_tb|5.035004||Viu ANYOFHb_tb_p8|5.033003||Viu ANYOFHb_tb_pb|5.033003||Viu ANYOF_HORIZWS|5.009005||Viu ANYOFHr|5.031002||Viu ANYOFHr_t8|5.035004||Viu ANYOFHr_t8_p8|5.033003||Viu ANYOFHr_t8_pb|5.033003||Viu ANYOFHr_tb|5.035004||Viu ANYOFHr_tb_p8|5.033003||Viu ANYOFHr_tb_pb|5.033003||Viu ANYOFHs|5.031007||Viu ANYOFHs_t8|5.035004||Viu ANYOFHs_t8_p8|5.033003||Viu ANYOFHs_t8_pb|5.033003||Viu ANYOFHs_tb|5.035004||Viu ANYOFHs_tb_p8|5.033003||Viu ANYOFHs_tb_pb|5.033003||Viu ANYOFH_t8|5.035004||Viu ANYOFH_t8_p8|5.033003||Viu ANYOFH_t8_pb|5.033003||Viu ANYOFH_tb|5.035004||Viu ANYOFH_tb_p8|5.033003||Viu ANYOFH_tb_pb|5.033003||Viu ANYOF_INVERT|5.004000||Viu ANYOFL|5.021008||Viu ANYOFL_FOLD|5.023007||Viu ANYOF_LOCALE_FLAGS|5.019005||Viu ANYOF_LOWER|5.006000||Viu ANYOFL_SHARED_UTF8_LOCALE_fold_HAS_MATCHES_nonfold_REQD|5.023007||Viu ANYOFL_SOME_FOLDS_ONLY_IN_UTF8_LOCALE|5.023007||Viu ANYOFL_t8|5.035004||Viu ANYOFL_t8_p8|5.033003||Viu ANYOFL_t8_pb|5.033003||Viu ANYOFL_tb|5.035004||Viu ANYOFL_tb_p8|5.033003||Viu ANYOFL_tb_pb|5.033003||Viu ANYOFL_UTF8_LOCALE_REQD|5.023007||Viu ANYOFM|5.027009||Viu ANYOF_MATCHES_ALL_ABOVE_BITMAP|5.021004||Viu ANYOF_MATCHES_POSIXL|5.021004||Viu ANYOF_MAX|5.006000||Viu ANYOFM_t8|5.035004||Viu ANYOFM_t8_p8|5.033003||Viu ANYOFM_t8_pb|5.033003||Viu ANYOFM_tb|5.035004||Viu ANYOFM_tb_p8|5.033003||Viu ANYOFM_tb_pb|5.033003||Viu ANYOF_NALNUM|5.006000||Viu ANYOF_NALNUML|5.004000||Viu ANYOF_NALPHA|5.006000||Viu ANYOF_NALPHANUMERIC|5.017008||Viu ANYOF_NASCII|5.006000||Viu ANYOF_NBLANK|5.006001||Viu ANYOF_NCASED|5.017008||Viu ANYOF_NCNTRL|5.006000||Viu ANYOF_NDIGIT|5.006000||Viu ANYOF_NGRAPH|5.006000||Viu ANYOF_NHORIZWS|5.009005||Viu ANYOF_NLOWER|5.006000||Viu ANYOF_NPRINT|5.006000||Viu ANYOF_NPUNCT|5.006000||Viu ANYOF_NSPACE|5.006000||Viu ANYOF_NSPACEL|5.004000||Viu ANYOF_NUPPER|5.006000||Viu ANYOF_NVERTWS|5.009005||Viu ANYOF_NWORDCHAR|5.017005||Viu ANYOF_NXDIGIT|5.006000||Viu ANYOF_ONLY_HAS_BITMAP|5.021004||Viu ANYOFPOSIXL|5.029004||Viu ANYOF_POSIXL_AND|5.019005||Viu ANYOF_POSIXL_BITMAP|5.035003||Viu ANYOF_POSIXL_CLEAR|5.019005||Viu ANYOF_POSIXL_MAX|5.019005||Viu ANYOF_POSIXL_OR|5.019005||Viu ANYOF_POSIXL_SET|5.019005||Viu ANYOF_POSIXL_SETALL|5.019005||Viu ANYOF_POSIXL_SET_TO_BITMAP|5.029004||Viu ANYOF_POSIXL_SSC_TEST_ALL_SET|5.019009||Viu ANYOF_POSIXL_SSC_TEST_ANY_SET|5.019009||Viu ANYOFPOSIXL_t8|5.035004||Viu ANYOFPOSIXL_t8_p8|5.033003||Viu ANYOFPOSIXL_t8_pb|5.033003||Viu ANYOFPOSIXL_tb|5.035004||Viu ANYOFPOSIXL_tb_p8|5.033003||Viu ANYOFPOSIXL_tb_pb|5.033003||Viu ANYOF_POSIXL_TEST|5.019005||Viu ANYOF_POSIXL_TEST_ALL_SET|5.019005||Viu ANYOF_POSIXL_TEST_ANY_SET|5.019005||Viu ANYOF_POSIXL_ZERO|5.019005||Viu ANYOF_PRINT|5.006000||Viu ANYOF_PUNCT|5.006000||Viu ANYOFR|5.031007||Viu ANYOFRb|5.031007||Viu ANYOFRbase|5.031007||Viu ANYOFR_BASE_BITS|5.031007||Viu ANYOFRb_t8|5.035004||Viu ANYOFRb_t8_p8|5.033003||Viu ANYOFRb_t8_pb|5.033003||Viu ANYOFRb_tb|5.035004||Viu ANYOFRb_tb_p8|5.033003||Viu ANYOFRb_tb_pb|5.033003||Viu ANYOFRdelta|5.031007||Viu ANYOFR_t8|5.035004||Viu ANYOFR_t8_p8|5.033003||Viu ANYOFR_t8_pb|5.033003||Viu ANYOFR_tb|5.035004||Viu ANYOFR_tb_p8|5.033003||Viu ANYOFR_tb_pb|5.033003||Viu ANYOF_SHARED_d_MATCHES_ALL_NON_UTF8_NON_ASCII_non_d_WARN_SUPER|5.023003||Viu ANYOF_SHARED_d_UPPER_LATIN1_UTF8_STRING_MATCHES_non_d_RUNTIME_USER_PROP|5.023006||Viu ANYOF_SPACE|5.006000||Viu ANYOF_SPACEL|5.004000||Viu ANYOF_t8|5.035004||Viu ANYOF_t8_p8|5.033003||Viu ANYOF_t8_pb|5.033003||Viu ANYOF_tb|5.035004||Viu ANYOF_tb_p8|5.033003||Viu ANYOF_tb_pb|5.033003||Viu ANYOF_UNIPROP|5.017006||Viu ANYOF_UPPER|5.006000||Viu ANYOF_VERTWS|5.009005||Viu ANYOF_WORDCHAR|5.017005||Viu ANYOF_XDIGIT|5.006000||Viu ao|5.005000||Viu _append_range_to_invlist|5.013010||Viu append_utf8_from_native_byte|5.019004||cVniu apply|5.003007||Viu apply_attrs|5.006000||Viu apply_attrs_my|5.007003||Viu apply_attrs_string|5.006001|5.006001|xu ARCHLIB|5.003007|5.003007|Vn ARCHLIB_EXP|5.003007|5.003007|Vn ARCHNAME|5.004000|5.004000|Vn ARG1|5.003007||Viu ARG1_LOC|5.005000||Viu ARG1_SET|5.005000||Viu ARG2|5.003007||Viu ARG2L|5.009005||Viu ARG2L_LOC|5.009005||Viu ARG2_LOC|5.005000||Viu ARG2L_SET|5.009005||Viu ARG2_SET|5.005000||Viu ARG|5.005000||Viu ARG_LOC|5.005000||Viu ARGp|5.031010||Viu ARGp_LOC|5.031010||Viu ARGp_SET|5.031010||Viu ARG__SET|5.005000||Viu ARG_SET|5.005000||Viu ARGTARG|5.003007||Viu ARG_VALUE|5.005000||Viu argvout_final|5.029006||Viu ASCIIish|5.005003||Viu ASCII_MORE_RESTRICT_PAT_MODS|5.013010||Viu ASCII_PLATFORM_UTF8_MAXBYTES|5.035004||Viu ASCII_RESTRICT_PAT_MOD|5.013009||Viu ASCII_RESTRICT_PAT_MODS|5.013009||Viu ASCII_TO_NATIVE|5.007001||Viu ASCII_TO_NEED|5.019004||dcVnu asctime|5.009000||Viu ASCTIME_R_PROTO|5.008000|5.008000|Vn assert|5.003007||Viu __ASSERT_|5.019007|5.008008|p ASSERT_CURPAD_ACTIVE|5.008001||Viu ASSERT_CURPAD_LEGAL|5.008001||Viu ASSERT_IS_LITERAL|||Viu ASSERT_IS_PTR|||Viu assert_not_glob|5.009004||Viu ASSERT_NOT_PTR|5.035004||Viu assert_not_ROK|5.008001||Viu assert_uft8_cache_coherent|5.013003||Viu assignment_type|5.021005||Viu ASSUME|5.019006|5.003007|p atfork_lock|5.007003|5.007003|nu atfork_unlock|5.007003|5.007003|nu aTHX|5.006000|5.003007|p aTHX_|5.006000|5.003007|p aTHXa|5.017006||Viu aTHXo|5.006000||Viu aTHXR||5.003007|ponu aTHXR_||5.003007|ponu aTHXx|5.006000||Viu Atof|5.006000||Viu Atol|5.006000||Viu atoll|5.008000||Viu Atoul|5.006000||Viu AvALLOC|5.003007||Viu AvARRAY|5.003007|5.003007| AvARYLEN|5.003007||Viu av_arylen_p|||cu av_clear|5.003007|5.003007| av_count|5.033001|5.003007|p av_create_and_push||| av_create_and_unshift_one||| av_delete|5.006000|5.006000| av_exists|5.006000|5.006000| av_extend|5.003007|5.003007| av_extend_guts|5.017004||Viu av_fetch|5.003007|5.003007| av_fetch_simple|5.035002||cV av_fill|5.003007|5.003007| AvFILL|5.003007|5.003007| AvFILLp|5.004005||pcV av_iter_p|||cu av_len|5.003007|5.003007| av_make|5.003007|5.003007| AvMAX|5.003007||Viu av_new_alloc|5.035001|5.035001| av_nonelem|5.027009||Viu av_pop|5.003007|5.003007| av_push|5.003007|5.003007| AvREAL|5.003007||Viu AvREALISH|5.003007||Viu AvREAL_off|5.003007||Viu AvREAL_on|5.003007||Viu AvREAL_only|5.009003||Viu AvREIFY|5.003007||Viu av_reify|5.004004||cViu AvREIFY_off|5.003007||Viu AvREIFY_on|5.003007||Viu AvREIFY_only|5.009003||Viu av_shift|5.003007|5.003007| av_store|5.003007|5.003007| av_store_simple|5.035002||cV av_tindex|5.017009|5.003007|p av_tindex_skip_len_mg|5.025010||Viu av_top_index|5.017009|5.003007|p av_top_index_skip_len_mg|5.025010||Viu av_undef|5.003007|5.003007| av_unshift|5.003007|5.003007| ax|5.003007|5.003007| backup_one_GCB|5.025003||Viu backup_one_LB|5.023007||Viu backup_one_SB|5.021009||Viu backup_one_WB|5.021009||Viu bad_type_gv|5.019002||Viu bad_type_pv|5.016000||Viu BADVERSION|5.011004||Viu BASEOP|5.003007||Viu BhkDISABLE|5.013003||xV BhkENABLE|5.013003||xV BhkENTRY|5.013003||xVi BhkENTRY_set|5.013003||xV BHKf_bhk_eval|5.013006||Viu BHKf_bhk_post_end|5.013006||Viu BHKf_bhk_pre_end|5.013006||Viu BHKf_bhk_start|5.013006||Viu BhkFLAGS|5.013003||xVi BIN|5.003007|5.003007|Vn bind|5.005000||Viu bind_match|5.003007||Viu BIN_EXP|5.004000|5.004000|Vn BIT_BUCKET|5.003007||Viu BIT_DIGITS|5.004000||Viu BITMAP_BYTE|5.009005||Viu BITMAP_TEST|5.009005||Viu blk_eval|5.003007||Viu blk_format|5.011000||Viu blk_gimme|5.003007||Viu blk_givwhen|5.027008||Viu blk_loop|5.003007||Viu blk_oldcop|5.003007||Viu blk_oldmarksp|5.003007||Viu blk_oldpm|5.003007||Viu blk_oldsaveix|5.023008||Viu blk_oldscopesp|5.003007||Viu blk_oldsp|5.003007||Viu blk_old_tmpsfloor|5.023008||Viu blk_sub|5.003007||Viu blk_u16|5.011000||Viu block_end|5.021006|5.021006| block_gimme|5.004000|5.004000|u blockhook_register|||x block_start|5.021006|5.021006| BmFLAGS|5.009005||Viu BmPREVIOUS|5.003007||Viu BmRARE|5.003007||Viu BmUSEFUL|5.003007||Viu BOL|5.003007||Viu BOL_t8|5.035004||Viu BOL_t8_p8|5.033003||Viu BOL_t8_pb|5.033003||Viu BOL_tb|5.035004||Viu BOL_tb_p8|5.033003||Viu BOL_tb_pb|5.033003||Viu BOM_UTF8|5.025005|5.003007|p BOM_UTF8_FIRST_BYTE|5.019004||Viu BOM_UTF8_TAIL|5.019004||Viu boolSV|5.004000|5.003007|p boot_core_builtin|5.035007||Viu boot_core_mro|5.009005||Viu boot_core_PerlIO|5.007002||Viu boot_core_UNIVERSAL|5.003007||Viu BOUND|5.003007||Viu BOUNDA|5.013009||Viu BOUNDA_t8|5.035004||Viu BOUNDA_t8_p8|5.033003||Viu BOUNDA_t8_pb|5.033003||Viu BOUNDA_tb|5.035004||Viu BOUNDA_tb_p8|5.033003||Viu BOUNDA_tb_pb|5.033003||Viu BOUNDL|5.004000||Viu BOUNDL_t8|5.035004||Viu BOUNDL_t8_p8|5.033003||Viu BOUNDL_t8_pb|5.033003||Viu BOUNDL_tb|5.035004||Viu BOUNDL_tb_p8|5.033003||Viu BOUNDL_tb_pb|5.033003||Viu BOUND_t8|5.035004||Viu BOUND_t8_p8|5.033003||Viu BOUND_t8_pb|5.033003||Viu BOUND_tb|5.035004||Viu BOUND_tb_p8|5.033003||Viu BOUND_tb_pb|5.033003||Viu BOUNDU|5.013009||Viu BOUNDU_t8|5.035004||Viu BOUNDU_t8_p8|5.033003||Viu BOUNDU_t8_pb|5.033003||Viu BOUNDU_tb|5.035004||Viu BOUNDU_tb_p8|5.033003||Viu BOUNDU_tb_pb|5.033003||Viu BRANCH|5.003007||Viu BRANCHJ|5.005000||Viu BRANCHJ_t8|5.035004||Viu BRANCHJ_t8_p8|5.033003||Viu BRANCHJ_t8_pb|5.033003||Viu BRANCHJ_tb|5.035004||Viu BRANCHJ_tb_p8|5.033003||Viu BRANCHJ_tb_pb|5.033003||Viu BRANCH_next|5.009005||Viu BRANCH_next_fail|5.009005||Viu BRANCH_next_fail_t8|5.035004||Viu BRANCH_next_fail_t8_p8|5.033003||Viu BRANCH_next_fail_t8_pb|5.033003||Viu BRANCH_next_fail_tb|5.035004||Viu BRANCH_next_fail_tb_p8|5.033003||Viu BRANCH_next_fail_tb_pb|5.033003||Viu BRANCH_next_t8|5.035004||Viu BRANCH_next_t8_p8|5.033003||Viu BRANCH_next_t8_pb|5.033003||Viu BRANCH_next_tb|5.035004||Viu BRANCH_next_tb_p8|5.033003||Viu BRANCH_next_tb_pb|5.033003||Viu BRANCH_t8|5.035004||Viu BRANCH_t8_p8|5.033003||Viu BRANCH_t8_pb|5.033003||Viu BRANCH_tb|5.035004||Viu BRANCH_tb_p8|5.033003||Viu BRANCH_tb_pb|5.033003||Viu BSD_GETPGRP|5.003007||Viu BSDish|5.008001||Viu BSD_SETPGRP|5.003007||Viu BUFSIZ|5.003007||Viu _byte_dump_string|5.025006||cViu BYTEORDER|5.003007|5.003007|Vn bytes_cmp_utf8|5.013007|5.013007| bytes_from_utf8|5.007001|5.007001|x bytes_from_utf8_loc|5.027001||xcVn bytes_to_utf8|5.006001|5.006001|x call_argv|5.006000|5.003007|p call_atexit|5.006000|5.006000|u CALL_BLOCK_HOOKS|5.013003||xVi CALL_CHECKER_REQUIRE_GV|5.021004|5.021004| caller_cx|5.013005|5.006000|p CALL_FPTR|5.006000||Viu call_list|5.004000|5.004000|u call_method|5.006000|5.003007|p calloc|5.029005||Vn call_pv|5.006000|5.003007|p CALLREGCOMP|5.005000||Viu CALLREGCOMP_ENG|5.009005||Viu CALLREGDUPE|5.009005||Viu CALLREGDUPE_PVT|5.009005||Viu CALLREGEXEC|5.005000||Viu CALLREGFREE|5.006000||Viu CALLREGFREE_PVT|5.009005||Viu CALLREG_INTUIT_START|5.006000||Viu CALLREG_INTUIT_STRING|5.006000||Viu CALLREG_NAMED_BUFF_ALL|5.009005||Viu CALLREG_NAMED_BUFF_CLEAR|5.009005||Viu CALLREG_NAMED_BUFF_COUNT|5.009005||Viu CALLREG_NAMED_BUFF_DELETE|5.009005||Viu CALLREG_NAMED_BUFF_EXISTS|5.009005||Viu CALLREG_NAMED_BUFF_FETCH|5.009005||Viu CALLREG_NAMED_BUFF_FIRSTKEY|5.009005||Viu CALLREG_NAMED_BUFF_NEXTKEY|5.009005||Viu CALLREG_NAMED_BUFF_SCALAR|5.009005||Viu CALLREG_NAMED_BUFF_STORE|5.009005||Viu CALLREG_NUMBUF_FETCH|5.009005||Viu CALLREG_NUMBUF_LENGTH|5.009005||Viu CALLREG_NUMBUF_STORE|5.009005||Viu CALLREG_PACKAGE|5.009005||Viu CALLRUNOPS|5.005000||Viu call_sv|5.006000|5.003007|p CAN64BITHASH|5.027001||Viu CAN_COW_FLAGS|5.009000||Viu CAN_COW_MASK|5.009000||Viu cando|5.003007||Viu CAN_PROTOTYPE|5.003007||Viu C_ARRAY_END|5.013002|5.003007|p C_ARRAY_LENGTH|5.008001|5.003007|p case_100_SBOX32|5.027001||Viu case_101_SBOX32|5.027001||Viu case_102_SBOX32|5.027001||Viu case_103_SBOX32|5.027001||Viu case_104_SBOX32|5.027001||Viu case_105_SBOX32|5.027001||Viu case_106_SBOX32|5.027001||Viu case_107_SBOX32|5.027001||Viu case_108_SBOX32|5.027001||Viu case_109_SBOX32|5.027001||Viu case_10_SBOX32|5.027001||Viu case_110_SBOX32|5.027001||Viu case_111_SBOX32|5.027001||Viu case_112_SBOX32|5.027001||Viu case_113_SBOX32|5.027001||Viu case_114_SBOX32|5.027001||Viu case_115_SBOX32|5.027001||Viu case_116_SBOX32|5.027001||Viu case_117_SBOX32|5.027001||Viu case_118_SBOX32|5.027001||Viu case_119_SBOX32|5.027001||Viu case_11_SBOX32|5.027001||Viu case_120_SBOX32|5.027001||Viu case_121_SBOX32|5.027001||Viu case_122_SBOX32|5.027001||Viu case_123_SBOX32|5.027001||Viu case_124_SBOX32|5.027001||Viu case_125_SBOX32|5.027001||Viu case_126_SBOX32|5.027001||Viu case_127_SBOX32|5.027001||Viu case_128_SBOX32|5.027001||Viu case_129_SBOX32|5.027001||Viu case_12_SBOX32|5.027001||Viu case_130_SBOX32|5.027001||Viu case_131_SBOX32|5.027001||Viu case_132_SBOX32|5.027001||Viu case_133_SBOX32|5.027001||Viu case_134_SBOX32|5.027001||Viu case_135_SBOX32|5.027001||Viu case_136_SBOX32|5.027001||Viu case_137_SBOX32|5.027001||Viu case_138_SBOX32|5.027001||Viu case_139_SBOX32|5.027001||Viu case_13_SBOX32|5.027001||Viu case_140_SBOX32|5.027001||Viu case_141_SBOX32|5.027001||Viu case_142_SBOX32|5.027001||Viu case_143_SBOX32|5.027001||Viu case_144_SBOX32|5.027001||Viu case_145_SBOX32|5.027001||Viu case_146_SBOX32|5.027001||Viu case_147_SBOX32|5.027001||Viu case_148_SBOX32|5.027001||Viu case_149_SBOX32|5.027001||Viu case_14_SBOX32|5.027001||Viu case_150_SBOX32|5.027001||Viu case_151_SBOX32|5.027001||Viu case_152_SBOX32|5.027001||Viu case_153_SBOX32|5.027001||Viu case_154_SBOX32|5.027001||Viu case_155_SBOX32|5.027001||Viu case_156_SBOX32|5.027001||Viu case_157_SBOX32|5.027001||Viu case_158_SBOX32|5.027001||Viu case_159_SBOX32|5.027001||Viu case_15_SBOX32|5.027001||Viu case_160_SBOX32|5.027001||Viu case_161_SBOX32|5.027001||Viu case_162_SBOX32|5.027001||Viu case_163_SBOX32|5.027001||Viu case_164_SBOX32|5.027001||Viu case_165_SBOX32|5.027001||Viu case_166_SBOX32|5.027001||Viu case_167_SBOX32|5.027001||Viu case_168_SBOX32|5.027001||Viu case_169_SBOX32|5.027001||Viu case_16_SBOX32|5.027001||Viu case_170_SBOX32|5.027001||Viu case_171_SBOX32|5.027001||Viu case_172_SBOX32|5.027001||Viu case_173_SBOX32|5.027001||Viu case_174_SBOX32|5.027001||Viu case_175_SBOX32|5.027001||Viu case_176_SBOX32|5.027001||Viu case_177_SBOX32|5.027001||Viu case_178_SBOX32|5.027001||Viu case_179_SBOX32|5.027001||Viu case_17_SBOX32|5.027001||Viu case_180_SBOX32|5.027001||Viu case_181_SBOX32|5.027001||Viu case_182_SBOX32|5.027001||Viu case_183_SBOX32|5.027001||Viu case_184_SBOX32|5.027001||Viu case_185_SBOX32|5.027001||Viu case_186_SBOX32|5.027001||Viu case_187_SBOX32|5.027001||Viu case_188_SBOX32|5.027001||Viu case_189_SBOX32|5.027001||Viu case_18_SBOX32|5.027001||Viu case_190_SBOX32|5.027001||Viu case_191_SBOX32|5.027001||Viu case_192_SBOX32|5.027001||Viu case_193_SBOX32|5.027001||Viu case_194_SBOX32|5.027001||Viu case_195_SBOX32|5.027001||Viu case_196_SBOX32|5.027001||Viu case_197_SBOX32|5.027001||Viu case_198_SBOX32|5.027001||Viu case_199_SBOX32|5.027001||Viu case_19_SBOX32|5.027001||Viu case_1_SBOX32|5.027001||Viu case_200_SBOX32|5.027001||Viu case_201_SBOX32|5.027001||Viu case_202_SBOX32|5.027001||Viu case_203_SBOX32|5.027001||Viu case_204_SBOX32|5.027001||Viu case_205_SBOX32|5.027001||Viu case_206_SBOX32|5.027001||Viu case_207_SBOX32|5.027001||Viu case_208_SBOX32|5.027001||Viu case_209_SBOX32|5.027001||Viu case_20_SBOX32|5.027001||Viu case_210_SBOX32|5.027001||Viu case_211_SBOX32|5.027001||Viu case_212_SBOX32|5.027001||Viu case_213_SBOX32|5.027001||Viu case_214_SBOX32|5.027001||Viu case_215_SBOX32|5.027001||Viu case_216_SBOX32|5.027001||Viu case_217_SBOX32|5.027001||Viu case_218_SBOX32|5.027001||Viu case_219_SBOX32|5.027001||Viu case_21_SBOX32|5.027001||Viu case_220_SBOX32|5.027001||Viu case_221_SBOX32|5.027001||Viu case_222_SBOX32|5.027001||Viu case_223_SBOX32|5.027001||Viu case_224_SBOX32|5.027001||Viu case_225_SBOX32|5.027001||Viu case_226_SBOX32|5.027001||Viu case_227_SBOX32|5.027001||Viu case_228_SBOX32|5.027001||Viu case_229_SBOX32|5.027001||Viu case_22_SBOX32|5.027001||Viu case_230_SBOX32|5.027001||Viu case_231_SBOX32|5.027001||Viu case_232_SBOX32|5.027001||Viu case_233_SBOX32|5.027001||Viu case_234_SBOX32|5.027001||Viu case_235_SBOX32|5.027001||Viu case_236_SBOX32|5.027001||Viu case_237_SBOX32|5.027001||Viu case_238_SBOX32|5.027001||Viu case_239_SBOX32|5.027001||Viu case_23_SBOX32|5.027001||Viu case_240_SBOX32|5.027001||Viu case_241_SBOX32|5.027001||Viu case_242_SBOX32|5.027001||Viu case_243_SBOX32|5.027001||Viu case_244_SBOX32|5.027001||Viu case_245_SBOX32|5.027001||Viu case_246_SBOX32|5.027001||Viu case_247_SBOX32|5.027001||Viu case_248_SBOX32|5.027001||Viu case_249_SBOX32|5.027001||Viu case_24_SBOX32|5.027001||Viu case_250_SBOX32|5.027001||Viu case_251_SBOX32|5.027001||Viu case_252_SBOX32|5.027001||Viu case_253_SBOX32|5.027001||Viu case_254_SBOX32|5.027001||Viu case_255_SBOX32|5.027001||Viu case_256_SBOX32|5.027001||Viu case_25_SBOX32|5.027001||Viu case_26_SBOX32|5.027001||Viu case_27_SBOX32|5.027001||Viu case_28_SBOX32|5.027001||Viu case_29_SBOX32|5.027001||Viu case_2_SBOX32|5.027001||Viu case_30_SBOX32|5.027001||Viu case_31_SBOX32|5.027001||Viu case_32_SBOX32|5.027001||Viu case_33_SBOX32|5.027001||Viu case_34_SBOX32|5.027001||Viu case_35_SBOX32|5.027001||Viu case_36_SBOX32|5.027001||Viu case_37_SBOX32|5.027001||Viu case_38_SBOX32|5.027001||Viu case_39_SBOX32|5.027001||Viu case_3_SBOX32|5.027001||Viu case_40_SBOX32|5.027001||Viu case_41_SBOX32|5.027001||Viu case_42_SBOX32|5.027001||Viu case_43_SBOX32|5.027001||Viu case_44_SBOX32|5.027001||Viu case_45_SBOX32|5.027001||Viu case_46_SBOX32|5.027001||Viu case_47_SBOX32|5.027001||Viu case_48_SBOX32|5.027001||Viu case_49_SBOX32|5.027001||Viu case_4_SBOX32|5.027001||Viu case_50_SBOX32|5.027001||Viu case_51_SBOX32|5.027001||Viu case_52_SBOX32|5.027001||Viu case_53_SBOX32|5.027001||Viu case_54_SBOX32|5.027001||Viu case_55_SBOX32|5.027001||Viu case_56_SBOX32|5.027001||Viu case_57_SBOX32|5.027001||Viu case_58_SBOX32|5.027001||Viu case_59_SBOX32|5.027001||Viu case_5_SBOX32|5.027001||Viu case_60_SBOX32|5.027001||Viu case_61_SBOX32|5.027001||Viu case_62_SBOX32|5.027001||Viu case_63_SBOX32|5.027001||Viu case_64_SBOX32|5.027001||Viu case_65_SBOX32|5.027001||Viu case_66_SBOX32|5.027001||Viu case_67_SBOX32|5.027001||Viu case_68_SBOX32|5.027001||Viu case_69_SBOX32|5.027001||Viu case_6_SBOX32|5.027001||Viu case_70_SBOX32|5.027001||Viu case_71_SBOX32|5.027001||Viu case_72_SBOX32|5.027001||Viu case_73_SBOX32|5.027001||Viu case_74_SBOX32|5.027001||Viu case_75_SBOX32|5.027001||Viu case_76_SBOX32|5.027001||Viu case_77_SBOX32|5.027001||Viu case_78_SBOX32|5.027001||Viu case_79_SBOX32|5.027001||Viu case_7_SBOX32|5.027001||Viu case_80_SBOX32|5.027001||Viu case_81_SBOX32|5.027001||Viu case_82_SBOX32|5.027001||Viu case_83_SBOX32|5.027001||Viu case_84_SBOX32|5.027001||Viu case_85_SBOX32|5.027001||Viu case_86_SBOX32|5.027001||Viu case_87_SBOX32|5.027001||Viu case_88_SBOX32|5.027001||Viu case_89_SBOX32|5.027001||Viu case_8_SBOX32|5.027001||Viu case_90_SBOX32|5.027001||Viu case_91_SBOX32|5.027001||Viu case_92_SBOX32|5.027001||Viu case_93_SBOX32|5.027001||Viu case_94_SBOX32|5.027001||Viu case_95_SBOX32|5.027001||Viu case_96_SBOX32|5.027001||Viu case_97_SBOX32|5.027001||Viu case_98_SBOX32|5.027001||Viu case_99_SBOX32|5.027001||Viu case_9_SBOX32|5.027001||Viu CASE_STD_PMMOD_FLAGS_PARSE_SET|5.009005||Viu CASTFLAGS|5.003007|5.003007|Vn cast_i32|5.006000||cVnu cast_iv|5.006000||cVnu CASTNEGFLOAT|5.003007|5.003007|Vn cast_ulong|5.003007||cVnu cast_uv|5.006000||cVnu CAT2|5.003007|5.003007|Vn CATCH_GET|5.004000||Viu CATCH_SET|5.004000||Viu category_name|5.027008||Vniu cBINOP|5.003007||Viu cBINOPo|5.004005||Viu cBINOPx|5.006000||Viu cBOOL|5.013000|5.003007|p cCOP|5.003007||Viu cCOPo|5.004005||Viu cCOPx|5.006000||Viu C_FAC_POSIX|5.009003||Viu cGVOP_gv|5.006000||Viu cGVOPo_gv|5.006000||Viu cGVOPx_gv|5.006000||Viu change_engine_size|5.029004||Viu CHANGE_MULTICALL_FLAGS|5.018000||Viu CHARBITS|5.011002|5.011002|Vn CHARSET_PAT_MODS|5.013010||Viu chdir|5.005000||Viu checkcomma|5.003007||Viu check_end_shift|5.009005||Viu check_locale_boundary_crossing|5.015006||Viu CHECK_MALLOC_TAINT|5.008001||Viu CHECK_MALLOC_TOO_LATE_FOR|5.008001||Viu check_offset_max|5.005000||Viu check_offset_min|5.005000||Viu check_substr|5.005000||Viu check_type_and_open|5.009003||Viu check_uni|5.003007||Viu check_utf8|5.008000||Viu check_utf8_print|5.013009||Viu child_offset_bits|5.009003||Viu chmod|5.005000||Viu chsize|5.005000||Viu ckDEAD|5.006000||Viu ck_entersub_args_core|||iu ck_entersub_args_list|5.013006|5.013006| ck_entersub_args_proto|5.013006|5.013006| ck_entersub_args_proto_or_list|5.013006|5.013006| ckWARN2|5.006000|5.003007|p ckWARN2_d|5.006000|5.003007|p ckWARN3|5.007003|5.003007|p ckWARN3_d|5.007003|5.003007|p ckWARN4|5.007003|5.003007|p ckWARN4_d|5.007003|5.003007|p ckWARN|5.006000|5.003007|p ckwarn_common|5.011001||Viu ckwarn|||cu ckWARN_d|5.006000|5.003007|p ckwarn_d|||cu ck_warner|5.011001||pvV ck_warner_d|5.011001||pvV CLANG_DIAG_IGNORE|5.023006||Viu CLANG_DIAG_IGNORE_DECL|5.027007||Viu CLANG_DIAG_IGNORE_STMT|5.027007||Viu CLANG_DIAG_PRAGMA|5.023006||Viu CLANG_DIAG_RESTORE|5.023006||Viu CLANG_DIAG_RESTORE_DECL|5.027007||Viu CLANG_DIAG_RESTORE_STMT|5.027007||Viu CLASS||5.003007| CLEAR_ARGARRAY|5.006000||Viu clear_defarray|5.023008|5.023008|u clearerr|5.003007||Viu CLEAR_ERRSV|5.025007|5.025007| CLEARFEATUREBITS|5.031006||Viu clear_placeholders|5.009004||xViu clear_special_blocks|5.021003||Viu cLISTOP|5.003007||Viu cLISTOPo|5.004005||Viu cLISTOPx|5.006000||Viu cLOGOP|5.003007||Viu cLOGOPo|5.004005||Viu cLOGOPx|5.006000||Viu CLONEf_CLONE_HOST|5.007002||Viu CLONEf_COPY_STACKS|5.007001||Viu CLONEf_JOIN_IN|5.008001||Viu CLONEf_KEEP_PTR_TABLE|5.007001||Viu clone_params_del|||nu clone_params_new|||nu cLOOP|5.003007||Viu cLOOPo|5.004005||Viu cLOOPx|5.006000||Viu CLOSE|5.003007||Viu close|5.005000||Viu closedir|5.005000||Viu closest_cop|5.007002||Viu CLOSE_t8|5.035004||Viu CLOSE_t8_p8|5.033003||Viu CLOSE_t8_pb|5.033003||Viu CLOSE_tb|5.035004||Viu CLOSE_tb_p8|5.033003||Viu CLOSE_tb_pb|5.033003||Viu CLUMP_2IV|5.006000||Viu CLUMP_2UV|5.006000||Viu CLUMP|5.006000||Viu CLUMP_t8|5.035004||Viu CLUMP_t8_p8|5.033003||Viu CLUMP_t8_pb|5.033003||Viu CLUMP_tb|5.035004||Viu CLUMP_tb_p8|5.033003||Viu CLUMP_tb_pb|5.033003||Viu cMETHOPx|5.021005||Viu cMETHOPx_meth|5.021005||Viu cMETHOPx_rclass|5.021007||Viu cmpchain_extend|5.031011||Viu cmpchain_finish|5.031011||Viu cmpchain_start|5.031011||Viu cmp_desc|5.031011||Viu cmp_locale_desc|5.031011||Viu cntrl_to_mnemonic|5.021004||cVniu CODESET|5.027010||Viu COMBINING_DOT_ABOVE_UTF8|5.029008||Viu COMBINING_GRAVE_ACCENT_UTF8|5.017004||Viu COMMIT|5.009005||Viu COMMIT_next|5.009005||Viu COMMIT_next_fail|5.009005||Viu COMMIT_next_fail_t8|5.035004||Viu COMMIT_next_fail_t8_p8|5.033003||Viu COMMIT_next_fail_t8_pb|5.033003||Viu COMMIT_next_fail_tb|5.035004||Viu COMMIT_next_fail_tb_p8|5.033003||Viu COMMIT_next_fail_tb_pb|5.033003||Viu COMMIT_next_t8|5.035004||Viu COMMIT_next_t8_p8|5.033003||Viu COMMIT_next_t8_pb|5.033003||Viu COMMIT_next_tb|5.035004||Viu COMMIT_next_tb_p8|5.033003||Viu COMMIT_next_tb_pb|5.033003||Viu COMMIT_t8|5.035004||Viu COMMIT_t8_p8|5.033003||Viu COMMIT_t8_pb|5.033003||Viu COMMIT_tb|5.035004||Viu COMMIT_tb_p8|5.033003||Viu COMMIT_tb_pb|5.033003||Viu compile_wildcard|5.031010||Viu compute_EXACTish|5.017003||Vniu COND_BROADCAST|5.005000||Viu COND_DESTROY|5.005000||Viu COND_INIT|5.005000||Viu COND_SIGNAL|5.005000||Viu COND_WAIT|5.005000||Viu connect|5.005000||Viu construct_ahocorasick_from_trie|5.021001||Viu CONTINUE_PAT_MOD|5.009005||Viu cop_fetch_label|5.031004|5.031004|x CopFILE|5.006000|5.003007|p CopFILEAV|5.006000|5.003007|p CopFILEAVn|5.035006|5.035006| cop_file_avn|5.035006||cVu CopFILEAVx|5.009003||Viu CopFILE_free|5.007003||Viu CopFILEGV|5.006000|5.003007|p CopFILEGV_set|5.006000|5.003007|p CopFILE_set|5.006000|5.003007|p CopFILE_setn|5.009005||Viu CopFILESV|5.006000|5.003007|p cop_free|5.006000||Viu cophh_2hv|5.013007|5.013007|x cophh_copy|5.013007|5.013007|x cophh_delete_pv|5.013007|5.013007|x cophh_delete_pvn|5.013007|5.013007|x cophh_delete_pvs|5.013007|5.013007|x cophh_delete_sv|5.013007|5.013007|x COPHH_EXISTS|5.033008||Viu cophh_exists_pv|5.033008|5.033008|x cophh_exists_pvn|5.033008|5.033008|x cophh_exists_pvs|5.033008|5.033008|x cophh_exists_sv|5.033008|5.033008|x cophh_fetch_pv|5.013007|5.013007|x cophh_fetch_pvn|5.013007|5.013007|x cophh_fetch_pvs|5.013007|5.013007|x cophh_fetch_sv|5.013007|5.013007|x cophh_free|5.013007|5.013007|x COPHH_KEY_UTF8|5.013007|5.013007| cophh_new_empty|5.013007|5.013007|x cophh_store_pv|5.013007|5.013007|x cophh_store_pvn|5.013007|5.013007|x cophh_store_pvs|5.013007|5.013007|x cophh_store_sv|5.013007|5.013007|x CopHINTHASH_get|5.013007||Viu CopHINTHASH_set|5.013007||Viu cop_hints_2hv|5.013007|5.013007| cop_hints_exists_pv|5.033008|5.033008| cop_hints_exists_pvn|5.033008|5.033008| cop_hints_exists_pvs|5.033008|5.033008| cop_hints_exists_sv|5.033008|5.033008| cop_hints_fetch_pv|5.013007|5.013007| cop_hints_fetch_pvn|5.013007|5.013007| cop_hints_fetch_pvs|5.013007|5.013007| cop_hints_fetch_sv|5.013007|5.013007| CopHINTS_get|5.009004||Viu CopHINTS_set|5.009004||Viu CopLABEL|5.009005|5.009005| CopLABEL_alloc|5.009005||Viu CopLABEL_len|5.016000|5.016000| CopLABEL_len_flags|5.016000|5.016000| CopLINE|5.006000|5.006000| CopLINE_dec|5.006000||Viu CopLINE_inc|5.006000||Viu CopLINE_set|5.006000||Viu COP_SEQMAX_INC|5.021006||Viu COP_SEQ_RANGE_HIGH|5.009005||Viu COP_SEQ_RANGE_LOW|5.009005||Viu CopSTASH|5.006000|5.003007|p CopSTASH_eq|5.006000|5.003007|p CopSTASH_ne|5.006000||Viu CopSTASHPV|5.006000|5.003007|p CopSTASHPV_set|5.017001|5.017001|p CopSTASH_set|5.006000|5.003007|p cop_store_label|5.031004|5.031004|x Copy|5.003007|5.003007| CopyD|5.009002|5.003007|p copy_length|||Viu core_prototype|5.015002||Vi coresub_op|5.015003||Viu CowREFCNT|5.017007||Viu cPADOP|5.006000||Viu cPADOPo|5.006000||Viu cPADOPx|5.006000||Viu CPERLarg|5.005000||Viu CPERLscope|5.005000|5.003007|pdV cPMOP|5.003007||Viu cPMOPo|5.004005||Viu cPMOPx|5.006000||Viu CPPLAST|5.006000|5.006000|Vn CPPMINUS|5.003007|5.003007|Vn CPPRUN|5.006000|5.006000|Vn CPPSTDIN|5.003007|5.003007|Vn cPVOP|5.003007||Viu cPVOPo|5.004005||Viu cPVOPx|5.006000||Viu create_eval_scope|5.009004||xViu CR_NATIVE|5.019004||Viu CRNCYSTR|5.027010||Viu croak|5.003007||vV croak_caller|5.025004||vVniu croak_memory_wrap|5.019003||pcVnu croak_nocontext|5.006000||pvVn croak_no_mem|5.017006||Vniu croak_no_modify|5.013003|5.003007|pn croak_popstack|5.017008||cVniu croak_sv|5.013001|5.003007|p croak_xs_usage|5.010001|5.003007|pn cr_textfilter|5.006000||Viu crypt|5.009000||Viu CRYPT_R_PROTO|5.008000|5.008000|Vn CSH|5.003007|5.003007|Vn csighandler1|5.031007||cVnu csighandler3|5.031007||cVnu csighandler|5.008001||cVnu cSVOP|5.003007||Viu cSVOPo|5.004005||Viu cSVOPo_sv|5.006000||Viu cSVOP_sv|5.006000||Viu cSVOPx|5.006000||Viu cSVOPx_sv|5.006000||Viu cSVOPx_svp|5.006000||Viu ctermid|5.009000||Viu CTERMID_R_PROTO|5.008000|5.008000|Vn ctime|5.009000||Viu CTIME_R_PROTO|5.008000|5.008000|Vn Ctl|5.003007||Viu CTYPE256|5.003007||Viu cUNOP|5.003007||Viu cUNOP_AUX|5.021007||Viu cUNOP_AUXo|5.021007||Viu cUNOP_AUXx|5.021007||Viu cUNOPo|5.004005||Viu cUNOPx|5.006000||Viu CURLY|5.003007||Viu CURLY_B_max|5.009005||Viu CURLY_B_max_fail|5.009005||Viu CURLY_B_max_fail_t8|5.035004||Viu CURLY_B_max_fail_t8_p8|5.033003||Viu CURLY_B_max_fail_t8_pb|5.033003||Viu CURLY_B_max_fail_tb|5.035004||Viu CURLY_B_max_fail_tb_p8|5.033003||Viu CURLY_B_max_fail_tb_pb|5.033003||Viu CURLY_B_max_t8|5.035004||Viu CURLY_B_max_t8_p8|5.033003||Viu CURLY_B_max_t8_pb|5.033003||Viu CURLY_B_max_tb|5.035004||Viu CURLY_B_max_tb_p8|5.033003||Viu CURLY_B_max_tb_pb|5.033003||Viu CURLY_B_min|5.009005||Viu CURLY_B_min_fail|5.009005||Viu CURLY_B_min_fail_t8|5.035004||Viu CURLY_B_min_fail_t8_p8|5.033003||Viu CURLY_B_min_fail_t8_pb|5.033003||Viu CURLY_B_min_fail_tb|5.035004||Viu CURLY_B_min_fail_tb_p8|5.033003||Viu CURLY_B_min_fail_tb_pb|5.033003||Viu CURLY_B_min_t8|5.035004||Viu CURLY_B_min_t8_p8|5.033003||Viu CURLY_B_min_t8_pb|5.033003||Viu CURLY_B_min_tb|5.035004||Viu CURLY_B_min_tb_p8|5.033003||Viu CURLY_B_min_tb_pb|5.033003||Viu CURLYM|5.005000||Viu CURLYM_A|5.009005||Viu CURLYM_A_fail|5.009005||Viu CURLYM_A_fail_t8|5.035004||Viu CURLYM_A_fail_t8_p8|5.033003||Viu CURLYM_A_fail_t8_pb|5.033003||Viu CURLYM_A_fail_tb|5.035004||Viu CURLYM_A_fail_tb_p8|5.033003||Viu CURLYM_A_fail_tb_pb|5.033003||Viu CURLYM_A_t8|5.035004||Viu CURLYM_A_t8_p8|5.033003||Viu CURLYM_A_t8_pb|5.033003||Viu CURLYM_A_tb|5.035004||Viu CURLYM_A_tb_p8|5.033003||Viu CURLYM_A_tb_pb|5.033003||Viu CURLYM_B|5.009005||Viu CURLYM_B_fail|5.009005||Viu CURLYM_B_fail_t8|5.035004||Viu CURLYM_B_fail_t8_p8|5.033003||Viu CURLYM_B_fail_t8_pb|5.033003||Viu CURLYM_B_fail_tb|5.035004||Viu CURLYM_B_fail_tb_p8|5.033003||Viu CURLYM_B_fail_tb_pb|5.033003||Viu CURLYM_B_t8|5.035004||Viu CURLYM_B_t8_p8|5.033003||Viu CURLYM_B_t8_pb|5.033003||Viu CURLYM_B_tb|5.035004||Viu CURLYM_B_tb_p8|5.033003||Viu CURLYM_B_tb_pb|5.033003||Viu CURLYM_t8|5.035004||Viu CURLYM_t8_p8|5.033003||Viu CURLYM_t8_pb|5.033003||Viu CURLYM_tb|5.035004||Viu CURLYM_tb_p8|5.033003||Viu CURLYM_tb_pb|5.033003||Viu CURLYN|5.005000||Viu CURLYN_t8|5.035004||Viu CURLYN_t8_p8|5.033003||Viu CURLYN_t8_pb|5.033003||Viu CURLYN_tb|5.035004||Viu CURLYN_tb_p8|5.033003||Viu CURLYN_tb_pb|5.033003||Viu CURLY_t8|5.035004||Viu CURLY_t8_p8|5.033003||Viu CURLY_t8_pb|5.033003||Viu CURLY_tb|5.035004||Viu CURLY_tb_p8|5.033003||Viu CURLY_tb_pb|5.033003||Viu CURLYX|5.003007||Viu CURLYX_end|5.009005||Viu CURLYX_end_fail|5.009005||Viu CURLYX_end_fail_t8|5.035004||Viu CURLYX_end_fail_t8_p8|5.033003||Viu CURLYX_end_fail_t8_pb|5.033003||Viu CURLYX_end_fail_tb|5.035004||Viu CURLYX_end_fail_tb_p8|5.033003||Viu CURLYX_end_fail_tb_pb|5.033003||Viu CURLYX_end_t8|5.035004||Viu CURLYX_end_t8_p8|5.033003||Viu CURLYX_end_t8_pb|5.033003||Viu CURLYX_end_tb|5.035004||Viu CURLYX_end_tb_p8|5.033003||Viu CURLYX_end_tb_pb|5.033003||Viu CURLYX_t8|5.035004||Viu CURLYX_t8_p8|5.033003||Viu CURLYX_t8_pb|5.033003||Viu CURLYX_tb|5.035004||Viu CURLYX_tb_p8|5.033003||Viu CURLYX_tb_pb|5.033003||Viu CURRENT_FEATURE_BUNDLE|5.015007||Viu CURRENT_HINTS|5.015007||Viu current_re_engine|5.017001||cViu curse|5.013009||Viu custom_op_desc|5.007003|5.007003|d custom_op_get_field|5.019006||cViu custom_op_name|5.007003|5.007003|d custom_op_register||| CUTGROUP|5.009005||Viu CUTGROUP_next|5.009005||Viu CUTGROUP_next_fail|5.009005||Viu CUTGROUP_next_fail_t8|5.035004||Viu CUTGROUP_next_fail_t8_p8|5.033003||Viu CUTGROUP_next_fail_t8_pb|5.033003||Viu CUTGROUP_next_fail_tb|5.035004||Viu CUTGROUP_next_fail_tb_p8|5.033003||Viu CUTGROUP_next_fail_tb_pb|5.033003||Viu CUTGROUP_next_t8|5.035004||Viu CUTGROUP_next_t8_p8|5.033003||Viu CUTGROUP_next_t8_pb|5.033003||Viu CUTGROUP_next_tb|5.035004||Viu CUTGROUP_next_tb_p8|5.033003||Viu CUTGROUP_next_tb_pb|5.033003||Viu CUTGROUP_t8|5.035004||Viu CUTGROUP_t8_p8|5.033003||Viu CUTGROUP_t8_pb|5.033003||Viu CUTGROUP_tb|5.035004||Viu CUTGROUP_tb_p8|5.033003||Viu CUTGROUP_tb_pb|5.033003||Viu CvANON|5.003007||Viu CvANONCONST|5.021008||Viu CvANONCONST_off|5.021008||Viu CvANONCONST_on|5.021008||Viu CvANON_off|5.003007||Viu CvANON_on|5.003007||Viu CvAUTOLOAD|5.015004||Viu CvAUTOLOAD_off|5.015004||Viu CvAUTOLOAD_on|5.015004||Viu cv_ckproto|5.009004||Viu cv_ckproto_len_flags|5.015004||xcViu CvCLONE|5.003007||Viu cv_clone|5.015001|5.015001| CvCLONED|5.003007||Viu CvCLONED_off|5.003007||Viu CvCLONED_on|5.003007||Viu cv_clone_into|5.017004||Viu CvCLONE_off|5.003007||Viu CvCLONE_on|5.003007||Viu CvCONST|5.007001||Viu CvCONST_off|5.007001||Viu CvCONST_on|5.007001||Viu cv_const_sv|5.003007|5.003007|n cv_const_sv_or_av|5.019003||Vniu CvCVGV_RC|5.013003||Viu CvCVGV_RC_off|5.013003||Viu CvCVGV_RC_on|5.013003||Viu CvDEPTH|5.003007|5.003007|nu CvDEPTHunsafe|5.021006||Viu cv_dump|5.006000||Vi CvDYNFILE|5.015002||Viu CvDYNFILE_off|5.015002||Viu CvDYNFILE_on|5.015002||Viu CvEVAL|5.005003||Viu CvEVAL_off|5.005003||Viu CvEVAL_on|5.005003||Viu CVf_ANON|5.003007||Viu CVf_ANONCONST|5.021008||Viu CVf_AUTOLOAD|5.015004||Viu CVf_BUILTIN_ATTRS|5.008000||Viu CVf_CLONE|5.003007||Viu CVf_CLONED|5.003007||Viu CVf_CONST|5.007001||Viu CVf_CVGV_RC|5.013003||Viu CVf_DYNFILE|5.015002||Viu CVf_HASEVAL|5.017002||Viu CvFILE|5.006000||Viu CvFILEGV|5.003007||Viu CvFILE_set_from_cop|5.007002||Viu CVf_ISXSUB|5.009004||Viu CvFLAGS|5.003007||Viu CVf_LEXICAL|5.021004||Viu CVf_LVALUE|5.006000||Viu CVf_METHOD|5.005000||Viu CVf_NAMED|5.017004||Viu CVf_NODEBUG|5.004000||Viu cv_forget_slab|5.017002||Vi CVf_SIGNATURE|5.035009||Viu CVf_SLABBED|5.017002||Viu CVf_UNIQUE|5.004000||Viu CVf_WEAKOUTSIDE|5.008001||Viu cv_get_call_checker|5.013006|5.013006| cv_get_call_checker_flags|5.027003|5.027003| CvGV|5.003007|5.003007| cvgv_from_hek|||ciu cvgv_set|5.013003||cViu CvGV_set|5.013003||Viu CvHASEVAL|5.017002||Viu CvHASEVAL_off|5.017002||Viu CvHASEVAL_on|5.017002||Viu CvHASGV|5.021004||Viu CvHSCXT|5.021006||Viu CvISXSUB|5.009004||Viu CvISXSUB_off|5.009004||Viu CvISXSUB_on|5.009004||Viu CvLEXICAL|5.021004||Viu CvLEXICAL_off|5.021004||Viu CvLEXICAL_on|5.021004||Viu CvLVALUE|5.006000||Viu CvLVALUE_off|5.006000||Viu CvLVALUE_on|5.006000||Viu CvMETHOD|5.005000||Viu CvMETHOD_off|5.005000||Viu CvMETHOD_on|5.005000||Viu cv_name|5.021005|5.021005| CvNAMED|5.017004||Viu CvNAMED_off|5.017004||Viu CvNAMED_on|5.017004||Viu CvNAME_HEK_set|5.017004||Viu CV_NAME_NOTQUAL|5.021005|5.021005| CvNODEBUG|5.004000||Viu CvNODEBUG_off|5.004000||Viu CvNODEBUG_on|5.004000||Viu CvOUTSIDE|5.003007||Viu CvOUTSIDE_SEQ|5.008001||Viu CvPADLIST|5.008001|5.008001|x CvPADLIST_set|5.021006||Viu CvPROTO|5.015004||Viu CvPROTOLEN|5.015004||Viu CvROOT|5.003007||Viu cv_set_call_checker|5.013006|5.013006| cv_set_call_checker_flags|5.021004|5.021004| CvSIGNATURE|5.035009||Viu CvSIGNATURE_off|5.035009||Viu CvSIGNATURE_on|5.035009||Viu CvSLABBED|5.017002||Viu CvSLABBED_off|5.017002||Viu CvSLABBED_on|5.017002||Viu CvSPECIAL|5.005003||Viu CvSPECIAL_off|5.005003||Viu CvSPECIAL_on|5.005003||Viu CvSTART|5.003007||Viu CvSTASH|5.003007|5.003007| cvstash_set|5.013007||cViu CvSTASH_set|5.013007||Viu cv_undef|5.003007|5.003007| cv_undef_flags|5.021004||Viu CV_UNDEF_KEEP_NAME|5.021004||Viu CvUNIQUE|5.004000||Viu CvUNIQUE_off|5.004000||Viu CvUNIQUE_on|5.004000||Viu CvWEAKOUTSIDE|5.008001||Vi CvWEAKOUTSIDE_off|5.008001||Viu CvWEAKOUTSIDE_on|5.008001||Viu CvXSUB|5.003007||Viu CvXSUBANY|5.003007||Viu CX_CUR|5.023008||Viu CX_CURPAD_SAVE|5.008001||Vi CX_CURPAD_SV|5.008001||Vi CX_DEBUG|5.023008||Viu cx_dump|5.003007||cVu cx_dup|5.006000||cVu CxEVALBLOCK|5.033007||Viu CxEVAL_TXT_REFCNTED|5.025007||Viu CxFOREACH|5.009003||Viu CxHASARGS|5.010001||Viu cxinc|5.003007||cVu CXINC|5.003007||Viu CxITERVAR|5.006000||Viu CxLABEL|5.010001||Viu CxLABEL_len|5.016000||Viu CxLABEL_len_flags|5.016000||Viu CX_LEAVE_SCOPE|5.023008||Viu CxLVAL|5.010001||Viu CxMULTICALL|5.009003||Viu CxOLD_IN_EVAL|5.010001||Viu CxOLD_OP_TYPE|5.010001||Viu CxONCE|5.010001||Viu CxPADLOOP|5.006000||Viu CXp_EVALBLOCK|5.033007||Viu CXp_FINALLY|5.035008||Viu CXp_FOR_DEF|5.027008||Viu CXp_FOR_GV|5.023008||Viu CXp_FOR_LVREF|5.021005||Viu CXp_FOR_PAD|5.023008||Viu CXp_HASARGS|5.011000||Viu CXp_MULTICALL|5.009003||Viu CXp_ONCE|5.011000||Viu CX_POP|5.023008||Viu cx_popblock|5.023008||xcVu cx_popeval|5.023008||xcVu cx_popformat|5.023008||xcVu cx_popgiven|5.027008||xcVu cx_poploop|5.023008||xcVu CX_POP_SAVEARRAY|5.023008||Viu cx_popsub|5.023008||xcVu cx_popsub_args|5.023008||xcVu cx_popsub_common|5.023008||xcVu CX_POPSUBST|5.023008||Viu cx_popwhen|5.027008||xcVu CXp_REAL|5.005003||Viu CXp_SUB_RE|5.018000||Viu CXp_SUB_RE_FAKE|5.018000||Viu CXp_TRY|5.033007||Viu CXp_TRYBLOCK|5.006000||Viu cx_pushblock|5.023008||xcVu cx_pusheval|5.023008||xcVu cx_pushformat|5.023008||xcVu cx_pushgiven|5.027008||xcVu cx_pushloop_for|5.023008||xcVu cx_pushloop_plain|5.023008||xcVu cx_pushsub|5.023008||xcVu CX_PUSHSUB_GET_LVALUE_MASK|5.023008||Viu CX_PUSHSUBST|5.023008||Viu cx_pushtry|5.033007||xcVu cx_pushwhen|5.027008||xcVu CxREALEVAL|5.005003||Viu cxstack|5.005000||Viu cxstack_ix|5.005000||Viu cxstack_max|5.005000||Viu CXt_BLOCK|5.003007||Viu CXt_DEFER|5.035004||Viu CXt_EVAL|5.003007||Viu CXt_FORMAT|5.006000||Viu CXt_GIVEN|5.027008||Viu CXt_LOOP_ARY|5.023008||Viu CXt_LOOP_LAZYIV|5.011000||Viu CXt_LOOP_LAZYSV|5.011000||Viu CXt_LOOP_LIST|5.023008||Viu CXt_LOOP_PLAIN|5.011000||Viu CXt_NULL|5.003007||Viu cx_topblock|5.023008||xcVu CxTRY|5.033007||Viu CxTRYBLOCK|5.006000||Viu CXt_SUB|5.003007||Viu CXt_SUBST|5.003007||Viu CXt_WHEN|5.027008||Viu CxTYPE|5.005003||Viu cx_type|5.009005||Viu CxTYPE_is_LOOP|5.011000||Viu CXTYPEMASK|5.005003||Viu dATARGET|5.003007||Viu dAX|5.007002|5.003007|p dAXMARK|5.009003|5.003007|p DAY_1|5.027010||Viu DAY_2|5.027010||Viu DAY_3|5.027010||Viu DAY_4|5.027010||Viu DAY_5|5.027010||Viu DAY_6|5.027010||Viu DAY_7|5.027010||Viu DB_Hash_t|5.003007|5.003007|Vn DBM_ckFilter|5.008001||Viu DBM_setFilter|5.008001||Viu DB_Prefix_t|5.003007|5.003007|Vn DBVARMG_COUNT|5.021005||Viu DBVARMG_SIGNAL|5.021005||Viu DBVARMG_SINGLE|5.021005||Viu DBVARMG_TRACE|5.021005||Viu DB_VERSION_MAJOR_CFG|5.007002|5.007002|Vn DB_VERSION_MINOR_CFG|5.007002|5.007002|Vn DB_VERSION_PATCH_CFG|5.007002|5.007002|Vn deb|5.003007||vVu deb_curcv|5.007002||Viu deb_nocontext|5.006000||vVnu debop|5.005000|5.005000|u debprof|5.005000||Viu debprofdump|5.005000|5.005000|u debstack|5.007003|5.007003|u deb_stack_all|5.008001||Viu deb_stack_n|5.008001||Viu debstackptrs|5.007003|5.007003|u DEBUG|5.003007||Viu DEBUG_A|5.009001||Viu DEBUG_A_FLAG|5.009001||Viu DEBUG_A_TEST|5.009001||Viu DEBUG_B|5.011000||Viu DEBUG_B_FLAG|5.011000||Viu DEBUG_BOTH_FLAGS_TEST|5.033007||Viu DEBUG_B_TEST|5.011000||Viu DEBUG_BUFFERS_r|5.009005||Viu DEBUG_c|5.003007||Viu DEBUG_C|5.009000||Viu DEBUG_c_FLAG|5.007001||Viu DEBUG_C_FLAG|5.009000||Viu DEBUG_COMPILE_r|5.009002||Viu DEBUG_c_TEST|5.007001||Viu DEBUG_C_TEST|5.009000||Viu DEBUG_D|5.003007||Viu DEBUG_DB_RECURSE_FLAG|5.007001||Viu DEBUG_D_FLAG|5.007001||Viu DEBUG_D_TEST|5.007001||Viu DEBUG_DUMP_PRE_OPTIMIZE_r|5.031004||Viu DEBUG_DUMP_r|5.009004||Viu DEBUG_EXECUTE_r|5.009002||Viu DEBUG_EXTRA_r|5.009004||Viu DEBUG_f|5.003007||Viu DEBUG_f_FLAG|5.007001||Viu DEBUG_FLAGS_r|5.009005||Viu DEBUG_f_TEST|5.007001||Viu DEBUG_GPOS_r|5.011000||Viu DEBUG_i|5.025002||Viu DEBUG_i_FLAG|5.025002||Viu DEBUG_INTUIT_r|5.009004||Viu DEBUG_i_TEST|5.025002||Viu DEBUG_J_FLAG|5.007003||Viu DEBUG_J_TEST|5.007003||Viu DEBUG_l|5.003007||Viu DEBUG_L|5.019009||Viu DEBUG_l_FLAG|5.007001||Viu DEBUG_L_FLAG|5.019009||Viu DEBUG_l_TEST|5.007001||Viu DEBUG_L_TEST|5.019009||Viu DEBUG_Lv|5.023003||Viu DEBUG_Lv_TEST|5.023003||Viu DEBUG_m|5.003007||Viu DEBUG_M|5.027008||Viu DEBUG_MASK|5.007001||Viu DEBUG_MATCH_r|5.009004||Viu DEBUG_m_FLAG|5.007001||Viu DEBUG_M_FLAG|5.027008||Viu DEBUG_m_TEST|5.007001||Viu DEBUG_M_TEST|5.027008||Viu DEBUG_o|5.003007||Viu DEBUG_o_FLAG|5.007001||Viu DEBUG_OPTIMISE_MORE_r|5.009005||Viu DEBUG_OPTIMISE_r|5.009002||Viu DEBUG_o_TEST|5.007001||Viu DEBUG_P|5.003007||Viu DEBUG_p|5.003007||Viu DEBUG_PARSE_r|5.009004||Viu DEBUG_P_FLAG|5.007001||Viu DEBUG_p_FLAG|5.007001||Viu DEBUG_POST_STMTS|5.033008||Viu DEBUG_PRE_STMTS|5.033008||Viu DEBUG_P_TEST|5.007001||Viu DEBUG_p_TEST|5.007001||Viu DEBUG_Pv|5.013008||Viu DEBUG_Pv_TEST|5.013008||Viu DEBUG_q|5.009001||Viu DEBUG_q_FLAG|5.009001||Viu DEBUG_q_TEST|5.009001||Viu DEBUG_r|5.003007||Viu DEBUG_R|5.007001||Viu DEBUG_R_FLAG|5.007001||Viu DEBUG_r_FLAG|5.007001||Viu DEBUG_R_TEST|5.007001||Viu DEBUG_r_TEST|5.007001||Viu DEBUG_s|5.003007||Viu DEBUG_S|5.017002||Viu DEBUG_SBOX32_HASH|5.027001||Viu DEBUG_SCOPE|5.008001||Viu DEBUG_s_FLAG|5.007001||Viu DEBUG_S_FLAG|5.017002||Viu DEBUG_STACK_r|5.009005||Viu debug_start_match|5.009004||Viu DEBUG_STATE_r|5.009004||Viu DEBUG_s_TEST|5.007001||Viu DEBUG_S_TEST|5.017002||Viu DEBUG_t|5.003007||Viu DEBUG_T|5.007001||Viu DEBUG_TEST_r|5.021005||Viu DEBUG_T_FLAG|5.007001||Viu DEBUG_t_FLAG|5.007001||Viu DEBUG_TOP_FLAG|5.007001||Viu DEBUG_TRIE_COMPILE_MORE_r|5.009002||Viu DEBUG_TRIE_COMPILE_r|5.009002||Viu DEBUG_TRIE_EXECUTE_MORE_r|5.009002||Viu DEBUG_TRIE_EXECUTE_r|5.009002||Viu DEBUG_TRIE_r|5.009002||Viu DEBUG_T_TEST|5.007001||Viu DEBUG_t_TEST|5.007001||Viu DEBUG_u|5.003007||Viu DEBUG_U|5.009005||Viu DEBUG_u_FLAG|5.007001||Viu DEBUG_U_FLAG|5.009005||Viu DEBUG_u_TEST|5.007001||Viu DEBUG_U_TEST|5.009005||Viu DEBUG_Uv|5.009005||Viu DEBUG_Uv_TEST|5.009005||Viu DEBUG_v|5.008001||Viu DEBUG_v_FLAG|5.008001||Viu DEBUG_v_TEST|5.008001||Viu DEBUG_X|5.003007||Viu DEBUG_x|5.003007||Viu DEBUG_X_FLAG|5.007001||Viu DEBUG_x_FLAG|5.007001||Viu DEBUG_X_TEST|5.007001||Viu DEBUG_x_TEST|5.007001||Viu DEBUG_Xv|5.008001||Viu DEBUG_Xv_TEST|5.008001||Viu DEBUG_y|5.031007||Viu DEBUG_y_FLAG|5.031007||Viu DEBUG_y_TEST|5.031007||Viu DEBUG_yv|5.031007||Viu DEBUG_yv_TEST|5.031007||Viu DEBUG_ZAPHOD32_HASH|5.027001||Viu DECLARATION_FOR_LC_NUMERIC_MANIPULATION|5.021010|5.021010|p DECLARE_AND_GET_RE_DEBUG_FLAGS|5.031011||Viu DECLARE_AND_GET_RE_DEBUG_FLAGS_NON_REGEX|5.031011||Viu DEFAULT_INC_EXCLUDES_DOT|5.025011|5.025011|Vn DEFAULT_PAT_MOD|5.013006||Viu defelem_target|5.019002||Viu DEFINE_INC_MACROS|5.027006||Viu DEFINEP|5.009005||Viu DEFINEP_t8|5.035004||Viu DEFINEP_t8_p8|5.033003||Viu DEFINEP_t8_pb|5.033003||Viu DEFINEP_tb|5.035004||Viu DEFINEP_tb_p8|5.033003||Viu DEFINEP_tb_pb|5.033003||Viu DEFSV|5.004005|5.003007|p DEFSV_set|5.010001|5.003007|p del_body_by_type|||Viu delete_eval_scope|5.009004||xViu delimcpy|5.004000|5.004000|n delimcpy_no_escape|5.025005||cVni DEL_NATIVE|5.017010||Viu del_sv|5.005000||Viu DEPENDS_PAT_MOD|5.013009||Viu DEPENDS_PAT_MODS|5.013009||Viu deprecate|5.011001||Viu deprecate_disappears_in|5.025009||Viu deprecate_fatal_in|5.025009||Viu despatch_signals|5.007001||cVu destroy_matcher|5.027008||Viu DETACH|5.005000||Viu dEXT|5.003007||Viu dEXTCONST|5.004000||Viu DFA_RETURN_FAILURE|5.035004||Viu DFA_RETURN_SUCCESS|5.035004||Viu DFA_TEASE_APART_FF|5.035004||Viu D_FMT|5.027010||Viu DIE|5.003007||Viu die|5.003007||vV die_nocontext|5.006000||vVn die_sv|5.013001|5.003007|p die_unwind|5.013001||Viu Direntry_t|5.003007|5.003007|Vn dirp_dup|5.013007|5.013007|u dITEMS|5.007002|5.003007|p div128|5.005000||Viu dJMPENV|5.004000||Viu djSP|5.004005||Vi dMARK|5.003007|5.003007| DM_ARRAY_ISA|5.013002||Viu DM_DELAY|5.003007||Viu DM_EGID|5.003007||Viu DM_EUID|5.003007||Viu DM_GID|5.003007||Viu DM_RGID|5.003007||Viu DM_RUID|5.003007||Viu DM_UID|5.003007||Viu dMULTICALL|5.009003|5.009003| dMY_CXT|5.009000|5.009000|p dMY_CXT_INTERP|5.009003||Viu dMY_CXT_SV|5.007003|5.003007|pV dNOOP|5.006000|5.003007|p do_aexec|5.009003||Viu do_aexec5|5.006000||Viu do_aspawn|5.008000||Vu do_binmode|5.004005|5.004005|du docatch|5.005000||Vi do_chomp|5.003007||Viu do_close|5.003007|5.003007|u do_delete_local|5.011000||Viu do_dump_pad|5.008001||Vi do_eof|5.003007||Viu does_utf8_overflow|5.025006||Vniu doeval_compile|5.023008||Viu do_exec3|5.006000||Viu do_exec|5.009003||Viu dofile|5.005003||Viu dofindlabel|5.003007||Viu doform|5.005000||Viu do_gv_dump|5.006000||cVu do_gvgv_dump|5.006000||cVu do_hv_dump|5.006000||cVu doing_taint|5.008001||cVnu DOINIT|5.003007||Viu do_ipcctl|5.003007||Viu do_ipcget|5.003007||Viu do_join|5.003007|5.003007|u do_magic_dump|5.006000||cVu do_msgrcv|5.003007||Viu do_msgsnd|5.003007||Viu do_ncmp|5.015001||Viu do_oddball|5.006000||Viu dooneliner|5.006000||Viu do_op_dump|5.006000||cVu do_open|5.003007|5.003007|u do_open6|5.019010||xViu do_open9|5.006000|5.006000|du do_openn|5.007001|5.007001|u doopen_pm|5.008001||Viu do_open_raw|5.019010||xViu doparseform|5.005000||Viu do_pmop_dump|5.006000||cVu dopoptoeval|5.003007||Viu dopoptogivenfor|5.027008||Viu dopoptolabel|5.005000||Viu dopoptoloop|5.005000||Viu dopoptosub_at|5.005000||Viu dopoptowhen|5.027008||Viu do_print|5.003007||Viu do_readline|5.003007||Viu doref|5.009003|5.009003|u dORIGMARK|5.003007|5.003007| do_seek|5.003007||Viu do_semop|5.003007||Viu do_shmio|5.003007||Viu DOSISH|5.003007||Viu do_smartmatch|5.027008||Viu do_spawn|5.008000||Vu do_spawn_nowait|5.008000||Vu do_sprintf|5.003007|5.003007|u do_sv_dump|5.006000||cVu do_sysseek|5.004000||Viu do_tell|5.003007||Viu do_trans|5.003007||Viu do_trans_complex|5.006001||Viu do_trans_count|5.006001||Viu do_trans_count_invmap|5.031006||Viu do_trans_invmap|5.031006||Viu do_trans_simple|5.006001||Viu DOUBLE_BIG_ENDIAN|5.021009||Viu DOUBLE_HAS_INF|5.025003|5.025003|Vn DOUBLE_HAS_NAN|5.025003|5.025003|Vn DOUBLE_HAS_NEGATIVE_ZERO|5.025007|5.025007|Vn DOUBLE_HAS_SUBNORMALS|5.025007|5.025007|Vn DOUBLEINFBYTES|5.023000|5.023000|Vn DOUBLE_IS_CRAY_SINGLE_64_BIT|5.025006|5.025006|Vn DOUBLE_IS_IBM_DOUBLE_64_BIT|5.025006|5.025006|Vn DOUBLE_IS_IBM_SINGLE_32_BIT|5.025006|5.025006|Vn DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN|5.021006|5.021006|Vn DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN|5.021006|5.021006|Vn DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN|5.021006|5.021006|Vn DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN|5.021006|5.021006|Vn DOUBLE_IS_IEEE_754_64_BIT_BIG_ENDIAN|5.021006|5.021006|Vn DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN|5.021006|5.021006|Vn DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_BE_LE|5.021006|5.021006|Vn DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE|5.021006|5.021006|Vn DOUBLE_IS_IEEE_FORMAT|5.025003||Viu DOUBLE_IS_UNKNOWN_FORMAT|5.021006|5.021006|Vn DOUBLE_IS_VAX_D_FLOAT|5.025003|5.025003|Vn DOUBLE_IS_VAX_F_FLOAT|5.025003|5.025003|Vn DOUBLE_IS_VAX_FLOAT|5.025003||Viu DOUBLE_IS_VAX_G_FLOAT|5.025003|5.025003|Vn DOUBLEKIND|5.021006|5.021006|Vn DOUBLE_LITTLE_ENDIAN|5.021009||Viu DOUBLEMANTBITS|5.023000|5.023000|Vn DOUBLE_MIX_ENDIAN|5.021009||Viu DOUBLENANBYTES|5.023000|5.023000|Vn DOUBLESIZE|5.005000|5.005000|Vn DOUBLE_STYLE_IEEE|5.025007|5.025007|Vn DOUBLE_VAX_ENDIAN|5.025003||Viu do_uniprop_match|5.031011||cVniu dounwind|5.003007|5.003007|u DO_UTF8|5.006000|5.006000| do_vecget|5.006000||Viu do_vecset|5.003007||Viu do_vop|5.003007||Viu dowantarray|5.003007|5.003007|u dPOPiv|5.003007||Viu dPOPnv|5.003007||Viu dPOPnv_nomg|5.013002||Viu dPOPPOPiirl|5.003007||Viu dPOPPOPnnrl|5.003007||Viu dPOPPOPssrl|5.003007||Viu dPOPss|5.003007||Viu dPOPTOPiirl|5.003007||Viu dPOPTOPiirl_nomg|5.013002||Viu dPOPTOPiirl_ul_nomg|5.013002||Viu dPOPTOPnnrl|5.003007||Viu dPOPTOPnnrl_nomg|5.013002||Viu dPOPTOPssrl|5.003007||Viu dPOPuv|5.004000||Viu dPOPXiirl|5.004000||Viu dPOPXiirl_ul_nomg|5.013002||Viu dPOPXnnrl|5.004000||Viu dPOPXssrl|5.004000||Viu DPTR2FPTR|5.009003||Viu Drand01|5.006000|5.006000| drand48_init_r|||cniu drand48_r|||cniu DRAND48_R_PROTO|5.008000|5.008000|Vn dSAVEDERRNO|5.010001||Vi dSAVE_ERRNO|5.010001||Vi dSP|5.003007|5.003007| dSS_ADD|5.017007||Viu dTARG|5.003007||Viu dTARGET|5.003007|5.003007| dTARGETSTACKED|5.003007||Viu D_T_FMT|5.027010||Viu dTHR|5.004005|5.003007|p dTHX|5.003007|5.003007|p dTHXa|5.006000|5.003007|p dTHX_DEBUGGING|5.027009||Viu dTHXo|5.006000||Viu dTHXoa|5.006001|5.003007|p dTHXR||5.003007|ponu dTHXs|5.007002||Viu dTHXx|5.006000||Viu dTOPiv|5.003007||Viu dTOPnv|5.003007||Viu dTOPss|5.003007||Viu dTOPuv|5.004000||Viu dtrace_probe_call|||ciu dtrace_probe_load|||ciu dtrace_probe_op|||ciu dtrace_probe_phase|||ciu dump_all|5.006000|5.006000| dump_all_perl|5.011000||Viu dump_c_backtrace|5.021001||V dump_eval|5.006000|5.006000|u dump_exec_pos|5.009004||Viu dump_form|5.006000|5.006000|u dump_indent|5.006000||vcVu dump_mstats|5.003007||Vu dump_packsubs|5.006000|5.006000| dump_packsubs_perl|5.011000||Viu dump_regex_sets_structures|5.025006||Viu dump_sub|5.006000|5.006000|u dump_sub_perl|5.011000||Viu dump_sv_child|5.009003||Viu dump_trie|5.009004||Viu dump_trie_interim_list|5.009004||Viu dump_trie_interim_table|5.009004||Viu dumpuntil|5.005000||Viu dump_vindent|5.006000||cVu dUNDERBAR|5.009002|5.003007|p dup2|5.005000||Viu dup|5.005000||Viu dup_attrlist|5.006000||Viu DUP_WARNINGS|5.009004||Viu dup_warnings|||ciu dVAR|5.009003|5.003007|p dXCPT|5.009002|5.003007|p dXSARGS|5.003007|5.003007| dXSBOOTARGSAPIVERCHK|5.021006||Viu dXSBOOTARGSNOVERCHK|5.021006||Viu dXSBOOTARGSXSAPIVERCHK|5.021006||Viu dXSFUNCTION|5.005000||Viu dXSI32|5.003007|5.003007|V dXSTARG|5.006000|5.003007|poVnu dXSUB_SYS|5.003007||Viu edit_distance|5.023008||Vniu EIGHT_BIT_UTF8_TO_NATIVE|5.023003||Viu ELEMENT_RANGE_MATCHES_INVLIST|5.023002||Viu EMBEDMYMALLOC|5.006000||Viu emulate_cop_io|||xciu emulate_setlocale|5.027009||Vniu END|5.003007||Viu END_EXTERN_C|5.005000|5.003007|pV endgrent|5.009000||Viu ENDGRENT_R_HAS_FPTR|5.008000||Viu ENDGRENT_R_PROTO|5.008000|5.008000|Vn endhostent|5.005000||Viu ENDHOSTENT_R_PROTO|5.008000|5.008000|Vn ENDLIKE|5.009005||Viu ENDLIKE_t8|5.035004||Viu ENDLIKE_t8_p8|5.033003||Viu ENDLIKE_t8_pb|5.033003||Viu ENDLIKE_tb|5.035004||Viu ENDLIKE_tb_p8|5.033003||Viu ENDLIKE_tb_pb|5.033003||Viu endnetent|5.005000||Viu ENDNETENT_R_PROTO|5.008000|5.008000|Vn endprotoent|5.005000||Viu ENDPROTOENT_R_PROTO|5.008000|5.008000|Vn endpwent|5.009000||Viu ENDPWENT_R_HAS_FPTR|5.008000||Viu ENDPWENT_R_PROTO|5.008000|5.008000|Vn endservent|5.005000||Viu ENDSERVENT_R_PROTO|5.008000|5.008000|Vn END_t8|5.035004||Viu END_t8_p8|5.033003||Viu END_t8_pb|5.033003||Viu END_tb|5.035004||Viu END_tb_p8|5.033003||Viu END_tb_pb|5.033003||Viu ENTER|5.003007|5.003007| ENTER_with_name|5.011002|5.011002| ENV_INIT|5.031011||Viu environ|5.003007||Viu ENV_LOCALE_LOCK|5.031011||Viu ENV_LOCALE_READ_LOCK|5.031011||Viu ENV_LOCALE_READ_UNLOCK|5.031011||Viu ENV_LOCALE_UNLOCK|5.031011||Viu ENV_LOCK|5.031011||Viu ENV_READ_LOCK|5.033005||Viu ENV_READ_UNLOCK|5.033005||Viu ENV_TERM|5.031011||Viu ENV_UNLOCK|5.031011||Viu EOF|5.003007||Viu EOF_NONBLOCK|5.003007|5.003007|Vn EOL|5.003007||Viu EOL_t8|5.035004||Viu EOL_t8_p8|5.033003||Viu EOL_t8_pb|5.033003||Viu EOL_tb|5.035004||Viu EOL_tb_p8|5.033003||Viu EOL_tb_pb|5.033003||Viu EOS|5.005000||Viu EOS_t8|5.035004||Viu EOS_t8_p8|5.033003||Viu EOS_t8_pb|5.033003||Viu EOS_tb|5.035004||Viu EOS_tb_p8|5.033003||Viu EOS_tb_pb|5.033003||Viu ERA|5.027010||Viu ERA_D_FMT|5.027010||Viu ERA_D_T_FMT|5.027010||Viu ERA_T_FMT|5.027010||Viu ERRSV|5.004005|5.003007|p ESC_NATIVE|5.021004||Viu EVAL|5.005000||Viu EVAL_B|5.025010||Viu EVAL_B_fail|5.025010||Viu EVAL_B_fail_t8|5.035004||Viu EVAL_B_fail_t8_p8|5.033003||Viu EVAL_B_fail_t8_pb|5.033003||Viu EVAL_B_fail_tb|5.035004||Viu EVAL_B_fail_tb_p8|5.033003||Viu EVAL_B_fail_tb_pb|5.033003||Viu EVAL_B_t8|5.035004||Viu EVAL_B_t8_p8|5.033003||Viu EVAL_B_t8_pb|5.033003||Viu EVAL_B_tb|5.035004||Viu EVAL_B_tb_p8|5.033003||Viu EVAL_B_tb_pb|5.033003||Viu EVAL_INEVAL|5.006000||Viu EVAL_INREQUIRE|5.007001||Viu EVAL_KEEPERR|5.006000||Viu EVAL_NULL|5.006000||Viu EVAL_postponed_AB|5.025010||Viu EVAL_postponed_AB_fail|5.025010||Viu EVAL_postponed_AB_fail_t8|5.035004||Viu EVAL_postponed_AB_fail_t8_p8|5.033003||Viu EVAL_postponed_AB_fail_t8_pb|5.033003||Viu EVAL_postponed_AB_fail_tb|5.035004||Viu EVAL_postponed_AB_fail_tb_p8|5.033003||Viu EVAL_postponed_AB_fail_tb_pb|5.033003||Viu EVAL_postponed_AB_t8|5.035004||Viu EVAL_postponed_AB_t8_p8|5.033003||Viu EVAL_postponed_AB_t8_pb|5.033003||Viu EVAL_postponed_AB_tb|5.035004||Viu EVAL_postponed_AB_tb_p8|5.033003||Viu EVAL_postponed_AB_tb_pb|5.033003||Viu eval_pv|5.006000|5.003007|p EVAL_RE_REPARSING|5.017011||Viu eval_sv|5.006000|5.003007|p EVAL_t8|5.035004||Viu EVAL_t8_p8|5.033003||Viu EVAL_t8_pb|5.033003||Viu EVAL_tb|5.035004||Viu EVAL_tb_p8|5.033003||Viu EVAL_tb_pb|5.033003||Viu EVAL_WARNONLY|5.006000||Viu EXACT|5.004000||Viu EXACTF|5.004000||Viu EXACTFAA|5.027009||Viu EXACTFAA_NO_TRIE|5.027009||Viu EXACTFAA_NO_TRIE_t8|5.035004||Viu EXACTFAA_NO_TRIE_t8_p8|5.033003||Viu EXACTFAA_NO_TRIE_t8_pb|5.033003||Viu EXACTFAA_NO_TRIE_tb|5.035004||Viu EXACTFAA_NO_TRIE_tb_p8|5.033003||Viu EXACTFAA_NO_TRIE_tb_pb|5.033003||Viu EXACTFAA_t8|5.035004||Viu EXACTFAA_t8_p8|5.033003||Viu EXACTFAA_t8_pb|5.033003||Viu EXACTFAA_tb|5.035004||Viu EXACTFAA_tb_p8|5.033003||Viu EXACTFAA_tb_pb|5.033003||Viu EXACTFL|5.004000||Viu EXACTFL_t8|5.035004||Viu EXACTFL_t8_p8|5.033003||Viu EXACTFL_t8_pb|5.033003||Viu EXACTFL_tb|5.035004||Viu EXACTFL_tb_p8|5.033003||Viu EXACTFL_tb_pb|5.033003||Viu EXACTFLU8|5.021008||Viu EXACTFLU8_t8|5.035004||Viu EXACTFLU8_t8_p8|5.033003||Viu EXACTFLU8_t8_pb|5.033003||Viu EXACTFLU8_tb|5.035004||Viu EXACTFLU8_tb_p8|5.033003||Viu EXACTFLU8_tb_pb|5.033003||Viu EXACTF_t8|5.035004||Viu EXACTF_t8_p8|5.033003||Viu EXACTF_t8_pb|5.033003||Viu EXACTF_tb|5.035004||Viu EXACTF_tb_p8|5.033003||Viu EXACTF_tb_pb|5.033003||Viu EXACTFU|5.013008||Viu EXACTFUP|5.029007||Viu EXACTFUP_t8|5.035004||Viu EXACTFUP_t8_p8|5.033003||Viu EXACTFUP_t8_pb|5.033003||Viu EXACTFUP_tb|5.035004||Viu EXACTFUP_tb_p8|5.033003||Viu EXACTFUP_tb_pb|5.033003||Viu EXACTFU_REQ8|5.031006||Viu EXACTFU_REQ8_t8|5.035004||Viu EXACTFU_REQ8_t8_p8|5.033003||Viu EXACTFU_REQ8_t8_pb|5.033003||Viu EXACTFU_REQ8_tb|5.035004||Viu EXACTFU_REQ8_tb_p8|5.033003||Viu EXACTFU_REQ8_tb_pb|5.033003||Viu EXACTFU_S_EDGE|5.029007||Viu EXACTFU_S_EDGE_t8|5.035004||Viu EXACTFU_S_EDGE_t8_p8|5.033003||Viu EXACTFU_S_EDGE_t8_pb|5.033003||Viu EXACTFU_S_EDGE_tb|5.035004||Viu EXACTFU_S_EDGE_tb_p8|5.033003||Viu EXACTFU_S_EDGE_tb_pb|5.033003||Viu EXACTFU_t8|5.035004||Viu EXACTFU_t8_p8|5.033003||Viu EXACTFU_t8_pb|5.033003||Viu EXACTFU_tb|5.035004||Viu EXACTFU_tb_p8|5.033003||Viu EXACTFU_tb_pb|5.033003||Viu EXACTL|5.021008||Viu EXACTL_t8|5.035004||Viu EXACTL_t8_p8|5.033003||Viu EXACTL_t8_pb|5.033003||Viu EXACTL_tb|5.035004||Viu EXACTL_tb_p8|5.033003||Viu EXACTL_tb_pb|5.033003||Viu EXACT_REQ8|5.031006||Viu EXACT_REQ8_t8|5.035004||Viu EXACT_REQ8_t8_p8|5.033003||Viu EXACT_REQ8_t8_pb|5.033003||Viu EXACT_REQ8_tb|5.035004||Viu EXACT_REQ8_tb_p8|5.033003||Viu EXACT_REQ8_tb_pb|5.033003||Viu EXACT_t8|5.035004||Viu EXACT_t8_p8|5.033003||Viu EXACT_t8_pb|5.033003||Viu EXACT_tb|5.035004||Viu EXACT_tb_p8|5.033003||Viu EXACT_tb_pb|5.033003||Viu EXEC_ARGV_CAST|5.007001||Viu exec_failed|5.009004||Viu execl|5.005000||Viu EXEC_PAT_MOD|5.009005||Viu EXEC_PAT_MODS|5.009005||Viu execute_wildcard|5.031010||Viu execv|5.005000||Viu execvp|5.005000||Viu exit|5.005000||Viu EXPECT|5.009004||Viu expect_number|5.007001||Viu EXT|5.003007||Viu EXTCONST|5.004000||Viu EXTEND|5.003007|5.003007| EXTEND_HWM_SET|5.027002||Viu EXTEND_MORTAL|5.004000||Viu EXTEND_SKIP|5.027002||Viu EXTERN_C|5.005000|5.003007|pV EXT_MGVTBL|5.009004||Viu EXT_PAT_MODS|5.009005||Viu EXTRA_SIZE|5.005000||Viu EXTRA_STEP_2ARGS|5.005000||Viu F0convert|5.009003||Vniu FAKE_BIT_BUCKET|5.009005||Viu FAKE_DEFAULT_SIGNAL_HANDLERS|5.009003||Viu FAKE_PERSISTENT_SIGNAL_HANDLERS|5.009003||Viu FALSE|5.003007||Viu FATAL_ABOVE_FF_MSG|5.027010||Viu F_atan2_amg|5.004000||Viu FBMcf_TAIL|5.006000||Viu FBMcf_TAIL_DOLLAR|5.006000||Viu FBMcf_TAIL_DOLLARM|5.006000||Viu FBMcf_TAIL_Z|5.006000||Viu FBMcf_TAIL_z|5.006000||Viu fbm_compile|5.005000|5.005000| fbm_instr|5.005000|5.005000| FBMrf_MULTILINE|5.006000||Viu fclose|5.003007||Viu fcntl|5.006000||Viu FCNTL_CAN_LOCK|5.007001|5.007001|Vn F_cos_amg|5.004000||Viu FD_CLR|5.008000||Viu FD_ISSET|5.008000||Viu fdopen|5.003007||Viu FD_SET|5.008000||Viu fd_set|5.008000||Viu FD_ZERO|5.008000||Viu FEATURE_BAREWORD_FILEHANDLES_BIT|5.033006||Viu FEATURE_BAREWORD_FILEHANDLES_IS_ENABLED|5.033006||Viu FEATURE_BITWISE_BIT|5.031006||Viu FEATURE_BITWISE_IS_ENABLED|5.021009||Viu FEATURE_BUNDLE_510|5.015007||Viu FEATURE_BUNDLE_511|5.015007||Viu FEATURE_BUNDLE_515|5.015007||Viu FEATURE_BUNDLE_523|5.023001||Viu FEATURE_BUNDLE_527|5.027008||Viu FEATURE_BUNDLE_535|5.035003||Viu FEATURE_BUNDLE_CUSTOM|5.015007||Viu FEATURE_BUNDLE_DEFAULT|5.015007||Viu FEATURE_DEFER_BIT|5.035004||Viu FEATURE_DEFER_IS_ENABLED|5.035004||Viu FEATURE_EVALBYTES_BIT|5.031006||Viu FEATURE_EVALBYTES_IS_ENABLED|5.015007||Viu FEATURE_FC_BIT|5.031006||Viu FEATURE_FC_IS_ENABLED|5.015008||Viu FEATURE_INDIRECT_BIT|5.031010||Viu FEATURE_INDIRECT_IS_ENABLED|5.031010||Viu FEATURE_ISA_BIT|5.031007||Viu FEATURE_ISA_IS_ENABLED|5.031007||Viu FEATURE_IS_ENABLED_MASK|5.031006||Viu FEATURE_MULTIDIMENSIONAL_BIT|5.033001||Viu FEATURE_MULTIDIMENSIONAL_IS_ENABLED|5.033001||Viu FEATURE_MYREF_BIT|5.031006||Viu FEATURE_MYREF_IS_ENABLED|5.025003||Viu FEATURE_POSTDEREF_QQ_BIT|5.031006||Viu FEATURE_POSTDEREF_QQ_IS_ENABLED|5.019005||Viu FEATURE_REFALIASING_BIT|5.031006||Viu FEATURE_REFALIASING_IS_ENABLED|5.021005||Viu FEATURE_SAY_BIT|5.031006||Viu FEATURE_SAY_IS_ENABLED|5.015007||Viu FEATURE_SIGNATURES_BIT|5.031006||Viu FEATURE_SIGNATURES_IS_ENABLED|5.019009||Viu FEATURE_STATE_BIT|5.031006||Viu FEATURE_STATE_IS_ENABLED|5.015007||Viu FEATURE___SUB___BIT|5.031006||Viu FEATURE___SUB___IS_ENABLED|5.015007||Viu FEATURE_SWITCH_BIT|5.031006||Viu FEATURE_SWITCH_IS_ENABLED|5.015007||Viu FEATURE_TRY_BIT|5.033007||Viu FEATURE_TRY_IS_ENABLED|5.033007||Viu FEATURE_UNICODE_BIT|5.031006||Viu FEATURE_UNICODE_IS_ENABLED|5.015007||Viu FEATURE_UNIEVAL_BIT|5.031006||Viu FEATURE_UNIEVAL_IS_ENABLED|5.015007||Viu feof|5.003007||Viu ferror|5.003007||Viu FETCHFEATUREBITSHH|5.031006||Viu F_exp_amg|5.004000||Viu FF_0DECIMAL|5.007001||Viu FF_BLANK|5.003007||Viu FF_CHECKCHOP|5.003007||Viu FF_CHECKNL|5.003007||Viu FF_CHOP|5.003007||Viu FF_DECIMAL|5.003007||Viu FF_END|5.003007||Viu FF_FETCH|5.003007||Viu FF_HALFSPACE|5.003007||Viu FF_ITEM|5.003007||Viu FF_LINEGLOB|5.003007||Viu FF_LINEMARK|5.003007||Viu FF_LINESNGL|5.009001||Viu FF_LITERAL|5.003007||Viu Fflush|5.003007||Viu fflush|5.003007||Viu FFLUSH_NULL|5.006000|5.006000|Vn FF_MORE|5.003007||Viu FF_NEWLINE|5.003007||Viu FF_SKIP|5.003007||Viu FF_SPACE|5.003007||Viu fgetc|5.003007||Viu fgetpos|5.003007||Viu fgets|5.003007||Viu FILE|5.003007||Viu FILE_base|5.007000|5.007000| FILE_bufsiz|5.007000|5.007000| FILE_cnt|5.007000|5.007000| fileno|5.003007||Viu FILE_ptr|5.007000|5.007000| FILL_ADVANCE_NODE_2L_ARG|5.021005||Viu FILL_ADVANCE_NODE|5.005000||Viu FILL_ADVANCE_NODE_ARG|5.005000||Viu FILL_ADVANCE_NODE_ARGp|5.031010||Viu FILL_NODE|5.029004||Viu filter_add|5.003007|5.003007| FILTER_DATA|5.003007||Viu filter_del|5.003007|5.003007|u filter_gets|5.005000||Viu FILTER_ISREADER|5.003007||Viu filter_read|5.003007|5.003007| FILTER_READ|5.003007||Viu finalize_op|5.015002||Viu finalize_optree|5.015002||Vi find_and_forget_pmops|5.009005||Viu find_array_subscript|5.009004||Viu find_beginning|5.005000||Viu find_byclass|5.006000||Viu find_default_stash|5.019004||Viu find_first_differing_byte_pos|5.031007||Vniu find_hash_subscript|5.009004||Viu find_in_my_stash|5.006001||Viu find_lexical_cv|5.019001||Viu find_next_masked|5.027009||Vniu find_runcv|5.009005|5.009005| FIND_RUNCV_level_eq|5.017002||Viu FIND_RUNCV_padid_eq|5.017004||Viu find_runcv_where|5.017002||Viu find_rundefsv|5.013002|5.013002| find_rundefsvoffset|5.009002|5.009002|d find_script|5.004005||Viu find_span_end|5.027009||Vniu find_span_end_mask|5.027009||Vniu find_uninit_var|5.009002||xVi FIRST_NON_ASCII_DECIMAL_DIGIT|5.027007||Viu first_symbol|5.009003||Vniu FIT_ARENA0|||Viu FIT_ARENAn|||Viu FIT_ARENA|||Viu FITS_IN_8_BITS|5.013005||Viu fixup_errno_string|5.019007||Viu FLAGS|5.013006||Viu FLEXFILENAMES|5.003007|5.003007|Vn float_end_shift|5.009005||Viu float_max_offset|5.005000||Viu float_min_offset|5.005000||Viu float_substr|5.005000||Viu float_utf8|5.008000||Viu flock|5.005000||Viu flockfile|5.003007||Viu F_log_amg|5.004000||Viu FmLINES|5.003007||Viu fold_constants|5.003007||Viu foldEQ|5.013002|5.013002|n foldEQ_latin1|5.013008||cVnu foldEQ_latin1_s2_folded|5.029007||Vniu foldEQ_locale|5.013002|5.013002|n FOLDEQ_LOCALE|5.019009||cV FOLDEQ_S1_ALREADY_FOLDED|5.015004||cV FOLDEQ_S1_FOLDS_SANE|5.021008||cV FOLDEQ_S2_ALREADY_FOLDED|5.015004||cV FOLDEQ_S2_FOLDS_SANE|5.021008||cV foldEQ_utf8|5.013002|5.007003|p foldEQ_utf8_flags|5.013010||cVu FOLDEQ_UTF8_NOMIX_ASCII|5.013010||cV FOLD_FLAGS_FULL|5.015006||Viu FOLD_FLAGS_LOCALE|5.015006||Viu FOLD_FLAGS_NOMIX_ASCII|5.017000||Viu fopen|5.003007||Viu forbid_setid|5.005000||Viu force_ident|5.003007||Viu force_ident_maybe_lex|5.017004||Viu force_list|5.003007||Viu force_next|5.003007||Viu _force_out_malformed_utf8_message|5.025009||cVu force_strict_version|5.011004||Viu force_version|5.005000||Viu force_word|5.003007||Viu forget_pmop|5.017007||Viu form|5.004000||vV form_alien_digit_msg|5.031009||cViu form_cp_too_large_msg|5.031009||cViu form_nocontext|5.006000||vVn fp_dup|5.007003|5.007003|u Fpos_t|5.003007|5.003007|Vn F_pow_amg|5.004000||Viu FP_PINF|5.021004||Viu FP_QNAN|5.021004||Viu fprintf|5.003007||Viu fprintf_nocontext|5.006000||vdVnu FPTR2DPTR|5.009003||Viu fputc|5.003007||Viu fputs|5.003007||Viu fread|5.003007||Viu free|5.003007||Viu free_and_set_cop_warnings|5.031011||Viu free_c_backtrace|5.021001||Vi FreeOp|5.008001||Viu Free_t|5.003007|5.003007|Vn FREE_THREAD_KEY|5.006001||Viu free_tied_hv_pool|5.008001||Viu FREETMPS|5.003007|5.003007| free_tmps|5.003007||cVu freopen|5.003007||Viu frewind|5.005000||Viu FROM_INTERNAL_SIZE|5.023002||Viu fscanf|5.003007||Viu fseek|5.003007||Viu FSEEKSIZE|5.006000||Viu fsetpos|5.003007||Viu F_sin_amg|5.004000||Viu F_sqrt_amg|5.004000||Viu Fstat|5.003007||Viu fstat|5.005000||Viu ftell|5.003007||Viu ftruncate|5.006000||Viu ftrylockfile|5.003007||Viu FUNCTION|5.009003||Viu funlockfile|5.003007||Viu fwrite1|5.003007||Viu fwrite|5.003007||Viu G_ARRAY|5.003007||Viu GCB_BREAKABLE|5.025003||Viu GCB_EX_then_EM|5.025003||Viu GCB_Maybe_Emoji_NonBreak|5.029002||Viu GCB_NOBREAK|5.025003||Viu GCB_RI_then_RI|5.025003||Viu GCC_DIAG_IGNORE|5.019007||Viu GCC_DIAG_IGNORE_DECL|5.027007||Viu GCC_DIAG_IGNORE_STMT|5.027007||Viu GCC_DIAG_PRAGMA|5.021001||Viu GCC_DIAG_RESTORE|5.019007||Viu GCC_DIAG_RESTORE_DECL|5.027007||Viu GCC_DIAG_RESTORE_STMT|5.027007||Viu Gconvert|5.003007|5.003007| GDBMNDBM_H_USES_PROTOTYPES|5.032001|5.032001|Vn G_DISCARD|5.003007|5.003007| gen_constant_list|5.003007||Viu get_and_check_backslash_N_name|5.017006||cViu get_and_check_backslash_N_name_wrapper|5.029009||Viu get_ANYOF_cp_list_for_ssc|5.019005||Viu get_ANYOFM_contents|5.027009||Viu GETATARGET|5.003007||Viu get_aux_mg|5.011000||Viu get_av|5.006000|5.003007|p getc|5.003007||Viu get_c_backtrace|5.021001||Vi get_c_backtrace_dump|5.021001||V get_context|5.006000|5.006000|nu getc_unlocked|5.003007||Viu get_cv|5.006000|5.003007|p get_cvn_flags|5.009005|5.003007|p get_cvs|5.011000|5.003007|p getcwd_sv|5.007002|5.007002| get_db_sub|||iu get_debug_opts|5.008001||Viu get_deprecated_property_msg|5.031011||cVniu getegid|5.005000||Viu getenv|5.005000||Viu getenv_len|5.006000||Viu GETENV_LOCK|5.033005||Viu GETENV_PRESERVES_OTHER_THREAD|5.033005|5.033005|Vn GETENV_UNLOCK|5.033005||Viu geteuid|5.005000||Viu getgid|5.005000||Viu getgrent|5.009000||Viu GETGRENT_R_HAS_BUFFER|5.008000||Viu GETGRENT_R_HAS_FPTR|5.008000||Viu GETGRENT_R_HAS_PTR|5.008000||Viu GETGRENT_R_PROTO|5.008000|5.008000|Vn getgrgid|5.009000||Viu GETGRGID_R_HAS_BUFFER|5.008000||Viu GETGRGID_R_HAS_PTR|5.008000||Viu GETGRGID_R_PROTO|5.008000|5.008000|Vn getgrnam|5.009000||Viu GETGRNAM_R_HAS_BUFFER|5.008000||Viu GETGRNAM_R_HAS_PTR|5.008000||Viu GETGRNAM_R_PROTO|5.008000|5.008000|Vn get_hash_seed|5.008001||Viu gethostbyaddr|5.005000||Viu GETHOSTBYADDR_R_HAS_BUFFER|5.008000||Viu GETHOSTBYADDR_R_HAS_ERRNO|5.008000||Viu GETHOSTBYADDR_R_HAS_PTR|5.008000||Viu GETHOSTBYADDR_R_PROTO|5.008000|5.008000|Vn gethostbyname|5.005000||Viu GETHOSTBYNAME_R_HAS_BUFFER|5.008000||Viu GETHOSTBYNAME_R_HAS_ERRNO|5.008000||Viu GETHOSTBYNAME_R_HAS_PTR|5.008000||Viu GETHOSTBYNAME_R_PROTO|5.008000|5.008000|Vn gethostent|5.005000||Viu GETHOSTENT_R_HAS_BUFFER|5.008000||Viu GETHOSTENT_R_HAS_ERRNO|5.008000||Viu GETHOSTENT_R_HAS_PTR|5.008000||Viu GETHOSTENT_R_PROTO|5.008000|5.008000|Vn gethostname|5.005000||Viu get_hv|5.006000|5.003007|p get_invlist_iter_addr|5.015001||Vniu get_invlist_offset_addr|5.019002||Vniu get_invlist_previous_index_addr|5.017004||Vniu getlogin|5.005000||Viu GETLOGIN_R_PROTO|5.008000|5.008000|Vn get_mstats|5.006000||Vu getnetbyaddr|5.005000||Viu GETNETBYADDR_R_HAS_BUFFER|5.008000||Viu GETNETBYADDR_R_HAS_ERRNO|5.008000||Viu GETNETBYADDR_R_HAS_PTR|5.008000||Viu GETNETBYADDR_R_PROTO|5.008000|5.008000|Vn getnetbyname|5.005000||Viu GETNETBYNAME_R_HAS_BUFFER|5.008000||Viu GETNETBYNAME_R_HAS_ERRNO|5.008000||Viu GETNETBYNAME_R_HAS_PTR|5.008000||Viu GETNETBYNAME_R_PROTO|5.008000|5.008000|Vn getnetent|5.005000||Viu GETNETENT_R_HAS_BUFFER|5.008000||Viu GETNETENT_R_HAS_ERRNO|5.008000||Viu GETNETENT_R_HAS_PTR|5.008000||Viu GETNETENT_R_PROTO|5.008000|5.008000|Vn get_no_modify|5.005000||Viu get_num|5.008001||Viu get_opargs|5.005000||Viu get_op_descs|5.005000|5.005000|u get_op_names|5.005000|5.005000|u getpeername|5.005000||Viu getpid|5.006000||Viu get_ppaddr|5.006000|5.006000|u get_prop_definition|5.031011||cViu get_prop_values|5.031011||cVniu getprotobyname|5.005000||Viu GETPROTOBYNAME_R_HAS_BUFFER|5.008000||Viu GETPROTOBYNAME_R_HAS_PTR|5.008000||Viu GETPROTOBYNAME_R_PROTO|5.008000|5.008000|Vn getprotobynumber|5.005000||Viu GETPROTOBYNUMBER_R_HAS_BUFFER|5.008000||Viu GETPROTOBYNUMBER_R_HAS_PTR|5.008000||Viu GETPROTOBYNUMBER_R_PROTO|5.008000|5.008000|Vn getprotoent|5.005000||Viu GETPROTOENT_R_HAS_BUFFER|5.008000||Viu GETPROTOENT_R_HAS_PTR|5.008000||Viu GETPROTOENT_R_PROTO|5.008000|5.008000|Vn getpwent|5.009000||Viu GETPWENT_R_HAS_BUFFER|5.008000||Viu GETPWENT_R_HAS_FPTR|5.008000||Viu GETPWENT_R_HAS_PTR|5.008000||Viu GETPWENT_R_PROTO|5.008000|5.008000|Vn getpwnam|5.009000||Viu GETPWNAM_R_HAS_BUFFER|5.008000||Viu GETPWNAM_R_HAS_PTR|5.008000||Viu GETPWNAM_R_PROTO|5.008000|5.008000|Vn getpwuid|5.009000||Viu GETPWUID_R_HAS_PTR|5.008000||Viu GETPWUID_R_PROTO|5.008000|5.008000|Vn get_quantifier_value|5.033006||Viu get_re_arg|||xciu get_re_gclass_nonbitmap_data|5.031011||Viu get_regclass_nonbitmap_data|5.031011||Viu get_regex_charset_name|5.031004||Vniu getservbyname|5.005000||Viu GETSERVBYNAME_R_HAS_BUFFER|5.008000||Viu GETSERVBYNAME_R_HAS_PTR|5.008000||Viu GETSERVBYNAME_R_PROTO|5.008000|5.008000|Vn getservbyport|5.005000||Viu GETSERVBYPORT_R_HAS_BUFFER|5.008000||Viu GETSERVBYPORT_R_HAS_PTR|5.008000||Viu GETSERVBYPORT_R_PROTO|5.008000|5.008000|Vn getservent|5.005000||Viu GETSERVENT_R_HAS_BUFFER|5.008000||Viu GETSERVENT_R_HAS_PTR|5.008000||Viu GETSERVENT_R_PROTO|5.008000|5.008000|Vn getsockname|5.005000||Viu getsockopt|5.005000||Viu getspnam|5.009000||Viu GETSPNAM_R_HAS_BUFFER|5.031011||Viu GETSPNAM_R_HAS_PTR|5.008000||Viu GETSPNAM_R_PROTO|5.008000|5.008000|Vn get_sv|5.006000|5.003007|p GETTARGET|5.003007||Viu GETTARGETSTACKED|5.003007||Viu gettimeofday|5.008000||Viu getuid|5.005000||Viu get_vtbl|5.005003|5.005003|u getw|5.003007||Viu G_EVAL|5.003007|5.003007| G_FAKINGEVAL|5.009004||Viu Gid_t|5.003007|5.003007|Vn Gid_t_f|5.006000|5.006000|Vn Gid_t_sign|5.006000|5.006000|Vn Gid_t_size|5.006000|5.006000|Vn GIMME|5.003007|5.003007|d GIMME_V|5.004000|5.004000| gimme_V|5.031005||xcVu G_KEEPERR|5.003007|5.003007| G_LIST|5.035001|5.003007| glob_2number|5.009004||Viu GLOBAL_PAT_MOD|5.009005||Viu glob_assign_glob|5.009004||Viu G_METHOD|5.006001|5.003007|p G_METHOD_NAMED|5.019002|5.019002| gmtime|5.031011||Viu GMTIME_MAX|5.010001|5.010001|Vn GMTIME_MIN|5.010001|5.010001|Vn GMTIME_R_PROTO|5.008000|5.008000|Vn G_NOARGS|5.003007|5.003007| G_NODEBUG|5.004005||Viu GOSUB|5.009005||Viu GOSUB_t8|5.035004||Viu GOSUB_t8_p8|5.033003||Viu GOSUB_t8_pb|5.033003||Viu GOSUB_tb|5.035004||Viu GOSUB_tb_p8|5.033003||Viu GOSUB_tb_pb|5.033003||Viu gp_dup|5.007003|5.007003|u gp_free|5.003007|5.003007|u GPOS|5.004000||Viu GPOS_t8|5.035004||Viu GPOS_t8_p8|5.033003||Viu GPOS_t8_pb|5.033003||Viu GPOS_tb|5.035004||Viu GPOS_tb_p8|5.033003||Viu GPOS_tb_pb|5.033003||Viu gp_ref|5.003007|5.003007|u GREEK_CAPITAL_LETTER_MU|5.013011||Viu GREEK_SMALL_LETTER_MU|5.013008||Viu G_RE_REPARSING|5.017011||Viu G_RETHROW|5.031002|5.003007|p grok_atoUV|5.021010||cVni grok_bin|5.007003|5.003007|p grok_bin_oct_hex|5.031008||cVu grok_bslash_c|5.013001||cViu grok_bslash_N|5.017003||Viu grok_bslash_o|5.013003||cViu grok_bslash_x|5.017002||cViu grok_hex|5.007003|5.003007|p grok_infnan|5.021004|5.021004| grok_number|5.007002|5.003007|p grok_number_flags|5.021002|5.021002| GROK_NUMERIC_RADIX|5.007002|5.003007|p grok_numeric_radix|5.007002|5.003007|p grok_oct|5.007003|5.003007|p group_end|5.007003||Viu GROUPP|5.005000||Viu GROUPPN|5.031001||Viu GROUPPN_t8|5.035004||Viu GROUPPN_t8_p8|5.033003||Viu GROUPPN_t8_pb|5.033003||Viu GROUPPN_tb|5.035004||Viu GROUPPN_tb_p8|5.033003||Viu GROUPPN_tb_pb|5.033003||Viu GROUPP_t8|5.035004||Viu GROUPP_t8_p8|5.033003||Viu GROUPP_t8_pb|5.033003||Viu GROUPP_tb|5.035004||Viu GROUPP_tb_p8|5.033003||Viu GROUPP_tb_pb|5.033003||Viu Groups_t|5.003007|5.003007|Vn GRPASSWD|5.005000|5.005000|Vn G_SCALAR|5.003007|5.003007| G_UNDEF_FILL|5.013001||Viu GV_ADD|5.003007|5.003007| gv_add_by_type|5.011000|5.011000|u GV_ADDMG|5.015003|5.015003| GV_ADDMULTI|5.003007|5.003007| GV_ADDWARN|5.003007|5.003007| Gv_AMG|5.003007||Viu Gv_AMupdate|5.011000|5.011000|u GvASSUMECV|5.003007||Viu GvASSUMECV_off|5.003007||Viu GvASSUMECV_on|5.003007||Viu gv_autoload4|5.004000|5.004000| GV_AUTOLOAD|5.011000||Viu GV_AUTOLOAD_ISMETHOD|5.015004||Viu gv_autoload_pv|5.015004|5.015004|u gv_autoload_pvn|5.015004|5.015004|u gv_autoload_sv|5.015004|5.015004|u GvAV|5.003007|5.003007| gv_AVadd|5.003007|5.003007|u GvAVn|5.003007||Viu GV_CACHE_ONLY|5.021004||Vi gv_check|5.003007||cVu gv_const_sv|5.009003|5.009003| GV_CROAK|5.011000||Viu GvCV|5.003007|5.003007| GvCVGEN|5.003007||Viu GvCV_set|5.013010||Viu GvCVu|5.004000||Viu gv_dump|5.006000|5.006000|u gv_efullname3|5.003007|5.003007|u gv_efullname4|5.006001|5.006001|u gv_efullname|5.003007|5.003007|du GvEGV|5.003007||Viu GvEGVx|5.013000||Viu GvENAME|5.003007||Viu GvENAME_HEK|5.015004||Viu GvENAMELEN|5.015004||Viu GvENAMEUTF8|5.015004||Viu GvESTASH|5.003007||Viu GVf_ASSUMECV|5.003007||Viu gv_fetchfile|5.003007|5.003007| gv_fetchfile_flags|5.009005|5.009005| gv_fetchmeth|5.003007|5.003007| gv_fetchmeth_autoload|5.007003|5.007003| gv_fetchmeth_internal|5.021007||Viu gv_fetchmethod|5.003007|5.003007| gv_fetchmethod_autoload|5.004000|5.004000| gv_fetchmethod_flags|5.015004||Viu gv_fetchmethod_pv_flags|5.015004|5.015004|xu gv_fetchmethod_pvn_flags|5.015004|5.015004|xu gv_fetchmethod_sv_flags|5.015004|5.015004|xu gv_fetchmeth_pv|5.015004|5.015004| gv_fetchmeth_pv_autoload|5.015004|5.015004| gv_fetchmeth_pvn|5.015004|5.015004| gv_fetchmeth_pvn_autoload|5.015004|5.015004| gv_fetchmeth_sv|5.015004|5.015004| gv_fetchmeth_sv_autoload|5.015004|5.015004| gv_fetchpv|5.003007|5.003007| gv_fetchpvn|5.013006|5.013006| gv_fetchpvn_flags|5.009002|5.003007|p gv_fetchpvs|5.009004|5.003007|p gv_fetchsv|5.009002|5.003007|p gv_fetchsv_nomg|5.015003|5.015003| GvFILE|5.006000||Viu GvFILEGV|5.003007||Viu GvFILE_HEK|5.009004||Viu GvFILEx|5.019006||Viu GVf_IMPORTED|5.003007||Viu GVf_IMPORTED_AV|5.003007||Viu GVf_IMPORTED_CV|5.003007||Viu GVf_IMPORTED_HV|5.003007||Viu GVf_IMPORTED_SV|5.003007||Viu GVf_INTRO|5.003007||Viu GvFLAGS|5.003007||Viu GVf_MULTI|5.003007||Viu GVF_NOADD|5.035006||Viu GvFORM|5.003007||Viu gv_fullname3|5.003007|5.003007|u gv_fullname4|5.006001|5.006001|u gv_fullname|5.003007|5.003007|du GvGP|5.003007||Viu GvGPFLAGS|5.021004||Viu GvGP_set|5.013010||Viu gv_handler|5.007001|5.007001|u GvHV|5.003007|5.003007| gv_HVadd|5.003007|5.003007|u GvHVn|5.003007||Viu GvIMPORTED|5.003007||Viu GvIMPORTED_AV|5.003007||Viu GvIMPORTED_AV_off|5.003007||Viu GvIMPORTED_AV_on|5.003007||Viu GvIMPORTED_CV|5.003007||Viu GvIMPORTED_CV_off|5.003007||Viu GvIMPORTED_CV_on|5.003007||Viu GvIMPORTED_HV|5.003007||Viu GvIMPORTED_HV_off|5.003007||Viu GvIMPORTED_HV_on|5.003007||Viu GvIMPORTED_off|5.003007||Viu GvIMPORTED_on|5.003007||Viu GvIMPORTED_SV|5.003007||Viu GvIMPORTED_SV_off|5.003007||Viu GvIMPORTED_SV_on|5.003007||Viu gv_init|5.003007|5.003007| gv_init_pv|5.015004|5.015004| gv_init_pvn|5.015004|5.003007|p gv_init_sv|5.015004|5.015004| gv_init_svtype|5.015004||Viu GvIN_PAD|5.006000||Viu GvIN_PAD_off|5.006000||Viu GvIN_PAD_on|5.006000||Viu GvINTRO|5.003007||Viu GvINTRO_off|5.003007||Viu GvINTRO_on|5.003007||Viu GvIO|5.003007||Viu gv_IOadd|5.003007|5.003007|u GvIOn|5.003007||Viu GvIOp|5.003007||Viu gv_is_in_main|5.019004||Viu GvLINE|5.003007||Viu gv_magicalize|5.019004||Viu gv_magicalize_isa|5.013005||Viu gv_method_changed|5.017007||Viu GvMULTI|5.003007||Viu GvMULTI_off|5.003007||Viu GvMULTI_on|5.003007||Viu GvNAME|5.003007||Viu GvNAME_get|5.009004||Viu GvNAME_HEK|5.009004||Viu GvNAMELEN|5.003007||Viu GvNAMELEN_get|5.009004||Viu gv_name_set|5.009004|5.009004|u GvNAMEUTF8|5.015004||Viu GV_NOADD_MASK|5.009005||Viu GV_NOADD_NOINIT|5.009003|5.009003| GV_NOEXPAND|5.009003|5.009003| GV_NOINIT|5.004005|5.004005| GV_NO_SVGMAGIC|5.015003|5.015003| GV_NOTQUAL|5.009004|5.009004| GV_NOUNIVERSAL|5.033009||Viu G_VOID|5.004000|5.004000| gv_override|5.019006||Viu GvREFCNT|5.003007||Viu gv_setref|5.021005||Viu GvSTASH|5.003007||Viu gv_stashpv|5.003007|5.003007| gv_stashpvn|5.003007|5.003007|p gv_stashpvn_internal|5.021004||Viu gv_stashpvs|5.009003|5.003007|p gv_stashsv|5.003007|5.003007| gv_stashsvpvn_cached|5.021004||Vi GV_SUPER|5.017004|5.017004| GvSV|5.003007|5.003007| gv_SVadd|5.011000||Vu GvSVn|5.009003|5.003007|p gv_try_downgrade|5.011002||xcVi GvXPVGV|5.003007||Viu G_WANT|5.010001||Viu G_WARN_ALL_MASK|5.006000||Viu G_WARN_ALL_OFF|5.006000||Viu G_WARN_ALL_ON|5.006000||Viu G_WARN_OFF|5.006000||Viu G_WARN_ON|5.006000||Viu G_WARN_ONCE|5.006000||Viu G_WRITING_TO_STDERR|5.013009||Viu HADNV|||Viu handle_named_backref|5.023008||Viu handle_names_wildcard|5.031011||Viu handle_possible_posix|5.023008||Viu handle_regex_sets|5.017009||Viu handle_user_defined_property|5.029008||Viu HAS_ACCEPT4|5.027008|5.027008|Vn HAS_ACCESS|5.006000|5.006000|Vn HAS_ACOSH|5.021004|5.021004|Vn HAS_ALARM|5.003007|5.003007|Vn HASARENA|||Viu HAS_ASCTIME_R|5.010000|5.010000|Vn HAS_ASINH|5.021006|5.021006|Vn HAS_ATANH|5.021006|5.021006|Vn HAS_ATOLL|5.006000|5.006000|Vn HASATTRIBUTE_ALWAYS_INLINE|5.031007|5.031007|Vn HASATTRIBUTE_DEPRECATED|5.010001|5.010001|Vn HASATTRIBUTE_FORMAT|5.009003|5.009003|Vn HASATTRIBUTE_MALLOC|5.009003|5.009003|Vn HASATTRIBUTE_NONNULL|5.009003|5.009003|Vn HASATTRIBUTE_NORETURN|5.009003|5.009003|Vn HASATTRIBUTE_PURE|5.009003|5.009003|Vn HASATTRIBUTE_UNUSED|5.009003|5.009003|Vn HASATTRIBUTE_WARN_UNUSED_RESULT|5.009003|5.009003|Vn HAS_BACKTRACE|5.021001|5.021001|Vn HAS_BUILTIN_CHOOSE_EXPR|5.009004|5.009004|Vn HAS_BUILTIN_EXPECT|5.010001|5.010001|Vn HAS_BUILTIN_UNREACHABLE|5.033003||Viu HAS_C99|5.021004||Viu HAS_C99_VARIADIC_MACROS|5.009004|5.009004|Vn HAS_CBRT|5.021006|5.021006|Vn HAS_CF_AUX_TABLES|5.027011||Viu HAS_CHOWN|5.003007|5.003007|Vn HAS_CHROOT|5.003007|5.003007|Vn HAS_CHSIZE|5.004005|5.004005|Vn HAS_CLEARENV|5.009003|5.009003|Vn HAS_COPYSIGN|5.021006|5.021006|Vn HAS_COPYSIGNL|5.008001|5.008001|Vn HAS_CRYPT|5.003007|5.003007|Vn HAS_CRYPT_R|5.010000|5.010000|Vn HAS_CSH|5.005000|5.005000|Vn HAS_CTERMID|5.009005|5.009005|Vn HAS_CTIME_R|5.010000|5.010000|Vn HAS_CUSERID|5.003007|5.003007|Vn HAS_DBMINIT_PROTO|5.032001|5.032001|Vn HAS_DIFFTIME|5.003007|5.003007|Vn HAS_DIRFD|5.007003|5.007003|Vn HAS_DLADDR|5.021001|5.021001|Vn HAS_DLERROR|5.003007|5.003007|Vn HAS_DRAND48_PROTO|5.006000|5.006000|Vn HAS_DRAND48_R|5.010000|5.010000|Vn HAS_DUP2|5.003007|5.003007|Vn HAS_DUP3|5.027008|5.027008|Vn HAS_DUPLOCALE|5.027011|5.027011|Vn HAS_EACCESS|5.006000|5.006000|Vn HAS_ENDGRENT|5.005000|5.005000|Vn HAS_ENDHOSTENT|5.005000|5.005000|Vn HAS_ENDNETENT|5.005000|5.005000|Vn HAS_ENDPROTOENT|5.005000|5.005000|Vn HAS_ENDPWENT|5.005000|5.005000|Vn HAS_ENDSERVENT|5.005000|5.005000|Vn HAS_ERF|5.021006|5.021006|Vn HAS_ERFC|5.021006|5.021006|Vn HAS_EXP2|5.021006|5.021006|Vn HAS_EXPM1|5.021006|5.021006|Vn HAS_EXTRA_LONG_UTF8|5.035004||Viu HAS_FAST_STDIO|5.008001|5.008001|Vn HAS_FCHDIR|5.007002|5.007002|Vn HAS_FCHMOD|5.003007|5.003007|Vn HAS_FCHMODAT|5.027004|5.027004|Vn HAS_FCHOWN|5.003007|5.003007|Vn HAS_FCNTL|5.003007|5.003007|Vn HAS_FDIM|5.021006|5.021006|Vn HAS_FD_SET|5.006000|5.006000|Vn HAS_FEGETROUND|5.021004|5.021004|Vn HAS_FFS|5.035001|5.035001|Vn HAS_FFSL|5.035001|5.035001|Vn HAS_FGETPOS|5.003007|5.003007|Vn HAS_FINITE|5.007003|5.007003|Vn HAS_FINITEL|5.007003|5.007003|Vn HAS_FLOCK|5.003007|5.003007|Vn HAS_FLOCK_PROTO|5.007002|5.007002|Vn HAS_FMA|5.021006|5.021006|Vn HAS_FMAX|5.021006|5.021006|Vn HAS_FMIN|5.021006|5.021006|Vn HAS_FORK|5.003007|5.003007|Vn HAS_FPATHCONF|5.003007|5.003007|Vn HAS_FPCLASSIFY|5.021004|5.021004|Vn HAS_FREELOCALE|5.023009|5.023009|Vn HAS_FREXPL|5.006001|5.006001|Vn HAS_FSEEKO|5.006000|5.006000|Vn HAS_FSETPOS|5.003007|5.003007|Vn HAS_FSTATFS|5.023005|5.023005|Vn HAS_FSTATVFS|5.023005|5.023005|Vn HAS_FSYNC|5.007001|5.007001|Vn HAS_FTELLO|5.006000|5.006000|Vn HAS_FUTIMES|5.009003|5.009003|Vn HAS_GAI_STRERROR|5.025004|5.025004|Vn HAS_GETADDRINFO|5.010001|5.010001|Vn HAS_GETCWD|5.006000|5.006000|Vn HAS_GETGRENT|5.005000|5.005000|Vn HAS_GETGRENT_R|5.010000|5.010000|Vn HAS_GETGRGID_R|5.010000|5.010000|Vn HAS_GETGRNAM_R|5.010000|5.010000|Vn HAS_GETGROUPS|5.003007|5.003007|Vn HAS_GETHOSTBYADDR|5.005000|5.005000|Vn HAS_GETHOSTBYADDR_R|5.010000|5.010000|Vn HAS_GETHOSTBYNAME|5.005000|5.005000|Vn HAS_GETHOSTBYNAME_R|5.010000|5.010000|Vn HAS_GETHOSTENT|5.003007|5.003007|Vn HAS_GETHOSTENT_R|5.010000|5.010000|Vn HAS_GETHOSTNAME|5.006000|5.006000|Vn HAS_GETHOST_PROTOS|5.005000|5.005000|Vn HAS_GETITIMER|5.007001|5.007001|Vn HAS_GETLOGIN|5.003007|5.003007|Vn HAS_GETLOGIN_R|5.010000|5.010000|Vn HAS_GETMNTENT|5.023005|5.023005|Vn HAS_GETNAMEINFO|5.010001|5.010001|Vn HAS_GETNETBYADDR|5.005000|5.005000|Vn HAS_GETNETBYADDR_R|5.010000|5.010000|Vn HAS_GETNETBYNAME|5.005000|5.005000|Vn HAS_GETNETBYNAME_R|5.010000|5.010000|Vn HAS_GETNETENT|5.005000|5.005000|Vn HAS_GETNETENT_R|5.010000|5.010000|Vn HAS_GETNET_PROTOS|5.005000|5.005000|Vn HAS_GETPAGESIZE|5.007001|5.007001|Vn HAS_GETPGID|5.003007|5.003007|Vn HAS_GETPGRP|5.003007|5.003007|Vn HAS_GETPPID|5.003007|5.003007|Vn HAS_GETPRIORITY|5.003007|5.003007|Vn HAS_GETPROTOBYNAME|5.005000|5.005000|Vn HAS_GETPROTOBYNAME_R|5.010000|5.010000|Vn HAS_GETPROTOBYNUMBER|5.005000|5.005000|Vn HAS_GETPROTOBYNUMBER_R|5.010000|5.010000|Vn HAS_GETPROTOENT|5.005000|5.005000|Vn HAS_GETPROTOENT_R|5.010000|5.010000|Vn HAS_GETPROTO_PROTOS|5.005000|5.005000|Vn HAS_GETPWENT|5.005000|5.005000|Vn HAS_GETPWENT_R|5.010000|5.010000|Vn HAS_GETPWNAM_R|5.010000|5.010000|Vn HAS_GETPWUID_R|5.010000|5.010000|Vn HAS_GETSERVBYNAME|5.005000|5.005000|Vn HAS_GETSERVBYNAME_R|5.010000|5.010000|Vn HAS_GETSERVBYPORT|5.005000|5.005000|Vn HAS_GETSERVBYPORT_R|5.010000|5.010000|Vn HAS_GETSERVENT|5.005000|5.005000|Vn HAS_GETSERVENT_R|5.010000|5.010000|Vn HAS_GETSERV_PROTOS|5.005000|5.005000|Vn HAS_GETSPNAM|5.006000|5.006000|Vn HAS_GETSPNAM_R|5.010000|5.010000|Vn HAS_GETTIMEOFDAY|5.004000|5.004000|Vn HAS_GMTIME_R|5.010000|5.010000|Vn HAS_GNULIBC|5.004005|5.004005|Vn HAS_GROUP|5.003007||Viu HAS_HASMNTOPT|5.023005|5.023005|Vn HAS_HTONL|5.003007|5.003007|Vn HAS_HTONS|5.003007|5.003007|Vn HAS_HYPOT|5.021006|5.021006|Vn HAS_ILOGB|5.021006|5.021006|Vn HAS_ILOGBL|5.008001|5.008001|Vn HAS_INET_ATON|5.004000|5.004000|Vn HAS_INETNTOP|5.010001|5.010001|Vn HAS_INETPTON|5.010001|5.010001|Vn HAS_INT64_T|5.006000|5.006000|Vn HAS_IOCTL|5.003007||Viu HAS_IP_MREQ|5.017002|5.017002|Vn HAS_IP_MREQ_SOURCE|5.017004|5.017004|Vn HAS_IPV6_MREQ|5.015008|5.015008|Vn HAS_ISASCII|5.003007|5.003007|Vn HAS_ISBLANK|5.015007|5.015007|Vn HAS_ISFINITE|5.021004|5.021004|Vn HAS_ISINF|5.007003|5.007003|Vn HAS_ISINFL|5.021004|5.021004|Vn HAS_ISLESS|5.031007|5.031007|Vn HAS_ISNAN|5.006001|5.006001|Vn HAS_ISNANL|5.006001|5.006001|Vn HAS_ISNORMAL|5.021006|5.021006|Vn HAS_IVCF_AUX_TABLES|5.027011||Viu HAS_J0|5.021004|5.021004|Vn HAS_J0L|5.021004|5.021004|Vn HAS_KILL|5.003007||Viu HAS_KILLPG|5.003007|5.003007|Vn HAS_LC_AUX_TABLES|5.027011||Viu HAS_LCHOWN|5.005000|5.005000|Vn HAS_LC_MONETARY_2008|5.021005|5.021005|Vn HAS_LDBL_DIG|5.006000|5.006000|Vn HAS_LDEXPL|5.021003|5.021003|Vn HAS_LGAMMA|5.021006|5.021006|Vn HAS_LGAMMA_R|5.021006|5.021006|Vn HAS_LINK|5.003007|5.003007|Vn HAS_LINKAT|5.027004|5.027004|Vn HAS_LLRINT|5.021006|5.021006|Vn HAS_LLRINTL|5.021009|5.021009|Vn HAS_LLROUND|5.021006|5.021006|Vn HAS_LLROUNDL|5.021009|5.021009|Vn HAS_LOCALECONV|5.003007|5.003007|Vn HAS_LOCALTIME_R|5.010000|5.010000|Vn HAS_LOCKF|5.003007|5.003007|Vn HAS_LOG1P|5.021006|5.021006|Vn HAS_LOG2|5.021006|5.021006|Vn HAS_LOGB|5.021006|5.021006|Vn HAS_LONG_DOUBLE|5.005000|5.005000|Vn HAS_LONG_LONG|5.005000|5.005000|Vn HAS_LRINT|5.021006|5.021006|Vn HAS_LRINTL|5.021009|5.021009|Vn HAS_LROUND|5.021006|5.021006|Vn HAS_LROUNDL|5.021009|5.021009|Vn HAS_LSEEK_PROTO|5.006000|5.006000|Vn HAS_LSTAT|5.003007|5.003007|Vn HAS_MADVISE|5.006000|5.006000|Vn HAS_MBLEN|5.003007|5.003007|Vn HAS_MBRLEN|5.027006|5.027006|Vn HAS_MBRTOWC|5.027006|5.027006|Vn HAS_MBSTOWCS|5.003007|5.003007|Vn HAS_MBTOWC|5.003007|5.003007|Vn HAS_MEMMEM|5.024000|5.024000|Vn HAS_MEMRCHR|5.027005|5.027005|Vn HAS_MKDIR|5.003007|5.003007|Vn HAS_MKDTEMP|5.006000|5.006000|Vn HAS_MKFIFO|5.003007|5.003007|Vn HAS_MKOSTEMP|5.027008|5.027008|Vn HAS_MKSTEMP|5.006000|5.006000|Vn HAS_MKSTEMPS|5.006000|5.006000|Vn HAS_MKTIME|5.003007|5.003007|Vn HAS_MMAP|5.006000|5.006000|Vn HAS_MODFL|5.006001|5.006001|Vn HAS_MODFL_PROTO|5.009003|5.009003|Vn HAS_MPROTECT|5.006000|5.006000|Vn HAS_MSG|5.003007|5.003007|Vn HAS_MSYNC|5.006000|5.006000|Vn HAS_MUNMAP|5.006000|5.006000|Vn HAS_NAN|5.021006|5.021006|Vn HAS_NANOSLEEP|5.027006|5.027006|Vn HAS_NEARBYINT|5.021006|5.021006|Vn HAS_NEWLOCALE|5.023009|5.023009|Vn HAS_NEXTAFTER|5.021006|5.021006|Vn HAS_NEXTTOWARD|5.021006|5.021006|Vn HAS_NICE|5.003007|5.003007|Vn HAS_NL_LANGINFO|5.007002|5.007002|Vn HAS_NL_LANGINFO_L|5.035001|5.035001|Vn HAS_NON_INT_BITFIELDS|5.035001|5.035001|Vn HAS_NONLATIN1_FOLD_CLOSURE|5.033005||Viu HAS_NONLATIN1_SIMPLE_FOLD_CLOSURE|5.033005||Viu HAS_NTOHL|5.003007|5.003007|Vn HAS_NTOHS|5.003007|5.003007|Vn HAS_OFF64_T|5.010000|5.010000|Vn HAS_OPEN3|5.003007|5.003007|Vn HAS_OPENAT|5.027004|5.027004|Vn HAS_PASSWD|5.003007||Viu HAS_PATHCONF|5.003007|5.003007|Vn HAS_PAUSE|5.003007|5.003007|Vn HAS_PIPE2|5.027008|5.027008|Vn HAS_PIPE|5.003007|5.003007|Vn HAS_POLL|5.003007|5.003007|Vn HAS_POSIX_2008_LOCALE|5.027003||Viu HAS_PRCTL|5.013000|5.013000|Vn HAS_PRCTL_SET_NAME|5.013000|5.013000|Vn HAS_PROCSELFEXE|5.007003|5.007003|Vn HAS_PTHREAD_ATFORK|5.010000|5.010000|Vn HAS_PTHREAD_ATTR_SETSCOPE|5.008001|5.008001|Vn HAS_PTHREAD_UNCHECKED_GETSPECIFIC_NP|5.007002||Viu HAS_PTHREAD_YIELD|5.009005|5.009005|Vn HAS_PTRDIFF_T|5.021001|5.021001|Vn HAS_QUAD|5.003007|5.003007|Vn HAS_RANDOM_R|5.010000|5.010000|Vn HAS_READDIR|5.003007|5.003007|Vn HAS_READDIR64_R|5.010000|5.010000|Vn HAS_READDIR_R|5.010000|5.010000|Vn HAS_READLINK|5.003007|5.003007|Vn HAS_READV|5.007001|5.007001|Vn HAS_RECVMSG|5.007001|5.007001|Vn HAS_REGCOMP|5.021007|5.021007|Vn HAS_REMAINDER|5.021006|5.021006|Vn HAS_REMQUO|5.021006|5.021006|Vn HAS_RENAME|5.003007|5.003007|Vn HAS_RENAMEAT|5.027004|5.027004|Vn HAS_REWINDDIR|5.003007|5.003007|Vn HAS_RINT|5.021006|5.021006|Vn HAS_RMDIR|5.003007|5.003007|Vn HAS_ROUND|5.021006|5.021006|Vn HAS_SBRK_PROTO|5.007001|5.007001|Vn HAS_SCALBN|5.021006|5.021006|Vn HAS_SCALBNL|5.008001|5.008001|Vn HAS_SCHED_YIELD|5.005000|5.005000|Vn HAS_SCX_AUX_TABLES|5.027008||Viu HAS_SEEKDIR|5.003007|5.003007|Vn HAS_SELECT|5.003007|5.003007|Vn HAS_SEM|5.003007|5.003007|Vn HAS_SENDMSG|5.007001|5.007001|Vn HAS_SETEGID|5.003007|5.003007|Vn HAS_SETEUID|5.003007|5.003007|Vn HAS_SETGRENT|5.005000|5.005000|Vn HAS_SETGROUPS|5.004000|5.004000|Vn HAS_SETHOSTENT|5.005000|5.005000|Vn HAS_SETITIMER|5.007001|5.007001|Vn HAS_SETLINEBUF|5.003007|5.003007|Vn HAS_SETLOCALE|5.003007|5.003007|Vn HAS_SETNETENT|5.005000|5.005000|Vn HAS_SETPGID|5.003007|5.003007|Vn HAS_SETPGRP|5.003007|5.003007|Vn HAS_SETPRIORITY|5.003007|5.003007|Vn HAS_SETPROTOENT|5.005000|5.005000|Vn HAS_SETPWENT|5.005000|5.005000|Vn HAS_SETREGID|5.003007|5.003007|Vn HAS_SETRESGID|5.003007|5.003007|Vn HAS_SETRESGID_PROTO|5.010000|5.010000|Vn HAS_SETRESUID|5.003007|5.003007|Vn HAS_SETRESUID_PROTO|5.010000|5.010000|Vn HAS_SETREUID|5.003007|5.003007|Vn HAS_SETSERVENT|5.005000|5.005000|Vn HAS_SETSID|5.003007|5.003007|Vn HAS_SETVBUF|5.005000|5.005000|Vn HAS_SHM|5.003007|5.003007|Vn HAS_SHMAT_PROTOTYPE|5.003007|5.003007|Vn HAS_SIGACTION|5.003007|5.003007|Vn HAS_SIGINFO_SI_ADDR|5.023008|5.023008|Vn HAS_SIGINFO_SI_BAND|5.023008|5.023008|Vn HAS_SIGINFO_SI_ERRNO|5.023008|5.023008|Vn HAS_SIGINFO_SI_PID|5.023008|5.023008|Vn HAS_SIGINFO_SI_STATUS|5.023008|5.023008|Vn HAS_SIGINFO_SI_UID|5.023008|5.023008|Vn HAS_SIGINFO_SI_VALUE|5.023008|5.023008|Vn HAS_SIGNBIT|5.009005|5.009005|Vn HAS_SIGPROCMASK|5.007001|5.007001|Vn HAS_SIGSETJMP|5.003007|5.003007|Vn HAS_SIN6_SCOPE_ID|5.013009|5.013009|Vn HAS_SKIP_LOCALE_INIT|5.019002||Viu HAS_SNPRINTF|5.009003|5.009003|Vn HAS_SOCKADDR_IN6|5.015008|5.015008|Vn HAS_SOCKADDR_STORAGE|5.032001|5.032001|Vn HAS_SOCKATMARK|5.007001|5.007001|Vn HAS_SOCKATMARK_PROTO|5.007002|5.007002|Vn HAS_SOCKET|5.003007|5.003007|Vn HAS_SOCKETPAIR|5.003007|5.003007|Vn HAS_SQRTL|5.006000|5.006000|Vn HAS_SRAND48_R|5.010000|5.010000|Vn HAS_SRANDOM_R|5.010000|5.010000|Vn HAS_STAT|5.021007|5.021007|Vn HAS_STATIC_INLINE|5.013004|5.013004|Vn HAS_STRCOLL|5.003007|5.003007|Vn HAS_STRERROR_L|5.025002|5.025002|Vn HAS_STRERROR_R|5.010000|5.010000|Vn HAS_STRFTIME|5.007002|5.007002|Vn HAS_STRNLEN|5.027006|5.027006|Vn HAS_STRTOD|5.004000|5.004000|Vn HAS_STRTOD_L|5.027011|5.027011|Vn HAS_STRTOL|5.004000|5.004000|Vn HAS_STRTOLD|5.006000|5.006000|Vn HAS_STRTOLD_L|5.027006|5.027006|Vn HAS_STRTOLL|5.006000|5.006000|Vn HAS_STRTOQ|5.007001|5.007001|Vn HAS_STRTOUL|5.004000|5.004000|Vn HAS_STRTOULL|5.006000|5.006000|Vn HAS_STRTOUQ|5.006000|5.006000|Vn HAS_STRUCT_CMSGHDR|5.007001|5.007001|Vn HAS_STRUCT_MSGHDR|5.007001|5.007001|Vn HAS_STRUCT_STATFS|5.023005|5.023005|Vn HAS_STRUCT_STATFS_F_FLAGS|5.023005|5.023005|Vn HAS_STRXFRM|5.003007|5.003007|Vn HAS_STRXFRM_L|5.035001|5.035001|Vn HAS_SYMLINK|5.003007|5.003007|Vn HAS_SYSCALL|5.003007|5.003007|Vn HAS_SYSCALL_PROTO|5.007002|5.007002|Vn HAS_SYSCONF|5.003007|5.003007|Vn HAS_SYS_ERRLIST|5.003007|5.003007|Vn HAS_SYSTEM|5.003007|5.003007|Vn HAS_TC_AUX_TABLES|5.027011||Viu HAS_TCGETPGRP|5.003007|5.003007|Vn HAS_TCSETPGRP|5.003007|5.003007|Vn HAS_TELLDIR|5.003007|5.003007|Vn HAS_TELLDIR_PROTO|5.006000|5.006000|Vn HAS_TGAMMA|5.021006|5.021006|Vn HAS_THREAD_SAFE_NL_LANGINFO_L|5.027006|5.027006|Vn HAS_TIME|5.008000|5.008000|Vn HAS_TIMEGM|5.010001|5.010001|Vn HAS_TIMES|5.003007|5.003007|Vn HAS_TMPNAM_R|5.010000|5.010000|Vn HAS_TM_TM_GMTOFF|5.008001|5.008001|Vn HAS_TM_TM_ZONE|5.008000|5.008000|Vn HAS_TOWLOWER|5.029009|5.029009|Vn HAS_TOWUPPER|5.029009|5.029009|Vn HAS_TRUNC|5.021006|5.021006|Vn HAS_TRUNCATE|5.003007|5.003007|Vn HAS_TRUNCL|5.021004|5.021004|Vn HAS_TTYNAME_R|5.010000|5.010000|Vn HAS_TZNAME|5.003007|5.003007|Vn HAS_UALARM|5.007001|5.007001|Vn HAS_UC_AUX_TABLES|5.027011||Viu HAS_UMASK|5.003007|5.003007|Vn HAS_UNAME|5.003007|5.003007|Vn HAS_UNLINKAT|5.027004|5.027004|Vn HAS_UNSETENV|5.009003|5.009003|Vn HAS_USELOCALE|5.023009|5.023009|Vn HAS_USLEEP|5.007001|5.007001|Vn HAS_USLEEP_PROTO|5.007002|5.007002|Vn HAS_USTAT|5.023005|5.023005|Vn HAS_UTIME|5.003007||Viu HAS_VSNPRINTF|5.009003|5.009003|Vn HAS_WAIT4|5.003007|5.003007|Vn HAS_WAIT|5.003007||Viu HAS_WAITPID|5.003007|5.003007|Vn HAS_WCRTOMB|5.031007|5.031007|Vn HAS_WCSCMP|5.021001|5.021001|Vn HAS_WCSTOMBS|5.003007|5.003007|Vn HAS_WCSXFRM|5.021001|5.021001|Vn HAS_WCTOMB|5.003007|5.003007|Vn HAS_WRITEV|5.007001|5.007001|Vn HE_ARENA_ROOT_IX|5.035005||Viu he_dup|5.007003|5.007003|u HEf_SVKEY|5.003007|5.003007|p HeHASH|5.003007|5.003007| HEK_BASESIZE|5.004000||Viu hek_dup|5.009000|5.009000|u HeKEY|5.003007|5.003007| HeKEY_hek|5.004000||Viu HeKEY_sv|5.004000||Viu HEKf256|5.015004||Viu HEKf|5.015004||Viu HEKfARG|5.015004||Viu HEK_FLAGS|5.008000||Viu HeKFLAGS|5.008000||Viu HEK_HASH|5.004000||Viu HEK_KEY|5.004000||Viu HeKLEN|5.003007|5.003007| HEK_LEN|5.004000||Viu HeKLEN_UTF8|5.007001||Viu HEK_UTF8|5.007001||Viu HeKUTF8|5.007001||Viu HEK_UTF8_off|5.008000||Viu HEK_UTF8_on|5.008000||Viu HEK_WASUTF8|5.008000||Viu HeKWASUTF8|5.008000||Viu HEK_WASUTF8_off|5.008000||Viu HEK_WASUTF8_on|5.008000||Viu HeNEXT|5.003007||Viu HePV|5.004000|5.004000| HeSVKEY|5.003007|5.003007| HeSVKEY_force|5.003007|5.003007| HeSVKEY_set|5.004000|5.004000| HeUTF8|5.010001|5.008000|p HeVAL|5.003007|5.003007| hfree_next_entry|||iu HIGHEST_ANYOF_HRx_BYTE|5.031002||Viu HIGHEST_CASE_CHANGING_CP|5.033005||Viu HINT_ALL_STRICT|5.033002||Viu HINT_BLOCK_SCOPE|5.003007||Viu HINT_BYTES|5.007002||Viu HINT_EXPLICIT_STRICT_REFS|5.016000||Viu HINT_EXPLICIT_STRICT_SUBS|5.016000||Viu HINT_EXPLICIT_STRICT_VARS|5.016000||Viu HINT_FEATURE_MASK|5.015007||Viu HINT_FEATURE_SHIFT|5.015007||Viu HINT_FILETEST_ACCESS|5.006000||Viu HINT_INTEGER|5.003007||Viu HINT_LEXICAL_IO_IN|5.009005||Viu HINT_LEXICAL_IO_OUT|5.009005||Viu HINT_LOCALE|5.004000||Viu HINT_LOCALE_PARTIAL|5.021001||Viu HINT_LOCALIZE_HH|5.005000||Viu HINT_NEW_BINARY|5.005000||Viu HINT_NEW_FLOAT|5.005000||Viu HINT_NEW_INTEGER|5.005000||Viu HINT_NEW_RE|5.005000||Viu HINT_NEW_STRING|5.005000||Viu HINT_NO_AMAGIC|5.010001||Viu HINT_RE_EVAL|5.005000||Viu HINT_RE_FLAGS|5.013007||Viu HINT_RE_TAINT|5.004005||Viu HINTS_DEFAULT|5.033002||Viu HINTS_REFCNT_INIT|5.009004||Viu HINTS_REFCNT_LOCK|5.009004||Viu HINTS_REFCNT_TERM|5.009004||Viu HINTS_REFCNT_UNLOCK|5.009004||Viu HINT_STRICT_REFS|5.003007||Viu HINT_STRICT_SUBS|5.003007||Viu HINT_STRICT_VARS|5.003007||Viu HINT_UNI_8_BIT|5.011002||Viu HINT_UTF8|5.006000||Viu H_PERL|5.003007||Viu HS_APIVERLEN_MAX|5.021006||Viu HS_CXT|5.021006||Viu HSf_IMP_CXT|5.021006||Viu HSf_NOCHK|5.021006||Viu HSf_POPMARK|5.021006||Viu HSf_SETXSUBFN|5.021006||Viu HS_GETAPIVERLEN|5.021006||Viu HS_GETINTERPSIZE|5.021006||Viu HS_GETXSVERLEN|5.021006||Viu HS_KEY|5.021006||Viu HS_KEYp|5.021006||Viu HSm_APIVERLEN|5.021006||Viu HSm_INTRPSIZE|5.021006||Viu HSm_KEY_MATCH|5.021006||Viu HSm_XSVERLEN|5.021006||Viu hsplit|5.005000||Viu HS_XSVERLEN_MAX|5.021006||Viu htoni|5.003007||Viu htonl|5.003007||Viu htons|5.003007||Viu htovl|5.003007||Viu htovs|5.003007||Viu HvAMAGIC|5.017000||Viu HvAMAGIC_off|5.017000||Viu HvAMAGIC_on|5.017000||Viu HvARRAY|5.003007||Viu hv_assert||| HvAUX|5.009003||Viu hv_auxalloc|||iu HVAUX_ARENA_ROOT_IX|5.035005||Viu HvAUXf_NO_DEREF|5.019010||Viu HvAUXf_SCAN_STASH|5.019010||Viu hv_auxinit|5.009003||Viu hv_backreferences_p|||xiu hv_bucket_ratio|5.025003|5.025003|x hv_clear|5.003007|5.003007| hv_clear_placeholders|5.009001|5.009001| hv_common|5.010000||cVu hv_common_key_len|5.010000||cVu hv_copy_hints_hv|5.013005|5.013005| hv_delayfree_ent|5.004000|5.004000|u hv_delete|5.003007|5.003007| HV_DELETE|5.009005||Viu hv_delete_common|5.009001||xViu hv_delete_ent|5.003007|5.003007| hv_deletehek|5.019006||Viu hv_deletes|5.025006||Viu HV_DISABLE_UVAR_XKEY|5.010000||Viu HvEITER|5.003007||Viu HvEITER_get|5.009003||Viu hv_eiter_p|||u HvEITER_set|5.009003||Viu hv_eiter_set|||u HvENAME|5.013007|5.013007| hv_ename_add|5.013007||Vi hv_ename_delete|5.013007||Vi HvENAME_get|5.013007||Viu HvENAME_HEK|5.013007||Viu HvENAME_HEK_NN|5.013007||Viu HvENAMELEN|5.015004|5.015004| HvENAMELEN_get|5.013007||Viu HvENAMEUTF8|5.015004|5.015004| hv_exists|5.003007|5.003007| hv_exists_ent|5.003007|5.003007| hv_existshek|5.035003||Viu hv_existss|5.025006||Viu hv_fetch|5.003007|5.003007| HV_FETCH_EMPTY_HE|5.013007||Viu hv_fetch_ent|5.003007|5.003007| hv_fetchhek|5.019006||Viu HV_FETCH_ISEXISTS|5.009005||Viu HV_FETCH_ISSTORE|5.009005||Viu HV_FETCH_JUST_SV|5.009005||Viu HV_FETCH_LVALUE|5.009005||Viu hv_fetchs|5.009003|5.003007|p hv_fill||| HvFILL|5.003007|5.003007| hv_free_ent|5.004000|5.004000|u hv_free_ent_ret|5.015000||Viu hv_free_entries|5.027002||Viu HvHASKFLAGS|5.008000||Viu HvHASKFLAGS_off|5.008000||Viu HvHASKFLAGS_on|5.008000||Viu HVhek_ENABLEHVKFLAGS|5.008002||Viu HVhek_FREEKEY|5.008000||Viu HVhek_KEYCANONICAL|5.010001||Viu HVhek_MASK|5.008000||Viu HVhek_PLACEHOLD|5.008000||Viu HVhek_UNSHARED|5.009004||Viu HVhek_UTF8|5.008000||Viu HVhek_WASUTF8|5.008000||Viu hv_iterinit|5.003007|5.003007| hv_iterkey|5.003007|5.003007| hv_iterkeysv|5.003007|5.003007| hv_iternext|5.003007|5.003007| hv_iternext_flags|5.008000|5.008000|x hv_iternextsv|5.003007|5.003007| HV_ITERNEXT_WANTPLACEHOLDERS|5.008000|5.008000| hv_iterval|5.003007|5.003007| HvKEYS|5.003007||Viu hv_kill_backrefs|||xiu hv_ksplit|5.003007|5.003007|u HvLASTRAND_get|5.017011||Viu HvLAZYDEL|5.003007||Viu HvLAZYDEL_off|5.003007||Viu HvLAZYDEL_on|5.003007||Viu hv_magic|5.003007|5.003007| hv_magic_check|5.006000||Vniu HvMAX|5.003007||Viu HvMROMETA|5.010001|5.010001| HvNAME|5.003007|5.003007| HvNAME_get|5.009003||pcV HvNAME_HEK|5.009003||Viu HvNAME_HEK_NN|5.013007||Viu HvNAMELEN|5.015004|5.015004| HvNAMELEN_get|5.009003|5.003007|p hv_name_set|5.009003|5.009003|u HV_NAME_SETALL|5.013008||Viu hv_name_sets|5.025006||Viu HvNAMEUTF8|5.015004|5.015004| hv_notallowed|5.008000||Viu HvPLACEHOLDERS|5.007003||Viu HvPLACEHOLDERS_get|5.009003||Viu hv_placeholders_get|||u hv_placeholders_p|||ciu HvPLACEHOLDERS_set|5.009003||Viu hv_placeholders_set|||u hv_pushkv|5.027003||Viu HvRAND_get|5.017011||Viu hv_rand_set|5.018000|5.018000|u HVrhek_delete|5.009004||Viu HVrhek_IV|5.009004||Viu HVrhek_PV|5.009004||Viu HVrhek_PV_UTF8|5.009005||Viu HVrhek_typemask|5.009004||Viu HVrhek_undef|5.009004||Viu HVrhek_UV|5.009004||Viu HvRITER|5.003007||Viu HvRITER_get|5.009003||Viu hv_riter_p|||u HvRITER_set|5.009003||Viu hv_riter_set|||u hv_scalar|5.009001|5.009001| HvSHAREKEYS|5.003007||Viu HvSHAREKEYS_off|5.003007||Viu HvSHAREKEYS_on|5.003007||Viu hv_store|5.003007|5.003007| hv_store_ent|5.003007|5.003007| hv_store_flags|5.008000|5.008000|xu hv_storehek|5.019006||Viu hv_stores|5.009004|5.003007|p HvTOTALKEYS|5.007003||Viu hv_undef|5.003007|5.003007| hv_undef_flags|||ciu HvUSEDKEYS|5.007003||Viu HYPHEN_UTF8|5.017004||Viu I16_MAX|5.003007||Viu I16_MIN|5.003007||Viu I16SIZE|5.006000|5.006000|Vn I16TYPE|5.006000|5.006000|Vn I_32|5.006000|5.003007| I32_MAX|5.003007||Viu I32_MAX_P1|5.007002||Viu I32_MIN|5.003007||Viu I32SIZE|5.006000|5.006000|Vn I32TYPE|5.006000|5.006000|Vn I64SIZE|5.006000|5.006000|Vn I64TYPE|5.006000|5.006000|Vn I8SIZE|5.006000|5.006000|Vn I8_TO_NATIVE|5.015006||Viu I8_TO_NATIVE_UTF8|5.019004||Viu I8TYPE|5.006000|5.006000|Vn I_ARPA_INET|5.005000|5.005000|Vn ibcmp|5.003007|5.003007| ibcmp_locale|5.004000|5.004000| ibcmp_utf8|5.007003|5.007003| I_CRYPT|5.008000|5.008000|Vn I_DBM|5.032001|5.032001|Vn I_DIRENT|5.003007|5.003007|Vn I_DLFCN|5.003007|5.003007|Vn I_EXECINFO|5.021001|5.021001|Vn I_FENV|5.021004|5.021004|Vn IFMATCH|5.003007||Viu IFMATCH_A|5.009005||Viu IFMATCH_A_fail|5.009005||Viu IFMATCH_A_fail_t8|5.035004||Viu IFMATCH_A_fail_t8_p8|5.033003||Viu IFMATCH_A_fail_t8_pb|5.033003||Viu IFMATCH_A_fail_tb|5.035004||Viu IFMATCH_A_fail_tb_p8|5.033003||Viu IFMATCH_A_fail_tb_pb|5.033003||Viu IFMATCH_A_t8|5.035004||Viu IFMATCH_A_t8_p8|5.033003||Viu IFMATCH_A_t8_pb|5.033003||Viu IFMATCH_A_tb|5.035004||Viu IFMATCH_A_tb_p8|5.033003||Viu IFMATCH_A_tb_pb|5.033003||Viu IFMATCH_t8|5.035004||Viu IFMATCH_t8_p8|5.033003||Viu IFMATCH_t8_pb|5.033003||Viu IFMATCH_tb|5.035004||Viu IFMATCH_tb_p8|5.033003||Viu IFMATCH_tb_pb|5.033003||Viu IFTHEN|5.005000||Viu IFTHEN_t8|5.035004||Viu IFTHEN_t8_p8|5.033003||Viu IFTHEN_t8_pb|5.033003||Viu IFTHEN_tb|5.035004||Viu IFTHEN_tb_p8|5.033003||Viu IFTHEN_tb_pb|5.033003||Viu I_GDBM|5.021007|5.021007|Vn I_GDBMNDBM|5.021007|5.021007|Vn IGNORE_PAT_MOD|5.009005||Viu I_GRP|5.003007|5.003007|Vn I_INTTYPES|5.006000|5.006000|Vn I_LANGINFO|5.007002|5.007002|Vn I_LIMITS|5.003007||Viu ILLEGAL_UTF8_BYTE|5.019004||Viu I_LOCALE|5.003007|5.003007|Vn I_MNTENT|5.023005|5.023005|Vn IN_BYTES|5.007002||Viu incline|5.005000||Viu INCLUDE_PROTOTYPES|5.007001||Viu INCMARK|5.023005||Viu incpush|5.005000||Viu INCPUSH_APPLLIB_EXP|5.027006||Viu INCPUSH_APPLLIB_OLD_EXP|5.027006||Viu INCPUSH_ARCHLIB_EXP|5.027006||Viu incpush_if_exists|5.009003||Viu INCPUSH_PERL5LIB|5.027006||Viu INCPUSH_PERL_OTHERLIBDIRS|5.027006||Viu INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY|5.027006||Viu INCPUSH_PERL_VENDORARCH_EXP|5.027006||Viu INCPUSH_PERL_VENDORLIB_EXP|5.027006||Viu INCPUSH_PERL_VENDORLIB_STEM|5.027006||Viu INCPUSH_PRIVLIB_EXP|5.027006||Viu INCPUSH_SITEARCH_EXP|5.027006||Viu INCPUSH_SITELIB_EXP|5.027006||Viu INCPUSH_SITELIB_STEM|5.027006||Viu incpush_use_sep|5.011000||Viu I_NDBM|5.032001|5.032001|Vn inet_addr|5.005000||Viu I_NETDB|5.005000|5.005000|Vn I_NETINET_IN|5.003007|5.003007|Vn I_NETINET_TCP|5.006000|5.006000|Vn inet_ntoa|5.005000||Viu INFNAN_NV_U8_DECL|5.023000||Viu INFNAN_U8_NV_DECL|5.023000||Viu ingroup|5.003007||Viu INIT|5.003007||Viu init_argv_symbols|5.007003||Viu init_constants|5.017003||Viu init_dbargs|||iu init_debugger|5.005000||Viu init_i18nl10n|5.006000||cVu init_i18nl14n|5.006000||dcVu initialize_invlist_guts|5.029002||Viu init_ids|5.005000||Viu init_interp|5.005000||Viu init_main_stash|5.005000||Viu init_named_cv|5.027010||cViu init_os_extras|5.005000||Viu init_perllib|5.005000||Viu init_postdump_symbols|5.005000||Viu init_predump_symbols|5.005000||Viu init_stacks|5.005000|5.005000|u INIT_THREADS|5.005000||Viu init_tm|5.007002|5.007002|u INIT_TRACK_MEMPOOL|5.009004||Viu init_uniprops|5.027011||Viu IN_LC|5.021001||Viu IN_LC_ALL_COMPILETIME|5.021001||Viu IN_LC_ALL_RUNTIME|5.021001||Viu IN_LC_COMPILETIME|5.021001||Viu IN_LC_PARTIAL_COMPILETIME|5.021001||Viu IN_LC_PARTIAL_RUNTIME|5.021001||Viu IN_LC_RUNTIME|5.021001||Viu IN_LOCALE|5.007002|5.004000|p IN_LOCALE_COMPILETIME|5.007002|5.004000|p IN_LOCALE_RUNTIME|5.007002|5.004000|p IN_PERL_COMPILETIME|5.008001|5.003007|p IN_PERL_RUNTIME|5.008001|5.008001| inplace_aassign|5.015003||Viu inRANGE|5.029010||Viu inRANGE_helper|5.033005||Viu IN_SOME_LOCALE_FORM|5.015008||Viu IN_SOME_LOCALE_FORM_COMPILETIME|5.015008||Viu IN_SOME_LOCALE_FORM_RUNTIME|5.015008||Viu instr|5.003007|5.003007|n INSUBP|5.009005||Viu INSUBP_t8|5.035004||Viu INSUBP_t8_p8|5.033003||Viu INSUBP_t8_pb|5.033003||Viu INSUBP_tb|5.035004||Viu INSUBP_tb_p8|5.033003||Viu INSUBP_tb_pb|5.033003||Viu INT16_C|5.003007|5.003007| INT2PTR|5.006000|5.003007|p INT32_C|5.003007|5.003007| INT32_MIN|5.007002||Viu INT64_C|5.023002|5.023002| INT64_MIN|5.007002||Viu INT_64_T|5.011000||Viu INTMAX_C|5.003007|5.003007| INT_PAT_MODS|5.009005||Viu intro_my|5.021006|5.021006| INTSIZE|5.003007|5.003007|Vn intuit_method|5.005000||Viu intuit_more|5.003007||Viu IN_UNI_8_BIT|5.011002||Viu IN_UTF8_CTYPE_LOCALE|5.019009||Viu _inverse_folds|5.027011||cViu invert|5.003007||Viu invlist_array|5.013010||Vniu _invlist_array_init|5.015001||Vniu invlist_clear|5.023009||Viu invlist_clone|5.015001||cViu _invlist_contains_cp|5.017003||Vniu invlist_contents|5.023008||Viu _invlist_dump|5.019003||cViu _invlistEQ|5.023006||cViu invlist_extend|5.013010||Viu invlist_highest|5.017002||Vniu _invlist_intersection|5.015001||Viu _invlist_intersection_maybe_complement_2nd|5.015008||cViu _invlist_invert|5.015001||cViu invlist_is_iterating|5.017008||Vniu invlist_iterfinish|5.017008||Vniu invlist_iterinit|5.015001||Vniu invlist_iternext|5.015001||Vniu _invlist_len|5.017004||Vniu invlist_lowest|5.031007||xVniu invlist_max|5.013010||Vniu invlist_previous_index|5.017004||Vniu invlist_replace_list_destroys_src|5.023009||Viu _invlist_search|5.017003||cVniu invlist_set_len|5.013010||Viu invlist_set_previous_index|5.017004||Vniu _invlist_subtract|5.015001||Viu invlist_trim|5.013010||Vniu _invlist_union|5.015001||cVu _invlist_union_maybe_complement_2nd|5.015008||cViu invmap_dump|5.031006||Viu invoke_exception_hook|5.013001||Viu IoANY|5.006001||Viu IoBOTTOM_GV|5.003007||Viu IoBOTTOM_NAME|5.003007||Viu io_close|5.003007||Viu IOCPARM_LEN|5.003007||Viu ioctl|5.005000||Viu IoDIRP|5.003007||Viu IOf_ARGV|5.003007||Viu IOf_DIDTOP|5.003007||Viu IOf_FAKE_DIRP|5.006000||Viu IOf_FLUSH|5.003007||Viu IoFLAGS|5.003007||Viu IoFMT_GV|5.003007||Viu IoFMT_NAME|5.003007||Viu IOf_NOLINE|5.005003||Viu IOf_START|5.003007||Viu IOf_UNTAINT|5.003007||Viu IoIFP|5.003007||Viu IoLINES|5.003007||Viu IoLINES_LEFT|5.003007||Viu IoOFP|5.003007||Viu IoPAGE|5.003007||Viu IoPAGE_LEN|5.003007||Viu IoTOP_GV|5.003007||Viu IoTOP_NAME|5.003007||Viu IoTYPE|5.003007||Viu IoTYPE_APPEND|5.006001||Viu IoTYPE_CLOSED|5.006001||Viu IoTYPE_IMPLICIT|5.008001||Viu IoTYPE_NUMERIC|5.008001||Viu IoTYPE_PIPE|5.006001||Viu IoTYPE_RDONLY|5.006001||Viu IoTYPE_RDWR|5.006001||Viu IoTYPE_SOCKET|5.006001||Viu IoTYPE_STD|5.006001||Viu IoTYPE_WRONLY|5.006001||Viu I_POLL|5.006000|5.006000|Vn I_PTHREAD|5.005003|5.005003|Vn I_PWD|5.003007|5.003007|Vn isALNUM|5.003007|5.003007|p isALNUM_A|5.031003|5.003007|p isALNUMC|5.006000|5.003007|p isALNUMC_A|5.013006|5.003007|p isALNUMC_L1|5.013006|5.003007|p isALNUMC_LC|5.006000|5.006000| isALNUMC_LC_utf8_safe|5.031007||Viu isALNUMC_LC_uvchr|5.017007|5.017007| isALNUMC_uni|5.017007||Viu isALNUMC_utf8|5.017007||Viu isALNUMC_utf8_safe|5.031007||Viu isALNUM_lazy_if_safe|5.031007||Viu isALNUM_LC|5.004000|5.004000| isALNUM_LC_utf8|5.006000||Viu isALNUM_LC_utf8_safe|5.031007||Viu isALNUM_LC_uvchr|5.007001|5.007001| isALNUMU|5.011005||Viu isALNUM_uni|5.006000||Viu isALNUM_utf8|5.006000||Viu isALNUM_utf8_safe|5.031007||Viu isa_lookup|5.005000||Viu isALPHA|5.003007|5.003007|p isALPHA_A|5.013006|5.003007|p isALPHA_FOLD_EQ|5.021004||Viu isALPHA_FOLD_NE|5.021004||Viu isALPHA_L1|5.013006|5.003007|p isALPHA_LC|5.004000|5.004000| isALPHA_LC_utf8|5.006000||Viu isALPHA_LC_utf8_safe|5.025009|5.006000|p isALPHA_LC_uvchr|5.007001|5.007001| isALPHANUMERIC|5.017008|5.003007|p isALPHANUMERIC_A|5.017008|5.003007|p isALPHANUMERIC_L1|5.017008|5.003007|p isALPHANUMERIC_LC|5.017008|5.004000|p isALPHANUMERIC_LC_utf8|5.017008||Viu isALPHANUMERIC_LC_utf8_safe|5.025009|5.006000|p isALPHANUMERIC_LC_uvchr|5.017008|5.017008| isALPHANUMERIC_uni|5.017008||Viu isALPHANUMERIC_utf8|5.031005|5.031005| isALPHANUMERIC_utf8_safe|5.025009|5.006000|p isALPHANUMERIC_uvchr|5.023009|5.006000|p isALPHAU|5.011005||Viu isALPHA_uni|5.006000||Viu isALPHA_utf8|5.031005|5.031005| isALPHA_utf8_safe|5.025009|5.006000|p isALPHA_uvchr|5.023009|5.006000|p is_an_int|5.005000||Viu is_ANYOF_SYNTHETIC|5.019009||Viu IS_ANYOF_TRIE|5.009005||Viu isASCII|5.006000|5.003007|p isASCII_A|5.013006|5.003007|p isASCII_L1|5.015004|5.003007|p isASCII_LC|5.015008|5.003007|p isASCII_LC_utf8|5.017007||Viu isASCII_LC_utf8_safe|5.025009|5.025009| isASCII_LC_uvchr|5.017007|5.017007| is_ascii_string|5.011000|5.011000|n isASCII_uni|5.006000||Viu isASCII_utf8|5.031005|5.031005| isASCII_utf8_safe|5.025009|5.003007|p isASCII_uvchr|5.023009|5.003007|p isatty|5.005000||Viu ISA_VERSION_OBJ|5.019008||Viu isBLANK|5.006001|5.003007|p isBLANK_A|5.013006|5.003007|p isBLANK_L1|5.013006|5.003007|p isBLANK_LC|5.006001|5.003007|p isBLANK_LC_uni|5.006001||Viu isBLANK_LC_utf8|5.006001||Viu isBLANK_LC_utf8_safe|5.025009|5.006000|p isBLANK_LC_uvchr|5.017007|5.017007| isBLANK_uni|5.006001||Viu isBLANK_utf8|5.031005|5.031005| isBLANK_utf8_safe|5.025009|5.006000|p isBLANK_uvchr|5.023009|5.006000|p isC9_STRICT_UTF8_CHAR|5.025005|5.025005|n is_c9strict_utf8_string|5.025006|5.025006|n is_c9strict_utf8_string_loc|5.025006|5.025006|n is_c9strict_utf8_string_loclen|5.025006|5.025006|n isCHARNAME_CONT|5.011005||Viu isCNTRL|5.006000|5.003007|p isCNTRL_A|5.013006|5.003007|p isCNTRL_L1|5.013006|5.003007|p isCNTRL_LC|5.006000|5.006000| isCNTRL_LC_utf8|5.006000||Viu isCNTRL_LC_utf8_safe|5.025009|5.006000|p isCNTRL_LC_uvchr|5.007001|5.007001| isCNTRL_uni|5.006000||Viu isCNTRL_utf8|5.031005|5.031005| isCNTRL_utf8_safe|5.025009|5.006000|p isCNTRL_uvchr|5.023009|5.006000|p _is_cur_LC_category_utf8|5.021001||cVu isDEBUG_WILDCARD|5.031011||Viu isDIGIT|5.003007|5.003007|p isDIGIT_A|5.013006|5.003007|p isDIGIT_L1|5.013006|5.003007|p isDIGIT_LC|5.004000|5.004000| isDIGIT_LC_utf8|5.006000||Viu isDIGIT_LC_utf8_safe|5.025009|5.006000|p isDIGIT_LC_uvchr|5.007001|5.007001| isDIGIT_uni|5.006000||Viu isDIGIT_utf8|5.031005|5.031005| isDIGIT_utf8_safe|5.025009|5.006000|p isDIGIT_uvchr|5.023009|5.006000|p isEXACTFish|5.033003||Viu isEXACT_REQ8|5.033003||Viu isFF_overlong|5.035004||Vniu is_FOLDS_TO_MULTI_utf8|5.019009||Viu isFOO_lc|5.017007||Viu isFOO_utf8_lc|5.017008||Viu isGCB|5.021009||Viu isGRAPH|5.006000|5.003007|p isGRAPH_A|5.013006|5.003007|p is_grapheme|5.031007||Viu isGRAPH_L1|5.013006|5.003007|p isGRAPH_LC|5.006000|5.006000| isGRAPH_LC_utf8|5.006000||Viu isGRAPH_LC_utf8_safe|5.025009|5.006000|p isGRAPH_LC_uvchr|5.007001|5.007001| isGRAPH_uni|5.006000||Viu isGRAPH_utf8|5.031005|5.031005| isGRAPH_utf8_safe|5.025009|5.006000|p isGRAPH_uvchr|5.023009|5.006000|p isGV|5.003007||Viu isGV_or_RVCV|5.027005||Viu isGV_with_GP|5.009004|5.003007|p isGV_with_GP_off|5.009005||Viu isGV_with_GP_on|5.009005||Viu I_SHADOW|5.006000|5.006000|Vn is_handle_constructor|5.006000||Vniu is_HANGUL_ED_utf8_safe|5.029001||Viu is_HORIZWS_cp_high|5.017006||Viu is_HORIZWS_high|5.017006||Viu isIDCONT|5.017008|5.003007|p isIDCONT_A|5.017008|5.003007|p isIDCONT_L1|5.017008|5.003007|p isIDCONT_LC|5.017008|5.004000|p isIDCONT_LC_utf8|5.017008||Viu isIDCONT_LC_utf8_safe|5.025009|5.006000|p isIDCONT_LC_uvchr|5.017008|5.017008| isIDCONT_uni|5.017008||Viu isIDCONT_utf8|5.031005|5.031005| isIDCONT_utf8_safe|5.025009|5.006000|p isIDCONT_uvchr|5.023009|5.006000|p isIDFIRST|5.003007|5.003007|p isIDFIRST_A|5.013006|5.003007|p isIDFIRST_L1|5.013006|5.003007|p isIDFIRST_lazy_if_safe|5.025009||Viu isIDFIRST_LC|5.004000|5.004000|p isIDFIRST_LC_utf8|5.006000||Viu isIDFIRST_LC_utf8_safe|5.025009|5.006000|p isIDFIRST_LC_uvchr|5.007001|5.007001| isIDFIRST_uni|5.006000||Viu isIDFIRST_utf8|5.031005|5.031005| isIDFIRST_utf8_safe|5.025009|5.006000|p isIDFIRST_uvchr|5.023009|5.006000|p isinfnan|5.021004|5.021004|n isinfnansv|5.021005||Vi _is_in_locale_category|5.021001||cViu IS_IN_SOME_FOLD_L1|5.033005||Viu is_invariant_string|5.021007|5.011000|pn is_invlist|5.029002||Vniu is_LARGER_NON_CHARS_utf8|5.035003||Viu is_LAX_VERSION|5.011004||Viu isLB|5.023007||Viu isLEXWARN_off|5.006000||Viu isLEXWARN_on|5.006000||Viu is_LNBREAK_latin1_safe|5.009005||Viu is_LNBREAK_safe|5.009005||Viu is_LNBREAK_utf8_safe|5.009005||Viu isLOWER|5.003007|5.003007|p isLOWER_A|5.013006|5.003007|p isLOWER_L1|5.013006|5.003007|p isLOWER_LC|5.004000|5.004000| isLOWER_LC_utf8|5.006000||Viu isLOWER_LC_utf8_safe|5.025009|5.006000|p isLOWER_LC_uvchr|5.007001|5.007001| isLOWER_uni|5.006000||Viu isLOWER_utf8|5.031005|5.031005| isLOWER_utf8_safe|5.025009|5.006000|p isLOWER_uvchr|5.023009|5.006000|p is_lvalue_sub|5.007001|5.007001|u isMNEMONIC_CNTRL|5.031009||Viu is_MULTI_CHAR_FOLD_latin1_safe|5.019010||Viu is_MULTI_CHAR_FOLD_utf8_safe|5.019010||Viu is_MULTI_CHAR_FOLD_utf8_safe_part0|5.019010||Viu is_MULTI_CHAR_FOLD_utf8_safe_part1|5.019010||Viu is_MULTI_CHAR_FOLD_utf8_safe_part2|5.025008||Viu is_MULTI_CHAR_FOLD_utf8_safe_part3|5.025008||Viu is_NONCHAR_utf8_safe|5.025005||Viu IS_NON_FINAL_FOLD|5.033005||Viu isnormal|5.021004||Viu IS_NUMBER_GREATER_THAN_UV_MAX|5.007002|5.003007|p IS_NUMBER_INFINITY|5.007002|5.003007|p IS_NUMBER_IN_UV|5.007002|5.003007|p IS_NUMBER_NAN|5.007003|5.003007|p IS_NUMBER_NEG|5.007002|5.003007|p IS_NUMBER_NOT_INT|5.007002|5.003007|p IS_NUMBER_TRAILING|5.021002||Viu IS_NUMERIC_RADIX|5.006000||Viu isOCTAL|5.013005|5.003007|p isOCTAL_A|5.013006|5.003007|p isOCTAL_L1|5.013006|5.003007|p IS_PADCONST|5.006000||Viu IS_PADGV|5.006000||Viu is_PATWS_safe|5.017008||Viu isPOWER_OF_2|5.029006||Viu isPRINT|5.004000|5.003007|p isPRINT_A|5.013006|5.003007|p isPRINT_L1|5.013006|5.003007|p isPRINT_LC|5.004000|5.004000| isPRINT_LC_utf8|5.006000||Viu isPRINT_LC_utf8_safe|5.025009|5.006000|p isPRINT_LC_uvchr|5.007001|5.007001| isPRINT_uni|5.006000||Viu isPRINT_utf8|5.031005|5.031005| isPRINT_utf8_safe|5.025009|5.006000|p isPRINT_uvchr|5.023009|5.006000|p is_PROBLEMATIC_LOCALE_FOLD_cp|5.019009||Viu is_PROBLEMATIC_LOCALE_FOLDEDS_START_cp|5.019009||Viu is_PROBLEMATIC_LOCALE_FOLDEDS_START_utf8|5.019009||Viu is_PROBLEMATIC_LOCALE_FOLD_utf8|5.019009||Viu isPSXSPC|5.006001|5.003007|p isPSXSPC_A|5.013006|5.003007|p isPSXSPC_L1|5.013006|5.003007|p isPSXSPC_LC|5.006001|5.006001| isPSXSPC_LC_utf8|5.006001||Viu isPSXSPC_LC_utf8_safe|5.025009|5.006000|p isPSXSPC_LC_uvchr|5.017007|5.017007| isPSXSPC_uni|5.006001||Viu isPSXSPC_utf8|5.031005|5.031005| isPSXSPC_utf8_safe|5.025009|5.006000|p isPSXSPC_uvchr|5.023009|5.006000|p isPUNCT|5.006000|5.003007|p isPUNCT_A|5.013006|5.003007|p isPUNCT_L1|5.013006|5.003007|p isPUNCT_LC|5.006000|5.006000| isPUNCT_LC_utf8|5.006000||Viu isPUNCT_LC_utf8_safe|5.025009|5.006000|p isPUNCT_LC_uvchr|5.007001|5.007001| isPUNCT_uni|5.006000||Viu isPUNCT_utf8|5.031005|5.031005| isPUNCT_utf8_safe|5.025009|5.006000|p isPUNCT_uvchr|5.023009|5.006000|p is_QUOTEMETA_high|5.017004||Viu isREGEXP|5.017006||Viu IS_SAFE_PATHNAME|5.019004||Viu IS_SAFE_SYSCALL|5.019004|5.019004| is_safe_syscall|5.019004|5.019004| isSB|5.021009||Viu isSCRIPT_RUN|5.027008||cVi is_SHORTER_NON_CHARS_utf8|5.035003||Viu isSPACE|5.003007|5.003007|p isSPACE_A|5.013006|5.003007|p isSPACE_L1|5.013006|5.003007|p isSPACE_LC|5.004000|5.004000| isSPACE_LC_utf8|5.006000||Viu isSPACE_LC_utf8_safe|5.025009|5.006000|p isSPACE_LC_uvchr|5.007001|5.007001| isSPACE_uni|5.006000||Viu isSPACE_utf8|5.031005|5.031005| isSPACE_utf8_safe|5.025009|5.006000|p isSPACE_uvchr|5.023009|5.006000|p is_ssc_worth_it|5.021005||Vniu isSTRICT_UTF8_CHAR|5.025005|5.025005|n is_strict_utf8_string|5.025006|5.025006|n is_strict_utf8_string_loc|5.025006|5.025006|n is_strict_utf8_string_loclen|5.025006|5.025006|n is_STRICT_VERSION|5.011004||Viu is_SURROGATE_utf8|5.035004||Viu is_SURROGATE_utf8_safe|5.025005||Viu I_STDARG|5.003007||Viu I_STDBOOL|5.015003|5.015003|Vn I_STDINT|5.021004|5.021004|Vn is_THREE_CHAR_FOLD_HEAD_latin1_safe|5.031007||Viu is_THREE_CHAR_FOLD_HEAD_utf8_safe|5.031007||Viu is_THREE_CHAR_FOLD_latin1_safe|5.031007||Viu is_THREE_CHAR_FOLD_utf8_safe|5.031007||Viu IS_TRIE_AC|5.009005||Viu isUNICODE_POSSIBLY_PROBLEMATIC|5.035004||Viu _is_uni_FOO|5.017008||cVu _is_uni_perl_idcont|5.017008||cVu _is_uni_perl_idstart|5.017007||cVu isUPPER|5.003007|5.003007|p isUPPER_A|5.013006|5.003007|p isUPPER_L1|5.013006|5.003007|p isUPPER_LC|5.004000|5.004000| isUPPER_LC_utf8|5.006000||Viu isUPPER_LC_utf8_safe|5.025009|5.006000|p isUPPER_LC_uvchr|5.007001|5.007001| isUPPER_uni|5.006000||Viu isUPPER_utf8|5.031005|5.031005| isUPPER_utf8_safe|5.025009|5.006000|p isUPPER_uvchr|5.023009|5.006000|p is_utf8_char|5.006000|5.006000|dn IS_UTF8_CHAR|5.009003||Viu isUTF8_CHAR|5.021001|5.006001|pn is_utf8_char_buf|5.015008|5.015008|n isUTF8_CHAR_flags|5.025005|5.025005|n is_utf8_char_helper_|5.035004||cVnu is_utf8_common|5.009003||Viu is_utf8_FF_helper_|5.035004||cVnu is_utf8_fixed_width_buf_flags|5.025006|5.025006|n is_utf8_fixed_width_buf_loc_flags|5.025006|5.025006|n is_utf8_fixed_width_buf_loclen_flags|5.025006|5.025006|n _is_utf8_FOO|5.031006||cVu is_utf8_invariant_string|5.025005|5.011000|pn is_utf8_invariant_string_loc|5.027001|5.027001|n is_utf8_non_invariant_string|5.027007||cVni is_utf8_overlong|5.035004||Vniu _is_utf8_perl_idcont|5.031006||cVu _is_utf8_perl_idstart|5.031006||cVu isUTF8_POSSIBLY_PROBLEMATIC|5.023003||Viu is_utf8_string|5.006001|5.006001|n is_utf8_string_flags|5.025006|5.025006|n is_utf8_string_loc|5.008001|5.008001|n is_utf8_string_loc_flags|5.025006|5.025006|n is_utf8_string_loclen|5.009003|5.009003|n is_utf8_string_loclen_flags|5.025006|5.025006|n is_utf8_valid_partial_char|5.025005|5.025005|n is_utf8_valid_partial_char_flags|5.025005|5.025005|n is_VERTWS_cp_high|5.017006||Viu is_VERTWS_high|5.017006||Viu isVERTWS_uni|5.017006||Viu isVERTWS_utf8|5.017006||Viu isVERTWS_utf8_safe|5.025009||Viu isVERTWS_uvchr|5.023009||Viu isWARNf_on|5.006001||Viu isWARN_on|5.006000||Viu isWARN_ONCE|5.006000||Viu isWB|5.021009||Viu isWORDCHAR|5.013006|5.003007|p isWORDCHAR_A|5.013006|5.003007|p isWORDCHAR_L1|5.013006|5.003007|p isWORDCHAR_lazy_if_safe|5.025009||Viu isWORDCHAR_LC|5.017007|5.004000|p isWORDCHAR_LC_utf8|5.017007||Viu isWORDCHAR_LC_utf8_safe|5.025009|5.006000|p isWORDCHAR_LC_uvchr|5.017007|5.017007| isWORDCHAR_uni|5.017006||Viu isWORDCHAR_utf8|5.031005|5.031005| isWORDCHAR_utf8_safe|5.025009|5.006000|p isWORDCHAR_uvchr|5.023009|5.006000|p isXDIGIT|5.006000|5.003007|p isXDIGIT_A|5.013006|5.003007|p is_XDIGIT_cp_high|5.017006||Viu is_XDIGIT_high|5.017006||Viu isXDIGIT_L1|5.013006|5.003007|p isXDIGIT_LC|5.017007|5.003007|p isXDIGIT_LC_utf8|5.017007||Viu isXDIGIT_LC_utf8_safe|5.025009|5.006000|p isXDIGIT_LC_uvchr|5.017007|5.017007| isXDIGIT_uni|5.006000||Viu isXDIGIT_utf8|5.031005|5.031005| isXDIGIT_utf8_safe|5.025009|5.006000|p isXDIGIT_uvchr|5.023009|5.006000|p is_XPERLSPACE_cp_high|5.017006||Viu is_XPERLSPACE_high|5.017006||Viu I_SYS_DIR|5.003007|5.003007|Vn I_SYS_FILE|5.003007|5.003007|Vn I_SYS_IOCTL|5.003007|5.003007|Vn I_SYSLOG|5.006000|5.006000|Vn I_SYS_MOUNT|5.023005|5.023005|Vn I_SYS_PARAM|5.003007|5.003007|Vn I_SYS_POLL|5.010001|5.010001|Vn I_SYS_RESOURCE|5.003007|5.003007|Vn I_SYS_SELECT|5.003007|5.003007|Vn I_SYS_STAT|5.003007|5.003007|Vn I_SYS_STATFS|5.023005|5.023005|Vn I_SYS_STATVFS|5.023005|5.023005|Vn I_SYS_TIME|5.003007|5.003007|Vn I_SYS_TIMES|5.003007|5.003007|Vn I_SYS_TYPES|5.003007|5.003007|Vn I_SYSUIO|5.006000|5.006000|Vn I_SYS_UN|5.003007|5.003007|Vn I_SYSUTSNAME|5.006000|5.006000|Vn I_SYS_VFS|5.023005|5.023005|Vn I_SYS_WAIT|5.003007|5.003007|Vn items||5.003007| I_TERMIOS|5.003007|5.003007|Vn I_TIME|5.003007|5.003007|Vn I_UNISTD|5.003007|5.003007|Vn I_USTAT|5.023005|5.023005|Vn I_UTIME|5.003007|5.003007|Vn I_V|5.006000|5.003007| IVdf|5.006000|5.003007|poVn IV_DIG|5.006000||Viu IV_IS_QUAD|5.006000||Viu IV_MAX|5.003007|5.003007| IV_MAX_P1|5.007002||Viu IV_MIN|5.003007|5.003007| IVSIZE|5.006000|5.003007|poVn IVTYPE|5.006000|5.003007|poVn I_WCHAR|5.027006|5.027006|Vn I_WCTYPE|5.029009|5.029009|Vn ix||5.003007| I_XLOCALE|5.025004|5.025004|Vn JE_OLD_STACK_HWM_restore|5.027002||Viu JE_OLD_STACK_HWM_save|5.027002||Viu JE_OLD_STACK_HWM_zero|5.027002||Viu jmaybe|5.003007||Viu JMPENV_BOOTSTRAP|5.006000||Viu JMPENV_JUMP|5.004000|5.004000| JMPENV_POP|5.004000||Viu JMPENV_PUSH|5.004000||Viu JOIN|5.005000||Viu join_exact|5.009004||Viu kBINOP|5.003007||Viu kCOP|5.003007||Viu KEEPCOPY_PAT_MOD|5.009005||Viu KEEPCOPY_PAT_MODS|5.009005||Viu KEEPS|5.009005||Viu KEEPS_next|5.009005||Viu KEEPS_next_fail|5.009005||Viu KEEPS_next_fail_t8|5.035004||Viu KEEPS_next_fail_t8_p8|5.033003||Viu KEEPS_next_fail_t8_pb|5.033003||Viu KEEPS_next_fail_tb|5.035004||Viu KEEPS_next_fail_tb_p8|5.033003||Viu KEEPS_next_fail_tb_pb|5.033003||Viu KEEPS_next_t8|5.035004||Viu KEEPS_next_t8_p8|5.033003||Viu KEEPS_next_t8_pb|5.033003||Viu KEEPS_next_tb|5.035004||Viu KEEPS_next_tb_p8|5.033003||Viu KEEPS_next_tb_pb|5.033003||Viu KEEPS_t8|5.035004||Viu KEEPS_t8_p8|5.033003||Viu KEEPS_t8_pb|5.033003||Viu KEEPS_tb|5.035004||Viu KEEPS_tb_p8|5.033003||Viu KEEPS_tb_pb|5.033003||Viu KELVIN_SIGN|5.017003||Viu KERNEL|5.003007||Viu KEY_abs|5.003007||Viu KEY_accept|5.003007||Viu KEY_alarm|5.003007||Viu KEY_and|5.003007||Viu KEY_atan2|5.003007||Viu KEY_AUTOLOAD|5.003007||Viu KEY_BEGIN|5.003007||Viu KEY_bind|5.003007||Viu KEY_binmode|5.003007||Viu KEY_bless|5.003007||Viu KEY_break|5.027008||Viu KEY_caller|5.003007||Viu KEY_catch|5.033007||Viu KEY_chdir|5.003007||Viu KEY_CHECK|5.006000||Viu KEY_chmod|5.003007||Viu KEY_chomp|5.003007||Viu KEY_chop|5.003007||Viu KEY_chown|5.003007||Viu KEY_chr|5.003007||Viu KEY_chroot|5.003007||Viu KEY_close|5.003007||Viu KEY_closedir|5.003007||Viu KEY_cmp|5.003007||Viu KEY_connect|5.003007||Viu KEY_continue|5.003007||Viu KEY_cos|5.003007||Viu KEY_crypt|5.003007||Viu KEY___DATA|5.003007||Viu KEY_dbmclose|5.003007||Viu KEY_dbmopen|5.003007||Viu KEY_default|5.027008||Viu KEY_defer|5.035004||Viu KEY_defined|5.003007||Viu KEY_delete|5.003007||Viu KEY_DESTROY|5.003007||Viu KEY_die|5.003007||Viu KEY_do|5.003007||Viu KEY_dump|5.003007||Viu KEY_each|5.003007||Viu KEY_else|5.003007||Viu KEY_elsif|5.003007||Viu KEY___END|5.003007||Viu KEY_END|5.003007||Viu KEY_endgrent|5.003007||Viu KEY_endhostent|5.003007||Viu KEY_endnetent|5.003007||Viu KEY_endprotoent|5.003007||Viu KEY_endpwent|5.003007||Viu KEY_endservent|5.003007||Viu KEY_eof|5.003007||Viu KEY_eq|5.003007||Viu KEY_eval|5.003007||Viu KEY_evalbytes|5.015005||Viu KEY_exec|5.003007||Viu KEY_exists|5.003007||Viu KEY_exit|5.003007||Viu KEY_exp|5.003007||Viu KEY_fc|5.015008||Viu KEY_fcntl|5.003007||Viu KEY___FILE|5.003007||Viu KEY_fileno|5.003007||Viu KEY_finally|5.035008||Viu KEY_flock|5.003007||Viu KEY_for|5.003007||Viu KEY_foreach|5.003007||Viu KEY_fork|5.003007||Viu KEY_format|5.003007||Viu KEY_formline|5.003007||Viu KEY_ge|5.003007||Viu KEY_getc|5.003007||Viu KEY_getgrent|5.003007||Viu KEY_getgrgid|5.003007||Viu KEY_getgrnam|5.003007||Viu KEY_gethostbyaddr|5.003007||Viu KEY_gethostbyname|5.003007||Viu KEY_gethostent|5.003007||Viu KEY_getlogin|5.003007||Viu KEY_getnetbyaddr|5.003007||Viu KEY_getnetbyname|5.003007||Viu KEY_getnetent|5.003007||Viu KEY_getpeername|5.003007||Viu KEY_getpgrp|5.003007||Viu KEY_getppid|5.003007||Viu KEY_getpriority|5.003007||Viu KEY_getprotobyname|5.003007||Viu KEY_getprotobynumber|5.003007||Viu KEY_getprotoent|5.003007||Viu KEY_getpwent|5.003007||Viu KEY_getpwnam|5.003007||Viu KEY_getpwuid|5.003007||Viu KEY_getservbyname|5.003007||Viu KEY_getservbyport|5.003007||Viu KEY_getservent|5.003007||Viu KEY_getsockname|5.003007||Viu KEY_getsockopt|5.003007||Viu KEY_getspnam|5.031011||Viu KEY_given|5.009003||Viu KEY_glob|5.003007||Viu KEY_gmtime|5.003007||Viu KEY_goto|5.003007||Viu KEY_grep|5.003007||Viu KEY_gt|5.003007||Viu KEY_hex|5.003007||Viu KEY_if|5.003007||Viu KEY_index|5.003007||Viu KEY_INIT|5.005000||Viu KEY_int|5.003007||Viu KEY_ioctl|5.003007||Viu KEY_isa|5.031007||Viu KEY_join|5.003007||Viu KEY_keys|5.003007||Viu KEY_kill|5.003007||Viu KEY_last|5.003007||Viu KEY_lc|5.003007||Viu KEY_lcfirst|5.003007||Viu KEY_le|5.003007||Viu KEY_length|5.003007||Viu KEY___LINE|5.003007||Viu KEY_link|5.003007||Viu KEY_listen|5.003007||Viu KEY_local|5.003007||Viu KEY_localtime|5.003007||Viu KEY_lock|5.005000||Viu KEY_log|5.003007||Viu KEY_lstat|5.003007||Viu KEY_lt|5.003007||Viu KEY_m|5.003007||Viu KEY_map|5.003007||Viu KEY_mkdir|5.003007||Viu KEY_msgctl|5.003007||Viu KEY_msgget|5.003007||Viu KEY_msgrcv|5.003007||Viu KEY_msgsnd|5.003007||Viu KEY_my|5.003007||Viu KEY_ne|5.003007||Viu KEY_next|5.003007||Viu KEY_no|5.003007||Viu KEY_not|5.003007||Viu KEY_NULL|5.003007||Viu KEY_oct|5.003007||Viu KEY_open|5.003007||Viu KEY_opendir|5.003007||Viu KEY_or|5.003007||Viu KEY_ord|5.003007||Viu KEY_our|5.006000||Viu KEY_pack|5.003007||Viu KEY_package|5.003007||Viu KEY___PACKAGE|5.004000||Viu KEY_pipe|5.003007||Viu KEY_pop|5.003007||Viu KEY_pos|5.003007||Viu KEY_print|5.003007||Viu KEY_printf|5.003007||Viu KEY_prototype|5.003007||Viu KEY_push|5.003007||Viu KEY_q|5.003007||Viu KEY_qq|5.003007||Viu KEY_qr|5.005000||Viu KEY_quotemeta|5.003007||Viu KEY_qw|5.003007||Viu KEY_qx|5.003007||Viu KEY_rand|5.003007||Viu KEY_read|5.003007||Viu KEY_readdir|5.003007||Viu KEY_readline|5.003007||Viu KEY_readlink|5.003007||Viu KEY_readpipe|5.003007||Viu KEY_recv|5.003007||Viu KEY_redo|5.003007||Viu KEY_ref|5.003007||Viu KEY_rename|5.003007||Viu KEY_require|5.003007||Viu KEY_reset|5.003007||Viu KEY_return|5.003007||Viu KEY_reverse|5.003007||Viu KEY_rewinddir|5.003007||Viu KEY_rindex|5.003007||Viu KEY_rmdir|5.003007||Viu KEY_s|5.003007||Viu KEY_say|5.009003||Viu KEY_scalar|5.003007||Viu KEY_seek|5.003007||Viu KEY_seekdir|5.003007||Viu KEY_select|5.003007||Viu KEY_semctl|5.003007||Viu KEY_semget|5.003007||Viu KEY_semop|5.003007||Viu KEY_send|5.003007||Viu KEY_setgrent|5.003007||Viu KEY_sethostent|5.003007||Viu KEY_setnetent|5.003007||Viu KEY_setpgrp|5.003007||Viu KEY_setpriority|5.003007||Viu KEY_setprotoent|5.003007||Viu KEY_setpwent|5.003007||Viu KEY_setservent|5.003007||Viu KEY_setsockopt|5.003007||Viu KEY_shift|5.003007||Viu KEY_shmctl|5.003007||Viu KEY_shmget|5.003007||Viu KEY_shmread|5.003007||Viu KEY_shmwrite|5.003007||Viu KEY_shutdown|5.003007||Viu KEY_sigvar|5.025004||Viu KEY_sin|5.003007||Viu KEY_sleep|5.003007||Viu KEY_socket|5.003007||Viu KEY_socketpair|5.003007||Viu KEY_sort|5.003007||Viu KEY_splice|5.003007||Viu KEY_split|5.003007||Viu KEY_sprintf|5.003007||Viu KEY_sqrt|5.003007||Viu KEY_srand|5.003007||Viu KEY_stat|5.003007||Viu KEY_state|5.009004||Viu KEY_study|5.003007||Viu KEY_sub|5.003007||Viu KEY___SUB|5.015006||Viu KEY_substr|5.003007||Viu KEY_symlink|5.003007||Viu KEY_syscall|5.003007||Viu KEY_sysopen|5.003007||Viu KEY_sysread|5.003007||Viu KEY_sysseek|5.004000||Viu KEY_system|5.003007||Viu KEY_syswrite|5.003007||Viu KEY_tell|5.003007||Viu KEY_telldir|5.003007||Viu KEY_tie|5.003007||Viu KEY_tied|5.003007||Viu KEY_time|5.003007||Viu KEY_times|5.003007||Viu KEY_tr|5.003007||Viu KEY_truncate|5.003007||Viu KEY_try|5.033007||Viu KEY_uc|5.003007||Viu KEY_ucfirst|5.003007||Viu KEY_umask|5.003007||Viu KEY_undef|5.003007||Viu KEY_UNITCHECK|5.009005||Viu KEY_unless|5.003007||Viu KEY_unlink|5.003007||Viu KEY_unpack|5.003007||Viu KEY_unshift|5.003007||Viu KEY_untie|5.003007||Viu KEY_until|5.003007||Viu KEY_use|5.003007||Viu KEY_utime|5.003007||Viu KEY_values|5.003007||Viu KEY_vec|5.003007||Viu KEY_wait|5.003007||Viu KEY_waitpid|5.003007||Viu KEY_wantarray|5.003007||Viu KEY_warn|5.003007||Viu KEY_when|5.027008||Viu KEY_while|5.003007||Viu keyword|5.003007||Viu KEYWORD_PLUGIN_DECLINE|5.011002||Viu KEYWORD_PLUGIN_EXPR|5.011002||Viu KEYWORD_PLUGIN_MUTEX_INIT|5.027006||Viu KEYWORD_PLUGIN_MUTEX_LOCK|5.027006||Viu KEYWORD_PLUGIN_MUTEX_TERM|5.027006||Viu KEYWORD_PLUGIN_MUTEX_UNLOCK|5.027006||Viu keyword_plugin_standard|||iu KEYWORD_PLUGIN_STMT|5.011002||Viu KEY_write|5.003007||Viu KEY_x|5.003007||Viu KEY_xor|5.003007||Viu KEY_y|5.003007||Viu kGVOP_gv|5.006000||Viu kill|5.005000||Viu killpg|5.005000||Viu kLISTOP|5.003007||Viu kLOGOP|5.003007||Viu kLOOP|5.003007||Viu kPADOP|5.006000||Viu kPMOP|5.003007||Viu kPVOP|5.003007||Viu kSVOP|5.003007||Viu kSVOP_sv|5.006000||Viu kUNOP|5.003007||Viu kUNOP_AUX|5.021007||Viu LATIN1_TO_NATIVE|5.019004|5.003007|p LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE|5.013011||Viu LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE_NATIVE|5.017004||Viu LATIN_CAPITAL_LETTER_I_WITH_DOT_ABOVE|5.023002||Viu LATIN_CAPITAL_LETTER_I_WITH_DOT_ABOVE_UTF8|5.023002||Viu LATIN_CAPITAL_LETTER_SHARP_S|5.014000||Viu LATIN_CAPITAL_LETTER_SHARP_S_UTF8|5.019001||Viu LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS|5.013011||Viu LATIN_SMALL_LETTER_A_WITH_RING_ABOVE|5.013011||Viu LATIN_SMALL_LETTER_A_WITH_RING_ABOVE_NATIVE|5.017004||Viu LATIN_SMALL_LETTER_DOTLESS_I|5.023002||Viu LATIN_SMALL_LETTER_DOTLESS_I_UTF8|5.023002||Viu LATIN_SMALL_LETTER_LONG_S|5.017003||Viu LATIN_SMALL_LETTER_LONG_S_UTF8|5.019001||Viu LATIN_SMALL_LETTER_SHARP_S|5.011002||Viu LATIN_SMALL_LETTER_SHARP_S_NATIVE|5.017004||Viu LATIN_SMALL_LETTER_SHARP_S_UTF8|5.033003||Viu LATIN_SMALL_LETTER_Y_WITH_DIAERESIS|5.011002||Viu LATIN_SMALL_LETTER_Y_WITH_DIAERESIS_NATIVE|5.017004||Viu LATIN_SMALL_LIGATURE_LONG_S_T|5.019004||Viu LATIN_SMALL_LIGATURE_LONG_S_T_UTF8|5.019004||Viu LATIN_SMALL_LIGATURE_ST|5.019004||Viu LATIN_SMALL_LIGATURE_ST_UTF8|5.019004||Viu LB_BREAKABLE|5.023007||Viu LB_CM_ZWJ_foo|5.025003||Viu LB_HY_or_BA_then_foo|5.023007||Viu LB_NOBREAK|5.023007||Viu LB_NOBREAK_EVEN_WITH_SP_BETWEEN|5.023007||Viu LB_PR_or_PO_then_OP_or_HY|5.023007||Viu LB_RI_then_RI|5.025003||Viu LB_SP_foo|5.023007||Viu LB_SY_or_IS_then_various|5.023007||Viu LB_various_then_PO_or_PR|5.023007||Viu LC_NUMERIC_LOCK|5.027009||pVu LC_NUMERIC_UNLOCK|5.027009||pVu LDBL_DIG|5.006000||Viu LEAVE|5.003007|5.003007| leave_adjust_stacks|5.023008|5.023008|xu leave_scope|5.003007|5.003007|u LEAVE_SCOPE|5.003007||Viu LEAVE_with_name|5.011002|5.011002| LEXACT|5.031005||Viu LEXACT_REQ8|5.031006||Viu LEXACT_REQ8_t8|5.035004||Viu LEXACT_REQ8_t8_p8|5.033003||Viu LEXACT_REQ8_t8_pb|5.033003||Viu LEXACT_REQ8_tb|5.035004||Viu LEXACT_REQ8_tb_p8|5.033003||Viu LEXACT_REQ8_tb_pb|5.033003||Viu LEXACT_t8|5.035004||Viu LEXACT_t8_p8|5.033003||Viu LEXACT_t8_pb|5.033003||Viu LEXACT_tb|5.035004||Viu LEXACT_tb_p8|5.033003||Viu LEXACT_tb_pb|5.033003||Viu lex_bufutf8|5.011002|5.011002|x lex_discard_to|5.011002|5.011002|x LEX_DONT_CLOSE_RSFP|5.015009||Viu LEX_EVALBYTES|5.015005||Viu lex_grow_linestr|5.011002|5.011002|x LEX_IGNORE_UTF8_HINTS|5.015005||Viu LEX_KEEP_PREVIOUS|5.011002|5.011002| lex_next_chunk|5.011002|5.011002|x LEX_NOTPARSING|5.004004||Viu lex_peek_unichar|5.011002|5.011002|x lex_read_space|5.011002|5.011002|x lex_read_to|5.011002|5.011002|x lex_read_unichar|5.011002|5.011002|x lex_start|5.013007|5.013007|x LEX_START_COPIED|5.015005||Viu LEX_START_FLAGS|5.015005||Viu LEX_START_SAME_FILTER|5.014000||Viu lex_stuff_pv|5.013006|5.013006|x lex_stuff_pvn|5.011002|5.011002|x lex_stuff_pvs|5.013005|5.013005|x lex_stuff_sv|5.011002|5.011002|x LEX_STUFF_UTF8|5.011002|5.011002| lex_unstuff|5.011002|5.011002|x LF_NATIVE|5.019004||Viu LIB_INVARG|5.008001||Viu LIBM_LIB_VERSION|5.009003|5.009003|Vn LIKELY|5.009004|5.003007|p link|5.006000||Viu LINKLIST|5.013006|5.013006| list|5.003007||Viu listen|5.005000||Viu listkids|5.003007||Viu LNBREAK|5.009005||Viu LNBREAK_t8|5.035004||Viu LNBREAK_t8_p8|5.033003||Viu LNBREAK_t8_pb|5.033003||Viu LNBREAK_tb|5.035004||Viu LNBREAK_tb_p8|5.033003||Viu LNBREAK_tb_pb|5.033003||Viu load_charnames|5.031010||cViu load_module|5.006000|5.003007|pv load_module_nocontext|5.013006|5.013006|vn LOCALECONV_LOCK|5.033005||Viu LOCALECONV_UNLOCK|5.033005||Viu LOCALE_INIT|5.024000||Viu LOCALE_INIT_LC_NUMERIC|5.033005||Viu LOCALE_LOCK|5.024000||Viu LOCALE_PAT_MOD|5.013006||Viu LOCALE_PAT_MODS|5.013006||Viu LOCALE_READ_LOCK|5.033005||Viu LOCALE_READ_UNLOCK|5.033005||Viu LOCALE_TERM|5.024000||Viu LOCALE_TERM_LC_NUMERIC|5.033005||Viu LOCALE_TERM_POSIX_2008|5.033005||Viu LOCALE_UNLOCK|5.024000||Viu localize|5.003007||Viu LOCAL_PATCH_COUNT|5.003007||Viu localtime|5.031011||Viu LOCALTIME_MAX|5.010001|5.010001|Vn LOCALTIME_MIN|5.010001|5.010001|Vn LOCALTIME_R_NEEDS_TZSET|5.010000|5.010000|Vn LOCALTIME_R_PROTO|5.008000|5.008000|Vn LOCK_DOLLARZERO_MUTEX|5.008001||Viu lockf|5.006000||Viu LOCK_LC_NUMERIC_STANDARD|5.021010||poVnu LOCK_NUMERIC_STANDARD|||piu LOC_SED|5.003007|5.003007|Vn LOGICAL|5.005000||Viu LOGICAL_t8|5.035004||Viu LOGICAL_t8_p8|5.033003||Viu LOGICAL_t8_pb|5.033003||Viu LOGICAL_tb|5.035004||Viu LOGICAL_tb_p8|5.033003||Viu LOGICAL_tb_pb|5.033003||Viu LONGDBLINFBYTES|5.023000|5.023000|Vn LONGDBLMANTBITS|5.023000|5.023000|Vn LONGDBLNANBYTES|5.023000|5.023000|Vn LONGDOUBLE_BIG_ENDIAN|5.021009||Viu LONGDOUBLE_DOUBLEDOUBLE|5.021009||Viu LONG_DOUBLE_EQUALS_DOUBLE|5.007001||Viu LONG_DOUBLE_IS_DOUBLE|5.021003|5.021003|Vn LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE|5.023006|5.023006|Vn LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE|5.023006|5.023006|Vn LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN|5.021003|5.021003|Vn LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE|5.023006|5.023006|Vn LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE|5.023006|5.023006|Vn LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN|5.021003|5.021003|Vn LONG_DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN|5.021003|5.021003|Vn LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN|5.021003|5.021003|Vn LONG_DOUBLE_IS_UNKNOWN_FORMAT|5.021003|5.021003|Vn LONG_DOUBLE_IS_VAX_H_FLOAT|5.025004|5.025004|Vn LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN|5.021003|5.021003|Vn LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN|5.021003|5.021003|Vn LONG_DOUBLEKIND|5.021003|5.021003|Vn LONGDOUBLE_LITTLE_ENDIAN|5.021009||Viu LONGDOUBLE_MIX_ENDIAN|5.023006||Viu LONG_DOUBLESIZE|5.005000|5.005000|Vn LONG_DOUBLE_STYLE_IEEE|5.025007|5.025007|Vn LONG_DOUBLE_STYLE_IEEE_EXTENDED|5.025007|5.025007|Vn LONGDOUBLE_VAX_ENDIAN|5.025004||Viu LONGDOUBLE_X86_80_BIT|5.021009||Viu LONGJMP|5.005000||Viu longjmp|5.005000||Viu LONGJMP_t8|5.035004||Viu LONGJMP_t8_p8|5.033003||Viu LONGJMP_t8_pb|5.033003||Viu LONGJMP_tb|5.035004||Viu LONGJMP_tb_p8|5.033003||Viu LONGJMP_tb_pb|5.033003||Viu LONGLONGSIZE|5.005000|5.005000|Vn LONGSIZE|5.004000|5.003007|oVn LOOKBEHIND_END_t8_p8|||Viu LOOKBEHIND_END_t8_pb|||Viu LOOKBEHIND_END_t8|||Viu LOOKBEHIND_END_tb_p8|||Viu LOOKBEHIND_END_tb_pb|||Viu LOOKBEHIND_END_tb|||Viu LOOKBEHIND_END|||Viu looks_like_bool|5.027008||Viu looks_like_number|5.003007|5.003007| LOOP_PAT_MODS|5.009005||Viu lop|5.005000||Viu lossless_NV_to_IV|5.031001||Vniu LOWEST_ANYOF_HRx_BYTE|5.031002||Viu L_R_TZSET|5.009005|5.009005|Vn lsbit_pos32|5.035003||cVnu lsbit_pos|5.035004||Viu lsbit_pos64|5.035003||cVnu lsbit_pos_uintmax|5.035003||Viu lseek|5.005000||Viu LSEEKSIZE|5.006000|5.006000|Vn lstat|5.005000||Viu LvFLAGS|5.015006||Viu LVf_NEG_LEN|5.027001||Viu LVf_NEG_OFF|5.027001||Viu LVf_OUT_OF_RANGE|5.027001||Viu LVRET|5.007001||Vi LvSTARGOFF|5.019004||Viu LvTARG|5.003007||Viu LvTARGLEN|5.003007||Viu LvTARGOFF|5.003007||Viu LvTYPE|5.003007||Viu LZC_TO_MSBIT_POS|5.035003||Viu magic_clear_all_env|5.004001||Viu magic_cleararylen_p|5.017002||Viu magic_clearenv|5.003007||Viu magic_clearhint|5.009004||Vi magic_clearhints|5.011000||Vi magic_clearisa|5.010001||Viu magic_clearpack|5.003007||Viu magic_clearsig|5.003007||Viu magic_copycallchecker|5.017000||Viu magic_dump|5.006000|5.006000|u magic_existspack|5.003007||Viu magic_freearylen_p|5.009003||Viu magic_freecollxfrm|5.033004||Viu magic_freemglob|5.033004||Viu magic_freeovrld|5.007001||Viu magic_freeutf8|5.033004||Viu magic_get|5.003007||Viu magic_getarylen|5.003007||Viu magic_getdebugvar|5.021005||Viu magic_getdefelem|5.004000||Viu magic_getnkeys|5.004005||Viu magic_getpack|5.003007||Viu magic_getpos|5.003007||Viu magic_getsig|5.003007||Viu magic_getsubstr|5.004005||Viu magic_gettaint|5.003007||Viu magic_getuvar|5.003007||Viu magic_getvec|5.004005||Viu magic_killbackrefs|5.006000||Viu magic_methcall1|5.013001||Viu magic_methcall|||vi magic_methpack|5.005000||Viu magic_nextpack|5.003007||Viu magic_regdata_cnt|5.006000||Viu magic_regdatum_get|5.006000||Viu magic_regdatum_set|5.006001||Viu magic_scalarpack|5.009001||Viu magic_set|5.003007||Viu magic_set_all_env|5.004004||Viu magic_setarylen|5.003007||Viu magic_setcollxfrm|5.004000||Viu magic_setdbline|5.003007||Viu magic_setdebugvar|5.021005||Viu magic_setdefelem|5.004000||Viu magic_setenv|5.003007||Viu magic_sethint|5.009004||Vi magic_sethint_feature|5.031007||Viu magic_setisa|5.003007||Viu magic_setlvref|5.021005||Viu magic_setmglob|5.003007||Viu magic_setnkeys|5.003007||Viu magic_setnonelem|5.027009||Viu magic_setpack|5.003007||Viu magic_setpos|5.003007||Viu magic_setregexp|5.008001||Viu magic_setsig|5.003007||Viu magic_setsigall|5.035001||Viu magic_setsubstr|5.003007||Viu magic_settaint|5.003007||Viu magic_setutf8|5.008001||Viu magic_setuvar|5.003007||Viu magic_setvec|5.003007||Viu magic_sizepack|5.005000||Viu magic_wipepack|5.003007||Viu make_exactf_invlist|5.031006||Viu make_matcher|5.027008||Viu make_trie|5.009002||Viu malloc|5.003007||Vn MALLOC_CHECK_TAINT2|5.008001||Viu MALLOC_CHECK_TAINT|5.008001||Viu malloced_size|5.005000||Vniu malloc_good_size|5.010001||Vniu MALLOC_INIT|5.005000||Viu MALLOC_OVERHEAD|5.006000||Viu Malloc_t|5.003007|5.003007|Vn MALLOC_TERM|5.005000||Viu MALLOC_TOO_LATE_FOR|5.008001||Viu MARK|5.003007|5.003007| MARKPOINT|5.009005||Viu MARKPOINT_next|5.009005||Viu MARKPOINT_next_fail|5.009005||Viu MARKPOINT_next_fail_t8|5.035004||Viu MARKPOINT_next_fail_t8_p8|5.033003||Viu MARKPOINT_next_fail_t8_pb|5.033003||Viu MARKPOINT_next_fail_tb|5.035004||Viu MARKPOINT_next_fail_tb_p8|5.033003||Viu MARKPOINT_next_fail_tb_pb|5.033003||Viu MARKPOINT_next_t8|5.035004||Viu MARKPOINT_next_t8_p8|5.033003||Viu MARKPOINT_next_t8_pb|5.033003||Viu MARKPOINT_next_tb|5.035004||Viu MARKPOINT_next_tb_p8|5.033003||Viu MARKPOINT_next_tb_pb|5.033003||Viu MARKPOINT_t8|5.035004||Viu MARKPOINT_t8_p8|5.033003||Viu MARKPOINT_t8_pb|5.033003||Viu MARKPOINT_tb|5.035004||Viu MARKPOINT_tb_p8|5.033003||Viu MARKPOINT_tb_pb|5.033003||Viu markstack_grow|5.021001|5.021001|u matcher_matches_sv|5.027008||Viu MAX|5.025006||Viu MAX_ANYOF_HRx_BYTE|5.031002||Viu MAXARG|5.003007||Viu MAX_CHARSET_NAME_LENGTH|5.013009||Viu MAX_FEATURE_LEN|5.013010||Viu MAX_FOLD_FROMS|5.029006||Viu MAX_LEGAL_CP|5.029002||Viu MAX_MATCHES|5.033005||Viu MAXO|5.003007||Viu MAXPATHLEN|5.006000||Viu MAX_PORTABLE_UTF8_TWO_BYTE|5.011002||Viu MAX_PRINT_A|5.033005||Viu MAX_RECURSE_EVAL_NOCHANGE_DEPTH|5.009005||Viu MAXSYSFD|5.003007||Viu MAX_UNICODE_UTF8|5.027006||Viu MAX_UNI_KEYWORD_INDEX|5.027011||Viu MAX_UTF8_TWO_BYTE|5.019004||Viu MAYBE_DEREF_GV|5.015003||Viu MAYBE_DEREF_GV_flags|5.015003||Viu MAYBE_DEREF_GV_nomg|5.015003||Viu maybe_multimagic_gv|5.019004||Viu mayberelocate|5.015006||Viu MBLEN_LOCK|5.033005||Viu MBLEN_UNLOCK|5.033005||Viu MBOL|5.003007||Viu MBOL_t8|5.035004||Viu MBOL_t8_p8|5.033003||Viu MBOL_t8_pb|5.033003||Viu MBOL_tb|5.035004||Viu MBOL_tb_p8|5.033003||Viu MBOL_tb_pb|5.033003||Viu MBTOWC_LOCK|5.033005||Viu MBTOWC_UNLOCK|5.033005||Viu MDEREF_ACTION_MASK|5.021007||Viu MDEREF_AV_gvav_aelem|5.021007||Viu MDEREF_AV_gvsv_vivify_rv2av_aelem|5.021007||Viu MDEREF_AV_padav_aelem|5.021007||Viu MDEREF_AV_padsv_vivify_rv2av_aelem|5.021007||Viu MDEREF_AV_pop_rv2av_aelem|5.021007||Viu MDEREF_AV_vivify_rv2av_aelem|5.021007||Viu MDEREF_FLAG_last|5.021007||Viu MDEREF_HV_gvhv_helem|5.021007||Viu MDEREF_HV_gvsv_vivify_rv2hv_helem|5.021007||Viu MDEREF_HV_padhv_helem|5.021007||Viu MDEREF_HV_padsv_vivify_rv2hv_helem|5.021007||Viu MDEREF_HV_pop_rv2hv_helem|5.021007||Viu MDEREF_HV_vivify_rv2hv_helem|5.021007||Viu MDEREF_INDEX_const|5.021007||Viu MDEREF_INDEX_gvsv|5.021007||Viu MDEREF_INDEX_MASK|5.021007||Viu MDEREF_INDEX_none|5.021007||Viu MDEREF_INDEX_padsv|5.021007||Viu MDEREF_MASK|5.021007||Viu MDEREF_reload|5.021007||Viu MDEREF_SHIFT|5.021007||Viu measure_struct|5.007003||Viu MEM_ALIGNBYTES|5.003007|5.003007|Vn memBEGINPs|5.027006||Viu memBEGINs|5.027006||Viu MEMBER_TO_FPTR|5.006000||Viu memCHRs|5.031008|5.003007|p mem_collxfrm|5.003007||dViu _mem_collxfrm|5.025002||Viu memENDPs|5.027006||Viu memENDs|5.027006||Viu memEQ|5.004000|5.003007|p memEQs|5.009005|5.003007|p memGE|5.025005||Viu memGT|5.025005||Viu memLE|5.025005||Viu MEM_LOG_ALLOC|5.009003||Viu mem_log_alloc|5.024000||Vniu mem_log_common|5.010001||Vniu MEM_LOG_DEL_SV|||Viu MEM_LOG_FREE|5.009003||Viu mem_log_free|5.024000||Vniu MEM_LOG_NEW_SV|||Viu MEM_LOG_REALLOC|5.009003||Viu mem_log_realloc|5.024000||Vniu memLT|5.025005||Viu memNE|5.004000|5.003007|p memNEs|5.009005|5.003007|p MEM_SIZE|5.003007||Viu MEM_SIZE_MAX|5.009005||Viu MEM_WRAP_CHECK_1|5.009002||Viu MEM_WRAP_CHECK|5.009002||Viu MEM_WRAP_CHECK_s|5.027010||Viu memzero|5.003007|5.003007| MEOL|5.003007||Viu MEOL_t8|5.035004||Viu MEOL_t8_p8|5.033003||Viu MEOL_t8_pb|5.033003||Viu MEOL_tb|5.035004||Viu MEOL_tb_p8|5.033003||Viu MEOL_tb_pb|5.033003||Viu mess|5.003007||pvV mess_alloc|5.005000||Viu mess_nocontext|5.006000||pvVn mess_sv|5.013001|5.004000|p MEXTEND|5.003007||Viu mfree|||nu MgBYTEPOS|5.019004||Viu MgBYTEPOS_set|5.019004||Viu mg_clear|5.003007|5.003007| mg_copy|5.003007|5.003007| mg_dup|5.007003|5.007003|u MGf_BYTES|5.019004||Viu MGf_COPY|5.007003||Viu MGf_DUP|5.007003||Viu MGf_GSKIP|5.003007||Viu mg_find|5.003007|5.003007|n mg_findext|5.013008|5.003007|pn mg_find_mglob|5.019002||cViu MGf_LOCAL|5.009003||Viu MGf_MINMATCH|5.003007||Viu MGf_PERSIST|5.021005||Viu mg_free|5.003007|5.003007| mg_freeext|5.027004|5.027004| mg_free_type|5.013006|5.013006| MGf_REFCOUNTED|5.003007||Viu MGf_REQUIRE_GV|5.021004||Viu MGf_TAINTEDDIR|5.003007||Viu mg_get|5.003007|5.003007| mg_length|5.005000|5.005000|d mg_localize|5.009003||Vi mg_magical|5.003007|5.003007|n MgPV|5.003007||Viu MgPV_const|5.009003||Viu MgPV_nolen_const|5.009003||Viu mg_set|5.003007|5.003007| mg_size|5.005000|5.005000|u MgSV|5.033009||Viu MgTAINTEDDIR|5.003007||Viu MgTAINTEDDIR_off|5.004000||Viu MgTAINTEDDIR_on|5.003007||Viu MICRO_SIGN|5.011002||Viu MICRO_SIGN_NATIVE|5.017004||Viu MICRO_SIGN_UTF8|5.033003||Viu MIN|5.025006||Viu mini_mktime|5.007002|5.007002|n MINMOD|5.003007||Viu MINMOD_t8|5.035004||Viu MINMOD_t8_p8|5.033003||Viu MINMOD_t8_pb|5.033003||Viu MINMOD_tb|5.035004||Viu MINMOD_tb_p8|5.033003||Viu MINMOD_tb_pb|5.033003||Viu minus_v|5.015006||Viu missingterm|5.005000||Viu Mkdir|5.004000||Viu mkdir|5.005000||Viu mktemp|5.005000||Viu Mmap_t|5.006000|5.006000|Vn mode_from_discipline|5.006000||Viu Mode_t|5.003007|5.003007|Vn modkids|5.003007||Viu MON_10|5.027010||Viu MON_11|5.027010||Viu MON_12|5.027010||Viu MON_1|5.027010||Viu MON_2|5.027010||Viu MON_3|5.027010||Viu MON_4|5.027010||Viu MON_5|5.027010||Viu MON_6|5.027010||Viu MON_7|5.027010||Viu MON_8|5.027010||Viu MON_9|5.027010||Viu more_bodies|||cu more_sv|5.009004||cVu moreswitches|5.003007||cVu mortal_getenv|5.031011||cVnu Move|5.003007|5.003007| MoveD|5.009002|5.003007|p move_proto_attr|5.019005||Viu M_PAT_MODS|5.009005||Viu MPH_BUCKETS|5.027011||Viu MPH_RSHIFT|5.027011||Viu MPH_VALt|5.027011||Viu mPUSHi|5.009002|5.003007|p mPUSHn|5.009002|5.003007|p mPUSHp|5.009002|5.003007|p mPUSHs|5.010001|5.003007|p mPUSHu|5.009002|5.003007|p mro_clean_isarev|5.013007||Viu mro_gather_and_rename|5.013007||Viu mro_get_from_name|||u mro_get_linear_isa|5.009005|5.009005| mro_get_linear_isa_c3|||i mro_get_linear_isa_dfs|5.009005||Vi MRO_GET_PRIVATE_DATA|5.010001|5.010001| mro_get_private_data|||cu mro_isa_changed_in|5.009005||Vi mro_meta_dup|5.009005||Viu mro_meta_init|||ciu mro_method_changed_in|5.009005|5.009005| mro_package_moved|5.013006||Vi mro_register||| mro_set_mro|||u mro_set_private_data||| msbit_pos32|5.035003||cVnu msbit_pos|5.035004||Viu msbit_pos64|5.035003||cVnu msbit_pos_uintmax|5.035003||Viu MSPAGAIN|5.003007||Viu MSVC_DIAG_IGNORE|5.029010||Viu MSVC_DIAG_IGNORE_DECL|5.029010||Viu MSVC_DIAG_IGNORE_STMT|5.029010||Viu MSVC_DIAG_RESTORE|5.029010||Viu MSVC_DIAG_RESTORE_DECL|5.029010||Viu MSVC_DIAG_RESTORE_STMT|5.029010||Viu mul128|5.005000||Viu MULTICALL|5.009003|5.009003| multiconcat_stringify|5.027006||cViu multideref_stringify|5.021009||cViu MULTILINE_PAT_MOD|5.009005||Viu MULTIPLICITY|5.006000|5.006000|Vn MUTABLE_AV|5.010001|5.003007|p MUTABLE_CV|5.010001|5.003007|p MUTABLE_GV|5.010001|5.003007|p MUTABLE_HV|5.010001|5.003007|p MUTABLE_IO|5.010001|5.003007|p MUTABLE_PTR|5.010001|5.003007|p MUTABLE_SV|5.010001|5.003007|p MUTEX_DESTROY|5.005000||Viu MUTEX_INIT|5.005000||Viu MUTEX_INIT_NEEDS_MUTEX_ZEROED|5.005003||Viu MUTEX_LOCK|5.005000||Viu MUTEX_UNLOCK|5.005000||Viu mXPUSHi|5.009002|5.003007|p mXPUSHn|5.009002|5.003007|p mXPUSHp|5.009002|5.003007|p mXPUSHs|5.010001|5.003007|p mXPUSHu|5.009002|5.003007|p my|5.011000||Viu my_atof2|5.029000||cVu my_atof3|5.029000||cVu my_atof|5.006000|5.006000| my_attrs|5.006000||Viu my_binmode|5.006000||Viu my_bytes_to_utf8|5.021009||Vniu my_chsize|5.003007||Vu my_clearenv|5.009003||Viu MY_CXT|5.009000|5.009000|p MY_CXT_CLONE|5.009002|5.009000|p MY_CXT_INDEX|5.009005||Viu MY_CXT_INIT|5.009000|5.009000|p MY_CXT_INIT_ARG|5.013005||Viu MY_CXT_INIT_INTERP|5.009003||Viu my_cxt_init|||u my_dirfd|5.009005|5.009005|nu my_exit|5.003007|5.003007| my_exit_jump|5.005000||Viu my_failure_exit|5.004000|5.004000|u my_fflush_all|5.006000|5.006000|u my_fork|5.007003|5.007003|nu my_kid|5.006000||Viu my_lstat|5.013003||Viu my_lstat_flags|5.013003||cViu my_memrchr|5.027006||Vniu my_mkostemp_cloexec|||niu my_mkostemp|||niu my_mkstemp_cloexec|||niu my_mkstemp|||niu my_nl_langinfo|5.027006||Vniu my_pclose|5.003007|5.003007|u my_popen|5.003007|5.003007|u my_popen_list|5.007001|5.007001|u my_setenv|5.003007|5.003007| my_snprintf|5.009004||pvVn my_socketpair|5.007003|5.007003|nu my_sprintf|5.009003|5.003007|pdn my_stat|5.013003||Viu my_stat_flags|5.013003||cViu my_strerror|5.021001||Viu my_strftime|5.007002||V my_strlcat|5.009004|5.003007|pn my_strlcpy|5.009004|5.003007|pn my_strnlen|5.027006|5.003007|pn my_strtod|5.029010|5.029010|n my_unexec|5.003007||Viu my_vsnprintf|5.009004|5.009004|n N0|5.029001||Viu N10|5.029001||Viu N11|5.029001||Viu N1|5.029001||Viu N2|5.029001||Viu N3|5.029001||Viu N4|5.029001||Viu N5|5.029001||Viu N6|5.029001||Viu N7|5.029001||Viu N8|5.029001||Viu N9|5.029001||Viu NAN_COMPARE_BROKEN|5.021005||Viu NANYOFM|5.029005||Viu NANYOFM_t8|5.035004||Viu NANYOFM_t8_p8|5.033003||Viu NANYOFM_t8_pb|5.033003||Viu NANYOFM_tb|5.035004||Viu NANYOFM_tb_p8|5.033003||Viu NANYOFM_tb_pb|5.033003||Viu NATIVE8_TO_UNI|5.011000||Viu NATIVE_BYTE_IS_INVARIANT|5.019004||Viu NATIVE_SKIP|5.019004||Viu NATIVE_TO_ASCII|5.007001||Viu NATIVE_TO_I8|5.015006||Viu NATIVE_TO_LATIN1|5.019004|5.003007|p NATIVE_TO_NEED|5.019004||dcVnu NATIVE_TO_UNI|5.007001|5.003007|p NATIVE_TO_UTF|5.007001||Viu NATIVE_UTF8_TO_I8|5.019004||Viu nBIT_MASK|5.033001||Viu nBIT_UMAX|5.033001||Viu NBOUND|5.003007||Viu NBOUNDA|5.013009||Viu NBOUNDA_t8|5.035004||Viu NBOUNDA_t8_p8|5.033003||Viu NBOUNDA_t8_pb|5.033003||Viu NBOUNDA_tb|5.035004||Viu NBOUNDA_tb_p8|5.033003||Viu NBOUNDA_tb_pb|5.033003||Viu NBOUNDL|5.004000||Viu NBOUNDL_t8|5.035004||Viu NBOUNDL_t8_p8|5.033003||Viu NBOUNDL_t8_pb|5.033003||Viu NBOUNDL_tb|5.035004||Viu NBOUNDL_tb_p8|5.033003||Viu NBOUNDL_tb_pb|5.033003||Viu NBOUND_t8|5.035004||Viu NBOUND_t8_p8|5.033003||Viu NBOUND_t8_pb|5.033003||Viu NBOUND_tb|5.035004||Viu NBOUND_tb_p8|5.033003||Viu NBOUND_tb_pb|5.033003||Viu NBOUNDU|5.013009||Viu NBOUNDU_t8|5.035004||Viu NBOUNDU_t8_p8|5.033003||Viu NBOUNDU_t8_pb|5.033003||Viu NBOUNDU_tb|5.035004||Viu NBOUNDU_tb_p8|5.033003||Viu NBOUNDU_tb_pb|5.033003||Viu NBSP_NATIVE|5.021001||Viu NBSP_UTF8|5.021001||Viu NDBM_H_USES_PROTOTYPES|5.032001|5.032001|Vn NDEBUG|5.021007||Viu need_utf8|5.009003||Vniu NEED_VA_COPY|5.007001|5.007001|Vn NEGATIVE_INDICES_VAR|5.008001||Viu Netdb_hlen_t|5.005000|5.005000|Vn Netdb_host_t|5.005000|5.005000|Vn Netdb_name_t|5.005000|5.005000|Vn Netdb_net_t|5.005000|5.005000|Vn NETDB_R_OBSOLETE|5.008000||Viu New|5.003007||Viu newANONATTRSUB|5.006000|5.006000|u newANONHASH|5.003007|5.003007|u newANONLIST|5.003007|5.003007|u newANONSUB|5.003007|5.003007|u newASSIGNOP|5.003007|5.003007| newATTRSUB|5.006000|5.006000| newATTRSUB_x|5.019008||cVi newAV|5.003007|5.003007| newAV_alloc_x|5.035001|5.035001| newAV_alloc_xz|5.035001|5.035001| newAVREF|5.003007|5.003007|u newBINOP|5.003007|5.003007| new_body_allocated|||Viu new_body_from_arena|||Viu Newc|5.003007||Viu new_collate|5.006000||Viu newCONDOP|5.003007|5.003007| new_constant|||iu newCONSTSUB|5.004005|5.003007|p newCONSTSUB_flags|5.015006|5.015006| new_ctype|5.006000||Viu newCVREF|5.003007|5.003007|u newDEFEROP|5.035004|5.035004|x newDEFSVOP|5.021006|5.021006| newFORM|5.003007|5.003007|u newFOROP|5.013007|5.013007| newGIVENOP|5.009003|5.009003| newGIVWHENOP|5.027008||Viu newGP|||xiu newGVgen|5.003007|5.003007|u newGVgen_flags|5.015004|5.015004|u newGVOP|5.003007|5.003007| newGVREF|5.003007|5.003007|u new_he|5.005000||Viu newHV|5.003007|5.003007| newHVhv|5.005000|5.005000|u newHVREF|5.003007|5.003007|u _new_invlist|5.013010||cViu _new_invlist_C_array|5.015008||cViu newIO|5.003007|5.003007|u newLISTOP|5.003007|5.003007| newLOGOP|5.003007|5.003007| new_logop|5.005000||Viu newLOOPEX|5.003007|5.003007| newLOOPOP|5.003007|5.003007| newMETHOP|5.021005|5.021005| newMETHOP_internal|5.021005||Viu newMETHOP_named|5.021005|5.021005| new_msg_hv|5.027009||Viu newMYSUB|5.017004|5.017004|u new_NOARENA|||Viu new_NOARENAZ|||Viu newNULLLIST|5.003007|5.003007| new_numeric|5.006000||Viu newOP|5.003007|5.003007| NewOp|5.008001||Viu newPADNAMELIST|5.021007|5.021007|xn newPADNAMEouter|5.021007|5.021007|xn newPADNAMEpvn|5.021007|5.021007|xn newPADOP|5.006000||V newPMOP|5.003007|5.003007| newPROG|5.003007|5.003007|u newPVOP|5.003007|5.003007| newRANGE|5.003007|5.003007| newRV|5.003007|5.003007| newRV_inc|5.004000|5.003007|p newRV_noinc|5.004000|5.003007|p newSLICEOP|5.003007|5.003007| new_stackinfo|5.005000|5.005000|u newSTATEOP|5.003007|5.003007| newSTUB|5.017001||Viu newSUB|5.003007|5.003007| newSV|5.003007|5.003007| NEWSV|5.003007||Viu newSVavdefelem|5.019004||Viu newSVhek|5.009003|5.009003| newSViv|5.003007|5.003007| newSVnv|5.006000|5.003007| newSVOP|5.003007|5.003007| newSVpadname|5.017004|5.017004|x newSVpv|5.003007|5.003007| newSVpvf|5.004000||vV newSVpvf_nocontext|5.006000||vVn newSVpvn|5.004005|5.003007|p newSVpvn_flags|5.010001|5.003007|p newSVpvn_share|5.007001|5.003007|p newSVpvn_utf8|5.010001|5.003007|p newSVpvs|5.009003|5.003007|p newSVpvs_flags|5.010001|5.003007|p newSVpv_share|5.013006|5.013006| newSVpvs_share|5.009003|5.003007|p newSVREF|5.003007|5.003007|u newSVrv|5.003007|5.003007| newSVsv|5.003007|5.003007| newSVsv_flags|5.029009|5.003007|p newSVsv_nomg|5.029009|5.003007|p newSV_type|5.009005|5.003007|p newSV_type_mortal||| newSVuv|5.006000|5.003007|p new_SV|||Viu newTRYCATCHOP|5.033007|5.033007|x newUNOP|5.003007|5.003007| newUNOP_AUX|5.021007|5.021007| new_version|5.009000|5.009000| NEW_VERSION|5.019008||Viu new_warnings_bitfield|||xciu newWHENOP|5.027008|5.027008| newWHILEOP|5.013007|5.013007| Newx|5.009003|5.003007|p Newxc|5.009003|5.003007|p new_XNV|||Viu new_XPVMG|||Viu new_XPVNV|||Viu newXS|5.006000|5.006000| newXS_deffile|5.021006||cViu newXS_flags|5.009004|5.009004|xu newXS_len_flags|5.015006||Vi newXSproto|5.006000|5.006000| Newxz|5.009003|5.003007|p Newz|5.003007||Viu nextargv|5.003007||Viu nextchar|5.005000||Viu NEXT_LINE_CHAR|5.007003||Viu NEXT_OFF|5.005000||Viu next_symbol|5.007003||Viu ninstr|5.003007|5.003007|n NL_LANGINFO_LOCK|5.033005||Viu NL_LANGINFO_UNLOCK|5.033005||Viu NOARENA|||Viu no_bareword_allowed|5.005004||Viu no_bareword_filehandle|5.033006||Viu NOCAPTURE_PAT_MOD|5.021008||Viu NOCAPTURE_PAT_MODS|5.021008||Viu NODE_ALIGN|5.005000||Viu NODE_ALIGN_FILL|5.005000||Viu NODE_STEP_REGNODE|5.005000||Viu NODE_SZ_STR|5.006000||Viu NO_ENV_ARRAY_IN_MAIN|5.009004||Viu NOEXPR|5.027010||Viu NofAMmeth|5.003007||Viu no_fh_allowed|5.003007||Viu NOLINE|5.003007||Viu NO_LOCALE|5.007000||Viu NONDESTRUCT_PAT_MOD|5.013002||Viu NONDESTRUCT_PAT_MODS|5.013002||Viu NON_OTHER_COUNT|5.033005||Viu NONV|||Viu no_op|5.003007||Viu NOOP|5.005000|5.003007|p noperl_die|5.021006||vVniu NORETURN_FUNCTION_END|5.009003||Viu NORMAL|5.003007||Viu NOSTR|5.027010||Viu NO_TAINT_SUPPORT|5.017006||Viu not_a_number|5.005000||Viu NOTE3|5.027001||Viu NOTHING|5.003007||Viu NOTHING_t8|5.035004||Viu NOTHING_t8_p8|5.033003||Viu NOTHING_t8_pb|5.033003||Viu NOTHING_tb|5.035004||Viu NOTHING_tb_p8|5.033003||Viu NOTHING_tb_pb|5.033003||Viu nothreadhook|5.008000|5.008000| notify_parser_that_changed_to_utf8|5.025010||Viu not_incrementable|5.021002||Viu NOT_IN_PAD|5.005000||Viu NOT_REACHED|5.019006|5.003007|poVnu NPOSIXA|5.017003||Viu NPOSIXA_t8|5.035004||Viu NPOSIXA_t8_p8|5.033003||Viu NPOSIXA_t8_pb|5.033003||Viu NPOSIXA_tb|5.035004||Viu NPOSIXA_tb_p8|5.033003||Viu NPOSIXA_tb_pb|5.033003||Viu NPOSIXD|5.017003||Viu NPOSIXD_t8|5.035004||Viu NPOSIXD_t8_p8|5.033003||Viu NPOSIXD_t8_pb|5.033003||Viu NPOSIXD_tb|5.035004||Viu NPOSIXD_tb_p8|5.033003||Viu NPOSIXD_tb_pb|5.033003||Viu NPOSIXL|5.017003||Viu NPOSIXL_t8|5.035004||Viu NPOSIXL_t8_p8|5.033003||Viu NPOSIXL_t8_pb|5.033003||Viu NPOSIXL_tb|5.035004||Viu NPOSIXL_tb_p8|5.033003||Viu NPOSIXL_tb_pb|5.033003||Viu NPOSIXU|5.017003||Viu NPOSIXU_t8|5.035004||Viu NPOSIXU_t8_p8|5.033003||Viu NPOSIXU_t8_pb|5.033003||Viu NPOSIXU_tb|5.035004||Viu NPOSIXU_tb_p8|5.033003||Viu NPOSIXU_tb_pb|5.033003||Viu NSIG|5.009003||Viu ntohi|5.003007||Viu ntohl|5.003007||Viu ntohs|5.003007||Viu nuke_stacks|5.005000||Viu Null|5.003007||Viu Nullav|5.003007|5.003007|d Nullch|5.003007|5.003007| Nullcv|5.003007|5.003007|d Nullfp|5.003007||Viu Nullgv|5.003007||Viu Nullhe|5.003007||Viu Nullhek|5.004000||Viu Nullhv|5.003007|5.003007|d Nullop|5.003007||Viu Nullsv|5.003007|5.003007| NUM2PTR|5.006000||pVu NUM_ANYOF_CODE_POINTS|5.021004||Viu NUM_CLASSES|5.029001||Viu num_overflow|5.009001||Vniu NV_BIG_ENDIAN|5.021009||Viu NV_DIG|5.006000||Viu NVef|5.006001|5.003007|poVn NV_EPSILON|5.007003||Viu NVff|5.006001|5.003007|poVn NVgf|5.006001|5.003007|poVn NV_IMPLICIT_BIT|5.021009||Viu NV_INF|5.007003||Viu NV_LITTLE_ENDIAN|5.021009||Viu NVMANTBITS|5.023000|5.023000|Vn NV_MANT_DIG|5.006001||Viu NV_MAX_10_EXP|5.007003||Viu NV_MAX|5.006001||Viu NV_MAX_EXP|5.021003||Viu NV_MIN_10_EXP|5.007003||Viu NV_MIN|5.006001||Viu NV_MIN_EXP|5.021003||Viu NV_MIX_ENDIAN|5.021009||Viu NV_NAN|5.007003||Viu NV_NAN_BITS|5.023000||Viu NV_NAN_IS_QUIET|5.023000||Viu NV_NAN_IS_SIGNALING|5.023000||Viu NV_NAN_PAYLOAD_MASK|5.023000||Viu NV_NAN_PAYLOAD_MASK_IEEE_754_128_BE|5.023000||Viu NV_NAN_PAYLOAD_MASK_IEEE_754_128_LE|5.023000||Viu NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE|5.023000||Viu NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE|5.023000||Viu NV_NAN_PAYLOAD_MASK_SKIP_EIGHT|5.023006||Viu NV_NAN_PAYLOAD_PERM_0_TO_7|5.023000||Viu NV_NAN_PAYLOAD_PERM|5.023000||Viu NV_NAN_PAYLOAD_PERM_7_TO_0|5.023000||Viu NV_NAN_PAYLOAD_PERM_IEEE_754_128_BE|5.023000||Viu NV_NAN_PAYLOAD_PERM_IEEE_754_128_LE|5.023000||Viu NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE|5.023000||Viu NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE|5.023000||Viu NV_NAN_PAYLOAD_PERM_SKIP_EIGHT|5.023006||Viu NV_NAN_QS_BIT|5.023000||Viu NV_NAN_QS_BIT_OFFSET|5.023000||Viu NV_NAN_QS_BIT_SHIFT|5.023000||Viu NV_NAN_QS_BYTE|5.023000||Viu NV_NAN_QS_BYTE_OFFSET|5.023000||Viu NV_NAN_QS_QUIET|5.023000||Viu NV_NAN_QS_SIGNALING|5.023000||Viu NV_NAN_QS_TEST|5.023000||Viu NV_NAN_QS_XOR|5.023000||Viu NV_NAN_SET_QUIET|5.023000||Viu NV_NAN_SET_SIGNALING|5.023000||Viu NV_OVERFLOWS_INTEGERS_AT|5.010001|5.010001|Vn NV_PRESERVES_UV_BITS|5.006001|5.006001|Vn NVSIZE|5.006001|5.006001|Vn NVTYPE|5.006000|5.003007|poVn NV_VAX_ENDIAN|5.025003||Viu NV_WITHIN_IV|5.006000||Viu NV_WITHIN_UV|5.006000||Viu NV_X86_80_BIT|5.025004||Viu NV_ZERO_IS_ALLBITS_ZERO|5.035009|5.035009|Vn OA_AVREF|5.003007||Viu OA_BASEOP|5.005000||Viu OA_BASEOP_OR_UNOP|5.005000||Viu OA_BINOP|5.005000||Viu OA_CLASS_MASK|5.005000||Viu OA_COP|5.005000||Viu OA_CVREF|5.003007||Viu OA_DANGEROUS|5.003007||Viu OA_DEFGV|5.003007||Viu OA_FILEREF|5.003007||Viu OA_FILESTATOP|5.005000||Viu OA_FOLDCONST|5.003007||Viu OA_HVREF|5.003007||Viu OA_LIST|5.003007||Viu OA_LISTOP|5.005000||Viu OA_LOGOP|5.005000||Viu OA_LOOP|5.005000||Viu OA_LOOPEXOP|5.005000||Viu OA_MARK|5.003007||Viu OA_METHOP|5.021005||Viu OA_OPTIONAL|5.003007||Viu OA_OTHERINT|5.003007||Viu OA_PADOP|5.006000||Viu OA_PMOP|5.005000||Viu OA_PVOP_OR_SVOP|5.006000||Viu OA_RETSCALAR|5.003007||Viu OA_SCALAR|5.003007||Viu OA_SCALARREF|5.003007||Viu OASHIFT|5.003007||Viu OA_SVOP|5.005000||Viu OA_TARGET|5.003007||Viu OA_TARGLEX|5.006000||Viu OA_UNOP|5.005000||Viu OA_UNOP_AUX|5.021007||Viu O_BINARY|5.006000||Viu O_CREAT|5.006000||Viu OCSHIFT|5.006000||Viu OCTAL_VALUE|5.019008||Viu Off_t|5.003007|5.003007|Vn Off_t_size|5.006000|5.006000|Vn OFFUNI_IS_INVARIANT|5.023003||Viu OFFUNISKIP|5.019004||Viu OFFUNISKIP_helper|5.035004||Viu ONCE_PAT_MOD|5.009005||Viu ONCE_PAT_MODS|5.009005||Viu ONE_IF_EBCDIC_ZERO_IF_NOT|5.035004||Viu oopsAV|5.003007||Viu oopsHV|5.003007||Viu OP|5.003007||Viu op_append_elem|5.013006|5.013006| op_append_list|5.013006|5.013006| opASSIGN|5.003007||Viu OP_CHECK_MUTEX_INIT|5.015008||Viu OP_CHECK_MUTEX_LOCK|5.015008||Viu OP_CHECK_MUTEX_TERM|5.015008||Viu OP_CHECK_MUTEX_UNLOCK|5.015008||Viu OP_CLASS|5.013007|5.013007| op_class|5.025010|5.025010| op_clear|5.006000||cViu OPCODE|5.003007||Viu op_contextualize|5.013006|5.013006| op_convert_list|5.021006|5.021006| OP_DESC|5.007003|5.007003| op_dump|5.006000|5.006000| OPEN|5.003007||Viu open|5.005000||Viu opendir|5.005000||Viu openn_cleanup|5.019010||Viu openn_setup|5.019010||Viu open_script|5.005000||Viu OPEN_t8|5.035004||Viu OPEN_t8_p8|5.033003||Viu OPEN_t8_pb|5.033003||Viu OPEN_tb|5.035004||Viu OPEN_tb_p8|5.033003||Viu OPEN_tb_pb|5.033003||Viu OPERAND|5.003007||Viu OPERANDl|5.031005||Viu OPERANDs|5.031005||Viu OPFAIL|5.009005||Viu OPFAIL_t8|5.035004||Viu OPFAIL_t8_p8|5.033003||Viu OPFAIL_t8_pb|5.033003||Viu OPFAIL_tb|5.035004||Viu OPFAIL_tb_p8|5.033003||Viu OPFAIL_tb_pb|5.033003||Viu OPf_FOLDED|5.021007||Viu OPf_KIDS|5.003007|5.003007| OPf_KNOW|5.003007||Viu OPf_LIST|5.003007||Viu OPf_MOD|5.003007||Viu OPf_PARENS|5.003007||Viu op_free|5.003007|5.003007| OP_FREED|5.017002||Viu OPf_REF|5.003007||Viu OPf_SPECIAL|5.003007||Viu OPf_STACKED|5.003007||Viu OPf_WANT|5.004000||Viu OPf_WANT_LIST|5.004000||Viu OPf_WANT_SCALAR|5.004000||Viu OPf_WANT_VOID|5.004000||Viu OP_GIMME|5.004000||Viu OP_GIMME_REVERSE|5.010001||Viu OpHAS_SIBLING|5.021007|5.003007|p op_integerize|5.015003||Viu OP_IS_DIRHOP|5.015003||Viu OP_IS_FILETEST|5.006001||Viu OP_IS_FILETEST_ACCESS|5.008001||Viu OP_IS_INFIX_BIT|5.021009||Viu OP_IS_NUMCOMPARE|5.015003||Viu OP_IS_SOCKET|5.006001||Viu OP_IS_STAT|5.031001||Viu OpLASTSIB_set|5.021011|5.003007|p op_linklist|5.013006|5.013006| op_lvalue|5.013007|5.013007|x op_lvalue_flags|||ciu OP_LVALUE_NO_CROAK|5.015001||Viu OpMAYBESIB_set|5.021011|5.003007|p opmethod_stash|5.021007||Viu OpMORESIB_set|5.021011|5.003007|p OP_NAME|5.007003|5.007003| op_null|5.007002|5.007002| OPpALLOW_FAKE|5.015006||Viu op_parent|5.025001|5.025001|n OPpARG1_MASK|5.021004||Viu OPpARG2_MASK|5.021004||Viu OPpARG3_MASK|5.021004||Viu OPpARG4_MASK|5.021004||Viu OPpARGELEM_AV|5.025004||Viu OPpARGELEM_HV|5.025004||Viu OPpARGELEM_MASK|5.025004||Viu OPpARGELEM_SV|5.025004||Viu OPpASSIGN_BACKWARDS|5.003007||Viu OPpASSIGN_COMMON_AGG|5.023002||Viu OPpASSIGN_COMMON_RC1|5.023002||Viu OPpASSIGN_COMMON_SCALAR|5.023002||Viu OPpASSIGN_CV_TO_GV|5.009003||Viu OPpASSIGN_TRUEBOOL|5.027003||Viu OPpAVHVSWITCH_MASK|5.025006||Viu OPpCONCAT_NESTED|5.027007||Viu OPpCONST_BARE|5.003007||Viu OPpCONST_ENTERED|5.003007||Viu OPpCONST_NOVER|5.009003||Viu OPpCONST_SHORTCIRCUIT|5.009001||Viu OPpCONST_STRICT|5.005004||Viu OPpCOREARGS_DEREF1|5.015003||Viu OPpCOREARGS_DEREF2|5.015003||Viu OPpCOREARGS_PUSHMARK|5.015003||Viu OPpCOREARGS_SCALARMOD|5.015003||Viu OPpDEFER_FINALLY|5.035008||Viu OPpDEREF|5.004000||Viu OPpDEREF_AV|5.003007||Viu OPpDEREF_HV|5.003007||Viu OPpDEREF_SV|5.004000||Viu OPpDONT_INIT_GV|5.009003||Viu OPpEARLY_CV|5.006000|5.006000| OPpENTERSUB_AMPER|5.003007|5.003007| OPpENTERSUB_DB|5.003007||Viu OPpENTERSUB_HASTARG|5.006000||Viu OPpENTERSUB_INARGS|5.006000||Viu OPpENTERSUB_LVAL_MASK|5.015001||Viu OPpENTERSUB_NOPAREN|5.005004||Viu OPpEVAL_BYTES|5.015005||Viu OPpEVAL_COPHH|5.015005||Viu OPpEVAL_HAS_HH|5.009003||Viu OPpEVAL_RE_REPARSING|5.017011||Viu OPpEVAL_UNICODE|5.015005||Viu OPpEXISTS_SUB|5.006000||Viu OPpFLIP_LINENUM|5.003007||Viu OPpFT_ACCESS|5.008001||Viu OPpFT_AFTER_t|5.015008||Viu OPpFT_STACKED|5.009001||Viu OPpFT_STACKING|5.015001||Viu OPpHINT_STRICT_REFS|5.021004||Viu OPpHUSH_VMSISH|5.007003||Viu OPpINDEX_BOOLNEG|5.027003||Viu OPpITER_DEF|5.027008||Viu OPpITER_REVERSED|5.009002||Viu OPpKVSLICE|5.027001||Viu OPpLIST_GUESSED|5.003007||Viu OPpLVAL_DEFER|5.004000||Viu OPpLVAL_INTRO|5.003007||Viu OPpLVALUE|5.019006||Viu OPpLVREF_AV|5.021005||Viu OPpLVREF_CV|5.021005||Viu OPpLVREF_ELEM|5.021005||Viu OPpLVREF_HV|5.021005||Viu OPpLVREF_ITER|5.021005||Viu OPpLVREF_SV|5.021005||Viu OPpLVREF_TYPE|5.021005||Viu OPpMAYBE_LVSUB|5.007001||Viu OPpMAYBE_TRUEBOOL|5.017004||Viu OPpMAY_RETURN_CONSTANT|5.009003||Viu OPpMULTICONCAT_APPEND|5.027006||Viu OPpMULTICONCAT_FAKE|5.027006||Viu OPpMULTICONCAT_STRINGIFY|5.027006||Viu OPpMULTIDEREF_DELETE|5.021007||Viu OPpMULTIDEREF_EXISTS|5.021007||Viu OPpOFFBYONE|5.015002||Viu OPpOPEN_IN_CRLF|5.006000||Viu OPpOPEN_IN_RAW|5.006000||Viu OPpOPEN_OUT_CRLF|5.006000||Viu OPpOPEN_OUT_RAW|5.006000||Viu OPpOUR_INTRO|5.006000||Viu OPpPADHV_ISKEYS|5.027003||Viu OPpPADRANGE_COUNTMASK|5.017006||Viu OPpPADRANGE_COUNTSHIFT|5.017006||Viu OPpPAD_STATE|5.009004||Viu OPpPV_IS_UTF8|5.016000||Viu OPpREFCOUNTED|5.006000||Viu OPpREPEAT_DOLIST|5.003007||Viu op_prepend_elem|5.013006|5.013006| OPpREVERSE_INPLACE|5.011002||Viu OPpRV2HV_ISKEYS|5.027003||Viu OPpSLICE|5.004000||Viu OPpSLICEWARNING|5.019004||Viu OPpSORT_DESCEND|5.009002||Viu OPpSORT_INPLACE|5.009001||Viu OPpSORT_INTEGER|5.006000||Viu OPpSORT_NUMERIC|5.006000||Viu OPpSORT_REVERSE|5.006000||Viu OPpSPLIT_ASSIGN|5.025006||Viu OPpSPLIT_IMPLIM|5.019002||Viu OPpSPLIT_LEX|5.025006||Viu OPpSUBSTR_REPL_FIRST|5.015006||Viu OPpTARGET_MY|5.006000||Viu OPpTRANS_ALL|5.009001||Viu OPpTRANS_CAN_FORCE_UTF8|5.031006||Viu OPpTRANS_COMPLEMENT|5.003007||Viu OPpTRANS_DELETE|5.003007||Viu OPpTRANS_FROM_UTF|5.006000||Viu OPpTRANS_GROWS|5.006000||Viu OPpTRANS_IDENTICAL|5.006000||Viu OPpTRANS_SQUASH|5.003007||Viu OPpTRANS_TO_UTF|5.006000||Viu OPpTRANS_USE_SVOP|5.031006||Viu OPpTRUEBOOL|5.017004||Viu OPpUSEINT|5.035005||Viu OpREFCNT_dec|5.006000||Viu op_refcnt_dec|||xiu OpREFCNT_inc|5.006000||Viu op_refcnt_inc|||xiu OP_REFCNT_INIT|5.006000||Viu OP_REFCNT_LOCK|5.006000||Viu op_refcnt_lock|5.009002|5.009002|u OpREFCNT_set|5.006000||Viu OP_REFCNT_TERM|5.006000||Viu OP_REFCNT_UNLOCK|5.006000||Viu op_refcnt_unlock|5.009002|5.009002|u op_relocate_sv|5.021005||Viu op_scope|5.013007|5.013007|x OP_SIBLING|5.021002||Viu OpSIBLING|5.021007|5.003007|p op_sibling_splice|5.021002|5.021002|n OpSLAB|5.017002||Viu opslab_force_free|5.017002||Viu opslab_free|5.017002||Viu opslab_free_nopad|5.017002||Viu OpslabREFCNT_dec|5.017002||Viu OpslabREFCNT_dec_padok|5.017002||Viu OpSLOT|5.017002||Viu OPSLOT_HEADER|5.017002||Viu OpSLOToff|5.033001||Viu op_std_init|5.015003||Viu OPTIMIZED|5.005000||Viu OPTIMIZED_t8|5.035004||Viu OPTIMIZED_t8_p8|5.033003||Viu OPTIMIZED_t8_pb|5.033003||Viu OPTIMIZED_tb|5.035004||Viu OPTIMIZED_tb_p8|5.033003||Viu OPTIMIZED_tb_pb|5.033003||Viu optimize_op|5.027006||Viu optimize_optree|5.027006||Vi optimize_regclass|5.035001||Viu OP_TYPE_IS|5.019007|5.019007| OP_TYPE_IS_NN|5.019010||Viu OP_TYPE_ISNT|5.019010||Viu OP_TYPE_ISNT_AND_WASNT|5.019010||Viu OP_TYPE_ISNT_AND_WASNT_NN|5.019010||Viu OP_TYPE_ISNT_NN|5.019010||Viu OP_TYPE_IS_OR_WAS|5.019010|5.019010| OP_TYPE_IS_OR_WAS_NN|5.019010||Viu op_unscope|5.017003||xViu op_wrap_finally|5.035008|5.035008|x O_RDONLY|5.006000||Viu O_RDWR|5.006000||Viu ORIGMARK|5.003007|5.003007| OSNAME|5.003007|5.003007|Vn OSVERS|5.007002|5.007002|Vn O_TEXT|5.006000||Viu OutCopFILE|5.007003||Viu output_non_portable|5.031008||Viu output_posix_warnings|5.029005||Viu O_VMS_DELETEONCLOSE|5.031002||Viu O_WRONLY|5.006000||Viu package|5.003007||Viu package_version|5.011001||Viu pack_cat|5.033002|5.033002|d packlist|5.008001|5.008001| pack_rec|5.008001||Viu packWARN2|5.007003|5.003007|p packWARN3|5.007003|5.003007|p packWARN4|5.007003|5.003007|p packWARN|5.007003|5.003007|p pad_add_anon|5.015001|5.015001| pad_add_name_pv|5.015001|5.015001| pad_add_name_pvn|5.015001|5.015001| pad_add_name_pvs|5.015001|5.015001| pad_add_name_sv|5.015001|5.015001| padadd_NO_DUP_CHECK|5.011002||Viu padadd_OUR|5.011002||Viu padadd_STALEOK|5.017003||Viu padadd_STATE|5.011002||Viu pad_add_weakref|5.021007||Viu pad_alloc|5.015001|5.015001|x pad_alloc_name|5.015001||Vi PadARRAY|5.017004|5.017004|x PAD_BASE_SV|5.008001||Vi pad_block_start|5.008001||Vi pad_check_dup|5.008001||Vi PAD_CLONE_VARS|5.008001||Vi PAD_COMPNAME|5.017004||Viu PAD_COMPNAME_FLAGS|5.008001||Vi PAD_COMPNAME_FLAGS_isOUR|5.009004||Viu PAD_COMPNAME_GEN|5.008001||Vi PAD_COMPNAME_GEN_set|5.009003||Vi PAD_COMPNAME_OURSTASH|5.008001||Vi PAD_COMPNAME_PV|5.008001||Vi PAD_COMPNAME_SV|5.009005||Viu PAD_COMPNAME_TYPE|5.008001||Vi pad_compname_type|5.033005|5.033005|d PAD_FAKELEX_ANON|5.009005||Viu PAD_FAKELEX_MULTI|5.009005||Viu pad_findlex|5.005000||Vi pad_findmy_pv|5.015001|5.015001| pad_findmy_pvn|5.015001|5.015001| pad_findmy_pvs|5.015001|5.015001| pad_findmy_sv|5.015001|5.015001| pad_fixup_inner_anons|5.008001||Vi pad_free|5.003007||Vi pad_leavemy|5.003007||Vi PadlistARRAY|5.017004|5.017004|x padlist_dup|5.013002||Vi PadlistMAX|5.017004|5.017004|x PadlistNAMES|5.017004|5.017004|x PadlistNAMESARRAY|5.017004|5.017004|x PadlistNAMESMAX|5.017004|5.017004|x PadlistREFCNT|5.017004|5.017004|x padlist_store|5.017004||Viu PadMAX|5.017004|5.017004|x padname_dup|5.021007||Vi PadnameFLAGS|5.021007||Viu padname_free|||ciu PADNAME_FROM_PV|5.021007||Viu PadnameIN_SCOPE|5.031004||Vniu PadnameIsOUR|5.017004||Vi PadnameIsSTATE|5.017004||Vi PadnameIsSTATE_on|5.021007||Viu PadnameLEN|5.017004|5.017004|x PadnamelistARRAY|5.017004|5.017004|x padnamelist_dup|5.021007||Vi padnamelist_fetch|5.021007|5.021007|xn padnamelist_free|||ciu PadnamelistMAX|5.017004|5.017004|x PadnamelistMAXNAMED|5.019003||Viu PadnamelistREFCNT|5.021007|5.021007|x PadnamelistREFCNT_dec|5.021007|5.021007|x padnamelist_store|5.021007|5.021007|x PadnameLVALUE|5.021006||Viu PadnameLVALUE_on|5.021006||Viu PadnameOURSTASH|5.017004||Vi PadnameOURSTASH_set|5.021007||Viu PadnameOUTER|5.017004||Vi PadnamePROTOCV|5.021007||Viu PadnamePV|5.017004|5.017004|x PadnameREFCNT|5.021007|5.021007|x PadnameREFCNT_dec|5.021007|5.021007|x PadnameSV|5.017004|5.017004|x PADNAMEt_LVALUE|5.021007||Viu PADNAMEt_OUR|5.021007||Viu PADNAMEt_OUTER|5.021007|5.021007| PADNAMEt_STATE|5.021007||Viu PADNAMEt_TYPED|5.021007||Viu PadnameTYPE|5.017004||Vi PadnameTYPE_set|5.021007||Viu PadnameUTF8|5.017004|5.017004|x pad_new|5.015001|5.015001| padnew_CLONE|5.008001||Viu padnew_SAVE|5.008001||Viu padnew_SAVESUB|5.008001||Viu pad_peg|5.009004||Viu pad_push|5.008001||cVi pad_reset|5.003007||Vi PAD_RESTORE_LOCAL|5.008001||Vi PAD_SAVE_LOCAL|5.008001||Vi PAD_SAVE_SETNULLPAD|5.008001||Vi PAD_SET_CUR|5.008001||Vi PAD_SET_CUR_NOSAVE|5.008002||Vi pad_setsv|5.008001||cV PAD_SETSV|5.008001||Vi pad_sv|5.003007||cV PAD_SV|5.003007||Vi PAD_SVl|5.008001||Vi pad_swipe|5.003007||Vi pad_tidy|5.015001|5.015001|x panic_write2|5.008001||Viu PARENT_FAKELEX_FLAGS|5.009005||Viu PARENT_PAD_INDEX|5.009005||Viu parse_arithexpr|5.013008|5.013008|x parse_barestmt|5.013007|5.013007|x parse_block|5.013007|5.013007|x parse_body|5.006000||Viu parse_fullexpr|5.013008|5.013008|x parse_fullstmt|5.013005|5.013005|x parse_gv_stash_name|5.019004||Viu parse_ident|5.017010||Viu parse_label|5.013007|5.013007|x parse_listexpr|5.013008|5.013008|x parse_lparen_question_flags|5.017009||Viu PARSE_OPTIONAL|5.013007|5.013007| parser_dup|5.009000|5.009000|u parser_free|5.009005||Viu parser_free_nexttoke_ops|5.017006||Viu parse_stmtseq|5.013006|5.013006|x parse_subsignature|5.031003|5.031003|x parse_termexpr|5.013008|5.013008|x parse_unicode_opts|5.008001||Viu parse_uniprop_string|5.027011||Viu PATCHLEVEL|5.003007||Viu path_is_searchable|5.019001||Vniu Pause|5.003007||Viu pause|5.005000||Viu pclose|5.003007||Viu peep|5.003007||Viu pending_ident|5.017004||Viu PERL_ABS|5.008001|5.003007|p Perl_acos|5.021004|5.021004|n perl_alloc|5.003007|5.003007|n PERL_ALLOC_CHECK|5.006000||Viu perl_alloc_using|5.006000||Vnu PERL_ANY_COW|5.017007||Viu PERL_API_REVISION|5.006000||Viu PERL_API_SUBVERSION|5.006000||Viu PERL_API_VERSION|5.006000||Viu PERL_API_VERSION_STRING|5.013004||Viu PERL_ARENA_ROOTS_SIZE|5.009004||Viu PERL_ARENA_SIZE|5.009003||Viu PERL_ARGS_ASSERT_CROAK_XS_USAGE|||ponu Perl_asin|5.021004|5.021004|n Perl_assert|5.011000||Viu perl_assert_ptr|5.027004||Viu PERL_ASYNC_CHECK|5.006000|5.006000| Perl_atan2|5.006000|5.006000|n Perl_atan|5.021004|5.021004|n Perl_atof2|5.006001||Viu Perl_atof|5.006000||Viu PERL_BCDVERSION||5.003007|onu PERL_BISON_VERSION|5.023008||Viu PERL_BITFIELD16|5.010001||Viu PERL_BITFIELD32|5.010001||Viu PERL_BITFIELD8|5.010001||Viu PERL_CALLCONV|5.005002||Viu PERL_CALLCONV_NO_RET|5.017002||Viu Perl_ceil|5.009001|5.009001|n PERL_CKDEF|5.006000||Viu perl_clone|5.006000||Vn perl_clone_using|5.006000||Vnu PERL_CLZ_32|5.035003||Viu PERL_CLZ_64|5.035003||Viu perl_construct|5.003007|5.003007|n PERL_COP_SEQMAX|5.013010||Viu PERL_COPY_ON_WRITE|5.023001||Viu Perl_cos|5.006000|5.006000|n Perl_cosh|5.021004|5.021004|n PERL_COUNT_MULTIPLIER|5.027007||Viu PERL_CTZ_32|5.035003||Viu PERL_CTZ_64|5.035003||Viu Perl_custom_op_xop|5.019006||V PERLDB_ALL|5.004002||Viu PERLDBf_GOTO|5.004005||Viu PERLDBf_INTER|5.004002||Viu PERLDBf_LINE|5.004002||Viu PERLDBf_NAMEANON|5.006000||Viu PERLDBf_NAMEEVAL|5.006000||Viu PERLDBf_NONAME|5.004005||Viu PERLDBf_NOOPT|5.004002||Viu PERLDBf_SAVESRC|5.010001||Viu PERLDBf_SAVESRC_INVALID|5.010001||Viu PERLDBf_SAVESRC_NOSUBS|5.010001||Viu PERLDBf_SINGLE|5.004002||Viu PERLDBf_SUB|5.004002||Viu PERLDBf_SUBLINE|5.004002||Viu PERLDB_GOTO|5.004005||Viu PERLDB_INTER|5.004002||Viu PERLDB_LINE|5.004002||Viu PERLDB_LINE_OR_SAVESRC|5.023002||Viu PERLDB_NAMEANON|5.006000||Viu PERLDB_NAMEEVAL|5.006000||Viu PERLDB_NOOPT|5.004002||Viu PERLDB_SAVESRC|5.010001||Viu PERLDB_SAVESRC_INVALID|5.010001||Viu PERLDB_SAVESRC_NOSUBS|5.010001||Viu PERLDB_SINGLE|5.004002||Viu PERLDB_SUB|5.004002||Viu PERLDB_SUBLINE|5.004002||Viu PERLDB_SUB_NN|5.004005||Viu PERL_DEB2|5.021007||Viu PERL_DEB|5.008001||Viu PERL_deBruijnMagic32|5.035003||Viu PERL_deBruijnMagic64|5.035003||Viu PERL_deBruijnShift32|5.035003||Viu PERL_deBruijnShift64|5.035003||Viu PERL_DEBUG|5.008001||Viu Perl_debug_log|5.003007||Viu PERL_DEBUG_PAD|5.007003||Viu PERL_DEBUG_PAD_ZERO|5.007003||Viu PERL_DECIMAL_VERSION|5.019008||Viu PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION|5.009003||Viu perl_destruct|5.007003|5.007003|n PerlDir_chdir|5.005000||Viu PerlDir_close|5.005000||Viu PerlDir_mapA|5.006000||Viu PerlDir_mapW|5.006000||Viu PerlDir_mkdir|5.005000||Viu PerlDir_open|5.005000||Viu PerlDir_read|5.005000||Viu PerlDir_rewind|5.005000||Viu PerlDir_rmdir|5.005000||Viu PerlDir_seek|5.005000||Viu PerlDir_tell|5.005000||Viu PERL_DONT_CREATE_GVSV|5.009003||Viu Perl_drand48|5.019004||Viu Perl_drand48_init|5.019004||Viu PERL_DRAND48_QUAD|5.019004||Viu PERL_DTRACE_PROBE_ENTRY|5.023009||Viu PERL_DTRACE_PROBE_FILE_LOADED|5.023009||Viu PERL_DTRACE_PROBE_FILE_LOADING|5.023009||Viu PERL_DTRACE_PROBE_OP|5.023009||Viu PERL_DTRACE_PROBE_PHASE|5.023009||Viu PERL_DTRACE_PROBE_RETURN|5.023009||Viu PERL_EBCDIC_TABLES_H|5.027001||Viu PERL_ENABLE_EXPERIMENTAL_REGEX_OPTIMISATIONS|5.009004||Viu PERL_ENABLE_EXTENDED_TRIE_OPTIMISATION|5.009004||Viu PERL_ENABLE_POSITIVE_ASSERTION_STUDY|5.009005||Viu PERL_ENABLE_TRIE_OPTIMISATION|5.009004||Viu PerlEnv_clearenv|5.006000||Viu PerlEnv_ENVgetenv|5.006000||Viu PerlEnv_ENVgetenv_len|5.006000||Viu PerlEnv_free_childdir|5.006000||Viu PerlEnv_free_childenv|5.006000||Viu PerlEnv_get_childdir|5.006000||Viu PerlEnv_get_childenv|5.006000||Viu PerlEnv_get_child_IO|5.006000||Viu PerlEnv_getenv|5.005000||Viu PerlEnv_getenv_len|5.006000||Viu PerlEnv_lib_path|5.005000||Viu PerlEnv_os_id|5.006000||Viu PerlEnv_putenv|5.005000||Viu PerlEnv_sitelib_path|5.005000||Viu PerlEnv_uname|5.005004||Viu PerlEnv_vendorlib_path|5.006000||Viu Perl_error_log|5.006000||Viu Perl_eval_pv||5.003007|onu Perl_eval_sv||5.003007|onu PERL_EXIT_ABORT|5.019003|5.019003| PERL_EXIT_DESTRUCT_END|5.007003|5.007003| PERL_EXIT_EXPECTED|5.006000|5.006000| PERL_EXIT_WARN|5.019003|5.019003| Perl_exp|5.006000|5.006000|n Perl_fabs|5.035005||Viu PERL_FEATURE_H|5.029006||Viu PERL_FILE_IS_ABSOLUTE|5.006000||Viu PERL_FILTER_EXISTS|5.009005||Viu Perl_floor|5.006000|5.006000|n PERL_FLUSHALL_FOR_CHILD|5.006000||Viu Perl_fmod|5.006000|5.006000|n Perl_fp_class|5.007003||Viu Perl_fp_class_denorm|5.007003||Viu Perl_fp_class_inf|5.007003||Viu Perl_fp_class_nan|5.007003||Viu Perl_fp_class_ndenorm|5.007003||Viu Perl_fp_class_ninf|5.007003||Viu Perl_fp_class_nnorm|5.007003||Viu Perl_fp_class_norm|5.007003||Viu Perl_fp_class_nzero|5.007003||Viu Perl_fp_class_pdenorm|5.007003||Viu Perl_fp_class_pinf|5.007003||Viu Perl_fp_class_pnorm|5.007003||Viu Perl_fp_class_pzero|5.007003||Viu Perl_fp_class_qnan|5.007003||Viu Perl_fp_class_snan|5.007003||Viu Perl_fp_class_zero|5.007003||Viu PERL_FPU_INIT|5.007002||Viu PERL_FPU_POST_EXEC|5.008001||Viu PERL_FPU_PRE_EXEC|5.008001||Viu perl_free|5.003007|5.003007|n Perl_free_c_backtrace|5.021001||Viu Perl_frexp|5.006000|5.006000|n PERL_FS_VER_FMT|5.006000||Viu PERL_FS_VERSION|5.010001||Viu PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||Viu PERL_GCC_VERSION_GE|5.035003||Viu PERL_GCC_VERSION_GT|5.035003||Viu PERL_GCC_VERSION_LE|5.035003||Viu PERL_GCC_VERSION_LT|5.035003||Viu PERL_GET_CONTEXT|5.006000||Viu PERL_GET_INTERP|5.006000||Viu PERL_GET_THX|5.006000||Viu PERL_GIT_UNPUSHED_COMMITS|5.010001||Viu PERL_GPROF_MONCONTROL|5.007002||Viu PERL_HANDY_H|5.027001||Viu PERL_HAS_FAST_GET_LSB_POS32|5.035003||Viu PERL_HAS_FAST_GET_LSB_POS64|5.035003||Viu PERL_HAS_FAST_GET_MSB_POS32|5.035003||Viu PERL_HAS_FAST_GET_MSB_POS64|5.035003||Viu PERL_HASH|5.003007|5.003007|p PERL_HASH_DEFAULT_HvMAX|5.017011||Viu PERL_HASH_FUNC|5.017006||Viu PERL_HASH_FUNC_SIPHASH13|5.033007||Viu PERL_HASH_FUNC_ZAPHOD32|5.027001||Viu PERL_HASH_INTERNAL|5.008002||Viu PERL_HASH_ITER_BUCKET|5.018000||Viu PERL_HASH_RANDOMIZE_KEYS|5.018000||Viu PERL_HASH_SEED|5.008001||Viu PERL_HASH_SEED_BYTES|5.017006||Viu PERL_HASH_SEED_STATE|5.027001||Viu PERL_HASH_SEED_WORDS|5.033007||Viu PERL_HASH_STATE_BYTES|5.027001||Viu PERL_HASH_STATE_WORDS|5.033007||Viu PERL_HASH_USE_SBOX32_ALSO|5.027001||Viu PERL_HASH_WITH_SEED|5.021001||Viu PERL_HASH_WITH_STATE|5.027001||Viu PERL_HV_ARRAY_ALLOC_BYTES|5.006000||Viu PERL___I|5.009005||Viu PERL_IMPLICIT_CONTEXT|5.006000||Viu PERL_INC_VERSION_LIST|5.035009|5.035009|Vn Perl_internal_drand48|5.027004||Viu PERL_INTERPRETER_SIZE_UPTO_MEMBER|5.010000||Viu PERL_INT_MAX|5.003007|5.003007|p PERL_INT_MIN|5.003007|5.003007|p PERL_INVLIST_INLINE_H|5.029006||Viu PerlIO|5.003007||Viu PerlIO_apply_layers|5.007001|5.007001| PerlIOArg|5.007001||Viu PerlIOBase|5.007001||Viu PerlIO_binmode|5.007001|5.007001| PERLIOBUF_DEFAULT_BUFSIZ|5.013007||Viu PerlIO_canset_cnt|5.003007|5.003007|n PerlIO_clearerr|5.007003|5.007003| PerlIO_close|5.007003|5.007003| PerlIO_context_layers|||u PerlIO_debug|5.007001|5.007001| PERLIO_DUP_CLONE|5.007003||Viu PERLIO_DUP_FD|5.007003||Viu PerlIO_eof|5.007003|5.007003| PerlIO_error|5.007003|5.007003| PerlIO_exportFILE|5.003007|5.003007|n PERLIO_F_APPEND|5.007001|5.007001| PerlIO_fast_gets|5.003007|5.003007|n PERLIO_F_CANREAD|5.007001|5.007001| PERLIO_F_CANWRITE|5.007001|5.007001| PERLIO_F_CLEARED|5.013008||Viu PERLIO_F_CRLF|5.007001|5.007001| PerlIO_fdopen|5.003007|5.003007|n PERLIO_F_EOF|5.007001|5.007001| PERLIO_F_ERROR|5.007001|5.007001| PERLIO_F_FASTGETS|5.007001|5.007001| PerlIO_fileno|5.007003|5.007003| PerlIO_fill|5.007000|5.007000|u PerlIO_findFILE|5.003007|5.003007|n PERLIO_F_LINEBUF|5.007001|5.007001| PerlIO_flush|5.007003|5.007003| PERLIO_F_NOTREG|5.008001||Viu PERLIO_F_OPEN|5.007001|5.007001| PERLIO_F_RDBUF|5.007001|5.007001| PERLIO_F_TEMP|5.007001|5.007001| PERLIO_F_TRUNCATE|5.007001|5.007001| PERLIO_F_TTY|5.007001||Viu PERLIO_F_UNBUF|5.007001|5.007001| PERLIO_FUNCS_CAST|5.009003||pVu PERLIO_FUNCS_DECL|5.009003|5.009003|pVu PERLIO_F_UTF8|5.007001|5.007001| PERLIO_F_WRBUF|5.007001|5.007001| PerlIO_get_base|5.007003|5.007003| PerlIO_get_bufsiz|5.007003|5.007003| PerlIO_getc|5.003007|5.003007|n PerlIO_get_cnt|5.007003|5.007003| PerlIO_getpos|5.003007|5.003007|n PerlIO_get_ptr|5.007003|5.007003| PERLIO_H|5.027001||Viu PerlIO_has_base|5.003007|5.003007|n PerlIO_has_cntptr|5.003007|5.003007|n PerlIO_importFILE|5.003007|5.003007|n PERLIO_INIT|5.009005||Viu PERLIO_K_BUFFERED|5.007001|5.007001| PERLIO_K_CANCRLF|5.007001|5.007001| PERLIO_K_DESTRUCT|5.007001||Viu PERLIO_K_DUMMY|5.007001||Viu PERLIO_K_FASTGETS|5.007001|5.007001| PERLIO_K_MULTIARG|5.007003|5.007003| PERLIO_K_RAW|5.007001|5.007001| PERLIO_K_UTF8|5.007001||Viu PERLIO_LAYERS|5.007001||Viu PERLIOL_H|5.027001||Viu PerlIONext|5.007001||Viu PERLIO_NOT_STDIO|5.003007||Viu PerlIO_open|5.003007|5.003007|n PerlIO_printf|5.006000|5.003007| PerlIO_putc|5.003007|5.003007|n PerlIO_puts|5.003007|5.003007|n PerlIO_read|5.007003|5.007003| PerlIO_releaseFILE|5.003007|5.003007|n PerlIO_reopen|5.003007|5.003007|n PerlIO_restore_errno|5.021006||cViu PerlIO_rewind|5.003007|5.003007|n PerlIO_save_errno|5.021006||cViu PerlIO_seek|5.007003|5.007003| PerlIOSelf|5.007001||Viu PerlIO_set_cnt|5.007003|5.007003| PerlIO_setlinebuf|5.007003|5.007003| PerlIO_setpos|5.003007|5.003007|n PerlIO_set_ptrcnt|5.007003|5.007003| PerlIO_stderr|5.007003|5.007003| PerlIO_stdin|5.007003|5.007003| PerlIO_stdout|5.007003|5.007003| PerlIO_stdoutf|5.006000|5.003007| PERLIO_STDTEXT|5.007001||Viu PerlIO_tell|5.007003|5.007003| PERLIO_TERM|5.009005||Viu PerlIO_ungetc|5.003007|5.003007|n PerlIO_unread|5.007003|5.007003|u PERLIO_USING_CRLF|5.007003||Viu PerlIOValid|5.007003||Viu PerlIO_vprintf|5.003007|5.003007|n PerlIO_write|5.007003|5.007003| Perl_isfinite|5.007003|5.007003|n Perl_isfinitel|5.021004||Viu PERL_IS_GCC|5.032001||Viu Perl_isinf|5.007003|5.007003|n Perl_isnan|5.006001|5.006001|n PERL_IS_SUBWORD_ADDR|5.027007||Viu PERL_IS_UTF8_CHAR_DFA|5.035004||Viu PERL_JNP_TO_DECIMAL|5.033001||Viu Perl_langinfo|5.027004|5.027004|n PERL_LANGINFO_H|5.027004||Viu PERL_LAST_5_18_0_INTERP_MEMBER|5.017009||Viu Perl_ldexp|5.021003|5.021003|n PerlLIO_access|5.005000||Viu PerlLIO_chmod|5.005000||Viu PerlLIO_chown|5.005000||Viu PerlLIO_chsize|5.005000||Viu PerlLIO_close|5.005000||Viu PerlLIO_dup2|5.005000||Viu PerlLIO_dup2_cloexec|5.027008||Viu PerlLIO_dup|5.005000||Viu PerlLIO_dup_cloexec|5.027008||Viu PerlLIO_flock|5.005000||Viu PerlLIO_fstat|5.005000||Viu PerlLIO_ioctl|5.005000||Viu PerlLIO_isatty|5.005000||Viu PerlLIO_link|5.006000||Viu PerlLIO_lseek|5.005000||Viu PerlLIO_lstat|5.005000||Viu PerlLIO_mktemp|5.005000||Viu PerlLIO_open3|5.005000||Viu PerlLIO_open3_cloexec|5.027008||Viu PerlLIO_open|5.005000||Viu PerlLIO_open_cloexec|5.027008||Viu PerlLIO_read|5.005000||Viu PerlLIO_readlink|5.033005||Viu PerlLIO_rename|5.005000||Viu PerlLIO_setmode|5.005000||Viu PerlLIO_stat|5.005000||Viu PerlLIO_symlink|5.033005||Viu PerlLIO_tmpnam|5.005000||Viu PerlLIO_umask|5.005000||Viu PerlLIO_unlink|5.005000||Viu PerlLIO_utime|5.005000||Viu PerlLIO_write|5.005000||Viu PERL_LOADMOD_DENY|5.006000|5.003007| PERL_LOADMOD_IMPORT_OPS|5.006000|5.003007| PERL_LOADMOD_NOIMPORT|5.006000|5.003007| Perl_log10|5.021004|5.021004|n Perl_log|5.006000|5.006000|n PERL_LONG_MAX|5.003007|5.003007|p PERL_LONG_MIN|5.003007|5.003007|p PERL_MAGIC_arylen|5.007002|5.003007|p PERL_MAGIC_arylen_p|5.009003|5.009003| PERL_MAGIC_backref|5.007002|5.003007|p PERL_MAGIC_bm|5.007002|5.003007|p PERL_MAGIC_checkcall|5.013006|5.013006| PERL_MAGIC_collxfrm|5.007002|5.003007|p PERL_MAGIC_dbfile|5.007002|5.003007|p PERL_MAGIC_dbline|5.007002|5.003007|p PERL_MAGIC_debugvar|5.021005|5.021005| PERL_MAGIC_defelem|5.007002|5.003007|p PERL_MAGIC_env|5.007002|5.003007|p PERL_MAGIC_envelem|5.007002|5.003007|p PERL_MAGIC_ext|5.007002|5.003007|p PERL_MAGIC_fm|5.007002|5.003007|p PERL_MAGIC_glob||5.003007|ponu PERL_MAGIC_hints|5.009004|5.009004| PERL_MAGIC_hintselem|5.009004|5.009004| PERL_MAGIC_isa|5.007002|5.003007|p PERL_MAGIC_isaelem|5.007002|5.003007|p PERL_MAGIC_lvref|5.021005|5.021005| PERL_MAGIC_mutex||5.003007|ponu PERL_MAGIC_nkeys|5.007002|5.003007|p PERL_MAGIC_nonelem|5.027009|5.027009| PERL_MAGIC_overload||5.003007|ponu PERL_MAGIC_overload_elem||5.003007|ponu PERL_MAGIC_overload_table|5.007002|5.003007|p PERL_MAGIC_pos|5.007002|5.003007|p PERL_MAGIC_qr|5.007002|5.003007|p PERL_MAGIC_READONLY_ACCEPTABLE|5.015000||Viu PERL_MAGIC_regdata|5.007002|5.003007|p PERL_MAGIC_regdatum|5.007002|5.003007|p PERL_MAGIC_regex_global|5.007002|5.003007|p PERL_MAGIC_rhash|5.009003|5.009003| PERL_MAGIC_shared|5.007003|5.003007|p PERL_MAGIC_shared_scalar|5.007003|5.003007|p PERL_MAGIC_sig|5.007002|5.003007|p PERL_MAGIC_sigelem|5.007002|5.003007|p PERL_MAGIC_substr|5.007002|5.003007|p PERL_MAGIC_sv|5.007002|5.003007|p PERL_MAGIC_symtab|5.009003|5.009003| PERL_MAGIC_taint|5.007002|5.003007|p PERL_MAGIC_tied|5.007002|5.003007|p PERL_MAGIC_tiedelem|5.007002|5.003007|p PERL_MAGIC_tiedscalar|5.007002|5.003007|p PERL_MAGIC_TYPE_IS_VALUE_MAGIC|5.015000||Viu PERL_MAGIC_TYPE_READONLY_ACCEPTABLE|5.015000||Viu PERL_MAGIC_utf8|5.008001|5.003007|p PERL_MAGIC_UTF8_CACHESIZE|5.008001||Viu PERL_MAGIC_uvar|5.007002|5.003007|p PERL_MAGIC_uvar_elem|5.007003|5.003007|p PERL_MAGIC_VALUE_MAGIC|5.015000||Viu PERL_MAGIC_vec|5.007002|5.003007|p PERL_MAGIC_vstring|5.008001|5.003007|p PERL_MAGIC_VTABLE_MASK|5.015000||Viu PERL_MALLOC_CTL_H|5.027001||Viu Perl_malloc_good_size|5.010001||Viu PERL_MALLOC_WRAP|5.009002|5.009002|Vn PerlMem_calloc|5.006000||Viu PerlMem_free|5.005000||Viu PerlMem_free_lock|5.006000||Viu PerlMem_get_lock|5.006000||Viu PerlMem_is_locked|5.006000||Viu PerlMem_malloc|5.005000||Viu PERL_MEMORY_DEBUG_HEADER_SIZE|5.019009||Viu PerlMemParse_calloc|5.006000||Viu PerlMemParse_free|5.006000||Viu PerlMemParse_free_lock|5.006000||Viu PerlMemParse_get_lock|5.006000||Viu PerlMemParse_is_locked|5.006000||Viu PerlMemParse_malloc|5.006000||Viu PerlMemParse_realloc|5.006000||Viu PerlMem_realloc|5.005000||Viu PerlMemShared_calloc|5.006000||Viu PerlMemShared_free|5.006000||Viu PerlMemShared_free_lock|5.006000||Viu PerlMemShared_get_lock|5.006000||Viu PerlMemShared_is_locked|5.006000||Viu PerlMemShared_malloc|5.006000||Viu PerlMemShared_realloc|5.006000||Viu PERL_MG_UFUNC|5.007001||Viu Perl_modf|5.006000|5.006000|n PERL_MULTICONCAT_HEADER_SIZE|5.027006||Viu PERL_MULTICONCAT_IX_LENGTHS|5.027006||Viu PERL_MULTICONCAT_IX_NARGS|5.027006||Viu PERL_MULTICONCAT_IX_PLAIN_LEN|5.027006||Viu PERL_MULTICONCAT_IX_PLAIN_PV|5.027006||Viu PERL_MULTICONCAT_IX_UTF8_LEN|5.027006||Viu PERL_MULTICONCAT_IX_UTF8_PV|5.027006||Viu PERL_MULTICONCAT_MAXARG|5.027006||Viu Perl_my_mkostemp|5.027008||Viu Perl_my_mkstemp|5.027004||Viu PERL_MY_SNPRINTF_GUARDED|5.009004||Viu PERL_MY_SNPRINTF_POST_GUARD|5.021002||Viu PERL_MY_VSNPRINTF_GUARDED|5.009004||Viu PERL_MY_VSNPRINTF_POST_GUARD|5.021002||Viu PERL_NO_DEV_RANDOM|5.009004||Viu PERL_NON_CORE_CHECK_EMPTY|5.035004||Viu PERL_OBJECT_THIS|5.005000||Viu PERL_OP_PARENT|5.025001||Viu PERL_PADNAME_MINIMAL|5.021007||Viu PERL_PADSEQ_INTRO|5.013010||Viu perl_parse|5.006000|5.006000|n PERL_PATCHLEVEL_H_IMPLICIT|5.006000||Viu PERL_PATCHNUM|5.010001||Viu PERL_POISON_EXPR|5.019006||Viu Perl_pow|5.006000|5.006000|n Perl_pp_accept|5.013009||Viu Perl_pp_aelemfast_lex|5.015000||Viu Perl_pp_andassign|5.013009||Viu Perl_pp_avalues|5.013009||Viu Perl_pp_bind|5.013009||Viu Perl_pp_bit_xor|5.013009||Viu Perl_pp_chmod|5.013009||Viu Perl_pp_chomp|5.013009||Viu Perl_pp_connect|5.013009||Viu Perl_pp_cos|5.013009||Viu Perl_pp_custom|5.013009||Viu Perl_pp_dbmclose|5.013009||Viu PERL_PPDEF|5.006000||Viu Perl_pp_dofile|5.013009||Viu Perl_pp_dor|5.013009||Viu Perl_pp_dorassign|5.013009||Viu Perl_pp_dump|5.013009||Viu Perl_pp_egrent|5.013009||Viu Perl_pp_enetent|5.013009||Viu Perl_pp_eprotoent|5.013009||Viu Perl_pp_epwent|5.013009||Viu Perl_pp_eservent|5.013009||Viu Perl_pp_exp|5.013009||Viu Perl_pp_fcntl|5.013009||Viu Perl_pp_ftatime|5.013009||Viu Perl_pp_ftbinary|5.013009||Viu Perl_pp_ftblk|5.013009||Viu Perl_pp_ftchr|5.013009||Viu Perl_pp_ftctime|5.013009||Viu Perl_pp_ftdir|5.013009||Viu Perl_pp_fteexec|5.013009||Viu Perl_pp_fteowned|5.013009||Viu Perl_pp_fteread|5.013009||Viu Perl_pp_ftewrite|5.013009||Viu Perl_pp_ftfile|5.013009||Viu Perl_pp_ftmtime|5.013009||Viu Perl_pp_ftpipe|5.013009||Viu Perl_pp_ftrexec|5.013009||Viu Perl_pp_ftrwrite|5.013009||Viu Perl_pp_ftsgid|5.013009||Viu Perl_pp_ftsize|5.013009||Viu Perl_pp_ftsock|5.013009||Viu Perl_pp_ftsuid|5.013009||Viu Perl_pp_ftsvtx|5.013009||Viu Perl_pp_ftzero|5.013009||Viu Perl_pp_getpeername|5.013009||Viu Perl_pp_getsockname|5.013009||Viu Perl_pp_ggrgid|5.013009||Viu Perl_pp_ggrnam|5.013009||Viu Perl_pp_ghbyaddr|5.013009||Viu Perl_pp_ghbyname|5.013009||Viu Perl_pp_gnbyaddr|5.013009||Viu Perl_pp_gnbyname|5.013009||Viu Perl_pp_gpbyname|5.013009||Viu Perl_pp_gpbynumber|5.013009||Viu Perl_pp_gpwnam|5.013009||Viu Perl_pp_gpwuid|5.013009||Viu Perl_pp_gsbyname|5.013009||Viu Perl_pp_gsbyport|5.013009||Viu Perl_pp_gsockopt|5.013009||Viu Perl_pp_hex|5.013009||Viu Perl_pp_i_postdec|5.006000||Viu Perl_pp_i_postinc|5.006000||Viu Perl_pp_i_predec|5.006000||Viu Perl_pp_i_preinc|5.006000||Viu Perl_pp_keys|5.013009||Viu Perl_pp_kill|5.013009||Viu Perl_pp_lcfirst|5.013009||Viu Perl_pp_lineseq|5.013009||Viu Perl_pp_listen|5.013009||Viu Perl_pp_localtime|5.013009||Viu Perl_pp_log|5.013009||Viu Perl_pp_lstat|5.013009||Viu Perl_pp_mapstart|5.013009||Viu Perl_pp_msgctl|5.013009||Viu Perl_pp_msgget|5.013009||Viu Perl_pp_msgrcv|5.013009||Viu Perl_pp_msgsnd|5.013009||Viu Perl_pp_nbit_xor|5.021009||Viu Perl_pp_orassign|5.013009||Viu Perl_pp_padany|5.013009||Viu Perl_pp_pop|5.013009||Viu Perl_pp_read|5.013009||Viu Perl_pp_recv|5.013009||Viu Perl_pp_regcmaybe|5.013009||Viu Perl_pp_rindex|5.013009||Viu Perl_pp_rv2hv|5.013009||Viu Perl_pp_say|5.013009||Viu Perl_pp_sbit_xor|5.021009||Viu Perl_pp_scalar|5.013009||Viu Perl_pp_schomp|5.013009||Viu Perl_pp_scope|5.013009||Viu Perl_pp_seek|5.013009||Viu Perl_pp_semop|5.013009||Viu Perl_pp_send|5.013009||Viu Perl_pp_sge|5.013009||Viu Perl_pp_sgrent|5.013009||Viu Perl_pp_sgt|5.013009||Viu Perl_pp_shmctl|5.013009||Viu Perl_pp_shmget|5.013009||Viu Perl_pp_shmread|5.013009||Viu Perl_pp_shutdown|5.013009||Viu Perl_pp_slt|5.013009||Viu Perl_pp_snetent|5.013009||Viu Perl_pp_socket|5.013009||Viu Perl_pp_sprotoent|5.013009||Viu Perl_pp_spwent|5.013009||Viu Perl_pp_sqrt|5.013009||Viu Perl_pp_sservent|5.013009||Viu Perl_pp_ssockopt|5.013009||Viu Perl_pp_symlink|5.013009||Viu Perl_pp_transr|5.013009||Viu Perl_pp_unlink|5.013009||Viu Perl_pp_utime|5.013009||Viu Perl_pp_values|5.013009||Viu PERL_PRESERVE_IVUV|5.007001||Viu PERL_PRIeldbl|5.006001|5.006001|Vn PERL_PRIfldbl|5.006000|5.006000|Vn PERL_PRIgldbl|5.006000|5.006000|Vn PerlProc_abort|5.005000||Viu PerlProc_crypt|5.005000||Viu PerlProc_DynaLoad|5.006000||Viu PerlProc_execl|5.005000||Viu PerlProc_execv|5.005000||Viu PerlProc_execvp|5.005000||Viu PerlProc__exit|5.005000||Viu PerlProc_exit|5.005000||Viu PerlProc_fork|5.006000||Viu PerlProc_getegid|5.005000||Viu PerlProc_geteuid|5.005000||Viu PerlProc_getgid|5.005000||Viu PerlProc_getlogin|5.005000||Viu PerlProc_GetOSError|5.006000||Viu PerlProc_getpid|5.006000||Viu PerlProc_gettimeofday|5.008000||Viu PerlProc_getuid|5.005000||Viu PerlProc_kill|5.005000||Viu PerlProc_killpg|5.005000||Viu PerlProc_lasthost|5.007001||Viu PerlProc_longjmp|5.005000||Viu PerlProc_pause|5.005000||Viu PerlProc_pclose|5.005000||Viu PerlProc_pipe|5.005000||Viu PerlProc_pipe_cloexec|5.027008||Viu PerlProc_popen|5.005000||Viu PerlProc_popen_list|5.007001||Viu PerlProc_setgid|5.005000||Viu PerlProc_setjmp|5.005000||Viu PerlProc_setuid|5.005000||Viu PerlProc_signal|5.005000||Viu PerlProc_sleep|5.005000||Viu PerlProc_spawnvp|5.008000||Viu PerlProc_times|5.005000||Viu PerlProc_wait|5.005000||Viu PerlProc_waitpid|5.005000||Viu perl_pthread_mutex_lock|5.023006||Viu perl_pthread_mutex_unlock|5.023006||Viu PERL_PV_ESCAPE_ALL|5.009004|5.003007|p PERL_PV_ESCAPE_DWIM|5.019008||Viu PERL_PV_ESCAPE_DWIM_ALL_HEX|||Viu PERL_PV_ESCAPE_FIRSTCHAR|5.009004|5.003007|p PERL_PV_ESCAPE_NOBACKSLASH|5.009004|5.003007|p PERL_PV_ESCAPE_NOCLEAR|5.009004|5.003007|p PERL_PV_ESCAPE_NONASCII|5.013009|5.013009| PERL_PV_ESCAPE_QUOTE|5.009004|5.003007|p PERL_PV_ESCAPE_RE|5.009005|5.003007|p PERL_PV_ESCAPE_UNI|5.009004|5.003007|p PERL_PV_ESCAPE_UNI_DETECT|5.009004|5.003007|p PERL_PV_PRETTY_DUMP|5.009004||pcV PERL_PV_PRETTY_ELLIPSES|5.010000|5.003007|p PERL_PV_PRETTY_EXACTSIZE|5.021005||Viu PERL_PV_PRETTY_LTGT|5.009004|5.003007|p PERL_PV_PRETTY_NOCLEAR|5.010000||pcV PERL_PV_PRETTY_QUOTE|5.009004|5.003007|p PERL_PV_PRETTY_REGPROP|5.009004||pcV PERL_QUAD_MAX|5.003007|5.003007|p PERL_QUAD_MIN|5.003007|5.003007|p PERL_READ_LOCK|5.033005||Viu PERL_READ_UNLOCK|5.033005||Viu PERL_REENTR_API|5.009005||Viu PERL_REENTR_H|5.027001||Viu PERL_REENTR_USING_ASCTIME_R|5.031011||Viu PERL_REENTR_USING_CRYPT_R|5.031011||Viu PERL_REENTR_USING_CTERMID_R|5.031011||Viu PERL_REENTR_USING_CTIME_R|5.031011||Viu PERL_REENTR_USING_ENDGRENT_R|5.031011||Viu PERL_REENTR_USING_ENDHOSTENT_R|5.031011||Viu PERL_REENTR_USING_ENDNETENT_R|5.031011||Viu PERL_REENTR_USING_ENDPROTOENT_R|5.031011||Viu PERL_REENTR_USING_ENDPWENT_R|5.031011||Viu PERL_REENTR_USING_ENDSERVENT_R|5.031011||Viu PERL_REENTR_USING_GETGRENT_R|5.031011||Viu PERL_REENTR_USING_GETGRGID_R|5.031011||Viu PERL_REENTR_USING_GETGRNAM_R|5.031011||Viu PERL_REENTR_USING_GETHOSTBYADDR_R|5.031011||Viu PERL_REENTR_USING_GETHOSTBYNAME_R|5.031011||Viu PERL_REENTR_USING_GETHOSTENT_R|5.031011||Viu PERL_REENTR_USING_GETLOGIN_R|5.031011||Viu PERL_REENTR_USING_GETNETBYADDR_R|5.031011||Viu PERL_REENTR_USING_GETNETBYNAME_R|5.031011||Viu PERL_REENTR_USING_GETNETENT_R|5.031011||Viu PERL_REENTR_USING_GETPROTOBYNAME_R|5.031011||Viu PERL_REENTR_USING_GETPROTOBYNUMBER_R|5.031011||Viu PERL_REENTR_USING_GETPROTOENT_R|5.031011||Viu PERL_REENTR_USING_GETPWENT_R|5.031011||Viu PERL_REENTR_USING_GETPWNAM_R|5.031011||Viu PERL_REENTR_USING_GETPWUID_R|5.031011||Viu PERL_REENTR_USING_GETSERVBYNAME_R|5.031011||Viu PERL_REENTR_USING_GETSERVBYPORT_R|5.031011||Viu PERL_REENTR_USING_GETSERVENT_R|5.031011||Viu PERL_REENTR_USING_GETSPNAM_R|5.031011||Viu PERL_REENTR_USING_GMTIME_R|5.031011||Viu PERL_REENTR_USING_LOCALTIME_R|5.031011||Viu PERL_REENTR_USING_READDIR64_R|5.031011||Viu PERL_REENTR_USING_READDIR_R|5.031011||Viu PERL_REENTR_USING_SETGRENT_R|5.031011||Viu PERL_REENTR_USING_SETHOSTENT_R|5.031011||Viu PERL_REENTR_USING_SETLOCALE_R|5.031011||Viu PERL_REENTR_USING_SETNETENT_R|5.031011||Viu PERL_REENTR_USING_SETPROTOENT_R|5.031011||Viu PERL_REENTR_USING_SETPWENT_R|5.031011||Viu PERL_REENTR_USING_SETSERVENT_R|5.031011||Viu PERL_REENTR_USING_STRERROR_R|5.031011||Viu PERL_REENTR_USING_TMPNAM_R|5.031011||Viu PERL_REENTR_USING_TTYNAME_R|5.031011||Viu PERL_REGCHARCLASS_H|5.027001||Viu PERL_REGCOMP_H|5.029006||Viu PERL_REGMATCH_SLAB_SLOTS|5.009004||Viu PERL_RELOCATABLE_INC|5.017002|5.017002|Vn PERL_REVISION|5.006000|5.006000|d perl_run|5.003007|5.003007|n PERL_RW_MUTEX_DESTROY|5.033005||Viu PERL_RW_MUTEX_INIT|5.033005||Viu Perl_safesysmalloc_size|5.010001||Viu PERL_SAWAMPERSAND|5.017010||Viu PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES|5.031009||Viu PERL_SCAN_ALLOW_UNDERSCORES|5.007003|5.003007|p PERL_SCAN_DISALLOW_PREFIX|5.007003|5.003007|p PERL_SCAN_GREATER_THAN_UV_MAX|5.007003|5.003007|p PERL_SCAN_NOTIFY_ILLDIGIT|5.031008||Viu PERL_SCAN_SILENT_ILLDIGIT|5.008001|5.003007|p PERL_SCAN_SILENT_NON_PORTABLE|5.015001||Viu PERL_SCAN_SILENT_OVERFLOW|5.031009||Viu PERL_SCAN_TRAILING|5.021002|5.021002| PERL_SCNfldbl|5.006001|5.006001|Vn PERL_SCRIPT_MODE|5.004005||Viu PERL_SEEN_HV_FUNC_H|5.017010||Viu PERL_SEEN_HV_MACRO_H|5.027001||Viu PERL_SET_CONTEXT|5.006000||Viu PERL_SET_INTERP|5.006000||Viu Perl_setlocale|5.027002|5.027002|n PERL_SET_PHASE|5.015001||Viu PERL_SET_THX|5.006000||Viu Perl_sharepvn|5.006000||Viu PERL_SHORT_MAX|5.003007|5.003007|p PERL_SHORT_MIN|5.003007|5.003007|p PERLSI_DESTROY|5.005000||Viu PERLSI_DIEHOOK|5.005000||Viu PERL_SIGNALS_UNSAFE_FLAG|5.008001|5.003007|p Perl_signbit|5.009005|5.009005|xn PERLSI_MAGIC|5.005000||Viu PERLSI_MAIN|5.005000||Viu PERLSI_MULTICALL|5.023000||Viu Perl_sin|5.006000|5.006000|n Perl_sinh|5.021004|5.021004|n PerlSIO_canset_cnt|5.007001||Viu PerlSIO_clearerr|5.007001||Viu PerlSIO_fast_gets|5.007001||Viu PerlSIO_fclose|5.007001||Viu PerlSIO_fdopen|5.007001||Viu PerlSIO_fdupopen|5.007001||Viu PerlSIO_feof|5.007001||Viu PerlSIO_ferror|5.007001||Viu PerlSIO_fflush|5.007001||Viu PerlSIO_fgetc|5.007001||Viu PerlSIO_fgetpos|5.007001||Viu PerlSIO_fgets|5.007001||Viu PerlSIO_fileno|5.007001||Viu PerlSIO_fopen|5.007001||Viu PerlSIO_fputc|5.007001||Viu PerlSIO_fputs|5.007001||Viu PerlSIO_fread|5.007001||Viu PerlSIO_freopen|5.007001||Viu PerlSIO_fseek|5.007001||Viu PerlSIO_fsetpos|5.007001||Viu PerlSIO_ftell|5.007001||Viu PerlSIO_fwrite|5.007001||Viu PerlSIO_get_base|5.007001||Viu PerlSIO_get_bufsiz|5.007001||Viu PerlSIO_get_cnt|5.007001||Viu PerlSIO_get_ptr|5.007001||Viu PerlSIO_has_base|5.007001||Viu PerlSIO_has_cntptr|5.007001||Viu PerlSIO_init|5.007001||Viu PerlSIO_printf|5.007001||Viu PerlSIO_rewind|5.007001||Viu PerlSIO_setbuf|5.007001||Viu PerlSIO_set_cnt|5.007001||Viu PerlSIO_setlinebuf|5.007001||Viu PerlSIO_set_ptr|5.007001||Viu PerlSIO_setvbuf|5.007001||Viu PerlSIO_stderr|5.007001||Viu PerlSIO_stdin|5.007001||Viu PerlSIO_stdout|5.007001||Viu PerlSIO_stdoutf|5.007001||Viu PerlSIO_tmpfile|5.007001||Viu PerlSIO_ungetc|5.007001||Viu PERLSI_OVERLOAD|5.005000||Viu PerlSIO_vprintf|5.007001||Viu PERL_SIPHASH_FNC|5.025008||Viu PERLSI_REGCOMP|5.031011||Viu PERLSI_REQUIRE|5.005000||Viu PERLSI_SIGNAL|5.005000||Viu PERLSI_SORT|5.005000||Viu PERLSI_UNDEF|5.005000||Viu PERLSI_UNKNOWN|5.005000||Viu PERLSI_WARNHOOK|5.005000||Viu PERL_SNPRINTF_CHECK|5.021002||Viu PerlSock_accept|5.005000||Viu PerlSock_accept_cloexec|5.027008||Viu PerlSock_bind|5.005000||Viu PerlSock_closesocket|5.006000||Viu PerlSock_connect|5.005000||Viu PerlSock_endhostent|5.005000||Viu PerlSock_endnetent|5.005000||Viu PerlSock_endprotoent|5.005000||Viu PerlSock_endservent|5.005000||Viu PerlSock_gethostbyaddr|5.005000||Viu PerlSock_gethostbyname|5.005000||Viu PerlSock_gethostent|5.005000||Viu PerlSock_gethostname|5.005000||Viu PerlSock_getnetbyaddr|5.005000||Viu PerlSock_getnetbyname|5.005000||Viu PerlSock_getnetent|5.005000||Viu PerlSock_getpeername|5.005000||Viu PerlSock_getprotobyname|5.005000||Viu PerlSock_getprotobynumber|5.005000||Viu PerlSock_getprotoent|5.005000||Viu PerlSock_getservbyname|5.005000||Viu PerlSock_getservbyport|5.005000||Viu PerlSock_getservent|5.005000||Viu PerlSock_getsockname|5.005000||Viu PerlSock_getsockopt|5.005000||Viu PerlSock_htonl|5.005000||Viu PerlSock_htons|5.005000||Viu PerlSock_inet_addr|5.005000||Viu PerlSock_inet_ntoa|5.005000||Viu PerlSock_listen|5.005000||Viu PerlSock_ntohl|5.005000||Viu PerlSock_ntohs|5.005000||Viu PerlSock_recv|5.005000||Viu PerlSock_recvfrom|5.005000||Viu PerlSock_select|5.005000||Viu PerlSock_send|5.005000||Viu PerlSock_sendto|5.005000||Viu PerlSock_sethostent|5.005000||Viu PerlSock_setnetent|5.005000||Viu PerlSock_setprotoent|5.005000||Viu PerlSock_setservent|5.005000||Viu PerlSock_setsockopt|5.005000||Viu PerlSock_shutdown|5.005000||Viu PERL_SOCKS_NEED_PROTOTYPES|5.007001||Viu PerlSock_socket|5.005000||Viu PerlSock_socket_cloexec|5.027008||Viu PerlSock_socketpair|5.005000||Viu PerlSock_socketpair_cloexec|5.027008||Viu Perl_sqrt|5.006000|5.006000|n PERL_STACK_OFFSET_DEFINED|||piu PERL_STACK_OVERFLOW_CHECK|5.006000||Viu PERL_STATIC_FORCE_INLINE|5.031011||Viu PERL_STATIC_FORCE_INLINE_NO_RET|5.031011||Viu PERL_STATIC_INLINE|5.013004|5.013004|poVn PERL_STATIC_INLINE_NO_RET|5.017005||Viu PERL_STATIC_NO_RET|5.017005||Viu PERL_STRLEN_EXPAND_SHIFT|5.013004||Viu PERL_STRLEN_ROUNDUP|5.009003||Viu PERL_STRLEN_ROUNDUP_QUANTUM|5.009003||Viu Perl_strtod|5.021004||Viu PERL_SUB_DEPTH_WARN|5.010001||Viu PERL_SUBVERSION|5.006000|5.003007|d PERL_SYS_FPU_INIT|5.021005||Viu PERL_SYS_INIT3|5.006000|5.006000| PERL_SYS_INIT3_BODY|5.010000||Viu PERL_SYS_INIT|5.003007|5.003007| PERL_SYS_INIT_BODY|5.010000||Viu PERL_SYS_TERM|5.003007|5.003007| PERL_SYS_TERM_BODY|5.010000||Viu Perl_tan|5.021004|5.021004|n Perl_tanh|5.021004|5.021004|n PERL_TARGETARCH|5.007002|5.007002|Vn PERL_THREAD_LOCAL|5.035004|5.035004|Vn PERL_TIME64_CONFIG_H|5.027001||Viu PERL_TIME64_H|5.027001||Viu PERL_TRACK_MEMPOOL|5.009003||Viu PERL_TSA|5.023006||Viu PERL_TSA_ACQUIRE|5.023006||Viu PERL_TSA_ACTIVE|5.023006||Viu PERL_TSA_CAPABILITY|5.023006||Viu PERL_TSA_EXCLUDES|5.023006||Viu PERL_TSA_GUARDED_BY|5.023006||Viu PERL_TSA_NO_TSA|5.023006||Viu PERL_TSA_PT_GUARDED_BY|5.023006||Viu PERL_TSA_RELEASE|5.023006||Viu PERL_TSA_REQUIRES|5.023006||Viu PERL_UCHAR_MAX|5.003007|5.003007|p PERL_UCHAR_MIN|5.003007|5.003007|p PERL_UINT_MAX|5.003007|5.003007|p PERL_UINT_MIN|5.003007|5.003007|p PERL_ULONG_MAX|5.003007|5.003007|p PERL_ULONG_MIN|5.003007|5.003007|p PERL_UNICODE_ALL_FLAGS|5.008001||Viu PERL_UNICODE_ARGV|5.008001||Viu PERL_UNICODE_ARGV_FLAG|5.008001||Viu PERL_UNICODE_CONSTANTS_H|5.027001||Viu PERL_UNICODE_DEFAULT_FLAGS|5.008001||Viu PERL_UNICODE_IN|5.008001||Viu PERL_UNICODE_IN_FLAG|5.008001||Viu PERL_UNICODE_INOUT|5.008001||Viu PERL_UNICODE_INOUT_FLAG|5.008001||Viu PERL_UNICODE_LOCALE|5.008001||Viu PERL_UNICODE_LOCALE_FLAG|5.008001||Viu PERL_UNICODE_MAX|5.007003||Viu PERL_UNICODE_OUT|5.008001||Viu PERL_UNICODE_OUT_FLAG|5.008001||Viu PERL_UNICODE_STD|5.008001||Viu PERL_UNICODE_STDERR|5.008001||Viu PERL_UNICODE_STDERR_FLAG|5.008001||Viu PERL_UNICODE_STD_FLAG|5.008001||Viu PERL_UNICODE_STDIN|5.008001||Viu PERL_UNICODE_STDIN_FLAG|5.008001||Viu PERL_UNICODE_STDOUT|5.008001||Viu PERL_UNICODE_STDOUT_FLAG|5.008001||Viu PERL_UNICODE_UTF8CACHEASSERT|5.009004||Viu PERL_UNICODE_UTF8CACHEASSERT_FLAG|5.009004||Viu PERL_UNICODE_WIDESYSCALLS|5.008001||Viu PERL_UNICODE_WIDESYSCALLS_FLAG|5.008001||Viu PERL_UNLOCK_HOOK|5.009004||Viu PERL_UNUSED_ARG|5.009003|5.003007|p PERL_UNUSED_CONTEXT|5.009004|5.003007|p PERL_UNUSED_DECL|5.007002|5.003007|p PERL_UNUSED_RESULT|5.021001|5.003007|p PERL_UNUSED_VAR|5.007002|5.003007|p PERL_UQUAD_MAX|5.003007|5.003007|p PERL_UQUAD_MIN|5.003007|5.003007|p PERL_USE_DEVEL|5.010001|5.010001|Vn PERL_USE_GCC_BRACE_GROUPS|5.009004|5.003007|pV PERL_USES_PL_PIDSTATUS|5.009003||Viu PERL_USE_THREAD_LOCAL|5.035004||Viu PERL_USHORT_MAX|5.003007|5.003007|p PERL_USHORT_MIN|5.003007|5.003007|p PERL_UTF8_H|5.027001||Viu PERL_UTIL_H|5.025012||Viu Perl_va_copy|5.007001||Viu PERLVAR|5.005000||Viu PERLVARA|5.006000||Viu PERLVARI|5.005000||Viu PERL_VARIANTS_WORD_MASK|5.027007||Viu PERLVARIC|5.005000||Viu PERL_VERSION|5.006000|5.003007|d PERL_VERSION_EQ|5.033001||p PERL_VERSION_GE|5.033001|5.003007|p PERL_VERSION_GT|5.033001|5.003007|p PERL_VERSION_LE|5.033001|5.003007|p PERL_VERSION_LT|5.033001|5.003007|p PERL_VERSION_MAJOR|5.033001||Viu PERL_VERSION_MINOR|5.033001||Viu PERL_VERSION_NE|5.033001||p PERL_VERSION_PATCH|5.033001||Viu PERL_VERSION_STRING|5.010001||Viu PERL_WAIT_FOR_CHILDREN|5.006000||Viu Perl_Warn_Bit|5.033003||Viu Perl_warner_nocontext||5.004000|ponu PERL_WARNHOOK_FATAL|5.009004||Viu Perl_Warn_Off|5.033003||Viu PERL_WORD_BOUNDARY_MASK|5.027007||Viu PERL_WORDSIZE|5.027007||Viu PERL_WRITE_LOCK|5.033005||Viu PERL_WRITE_MSG_TO_CONSOLE|5.007003||Viu PERL_WRITE_UNLOCK|5.033005||Viu PERL_XSUB_H|5.027001||Viu perly_sighandler|5.031007||cVnu phase_name|5.035007|5.035007| PHOSTNAME|5.006000|5.006000|Vn pidgone|5.003007||Viu Pid_t|5.005000|5.005000|Vn pipe|5.005000||Viu PIPE_OPEN_MODE|5.008002||Viu PIPESOCK_MODE|5.008001||Viu PL_AboveLatin1|5.015008||Viu PL_amagic_generation|5.005000||Viu PL_an|5.005000||Viu PL_argvgv|5.005000||Viu PL_argvoutgv|5.005000||Viu PL_argvout_stack|5.006000||Viu PL_Assigned_invlist|5.025009||Viu PL_basetime|5.005000||Viu PL_beginav|5.005000||Viu PL_beginav_save|5.006001||Viu PL_blockhooks|5.013003||Viu PL_body_arenas|5.009004||Viu PL_body_roots|5.009003||Viu PL_bodytarget|5.005000||Viu PL_breakable_sub_gen|5.010001||Viu PL_bufend||5.003007|ponu PL_bufptr||5.003007|ponu PL_CCC_non0_non230|5.029008||Viu PL_check|5.009003|5.006000| PL_checkav|5.006000||Viu PL_checkav_save|5.008001||Viu PL_chopset|5.005000||Viu PL_clocktick|5.008001||Viu PL_collation_ix|5.005000||Viu PL_collation_name|5.005000||Viu PL_collation_standard|5.005000||Viu PL_collxfrm_base|5.005000||Viu PL_collxfrm_mult|5.005000||Viu PL_colors|5.005000||Viu PL_colorset|5.005000||Viu PL_compcv|5.005000||Viu PL_compiling|5.005000|5.003007|poVnu PL_comppad|5.008001|5.008001|x PL_comppad_name|5.017004|5.017004|x PL_comppad_name_fill|5.005000||Viu PL_comppad_name_floor|5.005000||Viu PL_constpadix|5.021004||Viu PL_copline||5.003007|ponu PL_cop_seqmax|5.005000||Viu PL_cshlen|5.005000||Viu PL_curcop|5.004005|5.003007|p PL_curcopdb|5.005000||Viu PL_curlocales|5.027009||Viu PL_curpad|5.005000|5.005000|x PL_curpm|5.005000||Viu PL_curpm_under|5.025007||Viu PL_curstack|5.005000||Viu PL_curstackinfo|5.005000||Viu PL_curstash|5.004005|5.003007|p PL_curstname|5.005000||Viu PL_custom_op_descs|5.007003||Viu PL_custom_op_names|5.007003||Viu PL_custom_ops|5.013007||Viu PL_cv_has_eval|5.009000||Viu PL_dbargs|5.005000||Viu PL_DBcontrol|5.021005||Viu PL_DBcv|5.005000||Viu PL_DBgv|5.005000||Viu PL_DBline|5.005000||Viu PL_DBsignal|5.005000|5.003007|poVnu PL_DBsignal_iv|5.021005||Viu PL_DBsingle|5.005000||pV PL_DBsingle_iv|5.021005||Viu PL_DBsub|5.005000||pV PL_DBtrace|5.005000||pV PL_DBtrace_iv|5.021005||Viu PL_debstash|5.005000|5.003007|poVnu PL_debug|5.005000||Viu PL_debug_pad|5.007003||Viu PL_defgv|5.004005|5.003007|p PL_def_layerlist|5.007003||Viu PL_defoutgv|5.005000||Viu PL_defstash|5.005000||Viu PL_delaymagic|5.005000||Viu PL_delaymagic_egid|5.015008||Viu PL_delaymagic_euid|5.015008||Viu PL_delaymagic_gid|5.015008||Viu PL_delaymagic_uid|5.015008||Viu PL_destroyhook|5.010000||Viu PL_diehook|5.005000|5.003007|poVnu PL_Dir|5.006000||Viu PL_dirty|5.005000|5.003007|poVnu PL_doswitches|5.005000||Viu PL_dowarn|5.005000||pV PL_dumper_fd|5.009003||Viu PL_dumpindent|5.006000||Viu PL_dump_re_max_len|5.023008||Viu PL_efloatbuf|5.006000||Viu PL_efloatsize|5.006000||Viu PL_E_FORMAT_PRECISION|5.029000||Viu PL_encoding|5.007003||Viu PL_endav|5.005000||Viu PL_Env|5.006000||Viu PL_envgv|5.005000||Viu PL_errgv|5.004005|5.003007|p PL_error_count||5.003007|ponu PL_errors|5.006000||Viu PL_e_script|5.005000||Viu PL_eval_root|5.005000||Viu PL_evalseq|5.005000||Viu PL_eval_start|5.005000||Viu PL_exit_flags|5.006000|5.006000| PL_exitlist|5.005000||Viu PL_exitlistlen|5.005000||Viu PL_expect||5.003007|ponu PL_fdpid|5.005000||Viu PL_filemode|5.005000||Viu PL_firstgv|5.005000||Viu PL_forkprocess|5.005000||Viu PL_formtarget|5.005000||Viu PL_GCB_invlist|5.021009||Viu PL_generation|5.005000||Viu PL_gensym|5.005000||Viu PL_globalstash|5.005000||Viu PL_globhook|5.015005||Viu PL_hash_rand_bits|5.017010||Viu PL_HASH_RAND_BITS_ENABLED|5.018000||Viu PL_hash_rand_bits_enabled|5.018000||Viu PL_hash_seed|5.033007||Viu PL_hash_state|5.033007||Viu PL_HasMultiCharFold|5.017005||Viu PL_hexdigit||5.003007|pn PL_hintgv|5.005000||Viu PL_hints|5.005000|5.003007|poVnu PL_hv_fetch_ent_mh|5.005000||Viu PL_incgv|5.005000||Viu PL_in_clean_all|5.005000||Viu PL_in_clean_objs|5.005000||Viu PL_in_eval|5.005000||Viu PL_initav|5.005000||Viu PL_in_load_module|5.008001||Viu PL_in_my||5.003007|ponu PL_in_my_stash||5.005000|ponu PL_inplace|5.005000||Viu PL_in_some_fold|5.029007||Viu PL_internal_random_state|5.027004||Viu PL_in_utf8_COLLATE_locale|5.025002||Viu PL_in_utf8_CTYPE_locale|5.019009||Viu PL_in_utf8_turkic_locale|5.029008||Viu PL_isarev|5.009005||Viu PL_keyword_plugin|5.011002|5.011002|x PL_known_layers|5.007003||Viu PL_langinfo_buf|5.027004||Viu PL_langinfo_bufsize|5.027004||Viu PL_lastfd|5.005000||Viu PL_lastgotoprobe|5.005000||Viu PL_last_in_gv|5.005000||Vi PL_laststatval|5.005000|5.003007|poVnu PL_laststype|5.005000||Viu PL_Latin1|5.015008||Viu PL_LB_invlist|5.023007||Viu PL_lc_numeric_mutex_depth|5.027009||Viu PL_lex_state||5.003007|ponu PL_lex_stuff||5.003007|ponu PL_linestr||5.003007|ponu PL_LIO|5.006000||Viu PL_locale_utf8ness|5.027009||Viu PL_localizing|5.005000||Viu PL_localpatches|5.005000||Viu PL_lockhook|5.007003||Viu PL_main_cv|5.005000||Viu PL_main_root|5.005000||Viu PL_mainstack|5.005000||Viu PL_main_start|5.005000||Viu PL_markstack|5.005000||Viu PL_markstack_max|5.005000||Viu PL_markstack_ptr|5.005000||Viu PL_max_intro_pending|5.005000||Viu PL_maxo|5.005000||Viu PL_maxsysfd|5.005000|5.005000| PL_mbrlen_ps|5.031010||Viu PL_mbrtowc_ps|5.031010||Viu PL_Mem|5.006000||Viu PL_mem_log|5.033005||Viu PL_memory_debug_header|5.009004||Viu PL_MemParse|5.006000||Viu PL_MemShared|5.006000||Viu PL_mess_sv|5.005000|5.004000|poVnu PL_min_intro_pending|5.005000||Viu PL_minus_a|5.005000||Viu PL_minus_c|5.005000||Viu PL_minus_E|5.009003||Viu PL_minus_F|5.005000||Viu PL_minus_l|5.005000||Viu PL_minus_n|5.005000||Viu PL_minus_p|5.005000||Viu PL_modcount|5.005000||Viu PL_modglobal|5.005000|5.005000| PL_multideref_pc|5.021007||Viu PL_my_cxt_list|5.009003||Viu PL_my_cxt_size|5.009003||Viu PL_na|5.004005|5.003007|p PL_nomemok|5.005000||Viu PL_no_modify||5.003007|ponu PL_numeric_name|5.005000||Viu PL_numeric_radix_sv|5.007002||Viu PL_numeric_standard|5.005000||Viu PL_numeric_underlying|5.027006||Viu PL_numeric_underlying_is_standard|5.027009||Viu PL_ofsgv|5.011000||Vi PL_oldname|5.005000||Viu PL_op|5.005000||Viu PL_op_exec_cnt|5.019002||Viu PL_opfreehook|5.011000|5.011000| PL_op_mask|5.005000||Viu PL_origalen|5.005000||Viu PL_origargc|5.005000||Viu PL_origargv|5.005000||Viu PL_origenviron|5.005000||Viu PL_origfilename|5.005000||Viu PL_ors_sv|5.007001||Viu PL_osname|5.005000||Viu PL_padix|5.005000||Viu PL_padix_floor|5.005000||Viu PL_padlist_generation|5.021007||Viu PL_padname_const|5.021007||Viu PL_padname_undef|5.021007||Viu PL_pad_reset_pending|5.005000||Viu PL_parser|5.009005|5.003007|p PL_patchlevel|5.005000||Viu PL_peepp|5.007003|5.007003| PL_perldb|5.005000|5.003007|poVnu PL_perl_destruct_level|5.004005|5.003007|p PL_perlio|5.007003||Viu PL_phase|5.013007|5.013007| PL_pidstatus|5.005000||Viu PL_Posix_ptrs|5.029000||Viu PL_ppaddr||5.003007|ponu PL_preambleav|5.005000||Viu PL_prevailing_version|5.035009||Viu PL_Private_Use|5.029009||Viu PL_Proc|5.006000||Viu PL_profiledata|5.005000||Viu PL_psig_name|5.006000||Viu PL_psig_pend|5.007001||Viu PL_psig_ptr|5.006000||Viu PL_ptr_table|5.006000||Viu PL_random_state|5.019004||Viu PL_RANDOM_STATE_TYPE|5.019004||Viu PL_reentrant_buffer|5.007002||Viu PL_reentrant_retint|5.008001||Viu PL_reg_curpm|5.006000||Viu PL_regex_pad|5.007002||Viu PL_regex_padav|5.007002||Viu PL_registered_mros|5.010001||Viu PL_regmatch_slab|5.009004||Viu PL_regmatch_state|5.009004||Viu PL_replgv|5.005000||Viu PL_restartjmpenv|5.013001||Viu PL_restartop|5.005000|5.005000| PL_rpeepp|5.013005|5.013005| PL_rs|5.005000||Vi PL_rsfp||5.003007|ponu PL_rsfp_filters||5.003007|ponu PL_runops|5.006000|5.006000| PL_savebegin|5.007003||Viu PL_savestack|5.005000||Viu PL_savestack_ix|5.005000||Viu PL_savestack_max|5.005000||Viu PL_sawampersand|5.005000||Viu PL_SB_invlist|5.021009||Viu PL_scopestack|5.005000||Viu PL_scopestack_ix|5.005000||Viu PL_scopestack_max|5.005000||Viu PL_scopestack_name|5.011002||Viu PL_SCX_invlist|5.027008||Viu PL_secondgv|5.005000||Viu PL_setlocale_buf|5.027009||Viu PL_setlocale_bufsize|5.027009||Viu PL_sharehook|5.007003||Viu PL_sighandler1p|5.031007||Viu PL_sighandler3p|5.031007||Viu PL_sighandlerp|5.005000||Viu PL_signalhook|5.013002||Viu PL_signals|5.008001|5.003007|poVnu PL_sig_pending|5.007001||Viu PL_Sock|5.006000||Viu PL_sortcop|5.005000||Viu PL_sortstash|5.005000||Viu PL_splitstr|5.005000||Viu PL_srand_called|5.006000||Viu PL_stack_base|5.005000|5.003007|poVnu PL_stack_max|5.005000||Viu PL_stack_sp|5.005000|5.003007|poVnu PL_start_env|5.005000||Viu PL_stashcache|5.008001||Viu PL_stashpad|5.017001||Viu PL_stashpadix|5.017001||Viu PL_stashpadmax|5.017001||Viu PL_statcache|5.005000|5.003007|poVnu PL_statgv|5.005000||Viu PL_statname|5.005000||Viu PL_statusvalue|5.005000||Viu PL_statusvalue_posix|5.009003||Viu PL_statusvalue_vms|5.005000||Viu PL_stderrgv|5.006000||Viu PL_stdingv|5.005000|5.003007|poVnu PL_StdIO|5.006000||Viu PL_strtab|5.005000||Viu PL_strxfrm_is_behaved|5.025002||Viu PL_strxfrm_max_cp|5.025002||Viu PL_strxfrm_NUL_replacement|5.025008||Viu PL_sub_generation|5.005000||Viu PL_subline|5.005000||Viu PL_subname|5.005000||Viu PL_Sv|5.005000||pcV PL_sv_arenaroot|5.005000|5.003007|poVnu PL_sv_consts|5.019002||Viu PL_sv_count|5.005000||Viu PL_sv_immortals|5.027003||Viu PL_sv_no|5.004005|5.003007|p PL_sv_root|5.005000||Viu PL_sv_serial|5.010001||Viu PL_sv_undef|5.004005|5.003007|p PL_sv_yes|5.004005|5.003007|p PL_sv_zero|5.027003|5.027003| PL_sys_intern|5.005000||Viu PL_tainted|5.005000|5.003007|poVnu PL_tainting|5.005000|5.003007|poVnu PL_taint_warn|5.007003||Viu PL_threadhook|5.008000||Viu PL_tmps_floor|5.005000||Viu PL_tmps_ix|5.005000||Viu PL_tmps_max|5.005000||Viu PL_tmps_stack|5.005000||Viu PL_tokenbuf||5.003007|ponu PL_top_env|5.005000||Viu PL_toptarget|5.005000||Viu PL_TR_SPECIAL_HANDLING_UTF8|5.031006||Viu PL_underlying_numeric_obj|5.027009||Viu PL_unicode|5.008001||Viu PL_unitcheckav|5.009005||Viu PL_unitcheckav_save|5.009005||Viu PL_unlockhook|5.007003||Viu PL_unsafe|5.005000||Viu PL_UpperLatin1|5.019005||Viu PLUS|5.003007||Viu PLUS_t8|5.035004||Viu PLUS_t8_p8|5.033003||Viu PLUS_t8_pb|5.033003||Viu PLUS_tb|5.035004||Viu PLUS_tb_p8|5.033003||Viu PLUS_tb_pb|5.033003||Viu PL_utf8cache|5.009004||Viu PL_utf8_charname_begin|5.017006||Viu PL_utf8_charname_continue|5.017006||Viu PL_utf8_foldclosures|5.013007||Viu PL_utf8_idcont|5.008000||Viu PL_utf8_idstart|5.008000||Viu PL_utf8locale|5.008001||Viu PL_utf8_mark|5.006000||Viu PL_utf8_perl_idcont|5.017008||Viu PL_utf8_perl_idstart|5.015004||Viu PL_utf8_tofold|5.007003||Viu PL_utf8_tolower|5.006000||Viu PL_utf8_tosimplefold|5.027011||Viu PL_utf8_totitle|5.006000||Viu PL_utf8_toupper|5.006000||Viu PL_utf8_xidcont|5.013010||Viu PL_utf8_xidstart|5.013010||Viu PL_vtbl_arylen|5.015000||Viu PL_vtbl_arylen_p|5.015000||Viu PL_vtbl_backref|5.015000||Viu PL_vtbl_bm|5.015000||Viu PL_vtbl_checkcall|5.017000||Viu PL_vtbl_collxfrm|5.015000||Viu PL_vtbl_dbline|5.015000||Viu PL_vtbl_debugvar|5.021005||Viu PL_vtbl_defelem|5.015000||Viu PL_vtbl_env|5.015000||Viu PL_vtbl_envelem|5.015000||Viu PL_vtbl_fm|5.015000||Viu PL_vtbl_hints|5.015000||Viu PL_vtbl_hintselem|5.015000||Viu PL_vtbl_isa|5.015000||Viu PL_vtbl_isaelem|5.015000||Viu PL_vtbl_lvref|5.021005||Viu PL_vtbl_mglob|5.015000||Viu PL_vtbl_nkeys|5.015000||Viu PL_vtbl_nonelem|5.027009||Viu PL_vtbl_ovrld|5.015000||Viu PL_vtbl_pack|5.015000||Viu PL_vtbl_packelem|5.015000||Viu PL_vtbl_pos|5.015000||Viu PL_vtbl_regdata|5.015000||Viu PL_vtbl_regdatum|5.015000||Viu PL_vtbl_regexp|5.015000||Viu PL_vtbl_sig|5.035001||Viu PL_vtbl_sigelem|5.015000||Viu PL_vtbl_substr|5.015000||Viu PL_vtbl_sv|5.015000||Viu PL_vtbl_taint|5.015000||Viu PL_vtbl_utf8|5.015000||Viu PL_vtbl_uvar|5.015000||Viu PL_vtbl_vec|5.015000||Viu PL_warnhook|5.005000||Viu PL_warn_locale|5.021008||Viu PL_watchaddr|5.006000||Viu PL_watchok|5.006000||Viu PL_WB_invlist|5.021009||Viu PL_wcrtomb_ps|5.031010||Viu PL_XPosix_ptrs|5.017008||Viu PL_Xpv|5.005000|5.003007|poVnu PL_xsubfilename|5.021006||Viu pm_description|5.009004||Viu PMf_BASE_SHIFT|5.013004||Viu PMf_CHARSET|5.017011||Viu PMf_CODELIST_PRIVATE|5.017001||Viu PMf_CONST|5.003007||Viu PMf_CONTINUE|5.004000||Viu PMf_EVAL|5.003007||Viu PMf_EXTENDED|5.003007||Viu PMf_EXTENDED_MORE|5.021005||Viu PMf_FOLD|5.003007||Viu PMf_GLOBAL|5.003007||Viu PMf_HAS_CV|5.017001||Viu PMf_HAS_ERROR|5.025010||Viu PMf_IS_QR|5.017001||Viu PMf_KEEP|5.003007||Viu PMf_KEEPCOPY|5.009005||Viu PMf_MULTILINE|5.003007||Viu PMf_NOCAPTURE|5.021008||Viu PMf_NONDESTRUCT|5.013002||Viu PMf_ONCE|5.003007||Viu PMf_RETAINT|5.004005||Viu PMf_SINGLELINE|5.003007||Viu PMf_SPLIT|5.017011||Viu PMf_STRICT|5.021008||Viu PMf_USED|5.009005||Viu PMf_USE_RE_EVAL|5.017001||Viu PMf_WILDCARD|5.031010||Viu PM_GETRE|5.007002||Viu pmop_dump|5.006000|5.006000|u PmopSTASH|5.007001||Viu PmopSTASHPV|5.007001||Viu PmopSTASHPV_set|5.007001||Viu PmopSTASH_set|5.007001||Viu pmruntime|5.003007||Viu PM_SETRE|5.007002||Viu PM_STR|5.027010||Viu pmtrans|5.003007||Viu pMY_CXT|5.009000|5.009000|p _pMY_CXT||5.009000|p pMY_CXT_||5.009000|p PNf|5.021007||Viu PNfARG|5.021007||Viu Poison|5.008000|5.003007|p PoisonFree|5.009004|5.003007|p PoisonNew|5.009004|5.003007|p PoisonPADLIST|5.021006||Viu POISON_SV_HEAD|||Viu PoisonWith|5.009004|5.003007|p popen|5.003007||Viu POPi|5.003007|5.003007| POPl|5.003007|5.003007| POPMARK|5.003007||cViu POP_MULTICALL|5.009003|5.009003| POPn|5.006000|5.003007| POPp|5.003007|5.003007| POPpbytex|5.007001|5.007001| POPpconstx|5.009003||Viu POPpx|5.005003|5.005003| POPs|5.003007|5.003007| pop_scope|5.003007|5.003007|u POPSTACK|5.005000||Viu POPSTACK_TO|5.005000||Viu POPu|5.004000|5.004000| POPul|5.006000|5.006000| populate_ANYOF_from_invlist|5.019005||Viu populate_isa|||viu POSIXA|5.017003||Viu POSIXA_t8|5.035004||Viu POSIXA_t8_p8|5.033003||Viu POSIXA_t8_pb|5.033003||Viu POSIXA_tb|5.035004||Viu POSIXA_tb_p8|5.033003||Viu POSIXA_tb_pb|5.033003||Viu POSIX_CC_COUNT|5.017008||Viu POSIXD|5.017003||Viu POSIXD_t8|5.035004||Viu POSIXD_t8_p8|5.033003||Viu POSIXD_t8_pb|5.033003||Viu POSIXD_tb|5.035004||Viu POSIXD_tb_p8|5.033003||Viu POSIXD_tb_pb|5.033003||Viu POSIXL|5.017003||Viu POSIXL_CLEAR|5.029004||Viu POSIXL_SET|5.029004||Viu POSIXL_t8|5.035004||Viu POSIXL_t8_p8|5.033003||Viu POSIXL_t8_pb|5.033003||Viu POSIXL_tb|5.035004||Viu POSIXL_tb_p8|5.033003||Viu POSIXL_tb_pb|5.033003||Viu POSIXL_TEST|5.029004||Viu POSIXL_ZERO|5.029004||Viu POSIXU|5.017003||Viu POSIXU_t8|5.035004||Viu POSIXU_t8_p8|5.033003||Viu POSIXU_t8_pb|5.033003||Viu POSIXU_tb|5.035004||Viu POSIXU_tb_p8|5.033003||Viu POSIXU_tb_pb|5.033003||Viu PP|5.003007||Viu pregcomp|5.009005|5.009005| pregexec|5.003007|5.003007| PREGf_ANCH|5.019009||Viu PREGf_ANCH_GPOS|5.019009||Viu PREGf_ANCH_MBOL|5.019009||Viu PREGf_ANCH_SBOL|5.019009||Viu PREGf_CUTGROUP_SEEN|5.009005||Viu PREGf_GPOS_FLOAT|5.019009||Viu PREGf_GPOS_SEEN|5.019009||Viu PREGf_IMPLICIT|5.009005||Viu PREGf_NAUGHTY|5.009005||Viu PREGf_NOSCAN|5.019009||Viu PREGf_RECURSE_SEEN|5.023009||Viu pregfree2|5.011000||cVu pregfree|5.003007|5.003007|u PREGf_SKIP|5.009005||Viu PREGf_USE_RE_EVAL|5.017001||Viu PREGf_VERBARG_SEEN|5.009005||Viu prepare_SV_for_RV|5.010001||Viu prescan_version|5.011004|5.011004| PRESCAN_VERSION|5.019008||Viu PREV_RANGE_MATCHES_INVLIST|5.023002||Viu printbuf|5.009004||Viu print_bytes_for_locale|5.027002||Viu print_collxfrm_input_and_return|5.025004||Viu printf|5.003007||Viu PRINTF_FORMAT_NULL_OK|5.009005|5.009005|Vn printf_nocontext|5.007001||vdVnu PRIVLIB|5.003007|5.003007|Vn PRIVLIB_EXP|5.003007|5.003007|Vn PRIVSHIFT|5.003007||Viu process_special_blocks|5.009005||Viu PROCSELFEXE_PATH|5.007003|5.007003|Vn PRUNE|5.009005||Viu PRUNE_t8|5.035004||Viu PRUNE_t8_p8|5.033003||Viu PRUNE_t8_pb|5.033003||Viu PRUNE_tb|5.035004||Viu PRUNE_tb_p8|5.033003||Viu PRUNE_tb_pb|5.033003||Viu PSEUDO|5.009004||Viu PSEUDO_t8|5.035004||Viu PSEUDO_t8_p8|5.033003||Viu PSEUDO_t8_pb|5.033003||Viu PSEUDO_tb|5.035004||Viu PSEUDO_tb_p8|5.033003||Viu PSEUDO_tb_pb|5.033003||Viu pthread_addr_t|5.005000||Viu PTHREAD_ATFORK|5.007002||Viu pthread_attr_init|5.006000||Viu PTHREAD_ATTR_SETDETACHSTATE|5.006000||Viu pthread_condattr_default|5.005000||Viu PTHREAD_CREATE|5.006000||Viu pthread_create|5.008001||Viu PTHREAD_CREATE_JOINABLE|5.005000||Viu PTHREAD_GETSPECIFIC|5.007002||Viu PTHREAD_GETSPECIFIC_INT|5.006000||Viu pthread_key_create|5.005000||Viu pthread_keycreate|5.008001||Viu pthread_mutexattr_default|5.005000||Viu pthread_mutexattr_init|5.005000||Viu pthread_mutexattr_settype|5.005000||Viu pTHX_12|5.019010||Viu pTHX_1|5.006000||Viu pTHX_2|5.006000||Viu pTHX_3|5.006000||Viu pTHX_4|5.006000||Viu pTHX|5.006000|5.003007|p pTHX_5|5.009003||Viu pTHX_6|5.009003||Viu pTHX_7|5.009003||Viu pTHX_8|5.009003||Viu pTHX_9|5.009003||Viu pTHX_||5.003007|p pTHX__FORMAT|5.009002||Viu pTHX_FORMAT|5.009002||Viu pTHXo|5.006000||Viu pTHX__VALUE|5.009002||Viu pTHX_VALUE|5.009002||Viu pTHXx|5.006000||Viu PTR2IV|5.006000|5.003007|p PTR2nat|5.009003|5.003007|p PTR2NV|5.006000|5.003007|p PTR2ul|5.007001|5.003007|p PTR2UV|5.006000|5.003007|p Ptrdiff_t|5.029003||Viu ptr_hash|5.017010||Vniu PTRSIZE|5.005000|5.005000|Vn ptr_table_fetch|5.009005|5.009005|u ptr_table_find|5.009004||Vniu ptr_table_free|5.009005|5.009005|u ptr_table_new|5.009005|5.009005|u ptr_table_split|5.009005|5.009005|u ptr_table_store|5.009005|5.009005|u PTRV|5.006000|5.003007|poVnu PUSHi|5.003007|5.003007| PUSHMARK|5.003007|5.003007| PUSHmortal|5.009002|5.003007|p PUSH_MULTICALL|5.011000|5.011000| PUSH_MULTICALL_FLAGS|5.018000||Viu PUSHn|5.006000|5.003007| PUSHp|5.003007|5.003007| PUSHs|5.003007|5.003007| push_scope|5.003007|5.003007|u PUSHSTACK|5.005000||Viu PUSHSTACKi|5.005000||Viu PUSHSTACK_INIT_HWM|5.027002||Viu PUSHTARG|5.003007||Viu PUSHu|5.004000|5.003007|p PUTBACK|5.003007|5.003007| putc|5.003007||Viu put_charclass_bitmap_innards|5.021004||Viu put_charclass_bitmap_innards_common|5.023008||Viu put_charclass_bitmap_innards_invlist|5.023008||Viu put_code_point|5.021004||Viu putc_unlocked|5.003007||Viu putenv|5.005000||Viu put_range|5.019009||Viu putw|5.003007||Viu pv_display|5.006000|5.003007|p pv_escape|5.009004|5.003007|p pv_pretty|5.009004|5.003007|p pv_uni_display|5.007003|5.007003| pWARN_ALL|5.006000||Viu pWARN_NONE|5.006000||Viu pWARN_STD|5.006000||Viu PWGECOS|5.004005|5.004005|Vn PWPASSWD|5.005000|5.005000|Vn qerror|5.006000||cViu QR_PAT_MODS|5.009005||Viu QUAD_IS_INT|5.006000|5.006000|Vn QUAD_IS___INT64|5.015003|5.015003|Vn QUAD_IS_INT64_T|5.006000|5.006000|Vn QUAD_IS_LONG|5.006000|5.006000|Vn QUAD_IS_LONG_LONG|5.006000|5.006000|Vn QUADKIND|5.006000|5.006000|Vn quadmath_format_needed|5.021004||Vni quadmath_format_valid|5.031007||Vni Quad_t|5.003007|5.003007|Vn QUESTION_MARK_CTRL|5.021001||Viu RADIXCHAR|5.027010||Viu RANDBITS|5.003007|5.003007|Vn RANDOM_R_PROTO|5.008000|5.008000|Vn Rand_seed_t|5.006000|5.006000|Vn RANGE_INDICATOR|5.031006||Viu rck_elide_nothing|5.032001||Viu RD_NODATA|5.003007|5.003007|Vn read|5.005000||Viu readdir|5.005000||Viu readdir64|5.009000||Viu READDIR64_R_PROTO|5.008000|5.008000|Vn READDIR_R_PROTO|5.008000|5.008000|Vn READ_XDIGIT|5.017006|5.017006| realloc|5.003007||Vn ReANY|5.017006||cVnu re_compile|5.009005|5.009005|u RE_COMPILE_RECURSION_INIT|5.029009||Viu RE_COMPILE_RECURSION_LIMIT|5.029009||Viu re_croak|||iu recv|5.006000||Viu recvfrom|5.005000||Viu RE_DEBUG_COMPILE_DUMP|5.009004||Viu RE_DEBUG_COMPILE_FLAGS|5.009005||Viu RE_DEBUG_COMPILE_MASK|5.009004||Viu RE_DEBUG_COMPILE_OPTIMISE|5.009004||Viu RE_DEBUG_COMPILE_PARSE|5.009004||Viu RE_DEBUG_COMPILE_TEST|5.021005||Viu RE_DEBUG_COMPILE_TRIE|5.009004||Viu RE_DEBUG_EXECUTE_INTUIT|5.009004||Viu RE_DEBUG_EXECUTE_MASK|5.009004||Viu RE_DEBUG_EXECUTE_MATCH|5.009004||Viu RE_DEBUG_EXECUTE_TRIE|5.009004||Viu RE_DEBUG_EXTRA_BUFFERS|5.009005||Viu RE_DEBUG_EXTRA_DUMP_PRE_OPTIMIZE|5.031004||Viu RE_DEBUG_EXTRA_GPOS|5.011000||Viu RE_DEBUG_EXTRA_MASK|5.009004||Viu RE_DEBUG_EXTRA_OPTIMISE|5.009005||Viu RE_DEBUG_EXTRA_STACK|5.009005||Viu RE_DEBUG_EXTRA_STATE|5.009004||Viu RE_DEBUG_EXTRA_TRIE|5.009004||Viu RE_DEBUG_EXTRA_WILDCARD|5.031011||Viu RE_DEBUG_FLAG|5.009004||Viu RE_DEBUG_FLAGS|5.009002||Viu re_dup_guts|5.011000|5.011000| reentrant_free|5.008000||cVu reentrant_init|5.008000||cVu REENTRANT_PROTO_B_B|5.008000||Viu REENTRANT_PROTO_B_BI|5.008000||Viu REENTRANT_PROTO_B_BW|5.008000||Viu REENTRANT_PROTO_B_CCD|5.008000||Viu REENTRANT_PROTO_B_CCS|5.008000||Viu REENTRANT_PROTO_B_IBI|5.008000||Viu REENTRANT_PROTO_B_IBW|5.008000||Viu REENTRANT_PROTO_B_SB|5.008000||Viu REENTRANT_PROTO_B_SBI|5.008000||Viu REENTRANT_PROTO_I_BI|5.008000||Viu REENTRANT_PROTO_I_BW|5.008000||Viu REENTRANT_PROTO_I_CCSBWR|5.008000||Viu REENTRANT_PROTO_I_CCSD|5.008000||Viu REENTRANT_PROTO_I_CII|5.008000||Viu REENTRANT_PROTO_I_CIISD|5.008000||Viu REENTRANT_PROTO_I_CSBI|5.008000||Viu REENTRANT_PROTO_I_CSBIR|5.008000||Viu REENTRANT_PROTO_I_CSBWR|5.008000||Viu REENTRANT_PROTO_I_CSBWRE|5.008000||Viu REENTRANT_PROTO_I_CSD|5.008000||Viu REENTRANT_PROTO_I_CWISBWRE|5.008000||Viu REENTRANT_PROTO_I_CWISD|5.008000||Viu REENTRANT_PROTO_I_D|5.008000||Viu REENTRANT_PROTO_I_H|5.008000||Viu REENTRANT_PROTO_I_IBI|5.008000||Viu REENTRANT_PROTO_I_IBW|5.008000||Viu REENTRANT_PROTO_I_ICBI|5.008000||Viu REENTRANT_PROTO_I_ICSBWR|5.008000||Viu REENTRANT_PROTO_I_ICSD|5.008000||Viu REENTRANT_PROTO_I_ID|5.008000||Viu REENTRANT_PROTO_I_IISD|5.008000||Viu REENTRANT_PROTO_I_ISBWR|5.008000||Viu REENTRANT_PROTO_I_ISD|5.008000||Viu REENTRANT_PROTO_I_LISBI|5.008000||Viu REENTRANT_PROTO_I_LISD|5.008000||Viu REENTRANT_PROTO_I_SB|5.008000||Viu REENTRANT_PROTO_I_SBI|5.008000||Viu REENTRANT_PROTO_I_SBIE|5.008000||Viu REENTRANT_PROTO_I_SBIH|5.008000||Viu REENTRANT_PROTO_I_SBIR|5.008000||Viu REENTRANT_PROTO_I_SBWR|5.008000||Viu REENTRANT_PROTO_I_SBWRE|5.008000||Viu REENTRANT_PROTO_I_SD|5.008000||Viu REENTRANT_PROTO_I_TISD|5.008000||Viu REENTRANT_PROTO_I_TS|5.008000||Viu REENTRANT_PROTO_I_TSBI|5.008000||Viu REENTRANT_PROTO_I_TSBIR|5.008000||Viu REENTRANT_PROTO_I_TSBWR|5.008000||Viu REENTRANT_PROTO_I_TsISBWRE|5.008001||Viu REENTRANT_PROTO_I_TSR|5.008000||Viu REENTRANT_PROTO_I_UISBWRE|5.008000||Viu REENTRANT_PROTO_I_uISBWRE|5.008001||Viu REENTRANT_PROTO_S_CBI|5.008000||Viu REENTRANT_PROTO_S_CCSBI|5.008000||Viu REENTRANT_PROTO_S_CIISBIE|5.008000||Viu REENTRANT_PROTO_S_CSBI|5.008000||Viu REENTRANT_PROTO_S_CSBIE|5.008000||Viu REENTRANT_PROTO_S_CWISBIE|5.008000||Viu REENTRANT_PROTO_S_CWISBWIE|5.008000||Viu REENTRANT_PROTO_S_ICSBI|5.008000||Viu REENTRANT_PROTO_S_ISBI|5.008000||Viu REENTRANT_PROTO_S_LISBI|5.008000||Viu REENTRANT_PROTO_S_SBI|5.008000||Viu REENTRANT_PROTO_S_SBIE|5.008000||Viu REENTRANT_PROTO_S_SBW|5.008000||Viu REENTRANT_PROTO_S_TISBI|5.008000||Viu REENTRANT_PROTO_S_TS|5.031011||Viu REENTRANT_PROTO_S_TSBI|5.008000||Viu REENTRANT_PROTO_S_TSBIE|5.008000||Viu REENTRANT_PROTO_S_TWISBIE|5.008000||Viu REENTRANT_PROTO_V_D|5.008000||Viu REENTRANT_PROTO_V_H|5.008000||Viu REENTRANT_PROTO_V_ID|5.008000||Viu reentrant_retry|5.008000||vcVnu reentrant_size|5.008000||cVu REENTR_MEMZERO|5.009003||Viu re_exec_indentf|5.023009||vViu REF|5.003007||Viu ref|5.009003||Viu ref_array_or_hash|5.027008||Viu refcounted_he_chain_2hv|5.013007||cVi REFCOUNTED_HE_EXISTS|5.015007||Viu refcounted_he_fetch_pv|5.013007||cVi refcounted_he_fetch_pvn|5.013007||cVi refcounted_he_fetch_pvs|5.013007||Vi refcounted_he_fetch_sv|5.013007||cVi refcounted_he_free|5.013007||cVi refcounted_he_inc|5.013007||cVi REFCOUNTED_HE_KEY_UTF8|5.013007||Viu refcounted_he_new_pv|5.013007||cVi refcounted_he_new_pvn|5.013007||cVi refcounted_he_new_pvs|5.013007||Vi refcounted_he_new_sv|5.013007||cVi refcounted_he_value|5.009004||Viu REFF|5.004001||Viu REFFA|5.013010||Viu REFFAN|5.031001||Viu REFFAN_t8|5.035004||Viu REFFAN_t8_p8|5.033003||Viu REFFAN_t8_pb|5.033003||Viu REFFAN_tb|5.035004||Viu REFFAN_tb_p8|5.033003||Viu REFFAN_tb_pb|5.033003||Viu REFFA_t8|5.035004||Viu REFFA_t8_p8|5.033003||Viu REFFA_t8_pb|5.033003||Viu REFFA_tb|5.035004||Viu REFFA_tb_p8|5.033003||Viu REFFA_tb_pb|5.033003||Viu REFFL|5.004001||Viu REFFLN|5.031001||Viu REFFLN_t8|5.035004||Viu REFFLN_t8_p8|5.033003||Viu REFFLN_t8_pb|5.033003||Viu REFFLN_tb|5.035004||Viu REFFLN_tb_p8|5.033003||Viu REFFLN_tb_pb|5.033003||Viu REFFL_t8|5.035004||Viu REFFL_t8_p8|5.033003||Viu REFFL_t8_pb|5.033003||Viu REFFL_tb|5.035004||Viu REFFL_tb_p8|5.033003||Viu REFFL_tb_pb|5.033003||Viu REFFN|5.031001||Viu REFFN_t8|5.035004||Viu REFFN_t8_p8|5.033003||Viu REFFN_t8_pb|5.033003||Viu REFFN_tb|5.035004||Viu REFFN_tb_p8|5.033003||Viu REFFN_tb_pb|5.033003||Viu REFF_t8|5.035004||Viu REFF_t8_p8|5.033003||Viu REFF_t8_pb|5.033003||Viu REFF_tb|5.035004||Viu REFF_tb_p8|5.033003||Viu REFF_tb_pb|5.033003||Viu REFFU|5.013008||Viu REFFUN|5.031001||Viu REFFUN_t8|5.035004||Viu REFFUN_t8_p8|5.033003||Viu REFFUN_t8_pb|5.033003||Viu REFFUN_tb|5.035004||Viu REFFUN_tb_p8|5.033003||Viu REFFUN_tb_pb|5.033003||Viu REFFU_t8|5.035004||Viu REFFU_t8_p8|5.033003||Viu REFFU_t8_pb|5.033003||Viu REFFU_tb|5.035004||Viu REFFU_tb_p8|5.033003||Viu REFFU_tb_pb|5.033003||Viu REF_HE_KEY|5.009005||Viu refkids|5.003007||Viu REFN|5.031001||Viu REFN_t8|5.035004||Viu REFN_t8_p8|5.033003||Viu REFN_t8_pb|5.033003||Viu REFN_tb|5.035004||Viu REFN_tb_p8|5.033003||Viu REFN_tb_pb|5.033003||Viu REF_t8|5.035004||Viu REF_t8_p8|5.033003||Viu REF_t8_pb|5.033003||Viu REF_tb|5.035004||Viu REF_tb_p8|5.033003||Viu REF_tb_pb|5.033003||Viu refto|5.005000||Viu reg2Lanode|5.021005||Viu reg|5.005000||Viu reganode|5.005000||Viu REG_ANY|5.006000||Viu REG_ANY_t8|5.035004||Viu REG_ANY_t8_p8|5.033003||Viu REG_ANY_t8_pb|5.033003||Viu REG_ANY_tb|5.035004||Viu REG_ANY_tb_p8|5.033003||Viu REG_ANY_tb_pb|5.033003||Viu regatom|5.005000||Viu regbranch|5.005000||Viu reg_check_named_buff_matched|5.009005||Vniu regclass|5.005000||Viu regcppop|5.005000||Viu regcppush|5.005000||Viu regcp_restore|5.025006||Viu regcurly|5.013010||cVniu REG_CUTGROUP_SEEN|5.019009||Viu regdump|5.005000|5.005000|u regdump_extflags|5.009005||Viu regdump_intflags|5.019002||Viu regdupe_internal|5.009005||cVu regexec_flags|5.005000||cVu REGEX_SET|5.031010||Viu regex_set_precedence|5.021010||Vniu REGEX_SET_t8|5.035004||Viu REGEX_SET_t8_p8|5.033003||Viu REGEX_SET_t8_pb|5.033003||Viu REGEX_SET_tb|5.035004||Viu REGEX_SET_tb_p8|5.033003||Viu REGEX_SET_tb_pb|5.033003||Viu REG_EXTFLAGS_NAME_SIZE|5.020000||Viu regfree_internal|5.009005||cVu REG_GPOS_SEEN|5.019009||Viu reghop3|5.007001||Vniu reghop4|5.009005||Vniu reghopmaybe3|5.007001||Vniu reginclass|5.005000||Viu REG_INFTY|5.004005||Viu reginitcolors|5.006000||cVu reginsert|5.005000||Viu REG_INTFLAGS_NAME_SIZE|5.020000||Viu register|5.003007||Viu reg_la_NOTHING|||Viu reg_la_OPFAIL|||Viu REG_LB_SEEN|||Viu REG_LOOKBEHIND_SEEN|5.019009||Viu REG_MAGIC|5.006000||Viu regmatch|5.005000||Viu REGMATCH_STATE_MAX|5.009005||Viu reg_named_buff|5.009005||cViu reg_named_buff_all|5.009005||cVu reg_named_buff_exists|5.009005||cVu reg_named_buff_fetch|5.009005||cVu reg_named_buff_firstkey|5.009005||cVu reg_named_buff_iter|5.009005||cViu reg_named_buff_nextkey|5.009005||cVu reg_named_buff_scalar|5.009005||cVu regnext|5.003007||cVu reg_node|5.005000||Viu REGNODE_AFTER|5.003007||Viu REGNODE_BEFORE|5.003007||Viu regnode_guts|5.021005||Viu regnode_guts_debug|||Viu REGNODE_MAX|5.009004||Viu REGNODE_SIMPLE|5.013002||Viu REGNODE_VARIES|5.013002||Viu reg_numbered_buff_fetch|5.009005||cViu reg_numbered_buff_length|5.009005||cViu reg_numbered_buff_store|5.009005||cViu regpiece|5.005000||Viu regpnode|5.031010||Viu regprop|5.003007||Viu reg_qr_package|5.009005||cViu REG_RECURSE_SEEN|5.019009||Viu regrepeat|5.005000||Viu REG_RUN_ON_COMMENT_SEEN|5.019009||Viu reg_scan_name|5.009005||Viu reg_skipcomment|5.009005||Vniu regtail|5.005000||Viu regtail_study|5.009004||Viu reg_temp_copy|5.009005||cViu REG_TOP_LEVEL_BRANCHES_SEEN|5.019009||Viu regtry|5.005000||Viu REG_UNBOUNDED_QUANTIFIER_SEEN|5.019009||Viu REG_UNFOLDED_MULTI_SEEN|5.019009||Viu REG_VERBARG_SEEN|5.019009||Viu REG_ZERO_LEN_SEEN|5.019009||Viu re_indentf|5.023009||vViu re_intuit_start|5.006000||cVu re_intuit_string|5.006000||cVu rename|5.005000||Viu Renew|5.003007|5.003007| Renewc|5.003007|5.003007| RENUM|5.005000||Viu RENUM_t8|5.035004||Viu RENUM_t8_p8|5.033003||Viu RENUM_t8_pb|5.033003||Viu RENUM_tb|5.035004||Viu RENUM_tb_p8|5.033003||Viu RENUM_tb_pb|5.033003||Viu re_op_compile|5.017001||Viu repeatcpy|5.003007|5.003007|nu REPLACEMENT_CHARACTER_UTF8|5.025005|5.003007|p report_evil_fh|5.006001||Viu report_redefined_cv|5.015006||Viu report_uninit|5.006000||cVi report_wrongway_fh|5.013009||Viu re_printf|5.023009||vViu RE_PV_COLOR_DECL|5.009004||Viu RE_PV_QUOTED_DECL|5.009004||Viu require_pv|5.006000|5.006000| require_tie_mod|5.009005||Viu ReREFCNT_dec|5.005000||Viu ReREFCNT_inc|5.005000||Viu RESTORE_ERRNO|5.010001||Vi RESTORE_LC_NUMERIC|5.021010|5.021010|p restore_magic|5.009003||Viu restore_switched_locale|5.027009||Viu RE_SV_DUMPLEN|5.009004||Viu RE_SV_ESCAPE|5.009004||Viu RE_SV_TAIL|5.009004||Viu RETPUSHNO|5.003007||Viu RETPUSHUNDEF|5.003007||Viu RETPUSHYES|5.003007||Viu RE_TRIE_MAXBUF_INIT|5.009002||Viu RE_TRIE_MAXBUF_NAME|5.009002||Viu RETSETNO|5.003007||Viu RETSETTARG|5.021009||Viu RETSETUNDEF|5.003007||Viu RETSETYES|5.003007||Viu RETURN|5.003007||Viu RETURNOP|5.003007||Viu RETURNX|5.003007||Viu RETVAL|5.003007|5.003007|V rewind|5.003007||Viu rewinddir|5.005000||Viu REXEC_CHECKED|5.005000||Viu REXEC_COPY_SKIP_POST|5.017004||Viu REXEC_COPY_SKIP_PRE|5.017004||Viu REXEC_COPY_STR|5.005000||Viu REXEC_FAIL_ON_UNDERFLOW|5.019003||Viu REXEC_IGNOREPOS|5.006000||Viu REXEC_NOT_FIRST|5.006000||Viu REXEC_SCREAM|5.006000||Viu rmdir|5.005000||Viu RMS_DIR|5.008001||Viu RMS_FAC|5.008001||Viu RMS_FEX|5.008001||Viu RMS_FNF|5.008001||Viu RMS_IFI|5.008001||Viu RMS_ISI|5.008001||Viu RMS_PRV|5.008001||Viu rninstr|5.003007|5.003007|n ROTL32|5.017010||Viu ROTL64|5.017010||Viu ROTL_UV|5.017010||Viu ROTR32|5.027001||Viu ROTR64|5.027001||Viu ROTR_UV|5.027001||Viu rpeep|5.013005||Viu rsignal|5.004000|5.004000| rsignal_restore|5.004000||Viu rsignal_save|5.004000||Viu rsignal_state|5.004000|5.004000|u RsPARA|5.003007||Viu RsRECORD|5.005000||Viu RsSIMPLE|5.003007||Viu RsSNARF|5.003007||Viu run_body|5.006000||Viu runops_debug|5.005000||cVu RUNOPS_DEFAULT|5.005000||Viu runops_standard|5.005000||cVu run_user_filter|5.009003||Viu rv2cv_op_cv|5.013006|5.013006| RV2CVOPCV_FLAG_MASK|5.021004||Viu RV2CVOPCV_MARK_EARLY|5.013006|5.013006| RV2CVOPCV_MAYBE_NAME_GV|5.021004||Viu RV2CVOPCV_RETURN_NAME_GV|5.013006|5.013006| RV2CVOPCV_RETURN_STUB|5.021004||Viu rvpv_dup|5.008008|5.008008|u RX_ANCHORED_SUBSTR|5.010001||Viu RX_ANCHORED_UTF8|5.010001||Viu RXapif_ALL|5.009005||Viu RXapif_CLEAR|5.009005||Viu RXapif_DELETE|5.009005||Viu RXapif_EXISTS|5.009005||Viu RXapif_FETCH|5.009005||Viu RXapif_FIRSTKEY|5.009005||Viu RXapif_NEXTKEY|5.009005||Viu RXapif_ONE|5.009005||Viu RXapif_REGNAME|5.009005||Viu RXapif_REGNAMES|5.009005||Viu RXapif_REGNAMES_COUNT|5.009005||Viu RXapif_SCALAR|5.009005||Viu RXapif_STORE|5.009005||Viu RX_BUFF_IDX_CARET_FULLMATCH|5.017004||Viu RX_BUFF_IDX_CARET_POSTMATCH|5.017004||Viu RX_BUFF_IDX_CARET_PREMATCH|5.017004||Viu RX_BUFF_IDX_FULLMATCH|5.009005||Viu RX_BUFF_IDX_POSTMATCH|5.009005||Viu RX_BUFF_IDX_PREMATCH|5.009005||Viu RX_CHECK_SUBSTR|5.010001||Viu RX_COMPFLAGS|5.017011||Viu RX_ENGINE|5.010001||Viu RX_EXTFLAGS|5.010001||Viu RXf_BASE_SHIFT|5.013004||Viu RXf_CHECK_ALL|5.009005||Viu RXf_COPY_DONE|5.009005||Viu RXf_EVAL_SEEN|5.009005||Viu RXf_INTUIT_TAIL|5.009005||Viu RXf_IS_ANCHORED|5.019009||Viu RX_FLOAT_SUBSTR|5.010001||Viu RX_FLOAT_UTF8|5.010001||Viu RXf_MATCH_UTF8|5.009005||Viu RXf_NO_INPLACE_SUBST|5.017011||Viu RXf_NULL|5.010000||Viu RXf_PMf_CHARSET|5.013009||Viu RXf_PMf_COMPILETIME|5.009005||Viu RXf_PMf_EXTENDED|5.009005||Viu RXf_PMf_EXTENDED_MORE|5.021005||Viu RXf_PMf_FLAGCOPYMASK|5.017011||Viu RXf_PMf_FOLD|5.009005||Viu RXf_PMf_KEEPCOPY|5.009005||Viu RXf_PMf_MULTILINE|5.009005||Viu RXf_PMf_NOCAPTURE|5.021008||Viu RXf_PMf_SINGLELINE|5.009005||Viu RXf_PMf_SPLIT|5.017011||Viu RXf_PMf_STD_PMMOD|5.009005||Viu RXf_PMf_STD_PMMOD_SHIFT|5.010001||Viu RXf_PMf_STRICT|5.021008||Viu RXf_SKIPWHITE|5.009005||Viu RXf_SPLIT|5.009005||Viu RXf_START_ONLY|5.009005||Viu RXf_TAINTED|5.009005||Viu RXf_TAINTED_SEEN|5.009005||Viu RXf_UNBOUNDED_QUANTIFIER_SEEN|5.019009||Viu RXf_USE_INTUIT|5.009005||Viu RXf_USE_INTUIT_ML|5.009005||Viu RXf_USE_INTUIT_NOML|5.009005||Viu RXf_WHITE|5.009005||Viu RX_GOFS|5.010001||Viu RXi_GET|5.009005||Viu RXi_GET_DECL|5.009005||Viu RX_INTFLAGS|5.019009||Viu RXi_SET|5.009005||Viu RX_ISTAINTED|5.017006||Viu RX_LASTCLOSEPAREN|5.010001||Viu RX_LASTPAREN|5.010001||Viu RX_MATCH_COPIED|5.006000||Viu RX_MATCH_COPIED_off|5.006000||Viu RX_MATCH_COPIED_on|5.006000||Viu RX_MATCH_COPIED_set|5.006000||Viu RX_MATCH_COPY_FREE|5.009000||Viu RX_MATCH_TAINTED|5.005000||Viu RX_MATCH_TAINTED_off|5.005000||Viu RX_MATCH_TAINTED_on|5.005000||Viu RX_MATCH_TAINTED_set|5.005000||Viu RX_MATCH_UTF8|5.008001||Viu RX_MATCH_UTF8_off|5.008001||Viu RX_MATCH_UTF8_on|5.008001||Viu RX_MATCH_UTF8_set|5.008001||Viu RX_MINLEN|5.010001||Viu RX_MINLENRET|5.010001||Viu RX_NPARENS|5.010001||Viu RX_OFFS|5.010001||Viu RXp_COMPFLAGS|5.017011||Viu RXp_ENGINE|5.027003||Viu RXp_EXTFLAGS|5.010001||Viu RXp_GOFS|5.027003||Viu RXp_HAS_CUTGROUP|5.027003||Viu RXp_INTFLAGS|5.019009||Viu RXp_ISTAINTED|5.027003||Viu RXp_MATCH_COPIED|5.010001||Viu RXp_MATCH_COPIED_off|5.010001||Viu RXp_MATCH_COPIED_on|5.010001||Viu RXp_MATCH_COPY_FREE|5.027003||Viu RXp_MATCH_TAINTED|5.010001||Viu RXp_MATCH_TAINTED_off|5.027003||Viu RXp_MATCH_TAINTED_on|5.017008||Viu RXp_MATCH_UTF8|5.010001||Viu RXp_MATCH_UTF8_off|5.027003||Viu RXp_MATCH_UTF8_on|5.027003||Viu RXp_MATCH_UTF8_set|5.027003||Viu RXp_MINLEN|5.027003||Viu RXp_MINLENRET|5.027003||Viu RXp_NPARENS|5.027003||Viu RXp_OFFS|5.027003||Viu RXp_PAREN_NAMES|5.010001||Viu RX_PRECOMP|5.010001||Viu RX_PRECOMP_const|5.010001||Viu RX_PRELEN|5.010001||Viu RXp_SAVED_COPY|5.027003||Viu RXp_SUBBEG|5.027003||Viu RXp_SUBOFFSET|5.027003||Viu RXp_ZERO_LEN|5.027003||Viu RX_REFCNT|5.010001||Viu rxres_free|5.004000||Viu rxres_restore|5.004000||Viu rxres_save|5.004000||Viu RX_SAVED_COPY|5.011000||Viu RX_SUBBEG|5.010001||Viu RX_SUBCOFFSET|5.017004||Viu RX_SUBLEN|5.010001||Viu RX_SUBOFFSET|5.017004||Viu RX_TAINT_on|5.017006||Viu RX_UTF8|5.010001||Viu RX_WRAPLEN|5.010001||Viu RX_WRAPPED|5.010001||Viu RX_WRAPPED_const|5.011000||Viu RX_ZERO_LEN|5.019003||Viu safecalloc|5.003007||Viu Safefree|5.003007|5.003007| safefree|5.003007||Viu safemalloc|5.003007||Viu saferealloc|5.003007||Viu safesyscalloc|5.006000|5.006000|n safesysfree|5.006000|5.006000|n safesysmalloc|5.006000|5.006000|n safesysrealloc|5.006000|5.006000|n SAFE_TRIE_NODENUM|5.009002||Viu same_dirent|5.003007||Viu SANE_ERRSV|5.031003|5.031003| SANY|5.003007||Viu SANY_t8|5.035004||Viu SANY_t8_p8|5.033003||Viu SANY_t8_pb|5.033003||Viu SANY_tb|5.035004||Viu SANY_tb_p8|5.033003||Viu SANY_tb_pb|5.033003||Viu save_adelete|5.011000|5.011000|u SAVEADELETE|5.011000||Viu save_aelem|5.004005|5.004005|u save_aelem_flags|5.011000|5.011000|u save_alloc|5.006000|5.006000|u save_aptr|5.003007|5.003007| save_ary|5.003007|5.003007| SAVEBOOL|5.008001|5.008001| save_bool|5.008001||cVu save_clearsv|5.003007||cVu SAVECLEARSV|5.003007||Vi SAVECOMPILEWARNINGS|5.009004||Viu SAVECOMPPAD|5.006000||Vi SAVECOPFILE|5.006000||Viu SAVECOPFILE_FREE|5.006001||Viu SAVECOPLINE|5.006000||Viu SAVECOPSTASH_FREE|5.006001||Viu SAVE_DEFSV|5.004005|5.003007|p SAVEDELETE|5.003007|5.003007| save_delete|5.003007||cVu save_destructor|5.003007||cVu SAVEDESTRUCTOR|5.006000|5.006000| SAVEDESTRUCTOR_X|5.006000|5.006000| save_destructor_x|5.006000||cVu SAVE_ERRNO|5.010001||Vi SAVEFEATUREBITS|5.031006||Viu SAVEf_KEEPOLDELEM|5.011000||Viu SAVEFREECOPHH|5.013007||Viu SAVEFREEOP|5.010001|5.010001| save_freeop|5.010001||cVu SAVEFREEPADNAME|5.021007||Viu SAVEFREEPV|5.003007|5.003007| save_freepv|5.010001||cVu SAVEFREESV|5.003007|5.003007| save_freesv|5.010001||cVu SAVEf_SETMAGIC|5.011000||Viu SAVEGENERICPV|5.006001||Viu save_generic_pvref|5.006001|5.006001|u SAVEGENERICSV|5.005003||Viu save_generic_svref|5.005003|5.005003|u save_gp|5.004000|5.004000| save_hash|5.003007|5.003007| save_hdelete|5.011000|5.011000|u SAVEHDELETE|5.011000||Viu save_hek_flags|5.008000||Vniu save_helem|5.004005|5.004005|u save_helem_flags|5.011000|5.011000|u SAVEHINTS|5.005000||Viu save_hints|5.013005|5.013005|u save_hptr|5.003007|5.003007| SAVEI16|5.004000|5.004000| save_I16|5.004000||cVu SAVEI32|5.003007|5.003007| save_I32|5.003007||cVu SAVEI8|5.006000|5.006000| save_I8|5.006000||cVu SAVEINT|5.003007|5.003007| save_int|5.003007||cVu save_item|5.003007|5.003007| SAVEIV|5.003007|5.003007| save_iv|5.004000||cVu save_lines|5.005000||Viu save_list|5.003007|5.003007|d SAVELONG|5.003007|5.003007| save_long|5.003007||dcVu save_magic_flags|5.019002||Viu SAVE_MASK|5.013001||Viu SAVEMORTALIZESV|5.007001|5.007001| save_mortalizesv|5.010001||cVu save_nogv|5.003007|5.003007|du SAVEOP|5.005000||Viu save_op|5.010001|5.010001|u save_padsv_and_mortalize|5.010001|5.010001|u SAVEPADSVANDMORTALIZE|5.010001||Viu SAVEPADSV|||i SAVEPARSER|5.009005||Viu SAVEPPTR|5.003007|5.003007| save_pptr|5.003007||cVu save_pushi32ptr|5.013006|5.013006|u save_pushptr|5.010001|5.010001|u save_pushptri32ptr|5.010001||Viu save_pushptrptr|5.013006|5.013006|u savepv|5.003007|5.003007| savepvn|5.003007|5.003007| savepvs|5.009003|5.009003| save_re_context|5.006000||cVu save_scalar|5.003007|5.003007| save_scalar_at|5.005000||Viu save_set_svflags|5.009000|5.009000|u SAVESETSVFLAGS|5.009000||Viu savesharedpv|5.007003|5.007003| SAVESHAREDPV|5.007003||Viu savesharedpvn|5.009005|5.009005| save_shared_pvref|5.007003|5.007003|u savesharedpvs|5.013006|5.013006| savesharedsvpv|5.013006|5.013006| SAVESPTR|5.003007|5.003007| save_sptr|5.003007||cVu savestack_grow|5.003007|5.003007|u savestack_grow_cnt|5.008001|5.008001|u SAVESTACK_POS|5.004000|5.004000| save_strlen|5.019004||cViu SAVESTRLEN|5.035005|5.035005| savesvpv|5.009002|5.009002| save_svref|5.003007|5.003007| SAVESWITCHSTACK|5.009002||Viu SAVEt_ADELETE|5.011000||Viu SAVEt_AELEM|5.004005||Viu SAVEt_ALLOC|5.006000||Viu SAVEt_APTR|5.003007||Viu SAVEt_AV|5.003007||Viu SAVEt_BOOL|5.008001||Viu SAVEt_CLEARPADRANGE|5.017006||Viu SAVEt_CLEARSV|5.003007||Viu SAVEt_COMPILE_WARNINGS|5.009004||Viu SAVEt_COMPPAD|5.006000||Viu SAVEt_DELETE|5.003007||Viu SAVEt_DESTRUCTOR|5.003007||Viu SAVEt_DESTRUCTOR_X|5.006000||Viu SAVEt_FREECOPHH|5.013007||Viu SAVEt_FREEOP|5.003007||Viu SAVEt_FREEPADNAME|5.021007||Viu SAVEt_FREEPV|5.003007||Viu SAVEt_FREESV|5.003007||Viu SAVEt_GENERIC_PVREF|5.006001||Viu SAVEt_GENERIC_SVREF|5.005003||Viu SAVEt_GP|5.003007||Viu SAVEt_GVSLOT|5.017007||Viu SAVEt_GVSV|5.013005||Viu SAVEt_HELEM|5.004005||Viu SAVEt_HINTS|5.005000||Viu SAVEt_HINTS_HH|5.033001||Viu SAVEt_HPTR|5.003007||Viu SAVEt_HV|5.003007||Viu SAVEt_I16|5.004000||Viu SAVEt_I32|5.003007||Viu SAVEt_I32_SMALL|5.013001||Viu SAVEt_I8|5.006000||Viu SAVE_TIGHT_SHIFT|5.013001||Viu SAVEt_INT|5.003007||Viu SAVEt_INT_SMALL|5.013001||Viu SAVEt_ITEM|5.003007||Viu SAVEt_IV|5.003007||Viu SAVEt_LONG|5.003007||Viu SAVEt_MORTALIZESV|5.007001||Viu SAVETMPS|5.003007|5.003007| savetmps|||xu SAVEt_NSTAB|5.003007||Viu save_to_buffer|5.027004||Vniu SAVEt_OP|5.005000||Viu SAVEt_PADSV_AND_MORTALIZE|5.010001||Viu SAVEt_PARSER|5.009005||Viu SAVEt_PPTR|5.003007||Viu SAVEt_READONLY_OFF|5.019002||Viu SAVEt_REGCONTEXT|5.003007||Viu SAVEt_SAVESWITCHSTACK|5.009002||Viu SAVEt_SET_SVFLAGS|5.009000||Viu SAVEt_SHARED_PVREF|5.007003||Viu SAVEt_SPTR|5.003007||Viu SAVEt_STACK_POS|5.004000||Viu SAVEt_STRLEN|5.019004||Viu SAVEt_STRLEN_SMALL|5.033005||Viu SAVEt_SV|5.003007||Viu SAVEt_SVREF|5.003007||Viu SAVEt_TMPSFLOOR|5.023008||Viu SAVEt_VPTR|5.006000||Viu save_vptr|5.006000|5.006000|u SAVEVPTR|5.006000||Viu SAWAMPERSAND_LEFT|5.017004||Viu SAWAMPERSAND_MIDDLE|5.017004||Viu SAWAMPERSAND_RIGHT|5.017004||Viu sawparens|5.003007||Viu sb_dstr|5.003007||Viu sb_iters|5.003007||Viu sb_m|5.003007||Viu sb_maxiters|5.003007||Viu SBOL|5.003007||Viu SBOL_t8|5.035004||Viu SBOL_t8_p8|5.033003||Viu SBOL_t8_pb|5.033003||Viu SBOL_tb|5.035004||Viu SBOL_tb_p8|5.033003||Viu SBOL_tb_pb|5.033003||Viu sb_orig|5.003007||Viu SBOX32_CHURN_ROUNDS|5.027001||Viu SBOX32_MAX_LEN|5.027001||Viu SBOX32_MIX3|5.027001||Viu SBOX32_MIX4|5.027001||Viu SBOX32_SCRAMBLE32|5.027001||Viu SBOX32_SKIP_MASK|5.027001||Viu SBOX32_STATE_BITS|5.027001||Viu SBOX32_STATE_BYTES|5.027001||Viu SBOX32_STATE_WORDS|5.027001||Viu SBOX32_STATIC_INLINE|5.027001||Viu SBOX32_WARN2|5.027001||Viu SBOX32_WARN3|5.027001||Viu SBOX32_WARN4|5.027001||Viu SBOX32_WARN5|5.027001||Viu SBOX32_WARN6|5.027001||Viu sb_rflags|5.006000||Viu sb_rx|5.003007||Viu sb_rxres|5.004000||Viu sb_rxtainted|5.004000||Viu sb_s|5.003007||Viu sb_strend|5.003007||Viu sb_targ|5.003007||Viu scalar|5.003007||Viu scalarboolean|5.005000||Viu scalarkids|5.003007||Viu scalar_mod_type|5.006000||Vniu scalarvoid|5.003007||Viu scan_bin|5.006000|5.006000| scan_commit|5.005000||Viu scan_const|5.003007||Viu SCAN_DEF|5.003007||Viu scan_formline|5.003007||Viu scan_heredoc|5.003007||Viu scan_hex|5.006000|5.003007| scan_ident|5.003007||Viu scan_inputsymbol|5.003007||Viu scan_num|5.003007||cVu scan_oct|5.006000|5.003007| scan_pat|5.003007||Viu SCAN_REPL|5.003007||Viu scan_str|5.003007||xcViu scan_subst|5.003007||Viu SCAN_TR|5.003007||Viu scan_trans|5.003007||Viu scan_version|5.009001|5.009001| SCAN_VERSION|5.019008||Viu scan_vstring|5.009005|5.009005|u scan_word|5.003007||xcViu SCHED_YIELD|5.006000|5.006000|Vn SCOPE_SAVES_SIGNAL_MASK|5.007001||Viu search_const|5.010001||Viu seed|5.009003|5.009003|u seedDrand01|5.006000|5.006000| SEEK_CUR|5.003007||Viu seekdir|5.005000||Viu SEEK_END|5.003007||Viu SEEK_SET|5.003007||Viu select|5.005000||Viu Select_fd_set_t|5.003007|5.003007|Vn SELECT_MIN_BITS|5.005003|5.005003|Vn Semctl|5.004005||Viu semun|5.006000||Viu send|5.005000||Viu sendto|5.005000||Viu SEOL|5.003007||Viu SEOL_t8|5.035004||Viu SEOL_t8_p8|5.033003||Viu SEOL_t8_pb|5.033003||Viu SEOL_tb|5.035004||Viu SEOL_tb_p8|5.033003||Viu SEOL_tb_pb|5.033003||Viu sequence_num|5.009003||Viu set_ANYOF_arg|5.019005||Viu set_ANYOF_SYNTHETIC|5.019009||Viu setbuf|5.003007||Viu set_caret_X|5.019006||Viu set_context|5.006000|5.006000|nu setdefout|5.011000|5.011000| SETERRNO|5.003007||Vi setfd_cloexec|5.027008||Vniu setfd_cloexec_for_nonsysfd|5.027008||Viu setfd_cloexec_or_inhexec_by_sysfdness|5.027008||Viu setfd_inhexec|5.027008||Vniu setfd_inhexec_for_sysfd|5.027008||Viu setgid|5.005000||Viu setgrent|5.009000||Viu SETGRENT_R_HAS_FPTR|5.008000||Viu SETGRENT_R_PROTO|5.008000|5.008000|Vn sethostent|5.005000||Viu SETHOSTENT_R_PROTO|5.008000|5.008000|Vn SETi|5.003007||Viu setjmp|5.005000||Viu setlinebuf|5.005000||Viu setlocale|5.009000||Viu setlocale_debug_string|5.027002||Vniu SETLOCALE_LOCK|5.033005||Viu SETLOCALE_R_PROTO|5.008000|5.008000|Vn SETLOCALE_UNLOCK|5.033005||Viu SET_MARK_OFFSET|5.006000||Viu setmode|5.005000||Viu SETn|5.003007||Viu setnetent|5.005000||Viu SETNETENT_R_PROTO|5.008000|5.008000|Vn set_numeric_radix|5.006000||Viu SET_NUMERIC_STANDARD|5.004000||Viu set_numeric_standard|5.006000||cViu SET_NUMERIC_UNDERLYING|5.021010||Viu set_numeric_underlying|5.027006||cViu SETp|5.003007||Viu set_padlist|5.021006||cVniu setprotoent|5.005000||Viu SETPROTOENT_R_PROTO|5.008000|5.008000|Vn setpwent|5.009000||Viu SETPWENT_R_HAS_FPTR|5.008000||Viu SETPWENT_R_PROTO|5.008000|5.008000|Vn set_regex_pv|5.029004||Viu setregid|5.003007||Viu setreuid|5.003007||Viu SETs|5.003007||Viu setservent|5.005000||Viu SETSERVENT_R_PROTO|5.008000|5.008000|Vn setsockopt|5.005000||Viu setSTR_LEN|5.031005||Viu SET_SVANY_FOR_BODYLESS_IV|5.023008||Viu SET_SVANY_FOR_BODYLESS_NV|5.023008||Viu SETTARG|5.003007||Viu SET_THR|5.005000||Viu SET_THREAD_SELF|5.005003||Viu SETu|5.004000||Viu setuid|5.005000||Viu _setup_canned_invlist|5.019008||cViu setvbuf|5.003007||Viu share_hek|5.009003|5.009003|u share_hek_flags|5.008000||Viu share_hek_hek|5.009003||Viu sharepvn|5.005000||Viu SHARP_S_SKIP|5.007003||Viu Shmat_t|5.003007|5.003007|Vn SHORTSIZE|5.004000|5.004000|Vn should_warn_nl|5.021001||Vniu should_we_output_Debug_r|5.031011||Viu SH_PATH|5.003007|5.003007|Vn shutdown|5.005000||Viu si_dup|5.007003|5.007003|u S_IEXEC|5.006000||Viu S_IFIFO|5.011000||Viu S_IFMT|5.003007||Viu SIGABRT|5.003007||Viu sighandler1|5.031007||Vniu sighandler3|5.031007||Vniu sighandler|5.003007||Vniu SIGILL|5.003007||Viu Sigjmp_buf|5.003007|5.003007|Vn Siglongjmp|5.003007|5.003007| signal|5.005000||Viu Signal_t|5.003007|5.003007|Vn SIG_NAME|5.003007|5.003007|Vn SIG_NUM|5.003007|5.003007|Vn Sigsetjmp|5.003007|5.003007| SIG_SIZE|5.007001|5.007001|Vn simplify_sort|5.006000||Viu single_1bit_pos32|5.035003||cVnu single_1bit_pos64|5.035003||cVnu SINGLE_PAT_MOD|5.009005||Viu SIPHASH_SEED_STATE|5.027001||Viu SIPROUND|5.017006||Viu S_IREAD|5.006000||Viu S_IRGRP|5.003007||Viu S_IROTH|5.003007||Viu S_IRUSR|5.003007||Viu S_IRWXG|5.006000||Viu S_IRWXO|5.006000||Viu S_IRWXU|5.006000||Viu S_ISBLK|5.003007||Viu S_ISCHR|5.003007||Viu S_ISDIR|5.003007||Viu S_ISFIFO|5.003007||Viu S_ISGID|5.003007||Viu S_ISLNK|5.003007||Viu S_ISREG|5.003007||Viu S_ISSOCK|5.003007||Viu S_ISUID|5.003007||Viu SITEARCH|5.003007|5.003007|Vn SITEARCH_EXP|5.003007|5.003007|Vn SITELIB|5.003007|5.003007|Vn SITELIB_EXP|5.003007|5.003007|Vn SITELIB_STEM|5.006000|5.006000|Vn S_IWGRP|5.003007||Viu S_IWOTH|5.003007||Viu S_IWRITE|5.006000||Viu S_IWUSR|5.003007||Viu S_IXGRP|5.003007||Viu S_IXOTH|5.003007||Viu S_IXUSR|5.003007||Viu SIZE_ALIGN|5.005000||Viu Size_t|5.003007|5.003007|Vn Size_t_MAX|5.021003||Viu Size_t_size|5.006000|5.006000|Vn SKIP|5.009005||Viu SKIP_next|5.009005||Viu SKIP_next_fail|5.009005||Viu SKIP_next_fail_t8|5.035004||Viu SKIP_next_fail_t8_p8|5.033003||Viu SKIP_next_fail_t8_pb|5.033003||Viu SKIP_next_fail_tb|5.035004||Viu SKIP_next_fail_tb_p8|5.033003||Viu SKIP_next_fail_tb_pb|5.033003||Viu SKIP_next_t8|5.035004||Viu SKIP_next_t8_p8|5.033003||Viu SKIP_next_t8_pb|5.033003||Viu SKIP_next_tb|5.035004||Viu SKIP_next_tb_p8|5.033003||Viu SKIP_next_tb_pb|5.033003||Viu skipspace_flags|5.019002||xcViu SKIP_t8|5.035004||Viu SKIP_t8_p8|5.033003||Viu SKIP_t8_pb|5.033003||Viu SKIP_tb|5.035004||Viu SKIP_tb_p8|5.033003||Viu SKIP_tb_pb|5.033003||Viu skip_to_be_ignored_text|5.023004||Viu Slab_Alloc|5.006000||cViu Slab_Free|5.007003||cViu Slab_to_ro|5.017002||Viu Slab_to_rw|5.009005||Viu sleep|5.005000||Viu SLOPPYDIVIDE|5.003007||Viu socket|5.005000||Viu SOCKET_OPEN_MODE|5.008002||Viu socketpair|5.005000||Viu Sock_size_t|5.006000|5.006000|Vn softref2xv|||iu sortcv|5.009003||Viu sortcv_stacked|5.009003||Viu sortcv_xsub|5.009003||Viu sortsv|5.007003|5.007003| sortsv_flags|5.009003|5.009003| sortsv_flags_impl|5.031011||Viu SP|5.003007|5.003007| space_join_names_mortal|5.009004||Viu SPAGAIN|5.003007|5.003007| S_PAT_MODS|5.009005||Viu specialWARN|5.006000||Viu SRAND48_R_PROTO|5.008000|5.008000|Vn SRANDOM_R_PROTO|5.008000|5.008000|Vn SRCLOSE|5.027008||Viu SRCLOSE_t8|5.035004||Viu SRCLOSE_t8_p8|5.033003||Viu SRCLOSE_t8_pb|5.033003||Viu SRCLOSE_tb|5.035004||Viu SRCLOSE_tb_p8|5.033003||Viu SRCLOSE_tb_pb|5.033003||Viu SROPEN|5.027008||Viu SROPEN_t8|5.035004||Viu SROPEN_t8_p8|5.033003||Viu SROPEN_t8_pb|5.033003||Viu SROPEN_tb|5.035004||Viu SROPEN_tb_p8|5.033003||Viu SROPEN_tb_pb|5.033003||Viu SS_ACCVIO|5.008001||Viu SS_ADD_BOOL|5.017007||Viu SS_ADD_DPTR|5.017007||Viu SS_ADD_DXPTR|5.017007||Viu SS_ADD_END|5.017007||Viu SS_ADD_INT|5.017007||Viu SS_ADD_IV|5.017007||Viu SS_ADD_LONG|5.017007||Viu SS_ADD_PTR|5.017007||Viu SS_ADD_UV|5.017007||Viu SS_BUFFEROVF|5.021009||Viu ssc_add_range|5.019005||Viu ssc_and|5.019005||Viu ssc_anything|5.019005||Viu ssc_clear_locale|5.019005||Vniu ssc_cp_and|5.019005||Viu ssc_finalize|5.019005||Viu SSCHECK|5.003007||Viu ssc_init|5.019005||Viu ssc_intersection|5.019005||Viu ssc_is_anything|5.019005||Vniu ssc_is_cp_posixl_init|5.019005||Vniu SSC_MATCHES_EMPTY_STRING|5.021004||Viu ssc_or|5.019005||Viu ssc_union|5.019005||Viu SS_DEVOFFLINE|5.008001||Viu ss_dup|5.007003|5.007003|u SSGROW|5.008001||Viu SS_IVCHAN|5.008001||Viu SSize_t|5.003007|5.003007|Vn SSize_t_MAX|5.019004||Viu SS_MAXPUSH|5.017007||Viu SSNEW|5.006000||Viu SSNEWa|5.006000||Viu SSNEWat|5.007001||Viu SSNEWt|5.007001||Viu SS_NOPRIV|5.021001||Viu SS_NORMAL|5.008001||Viu SSPOPBOOL|5.008001||Viu SSPOPDPTR|5.003007||Viu SSPOPDXPTR|5.006000||Viu SSPOPINT|5.003007||Viu SSPOPIV|5.003007||Viu SSPOPLONG|5.003007||Viu SSPOPPTR|5.003007||Viu SSPOPUV|5.013001||Viu SSPTR|5.006000||Viu SSPTRt|5.007001||Viu SSPUSHBOOL|5.008001||Viu SSPUSHDPTR|5.003007||Viu SSPUSHDXPTR|5.006000||Viu SSPUSHINT|5.003007||Viu SSPUSHIV|5.003007||Viu SSPUSHLONG|5.003007||Viu SSPUSHPTR|5.003007||Viu SSPUSHUV|5.013001||Viu ST|5.003007|5.003007| stack_grow|5.003007||cVu Stack_off_t_MAX|||piu Stack_off_t|||piu STANDARD_C|5.003007||Viu STAR|5.003007||Viu STAR_t8|5.035004||Viu STAR_t8_p8|5.033003||Viu STAR_t8_pb|5.033003||Viu STAR_tb|5.035004||Viu STAR_tb_p8|5.033003||Viu STAR_tb_pb|5.033003||Viu START_EXTERN_C|5.005000|5.003007|pV start_glob|||xi START_MY_CXT|5.010000|5.010000|p STARTPERL|5.003007|5.003007|Vn start_subparse|5.004000|5.003007|pu StashHANDLER|5.007001||Viu Stat|5.003007||Viu stat|5.005000||Viu STATIC|5.005000||Viu STATIC_ASSERT_1|5.021007||Viu STATIC_ASSERT_2|5.021007||Viu STATIC_ASSERT_DECL|5.027001||Viu STATIC_ASSERT_STMT|5.021007||Viu Stat_t|5.004005||Viu STATUS_ALL_FAILURE|5.004000||Viu STATUS_ALL_SUCCESS|5.004000||Viu STATUS_CURRENT|5.004000||Viu STATUS_EXIT|5.009003||Viu STATUS_EXIT_SET|5.009003||Viu STATUS_NATIVE|5.004000||Viu STATUS_NATIVE_CHILD_SET|5.009003||Viu STATUS_UNIX|5.009003||Viu STATUS_UNIX_EXIT_SET|5.009003||Viu STATUS_UNIX_SET|5.009003||Viu STDCHAR|5.003007|5.003007|Vn stderr|5.003007||Viu ST_DEV_SIGN|5.035004|5.035004|Vn ST_DEV_SIZE|5.035004|5.035004|Vn stdin|5.003007||Viu STDIO_PTR_LVAL_SETS_CNT|5.007001|5.007001|Vn STDIO_PTR_LVALUE|5.006000|5.006000|Vn STDIO_STREAM_ARRAY|5.006000|5.006000|Vn stdize_locale|5.007001||Viu stdout|5.003007||Viu stdoutf|5.005000||Viu STD_PAT_MODS|5.009005||Viu STD_PMMOD_FLAGS_CLEAR|5.013006||Viu ST_INO_SIGN|5.015002|5.015002|Vn ST_INO_SIZE|5.015002|5.015002|Vn STMT_END|5.003007|5.003007|pV STMT_START|5.003007|5.003007|pV STOREFEATUREBITSHH|5.031006||Viu STORE_LC_NUMERIC_FORCE_TO_UNDERLYING|5.021010|5.021010| STORE_LC_NUMERIC_SET_STANDARD|5.027009||pVu STORE_LC_NUMERIC_SET_TO_NEEDED|5.021010|5.021010| STORE_LC_NUMERIC_SET_TO_NEEDED_IN|5.031003|5.031003| STORE_NUMERIC_SET_STANDARD|||piu strBEGINs|5.027006||Viu strEQ|5.003007|5.003007| Strerror|5.003007||Viu strerror|5.009000||Viu STRERROR_R_PROTO|5.008000|5.008000|Vn strGE|5.003007|5.003007| strGT|5.003007|5.003007| STRING|5.006000||Viu STRINGIFY|5.003007|5.003007|Vn STRINGl|5.031005||Viu STRINGs|5.031005||Viu strip_return|5.009003||Viu strLE|5.003007|5.003007| STR_LEN|5.006000||Viu STRLEN|5.027001||Viu STR_LENl|5.031005||Viu STR_LENs|5.031005||Viu strLT|5.003007|5.003007| strNE|5.003007|5.003007| strnEQ|5.003007|5.003007| strnNE|5.003007|5.003007| STR_SZ|5.006000||Viu Strtod|5.029010|5.029010|n Strtol|5.006000|5.006000|n strtoll|5.006000||Viu Strtoul|5.006000|5.006000|n strtoull|5.006000||Viu str_to_version|5.006000||cVu StructCopy|5.003007|5.003007|V STRUCT_OFFSET|5.004000||Viu STRUCT_SV|5.007001||Viu STR_WITH_LEN|5.009003|5.003007|pV study_chunk|5.005000||Viu sub_crush_depth|5.004000||Viu sublex_done|5.005000||Viu sublex_push|5.005000||Viu sublex_start|5.005000||Viu SUBST_TAINT_BOOLRET|5.013010||Viu SUBST_TAINT_PAT|5.013010||Viu SUBST_TAINT_REPL|5.013010||Viu SUBST_TAINT_RETAINT|5.013010||Viu SUBST_TAINT_STR|5.013010||Viu SUBVERSION|5.003007||Viu SUCCEED|5.003007||Viu SUCCEED_t8|5.035004||Viu SUCCEED_t8_p8|5.033003||Viu SUCCEED_t8_pb|5.033003||Viu SUCCEED_tb|5.035004||Viu SUCCEED_tb_p8|5.033003||Viu SUCCEED_tb_pb|5.033003||Viu SUSPEND|5.005000||Viu SUSPEND_t8|5.035004||Viu SUSPEND_t8_p8|5.033003||Viu SUSPEND_t8_pb|5.033003||Viu SUSPEND_tb|5.035004||Viu SUSPEND_tb_p8|5.033003||Viu SUSPEND_tb_pb|5.033003||Viu sv_2bool|5.013006||cV sv_2bool_flags|5.013006||cV sv_2bool_nomg|5.017002||Viu sv_2cv|5.003007|5.003007| sv_2io|5.003007|5.003007| sv_2iuv_common|5.009004||Viu sv_2iuv_non_preserve|5.007001||Viu sv_2iv|5.009001||cVu sv_2iv_flags|5.009001|5.009001| sv_2mortal|5.003007|5.003007| sv_2num|5.010000||xVi sv_2nv|5.013001||Viu sv_2nv_flags|5.013001|5.013001| sv_2pv|5.005000||pcVu sv_2pvbyte|5.006000|5.003007|p sv_2pvbyte_flags|5.031004|5.031004|u sv_2pvbyte_nolen|5.009003||pcV sv_2pv_flags|5.007002||pcV sv_2pv_nolen|5.009003||pcV sv_2pv_nomg|5.007002||Viu sv_2pvutf8|5.006000|5.006000| sv_2pvutf8_flags|5.031004|5.031004|u sv_2pvutf8_nolen|5.009003||cV sv_2uv|5.009001||pcVu sv_2uv_flags|5.009001|5.009001| sv_add_arena|5.003007||Vi sv_add_backref|||iu SvAMAGIC|5.003007||Viu SvAMAGIC_off|5.003007|5.003007|nu SvAMAGIC_on|5.003007|5.003007|nu SvANY|5.003007||Viu SvARENA_CHAIN_SET|||Viu SvARENA_CHAIN|||Viu sv_backoff|5.003007|5.003007|n sv_bless|5.003007|5.003007| sv_buf_to_ro|5.019008||Viu sv_buf_to_rw|5.019008||Viu SvCANCOW|5.017007||Viu SvCANEXISTDELETE|5.011000||Viu SV_CATBYTES|5.021005|5.021005| sv_cat_decode|5.008001|5.008001| sv_cathek|5.021004||Viu sv_catpv|5.003007|5.003007| sv_catpvf|5.004000||vV sv_catpv_flags|5.013006|5.013006| sv_catpvf_mg|5.004005||pvV sv_catpvf_mg_nocontext|5.006000||pvVn sv_catpvf_nocontext|5.006000||vVn sv_catpv_mg|5.004005|5.003007|p sv_catpvn|5.003007|5.003007| sv_catpvn_flags|5.007002|5.007002| sv_catpvn_mg|5.004005|5.003007|p sv_catpvn_nomg|5.007002|5.003007|p sv_catpvn_nomg_maybeutf8|5.017005||Viu sv_catpvn_nomg_utf8_upgrade|5.017002||Viu sv_catpv_nomg|5.013006|5.013006| sv_catpvs|5.009003|5.003007|p sv_catpvs_flags|5.013006|5.013006| sv_catpvs_mg|5.013006|5.013006| sv_catpvs_nomg|5.013006|5.013006| sv_catsv|5.003007|5.003007| sv_catsv_flags|5.007002|5.007002| sv_catsv_mg|5.004005|5.003007|p sv_catsv_nomg|5.007002|5.003007|p SV_CATUTF8|5.021005|5.021005| sv_catxmlpvs|5.013006||Viu SV_CHECK_THINKFIRST|5.008001||Viu SV_CHECK_THINKFIRST_COW_DROP|5.009000||Viu sv_chop|5.003007|5.003007| sv_clean_all|5.003007||Vi sv_clean_objs|5.003007||Vi sv_clear|5.003007|5.003007| sv_cmp|5.003007|5.003007| sv_cmp_flags|5.013006|5.013006| sv_cmp_locale|5.004000|5.004000| sv_cmp_locale_flags|5.013006|5.013006| sv_collxfrm|5.013006||V sv_collxfrm_flags|5.013006|5.013006| SvCOMPILED|5.003007||Viu SvCOMPILED_off|5.003007||Viu SvCOMPILED_on|5.003007||Viu SV_CONST|5.019002||Viu SV_CONST_BINMODE|5.019002||Viu SV_CONST_CLEAR|5.019002||Viu SV_CONST_CLOSE|5.019002||Viu SV_CONST_DELETE|5.019002||Viu SV_CONST_DESTROY|5.019002||Viu SV_CONST_EOF|5.019002||Viu SV_CONST_EXISTS|5.019002||Viu SV_CONST_EXTEND|5.019002||Viu SV_CONST_FETCH|5.019002||Viu SV_CONST_FETCHSIZE|5.019002||Viu SV_CONST_FILENO|5.019002||Viu SV_CONST_FIRSTKEY|5.019002||Viu SV_CONST_GETC|5.019002||Viu SV_CONST_NEXTKEY|5.019002||Viu SV_CONST_OPEN|5.019002||Viu SV_CONST_POP|5.019002||Viu SV_CONST_PRINT|5.019002||Viu SV_CONST_PRINTF|5.019002||Viu SV_CONST_PUSH|5.019002||Viu SV_CONST_READ|5.019002||Viu SV_CONST_READLINE|5.019002||Viu SV_CONST_RETURN|5.009003|5.003007|poVnu SV_CONST_SCALAR|5.019002||Viu SV_CONSTS_COUNT|5.019002||Viu SV_CONST_SEEK|5.019002||Viu SV_CONST_SHIFT|5.019002||Viu SV_CONST_SPLICE|5.019002||Viu SV_CONST_STORE|5.019002||Viu SV_CONST_STORESIZE|5.019002||Viu SV_CONST_TELL|5.019002||Viu SV_CONST_TIEARRAY|5.019002||Viu SV_CONST_TIEHANDLE|5.019002||Viu SV_CONST_TIEHASH|5.019002||Viu SV_CONST_TIESCALAR|5.019002||Viu SV_CONST_UNSHIFT|5.019002||Viu SV_CONST_UNTIE|5.019002||Viu SV_CONST_WRITE|5.019002||Viu sv_copypv|5.007003|5.007003| sv_copypv_flags|5.017002|5.017002| sv_copypv_nomg|5.017002|5.017002| SV_COW_DROP_PV|5.008001|5.003007|p SV_COW_OTHER_PVS|5.009005||Viu SV_COW_REFCNT_MAX|5.017007||Viu SV_COW_SHARED_HASH_KEYS|5.009005|5.003007|poVnu SvCUR|5.003007|5.003007| SvCUR_set|5.003007|5.003007| sv_dec|5.003007|5.003007| sv_dec_nomg|5.013002|5.013002| sv_del_backref|5.006000||cViu sv_derived_from|5.004000|5.004000| sv_derived_from_pv|5.015004|5.015004| sv_derived_from_pvn|5.015004|5.015004| sv_derived_from_sv|5.015004|5.015004| sv_derived_from_svpvn|5.031006||Viu sv_destroyable|5.010000|5.010000| SvDESTROYABLE|5.010000||Viu sv_display|5.021002||Viu SV_DO_COW_SVSETSV|5.009005||Viu sv_does|5.009004|5.009004| sv_does_pv|5.015004|5.015004| sv_does_pvn|5.015004|5.015004| sv_does_sv|5.015004|5.015004| sv_dump|5.003007|5.003007| sv_dup|5.007003|5.007003|u sv_dup_common|5.013002||Viu sv_dup_inc|5.013002|5.013002|u sv_dup_inc_multiple|5.011000||Viu SvEND|5.003007|5.003007| SvEND_set|5.003007||Viu SvENDx|5.003007||Viu sv_eq|5.003007|5.003007| sv_eq_flags|5.013006|5.013006| sv_exp_grow|5.009003||Viu SVf256|5.008001||Viu SVf32|5.009002||Viu SVf|5.006000|5.003007|p SvFAKE|5.003007||Viu SvFAKE_off|5.003007||Viu SvFAKE_on|5.003007||Viu SVf_AMAGIC|5.003007||Viu SVfARG|5.009005|5.003007|p SVf_BREAK|5.003007||Viu SVf_FAKE|5.003007||Viu SVf_IOK|5.003007||Viu SVf_IsCOW|5.017006||Viu SVf_IVisUV|5.006000||Viu SvFLAGS|5.003007||Viu SVf_NOK|5.003007||Viu SVf_OK|5.003007||Viu SVf_OOK|5.003007||Viu sv_force_normal|5.006000|5.006000| sv_force_normal_flags|5.007001|5.007001| SV_FORCE_UTF8_UPGRADE|5.011000|5.011000| SVf_POK|5.003007||Viu SVf_PROTECT|5.021005||Viu SVf_READONLY|5.003007||Viu sv_free2|||xciu sv_free|5.003007|5.003007| sv_free_arenas|5.003007||Vi SVf_ROK|5.003007||Viu SVf_THINKFIRST|5.003007||Viu SVf_UTF8|5.006000|5.003007|p SvGAMAGIC|5.006001|5.006001| sv_get_backrefs|5.021008|5.021008|xn SvGETMAGIC|5.004005|5.003007|p sv_gets|5.003007|5.003007| SvGID|5.019001||Viu SV_GMAGIC|5.007002|5.003007|p SvGMAGICAL|5.003007||Viu SvGMAGICAL_off|5.003007||Viu SvGMAGICAL_on|5.003007||Viu SvGROW|5.003007|5.003007| sv_grow|5.003007||cV Sv_Grow|5.003007||Viu sv_grow_fresh|5.035006||cV SvGROW_mutable|5.009003||Viu SV_HAS_TRAILING_NUL|5.009004|5.003007|p SV_IMMEDIATE_UNREF|5.007001|5.003007|p SvIMMORTAL|5.004000||Viu SvIMMORTAL_INTERP|5.027003||Viu SvIMMORTAL_TRUE|5.027003||Viu sv_inc|5.003007|5.003007| sv_i_ncmp|5.009003||Viu sv_i_ncmp_desc|5.031011||Viu sv_inc_nomg|5.013002|5.013002| sv_insert|5.003007|5.003007| sv_insert_flags|5.010001|5.010001| SvIOK|5.003007|5.003007| SvIOK_nog|5.017002||Viu SvIOK_nogthink|5.017002||Viu SvIOK_notUV|5.006000|5.006000| SvIOK_off|5.003007|5.003007| SvIOK_on|5.003007|5.003007| SvIOK_only|5.003007|5.003007| SvIOK_only_UV|5.006000|5.006000| SvIOKp|5.003007|5.003007| SvIOKp_on|5.003007||Viu SvIOK_UV|5.006000|5.006000| sv_isa|5.003007|5.003007| sv_isa_sv|5.031007|5.031007|x SvIsBOOL|5.035004|5.035004| SvIsCOW|5.008003|5.008003| SvIsCOW_shared_hash|5.008003|5.008003| SvIS_FREED|5.009003||Viu sv_isobject|5.003007|5.003007| SvIV|5.003007|5.003007| sv_iv|5.005000||dcV SvIV_nomg|5.009001|5.003007|p SvIV_please|5.007001||Viu SvIV_please_nomg|5.013002||Viu SvIV_set|5.003007|5.003007| SvIVX|5.003007|5.003007| SvIVx|5.003007|5.003007| SvIVXx|5.003007||Viu sv_kill_backrefs|||xiu sv_len|5.003007|5.003007| SvLEN|5.003007|5.003007| SvLEN_set|5.003007|5.003007| sv_len_utf8|5.006000|5.006000|p sv_len_utf8_nomg||5.006000|p SvLENx|5.003007||Viu SvLOCK|5.007003|5.007003| sv_magic|5.003007|5.003007| SvMAGIC|5.003007||Viu SvMAGICAL|5.003007||Viu SvMAGICAL_off|5.003007||Viu SvMAGICAL_on|5.003007||Viu sv_magicext|5.007003|5.007003| sv_magicext_mglob|5.019002||cViu sv_magic_portable||5.004000|pou SvMAGIC_set|5.009003|5.003007|p sv_mortalcopy|5.003007|5.003007| sv_mortalcopy_flags|5.031001|5.003007|p SV_MUTABLE_RETURN|5.009003|5.003007|poVnu sv_ncmp|5.009003||Viu sv_ncmp_desc|5.031011||Viu sv_newmortal|5.003007|5.003007| sv_newref|5.003007||cV SvNIOK|5.003007|5.003007| SvNIOK_nog|5.017002||Viu SvNIOK_nogthink|5.017002||Viu SvNIOK_off|5.003007|5.003007| SvNIOKp|5.003007|5.003007| SvNOK|5.003007|5.003007| SvNOK_nog|5.017002||Viu SvNOK_nogthink|5.017002||Viu SvNOK_off|5.003007|5.003007| SvNOK_on|5.003007|5.003007| SvNOK_only|5.003007|5.003007| SvNOKp|5.003007|5.003007| SvNOKp_on|5.003007||Viu sv_nolocking|5.031004|5.031004|d sv_nosharing|5.007003|5.007003| SV_NOSTEAL|5.009002|5.003007|p sv_nounlocking|5.009004|5.009004|d sv_numeq|5.035009|5.035009| sv_numeq_flags|5.035009|5.035009| sv_nv|5.005000||dcV SvNV|5.006000|5.003007| SvNV_nomg|5.013002|5.003007|p SvNV_set|5.006000|5.003007| SvNVX|5.006000|5.003007| SvNVx|5.006000|5.003007| SvNVXx|5.003007||Viu SvOBJECT|5.003007||Viu SvOBJECT_off|5.003007||Viu SvOBJECT_on|5.003007||Viu SvOK|5.003007|5.003007| SvOK_off|5.003007||Viu SvOK_off_exc_UV|5.006000||Viu SvOKp|5.003007||Viu sv_only_taint_gmagic|5.021010||Vniu SvOOK|5.003007|5.003007| SvOOK_off|5.003007|5.003007| SvOOK_offset|5.011000|5.011000| SvOOK_on|5.003007||Viu sv_or_pv_len_utf8|5.017005||Viu sv_or_pv_pos_u2b|5.019004||Viu SvOURSTASH|5.009005||Viu SvOURSTASH_set|5.009005||Viu SvPADMY|5.003007||Viu SvPADMY_on|5.003007||Viu SVpad_OUR|5.006000||Viu SvPAD_OUR|5.009004||Viu SvPAD_OUR_on|5.009004||Viu SvPADSTALE|5.009000||Viu SvPADSTALE_off|5.009000||Viu SvPADSTALE_on|5.009000||Viu SVpad_STATE|5.009004||Viu SvPAD_STATE|5.009004||Viu SvPAD_STATE_on|5.009004||Viu SvPADTMP|5.003007||Viu SvPADTMP_off|5.003007||Viu SvPADTMP_on|5.003007||Viu SVpad_TYPED|5.007002||Viu SvPAD_TYPED|5.009004||Viu SvPAD_TYPED_on|5.009004||Viu SVpav_REAL|5.009003||Viu SVpav_REIFY|5.009003||Viu SvPCS_IMPORTED|5.009005||Viu SvPCS_IMPORTED_off|5.009005||Viu SvPCS_IMPORTED_on|5.009005||Viu SvPEEK|5.003007||Viu sv_peek|5.005000|5.005000|u SVpgv_GP|5.009005||Viu SVphv_CLONEABLE|5.009003||Viu SVphv_HASKFLAGS|5.008000||Viu SVphv_LAZYDEL|5.003007||Viu SVphv_SHAREKEYS|5.003007||Viu SVp_IOK|5.003007||Viu SVp_NOK|5.003007||Viu SvPOK|5.003007|5.003007| SvPOK_byte_nog|5.017002||Viu SvPOK_byte_nogthink|5.017002||Viu SvPOK_byte_pure_nogthink|5.017003||Viu SvPOK_nog|5.017002||Viu SvPOK_nogthink|5.017002||Viu SvPOK_off|5.003007|5.003007| SvPOK_on|5.003007|5.003007| SvPOK_only|5.003007|5.003007| SvPOK_only_UTF8|5.006000|5.006000| SvPOK_or_cached_IV|||Viu SvPOKp|5.003007|5.003007| SvPOKp_on|5.003007||Viu SvPOK_pure_nogthink|5.017003||Viu SvPOK_utf8_nog|5.017002||Viu SvPOK_utf8_nogthink|5.017002||Viu SvPOK_utf8_pure_nogthink|5.017003||Viu sv_pos_b2u|5.006000|5.006000| sv_pos_b2u_flags|5.019003|5.019003| sv_pos_b2u_midway|5.009004||Viu sv_pos_u2b|5.006000|5.006000| sv_pos_u2b_cached|5.009004||Viu sv_pos_u2b_flags|5.011005|5.011005| sv_pos_u2b_forwards|5.009004||Vniu sv_pos_u2b_midway|5.009004||Vniu SVp_POK|5.003007||Viu SVppv_STATIC|5.035004||Viu SVprv_PCS_IMPORTED|5.009005||Viu SVprv_WEAKREF|5.006000||Viu SVp_SCREAM|5.003007||Viu SvPV|5.003007|5.003007| sv_pv|5.008000||cV SvPVbyte|5.006000|5.003007|p sv_pvbyte|5.008000||cV SvPVbyte_force|5.009002|5.009002| sv_pvbyten|5.006000||dcV sv_pvbyten_force|5.006000||cV SvPVbyte_nolen|5.006000|5.006000| SvPVbyte_nomg|5.031004|5.031004| SvPVbyte_or_null|5.031004|5.031004| SvPVbyte_or_null_nomg|5.031004|5.031004| SvPVbytex|5.006000|5.006000| SvPVbytex_force|5.006000|5.006000| SvPVbytex_nolen|5.009003|5.009003| SvPVCLEAR|5.025006|5.025006|p SvPV_const|5.009003|5.003007|p SvPV_flags|5.007002|5.003007|p SvPV_flags_const|5.009003|5.003007|p SvPV_flags_const_nolen|5.009003||pVu SvPV_flags_mutable|5.009003|5.003007|p SvPV_force|5.003007|5.003007|p SvPV_force_flags|5.007002|5.003007|p SvPV_force_flags_mutable|5.009003|5.003007|p SvPV_force_flags_nolen|5.009003|5.003007|p SvPV_force_mutable|5.009003|5.003007|p SvPV_force_nolen|5.009003|5.003007|p SvPV_force_nomg|5.007002|5.003007|p SvPV_force_nomg_nolen|5.009003|5.003007|p SvPV_free|5.009003|5.009003| SvPV_mutable|5.009003|5.003007|p sv_pvn|5.004000||dcV sv_pvn_force|5.005000||cV sv_pvn_force_flags|5.007002|5.003007|p sv_pvn_force_nomg|5.007002||Viu sv_pvn_nomg|5.007003|5.005000|pdu SvPV_nolen|5.006000|5.003007|p SvPV_nolen_const|5.009003|5.003007|p SvPV_nomg|5.007002|5.003007|p SvPV_nomg_const|5.009003|5.003007|p SvPV_nomg_const_nolen|5.009003|5.003007|p SvPV_nomg_nolen|5.013007|5.003007|p SvPV_renew|5.009003|5.003007|p SvPV_set|5.003007|5.003007| SvPV_shrink_to_cur|5.009003||Viu SvPVutf8|5.006000|5.006000| sv_pvutf8|5.008000||cV SvPVutf8_force|5.006000|5.006000| sv_pvutf8n|5.006000||dcV sv_pvutf8n_force|5.006000||cV SvPVutf8_nolen|5.006000|5.006000| SvPVutf8_nomg|5.031004|5.031004| SvPVutf8_or_null|5.031004|5.031004| SvPVutf8_or_null_nomg|5.031004|5.031004| SvPVutf8x|5.006000|5.006000| SvPVutf8x_force|5.006000|5.006000| SvPVX|5.003007|5.003007| SvPVx|5.003007|5.003007| SvPVX_const|5.009003|5.003007|p SvPVx_const|5.009003|5.009003| SvPVx_force|5.005000|5.005000| SvPVX_mutable|5.009003|5.003007|p SvPVx_nolen|5.009003|5.009003| SvPVx_nolen_const|5.009003|5.003007|p SvPVXtrue|5.017002||Viu SvPVXx|5.003007|5.003007| SvREADONLY|5.003007|5.003007| SvREADONLY_off|5.003007|5.003007| SvREADONLY_on|5.003007|5.003007| sv_recode_to_utf8|5.007003|5.007003| sv_ref|5.023005|5.023005| SvREFCNT|5.003007|5.003007| SvREFCNT_dec|5.003007|5.003007| SvREFCNT_dec_NN|5.017007|5.017007| SvREFCNT_IMMORTAL|5.017008||Viu SvREFCNT_inc|5.003007|5.003007|pn SvREFCNT_inc_NN|5.009004|5.003007|pn SvREFCNT_inc_simple|5.009004|5.003007|pn SvREFCNT_inc_simple_NN|5.009004|5.003007|pn SvREFCNT_inc_simple_void|5.009004|5.003007|pn SvREFCNT_inc_simple_void_NN|5.009004|5.003007|pn SvREFCNT_inc_void|5.009004|5.003007|pn SvREFCNT_inc_void_NN|5.009004|5.003007|pn sv_reftype|5.003007|5.003007| sv_replace|5.003007|5.003007| sv_report_used|5.003007|5.003007| sv_reset|5.003007|5.003007| sv_resetpvn|5.017005||Viu SvRMAGICAL|5.003007||Viu SvRMAGICAL_off|5.003007||Viu SvRMAGICAL_on|5.003007||Viu SvROK|5.003007|5.003007| SvROK_off|5.003007|5.003007| SvROK_on|5.003007|5.003007| SvRV|5.003007|5.003007| SvRV_const|5.010001||Viu SvRV_set|5.009003|5.003007|p sv_rvunweaken|5.027004|5.027004| sv_rvweaken|5.006000|5.006000| SvRVx|5.003007||Viu SvRX|5.009005|5.003007|p SvRXOK|5.009005|5.003007|p SV_SAVED_COPY|5.009005||Viu SvSCREAM|5.003007||Viu SvSCREAM_off|5.003007||Viu SvSCREAM_on|5.003007||Viu sv_setbool|5.035004|5.035004| sv_setbool_mg|5.035004|5.035004| sv_setgid|5.019001||Viu sv_sethek|5.015004||cViu sv_setiv|5.003007|5.003007| sv_setiv_mg|5.004005|5.003007|p SvSETMAGIC|5.003007|5.003007| SvSetMagicSV|5.004000|5.004000| SvSetMagicSV_nosteal|5.004000|5.004000| sv_setnv|5.006000|5.003007| sv_setnv_mg|5.006000|5.003007|p sv_setpv|5.003007|5.003007| sv_setpv_bufsize|5.025006|5.025006| sv_setpvf|5.004000||vV sv_setpvf_mg|5.004005||pvV sv_setpvf_mg_nocontext|5.006000||pvVn sv_setpvf_nocontext|5.006000||vVn sv_setpviv|5.008001|5.008001|d sv_setpviv_mg|5.008001|5.008001|d sv_setpv_mg|5.004005|5.003007|p sv_setpvn|5.003007|5.003007| sv_setpvn_fresh|5.035006|5.035006| sv_setpvn_mg|5.004005|5.003007|p sv_setpvs|5.009004|5.003007|p sv_setpvs_mg|5.013006|5.013006| sv_setref_iv|5.003007|5.003007| sv_setref_nv|5.006000|5.003007| sv_setref_pv|5.003007|5.003007| sv_setref_pvn|5.003007|5.003007| sv_setref_pvs|5.013006|5.013006| sv_setref_uv|5.007001|5.007001| sv_setrv_inc|5.035004|5.035004| sv_setrv_inc_mg|5.035004|5.035004| sv_setrv_noinc|5.035004|5.035004| sv_setrv_noinc_mg|5.035004|5.035004| sv_setsv|5.003007|5.003007| SvSetSV|5.003007|5.003007| sv_setsv_cow|5.009000||xcViu sv_setsv_flags|5.007002|5.003007|p sv_setsv_mg|5.004005|5.003007|p sv_setsv_nomg|5.007002|5.003007|p SvSetSV_nosteal|5.004000|5.004000| sv_setuid|5.019001||Viu sv_set_undef|5.025008|5.025008| sv_setuv|5.004000|5.003007|p sv_setuv_mg|5.004005|5.003007|p SVs_GMG|5.003007||Viu SvSHARE|5.007003|5.007003| SvSHARED_HASH|5.009003|5.003007|p SvSHARED_HEK_FROM_PV|5.009003||Viu SV_SKIP_OVERLOAD|5.013001||Viu SV_SMAGIC|5.009003|5.003007|p SvSMAGICAL|5.003007||Viu SvSMAGICAL_off|5.003007||Viu SvSMAGICAL_on|5.003007||Viu SVs_OBJECT|5.003007||Viu SVs_PADMY|5.003007||Viu SVs_PADSTALE|5.009000|5.009000| SVs_PADTMP|5.003007||Viu SVs_RMG|5.003007||Viu SVs_SMG|5.003007||Viu SvSTASH|5.003007|5.003007| SvSTASH_set|5.009003|5.003007|p SVs_TEMP|5.003007|5.003007| sv_streq|5.035009|5.035009| sv_streq_flags|5.035009|5.035009| sv_string_from_errnum|5.027003|5.027003| SvTAIL|5.003007||Viu SvTAINT|5.003007|5.003007| sv_taint|5.009003||cV SvTAINTED|5.004000|5.004000| sv_tainted|5.004000||cV SvTAINTED_off|5.004000|5.004000| SvTAINTED_on|5.004000|5.004000| SvTEMP|5.003007||Viu SvTEMP_off|5.003007||Viu SvTEMP_on|5.003007||Viu SVt_FIRST|5.021005||Viu SvTHINKFIRST|5.003007||Vi SvTIED_mg|5.005003||Viu SvTIED_obj|5.005003|5.005003| SVt_INVLIST|||c SVt_IV|5.003007|5.003007| SVt_MASK|5.015001||Viu SVt_NULL|5.003007|5.003007| SVt_NV|5.003007|5.003007| SVt_PV|5.003007|5.003007| SVt_PVAV|5.003007|5.003007| SVt_PVBM|5.009005||Viu SVt_PVCV|5.003007|5.003007| SVt_PVFM|5.003007|5.003007| SVt_PVGV|5.003007|5.003007| SVt_PVHV|5.003007|5.003007| SVt_PVIO|5.003007|5.003007| SVt_PVIV|5.003007|5.003007| SVt_PVLV|5.003007|5.003007| SVt_PVMG|5.003007|5.003007| SVt_PVNV|5.003007|5.003007| SVt_REGEXP|5.011000|5.011000| SvTRUE|5.003007|5.003007| sv_true|5.005000||cV SvTRUE_common|5.033005||cVu SvTRUE_NN|5.017007|5.017007| SvTRUE_nomg|5.013006|5.003007|p SvTRUE_nomg_NN|5.017007|5.017007| SvTRUEx|5.003007|5.003007| SvTRUEx_nomg|5.017002||Viu SVt_RV|5.011000||Viu SvTYPE|5.003007|5.003007| SVTYPEMASK|5.003007||Viu SvUID|5.019001||Viu SV_UNDEF_RETURNS_NULL|5.011000||Viu sv_unglob|5.005000||Viu sv_uni_display|5.007003|5.007003| SvUNLOCK|5.007003|5.007003| sv_unmagic|5.003007|5.003007| sv_unmagicext|5.013008|5.003007|p sv_unref|5.003007|5.003007| sv_unref_flags|5.007001|5.007001| sv_untaint|5.004000||cV SvUOK|5.007001|5.006000|p SvUOK_nog|5.017002||Viu SvUOK_nogthink|5.017002||Viu sv_upgrade|5.003007|5.003007| SvUPGRADE|5.003007|5.003007| sv_usepvn|5.003007|5.003007| sv_usepvn_flags|5.009004|5.009004| sv_usepvn_mg|5.004005|5.003007|p SvUTF8|5.006000|5.003007|p sv_utf8_decode|5.006000|5.006000| sv_utf8_downgrade|5.006000|5.006000| sv_utf8_downgrade_flags|5.031004|5.031004| sv_utf8_downgrade_nomg|5.031004|5.031004| sv_utf8_encode|5.006000|5.006000| SV_UTF8_NO_ENCODING|5.008001|5.003007|pd SvUTF8_off|5.006000|5.006000| SvUTF8_on|5.006000|5.006000| sv_utf8_upgrade|5.007001|5.007001| sv_utf8_upgrade_flags|5.007002|5.007002| sv_utf8_upgrade_flags_grow|5.011000|5.011000| sv_utf8_upgrade_nomg|5.007002|5.007002| SvUV|5.004000|5.003007|p sv_uv|5.005000||pdcV SvUV_nomg|5.009001|5.003007|p SvUV_set|5.009003|5.003007|p SvUVX|5.004000|5.003007|p SvUVx|5.004000|5.003007|p SvUVXx|5.004000|5.003007|pd SvVALID|5.003007||Viu sv_vcatpvf|5.006000|5.004000|p sv_vcatpvf_mg|5.006000|5.004000|p sv_vcatpvfn|5.004000|5.004000| sv_vcatpvfn_flags|5.017002|5.017002| SvVOK|5.008001|5.008001| sv_vsetpvf|5.006000|5.004000|p sv_vsetpvf_mg|5.006000|5.004000|p sv_vsetpvfn|5.004000|5.004000| SvVSTRING_mg|5.009004|5.003007|p SvWEAKREF|5.006000||Viu SvWEAKREF_off|5.006000||Viu SvWEAKREF_on|5.006000||Viu swallow_bom|5.006001||Viu switch_category_locale_to_template|5.027009||Viu SWITCHSTACK|5.003007||Viu switch_to_global_locale|5.027009|5.003007|pn sync_locale|5.027009|5.003007|pn sys_init3|||cnu sys_init|||cnu sys_intern_clear|5.006001||Vu sys_intern_dup|5.006000||Vu sys_intern_init|5.006001||Vu SYSTEM_GMTIME_MAX|5.011000||Viu SYSTEM_GMTIME_MIN|5.011000||Viu SYSTEM_LOCALTIME_MAX|5.011000||Viu SYSTEM_LOCALTIME_MIN|5.011000||Viu sys_term|||cnu TAIL|5.005000||Viu TAIL_t8|5.035004||Viu TAIL_t8_p8|5.033003||Viu TAIL_t8_pb|5.033003||Viu TAIL_tb|5.035004||Viu TAIL_tb_p8|5.033003||Viu TAIL_tb_pb|5.033003||Viu TAINT|5.004000||Viu taint_env|5.003007|5.003007|u TAINT_ENV|5.003007||Viu TAINT_get|5.017006||Viu TAINT_IF|5.003007||Viu TAINTING_get|5.017006||Viu TAINTING_set|5.017006||Viu TAINT_NOT|5.003007||Viu taint_proper|5.003007|5.003007|u TAINT_PROPER|5.003007||Viu TAINT_set|5.017006||Viu TAINT_WARN_get|5.017006||Viu TAINT_WARN_set|5.017006||Viu TARG|5.003007|5.003007| TARGi|5.023005||Viu TARGn|5.023005||Viu TARGu|5.023005||Viu telldir|5.005000||Viu T_FMT|5.027010||Viu T_FMT_AMPM|5.027010||Viu THIS|5.003007|5.003007|V THOUSEP|5.027010||Viu THR|5.005000||Viu THREAD_CREATE_NEEDS_STACK|5.007002||Viu thread_locale_init|5.027009|5.027009|xnu thread_locale_term|5.027009|5.027009|xnu THREAD_RET_TYPE|5.005000||Viu tied_method|5.013009||vViu TIED_METHOD_ARGUMENTS_ON_STACK|5.013009||Viu TIED_METHOD_MORTALIZE_NOT_NEEDED|5.013009||Viu TIED_METHOD_SAY|5.013009||Viu times|5.005000||Viu Time_t|5.003007|5.003007|Vn Timeval|5.004000|5.004000|Vn TM|5.011000||Viu tmpfile|5.003007||Viu tmpnam|5.005000||Viu TMPNAM_R_PROTO|5.008000|5.008000|Vn tmps_grow_p|5.021005||cViu to_byte_substr|5.008000||Viu to_case_cp_list|5.035004||Viu toCTRL|5.004000||Viu toFOLD|5.019001|5.019001| toFOLD_A|5.019001|5.019001| _to_fold_latin1|5.015005||cVniu toFOLD_LC|5.019001||Viu toFOLD_uni|5.007003||Viu toFOLD_utf8|5.031005|5.031005| toFOLD_utf8_safe|5.025009|5.006000|p toFOLD_uvchr|5.023009|5.006000|p TO_INTERNAL_SIZE|5.023002||Viu tokenize_use|5.009003||Viu tokeq|5.005000||Viu tokereport|5.007001||Viu toLOWER|5.003007|5.003007| toLOWER_A|5.019001|5.019001| toLOWER_L1|5.019001|5.019001| toLOWER_LATIN1|5.013006|5.011002| to_lower_latin1|5.015005||Vniu toLOWER_LC|5.004000|5.004000| toLOWER_uni|5.006000||Viu toLOWER_utf8|5.031005|5.031005| toLOWER_utf8_safe|5.025009|5.006000|p toLOWER_uvchr|5.023009|5.006000|p too_few_arguments_pv|5.016000||Viu TOO_LATE_FOR|5.008001||Viu too_many_arguments_pv|5.016000||Viu TOPi|5.003007||Viu TOPl|5.003007||Viu TOPm1s|5.007001||Viu TOPMARK|5.003007||cViu TOPn|5.003007||Viu TOPp1s|5.007001||Viu TOPp|5.003007||Viu TOPpx|5.005003||Viu TOPs|5.003007||Viu TOPu|5.004000||Viu TOPul|5.006000||Viu toTITLE|5.019001|5.019001| toTITLE_A|5.019001|5.019001| toTITLE_uni|5.006000||Viu toTITLE_utf8|5.031005|5.031005| toTITLE_utf8_safe|5.025009|5.006000|p toTITLE_uvchr|5.023009|5.006000|p to_uni_fold|5.014000||cVu _to_uni_fold_flags|5.014000||cVu to_uni_lower|5.006000||cVu to_uni_title|5.006000||cVu to_uni_upper|5.006000||cVu toUPPER|5.003007|5.003007| toUPPER_A|5.019001|5.019001| toUPPER_LATIN1_MOD|5.011002||Viu toUPPER_LC|5.004000||Viu _to_upper_title_latin1|5.015005||Viu toUPPER_uni|5.006000||Viu toUPPER_utf8|5.031005|5.031005| toUPPER_utf8_safe|5.025009|5.006000|p toUPPER_uvchr|5.023009|5.006000|p _to_utf8_case|5.023006||Viu _to_utf8_fold_flags|5.014000||cVu _to_utf8_lower_flags|5.015006||cVu to_utf8_substr|5.008000||Viu _to_utf8_title_flags|5.015006||cVu _to_utf8_upper_flags|5.015006||cVu translate_substr_offsets|5.015006||Vniu traverse_op_tree|5.029008||Vi TR_DELETE|5.031006||Viu TRIE|5.009002||Viu TRIE_BITMAP|5.009004||Viu TRIE_BITMAP_BYTE|5.009004||Viu TRIE_BITMAP_CLEAR|5.009004||Viu TRIE_BITMAP_SET|5.009004||Viu TRIE_BITMAP_TEST|5.009004||Viu TRIEC|5.009004||Viu TRIE_CHARCOUNT|5.009004||Viu TRIEC_t8|5.035004||Viu TRIEC_t8_p8|5.033003||Viu TRIEC_t8_pb|5.033003||Viu TRIEC_tb|5.035004||Viu TRIEC_tb_p8|5.033003||Viu TRIEC_tb_pb|5.033003||Viu TRIE_next|5.009005||Viu TRIE_next_fail|5.009005||Viu TRIE_next_fail_t8|5.035004||Viu TRIE_next_fail_t8_p8|5.033003||Viu TRIE_next_fail_t8_pb|5.033003||Viu TRIE_next_fail_tb|5.035004||Viu TRIE_next_fail_tb_p8|5.033003||Viu TRIE_next_fail_tb_pb|5.033003||Viu TRIE_next_t8|5.035004||Viu TRIE_next_t8_p8|5.033003||Viu TRIE_next_t8_pb|5.033003||Viu TRIE_next_tb|5.035004||Viu TRIE_next_tb_p8|5.033003||Viu TRIE_next_tb_pb|5.033003||Viu TRIE_NODEIDX|5.009002||Viu TRIE_NODENUM|5.009002||Viu TRIE_t8|5.035004||Viu TRIE_t8_p8|5.033003||Viu TRIE_t8_pb|5.033003||Viu TRIE_tb|5.035004||Viu TRIE_tb_p8|5.033003||Viu TRIE_tb_pb|5.033003||Viu TRIE_WORDS_OFFSET|5.009005||Viu TR_OOB|5.031006||Viu TR_R_EMPTY|5.031006||Viu TR_SPECIAL_HANDLING|5.031006||Viu TRUE|5.003007||Viu truncate|5.006000||Viu TR_UNLISTED|5.031006||Viu TR_UNMAPPED|5.031006||Viu try_amagic_bin|||ciu tryAMAGICbin_MG|5.013002||Viu try_amagic_un|||ciu tryAMAGICunDEREF|5.006000||Viu tryAMAGICun_MG|5.013002||Viu tryAMAGICunTARGETlist|5.017002||Viu TS_W32_BROKEN_LOCALECONV|5.027010||Viu tTHX|5.009003||Viu ttyname|5.009000||Viu TTYNAME_R_PROTO|5.008000|5.008000|Vn turkic_fc|5.029008||Viu turkic_lc|5.029008||Viu turkic_uc|5.029008||Viu TWO_BYTE_UTF8_TO_NATIVE|5.019004||Viu TWO_BYTE_UTF8_TO_UNI|5.013008||Viu TYPE_CHARS|5.004000||Viu TYPE_DIGITS|5.004000||Viu U16|5.027001||Viu U16_MAX|5.003007||Viu U16_MIN|5.003007||Viu U16SIZE|5.006000|5.006000|Vn U16TYPE|5.006000|5.006000|Vn U_32|5.007002|5.007002| U32|5.027001||Viu U32_ALIGNMENT_REQUIRED|5.007001|5.007001|Vn U32_MAX|5.003007||Viu U32_MAX_P1|5.007002||Viu U32_MAX_P1_HALF|5.007002||Viu U32_MIN|5.003007||Viu U32SIZE|5.006000|5.006000|Vn U32TYPE|5.006000|5.006000|Vn U64|5.023002||Viu U64SIZE|5.006000|5.006000|Vn U64TYPE|5.006000|5.006000|Vn U8|5.027001||Viu U8_MAX|5.003007||Viu U8_MIN|5.003007||Viu U8SIZE|5.006000|5.006000|Vn U8TO16_LE|5.017010||Viu U8TO32_LE|5.017010||Viu U8TO64_LE|5.017006||Viu U8TYPE|5.006000|5.006000|Vn UCHARAT|5.003007||Viu U_I|5.003007||Viu Uid_t|5.003007|5.003007|Vn Uid_t_f|5.006000|5.006000|Vn Uid_t_sign|5.006000|5.006000|Vn Uid_t_size|5.006000|5.006000|Vn UINT16_C|5.003007|5.003007| UINT32_C|5.003007|5.003007| UINT32_MIN|5.006000||Viu UINT64_C|5.023002|5.023002| UINT64_MIN|5.006000||Viu UINTMAX_C|5.003007|5.003007| uiv_2buf|5.009003||Vniu U_L|5.003007||Viu umask|5.005000||Viu uname|5.005004||Viu UNDERBAR|5.009002|5.003007|p unexpected_non_continuation_text|5.025006||Viu ungetc|5.003007||Viu UNI_age_values_index|5.029009||Viu UNI_AHEX|5.029002||Viu UNI_ahex_values_index|5.029009||Viu UNI_ALNUM|5.029002||Viu UNI_ALPHA|5.029002||Viu UNI_ALPHABETIC|5.029002||Viu UNI_alpha_values_index|5.029009||Viu UNI_ASCIIHEXDIGIT|5.029002||Viu UNI_BASICLATIN|5.029002||Viu UNI_bc_values_index|5.029009||Viu UNI_bidic_values_index|5.029009||Viu UNI_bidim_values_index|5.029009||Viu UNI_BLANK|5.029002||Viu UNI_blk_values_index|5.029009||Viu UNI_bpt_values_index|5.029009||Viu UNI_cased_values_index|5.029009||Viu UNI_CC|5.029002||Viu UNI_ccc_values_index|5.029009||Viu UNI_ce_values_index|5.029009||Viu UNI_ci_values_index|5.029009||Viu UNI_CNTRL|5.029002||Viu UNICODE_ALLOW_ABOVE_IV_MAX|5.031006||Viu UNICODE_ALLOW_ANY|5.007003||Viu UNICODE_ALLOW_SUPER|5.007003||Viu UNICODE_ALLOW_SURROGATE|5.007003||Viu UNICODE_BYTE_ORDER_MARK|5.008000||Viu UNICODE_DISALLOW_ABOVE_31_BIT|5.023006|5.023006| UNICODE_DISALLOW_ILLEGAL_C9_INTERCHANGE|5.025005|5.025005| UNICODE_DISALLOW_ILLEGAL_INTERCHANGE|5.013009|5.013009| UNICODE_DISALLOW_NONCHAR|5.013009|5.013009| UNICODE_DISALLOW_PERL_EXTENDED|5.027002|5.027002| UNICODE_DISALLOW_SUPER|5.013009|5.013009| UNICODE_DISALLOW_SURROGATE|5.013009|5.013009| UNICODE_DOT_DOT_VERSION|5.023002||Viu UNICODE_DOT_VERSION|5.023002||Viu UNICODE_GOT_NONCHAR|5.027009||Viu UNICODE_GOT_PERL_EXTENDED|5.027009||Viu UNICODE_GOT_SUPER|5.027009||Viu UNICODE_GOT_SURROGATE|5.027009||Viu UNICODE_GREEK_CAPITAL_LETTER_SIGMA|5.007003||Viu UNICODE_GREEK_SMALL_LETTER_FINAL_SIGMA|5.007003||Viu UNICODE_GREEK_SMALL_LETTER_SIGMA|5.007003||Viu UNICODE_IS_32_CONTIGUOUS_NONCHARS|5.023006||Viu UNICODE_IS_BYTE_ORDER_MARK|5.007001||Viu UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER|5.023006||Viu UNICODE_IS_NONCHAR|5.013009|5.013009| UNICODE_IS_PERL_EXTENDED|5.027002||Viu UNICODE_IS_REPLACEMENT|5.007002|5.007002| UNICODE_IS_SUPER|5.013009|5.013009| UNICODE_IS_SURROGATE|5.007001|5.007001| UNICODE_MAJOR_VERSION|5.023002||Viu UNICODE_PAT_MOD|5.013006||Viu UNICODE_PAT_MODS|5.013006||Viu UNICODE_REPLACEMENT|5.007001|5.003007|p UNICODE_SURROGATE_FIRST|5.007001||Viu UNICODE_SURROGATE_LAST|5.007001||Viu UNICODE_WARN_ABOVE_31_BIT|5.023006|5.023006| UNICODE_WARN_ILLEGAL_C9_INTERCHANGE|5.025005|5.025005| UNICODE_WARN_ILLEGAL_INTERCHANGE|5.013009|5.013009| UNICODE_WARN_NONCHAR|5.013009|5.013009| UNICODE_WARN_PERL_EXTENDED|5.027002|5.027002| UNICODE_WARN_SUPER|5.013009|5.013009| UNICODE_WARN_SURROGATE|5.013009|5.013009| UNI_compex_values_index|5.029009||Viu UNI_CONTROL|5.029002||Viu UNI_cwcf_values_index|5.029009||Viu UNI_cwcm_values_index|5.029009||Viu UNI_cwkcf_values_index|5.029009||Viu UNI_cwl_values_index|5.029009||Viu UNI_cwt_values_index|5.029009||Viu UNI_cwu_values_index|5.029009||Viu UNI_dash_values_index|5.029009||Viu UNI_DECIMALNUMBER|5.029002||Viu UNI_dep_values_index|5.029009||Viu UNI_dia_values_index|5.029009||Viu UNI_DIGIT|5.029002||Viu UNI_DISPLAY_BACKSLASH|5.007003|5.007003| UNI_DISPLAY_BACKSPACE|5.031009|5.031009| UNI_DISPLAY_ISPRINT|5.007003|5.007003| UNI_DISPLAY_QQ|5.007003|5.007003| UNI_DISPLAY_REGEX|5.007003|5.007003| UNI_di_values_index|5.029009||Viu UNI_dt_values_index|5.029009||Viu UNI_ea_values_index|5.029009||Viu UNI_ebase_values_index|5.031010||Viu UNI_ecomp_values_index|5.031010||Viu UNI_emod_values_index|5.031010||Viu UNI_emoji_values_index|5.031010||Viu UNI_epres_values_index|5.031010||Viu UNI_extpict_values_index|5.031010||Viu UNI_ext_values_index|5.029009||Viu UNI_gcb_values_index|5.029009||Viu UNI_gc_values_index|5.029009||Viu UNI_GRAPH|5.029002||Viu UNI_grbase_values_index|5.029009||Viu UNI_grext_values_index|5.029009||Viu UNI_HEX|5.029002||Viu UNI_HEXDIGIT|5.029002||Viu UNI_hex_values_index|5.029009||Viu UNI_HORIZSPACE|5.029002||Viu UNI_hst_values_index|5.029009||Viu UNI_HYPHEN|5.029002||Viu UNI_hyphen_values_index|5.029009||Viu UNI_idc_values_index|5.029009||Viu UNI_identifierstatus_values_index|5.031010||Viu UNI_identifiertype_values_index|5.031010||Viu UNI_ideo_values_index|5.029009||Viu UNI_idsb_values_index|5.029009||Viu UNI_idst_values_index|5.029009||Viu UNI_ids_values_index|5.029009||Viu UNI_inpc_values_index|5.029009||Viu UNI_insc_values_index|5.029009||Viu UNI_in_values_index|5.029009||Viu UNI_IS_INVARIANT|5.007001||Viu UNI_jg_values_index|5.029009||Viu UNI_joinc_values_index|5.029009||Viu UNI_jt_values_index|5.029009||Viu UNI_L|5.029002||Viu UNI_L_AMP|5.029002||Viu UNI_LB__SG|5.029002||Viu UNI_lb_values_index|5.029009||Viu UNI_LC|5.029002||Viu UNI_LL|5.029002||Viu UNI_loe_values_index|5.029009||Viu UNI_LOWER|5.029002||Viu UNI_LOWERCASE|5.029002||Viu UNI_lower_values_index|5.029009||Viu UNI_LT|5.029002||Viu UNI_LU|5.029002||Viu UNI_math_values_index|5.029009||Viu UNI_nchar_values_index|5.029009||Viu UNI_ND|5.029002||Viu UNI_nfcqc_values_index|5.029009||Viu UNI_nfdqc_values_index|5.029009||Viu UNI_nfkcqc_values_index|5.029009||Viu UNI_nfkdqc_values_index|5.029009||Viu UNI_nt_values_index|5.029009||Viu UNI_nv_values_index|5.029009||Viu UNI_patsyn_values_index|5.029009||Viu UNI_patws_values_index|5.029009||Viu UNI_pcm_values_index|5.029009||Viu UNI_PERLSPACE|5.029002||Viu UNI_PERLWORD|5.029002||Viu UNI_PRINT|5.029002||Viu UNI_qmark_values_index|5.029009||Viu UNI_radical_values_index|5.029009||Viu UNI_ri_values_index|5.029009||Viu UNI_sb_values_index|5.029009||Viu UNI_sc_values_index|5.029009||Viu UNI_scx_values_index|5.029009||Viu UNI_sd_values_index|5.029009||Viu UNISKIP|5.007001||Viu UNISKIP_BY_MSB|5.035004||Viu UNI_SPACE|5.029002||Viu UNI_SPACEPERL|5.029002||Viu UNI_sterm_values_index|5.029009||Viu UNI_term_values_index|5.029009||Viu UNI_TITLECASE|5.029002||Viu UNI_TITLECASELETTER|5.029002||Viu UNI_TO_NATIVE|5.007001|5.003007|p UNI_uideo_values_index|5.029009||Viu UNI_UPPER|5.029002||Viu UNI_UPPERCASE|5.029002||Viu UNI_upper_values_index|5.029009||Viu UNI_vo_values_index|5.029009||Viu UNI_vs_values_index|5.029009||Viu UNI_wb_values_index|5.029009||Viu UNI_WHITESPACE|5.029002||Viu UNI_WORD|5.029002||Viu UNI_WSPACE|5.029002||Viu UNI_wspace_values_index|5.029009||Viu UNI_XDIGIT|5.029002||Viu UNI_xidc_values_index|5.029009||Viu UNI_xids_values_index|5.029009||Viu UNI_XPERLSPACE|5.029002||Viu UNKNOWN_ERRNO_MSG|5.019007||Viu UNLESSM|5.003007||Viu UNLESSM_t8|5.035004||Viu UNLESSM_t8_p8|5.033003||Viu UNLESSM_t8_pb|5.033003||Viu UNLESSM_tb|5.035004||Viu UNLESSM_tb_p8|5.033003||Viu UNLESSM_tb_pb|5.033003||Viu UNLIKELY|5.009004|5.003007|p UNLINK|5.003007||Viu unlink|5.005000||Viu unlnk|5.003007||cVu UNLOCK_DOLLARZERO_MUTEX|5.008001||Viu UNLOCK_LC_NUMERIC_STANDARD|5.021010||poVnu UNLOCK_NUMERIC_STANDARD|||piu UNOP_AUX_item_sv|5.021007||Viu unpack_rec|5.008001||Viu unpack_str|5.007003|5.007003|d unpackstring|5.008001|5.008001| unpackWARN1|5.007003||Viu unpackWARN2|5.007003||Viu unpackWARN3|5.007003||Viu unpackWARN4|5.007003||Viu unreferenced_to_tmp_stack|5.013002||Viu unshare_hek|5.004000||Viu unshare_hek_or_pvn|5.008000||Viu unsharepvn|5.003007|5.003007|u unwind_handler_stack|5.009003||Viu update_debugger_info|5.009005||Viu upg_version|5.009005|5.009005| UPG_VERSION|5.019008||Viu uproot_SV|||Viu Uquad_t|5.006000|5.006000|Vn U_S|5.003007||Viu usage|5.005000||Viu USE_64_BIT_ALL|5.006000|5.006000|Vn USE_64_BIT_INT|5.006000|5.006000|Vn USE_64_BIT_RAWIO|5.006000||Viu USE_64_BIT_STDIO|5.006000||Viu USE_BSDPGRP|5.003007||Viu USE_C_BACKTRACE|5.035009|5.035009|Vn USE_DYNAMIC_LOADING|5.003007|5.003007|Vn USE_ENVIRON_ARRAY|5.007001||Viu USE_GRENT_BUFFER|5.008000||Viu USE_GRENT_FPTR|5.008000||Viu USE_GRENT_PTR|5.008000||Viu USE_HASH_SEED|5.008001||Viu USE_HOSTENT_BUFFER|5.008000||Viu USE_HOSTENT_ERRNO|5.008000||Viu USE_HOSTENT_PTR|5.008000||Viu USE_ITHREADS|5.010000|5.010000|Vn USE_LARGE_FILES|5.006000|5.006000|Vn USE_LEFT|5.004000||Viu USE_LOCALE|5.004000||Viu USE_LOCALE_ADDRESS|5.027009||Viu USE_LOCALE_COLLATE|5.004000||Viu USE_LOCALE_CTYPE|5.004000||Viu USE_LOCALE_IDENTIFICATION|5.027009||Viu USE_LOCALE_MEASUREMENT|5.027009||Viu USE_LOCALE_MESSAGES|5.019002||Viu USE_LOCALE_MONETARY|5.019002||Viu USE_LOCALE_NUMERIC|5.004000||Viu USE_LOCALE_PAPER|5.027009||Viu USE_LOCALE_SYNTAX|5.033001||Viu USE_LOCALE_TELEPHONE|5.027009||Viu USE_LOCALE_TIME|5.021002||Viu USE_LOCALE_TOD|5.033001||Viu USEMYBINMODE|5.006000||Viu USE_NETENT_BUFFER|5.008000||Viu USE_NETENT_ERRNO|5.008000||Viu USE_NETENT_PTR|5.008000||Viu USE_PERL_ATOF|5.008000||Viu USE_PERLIO|5.007001|5.007001|Vn USE_PERL_PERTURB_KEYS|5.018000||Viu USE_POSIX_2008_LOCALE|5.027003||Viu USE_PROTOENT_BUFFER|5.008000||Viu USE_PROTOENT_PTR|5.008000||Viu USE_PWENT_BUFFER|5.008000||Viu USE_PWENT_FPTR|5.008000||Viu USE_PWENT_PTR|5.008000||Viu USE_REENTRANT_API|5.007003||Viu USER_PROP_MUTEX_INIT|5.029008||Viu USER_PROP_MUTEX_LOCK|5.029008||Viu USER_PROP_MUTEX_TERM|5.029008||Viu USER_PROP_MUTEX_UNLOCK|5.029008||Viu USE_SEMCTL_SEMID_DS|5.004005|5.004005|Vn USE_SEMCTL_SEMUN|5.004005|5.004005|Vn USE_SERVENT_BUFFER|5.008000||Viu USE_SERVENT_PTR|5.008000||Viu USE_SPENT_BUFFER|5.031011||Viu USE_SPENT_PTR|5.008000||Viu USE_STAT_BLOCKS|5.005003|5.005003|Vn USE_STAT_RDEV|5.003007||Viu USE_STDIO|5.003007||Viu USE_STDIO_BASE|5.006000|5.006000|Vn USE_STDIO_PTR|5.006000|5.006000|Vn USE_SYSTEM_GMTIME|5.011000||Viu USE_SYSTEM_LOCALTIME|5.011000||Viu USE_THREADS|5.006000|5.006000|Vn USE_THREAD_SAFE_LOCALE|5.025004||Viu USE_TM64|5.011000||Viu USE_UTF8_IN_NAMES|5.007003||Viu utf16_textfilter|5.011001||Viu utf16_to_utf8|5.035004||cViu utf16_to_utf8_base|5.035004||cViu utf16_to_utf8_reversed|5.035004||cViu UTF8_ACCUMULATE|5.007001||Viu UTF8_ALLOW_ANY|5.007001||Viu UTF8_ALLOW_ANYUV|5.007001||Viu UTF8_ALLOW_CONTINUATION|5.007001||Viu UTF8_ALLOW_DEFAULT|5.009004||Viu UTF8_ALLOW_EMPTY|5.007001||Viu UTF8_ALLOW_FE_FF|5.027009||Viu UTF8_ALLOW_FFFF|5.007001||Viu UTF8_ALLOW_LONG|5.007001||Viu UTF8_ALLOW_LONG_AND_ITS_VALUE|5.025009||Viu UTF8_ALLOW_NON_CONTINUATION|5.007001||Viu UTF8_ALLOW_OVERFLOW|5.025009||Viu UTF8_ALLOW_SHORT|5.007001||Viu UTF8_ALLOW_SURROGATE|5.007001||Viu UTF8_CHECK_ONLY|5.007001|5.007001| UTF8_CHK_SKIP|5.031006|5.006000|p UTF8_DISALLOW_ABOVE_31_BIT|5.023006||Viu UTF8_DISALLOW_FE_FF|5.013009||Viu UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE|5.025005|5.025005| UTF8_DISALLOW_ILLEGAL_INTERCHANGE|5.013009|5.013009| UTF8_DISALLOW_NONCHAR|5.013009|5.013009| UTF8_DISALLOW_PERL_EXTENDED|5.027002|5.027002| UTF8_DISALLOW_SUPER|5.013009|5.013009| UTF8_DISALLOW_SURROGATE|5.013009|5.013009| utf8_distance|5.006000|5.006000| UTF8_EIGHT_BIT_HI|5.007001||Viu UTF8_EIGHT_BIT_LO|5.007001||Viu UTF8f|5.019001|5.003007|p UTF8fARG|5.019002|5.003007|p UTF8_GOT_ABOVE_31_BIT|5.025006||Viu UTF8_GOT_CONTINUATION|5.025006|5.025006| UTF8_GOT_EMPTY|5.025006|5.025006| UTF8_GOT_LONG|5.025006|5.025006| UTF8_GOT_NONCHAR|5.025006|5.025006| UTF8_GOT_NON_CONTINUATION|5.025006|5.025006| UTF8_GOT_OVERFLOW|5.025006|5.025006| UTF8_GOT_PERL_EXTENDED|5.027002|5.027002| UTF8_GOT_SHORT|5.025006|5.025006| UTF8_GOT_SUPER|5.025006|5.025006| UTF8_GOT_SURROGATE|5.025006|5.025006| utf8_hop|5.006000|5.006000|n utf8_hop_back|5.025007|5.025007|n utf8_hop_forward|5.025007|5.025007|n utf8_hop_safe|5.025007|5.025007|n UTF8_IS_ABOVE_LATIN1|5.017004||Viu UTF8_IS_ABOVE_LATIN1_START|5.023003||Viu UTF8_IS_CONTINUATION|5.007001||Viu UTF8_IS_CONTINUED|5.007001||Viu UTF8_IS_DOWNGRADEABLE_START|5.007001||Viu UTF8_IS_INVARIANT|5.007001|5.003007|p UTF8_IS_NEXT_CHAR_DOWNGRADEABLE|5.017006||Viu UTF8_IS_NONCHAR|5.023002|5.023002| UTF8_IS_NONCHAR_GIVEN_THAT_NON_SUPER_AND_GE_PROBLEMATIC|5.013009||Viu UTF8_IS_PERL_EXTENDED|5.035004||Viu UTF8_IS_REPLACEMENT||| UTF8_IS_START|5.007001||Viu UTF8_IS_START_base|5.031007||Viu UTF8_IS_SUPER|5.023002|5.023002| UTF8_IS_SURROGATE|5.023002|5.023002| utf8_length|5.007001|5.007001| UTF8_MAXBYTES|5.009002|5.006000|p UTF8_MAXBYTES_CASE|5.009002|5.003007|p UTF8_MAX_FOLD_CHAR_EXPAND|5.013009||Viu UTF8_MAXLEN|5.006000||Viu utf8_mg_len_cache_update|5.013003||Viu utf8_mg_pos_cache_update|5.009004||Viu utf8n_to_uvchr|5.007001|5.007001|n utf8n_to_uvchr_error|5.025006|5.025006|n utf8n_to_uvchr_msgs|5.027009|5.027009|n _utf8n_to_uvchr_msgs_helper|5.029001||cVnu utf8n_to_uvuni|5.007001||dcV UTF8_SAFE_SKIP|5.029009|5.006000|p UTF8SKIP|5.006000|5.006000| UTF8_SKIP|5.023002|5.006000|p utf8_to_bytes|5.006001|5.006001|x utf8_to_utf16|5.035004||Viu utf8_to_utf16_base|5.035004||xcViu utf8_to_utf16_reversed|5.035004||Viu utf8_to_uvchr|5.007001|5.006001|pd utf8_to_uvchr_buf|5.015009|5.006001|p utf8_to_uvchr_buf_helper|5.031004||cVu utf8_to_uvuni|5.007001||dcV utf8_to_uvuni_buf|5.015009||dcV UTF8_TWO_BYTE_HI|5.011002||Viu UTF8_TWO_BYTE_HI_nocast|5.011002||Viu UTF8_TWO_BYTE_LO|5.011002||Viu UTF8_TWO_BYTE_LO_nocast|5.011002||Viu UTF8_WARN_ABOVE_31_BIT|5.023006||Viu UTF8_WARN_FE_FF|5.013009||Viu UTF8_WARN_ILLEGAL_C9_INTERCHANGE|5.025005|5.025005| UTF8_WARN_ILLEGAL_INTERCHANGE|5.013009|5.013009| UTF8_WARN_NONCHAR|5.013009|5.013009| UTF8_WARN_PERL_EXTENDED|5.027002|5.027002| UTF8_WARN_SUPER|5.013009|5.013009| UTF8_WARN_SURROGATE|5.013009|5.013009| UTF_ACCUMULATION_SHIFT|5.007001||Viu UTF_CONTINUATION_BYTE_INFO_BITS|5.035004||Viu UTF_CONTINUATION_MARK|5.007001||Viu UTF_CONTINUATION_MASK|5.007001||Viu UTF_EBCDIC_CONTINUATION_BYTE_INFO_BITS|5.035004||Viu UTF_FIRST_CONT_BYTE_110000|5.035004||Viu UTF_FIRST_CONT_BYTE|5.035004||Viu UTF_IS_CONTINUATION_MASK|5.023006||Viu UTF_MIN_ABOVE_LATIN1_BYTE|5.031006||Viu UTF_MIN_CONTINUATION_BYTE|5.035004||Viu UTF_MIN_START_BYTE|5.031006||Viu UTF_START_BYTE_110000|5.035004||Viu UTF_START_BYTE|5.035004||Viu UTF_START_MARK|5.007001||Viu UTF_START_MASK|5.007001||Viu UTF_TO_NATIVE|5.007001||Viu utilize|5.003007||Viu utime|5.005000||Viu U_V|5.006000|5.003007| UVCHR_IS_INVARIANT|5.019004|5.003007|p UVCHR_SKIP|5.022000|5.003007|p uvchr_to_utf8|5.007001|5.007001| uvchr_to_utf8_flags|5.007003|5.007003| uvchr_to_utf8_flags_msgs|5.027009|5.027009| UV_DIG|5.006000||Viu UVf|5.010000|5.010000|d UV_IS_QUAD|5.006000||Viu UV_MAX|5.003007|5.003007| UV_MAX_P1|5.007002||Viu UV_MAX_P1_HALF|5.007002||Viu UV_MIN|5.003007|5.003007| UVof|5.006000|5.003007|poVn uvoffuni_to_utf8_flags|5.027009||cV uvoffuni_to_utf8_flags_msgs|5.027009||cVu UVSIZE|5.006000|5.003007|poVn UVTYPE|5.006000|5.003007|poVn UVuf|5.006000|5.003007|poVn uvuni_to_utf8|5.019004||cVu uvuni_to_utf8_flags|5.007003||dcV UVxf|5.006000|5.003007|poVn UVXf|5.007001|5.007001|poVn VAL_EAGAIN|5.003007|5.003007|Vn validate_proto|5.019002||xcVi validate_suid|||iu valid_utf8_to_uvchr|5.015009||cVn valid_utf8_to_uvuni|5.015009||dcVu VAL_O_NONBLOCK|5.003007|5.003007|Vn variant_byte_number|5.031004||cVnu variant_under_utf8_count|5.027007||Vni varname|5.009003||Viu vcmp|5.009000|5.009000| VCMP|5.019008||Viu vcroak|5.006000|5.006000| vdeb|5.007003|5.007003|u VERB|5.009005||Viu VERB_t8|5.035004||Viu VERB_t8_p8|5.033003||Viu VERB_t8_pb|5.033003||Viu VERB_tb|5.035004||Viu VERB_tb_p8|5.033003||Viu VERB_tb_pb|5.033003||Viu vform|5.006000|5.006000| vfprintf|5.003007||Viu visit|5.005000||Viu vivify_defelem|5.004000||cViu vivify_ref|5.004000||Viu vload_module|5.006000|5.003007|p vmess|5.006000|5.004000|p vnewSVpvf|5.006000|5.004000|p vnormal|5.009002|5.009002| VNORMAL|5.019008||Viu vnumify|5.009000|5.009000| VNUMIFY|5.019008||Viu voidnonfinal|5.035002||Viu VOL|5.003007||Viu vstringify|5.009000|5.009000| VSTRINGIFY|5.019008||Viu VTBL_amagic|5.005003||Viu VTBL_amagicelem|5.005003||Viu VTBL_arylen|5.005003||Viu VTBL_bm|5.005003||Viu VTBL_collxfrm|5.005003||Viu VTBL_dbline|5.005003||Viu VTBL_defelem|5.005003||Viu VTBL_env|5.005003||Viu VTBL_envelem|5.005003||Viu VTBL_fm|5.005003||Viu VTBL_glob|5.005003||Viu VTBL_isa|5.005003||Viu VTBL_isaelem|5.005003||Viu VTBL_mglob|5.005003||Viu VTBL_nkeys|5.005003||Viu VTBL_pack|5.005003||Viu VTBL_packelem|5.005003||Viu VTBL_pos|5.005003||Viu VTBL_regdata|5.006000||Viu VTBL_regdatum|5.006000||Viu VTBL_regexp|5.005003||Viu VTBL_sigelem|5.005003||Viu VTBL_substr|5.005003||Viu VTBL_sv|5.005003||Viu VTBL_taint|5.005003||Viu VTBL_uvar|5.005003||Viu VTBL_vec|5.005003||Viu vTHX|5.006000||Viu VT_NATIVE|5.021004||Viu vtohl|5.003007||Viu vtohs|5.003007||Viu VUTIL_REPLACE_CORE|5.019008||Viu vverify|5.009003|5.009003| VVERIFY|5.019008||Viu vwarn|5.006000|5.003007| vwarner|5.006000|5.004000|p wait4pid|5.003007||Viu wait|5.005000||Viu want_vtbl_bm|5.015000||Viu want_vtbl_fm|5.015000||Viu warn|5.003007||vV WARN_ALL|5.006000|5.003007|p WARN_ALLstring|5.006000||Viu WARN_AMBIGUOUS|5.006000|5.003007|p WARN_ASSERTIONS||5.003007|ponu WARN_BAREWORD|5.006000|5.003007|p WARN_CLOSED|5.006000|5.003007|p WARN_CLOSURE|5.006000|5.003007|p WARN_DEBUGGING|5.006000|5.003007|p WARN_DEPRECATED|5.006000|5.003007|p WARN_DIGIT|5.006000|5.003007|p warner|5.006000||pvV warner_nocontext|5.006000||vVn WARN_EXEC|5.006000|5.003007|p WARN_EXITING|5.006000|5.003007|p WARN_EXPERIMENTAL|5.017004|5.017004| WARN_EXPERIMENTAL__ALPHA_ASSERTIONS|5.027009|5.027009| WARN_EXPERIMENTAL__ARGS_ARRAY_WITH_SIGNATURES|5.035009|5.035009| WARN_EXPERIMENTAL__BITWISE|5.021009|5.021009| WARN_EXPERIMENTAL__BUILTIN|5.035009|5.035009| WARN_EXPERIMENTAL__CONST_ATTR|5.021008|5.021008| WARN_EXPERIMENTAL__DECLARED_REFS|5.025003|5.025003| WARN_EXPERIMENTAL__DEFER|5.035004|5.035004| WARN_EXPERIMENTAL__FOR_LIST|5.035005|5.035005| WARN_EXPERIMENTAL__ISA|5.031007|5.031007| WARN_EXPERIMENTAL__LEXICAL_SUBS|5.017005|5.017005| WARN_EXPERIMENTAL__POSTDEREF|5.019005|5.019005| WARN_EXPERIMENTAL__PRIVATE_USE|5.029009|5.029009| WARN_EXPERIMENTAL__REFALIASING|5.021005|5.021005| WARN_EXPERIMENTAL__REGEX_SETS|5.017008|5.017008| WARN_EXPERIMENTAL__RE_STRICT|5.021008|5.021008| WARN_EXPERIMENTAL__SCRIPT_RUN|5.027008|5.027008| WARN_EXPERIMENTAL__SIGNATURES|5.019009|5.019009| WARN_EXPERIMENTAL__SMARTMATCH|5.017011|5.017011| WARN_EXPERIMENTAL__TRY|5.033007|5.033007| WARN_EXPERIMENTAL__UNIPROP_WILDCARDS|5.029009|5.029009| WARN_EXPERIMENTAL__VLB|5.029009|5.029009| WARN_GLOB|5.006000|5.003007|p WARN_ILLEGALPROTO|5.011004|5.011004| WARN_IMPRECISION|5.011000|5.011000| WARN_INPLACE|5.006000|5.003007|p WARN_INTERNAL|5.006000|5.003007|p WARN_IO|5.006000|5.003007|p WARN_LAYER|5.008000|5.003007|p WARN_LOCALE|5.021006|5.021006| WARN_MALLOC|5.006000|5.003007|p WARN_MISC|5.006000|5.003007|p WARN_MISSING|5.021002|5.021002| WARN_NEWLINE|5.006000|5.003007|p warn_nocontext|5.006000||pvVn WARN_NONCHAR|5.013010|5.013010| WARN_NONEstring|5.006000||Viu WARN_NON_UNICODE|5.013010|5.013010| WARN_NUMERIC|5.006000|5.003007|p WARN_ONCE|5.006000|5.003007|p warn_on_first_deprecated_use|5.025009||Viu WARN_OVERFLOW|5.006000|5.003007|p WARN_PACK|5.006000|5.003007|p WARN_PARENTHESIS|5.006000|5.003007|p WARN_PIPE|5.006000|5.003007|p WARN_PORTABLE|5.006000|5.003007|p WARN_PRECEDENCE|5.006000|5.003007|p WARN_PRINTF|5.006000|5.003007|p _warn_problematic_locale|5.021008||cVniu WARN_PROTOTYPE|5.006000|5.003007|p WARN_QW|5.006000|5.003007|p WARN_RECURSION|5.006000|5.003007|p WARN_REDEFINE|5.006000|5.003007|p WARN_REDUNDANT|5.021002|5.021002| WARN_REGEXP|5.006000|5.003007|p WARN_RESERVED|5.006000|5.003007|p WARN_SEMICOLON|5.006000|5.003007|p WARN_SEVERE|5.006000|5.003007|p WARN_SHADOW|5.027007|5.027007| WARNshift|5.011001||Viu WARN_SIGNAL|5.006000|5.003007|p WARNsize|5.006000||Viu WARN_SUBSTR|5.006000|5.003007|p WARN_SURROGATE|5.013010|5.013010| warn_sv|5.013001|5.003007|p WARN_SYNTAX|5.006000|5.003007|p WARN_SYSCALLS|5.019004|5.019004| WARN_TAINT|5.006000|5.003007|p WARN_THREADS|5.008000|5.003007|p WARN_UNINITIALIZED|5.006000|5.003007|p WARN_UNOPENED|5.006000|5.003007|p WARN_UNPACK|5.006000|5.003007|p WARN_UNTIE|5.006000|5.003007|p WARN_UTF8|5.006000|5.003007|p WARN_VOID|5.006000|5.003007|p was_lvalue_sub|||ciu watch|5.003007||Viu WB_BREAKABLE|5.023008||Viu WB_DQ_then_HL|5.023008||Viu WB_Ex_or_FO_or_ZWJ_then_foo|5.025003||Viu WB_HL_then_DQ|5.023008||Viu WB_hs_then_hs|5.023008||Viu WB_LE_or_HL_then_MB_or_ML_or_SQ|5.023008||Viu WB_MB_or_ML_or_SQ_then_LE_or_HL|5.023008||Viu WB_MB_or_MN_or_SQ_then_NU|5.023008||Viu WB_NOBREAK|5.023008||Viu WB_NU_then_MB_or_MN_or_SQ|5.023008||Viu WB_RI_then_RI|5.025003||Viu WCTOMB_LOCK|5.033005||Viu WCTOMB_UNLOCK|5.033005||Viu what_MULTI_CHAR_FOLD_latin1_safe|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part0|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part1|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part2|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part3|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part4|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part5|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part6|5.033005||Viu what_MULTI_CHAR_FOLD_utf8_safe_part7|5.033005||Viu whichsig|5.003007|5.003007| whichsig_pv|5.015004|5.015004| whichsig_pvn|5.015004|5.015004| whichsig_sv|5.015004|5.015004| WHILEM|5.003007||Viu WHILEM_A_max|5.009005||Viu WHILEM_A_max_fail|5.009005||Viu WHILEM_A_max_fail_t8|5.035004||Viu WHILEM_A_max_fail_t8_p8|5.033003||Viu WHILEM_A_max_fail_t8_pb|5.033003||Viu WHILEM_A_max_fail_tb|5.035004||Viu WHILEM_A_max_fail_tb_p8|5.033003||Viu WHILEM_A_max_fail_tb_pb|5.033003||Viu WHILEM_A_max_t8|5.035004||Viu WHILEM_A_max_t8_p8|5.033003||Viu WHILEM_A_max_t8_pb|5.033003||Viu WHILEM_A_max_tb|5.035004||Viu WHILEM_A_max_tb_p8|5.033003||Viu WHILEM_A_max_tb_pb|5.033003||Viu WHILEM_A_min|5.009005||Viu WHILEM_A_min_fail|5.009005||Viu WHILEM_A_min_fail_t8|5.035004||Viu WHILEM_A_min_fail_t8_p8|5.033003||Viu WHILEM_A_min_fail_t8_pb|5.033003||Viu WHILEM_A_min_fail_tb|5.035004||Viu WHILEM_A_min_fail_tb_p8|5.033003||Viu WHILEM_A_min_fail_tb_pb|5.033003||Viu WHILEM_A_min_t8|5.035004||Viu WHILEM_A_min_t8_p8|5.033003||Viu WHILEM_A_min_t8_pb|5.033003||Viu WHILEM_A_min_tb|5.035004||Viu WHILEM_A_min_tb_p8|5.033003||Viu WHILEM_A_min_tb_pb|5.033003||Viu WHILEM_A_pre|5.009005||Viu WHILEM_A_pre_fail|5.009005||Viu WHILEM_A_pre_fail_t8|5.035004||Viu WHILEM_A_pre_fail_t8_p8|5.033003||Viu WHILEM_A_pre_fail_t8_pb|5.033003||Viu WHILEM_A_pre_fail_tb|5.035004||Viu WHILEM_A_pre_fail_tb_p8|5.033003||Viu WHILEM_A_pre_fail_tb_pb|5.033003||Viu WHILEM_A_pre_t8|5.035004||Viu WHILEM_A_pre_t8_p8|5.033003||Viu WHILEM_A_pre_t8_pb|5.033003||Viu WHILEM_A_pre_tb|5.035004||Viu WHILEM_A_pre_tb_p8|5.033003||Viu WHILEM_A_pre_tb_pb|5.033003||Viu WHILEM_B_max|5.009005||Viu WHILEM_B_max_fail|5.009005||Viu WHILEM_B_max_fail_t8|5.035004||Viu WHILEM_B_max_fail_t8_p8|5.033003||Viu WHILEM_B_max_fail_t8_pb|5.033003||Viu WHILEM_B_max_fail_tb|5.035004||Viu WHILEM_B_max_fail_tb_p8|5.033003||Viu WHILEM_B_max_fail_tb_pb|5.033003||Viu WHILEM_B_max_t8|5.035004||Viu WHILEM_B_max_t8_p8|5.033003||Viu WHILEM_B_max_t8_pb|5.033003||Viu WHILEM_B_max_tb|5.035004||Viu WHILEM_B_max_tb_p8|5.033003||Viu WHILEM_B_max_tb_pb|5.033003||Viu WHILEM_B_min|5.009005||Viu WHILEM_B_min_fail|5.009005||Viu WHILEM_B_min_fail_t8|5.035004||Viu WHILEM_B_min_fail_t8_p8|5.033003||Viu WHILEM_B_min_fail_t8_pb|5.033003||Viu WHILEM_B_min_fail_tb|5.035004||Viu WHILEM_B_min_fail_tb_p8|5.033003||Viu WHILEM_B_min_fail_tb_pb|5.033003||Viu WHILEM_B_min_t8|5.035004||Viu WHILEM_B_min_t8_p8|5.033003||Viu WHILEM_B_min_t8_pb|5.033003||Viu WHILEM_B_min_tb|5.035004||Viu WHILEM_B_min_tb_p8|5.033003||Viu WHILEM_B_min_tb_pb|5.033003||Viu WHILEM_t8|5.035004||Viu WHILEM_t8_p8|5.033003||Viu WHILEM_t8_pb|5.033003||Viu WHILEM_tb|5.035004||Viu WHILEM_tb_p8|5.033003||Viu WHILEM_tb_pb|5.033003||Viu WIDEST_UTYPE|5.015004|5.003007|poVnu win32_croak_not_implemented|5.017006||Vniu WIN32SCK_IS_STDSCK|5.007001||Viu win32_setlocale|5.027006||Viu withinCOUNT|5.031004||Viu withinCOUNT_KNOWN_VALID|5.033005||Viu WITH_LC_NUMERIC_SET_TO_NEEDED|5.031003|5.031003| WITH_LC_NUMERIC_SET_TO_NEEDED_IN|5.031003|5.031003| with_queued_errors|5.013001||Viu with_tp_UTF8ness|5.033003||Viu with_t_UTF8ness|5.035004||Viu wrap_keyword_plugin|5.027006|5.027006|x wrap_op_checker|5.015008|5.015008| write|5.005000||Viu write_to_stderr|5.008001||Viu XCPT_CATCH|5.009002|5.003007|p XCPT_RETHROW|5.009002|5.003007|p XCPT_TRY_END|5.009002|5.003007|p XCPT_TRY_START|5.009002|5.003007|p XDIGIT_VALUE|5.019008||Viu xio_any|5.006001||Viu xio_dirp|5.006001||Viu xiv_iv|5.009003||Viu xlv_targoff|5.019004||Viu XopDISABLE|5.013007|5.013007|V XOPd_xop_class|5.013007||Viu XOPd_xop_desc|5.013007||Viu XOPd_xop_name|5.013007||Viu XOPd_xop_peep|5.013007||Viu XopENABLE|5.013007|5.013007|V XopENTRY|5.013007|5.013007|V XopENTRYCUSTOM|5.019006|5.013007|V XopENTRY_set|5.013007|5.013007|V XopFLAGS|5.013007|5.013007| XOPf_xop_class|5.013007||Viu XOPf_xop_desc|5.013007||Viu XOPf_xop_name|5.013007||Viu XOPf_xop_peep|5.013007||Viu XORSHIFT128_set|5.027001||Viu XORSHIFT96_set|5.027001||Viu XPUSHi|5.003007|5.003007| XPUSHmortal|5.009002|5.003007|p XPUSHn|5.006000|5.003007| XPUSHp|5.003007|5.003007| XPUSHs|5.003007|5.003007| XPUSHTARG|5.003007||Viu XPUSHu|5.004000|5.003007|p XPUSHundef|5.006000||Viu xpv_len|5.017006||Viu XS|5.003007|5.003007|Vu XSANY|5.003007||Viu XS_APIVERSION_BOOTCHECK|5.013004|5.013004| XS_APIVERSION_POPMARK_BOOTCHECK|5.021006||Viu XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK|5.021006||Viu xs_boot_epilog|5.021006||cViu XS_BOTHVERSION_BOOTCHECK|5.021006||Viu XS_BOTHVERSION_POPMARK_BOOTCHECK|5.021006||Viu XS_BOTHVERSION_SETXSUBFN_POPMARK_BOOTCHECK|5.021006||Viu XS_DYNAMIC_FILENAME|5.009004||Viu XS_EXTERNAL|5.015002|5.015002|Vu xs_handshake|||vcniu XSINTERFACE_CVT|5.005000||Viu XSINTERFACE_CVT_ANON|5.010000||Viu XSINTERFACE_FUNC|5.005000||Viu XSINTERFACE_FUNC_SET|5.005000||Viu XS_INTERNAL|5.015002|5.015002|Vu XSprePUSH|5.006000|5.003007|poVnu XSPROTO|5.010000|5.003007|pVu XSRETURN|5.003007|5.003007|p XSRETURN_EMPTY|5.003007|5.003007| XSRETURN_IV|5.003007|5.003007| XSRETURN_NO|5.003007|5.003007| XSRETURN_NV|5.006000|5.003007| XSRETURN_PV|5.003007|5.003007| XSRETURN_PVN|5.006000||Viu XSRETURN_UNDEF|5.003007|5.003007| XSRETURN_UV|5.008001|5.003007|p XSRETURN_YES|5.003007|5.003007| XS_SETXSUBFN_POPMARK|5.021006||Viu XST_mIV|5.003007|5.003007| XST_mNO|5.003007|5.003007| XST_mNV|5.006000|5.003007| XST_mPV|5.003007|5.003007| XST_mPVN|5.006000||Viu XST_mUNDEF|5.003007|5.003007| XST_mUV|5.008001|5.003007|p XST_mYES|5.003007|5.003007| XS_VERSION|5.003007|5.003007| XS_VERSION_BOOTCHECK|5.003007|5.003007| xs_version_bootcheck|||iu XTENDED_PAT_MOD|5.009005||Viu xuv_uv|5.009003||Viu YESEXPR|5.027010||Viu YESSTR|5.027010||Viu YIELD|5.005000||Viu YYDEBUG|5.025006||Viu YYEMPTY|5.009005||Viu yyerror|5.003007||Viu yyerror_pv|5.016000||Viu yyerror_pvn|5.016000||Viu yylex|5.003007||cViu yyparse|5.003007||Viu yyquit|5.025010||Viu YYSTYPE_IS_DECLARED|5.009001||Viu YYSTYPE_IS_TRIVIAL|5.009001||Viu YYTOKENTYPE|5.009001||Viu yyunlex|5.013005||Viu yywarn|5.003007||Viu ZAPHOD32_FINALIZE|5.027001||Viu ZAPHOD32_MIX|5.027001||Viu ZAPHOD32_SCRAMBLE32|5.027001||Viu ZAPHOD32_STATIC_INLINE|5.027001||Viu ZAPHOD32_WARN2|5.027001||Viu ZAPHOD32_WARN3|5.027001||Viu ZAPHOD32_WARN4|5.027001||Viu ZAPHOD32_WARN5|5.027001||Viu ZAPHOD32_WARN6|5.027001||Viu Zero|5.003007|5.003007| ZeroD|5.009002|5.003007|p ); if (exists $opt{'list-unsupported'}) { my $f; for $f (sort dictionary_order keys %API) { next if $API{$f}{core_only}; next if $API{$f}{beyond_depr}; next if $API{$f}{inaccessible}; next if $API{$f}{experimental}; next unless $API{$f}{todo}; next if int_parse_version($API{$f}{todo}) <= $int_min_perl; my $repeat = 40 - length($f); $repeat = 0 if $repeat < 0; print "$f ", '.'x $repeat, " ", format_version($API{$f}{todo}), "\n"; } exit 0; } # Scan for hints, possible replacement candidates, etc. my(%replace, %need, %hints, %warnings, %depends); my $replace = 0; my($hint, $define, $function); sub find_api { BEGIN { 'warnings'->unimport('uninitialized') if "$]" > '5.006' } my $code = shift; $code =~ s{ / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) | "[^"\\]*(?:\\.[^"\\]*)*" | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx; grep { exists $API{$_} } $code =~ /(\w+)/mg; } while () { if ($hint) { # Here, we are in the middle of accumulating a hint or warning. my $end_of_hint = 0; # A line containing a comment end marker closes the hint. Remove that # marker for processing below. if (s/\s*$rcce(.*?)\s*$//) { die "Nothing can follow the end of comment in '$_'\n" if length $1 > 0; $end_of_hint = 1; } # Set $h to the hash of which type. my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; # Ignore any leading and trailing white space, and an optional star comment # continuation marker, then place the meat of the line into $1 m/^\s*(?:\*\s*)?(.*?)\s*$/; # Add the meat of this line to the hash value of each API element it # applies to for (@{$hint->[1]}) { $h->{$_} ||= ''; # avoid the warning older perls generate $h->{$_} .= "$1\n"; } # If the line had a comment close, we are through with this hint undef $hint if $end_of_hint; next; } # Set up $hint if this is the beginning of a Hint: or Warning: # These are from a multi-line C comment in the file, with the first line # looking like (a space has been inserted because this file can't have C # comment markers in it): # / * Warning: PL_expect, PL_copline, PL_rsfp # # $hint becomes # [ # 'Warning', # [ # 'PL_expect', # 'PL_copline', # 'PL_rsfp', # ], # ] if (m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}) { $hint = [$1, [split /,?\s+/, $2]]; next; } if ($define) { # If in the middle of a definition... # append a continuation line ending with backslash. if ($define->[1] =~ /\\$/) { $define->[1] .= $_; } else { # Otherwise this line ends the definition, make foo depend on bar # (and what bar depends on) if its not one of ppp's own constructs if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { my @n = find_api($define->[1]); push @{$depends{$define->[0]}}, @n if @n } undef $define; } } # For '#define foo bar' or '#define foo(a,b,c) bar', $define becomes a # reference to [ foo, bar ] $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; if ($function) { if (/^}/) { if (exists $API{$function->[0]}) { my @n = find_api($function->[1]); push @{$depends{$function->[0]}}, @n if @n } undef $function; } else { $function->[1] .= $_; } } $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; # Set $replace to the number given for lines that look like # / * Replace: \d+ * / # Thus setting it to 1 starts a region where replacements are automatically # done, and setting it to 0 ends that region. $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; # Add bar => foo to %replace for lines like '#define foo bar in a region # where $replace is non-zero $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; # Add bar => foo to %replace for lines like '#define foo bar / * Replace * / $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; # Add foo => bar to %replace for lines like / * Replace foo with bar * / $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+.*?)\s+$rcce\s*$}; # For lines like / * foo, bar depends on baz, bat * / # create a list of the elements on the rhs, and make that list apply to each # element in the lhs, which becomes a key in \%depends. if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { my @deps = map { s/\s+//g; $_ } split /,/, $3; my $d; for $d (map { s/\s+//g; $_ } split /,/, $1) { push @{$depends{$d}}, @deps; } } $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; } for (values %depends) { my %seen; $_ = [sort dictionary_order grep !$seen{$_}++, @$_]; } if (exists $opt{'api-info'}) { my $f; my $count = 0; my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; # Sort the names, and split into two classes; one for things that are part of # the API; a second for things that aren't. my @ok_to_use; my @shouldnt_use; for $f (sort dictionary_order keys %API) { next unless $f =~ /$match/; my $base = int_parse_version($API{$f}{base}) if $API{$f}{base}; if ($base && ! $API{$f}{inaccessible} && ! $API{$f}{core_only}) { push @ok_to_use, $f; } else { push @shouldnt_use, $f; } } # We normally suppress non-API items. But if the search matched no API # items, output the non-ones. This allows someone to get the info for an # item if they ask for it specifically enough, but doesn't normally clutter # the output with irrelevant results. @ok_to_use = @shouldnt_use unless @ok_to_use; for $f (@ok_to_use) { print "\n=== $f ===\n"; my $info = 0; my $base; $base = int_parse_version($API{$f}{base}) if $API{$f}{base}; my $todo; $todo = int_parse_version($API{$f}{todo}) if $API{$f}{todo}; # Output information if ($base) { my $with_or= ""; if ( $base <= $int_min_perl || ( (! $API{$f}{provided} && ! $todo) || ($todo && $todo >= $base))) { $with_or= " with or"; } my $Supported = ($API{$f}{undocumented}) ? 'Available' : 'Supported'; print "\n$Supported at least since perl-", format_version($base), ",$with_or without $ppport."; if ($API{$f}{unverified}) { print "\nThis information is based on inspection of the source code", " and has not been\n", "verified by successful compilation."; } print "\n"; $info++; } if ($API{$f}{provided} || $todo) { print "\nThis is only supported by $ppport, and NOT by perl versions going forward.\n" unless $base; if ($todo) { if (! $base || $todo < $base) { my $additionally = ""; $additionally .= " additionally" if $base; print "$ppport$additionally provides support at least back to perl-", format_version($todo), ".\n"; } } elsif (! $base || $base > $int_min_perl) { if (exists $depends{$f}) { my $max = 0; for (@{$depends{$f}}) { $max = int_parse_version($API{$_}{todo}) if $API{$_}{todo} && $API{$_}{todo} > $max; # XXX What to assume unspecified values are? This effectively makes them MIN_PERL } $todo = $max if $max; } print "\n$ppport provides support for this, but ironically, does not", " currently know,\n", "for this report, the minimum version it supports for this"; if ($API{$f}{undocumented}) { print " and many things\n", "it provides that are implemented as macros and aren't", " documented. You can\n", "help by submitting a documentation patch"; } print ".\n"; if ($todo) { if ($todo <= $int_min_perl) { print "It may very well be supported all the way back to ", format_version(5.003_07), ".\n"; } else { print "But given the things $f depends on, it's a good", " guess that it isn't\n", "supported prior to ", format_version($todo), ".\n"; } } } } if ($API{$f}{provided}) { print "Support needs to be explicitly requested by #define NEED_$f\n", "(or #define NEED_${f}_GLOBAL).\n" if exists $need{$f}; $info++; } if ($base || ! $API{$f}{ppport_fnc}) { my $email = "Send email to perl5-porters\@perl.org if you need to have this functionality.\n"; if ($API{$f}{inaccessible}) { print "\nThis is not part of the public API, and may not even be accessible to XS code.\n"; $info++; } elsif ($API{$f}{core_only}) { print "\nThis is not part of the public API, and should not be used by XS code.\n"; $info++; } elsif ($API{$f}{deprecated}) { print "\nThis is deprecated and should not be used. Convert existing uses.\n"; $info++; } elsif ($API{$f}{experimental}) { print "\nThe API for this is unstable and should not be used by XS code.\n", $email; $info++; } elsif ($API{$f}{undocumented}) { print "\nSince this is undocumented, the API should be considered unstable.\n"; if ($API{$f}{provided}) { print "Consider bringing this up on the list: perl5-porters\@perl.org.\n"; } else { print "It may be that this is not intended for XS use, or it may just be\n", "that no one has gotten around to documenting it.\n", $email; } $info++; } unless ($info) { print "No portability information available. Check your spelling; or", " this could be\na bug in Devel::PPPort. To report an issue:\n", "https://github.com/Dual-Life/Devel-PPPort/issues/new\n"; } } print "\nDepends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; if (exists $hints{$f} || exists $warnings{$f}) { print "\n$hints{$f}" if exists $hints{$f}; print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; $info++; } $count++; } $count or print "\nFound no API matching '$opt{'api-info'}'."; print "\n"; exit 0; } if (exists $opt{'list-provided'}) { my $f; for $f (sort dictionary_order keys %API) { next unless $API{$f}{provided}; my @flags; push @flags, 'explicit' if exists $need{$f}; push @flags, 'depend' if exists $depends{$f}; push @flags, 'hint' if exists $hints{$f}; push @flags, 'warning' if exists $warnings{$f}; my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; print "$f$flags\n"; } exit 0; } my @files; my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); my $srcext = join '|', map { quotemeta $_ } @srcext; if (@ARGV) { my %seen; for (@ARGV) { if (-e) { if (-f) { push @files, $_ unless $seen{$_}++; } else { warn "'$_' is not a file.\n" } } else { my @new = grep { -f } glob $_ or warn "'$_' does not exist.\n"; push @files, grep { !$seen{$_}++ } @new; } } } else { eval { require File::Find; File::Find::find(sub { $File::Find::name =~ /($srcext)$/i and push @files, $File::Find::name; }, '.'); }; if ($@) { @files = map { glob "*$_" } @srcext; } } if (!@ARGV || $opt{filter}) { my(@in, @out); my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; for (@files) { my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; push @{ $out ? \@out : \@in }, $_; } if (@ARGV && @out) { warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); } @files = @in; } die "No input files given!\n" unless @files; my(%files, %global, %revreplace); %revreplace = reverse %replace; my $filename; my $patch_opened = 0; for $filename (@files) { unless (open IN, "<$filename") { warn "Unable to read from $filename: $!\n"; next; } info("Scanning $filename ..."); my $c = do { local $/; }; close IN; my %file = (orig => $c, changes => 0); # Temporarily remove C/XS comments and strings from the code my @ccom; $c =~ s{ ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]* | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* ) | ( ^$HS*\#[^\r\n]* | "[^"\\]*(?:\\.[^"\\]*)*" | '[^'\\]*(?:\\.[^'\\]*)*' | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) ) }{ defined $2 and push @ccom, $2; defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex; $file{ccom} = \@ccom; $file{code} = $c; $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m; my $func; for $func (keys %API) { my $match = $func; $match .= "|$revreplace{$func}" if exists $revreplace{$func}; if ($c =~ /\b(?:Perl_)?($match)\b/) { $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; if (exists $API{$func}{provided}) { $file{uses_provided}{$func}++; if ( ! exists $API{$func}{base} || int_parse_version($API{$func}{base}) > $opt{'compat-version'}) { $file{uses}{$func}++; my @deps = rec_depend($func); if (@deps) { $file{uses_deps}{$func} = \@deps; for (@deps) { $file{uses}{$_} = 0 unless exists $file{uses}{$_}; } } for ($func, @deps) { $file{needs}{$_} = 'static' if exists $need{$_}; } } } if ( exists $API{$func}{todo} && int_parse_version($API{$func}{todo}) > $opt{'compat-version'}) { if ($c =~ /\b$func\b/) { $file{uses_todo}{$func}++; } } } } while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { if (exists $need{$2}) { $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; } else { warning("Possibly wrong #define $1 in $filename") } } for (qw(uses needs uses_todo needed_global needed_static)) { for $func (keys %{$file{$_}}) { push @{$global{$_}{$func}}, $filename; } } $files{$filename} = \%file; } # Globally resolve NEED_'s my $need; for $need (keys %{$global{needs}}) { if (@{$global{needs}{$need}} > 1) { my @targets = @{$global{needs}{$need}}; my @t = grep $files{$_}{needed_global}{$need}, @targets; @targets = @t if @t; @t = grep /\.xs$/i, @targets; @targets = @t if @t; my $target = shift @targets; $files{$target}{needs}{$need} = 'global'; for (@{$global{needs}{$need}}) { $files{$_}{needs}{$need} = 'extern' if $_ ne $target; } } } for $filename (@files) { exists $files{$filename} or next; info("=== Analyzing $filename ==="); my %file = %{$files{$filename}}; my $func; my $c = $file{code}; my $warnings = 0; for $func (sort dictionary_order keys %{$file{uses_Perl}}) { if ($API{$func}{varargs}) { unless ($API{$func}{noTHXarg}) { my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); if ($changes) { warning("Doesn't pass interpreter argument aTHX to Perl_$func"); $file{changes} += $changes; } } } else { warning("Uses Perl_$func instead of $func"); $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} {$func$1(}g); } } for $func (sort dictionary_order keys %{$file{uses_replace}}) { warning("Uses $func instead of $replace{$func}"); $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); } for $func (sort dictionary_order keys %{$file{uses_provided}}) { if ($file{uses}{$func}) { if (exists $file{uses_deps}{$func}) { diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); } else { diag("Uses $func"); } } $warnings += (hint($func) || 0); } unless ($opt{quiet}) { for $func (sort dictionary_order keys %{$file{uses_todo}}) { next if int_parse_version($API{$func}{todo}) <= $int_min_perl; print "*** WARNING: Uses $func, which may not be portable below perl ", format_version($API{$func}{todo}), ", even with '$ppport'\n"; $warnings++; } } for $func (sort dictionary_order keys %{$file{needed_static}}) { my $message = ''; if (not exists $file{uses}{$func}) { $message = "No need to define NEED_$func if $func is never used"; } elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { $message = "No need to define NEED_$func when already needed globally"; } if ($message) { diag($message); $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); } } for $func (sort dictionary_order keys %{$file{needed_global}}) { my $message = ''; if (not exists $global{uses}{$func}) { $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; } elsif (exists $file{needs}{$func}) { if ($file{needs}{$func} eq 'extern') { $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; } elsif ($file{needs}{$func} eq 'static') { $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; } } if ($message) { diag($message); $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); } } $file{needs_inc_ppport} = keys %{$file{uses}}; if ($file{needs_inc_ppport}) { my $pp = ''; for $func (sort dictionary_order keys %{$file{needs}}) { my $type = $file{needs}{$func}; next if $type eq 'extern'; my $suffix = $type eq 'global' ? '_GLOBAL' : ''; unless (exists $file{"needed_$type"}{$func}) { if ($type eq 'global') { diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); } else { diag("File needs $func, adding static request"); } $pp .= "#define NEED_$func$suffix\n"; } } if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { $pp = ''; $file{changes}++; } unless ($file{has_inc_ppport}) { diag("Needs to include '$ppport'"); $pp .= qq(#include "$ppport"\n) } if ($pp) { $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) || ($c =~ s/^/$pp/); } } else { if ($file{has_inc_ppport}) { diag("No need to include '$ppport'"); $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); } } # put back in our C comments my $ix; my $cppc = 0; my @ccom = @{$file{ccom}}; for $ix (0 .. $#ccom) { if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { $cppc++; $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; } else { $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; } } if ($cppc) { my $s = $cppc != 1 ? 's' : ''; warning("Uses $cppc C++ style comment$s, which is not portable"); } my $s = $warnings != 1 ? 's' : ''; my $warn = $warnings ? " ($warnings warning$s)" : ''; info("Analysis completed$warn"); if ($file{changes}) { if (exists $opt{copy}) { my $newfile = "$filename$opt{copy}"; if (-e $newfile) { error("'$newfile' already exists, refusing to write copy of '$filename'"); } else { local *F; if (open F, ">$newfile") { info("Writing copy of '$filename' with changes to '$newfile'"); print F $c; close F; } else { error("Cannot open '$newfile' for writing: $!"); } } } elsif (exists $opt{patch} || $opt{changes}) { if (exists $opt{patch}) { unless ($patch_opened) { if (open PATCH, ">$opt{patch}") { $patch_opened = 1; } else { error("Cannot open '$opt{patch}' for writing: $!"); delete $opt{patch}; $opt{changes} = 1; goto fallback; } } mydiff(\*PATCH, $filename, $c); } else { fallback: info("Suggested changes:"); mydiff(\*STDOUT, $filename, $c); } } else { my $s = $file{changes} == 1 ? '' : 's'; info("$file{changes} potentially required change$s detected"); } } else { info("Looks good"); } } close PATCH if $patch_opened; exit 0; sub try_use { eval "use @_;"; return $@ eq '' } sub mydiff { local *F = shift; my($file, $str) = @_; my $diff; if (exists $opt{diff}) { $diff = run_diff($opt{diff}, $file, $str); } if (!defined $diff and try_use('Text::Diff')) { $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); $diff = <
$tmp") { print F $str; close F; if (open F, "$prog $file $tmp |") { while () { s/\Q$tmp\E/$file.patched/; $diff .= $_; } close F; unlink $tmp; return $diff; } unlink $tmp; } else { error("Cannot open '$tmp' for writing: $!"); } return undef; } sub rec_depend { my($func, $seen) = @_; return () unless exists $depends{$func}; $seen = {%{$seen||{}}}; return () if $seen->{$func}++; my %s; grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}}; } sub info { $opt{quiet} and return; print @_, "\n"; } sub diag { $opt{quiet} and return; $opt{diag} and print @_, "\n"; } sub warning { $opt{quiet} and return; print "*** ", @_, "\n"; } sub error { print "*** ERROR: ", @_, "\n"; } my %given_hints; my %given_warnings; sub hint { $opt{quiet} and return; my $func = shift; my $rv = 0; if (exists $warnings{$func} && !$given_warnings{$func}++) { my $warn = $warnings{$func}; $warn =~ s!^!*** !mg; print "*** WARNING: $func\n", $warn; $rv++; } if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { my $hint = $hints{$func}; $hint =~ s/^/ /mg; print " --- hint for $func ---\n", $hint; } $rv || 0; } sub usage { my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; my %M = ( 'I' => '*' ); $usage =~ s/^\s*perl\s+\S+/$^X $0/; $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; print < }; my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms; $copy =~ s/^(?=\S+)/ /gms; $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms; $self =~ s/^SKIP.*(?=^__DATA__)/SKIP if (\@ARGV && \$ARGV[0] eq '--unstrip') { eval { require Devel::PPPort }; \$@ and die "Cannot require Devel::PPPort, please install.\\n"; if (eval \$Devel::PPPort::VERSION < $VERSION) { die "$0 was originally generated with Devel::PPPort $VERSION.\\n" . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n" . "Please install a newer version, or --unstrip will not work.\\n"; } Devel::PPPort::WriteFile(\$0); exit 0; } print <$0" or die "cannot strip $0: $!\n"; print OUT "$pl$c\n"; exit 0; } __DATA__ */ #ifndef _P_P_PORTABILITY_H_ #define _P_P_PORTABILITY_H_ #ifndef DPPP_NAMESPACE # define DPPP_NAMESPACE DPPP_ #endif #define DPPP_CAT2(x,y) CAT2(x,y) #define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name) #define D_PPP_RELEASE_DATE 1693785600 /* 2023-09-04 */ #if ! defined(PERL_REVISION) && ! defined(PERL_VERSION_MAJOR) # if ! defined(__PATCHLEVEL_H_INCLUDED__) \ && ! ( defined(PATCHLEVEL) && defined(SUBVERSION)) # define PERL_PATCHLEVEL_H_IMPLICIT # include # endif # if ! defined(PERL_VERSION) \ && ! defined(PERL_VERSION_MAJOR) \ && ( ! defined(SUBVERSION) || ! defined(PATCHLEVEL) ) # include # endif #endif #ifdef PERL_VERSION_MAJOR # define D_PPP_MAJOR PERL_VERSION_MAJOR #elif defined(PERL_REVISION) # define D_PPP_MAJOR PERL_REVISION #else # define D_PPP_MAJOR 5 #endif #ifdef PERL_VERSION_MINOR # define D_PPP_MINOR PERL_VERSION_MINOR #elif defined(PERL_VERSION) # define D_PPP_MINOR PERL_VERSION #elif defined(PATCHLEVEL) # define D_PPP_MINOR PATCHLEVEL # define PERL_VERSION PATCHLEVEL /* back-compat */ #else # error Could not find a source for PERL_VERSION_MINOR #endif #ifdef PERL_VERSION_PATCH # define D_PPP_PATCH PERL_VERSION_PATCH #elif defined(PERL_SUBVERSION) # define D_PPP_PATCH PERL_SUBVERSION #elif defined(SUBVERSION) # define D_PPP_PATCH SUBVERSION # define PERL_SUBVERSION SUBVERSION /* back-compat */ #else # error Could not find a source for PERL_VERSION_PATCH #endif #if D_PPP_MAJOR < 5 || D_PPP_MAJOR == 6 # error Devel::PPPort works only on Perl 5, Perl 7, ... #elif D_PPP_MAJOR != 5 /* Perl 7 and above: the old forms are deprecated, set up so that they * assume Perl 5, and will make this look like 5.201.201. * * 201 is used so will be well above anything that would come from a 5 * series if we unexpectedly have to continue it, but still gives plenty of * room, up to 255, of numbers that will fit into a byte in case there is * something else unforeseen */ # undef PERL_REVISION # undef PERL_VERSION # undef PERL_SUBVERSION # define D_PPP_REVISION 5 # define D_PPP_VERSION 201 # define D_PPP_SUBVERSION 201 # if (defined(__clang__) /* _Pragma here doesn't work with gcc */ \ && ( (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ || defined(_STDC_C99) \ || defined(__c99))) # define D_PPP_STRINGIFY(x) #x # define D_PPP_deprecate(xyz) _Pragma(D_PPP_STRINGIFY(GCC warning(D_PPP_STRINGIFY(xyz) " is deprecated"))) # define PERL_REVISION (D_PPP_REVISION D_PPP_deprecate(PERL_REVISION)) # define PERL_VERSION (D_PPP_REVISION D_PPP_deprecate(PERL_VERSION)) # define PERL_SUBVERSION (D_PPP_SUBVERSION D_PPP_deprecate(PERL_SUBVERSION)) # else # define PERL_REVISION D_PPP_REVISION # define PERL_VERSION D_PPP_REVISION # define PERL_SUBVERSION D_PPP_SUBVERSION # endif #endif /* Warning: PERL_PATCHLEVEL PATCHLEVEL SUBVERSION PERL_REVISION PERL_VERSION * PERL_SUBVERSION PERL_BCDVERSION * * You should be using PERL_VERSION_xy(maj,min,ptch) instead of this, where xy * is one of EQ, NE, LE, GT, LT, GE */ /* Replace PERL_PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ /* Replace PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ /* Replace SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ /* Replace PERL_REVISION with PERL_VERSION_xy(a,b,c) (where xy is EQ,LT,GT...) */ /* Replace PERL_VERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ /* Replace PERL_SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ /* Replace PERL_BCDVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ #define D_PPP_DEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) #define D_PPP_JNP_TO_BCD(j,n,p) ((D_PPP_DEC2BCD(j)<<24)|(D_PPP_DEC2BCD(n)<<12)|D_PPP_DEC2BCD(p)) #define PERL_BCDVERSION D_PPP_JNP_TO_BCD(D_PPP_MAJOR, \ D_PPP_MINOR, \ D_PPP_PATCH) /* These differ from the versions outside D:P in using PERL_BCDVERSION instead * of PERL_DECIMAL_VERSION. The formats printing in this module assume BCD, so * always use it */ #undef PERL_VERSION_EQ #undef PERL_VERSION_NE #undef PERL_VERSION_LT #undef PERL_VERSION_GE #undef PERL_VERSION_LE #undef PERL_VERSION_GT /* N.B. These don't work if the patch number is 42 or 92, as those are what '*' * is in ASCII and EBCDIC respectively */ #ifndef PERL_VERSION_EQ # define PERL_VERSION_EQ(j,n,p) \ (((p) == '*') ? ( (j) == D_PPP_MAJOR \ && (n) == D_PPP_MINOR) \ : (PERL_BCDVERSION == D_PPP_JNP_TO_BCD(j,n,p))) #endif #ifndef PERL_VERSION_NE # define PERL_VERSION_NE(j,n,p) (! PERL_VERSION_EQ(j,n,p)) #endif #ifndef PERL_VERSION_LT # define PERL_VERSION_LT(j,n,p) /* p=='*' means _LT(j,n,0) */ \ (PERL_BCDVERSION < D_PPP_JNP_TO_BCD( (j), \ (n), \ (((p) == '*') ? 0 : (p)))) #endif #ifndef PERL_VERSION_GE # define PERL_VERSION_GE(j,n,p) (! PERL_VERSION_LT(j,n,p)) #endif #ifndef PERL_VERSION_LE # define PERL_VERSION_LE(j,n,p) /* p=='*' means _LE(j,n,999) */ \ (PERL_BCDVERSION <= D_PPP_JNP_TO_BCD( (j), \ (n), \ (((p) == '*') ? 999 : (p)))) #endif #ifndef PERL_VERSION_GT # define PERL_VERSION_GT(j,n,p) (! PERL_VERSION_LE(j,n,p)) #endif #ifndef dTHR # define dTHR dNOOP #endif #ifndef dTHX # define dTHX dNOOP #endif /* Hint: dTHX For pre-5.6.0 thread compatibility, instead use dTHXR, available only through dbipport.h */ #ifndef dTHXa # define dTHXa(x) dNOOP #endif #ifndef pTHX # define pTHX void #endif #ifndef pTHX_ # define pTHX_ #endif #ifndef aTHX # define aTHX #endif /* Hint: aTHX For pre-5.6.0 thread compatibility, instead use aTHXR, available only through dbipport.h */ #ifndef aTHX_ # define aTHX_ #endif /* Hint: aTHX_ For pre-5.6.0 thread compatibility, instead use aTHXR_, available only through dbipport.h */ #if (PERL_BCDVERSION < 0x5006000) # ifdef USE_THREADS # define aTHXR thr # define aTHXR_ thr, # else # define aTHXR # define aTHXR_ # endif # define dTHXR dTHR #else # define aTHXR aTHX # define aTHXR_ aTHX_ # define dTHXR dTHX #endif #ifndef dTHXoa # define dTHXoa(x) dTHXa(x) #endif #ifdef I_LIMITS # include #endif #ifndef PERL_UCHAR_MIN # define PERL_UCHAR_MIN ((unsigned char)0) #endif #ifndef PERL_UCHAR_MAX # ifdef UCHAR_MAX # define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) # else # ifdef MAXUCHAR # define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) # else # define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) # endif # endif #endif #ifndef PERL_USHORT_MIN # define PERL_USHORT_MIN ((unsigned short)0) #endif #ifndef PERL_USHORT_MAX # ifdef USHORT_MAX # define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) # else # ifdef MAXUSHORT # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) # else # ifdef USHRT_MAX # define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) # else # define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) # endif # endif # endif #endif #ifndef PERL_SHORT_MAX # ifdef SHORT_MAX # define PERL_SHORT_MAX ((short)SHORT_MAX) # else # ifdef MAXSHORT /* Often used in */ # define PERL_SHORT_MAX ((short)MAXSHORT) # else # ifdef SHRT_MAX # define PERL_SHORT_MAX ((short)SHRT_MAX) # else # define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) # endif # endif # endif #endif #ifndef PERL_SHORT_MIN # ifdef SHORT_MIN # define PERL_SHORT_MIN ((short)SHORT_MIN) # else # ifdef MINSHORT # define PERL_SHORT_MIN ((short)MINSHORT) # else # ifdef SHRT_MIN # define PERL_SHORT_MIN ((short)SHRT_MIN) # else # define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) # endif # endif # endif #endif #ifndef PERL_UINT_MAX # ifdef UINT_MAX # define PERL_UINT_MAX ((unsigned int)UINT_MAX) # else # ifdef MAXUINT # define PERL_UINT_MAX ((unsigned int)MAXUINT) # else # define PERL_UINT_MAX (~(unsigned int)0) # endif # endif #endif #ifndef PERL_UINT_MIN # define PERL_UINT_MIN ((unsigned int)0) #endif #ifndef PERL_INT_MAX # ifdef INT_MAX # define PERL_INT_MAX ((int)INT_MAX) # else # ifdef MAXINT /* Often used in */ # define PERL_INT_MAX ((int)MAXINT) # else # define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) # endif # endif #endif #ifndef PERL_INT_MIN # ifdef INT_MIN # define PERL_INT_MIN ((int)INT_MIN) # else # ifdef MININT # define PERL_INT_MIN ((int)MININT) # else # define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) # endif # endif #endif #ifndef PERL_ULONG_MAX # ifdef ULONG_MAX # define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) # else # ifdef MAXULONG # define PERL_ULONG_MAX ((unsigned long)MAXULONG) # else # define PERL_ULONG_MAX (~(unsigned long)0) # endif # endif #endif #ifndef PERL_ULONG_MIN # define PERL_ULONG_MIN ((unsigned long)0L) #endif #ifndef PERL_LONG_MAX # ifdef LONG_MAX # define PERL_LONG_MAX ((long)LONG_MAX) # else # ifdef MAXLONG # define PERL_LONG_MAX ((long)MAXLONG) # else # define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) # endif # endif #endif #ifndef PERL_LONG_MIN # ifdef LONG_MIN # define PERL_LONG_MIN ((long)LONG_MIN) # else # ifdef MINLONG # define PERL_LONG_MIN ((long)MINLONG) # else # define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) # endif # endif #endif #if defined(HAS_QUAD) && (defined(convex) || defined(uts)) # ifndef PERL_UQUAD_MAX # ifdef ULONGLONG_MAX # define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) # else # ifdef MAXULONGLONG # define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) # else # define PERL_UQUAD_MAX (~(unsigned long long)0) # endif # endif # endif # ifndef PERL_UQUAD_MIN # define PERL_UQUAD_MIN ((unsigned long long)0L) # endif # ifndef PERL_QUAD_MAX # ifdef LONGLONG_MAX # define PERL_QUAD_MAX ((long long)LONGLONG_MAX) # else # ifdef MAXLONGLONG # define PERL_QUAD_MAX ((long long)MAXLONGLONG) # else # define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) # endif # endif # endif # ifndef PERL_QUAD_MIN # ifdef LONGLONG_MIN # define PERL_QUAD_MIN ((long long)LONGLONG_MIN) # else # ifdef MINLONGLONG # define PERL_QUAD_MIN ((long long)MINLONGLONG) # else # define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) # endif # endif # endif #endif /* This is based on code from 5.003 perl.h */ #ifdef HAS_QUAD # ifdef cray #ifndef IVTYPE # define IVTYPE int #endif #ifndef IV_MIN # define IV_MIN PERL_INT_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_INT_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_UINT_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_UINT_MAX #endif # ifdef INTSIZE #ifndef IVSIZE # define IVSIZE INTSIZE #endif # endif # else # if defined(convex) || defined(uts) #ifndef IVTYPE # define IVTYPE long long #endif #ifndef IV_MIN # define IV_MIN PERL_QUAD_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_QUAD_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_UQUAD_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_UQUAD_MAX #endif # ifdef LONGLONGSIZE #ifndef IVSIZE # define IVSIZE LONGLONGSIZE #endif # endif # else #ifndef IVTYPE # define IVTYPE long #endif #ifndef IV_MIN # define IV_MIN PERL_LONG_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_LONG_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_ULONG_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_ULONG_MAX #endif # ifdef LONGSIZE #ifndef IVSIZE # define IVSIZE LONGSIZE #endif # endif # endif # endif #ifndef IVSIZE # define IVSIZE 8 #endif #ifndef LONGSIZE # define LONGSIZE 8 #endif #ifndef PERL_QUAD_MIN # define PERL_QUAD_MIN IV_MIN #endif #ifndef PERL_QUAD_MAX # define PERL_QUAD_MAX IV_MAX #endif #ifndef PERL_UQUAD_MIN # define PERL_UQUAD_MIN UV_MIN #endif #ifndef PERL_UQUAD_MAX # define PERL_UQUAD_MAX UV_MAX #endif #else #ifndef IVTYPE # define IVTYPE long #endif #ifndef LONGSIZE # define LONGSIZE 4 #endif #ifndef IV_MIN # define IV_MIN PERL_LONG_MIN #endif #ifndef IV_MAX # define IV_MAX PERL_LONG_MAX #endif #ifndef UV_MIN # define UV_MIN PERL_ULONG_MIN #endif #ifndef UV_MAX # define UV_MAX PERL_ULONG_MAX #endif #endif #ifndef IVSIZE # ifdef LONGSIZE # define IVSIZE LONGSIZE # else # define IVSIZE 4 /* A bold guess, but the best we can make. */ # endif #endif #ifndef UVTYPE # define UVTYPE unsigned IVTYPE #endif #ifndef UVSIZE # define UVSIZE IVSIZE #endif #ifndef PERL_SIGNALS_UNSAFE_FLAG #define PERL_SIGNALS_UNSAFE_FLAG 0x0001 #if (PERL_BCDVERSION < 0x5008000) # define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG #else # define D_PPP_PERL_SIGNALS_INIT 0 #endif #if defined(NEED_PL_signals) static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; #elif defined(NEED_PL_signals_GLOBAL) U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; #else extern U32 DPPP_(my_PL_signals); #endif #define PL_signals DPPP_(my_PL_signals) #endif /* Hint: PL_ppaddr * Calling an op via PL_ppaddr requires passing a context argument * for threaded builds. Since the context argument is different for * 5.005 perls, you can use aTHXR (supplied by dbipport.h), which will * automatically be defined as the correct argument. */ #if (PERL_BCDVERSION <= 0x5005005) /* Replace: 1 */ # define PL_ppaddr ppaddr # define PL_no_modify no_modify /* Replace: 0 */ #endif #if (PERL_BCDVERSION <= 0x5004005) /* Replace: 1 */ # define PL_DBsignal DBsignal # define PL_DBsingle DBsingle # define PL_DBsub DBsub # define PL_DBtrace DBtrace # define PL_Sv Sv # define PL_Xpv Xpv # define PL_bufend bufend # define PL_bufptr bufptr # define PL_compiling compiling # define PL_copline copline # define PL_curcop curcop # define PL_curstash curstash # define PL_debstash debstash # define PL_defgv defgv # define PL_diehook diehook # define PL_dirty dirty # define PL_dowarn dowarn # define PL_errgv errgv # define PL_error_count error_count # define PL_expect expect # define PL_hexdigit hexdigit # define PL_hints hints # define PL_in_my in_my # define PL_laststatval laststatval # define PL_lex_state lex_state # define PL_lex_stuff lex_stuff # define PL_linestr linestr # define PL_na na # define PL_perl_destruct_level perl_destruct_level # define PL_perldb perldb # define PL_rsfp_filters rsfp_filters # define PL_rsfp rsfp # define PL_stack_base stack_base # define PL_stack_sp stack_sp # define PL_statcache statcache # define PL_stdingv stdingv # define PL_sv_arenaroot sv_arenaroot # define PL_sv_no sv_no # define PL_sv_undef sv_undef # define PL_sv_yes sv_yes # define PL_tainted tainted # define PL_tainting tainting # define PL_tokenbuf tokenbuf # define PL_mess_sv mess_sv /* Replace: 0 */ #endif /* Warning: PL_parser * For perl versions earlier than 5.9.5, this is an always * non-NULL dummy. Also, it cannot be dereferenced. Don't * use it if you can avoid it, and unless you absolutely know * what you're doing. * If you always check that PL_parser is non-NULL, you can * define DPPP_PL_parser_NO_DUMMY to avoid the creation of * a dummy parser structure. */ #if (PERL_BCDVERSION >= 0x5009005) # ifdef DPPP_PL_parser_NO_DUMMY # define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ (croak("panic: PL_parser == NULL in %s:%d", \ __FILE__, __LINE__), (yy_parser *) NULL))->var) # else # ifdef DPPP_PL_parser_NO_DUMMY_WARNING # define D_PPP_parser_dummy_warning(var) # else # define D_PPP_parser_dummy_warning(var) \ warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__), # endif # define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var) #if defined(NEED_PL_parser) static yy_parser DPPP_(dummy_PL_parser); #elif defined(NEED_PL_parser_GLOBAL) yy_parser DPPP_(dummy_PL_parser); #else extern yy_parser DPPP_(dummy_PL_parser); #endif # endif /* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */ /* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf * Do not use this variable unless you know exactly what you're * doing. It is internal to the perl parser and may change or even * be removed in the future. As of perl 5.9.5, you have to check * for (PL_parser != NULL) for this variable to have any effect. * An always non-NULL PL_parser dummy is provided for earlier * perl versions. * If PL_parser is NULL when you try to access this variable, a * dummy is being accessed instead and a warning is issued unless * you define DPPP_PL_parser_NO_DUMMY_WARNING. * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access * this variable will croak with a panic message. */ # define PL_expect D_PPP_my_PL_parser_var(expect) # define PL_copline D_PPP_my_PL_parser_var(copline) # define PL_rsfp D_PPP_my_PL_parser_var(rsfp) # define PL_rsfp_filters D_PPP_my_PL_parser_var(rsfp_filters) # define PL_linestr D_PPP_my_PL_parser_var(linestr) # define PL_bufptr D_PPP_my_PL_parser_var(bufptr) # define PL_bufend D_PPP_my_PL_parser_var(bufend) # define PL_lex_state D_PPP_my_PL_parser_var(lex_state) # define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff) # define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf) # define PL_in_my D_PPP_my_PL_parser_var(in_my) # define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash) # define PL_error_count D_PPP_my_PL_parser_var(error_count) #else /* ensure that PL_parser != NULL and cannot be dereferenced */ # define PL_parser ((void *) 1) #endif #if (PERL_BCDVERSION <= 0x5003022) # undef start_subparse # if (PERL_BCDVERSION < 0x5003022) #ifndef start_subparse # define start_subparse(a, b) Perl_start_subparse() #endif # else #ifndef start_subparse # define start_subparse(a, b) Perl_start_subparse(b) #endif # endif #if (PERL_BCDVERSION < 0x5003007) foo #endif #endif /* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ #if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005) /* And before that, we need to make sure this gets compiled for the functions * that rely on it */ #define NEED_newCONSTSUB #if defined(NEED_newCONSTSUB) static CV * DPPP_(my_newCONSTSUB)(HV * stash, const char * name, SV * sv); static #else extern CV * DPPP_(my_newCONSTSUB)(HV * stash, const char * name, SV * sv); #endif #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) #ifdef newCONSTSUB # undef newCONSTSUB #endif #define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) #define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) /* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */ /* (There's no PL_parser in perl < 5.005, so this is completely safe) */ #define D_PPP_PL_copline PL_copline CV * DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv) { CV *cv; U32 oldhints = PL_hints; HV *old_cop_stash = PL_curcop->cop_stash; HV *old_curstash = PL_curstash; line_t oldline = PL_curcop->cop_line; PL_curcop->cop_line = D_PPP_PL_copline; PL_hints &= ~HINT_BLOCK_SCOPE; if (stash) PL_curstash = PL_curcop->cop_stash = stash; cv = newSUB( start_subparse(FALSE, 0), newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)), newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) ); PL_hints = oldhints; PL_curcop->cop_stash = old_cop_stash; PL_curstash = old_curstash; PL_curcop->cop_line = oldline; return cv; } #endif #endif #ifndef PERL_MAGIC_sv # define PERL_MAGIC_sv '\0' #endif #ifndef PERL_MAGIC_overload # define PERL_MAGIC_overload 'A' #endif #ifndef PERL_MAGIC_overload_elem # define PERL_MAGIC_overload_elem 'a' #endif #ifndef PERL_MAGIC_overload_table # define PERL_MAGIC_overload_table 'c' #endif #ifndef PERL_MAGIC_bm # define PERL_MAGIC_bm 'B' #endif #ifndef PERL_MAGIC_regdata # define PERL_MAGIC_regdata 'D' #endif #ifndef PERL_MAGIC_regdatum # define PERL_MAGIC_regdatum 'd' #endif #ifndef PERL_MAGIC_env # define PERL_MAGIC_env 'E' #endif #ifndef PERL_MAGIC_envelem # define PERL_MAGIC_envelem 'e' #endif #ifndef PERL_MAGIC_fm # define PERL_MAGIC_fm 'f' #endif #ifndef PERL_MAGIC_regex_global # define PERL_MAGIC_regex_global 'g' #endif #ifndef PERL_MAGIC_isa # define PERL_MAGIC_isa 'I' #endif #ifndef PERL_MAGIC_isaelem # define PERL_MAGIC_isaelem 'i' #endif #ifndef PERL_MAGIC_nkeys # define PERL_MAGIC_nkeys 'k' #endif #ifndef PERL_MAGIC_dbfile # define PERL_MAGIC_dbfile 'L' #endif #ifndef PERL_MAGIC_dbline # define PERL_MAGIC_dbline 'l' #endif #ifndef PERL_MAGIC_mutex # define PERL_MAGIC_mutex 'm' #endif #ifndef PERL_MAGIC_shared # define PERL_MAGIC_shared 'N' #endif #ifndef PERL_MAGIC_shared_scalar # define PERL_MAGIC_shared_scalar 'n' #endif #ifndef PERL_MAGIC_collxfrm # define PERL_MAGIC_collxfrm 'o' #endif #ifndef PERL_MAGIC_tied # define PERL_MAGIC_tied 'P' #endif #ifndef PERL_MAGIC_tiedelem # define PERL_MAGIC_tiedelem 'p' #endif #ifndef PERL_MAGIC_tiedscalar # define PERL_MAGIC_tiedscalar 'q' #endif #ifndef PERL_MAGIC_qr # define PERL_MAGIC_qr 'r' #endif #ifndef PERL_MAGIC_sig # define PERL_MAGIC_sig 'S' #endif #ifndef PERL_MAGIC_sigelem # define PERL_MAGIC_sigelem 's' #endif #ifndef PERL_MAGIC_taint # define PERL_MAGIC_taint 't' #endif #ifndef PERL_MAGIC_uvar # define PERL_MAGIC_uvar 'U' #endif #ifndef PERL_MAGIC_uvar_elem # define PERL_MAGIC_uvar_elem 'u' #endif #ifndef PERL_MAGIC_vstring # define PERL_MAGIC_vstring 'V' #endif #ifndef PERL_MAGIC_vec # define PERL_MAGIC_vec 'v' #endif #ifndef PERL_MAGIC_utf8 # define PERL_MAGIC_utf8 'w' #endif #ifndef PERL_MAGIC_substr # define PERL_MAGIC_substr 'x' #endif #ifndef PERL_MAGIC_defelem # define PERL_MAGIC_defelem 'y' #endif #ifndef PERL_MAGIC_glob # define PERL_MAGIC_glob '*' #endif #ifndef PERL_MAGIC_arylen # define PERL_MAGIC_arylen '#' #endif #ifndef PERL_MAGIC_pos # define PERL_MAGIC_pos '.' #endif #ifndef PERL_MAGIC_backref # define PERL_MAGIC_backref '<' #endif #ifndef PERL_MAGIC_ext # define PERL_MAGIC_ext '~' #endif #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #ifndef PERL_STATIC_INLINE # define PERL_STATIC_INLINE static inline #endif #else #ifndef PERL_STATIC_INLINE # define PERL_STATIC_INLINE static #endif #endif #ifndef cBOOL # define cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0) #endif #ifndef OpHAS_SIBLING # define OpHAS_SIBLING(o) (cBOOL((o)->op_sibling)) #endif #ifndef OpSIBLING # define OpSIBLING(o) (0 + (o)->op_sibling) #endif #ifndef OpMORESIB_set # define OpMORESIB_set(o, sib) ((o)->op_sibling = (sib)) #endif #ifndef OpLASTSIB_set # define OpLASTSIB_set(o, parent) ((o)->op_sibling = NULL) #endif #ifndef OpMAYBESIB_set # define OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib)) #endif #ifndef HEf_SVKEY # define HEf_SVKEY -2 #endif #if defined(DEBUGGING) && !defined(__COVERITY__) #ifndef __ASSERT_ # define __ASSERT_(statement) assert(statement), #endif #else #ifndef __ASSERT_ # define __ASSERT_(statement) #endif #endif #ifndef __has_builtin # define __has_builtin(x) 0 #endif #if __has_builtin(__builtin_unreachable) # define D_PPP_HAS_BUILTIN_UNREACHABLE #elif (defined(__GNUC__) && ( __GNUC__ > 4 \ || __GNUC__ == 4 && __GNUC_MINOR__ >= 5)) # define D_PPP_HAS_BUILTIN_UNREACHABLE #endif #ifndef ASSUME # ifdef DEBUGGING # define ASSUME(x) assert(x) # elif defined(_MSC_VER) # define ASSUME(x) __assume(x) # elif defined(__ARMCC_VERSION) # define ASSUME(x) __promise(x) # elif defined(D_PPP_HAS_BUILTIN_UNREACHABLE) # define ASSUME(x) ((x) ? (void) 0 : __builtin_unreachable()) # else # define ASSUME(x) assert(x) # endif #endif #ifndef NOT_REACHED # ifdef D_PPP_HAS_BUILTIN_UNREACHABLE # define NOT_REACHED \ STMT_START { \ ASSUME(!"UNREACHABLE"); __builtin_unreachable(); \ } STMT_END # elif ! defined(__GNUC__) && (defined(__sun) || defined(__hpux)) # define NOT_REACHED # else # define NOT_REACHED ASSUME(!"UNREACHABLE") # endif #endif #ifndef WIDEST_UTYPE # ifdef QUADKIND # ifdef U64TYPE # define WIDEST_UTYPE U64TYPE # else # define WIDEST_UTYPE unsigned Quad_t # endif # else # define WIDEST_UTYPE U32 # endif #endif /* These could become provided if/when they become part of the public API */ #ifndef withinCOUNT # define withinCOUNT(c, l, n) \ (((WIDEST_UTYPE) (((c)) - ((l) | 0))) <= (((WIDEST_UTYPE) ((n) | 0)))) #endif #ifndef inRANGE # define inRANGE(c, l, u) \ ( (sizeof(c) == sizeof(U8)) ? withinCOUNT(((U8) (c)), (l), ((u) - (l))) \ : (sizeof(c) == sizeof(U32)) ? withinCOUNT(((U32) (c)), (l), ((u) - (l))) \ : (withinCOUNT(((WIDEST_UTYPE) (c)), (l), ((u) - (l))))) #endif /* The '| 0' part ensures a compiler error if c is not integer (like e.g., a * pointer) */ #undef FITS_IN_8_BITS /* handy.h version uses a core-only constant */ #ifndef FITS_IN_8_BITS # define FITS_IN_8_BITS(c) ( (sizeof(c) == 1) \ || !(((WIDEST_UTYPE)((c) | 0)) & ~0xFF)) #endif /* Create the macro for "is'macro'_utf8_safe(s, e)". For code points below * 256, it calls the equivalent _L1 macro by converting the UTF-8 to code * point. That is so that it can automatically get the bug fixes done in this * file. */ #define D_PPP_IS_GENERIC_UTF8_SAFE(s, e, macro) \ (((e) - (s)) <= 0 \ ? 0 \ : UTF8_IS_INVARIANT((s)[0]) \ ? is ## macro ## _L1((s)[0]) \ : (((e) - (s)) < UTF8SKIP(s)) \ ? 0 \ : UTF8_IS_DOWNGRADEABLE_START((s)[0]) \ /* The cast in the line below is only to silence warnings */ \ ? is ## macro ## _L1((WIDEST_UTYPE) LATIN1_TO_NATIVE( \ UTF8_ACCUMULATE(NATIVE_UTF8_TO_I8((s)[0]) \ & UTF_START_MASK(2), \ (s)[1]))) \ : is ## macro ## _utf8(s)) /* Create the macro for "is'macro'_LC_utf8_safe(s, e)". For code points below * 256, it calls the equivalent _L1 macro by converting the UTF-8 to code * point. That is so that it can automatically get the bug fixes done in this * file. */ #define D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, macro) \ (((e) - (s)) <= 0 \ ? 0 \ : UTF8_IS_INVARIANT((s)[0]) \ ? is ## macro ## _LC((s)[0]) \ : (((e) - (s)) < UTF8SKIP(s)) \ ? 0 \ : UTF8_IS_DOWNGRADEABLE_START((s)[0]) \ /* The cast in the line below is only to silence warnings */ \ ? is ## macro ## _LC((WIDEST_UTYPE) LATIN1_TO_NATIVE( \ UTF8_ACCUMULATE(NATIVE_UTF8_TO_I8((s)[0]) \ & UTF_START_MASK(2), \ (s)[1]))) \ : is ## macro ## _utf8(s)) /* A few of the early functions are broken. For these and the non-LC case, * machine generated code is substituted. But that code doesn't work for * locales. This is just like the above macro, but at the end, we call the * macro we've generated for the above 255 case, which is correct since locale * isn't involved. This will generate extra code to handle the 0-255 inputs, * but hopefully it will be optimized out by the C compiler. But just in case * it isn't, this macro is only used on the few versions that are broken */ #define D_PPP_IS_GENERIC_LC_UTF8_SAFE_BROKEN(s, e, macro) \ (((e) - (s)) <= 0 \ ? 0 \ : UTF8_IS_INVARIANT((s)[0]) \ ? is ## macro ## _LC((s)[0]) \ : (((e) - (s)) < UTF8SKIP(s)) \ ? 0 \ : UTF8_IS_DOWNGRADEABLE_START((s)[0]) \ /* The cast in the line below is only to silence warnings */ \ ? is ## macro ## _LC((WIDEST_UTYPE) LATIN1_TO_NATIVE( \ UTF8_ACCUMULATE(NATIVE_UTF8_TO_I8((s)[0]) \ & UTF_START_MASK(2), \ (s)[1]))) \ : is ## macro ## _utf8_safe(s, e)) #ifndef SvRX # define SvRX(rv) (SvROK((rv)) ? (SvMAGICAL(SvRV((rv))) ? (mg_find(SvRV((rv)), PERL_MAGIC_qr) ? mg_find(SvRV((rv)), PERL_MAGIC_qr)->mg_obj : NULL) : NULL) : NULL) #endif #ifndef SvRXOK # define SvRXOK(sv) (!!SvRX(sv)) #endif #ifndef PERL_UNUSED_DECL # ifdef HASATTRIBUTE # if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) # define PERL_UNUSED_DECL # else # define PERL_UNUSED_DECL __attribute__((unused)) # endif # else # define PERL_UNUSED_DECL # endif #endif #ifndef PERL_UNUSED_ARG # if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ # include # define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x)) # else # define PERL_UNUSED_ARG(x) ((void)x) # endif #endif #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(x) ((void)x) #endif #ifndef PERL_UNUSED_CONTEXT # ifdef USE_ITHREADS # define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl) # else # define PERL_UNUSED_CONTEXT # endif #endif #ifndef PERL_UNUSED_RESULT # if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT) # define PERL_UNUSED_RESULT(v) STMT_START { __typeof__(v) z = (v); (void)sizeof(z); } STMT_END # else # define PERL_UNUSED_RESULT(v) ((void)(v)) # endif #endif #ifndef NOOP # define NOOP /*EMPTY*/(void)0 #endif #if (PERL_BCDVERSION < 0x5006001) && (PERL_BCDVERSION < 0x5027007) #undef dNOOP #ifndef dNOOP # define dNOOP struct Perl___notused_struct #endif #endif #ifndef NVTYPE # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) # define NVTYPE long double # else # define NVTYPE double # endif typedef NVTYPE NV; #endif #ifndef INT2PTR # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) # define PTRV UV # define INT2PTR(any,d) (any)(d) # else # if PTRSIZE == LONGSIZE # define PTRV unsigned long # else # define PTRV unsigned # endif # define INT2PTR(any,d) (any)(PTRV)(d) # endif #endif #ifndef PTR2ul # if PTRSIZE == LONGSIZE # define PTR2ul(p) (unsigned long)(p) # else # define PTR2ul(p) INT2PTR(unsigned long,p) # endif #endif #ifndef PERL_STACK_OFFSET_DEFINED typedef I32 Stack_off_t; # define Stack_off_t_MAX I32_MAX # define PERL_STACK_OFFSET_DEFINED #endif #ifndef PTR2nat # define PTR2nat(p) (PTRV)(p) #endif #ifndef NUM2PTR # define NUM2PTR(any,d) (any)PTR2nat(d) #endif #ifndef PTR2IV # define PTR2IV(p) INT2PTR(IV,p) #endif #ifndef PTR2UV # define PTR2UV(p) INT2PTR(UV,p) #endif #ifndef PTR2NV # define PTR2NV(p) NUM2PTR(NV,p) #endif #ifdef __cplusplus #undef START_EXTERN_C #ifndef START_EXTERN_C # define START_EXTERN_C extern "C" { #endif #undef END_EXTERN_C #ifndef END_EXTERN_C # define END_EXTERN_C } #endif #undef EXTERN_C #ifndef EXTERN_C # define EXTERN_C extern "C" #endif #else #undef START_EXTERN_C #ifndef START_EXTERN_C # define START_EXTERN_C #endif #undef END_EXTERN_C #ifndef END_EXTERN_C # define END_EXTERN_C #endif #undef EXTERN_C #ifndef EXTERN_C # define EXTERN_C extern #endif #endif #if (PERL_BCDVERSION < 0x5004000) || defined(PERL_GCC_PEDANTIC) # ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN #ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN # define PERL_GCC_BRACE_GROUPS_FORBIDDEN #endif # endif #endif #if ! defined(__GNUC__) || defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) || defined(__cplusplus) # undef PERL_USE_GCC_BRACE_GROUPS #else # ifndef PERL_USE_GCC_BRACE_GROUPS # define PERL_USE_GCC_BRACE_GROUPS # endif #endif #if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) #undef STMT_START #ifndef STMT_START # define STMT_START if (1) #endif #undef STMT_END #ifndef STMT_END # define STMT_END else (void)0 #endif #else #undef STMT_START #ifndef STMT_START # define STMT_START do #endif #undef STMT_END #ifndef STMT_END # define STMT_END while (0) #endif #endif #ifndef boolSV # define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) #endif /* DEFSV appears first in 5.004_56 */ #ifndef DEFSV # define DEFSV GvSV(PL_defgv) #endif #ifndef SAVE_DEFSV # define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) #endif #ifndef DEFSV_set # define DEFSV_set(sv) (DEFSV = (sv)) #endif /* Older perls (<=5.003) lack AvFILLp */ #ifndef AvFILLp # define AvFILLp AvFILL #endif #ifndef av_tindex # define av_tindex AvFILL #endif #ifndef av_top_index # define av_top_index AvFILL #endif #ifndef av_count # define av_count(av) (AvFILL(av)+1) #endif #ifndef ERRSV # define ERRSV get_sv("@",FALSE) #endif /* Hint: gv_stashpvn * This function's backport doesn't support the length parameter, but * rather ignores it. Portability can only be ensured if the length * parameter is used for speed reasons, but the length can always be * correctly computed from the string argument. */ #ifndef gv_stashpvn # define gv_stashpvn(str,len,create) gv_stashpv(str,create) #endif /* Replace: 1 */ #ifndef get_cv # define get_cv perl_get_cv #endif #ifndef get_sv # define get_sv perl_get_sv #endif #ifndef get_av # define get_av perl_get_av #endif #ifndef get_hv # define get_hv perl_get_hv #endif /* Replace: 0 */ #ifndef dUNDERBAR # define dUNDERBAR dNOOP #endif #ifndef UNDERBAR # define UNDERBAR DEFSV #endif #ifndef dAX # define dAX I32 ax = MARK - PL_stack_base + 1 #endif #ifndef dITEMS # define dITEMS I32 items = SP - MARK #endif #ifndef dXSTARG # define dXSTARG SV * targ = sv_newmortal() #endif #ifndef dAXMARK # define dAXMARK I32 ax = POPMARK; \ SV ** const mark = PL_stack_base + ax++ #endif #ifndef XSprePUSH # define XSprePUSH (sp = PL_stack_base + ax - 1) #endif #if (PERL_BCDVERSION < 0x5005000) #undef XSRETURN #ifndef XSRETURN # define XSRETURN(off) \ STMT_START { \ PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ return; \ } STMT_END #endif #endif #ifndef XSPROTO # define XSPROTO(name) void name(pTHX_ CV* cv) #endif #ifndef SVfARG # define SVfARG(p) ((void*)(p)) #endif #ifndef PERL_ABS # define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) #endif #ifndef dVAR # define dVAR dNOOP #endif #ifndef SVf # define SVf "_" #endif #ifndef CPERLscope # define CPERLscope(x) x #endif #ifndef PERL_HASH # define PERL_HASH(hash,str,len) \ STMT_START { \ const char *s_PeRlHaSh = str; \ I32 i_PeRlHaSh = len; \ U32 hash_PeRlHaSh = 0; \ while (i_PeRlHaSh--) \ hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \ (hash) = hash_PeRlHaSh; \ } STMT_END #endif #ifndef PERLIO_FUNCS_DECL # ifdef PERLIO_FUNCS_CONST # define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs # define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs) # else # define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs # define PERLIO_FUNCS_CAST(funcs) (funcs) # endif #endif /* provide these typedefs for older perls */ #if (PERL_BCDVERSION < 0x5009003) # ifdef ARGSproto typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto); # else typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX); # endif typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*); #endif /* On versions without NATIVE_TO_ASCII, only ASCII is supported */ #if defined(EBCDIC) && defined(NATIVE_TO_ASCI) #ifndef NATIVE_TO_LATIN1 # define NATIVE_TO_LATIN1(c) NATIVE_TO_ASCII(c) #endif #ifndef LATIN1_TO_NATIVE # define LATIN1_TO_NATIVE(c) ASCII_TO_NATIVE(c) #endif #ifndef NATIVE_TO_UNI # define NATIVE_TO_UNI(c) ((c) > 255 ? (c) : NATIVE_TO_LATIN1(c)) #endif #ifndef UNI_TO_NATIVE # define UNI_TO_NATIVE(c) ((c) > 255 ? (c) : LATIN1_TO_NATIVE(c)) #endif #else #ifndef NATIVE_TO_LATIN1 # define NATIVE_TO_LATIN1(c) (c) #endif #ifndef LATIN1_TO_NATIVE # define LATIN1_TO_NATIVE(c) (c) #endif #ifndef NATIVE_TO_UNI # define NATIVE_TO_UNI(c) (c) #endif #ifndef UNI_TO_NATIVE # define UNI_TO_NATIVE(c) (c) #endif #endif /* Warning: LATIN1_TO_NATIVE, NATIVE_TO_LATIN1 NATIVE_TO_UNI UNI_TO_NATIVE EBCDIC is not supported on versions earlier than 5.7.1 */ /* The meaning of this changed; use the modern version */ #undef isPSXSPC #undef isPSXSPC_A #undef isPSXSPC_L1 /* Hint: isPSXSPC, isPSXSPC_A, isPSXSPC_L1, isPSXSPC_utf8_safe This is equivalent to the corresponding isSPACE-type macro. On perls before 5.18, this matched a vertical tab and SPACE didn't. But the dbipport.h SPACE version does match VT in all perl releases. Since VT's are extremely rarely found in real-life files, this difference effectively doesn't matter */ /* Hint: isSPACE, isSPACE_A, isSPACE_L1, isSPACE_utf8_safe Until Perl 5.18, this did not match the vertical tab (VT). The dbipport.h version does match it in all perl releases. Since VT's are extremely rarely found in real-life files, this difference effectively doesn't matter */ #ifdef EBCDIC /* This is the first version where these macros are fully correct on EBCDIC * platforms. Relying on the C library functions, as earlier releases did, * causes problems with locales */ # if (PERL_BCDVERSION < 0x5022000) # undef isALNUM # undef isALNUM_A # undef isALNUM_L1 # undef isALNUMC # undef isALNUMC_A # undef isALNUMC_L1 # undef isALPHA # undef isALPHA_A # undef isALPHA_L1 # undef isALPHANUMERIC # undef isALPHANUMERIC_A # undef isALPHANUMERIC_L1 # undef isASCII # undef isASCII_A # undef isASCII_L1 # undef isBLANK # undef isBLANK_A # undef isBLANK_L1 # undef isCNTRL # undef isCNTRL_A # undef isCNTRL_L1 # undef isDIGIT # undef isDIGIT_A # undef isDIGIT_L1 # undef isGRAPH # undef isGRAPH_A # undef isGRAPH_L1 # undef isIDCONT # undef isIDCONT_A # undef isIDCONT_L1 # undef isIDFIRST # undef isIDFIRST_A # undef isIDFIRST_L1 # undef isLOWER # undef isLOWER_A # undef isLOWER_L1 # undef isOCTAL # undef isOCTAL_A # undef isOCTAL_L1 # undef isPRINT # undef isPRINT_A # undef isPRINT_L1 # undef isPUNCT # undef isPUNCT_A # undef isPUNCT_L1 # undef isSPACE # undef isSPACE_A # undef isSPACE_L1 # undef isUPPER # undef isUPPER_A # undef isUPPER_L1 # undef isWORDCHAR # undef isWORDCHAR_A # undef isWORDCHAR_L1 # undef isXDIGIT # undef isXDIGIT_A # undef isXDIGIT_L1 # endif #ifndef isASCII # define isASCII(c) (isCNTRL(c) || isPRINT(c)) #endif /* The below is accurate for all EBCDIC code pages supported by * all the versions of Perl overridden by this */ #ifndef isCNTRL # define isCNTRL(c) ( (c) == '\0' || (c) == '\a' || (c) == '\b' \ || (c) == '\f' || (c) == '\n' || (c) == '\r' \ || (c) == '\t' || (c) == '\v' \ || ((c) <= 3 && (c) >= 1) /* SOH, STX, ETX */ \ || (c) == 7 /* U+7F DEL */ \ || ((c) <= 0x13 && (c) >= 0x0E) /* SO, SI */ \ /* DLE, DC[1-3] */ \ || (c) == 0x18 /* U+18 CAN */ \ || (c) == 0x19 /* U+19 EOM */ \ || ((c) <= 0x1F && (c) >= 0x1C) /* [FGRU]S */ \ || (c) == 0x26 /* U+17 ETB */ \ || (c) == 0x27 /* U+1B ESC */ \ || (c) == 0x2D /* U+05 ENQ */ \ || (c) == 0x2E /* U+06 ACK */ \ || (c) == 0x32 /* U+16 SYN */ \ || (c) == 0x37 /* U+04 EOT */ \ || (c) == 0x3C /* U+14 DC4 */ \ || (c) == 0x3D /* U+15 NAK */ \ || (c) == 0x3F /* U+1A SUB */ \ ) #endif #if '^' == 106 /* EBCDIC POSIX-BC */ # define D_PPP_OUTLIER_CONTROL 0x5F #else /* EBCDIC 1047 037 */ # define D_PPP_OUTLIER_CONTROL 0xFF #endif /* The controls are everything below blank, plus one outlier */ #ifndef isCNTRL_L1 # define isCNTRL_L1(c) ((WIDEST_UTYPE) (c) < ' ' \ || (WIDEST_UTYPE) (c) == D_PPP_OUTLIER_CONTROL) #endif /* The ordering of the tests in this and isUPPER are to exclude most characters * early */ #ifndef isLOWER # define isLOWER(c) ( (c) >= 'a' && (c) <= 'z' \ && ( (c) <= 'i' \ || ((c) >= 'j' && (c) <= 'r') \ || (c) >= 's')) #endif #ifndef isUPPER # define isUPPER(c) ( (c) >= 'A' && (c) <= 'Z' \ && ( (c) <= 'I' \ || ((c) >= 'J' && (c) <= 'R') \ || (c) >= 'S')) #endif #else /* Above is EBCDIC; below is ASCII */ # if (PERL_BCDVERSION < 0x5004000) /* The implementation of these in older perl versions can give wrong results if * the C program locale is set to other than the C locale */ # undef isALNUM # undef isALNUM_A # undef isALPHA # undef isALPHA_A # undef isDIGIT # undef isDIGIT_A # undef isIDFIRST # undef isIDFIRST_A # undef isLOWER # undef isLOWER_A # undef isUPPER # undef isUPPER_A # endif # if (PERL_BCDVERSION == 0x5007000) /* this perl made space GRAPH */ # undef isGRAPH # endif # if (PERL_BCDVERSION < 0x5008000) /* earlier perls omitted DEL */ # undef isCNTRL # endif # if (PERL_BCDVERSION < 0x5010000) /* earlier perls included all of the isSPACE() characters, which is wrong. The * version provided by Devel::PPPort always overrides an existing buggy * version. */ # undef isPRINT # undef isPRINT_A # endif # if (PERL_BCDVERSION < 0x5014000) /* earlier perls always returned true if the parameter was a signed char */ # undef isASCII # undef isASCII_A # endif # if (PERL_BCDVERSION < 0x5017008) /* earlier perls didn't include PILCROW, SECTION SIGN */ # undef isPUNCT_L1 # endif # if (PERL_BCDVERSION < 0x5013007) /* khw didn't investigate why this failed */ # undef isALNUMC_L1 #endif # if (PERL_BCDVERSION < 0x5020000) /* earlier perls didn't include \v */ # undef isSPACE # undef isSPACE_A # undef isSPACE_L1 # endif #ifndef isASCII # define isASCII(c) ((WIDEST_UTYPE) (c) <= 127) #endif #ifndef isCNTRL # define isCNTRL(c) ((WIDEST_UTYPE) (c) < ' ' || (c) == 127) #endif #ifndef isCNTRL_L1 # define isCNTRL_L1(c) ( (WIDEST_UTYPE) (c) < ' ' \ || inRANGE((c), 0x7F, 0x9F)) #endif #ifndef isLOWER # define isLOWER(c) inRANGE((c), 'a', 'z') #endif #ifndef isUPPER # define isUPPER(c) inRANGE((c), 'A', 'Z') #endif #endif /* Below are definitions common to EBCDIC and ASCII */ #ifndef isASCII_L1 # define isASCII_L1(c) isASCII(c) #endif #ifndef isASCII_LC # define isASCII_LC(c) isASCII(c) #endif #ifndef isALNUM # define isALNUM(c) isWORDCHAR(c) #endif #ifndef isALNUMC # define isALNUMC(c) isALPHANUMERIC(c) #endif #ifndef isALNUMC_L1 # define isALNUMC_L1(c) isALPHANUMERIC_L1(c) #endif #ifndef isALPHA # define isALPHA(c) (isUPPER(c) || isLOWER(c)) #endif #ifndef isALPHA_L1 # define isALPHA_L1(c) (isUPPER_L1(c) || isLOWER_L1(c)) #endif #ifndef isALPHANUMERIC # define isALPHANUMERIC(c) (isALPHA(c) || isDIGIT(c)) #endif #ifndef isALPHANUMERIC_L1 # define isALPHANUMERIC_L1(c) (isALPHA_L1(c) || isDIGIT(c)) #endif #ifndef isALPHANUMERIC_LC # define isALPHANUMERIC_LC(c) (isALPHA_LC(c) || isDIGIT_LC(c)) #endif #ifndef isBLANK # define isBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifndef isBLANK_L1 # define isBLANK_L1(c) ( isBLANK(c) \ || ( FITS_IN_8_BITS(c) \ && NATIVE_TO_LATIN1((U8) c) == 0xA0)) #endif #ifndef isBLANK_LC # define isBLANK_LC(c) isBLANK(c) #endif #ifndef isDIGIT # define isDIGIT(c) inRANGE(c, '0', '9') #endif #ifndef isDIGIT_L1 # define isDIGIT_L1(c) isDIGIT(c) #endif #ifndef isGRAPH # define isGRAPH(c) (isWORDCHAR(c) || isPUNCT(c)) #endif #ifndef isGRAPH_L1 # define isGRAPH_L1(c) ( isPRINT_L1(c) \ && (c) != ' ' \ && NATIVE_TO_LATIN1((U8) c) != 0xA0) #endif #ifndef isIDCONT # define isIDCONT(c) isWORDCHAR(c) #endif #ifndef isIDCONT_L1 # define isIDCONT_L1(c) isWORDCHAR_L1(c) #endif #ifndef isIDCONT_LC # define isIDCONT_LC(c) isWORDCHAR_LC(c) #endif #ifndef isIDFIRST # define isIDFIRST(c) (isALPHA(c) || (c) == '_') #endif #ifndef isIDFIRST_L1 # define isIDFIRST_L1(c) (isALPHA_L1(c) || (U8) (c) == '_') #endif #ifndef isIDFIRST_LC # define isIDFIRST_LC(c) (isALPHA_LC(c) || (U8) (c) == '_') #endif #ifndef isLOWER_L1 # define isLOWER_L1(c) ( isLOWER(c) \ || ( FITS_IN_8_BITS(c) \ && ( ( NATIVE_TO_LATIN1((U8) c) >= 0xDF \ && NATIVE_TO_LATIN1((U8) c) != 0xF7) \ || NATIVE_TO_LATIN1((U8) c) == 0xAA \ || NATIVE_TO_LATIN1((U8) c) == 0xBA \ || NATIVE_TO_LATIN1((U8) c) == 0xB5))) #endif #ifndef isOCTAL # define isOCTAL(c) (((WIDEST_UTYPE)((c)) & ~7) == '0') #endif #ifndef isOCTAL_L1 # define isOCTAL_L1(c) isOCTAL(c) #endif #ifndef isPRINT # define isPRINT(c) (isGRAPH(c) || (c) == ' ') #endif #ifndef isPRINT_L1 # define isPRINT_L1(c) (FITS_IN_8_BITS(c) && ! isCNTRL_L1(c)) #endif #ifndef isPSXSPC # define isPSXSPC(c) isSPACE(c) #endif #ifndef isPSXSPC_L1 # define isPSXSPC_L1(c) isSPACE_L1(c) #endif #ifndef isPUNCT # define isPUNCT(c) ( (c) == '-' || (c) == '!' || (c) == '"' \ || (c) == '#' || (c) == '$' || (c) == '%' \ || (c) == '&' || (c) == '\'' || (c) == '(' \ || (c) == ')' || (c) == '*' || (c) == '+' \ || (c) == ',' || (c) == '.' || (c) == '/' \ || (c) == ':' || (c) == ';' || (c) == '<' \ || (c) == '=' || (c) == '>' || (c) == '?' \ || (c) == '@' || (c) == '[' || (c) == '\\' \ || (c) == ']' || (c) == '^' || (c) == '_' \ || (c) == '`' || (c) == '{' || (c) == '|' \ || (c) == '}' || (c) == '~') #endif #ifndef isPUNCT_L1 # define isPUNCT_L1(c) ( isPUNCT(c) \ || ( FITS_IN_8_BITS(c) \ && ( NATIVE_TO_LATIN1((U8) c) == 0xA1 \ || NATIVE_TO_LATIN1((U8) c) == 0xA7 \ || NATIVE_TO_LATIN1((U8) c) == 0xAB \ || NATIVE_TO_LATIN1((U8) c) == 0xB6 \ || NATIVE_TO_LATIN1((U8) c) == 0xB7 \ || NATIVE_TO_LATIN1((U8) c) == 0xBB \ || NATIVE_TO_LATIN1((U8) c) == 0xBF))) #endif #ifndef isSPACE # define isSPACE(c) ( isBLANK(c) || (c) == '\n' || (c) == '\r' \ || (c) == '\v' || (c) == '\f') #endif #ifndef isSPACE_L1 # define isSPACE_L1(c) ( isSPACE(c) \ || (FITS_IN_8_BITS(c) \ && ( NATIVE_TO_LATIN1((U8) c) == 0x85 \ || NATIVE_TO_LATIN1((U8) c) == 0xA0))) #endif #ifndef isUPPER_L1 # define isUPPER_L1(c) ( isUPPER(c) \ || (FITS_IN_8_BITS(c) \ && ( NATIVE_TO_LATIN1((U8) c) >= 0xC0 \ && NATIVE_TO_LATIN1((U8) c) <= 0xDE \ && NATIVE_TO_LATIN1((U8) c) != 0xD7))) #endif #ifndef isWORDCHAR # define isWORDCHAR(c) (isALPHANUMERIC(c) || (c) == '_') #endif #ifndef isWORDCHAR_L1 # define isWORDCHAR_L1(c) (isIDFIRST_L1(c) || isDIGIT(c)) #endif #ifndef isWORDCHAR_LC # define isWORDCHAR_LC(c) (isIDFIRST_LC(c) || isDIGIT_LC(c)) #endif #ifndef isXDIGIT # define isXDIGIT(c) ( isDIGIT(c) \ || inRANGE((c), 'a', 'f') \ || inRANGE((c), 'A', 'F')) #endif #ifndef isXDIGIT_L1 # define isXDIGIT_L1(c) isXDIGIT(c) #endif #ifndef isXDIGIT_LC # define isXDIGIT_LC(c) isxdigit(c) #endif #ifndef isALNUM_A # define isALNUM_A(c) isALNUM(c) #endif #ifndef isALNUMC_A # define isALNUMC_A(c) isALNUMC(c) #endif #ifndef isALPHA_A # define isALPHA_A(c) isALPHA(c) #endif #ifndef isALPHANUMERIC_A # define isALPHANUMERIC_A(c) isALPHANUMERIC(c) #endif #ifndef isASCII_A # define isASCII_A(c) isASCII(c) #endif #ifndef isBLANK_A # define isBLANK_A(c) isBLANK(c) #endif #ifndef isCNTRL_A # define isCNTRL_A(c) isCNTRL(c) #endif #ifndef isDIGIT_A # define isDIGIT_A(c) isDIGIT(c) #endif #ifndef isGRAPH_A # define isGRAPH_A(c) isGRAPH(c) #endif #ifndef isIDCONT_A # define isIDCONT_A(c) isIDCONT(c) #endif #ifndef isIDFIRST_A # define isIDFIRST_A(c) isIDFIRST(c) #endif #ifndef isLOWER_A # define isLOWER_A(c) isLOWER(c) #endif #ifndef isOCTAL_A # define isOCTAL_A(c) isOCTAL(c) #endif #ifndef isPRINT_A # define isPRINT_A(c) isPRINT(c) #endif #ifndef isPSXSPC_A # define isPSXSPC_A(c) isPSXSPC(c) #endif #ifndef isPUNCT_A # define isPUNCT_A(c) isPUNCT(c) #endif #ifndef isSPACE_A # define isSPACE_A(c) isSPACE(c) #endif #ifndef isUPPER_A # define isUPPER_A(c) isUPPER(c) #endif #ifndef isWORDCHAR_A # define isWORDCHAR_A(c) isWORDCHAR(c) #endif #ifndef isXDIGIT_A # define isXDIGIT_A(c) isXDIGIT(c) #endif #ifndef isASCII_utf8_safe # define isASCII_utf8_safe(s,e) (((e) - (s)) <= 0 ? 0 : isASCII(*(s))) #endif #ifndef isASCII_uvchr # define isASCII_uvchr(c) (FITS_IN_8_BITS(c) ? isASCII_L1(c) : 0) #endif #if (PERL_BCDVERSION >= 0x5006000) # ifdef isALPHA_uni /* If one defined, all are; this is just an exemplar */ # define D_PPP_is_ctype(upper, lower, c) \ (FITS_IN_8_BITS(c) \ ? is ## upper ## _L1(c) \ : is ## upper ## _uni((UV) (c))) /* _uni is old synonym */ # else # define D_PPP_is_ctype(upper, lower, c) \ (FITS_IN_8_BITS(c) \ ? is ## upper ## _L1(c) \ : is_uni_ ## lower((UV) (c))) /* is_uni_ is even older */ # endif #ifndef isALPHA_uvchr # define isALPHA_uvchr(c) D_PPP_is_ctype(ALPHA, alpha, c) #endif #ifndef isALPHANUMERIC_uvchr # define isALPHANUMERIC_uvchr(c) (isALPHA_uvchr(c) || isDIGIT_uvchr(c)) #endif # ifdef is_uni_blank #ifndef isBLANK_uvchr # define isBLANK_uvchr(c) D_PPP_is_ctype(BLANK, blank, c) #endif # else #ifndef isBLANK_uvchr # define isBLANK_uvchr(c) (FITS_IN_8_BITS(c) \ ? isBLANK_L1(c) \ : ( (UV) (c) == 0x1680 /* Unicode 3.0 */ \ || inRANGE((UV) (c), 0x2000, 0x200A) \ || (UV) (c) == 0x202F /* Unicode 3.0 */\ || (UV) (c) == 0x205F /* Unicode 3.2 */\ || (UV) (c) == 0x3000)) #endif # endif #ifndef isCNTRL_uvchr # define isCNTRL_uvchr(c) D_PPP_is_ctype(CNTRL, cntrl, c) #endif #ifndef isDIGIT_uvchr # define isDIGIT_uvchr(c) D_PPP_is_ctype(DIGIT, digit, c) #endif #ifndef isGRAPH_uvchr # define isGRAPH_uvchr(c) D_PPP_is_ctype(GRAPH, graph, c) #endif #ifndef isIDCONT_uvchr # define isIDCONT_uvchr(c) isWORDCHAR_uvchr(c) #endif #ifndef isIDFIRST_uvchr # define isIDFIRST_uvchr(c) D_PPP_is_ctype(IDFIRST, idfirst, c) #endif #ifndef isLOWER_uvchr # define isLOWER_uvchr(c) D_PPP_is_ctype(LOWER, lower, c) #endif #ifndef isPRINT_uvchr # define isPRINT_uvchr(c) D_PPP_is_ctype(PRINT, print, c) #endif #ifndef isPSXSPC_uvchr # define isPSXSPC_uvchr(c) isSPACE_uvchr(c) #endif #ifndef isPUNCT_uvchr # define isPUNCT_uvchr(c) D_PPP_is_ctype(PUNCT, punct, c) #endif #ifndef isSPACE_uvchr # define isSPACE_uvchr(c) D_PPP_is_ctype(SPACE, space, c) #endif #ifndef isUPPER_uvchr # define isUPPER_uvchr(c) D_PPP_is_ctype(UPPER, upper, c) #endif #ifndef isXDIGIT_uvchr # define isXDIGIT_uvchr(c) D_PPP_is_ctype(XDIGIT, xdigit, c) #endif #ifndef isWORDCHAR_uvchr # define isWORDCHAR_uvchr(c) (FITS_IN_8_BITS(c) \ ? isWORDCHAR_L1(c) : isALPHANUMERIC_uvchr(c)) #endif #ifndef isALPHA_utf8_safe # define isALPHA_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, ALPHA) #endif # ifdef isALPHANUMERIC_utf8 #ifndef isALPHANUMERIC_utf8_safe # define isALPHANUMERIC_utf8_safe(s,e) \ D_PPP_IS_GENERIC_UTF8_SAFE(s, e, ALPHANUMERIC) #endif # else #ifndef isALPHANUMERIC_utf8_safe # define isALPHANUMERIC_utf8_safe(s,e) \ (isALPHA_utf8_safe(s,e) || isDIGIT_utf8_safe(s,e)) #endif # endif /* This was broken before 5.18, and just use this instead of worrying about * which releases the official works on */ # if 'A' == 65 #ifndef isBLANK_utf8_safe # define isBLANK_utf8_safe(s,e) \ ( ( LIKELY((e) > (s)) ) ? /* Machine generated */ \ ( ( 0x09 == ((const U8*)s)[0] || 0x20 == ((const U8*)s)[0] ) ? 1 \ : ( LIKELY(((e) - (s)) >= UTF8SKIP(s)) ) ? \ ( ( 0xC2 == ((const U8*)s)[0] ) ? \ ( ( 0xA0 == ((const U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE1 == ((const U8*)s)[0] ) ? \ ( ( ( 0x9A == ((const U8*)s)[1] ) && ( 0x80 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : ( 0xE2 == ((const U8*)s)[0] ) ? \ ( ( 0x80 == ((const U8*)s)[1] ) ? \ ( ( inRANGE(((const U8*)s)[2], 0x80, 0x8A ) || 0xAF == ((const U8*)s)[2] ) ? 3 : 0 )\ : ( ( 0x81 == ((const U8*)s)[1] ) && ( 0x9F == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : ( ( ( 0xE3 == ((const U8*)s)[0] ) && ( 0x80 == ((const U8*)s)[1] ) ) && ( 0x80 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : 0 ) \ : 0 ) #endif # elif 'A' == 193 && '^' == 95 /* EBCDIC 1047 */ #ifndef isBLANK_utf8_safe # define isBLANK_utf8_safe(s,e) \ ( ( LIKELY((e) > (s)) ) ? \ ( ( 0x05 == ((const U8*)s)[0] || 0x40 == ((const U8*)s)[0] ) ? 1 \ : ( LIKELY(((e) - (s)) >= UTF8SKIP(s)) ) ? \ ( ( 0x80 == ((const U8*)s)[0] ) ? \ ( ( 0x41 == ((const U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xBC == ((const U8*)s)[0] ) ? \ ( ( ( 0x63 == ((const U8*)s)[1] ) && ( 0x41 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : ( 0xCA == ((const U8*)s)[0] ) ? \ ( ( 0x41 == ((const U8*)s)[1] ) ? \ ( ( inRANGE(((const U8*)s)[2], 0x41, 0x4A ) || 0x51 == ((const U8*)s)[2] ) ? 3 : 0 )\ : ( 0x42 == ((const U8*)s)[1] ) ? \ ( ( 0x56 == ((const U8*)s)[2] ) ? 3 : 0 ) \ : ( ( 0x43 == ((const U8*)s)[1] ) && ( 0x73 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : ( ( ( 0xCE == ((const U8*)s)[0] ) && ( 0x41 == ((const U8*)s)[1] ) ) && ( 0x41 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : 0 ) \ : 0 ) #endif # elif 'A' == 193 && '^' == 176 /* EBCDIC 037 */ #ifndef isBLANK_utf8_safe # define isBLANK_utf8_safe(s,e) \ ( ( LIKELY((e) > (s)) ) ? \ ( ( 0x05 == ((const U8*)s)[0] || 0x40 == ((const U8*)s)[0] ) ? 1 \ : ( LIKELY(((e) - (s)) >= UTF8SKIP(s)) ) ? \ ( ( 0x78 == ((const U8*)s)[0] ) ? \ ( ( 0x41 == ((const U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xBD == ((const U8*)s)[0] ) ? \ ( ( ( 0x62 == ((const U8*)s)[1] ) && ( 0x41 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : ( 0xCA == ((const U8*)s)[0] ) ? \ ( ( 0x41 == ((const U8*)s)[1] ) ? \ ( ( inRANGE(((const U8*)s)[2], 0x41, 0x4A ) || 0x51 == ((const U8*)s)[2] ) ? 3 : 0 )\ : ( 0x42 == ((const U8*)s)[1] ) ? \ ( ( 0x56 == ((const U8*)s)[2] ) ? 3 : 0 ) \ : ( ( 0x43 == ((const U8*)s)[1] ) && ( 0x72 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : ( ( ( 0xCE == ((const U8*)s)[0] ) && ( 0x41 == ((const U8*)s)[1] ) ) && ( 0x41 == ((const U8*)s)[2] ) ) ? 3 : 0 )\ : 0 ) \ : 0 ) #endif # else # error Unknown character set # endif #ifndef isCNTRL_utf8_safe # define isCNTRL_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, CNTRL) #endif #ifndef isDIGIT_utf8_safe # define isDIGIT_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, DIGIT) #endif #ifndef isGRAPH_utf8_safe # define isGRAPH_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, GRAPH) #endif # ifdef isIDCONT_utf8 #ifndef isIDCONT_utf8_safe # define isIDCONT_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, IDCONT) #endif # else #ifndef isIDCONT_utf8_safe # define isIDCONT_utf8_safe(s,e) isWORDCHAR_utf8_safe(s,e) #endif # endif #ifndef isIDFIRST_utf8_safe # define isIDFIRST_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, IDFIRST) #endif #ifndef isLOWER_utf8_safe # define isLOWER_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, LOWER) #endif #ifndef isPRINT_utf8_safe # define isPRINT_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, PRINT) #endif /* Use the modern definition */ #undef isPSXSPC_utf8_safe #ifndef isPSXSPC_utf8_safe # define isPSXSPC_utf8_safe(s,e) isSPACE_utf8_safe(s,e) #endif #ifndef isPUNCT_utf8_safe # define isPUNCT_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, PUNCT) #endif #ifndef isSPACE_utf8_safe # define isSPACE_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, SPACE) #endif #ifndef isUPPER_utf8_safe # define isUPPER_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, UPPER) #endif # ifdef isWORDCHAR_utf8 #ifndef isWORDCHAR_utf8_safe # define isWORDCHAR_utf8_safe(s,e) D_PPP_IS_GENERIC_UTF8_SAFE(s, e, WORDCHAR) #endif # else #ifndef isWORDCHAR_utf8_safe # define isWORDCHAR_utf8_safe(s,e) \ (isALPHANUMERIC_utf8_safe(s,e) || (*(s)) == '_') #endif # endif /* This was broken before 5.12, and just use this instead of worrying about * which releases the official works on */ # if 'A' == 65 #ifndef isXDIGIT_utf8_safe # define isXDIGIT_utf8_safe(s,e) \ ( ( LIKELY((e) > (s)) ) ? \ ( ( inRANGE(((const U8*)s)[0], 0x30, 0x39 ) || inRANGE(((const U8*)s)[0], 0x41, 0x46 ) || inRANGE(((const U8*)s)[0], 0x61, 0x66 ) ) ? 1\ : ( ( LIKELY(((e) - (s)) >= UTF8SKIP(s)) ) && ( 0xEF == ((const U8*)s)[0] ) ) ? ( ( 0xBC == ((const U8*)s)[1] ) ?\ ( ( inRANGE(((const U8*)s)[2], 0x90, 0x99 ) || inRANGE(((const U8*)s)[2], 0xA1, 0xA6 ) ) ? 3 : 0 )\ : ( ( 0xBD == ((const U8*)s)[1] ) && ( inRANGE(((const U8*)s)[2], 0x81, 0x86 ) ) ) ? 3 : 0 ) : 0 )\ : 0 ) #endif # elif 'A' == 193 && '^' == 95 /* EBCDIC 1047 */ #ifndef isXDIGIT_utf8_safe # define isXDIGIT_utf8_safe(s,e) \ ( ( LIKELY((e) > (s)) ) ? \ ( ( inRANGE(((const U8*)s)[0], 0x81, 0x86 ) || inRANGE(((const U8*)s)[0], 0xC1, 0xC6 ) || inRANGE(((const U8*)s)[0], 0xF0, 0xF9 ) ) ? 1\ : ( ( ( LIKELY(((e) - (s)) >= UTF8SKIP(s)) ) && ( 0xDD == ((const U8*)s)[0] ) ) && ( 0x73 == ((const U8*)s)[1] ) ) ? ( ( 0x67 == ((const U8*)s)[2] ) ?\ ( ( inRANGE(((const U8*)s)[3], 0x57, 0x59 ) || inRANGE(((const U8*)s)[3], 0x62, 0x68 ) ) ? 4 : 0 )\ : ( ( inRANGE(((const U8*)s)[2], 0x68, 0x69 ) ) && ( inRANGE(((const U8*)s)[3], 0x42, 0x47 ) ) ) ? 4 : 0 ) : 0 )\ : 0 ) #endif # elif 'A' == 193 && '^' == 176 /* EBCDIC 037 */ #ifndef isXDIGIT_utf8_safe # define isXDIGIT_utf8_safe(s,e) \ ( ( LIKELY((e) > (s)) ) ? \ ( ( inRANGE(((const U8*)s)[0], 0x81, 0x86 ) || inRANGE(((const U8*)s)[0], 0xC1, 0xC6 ) || inRANGE(((const U8*)s)[0], 0xF0, 0xF9 ) ) ? 1\ : ( ( ( LIKELY(((e) - (s)) >= UTF8SKIP(s)) ) && ( 0xDD == ((const U8*)s)[0] ) ) && ( 0x72 == ((const U8*)s)[1] ) ) ? ( ( 0x66 == ((const U8*)s)[2] ) ?\ ( ( inRANGE(((const U8*)s)[3], 0x57, 0x59 ) || 0x5F == ((const U8*)s)[3] || inRANGE(((const U8*)s)[3], 0x62, 0x67 ) ) ? 4 : 0 )\ : ( ( inRANGE(((const U8*)s)[2], 0x67, 0x68 ) ) && ( inRANGE(((const U8*)s)[3], 0x42, 0x47 ) ) ) ? 4 : 0 ) : 0 )\ : 0 ) #endif # else # error Unknown character set # endif #ifndef isALPHA_LC_utf8_safe # define isALPHA_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, ALPHA) #endif # ifdef isALPHANUMERIC_utf8 #ifndef isALPHANUMERIC_LC_utf8_safe # define isALPHANUMERIC_LC_utf8_safe(s,e) \ D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, ALPHANUMERIC) #endif # else #ifndef isALPHANUMERIC_LC_utf8_safe # define isALPHANUMERIC_LC_utf8_safe(s,e) \ (isALPHA_LC_utf8_safe(s,e) || isDIGIT_LC_utf8_safe(s,e)) #endif # endif #ifndef isBLANK_LC_utf8_safe # define isBLANK_LC_utf8_safe(s,e) \ D_PPP_IS_GENERIC_LC_UTF8_SAFE_BROKEN(s, e, BLANK) #endif #ifndef isCNTRL_LC_utf8_safe # define isCNTRL_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, CNTRL) #endif #ifndef isDIGIT_LC_utf8_safe # define isDIGIT_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, DIGIT) #endif #ifndef isGRAPH_LC_utf8_safe # define isGRAPH_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, GRAPH) #endif # ifdef isIDCONT_utf8 #ifndef isIDCONT_LC_utf8_safe # define isIDCONT_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, IDCONT) #endif # else #ifndef isIDCONT_LC_utf8_safe # define isIDCONT_LC_utf8_safe(s,e) isWORDCHAR_LC_utf8_safe(s,e) #endif # endif #ifndef isIDFIRST_LC_utf8_safe # define isIDFIRST_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, IDFIRST) #endif #ifndef isLOWER_LC_utf8_safe # define isLOWER_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, LOWER) #endif #ifndef isPRINT_LC_utf8_safe # define isPRINT_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, PRINT) #endif /* Use the modern definition */ #undef isPSXSPC_LC_utf8_safe #ifndef isPSXSPC_LC_utf8_safe # define isPSXSPC_LC_utf8_safe(s,e) isSPACE_LC_utf8_safe(s,e) #endif #ifndef isPUNCT_LC_utf8_safe # define isPUNCT_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, PUNCT) #endif #ifndef isSPACE_LC_utf8_safe # define isSPACE_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, SPACE) #endif #ifndef isUPPER_LC_utf8_safe # define isUPPER_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, UPPER) #endif # ifdef isWORDCHAR_utf8 #ifndef isWORDCHAR_LC_utf8_safe # define isWORDCHAR_LC_utf8_safe(s,e) D_PPP_IS_GENERIC_LC_UTF8_SAFE(s, e, WORDCHAR) #endif # else #ifndef isWORDCHAR_LC_utf8_safe # define isWORDCHAR_LC_utf8_safe(s,e) \ (isALPHANUMERIC_LC_utf8_safe(s,e) || (*(s)) == '_') #endif # endif #ifndef isXDIGIT_LC_utf8_safe # define isXDIGIT_LC_utf8_safe(s,e) \ D_PPP_IS_GENERIC_LC_UTF8_SAFE_BROKEN(s, e, XDIGIT) #endif /* Warning: isALPHANUMERIC_utf8_safe, isALPHA_utf8_safe, isASCII_utf8_safe, * isBLANK_utf8_safe, isCNTRL_utf8_safe, isDIGIT_utf8_safe, isGRAPH_utf8_safe, * isIDCONT_utf8_safe, isIDFIRST_utf8_safe, isLOWER_utf8_safe, * isPRINT_utf8_safe, isPSXSPC_utf8_safe, isPUNCT_utf8_safe, isSPACE_utf8_safe, * isUPPER_utf8_safe, isWORDCHAR_utf8_safe, isWORDCHAR_utf8_safe, * isXDIGIT_utf8_safe, * isALPHANUMERIC_LC_utf8_safe, isALPHA_LC_utf8_safe, isASCII_LC_utf8_safe, * isBLANK_LC_utf8_safe, isCNTRL_LC_utf8_safe, isDIGIT_LC_utf8_safe, * isGRAPH_LC_utf8_safe, isIDCONT_LC_utf8_safe, isIDFIRST_LC_utf8_safe, * isLOWER_LC_utf8_safe, isPRINT_LC_utf8_safe, isPSXSPC_LC_utf8_safe, * isPUNCT_LC_utf8_safe, isSPACE_LC_utf8_safe, isUPPER_LC_utf8_safe, * isWORDCHAR_LC_utf8_safe, isWORDCHAR_LC_utf8_safe, isXDIGIT_LC_utf8_safe, * isALPHANUMERIC_uvchr, isALPHA_uvchr, isASCII_uvchr, isBLANK_uvchr, * isCNTRL_uvchr, isDIGIT_uvchr, isGRAPH_uvchr, isIDCONT_uvchr, * isIDFIRST_uvchr, isLOWER_uvchr, isPRINT_uvchr, isPSXSPC_uvchr, * isPUNCT_uvchr, isSPACE_uvchr, isUPPER_uvchr, isWORDCHAR_uvchr, * isWORDCHAR_uvchr, isXDIGIT_uvchr * * The UTF-8 handling is buggy in early Perls, and this can give inaccurate * results for code points above 0xFF, until the implementation started * settling down in 5.12 and 5.14 */ #endif #define D_PPP_TOO_SHORT_MSG "Malformed UTF-8 character starting with:" \ " \\x%02x (too short; %d bytes available, need" \ " %d)\n" /* Perls starting here had a new API which handled multi-character results */ #if (PERL_BCDVERSION >= 0x5007003) #ifndef toLOWER_uvchr # define toLOWER_uvchr(c, s, l) UNI_TO_NATIVE(to_uni_lower(NATIVE_TO_UNI(c), s, l)) #endif #ifndef toUPPER_uvchr # define toUPPER_uvchr(c, s, l) UNI_TO_NATIVE(to_uni_upper(NATIVE_TO_UNI(c), s, l)) #endif #ifndef toTITLE_uvchr # define toTITLE_uvchr(c, s, l) UNI_TO_NATIVE(to_uni_title(NATIVE_TO_UNI(c), s, l)) #endif #ifndef toFOLD_uvchr # define toFOLD_uvchr(c, s, l) UNI_TO_NATIVE(to_uni_fold( NATIVE_TO_UNI(c), s, l)) #endif # if (PERL_BCDVERSION != 0x5015006) /* Just this version is broken */ /* Prefer the macro to the function */ # if defined toLOWER_utf8 # define D_PPP_TO_LOWER_CALLEE(s,r,l) toLOWER_utf8(s,r,l) # else # define D_PPP_TO_LOWER_CALLEE(s,r,l) to_utf8_lower(s,r,l) # endif # if defined toTITLE_utf8 # define D_PPP_TO_TITLE_CALLEE(s,r,l) toTITLE_utf8(s,r,l) # else # define D_PPP_TO_TITLE_CALLEE(s,r,l) to_utf8_title(s,r,l) # endif # if defined toUPPER_utf8 # define D_PPP_TO_UPPER_CALLEE(s,r,l) toUPPER_utf8(s,r,l) # else # define D_PPP_TO_UPPER_CALLEE(s,r,l) to_utf8_upper(s,r,l) # endif # if defined toFOLD_utf8 # define D_PPP_TO_FOLD_CALLEE(s,r,l) toFOLD_utf8(s,r,l) # else # define D_PPP_TO_FOLD_CALLEE(s,r,l) to_utf8_fold(s,r,l) # endif # else /* Below is 5.15.6, which failed to make the macros available # outside of core, so we have to use the 'Perl_' form. khw # decided it was easier to just handle this case than have to # document the exception, and make an exception in the tests below # */ # define D_PPP_TO_LOWER_CALLEE(s,r,l) \ Perl__to_utf8_lower_flags(aTHX_ s, r, l, 0, NULL) # define D_PPP_TO_TITLE_CALLEE(s,r,l) \ Perl__to_utf8_title_flags(aTHX_ s, r, l, 0, NULL) # define D_PPP_TO_UPPER_CALLEE(s,r,l) \ Perl__to_utf8_upper_flags(aTHX_ s, r, l, 0, NULL) # define D_PPP_TO_FOLD_CALLEE(s,r,l) \ Perl__to_utf8_fold_flags(aTHX_ s, r, l, FOLD_FLAGS_FULL, NULL) # endif /* The actual implementation of the backported macros. If too short, croak, * otherwise call the original that doesn't have an upper limit parameter */ # define D_PPP_GENERIC_MULTI_ARG_TO(name, s, e,r,l) \ (((((e) - (s)) <= 0) \ /* We could just do nothing, but modern perls croak */ \ ? (croak("Attempting case change on zero length string"), \ 0) /* So looks like it returns something, and will compile */ \ : ((e) - (s)) < UTF8SKIP(s)) \ ? (croak(D_PPP_TOO_SHORT_MSG, \ s[0], (int) ((e) - (s)), (int) UTF8SKIP(s)), \ 0) \ : D_PPP_TO_ ## name ## _CALLEE(s,r,l)) #ifndef toUPPER_utf8_safe # define toUPPER_utf8_safe(s,e,r,l) \ D_PPP_GENERIC_MULTI_ARG_TO(UPPER,s,e,r,l) #endif #ifndef toLOWER_utf8_safe # define toLOWER_utf8_safe(s,e,r,l) \ D_PPP_GENERIC_MULTI_ARG_TO(LOWER,s,e,r,l) #endif #ifndef toTITLE_utf8_safe # define toTITLE_utf8_safe(s,e,r,l) \ D_PPP_GENERIC_MULTI_ARG_TO(TITLE,s,e,r,l) #endif #ifndef toFOLD_utf8_safe # define toFOLD_utf8_safe(s,e,r,l) \ D_PPP_GENERIC_MULTI_ARG_TO(FOLD,s,e,r,l) #endif #elif (PERL_BCDVERSION >= 0x5006000) /* Here we have UTF-8 support, but using the original API where the case * changing functions merely returned the changed code point; hence they * couldn't handle multi-character results. */ # ifdef uvchr_to_utf8 # define D_PPP_UV_TO_UTF8 uvchr_to_utf8 # else # define D_PPP_UV_TO_UTF8 uv_to_utf8 # endif /* Get the utf8 of the case changed value, and store its length; then have * to re-calculate the changed case value in order to return it */ # define D_PPP_GENERIC_SINGLE_ARG_TO_UVCHR(name, c, s, l) \ (*(l) = (D_PPP_UV_TO_UTF8(s, \ UNI_TO_NATIVE(to_uni_ ## name(NATIVE_TO_UNI(c)))) - (s)), \ UNI_TO_NATIVE(to_uni_ ## name(NATIVE_TO_UNI(c)))) #ifndef toLOWER_uvchr # define toLOWER_uvchr(c, s, l) \ D_PPP_GENERIC_SINGLE_ARG_TO_UVCHR(lower, c, s, l) #endif #ifndef toUPPER_uvchr # define toUPPER_uvchr(c, s, l) \ D_PPP_GENERIC_SINGLE_ARG_TO_UVCHR(upper, c, s, l) #endif #ifndef toTITLE_uvchr # define toTITLE_uvchr(c, s, l) \ D_PPP_GENERIC_SINGLE_ARG_TO_UVCHR(title, c, s, l) #endif #ifndef toFOLD_uvchr # define toFOLD_uvchr(c, s, l) toLOWER_uvchr(c, s, l) #endif # define D_PPP_GENERIC_SINGLE_ARG_TO_UTF8(name, s, e, r, l) \ (((((e) - (s)) <= 0) \ ? (croak("Attempting case change on zero length string"), \ 0) /* So looks like it returns something, and will compile */ \ : ((e) - (s)) < UTF8SKIP(s)) \ ? (croak(D_PPP_TOO_SHORT_MSG, \ s[0], (int) ((e) - (s)), (int) UTF8SKIP(s)), \ 0) \ /* Get the changed code point and store its UTF-8 */ \ : D_PPP_UV_TO_UTF8(r, to_utf8_ ## name(s)), \ /* Then store its length, and re-get code point for return */ \ *(l) = UTF8SKIP(r), to_utf8_ ## name(r)) /* Warning: toUPPER_utf8_safe, toLOWER_utf8_safe, toTITLE_utf8_safe, * toUPPER_uvchr, toLOWER_uvchr, toTITLE_uvchr The UTF-8 case changing operations had bugs before around 5.12 or 5.14; this backport does not correct them. In perls before 7.3, multi-character case changing is not implemented; this backport uses the simple case changes available in those perls. */ #ifndef toUPPER_utf8_safe # define toUPPER_utf8_safe(s,e,r,l) \ D_PPP_GENERIC_SINGLE_ARG_TO_UTF8(upper, s, e, r, l) #endif #ifndef toLOWER_utf8_safe # define toLOWER_utf8_safe(s,e,r,l) \ D_PPP_GENERIC_SINGLE_ARG_TO_UTF8(lower, s, e, r, l) #endif #ifndef toTITLE_utf8_safe # define toTITLE_utf8_safe(s,e,r,l) \ D_PPP_GENERIC_SINGLE_ARG_TO_UTF8(title, s, e, r, l) #endif /* Warning: toFOLD_utf8_safe, toFOLD_uvchr The UTF-8 case changing operations had bugs before around 5.12 or 5.14; this backport does not correct them. In perls before 7.3, case folding is not implemented; instead, this backport substitutes simple (not multi-character, which isn't available) lowercasing. This gives the correct result in most, but not all, instances */ #ifndef toFOLD_utf8_safe # define toFOLD_utf8_safe(s,e,r,l) toLOWER_utf8_safe(s,e,r,l) #endif #endif /* Until we figure out how to support this in older perls... */ #if (PERL_BCDVERSION >= 0x5008000) #ifndef HeUTF8 # define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \ SvUTF8(HeKEY_sv(he)) : \ (U32)HeKUTF8(he)) #endif #endif #ifndef C_ARRAY_LENGTH # define C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0])) #endif #ifndef C_ARRAY_END # define C_ARRAY_END(a) ((a) + C_ARRAY_LENGTH(a)) #endif #ifndef LIKELY # define LIKELY(x) (x) #endif #ifndef UNLIKELY # define UNLIKELY(x) (x) #endif #ifndef MUTABLE_PTR #if defined(PERL_USE_GCC_BRACE_GROUPS) # define MUTABLE_PTR(p) ({ void *_p = (p); _p; }) #else # define MUTABLE_PTR(p) ((void *) (p)) #endif #endif #ifndef MUTABLE_AV # define MUTABLE_AV(p) ((AV *)MUTABLE_PTR(p)) #endif #ifndef MUTABLE_CV # define MUTABLE_CV(p) ((CV *)MUTABLE_PTR(p)) #endif #ifndef MUTABLE_GV # define MUTABLE_GV(p) ((GV *)MUTABLE_PTR(p)) #endif #ifndef MUTABLE_HV # define MUTABLE_HV(p) ((HV *)MUTABLE_PTR(p)) #endif #ifndef MUTABLE_IO # define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p)) #endif #ifndef MUTABLE_SV # define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p)) #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf) #if defined(PERL_USE_GCC_BRACE_GROUPS) # define vnewSVpvf(pat, args) ({ SV *_sv = newSV(0); sv_vsetpvfn(_sv, (pat), strlen((pat)), (args), Null(SV**), 0, Null(bool*)); _sv; }) #else # define vnewSVpvf(pat, args) ((PL_Sv = newSV(0)), sv_vsetpvfn(PL_Sv, (pat), strlen((pat)), (args), Null(SV**), 0, Null(bool*)), PL_Sv) #endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf) # define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf) # define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg) #if defined(NEED_sv_catpvf_mg) static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * const sv, const char * const pat, ...); static #else extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * const sv, const char * const pat, ...); #endif #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * const sv, const char * const pat, ...) { va_list args; va_start(args, pat); sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #ifdef PERL_IMPLICIT_CONTEXT #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext) #if defined(NEED_sv_catpvf_mg_nocontext) static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * const sv, const char * const pat, ...); static #else extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV * const sv, const char * const pat, ...); #endif #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) #define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) void DPPP_(my_sv_catpvf_mg_nocontext)(SV * const sv, const char * const pat, ...) { dTHX; va_list args; va_start(args, pat); sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #endif /* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */ #ifndef sv_catpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext # else # define sv_catpvf_mg Perl_sv_catpvf_mg # endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg) # define sv_vcatpvf_mg(sv, pat, args) \ STMT_START { \ sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ SvSETMAGIC(sv); \ } STMT_END #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg) #if defined(NEED_sv_setpvf_mg) static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * const sv, const char * const pat, ...); static #else extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * const sv, const char * const pat, ...); #endif #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * const sv, const char * const pat, ...) { va_list args; va_start(args, pat); sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #ifdef PERL_IMPLICIT_CONTEXT #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext) #if defined(NEED_sv_setpvf_mg_nocontext) static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * const sv, const char * const pat, ...); static #else extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV * const sv, const char * const pat, ...); #endif #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) #define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) void DPPP_(my_sv_setpvf_mg_nocontext)(SV * const sv, const char * const pat, ...) { dTHX; va_list args; va_start(args, pat); sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); SvSETMAGIC(sv); va_end(args); } #endif #endif #endif /* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */ #ifndef sv_setpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext # else # define sv_setpvf_mg Perl_sv_setpvf_mg # endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg) # define sv_vsetpvf_mg(sv, pat, args) \ STMT_START { \ sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ SvSETMAGIC(sv); \ } STMT_END #endif /* Hint: sv_2pv_nolen * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen(). */ #ifndef sv_2pv_nolen # define sv_2pv_nolen(sv) SvPV_nolen(sv) #endif #ifdef SvPVbyte /* Hint: SvPVbyte * Does not work in perl-5.6.1, dbipport.h implements a version * borrowed from perl-5.7.3. */ #if (PERL_BCDVERSION < 0x5007000) #ifndef sv_2pvbyte # define sv_2pvbyte(sv, lp) (sv_utf8_downgrade((sv), 0), SvPV((sv), *(lp))) #endif /* Hint: sv_2pvbyte * Use the SvPVbyte() macro instead of sv_2pvbyte(). */ /* Replace sv_2pvbyte with SvPVbyte */ #undef SvPVbyte #define SvPVbyte(sv, lp) \ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) #endif #else # define SvPVbyte SvPV # define sv_2pvbyte sv_2pv #endif #ifndef sv_2pvbyte_nolen # define sv_2pvbyte_nolen(sv) sv_2pv_nolen(sv) #endif /* Hint: sv_pvn * Always use the SvPV() macro instead of sv_pvn(). */ /* Replace sv_pvn with SvPV */ /* Hint: sv_pvn_force * Always use the SvPV_force() macro instead of sv_pvn_force(). */ /* Replace sv_pvn_force with SvPV_force */ /* If these are undefined, they're not handled by the core anyway */ #ifndef SV_IMMEDIATE_UNREF # define SV_IMMEDIATE_UNREF 0 #endif #ifndef SV_GMAGIC # define SV_GMAGIC 0 #endif #ifndef SV_COW_DROP_PV # define SV_COW_DROP_PV 0 #endif #ifndef SV_UTF8_NO_ENCODING # define SV_UTF8_NO_ENCODING 0 #endif #ifndef SV_CONST_RETURN # define SV_CONST_RETURN 0 #endif #ifndef SV_MUTABLE_RETURN # define SV_MUTABLE_RETURN 0 #endif #ifndef SV_SMAGIC # define SV_SMAGIC 0 #endif #ifndef SV_HAS_TRAILING_NUL # define SV_HAS_TRAILING_NUL 0 #endif #ifndef SV_COW_SHARED_HASH_KEYS # define SV_COW_SHARED_HASH_KEYS 0 #endif #if (PERL_BCDVERSION < 0x5007002) # /* Fix sv_2pv for Perl < 5.7.2 - view https://github.com/Dual-Life/Devel-PPPort/issues/231 */ # ifdef sv_2pv # undef sv_2pv # endif # if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef sv_2pv # define sv_2pv(sv, lp) ({ SV *_sv_2pv = (sv); STRLEN sv_2pv_dummy_; STRLEN *_lp_2pv = (lp); _lp_2pv = _lp_2pv ? : &sv_2pv_dummy_; SvPOKp(_sv_2pv) ? ((*(_lp_2pv) = SvCUR(_sv_2pv)), SvPVX(_sv_2pv)) : Perl_sv_2pv(aTHX_ _sv_2pv, (_lp_2pv)); }) #endif # else #ifndef sv_2pv # define sv_2pv(sv, lp) (SvPOKp(sv) ? ((*((lp) ? (lp) : &PL_na) = SvCUR(sv)), SvPVX(sv)) : Perl_sv_2pv(aTHX_ (sv), (lp))) #endif # endif #endif #if (PERL_BCDVERSION < 0x5007002) /* Define sv_2pv_flags for Perl < 5.7.2 which does not have it at all */ #if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef sv_2pv_flags # define sv_2pv_flags(sv, lp, flags) ({ SV *_sv = (sv); STRLEN sv_2pv_dummy_; const I32 _flags = (flags); STRLEN *_lp = lp; _lp = _lp ? : &sv_2pv_dummy_; (!(_flags & SV_GMAGIC) && SvGMAGICAL(_sv)) ? ({ char *_pv; SvGMAGICAL_off(_sv); _pv = sv_2pv(_sv, _lp); SvGMAGICAL_on(_sv); _pv; }) : sv_2pv(_sv, _lp); }) #endif #ifndef sv_pvn_force_flags # define sv_pvn_force_flags(sv, lp, flags) ({ SV *_sv = (sv); STRLEN sv_2pv_dummy_; const I32 _flags = (flags); STRLEN *_lp = lp; _lp = _lp ? : &sv_2pv_dummy_; (!(_flags & SV_GMAGIC) && SvGMAGICAL(_sv)) ? ({ char *_pv; SvGMAGICAL_off(_sv); _pv = sv_pvn_force(_sv, _lp); SvGMAGICAL_on(_sv); _pv; }) : sv_pvn_force(_sv, _lp); }) #endif #else #ifndef sv_2pv_flags # define sv_2pv_flags(sv, lp, flags) ((PL_Sv = (sv)), (!((flags) & SV_GMAGIC) && SvGMAGICAL(PL_Sv)) ? (SvGMAGICAL_off(PL_Sv), (PL_Xpv = (XPV *)sv_2pv(PL_Sv, (lp) ? (lp) : &PL_na)), SvGMAGICAL_on(PL_Sv), (char *)PL_Xpv) : sv_2pv(PL_Sv, (lp) ? (lp) : &PL_na)) #endif #ifndef sv_pvn_force_flags # define sv_pvn_force_flags(sv, lp, flags) ((PL_Sv = (sv)), (!((flags) & SV_GMAGIC) && SvGMAGICAL(PL_Sv)) ? (SvGMAGICAL_off(PL_Sv), (PL_Xpv = (XPV *)sv_pvn_force(PL_Sv, (lp) ? (lp) : &PL_na)), SvGMAGICAL_on(PL_Sv), (char *)PL_Xpv) : sv_pvn_force(PL_Sv, (lp) ? (lp) : &PL_na)) #endif #endif #elif (PERL_BCDVERSION < 0x5017002) /* Fix sv_2pv_flags for Perl < 5.17.2 */ # ifdef sv_2pv_flags # undef sv_2pv_flags # endif # if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef sv_2pv_flags # define sv_2pv_flags(sv, lp, flags) ({ SV *_sv_2pv = (sv); STRLEN sv_2pv_dummy_; const I32 _flags_2pv = (flags); STRLEN *_lp_2pv = (lp); _lp_2pv = _lp_2pv ? : &sv_2pv_dummy_; ((!(_flags_2pv & SV_GMAGIC) || !SvGMAGICAL(_sv_2pv)) && SvPOKp(_sv_2pv)) ? ((*(_lp_2pv) = SvCUR(_sv_2pv)), SvPVX(_sv_2pv)) : Perl_sv_2pv_flags(aTHX_ _sv_2pv, (_lp_2pv), (_flags_2pv)); }) #endif # else #ifndef sv_2pv_flags # define sv_2pv_flags(sv, lp, flags) (((!((flags) & SV_GMAGIC) || !SvGMAGICAL(sv)) && SvPOKp(sv)) ? ((*((lp) ? (lp) : &PL_na) = SvCUR(sv)), SvPVX(sv)) : Perl_sv_2pv_flags(aTHX_ (sv), (lp), (flags))) #endif # endif #endif #if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) ) # define D_PPP_SVPV_NOLEN_LP_ARG &PL_na #else # define D_PPP_SVPV_NOLEN_LP_ARG 0 #endif #ifndef SvPV_const # define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_mutable # define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_flags # define SvPV_flags(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags)) #endif #ifndef SvPV_flags_const # define SvPV_flags_const(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \ (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN)) #endif #ifndef SvPV_flags_const_nolen # define SvPV_flags_const_nolen(sv, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX_const(sv) : \ (const char*) sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN)) #endif #ifndef SvPV_flags_mutable # define SvPV_flags_mutable(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \ sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) #endif #ifndef SvPV_force # define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_force_nolen # define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC) #endif #ifndef SvPV_force_mutable # define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC) #endif #ifndef SvPV_force_nomg # define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0) #endif #ifndef SvPV_force_nomg_nolen # define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) #endif #ifndef SvPV_force_flags # define SvPV_force_flags(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags)) #endif #ifndef SvPV_force_flags_nolen # define SvPV_force_flags_nolen(sv, flags) \ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ? SvPVX(sv) : sv_pvn_force_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, flags)) #endif #ifndef SvPV_force_flags_mutable # define SvPV_force_flags_mutable(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \ : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) #endif #ifndef SvPV_nolen # define SvPV_nolen(sv) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX(sv) : sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC)) #endif #ifndef SvPV_nolen_const # define SvPV_nolen_const(sv) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX_const(sv) : sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN)) #endif # if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef SvPVx_nolen_const # define SvPVx_nolen_const(sv) ({SV *sV_ = (sv); SvPV_nolen_const(sV_); }) #endif # else #ifndef SvPVx_nolen_const # define SvPVx_nolen_const(sv) (PL_Sv = sv, SvPV_nolen_const(PL_Sv)) #endif # endif #ifndef SvPV_nomg # define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0) #endif #ifndef SvPV_nomg_const # define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0) #endif #ifndef SvPV_nomg_const_nolen # define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) #endif #ifndef SvPV_nomg_nolen # define SvPV_nomg_nolen(sv) ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? SvPVX(sv) : sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, 0)) #endif #ifndef SvPV_renew # define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \ SvPV_set((sv), (char *) saferealloc( \ (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \ } STMT_END #endif #ifndef SvPVCLEAR # define SvPVCLEAR(sv) sv_setpvs((sv), "") #endif #ifndef WARN_ALL # define WARN_ALL 0 #endif #ifndef WARN_CLOSURE # define WARN_CLOSURE 1 #endif #ifndef WARN_DEPRECATED # define WARN_DEPRECATED 2 #endif #ifndef WARN_EXITING # define WARN_EXITING 3 #endif #ifndef WARN_GLOB # define WARN_GLOB 4 #endif #ifndef WARN_IO # define WARN_IO 5 #endif #ifndef WARN_CLOSED # define WARN_CLOSED 6 #endif #ifndef WARN_EXEC # define WARN_EXEC 7 #endif #ifndef WARN_LAYER # define WARN_LAYER 8 #endif #ifndef WARN_NEWLINE # define WARN_NEWLINE 9 #endif #ifndef WARN_PIPE # define WARN_PIPE 10 #endif #ifndef WARN_UNOPENED # define WARN_UNOPENED 11 #endif #ifndef WARN_MISC # define WARN_MISC 12 #endif #ifndef WARN_NUMERIC # define WARN_NUMERIC 13 #endif #ifndef WARN_ONCE # define WARN_ONCE 14 #endif #ifndef WARN_OVERFLOW # define WARN_OVERFLOW 15 #endif #ifndef WARN_PACK # define WARN_PACK 16 #endif #ifndef WARN_PORTABLE # define WARN_PORTABLE 17 #endif #ifndef WARN_RECURSION # define WARN_RECURSION 18 #endif #ifndef WARN_REDEFINE # define WARN_REDEFINE 19 #endif #ifndef WARN_REGEXP # define WARN_REGEXP 20 #endif #ifndef WARN_SEVERE # define WARN_SEVERE 21 #endif #ifndef WARN_DEBUGGING # define WARN_DEBUGGING 22 #endif #ifndef WARN_INPLACE # define WARN_INPLACE 23 #endif #ifndef WARN_INTERNAL # define WARN_INTERNAL 24 #endif #ifndef WARN_MALLOC # define WARN_MALLOC 25 #endif #ifndef WARN_SIGNAL # define WARN_SIGNAL 26 #endif #ifndef WARN_SUBSTR # define WARN_SUBSTR 27 #endif #ifndef WARN_SYNTAX # define WARN_SYNTAX 28 #endif #ifndef WARN_AMBIGUOUS # define WARN_AMBIGUOUS 29 #endif #ifndef WARN_BAREWORD # define WARN_BAREWORD 30 #endif #ifndef WARN_DIGIT # define WARN_DIGIT 31 #endif #ifndef WARN_PARENTHESIS # define WARN_PARENTHESIS 32 #endif #ifndef WARN_PRECEDENCE # define WARN_PRECEDENCE 33 #endif #ifndef WARN_PRINTF # define WARN_PRINTF 34 #endif #ifndef WARN_PROTOTYPE # define WARN_PROTOTYPE 35 #endif #ifndef WARN_QW # define WARN_QW 36 #endif #ifndef WARN_RESERVED # define WARN_RESERVED 37 #endif #ifndef WARN_SEMICOLON # define WARN_SEMICOLON 38 #endif #ifndef WARN_TAINT # define WARN_TAINT 39 #endif #ifndef WARN_THREADS # define WARN_THREADS 40 #endif #ifndef WARN_UNINITIALIZED # define WARN_UNINITIALIZED 41 #endif #ifndef WARN_UNPACK # define WARN_UNPACK 42 #endif #ifndef WARN_UNTIE # define WARN_UNTIE 43 #endif #ifndef WARN_UTF8 # define WARN_UTF8 44 #endif #ifndef WARN_VOID # define WARN_VOID 45 #endif #ifndef WARN_ASSERTIONS # define WARN_ASSERTIONS 46 #endif #ifndef packWARN # define packWARN(a) (a) #endif #ifndef packWARN2 # define packWARN2(a,b) (packWARN(a) << 8 | (b)) #endif #ifndef packWARN3 # define packWARN3(a,b,c) (packWARN2(a,b) << 8 | (c)) #endif #ifndef packWARN4 # define packWARN4(a,b,c,d) (packWARN3(a,b,c) << 8 | (d)) #endif #ifndef ckWARN # ifdef G_WARN_ON # define ckWARN(a) (PL_dowarn & G_WARN_ON) # else # define ckWARN(a) PL_dowarn # endif #endif #ifndef ckWARN2 # define ckWARN2(a,b) (ckWARN(a) || ckWARN(b)) #endif #ifndef ckWARN3 # define ckWARN3(a,b,c) (ckWARN(c) || ckWARN2(a,b)) #endif #ifndef ckWARN4 # define ckWARN4(a,b,c,d) (ckWARN(d) || ckWARN3(a,b,c)) #endif #ifndef ckWARN_d # ifdef isLEXWARN_off # define ckWARN_d(a) (isLEXWARN_off || ckWARN(a)) # else # define ckWARN_d(a) 1 # endif #endif #ifndef ckWARN2_d # define ckWARN2_d(a,b) (ckWARN_d(a) || ckWARN_d(b)) #endif #ifndef ckWARN3_d # define ckWARN3_d(a,b,c) (ckWARN_d(c) || ckWARN2_d(a,b)) #endif #ifndef ckWARN4_d # define ckWARN4_d(a,b,c,d) (ckWARN_d(d) || ckWARN3_d(a,b,c)) #endif #ifndef vwarner # define vwarner(err, pat, argsp) \ STMT_START { SV *sv; \ PERL_UNUSED_ARG(err); \ sv = vnewSVpvf(pat, argsp); \ sv_2mortal(sv); \ warn("%s", SvPV_nolen(sv)); \ } STMT_END #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(warner) # if defined(NEED_warner) static void DPPP_(my_warner)(U32 err, const char * pat, ...); static #else extern void DPPP_(my_warner)(U32 err, const char * pat, ...); #endif #if defined(NEED_warner) || defined(NEED_warner_GLOBAL) #define Perl_warner DPPP_(my_warner) void DPPP_(my_warner)(U32 err, const char *pat, ...) { va_list args; va_start(args, pat); vwarner(err, pat, &args); va_end(args); } # define warner Perl_warner # define Perl_warner_nocontext Perl_warner # endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(ck_warner) # if defined(NEED_ck_warner) static void DPPP_(my_ck_warner)(pTHX_ U32 err, const char * pat, ...); static #else extern void DPPP_(my_ck_warner)(pTHX_ U32 err, const char * pat, ...); #endif #if defined(NEED_ck_warner) || defined(NEED_ck_warner_GLOBAL) #define Perl_ck_warner DPPP_(my_ck_warner) void DPPP_(my_ck_warner)(pTHX_ U32 err, const char *pat, ...) { va_list args; if ( ! ckWARN((err ) & 0xFF) && ! ckWARN((err >> 8) & 0xFF) && ! ckWARN((err >> 16) & 0xFF) && ! ckWARN((err >> 24) & 0xFF)) { return; } va_start(args, pat); vwarner(err, pat, &args); va_end(args); } # define ck_warner Perl_ck_warner # endif #endif #if (PERL_BCDVERSION >= 0x5004000) && !defined(ck_warner_d) # if defined(NEED_ck_warner_d) static void DPPP_(my_ck_warner_d)(pTHX_ U32 err, const char * pat, ...); static #else extern void DPPP_(my_ck_warner_d)(pTHX_ U32 err, const char * pat, ...); #endif #if defined(NEED_ck_warner_d) || defined(NEED_ck_warner_d_GLOBAL) #define Perl_ck_warner_d DPPP_(my_ck_warner_d) void DPPP_(my_ck_warner_d)(pTHX_ U32 err, const char *pat, ...) { va_list args; if ( ! ckWARN_d((err ) & 0xFF) && ! ckWARN_d((err >> 8) & 0xFF) && ! ckWARN_d((err >> 16) & 0xFF) && ! ckWARN_d((err >> 24) & 0xFF)) { return; } va_start(args, pat); vwarner(err, pat, &args); va_end(args); } # define ck_warner_d Perl_ck_warner_d # endif #endif #ifndef IVdf # if IVSIZE == LONGSIZE # define IVdf "ld" # define UVuf "lu" # define UVof "lo" # define UVxf "lx" # define UVXf "lX" # elif IVSIZE == INTSIZE # define IVdf "d" # define UVuf "u" # define UVof "o" # define UVxf "x" # define UVXf "X" # else # error "cannot define IV/UV formats" # endif #endif #ifndef NVef # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000) /* Not very likely, but let's try anyway. */ # define NVef PERL_PRIeldbl # define NVff PERL_PRIfldbl # define NVgf PERL_PRIgldbl # else # define NVef "e" # define NVff "f" # define NVgf "g" # endif #endif #ifndef sv_setuv # define sv_setuv(sv, uv) \ STMT_START { \ UV TeMpUv = uv; \ if (TeMpUv <= IV_MAX) \ sv_setiv(sv, TeMpUv); \ else \ sv_setnv(sv, (double)TeMpUv); \ } STMT_END #endif #ifndef newSVuv # define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) #endif #if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef sv_2uv # define sv_2uv(sv) ({ SV *_sv = (sv); (UV) (SvNOK(_sv) ? SvNV(_sv) : sv_2nv(_sv)); }) #endif #else #ifndef sv_2uv # define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) #endif #endif #ifndef SvUVX # define SvUVX(sv) ((UV)SvIVX(sv)) #endif #ifndef SvUVXx # define SvUVXx(sv) SvUVX(sv) #endif #ifndef SvUV # define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) #endif #if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef SvUVx # define SvUVx(sv) ({ SV *_sv = (sv)); SvUV(_sv); }) #endif #else #ifndef SvUVx # define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) #endif #endif /* Hint: sv_uv * Always use the SvUVx() macro instead of sv_uv(). */ /* Replace sv_uv with SvUVx */ #ifndef sv_uv # define sv_uv(sv) SvUVx(sv) #endif #if !defined(SvUOK) && defined(SvIOK_UV) # define SvUOK(sv) SvIOK_UV(sv) #endif #ifndef XST_mUV # define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) #endif #ifndef XSRETURN_UV # define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END #endif #ifndef PUSHu # define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END #endif #ifndef XPUSHu # define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END #endif #if !defined(my_strnlen) #if defined(NEED_my_strnlen) static Size_t DPPP_(my_my_strnlen)(const char * str, Size_t maxlen); static #else extern Size_t DPPP_(my_my_strnlen)(const char * str, Size_t maxlen); #endif #if defined(NEED_my_strnlen) || defined(NEED_my_strnlen_GLOBAL) #define my_strnlen DPPP_(my_my_strnlen) #define Perl_my_strnlen DPPP_(my_my_strnlen) Size_t DPPP_(my_my_strnlen)(const char *str, Size_t maxlen) { const char *p = str; while(maxlen-- && *p) p++; return p - str; } #endif #endif #ifdef HAS_MEMCMP #ifndef memNE # define memNE(s1,s2,l) (memcmp(s1,s2,l)) #endif #ifndef memEQ # define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) #endif #else #ifndef memNE # define memNE(s1,s2,l) (bcmp(s1,s2,l)) #endif #ifndef memEQ # define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) #endif #endif #ifndef memEQs # define memEQs(s1, l, s2) \ (sizeof(s2)-1 == l && memEQ(s1, (s2 ""), (sizeof(s2)-1))) #endif #ifndef memNEs # define memNEs(s1, l, s2) !memEQs(s1, l, s2) #endif #ifndef memCHRs # define memCHRs(s, c) ((const char *) memchr("" s "" , c, sizeof(s)-1)) #endif #ifndef MoveD # define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) #endif #ifndef CopyD # define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) #endif #ifdef HAS_MEMSET #ifndef ZeroD # define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) #endif #else #ifndef ZeroD # define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d) #endif #endif #ifndef PoisonWith # define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t)) #endif #ifndef PoisonNew # define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB) #endif #ifndef PoisonFree # define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF) #endif #ifndef Poison # define Poison(d,n,t) PoisonFree(d,n,t) #endif #ifndef Newx # define Newx(v,n,t) New(0,v,n,t) #endif #ifndef Newxc # define Newxc(v,n,t,c) Newc(0,v,n,t,c) #endif #ifndef Newxz # define Newxz(v,n,t) Newz(0,v,n,t) #endif #ifdef NEED_mess_sv #define NEED_mess #endif #ifdef NEED_mess #define NEED_mess_nocontext #define NEED_vmess #endif #ifndef croak_sv #if (PERL_BCDVERSION >= 0x5007003) || ( (PERL_BCDVERSION >= 0x5006001) && (PERL_BCDVERSION < 0x5007000) ) # if ( (PERL_BCDVERSION >= 0x5008000) && (PERL_BCDVERSION < 0x5008009) ) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5010001) ) # define D_PPP_FIX_UTF8_ERRSV_FOR_SV(sv) \ STMT_START { \ SV *_errsv = ERRSV; \ SvFLAGS(_errsv) = (SvFLAGS(_errsv) & ~SVf_UTF8) | \ (SvFLAGS(sv) & SVf_UTF8); \ } STMT_END # else # define D_PPP_FIX_UTF8_ERRSV_FOR_SV(sv) STMT_START {} STMT_END # endif PERL_STATIC_INLINE void D_PPP_croak_sv(SV *sv) { dTHX; SV *_sv = (sv); if (SvROK(_sv)) { sv_setsv(ERRSV, _sv); croak(NULL); } else { D_PPP_FIX_UTF8_ERRSV_FOR_SV(_sv); croak("%" SVf, SVfARG(_sv)); } } # define croak_sv(sv) D_PPP_croak_sv(sv) #elif (PERL_BCDVERSION >= 0x5004000) # define croak_sv(sv) croak("%" SVf, SVfARG(sv)) #else # define croak_sv(sv) croak("%s", SvPV_nolen(sv)) #endif #endif #ifndef die_sv #if defined(NEED_die_sv) static OP * DPPP_(my_die_sv)(pTHX_ SV * baseex); static #else extern OP * DPPP_(my_die_sv)(pTHX_ SV * baseex); #endif #if defined(NEED_die_sv) || defined(NEED_die_sv_GLOBAL) #ifdef die_sv # undef die_sv #endif #define die_sv(a) DPPP_(my_die_sv)(aTHX_ a) #define Perl_die_sv DPPP_(my_die_sv) OP * DPPP_(my_die_sv)(pTHX_ SV *baseex) { croak_sv(baseex); return (OP *)NULL; } #endif #endif #ifndef warn_sv #if (PERL_BCDVERSION >= 0x5004000) # define warn_sv(sv) warn("%" SVf, SVfARG(sv)) #else # define warn_sv(sv) warn("%s", SvPV_nolen(sv)) #endif #endif #if ! defined vmess && (PERL_BCDVERSION >= 0x5004000) # if defined(NEED_vmess) static SV * DPPP_(my_vmess)(pTHX_ const char * pat, va_list * args); static #else extern SV * DPPP_(my_vmess)(pTHX_ const char * pat, va_list * args); #endif #if defined(NEED_vmess) || defined(NEED_vmess_GLOBAL) #ifdef vmess # undef vmess #endif #define vmess(a,b) DPPP_(my_vmess)(aTHX_ a,b) #define Perl_vmess DPPP_(my_vmess) SV* DPPP_(my_vmess)(pTHX_ const char* pat, va_list* args) { mess(pat, args); return PL_mess_sv; } # endif #endif #if (PERL_BCDVERSION < 0x5006000) && (PERL_BCDVERSION >= 0x5004000) #undef mess #endif #if !defined(mess_nocontext) && !defined(Perl_mess_nocontext) && (PERL_BCDVERSION >= 0x5004000) #if defined(NEED_mess_nocontext) static SV * DPPP_(my_mess_nocontext)(const char * pat, ...); static #else extern SV * DPPP_(my_mess_nocontext)(const char * pat, ...); #endif #if defined(NEED_mess_nocontext) || defined(NEED_mess_nocontext_GLOBAL) #define mess_nocontext DPPP_(my_mess_nocontext) #define Perl_mess_nocontext DPPP_(my_mess_nocontext) SV* DPPP_(my_mess_nocontext)(const char* pat, ...) { dTHX; SV *sv; va_list args; va_start(args, pat); sv = vmess(pat, &args); va_end(args); return sv; } #endif #endif #ifndef mess #if defined(NEED_mess) static SV * DPPP_(my_mess)(pTHX_ const char * pat, ...); static #else extern SV * DPPP_(my_mess)(pTHX_ const char * pat, ...); #endif #if defined(NEED_mess) || defined(NEED_mess_GLOBAL) #define Perl_mess DPPP_(my_mess) SV* DPPP_(my_mess)(pTHX_ const char* pat, ...) { SV *sv; va_list args; va_start(args, pat); sv = vmess(pat, &args); va_end(args); return sv; } #ifdef mess_nocontext #define mess mess_nocontext #else #define mess Perl_mess_nocontext #endif #endif #endif #if ! defined mess_sv && (PERL_BCDVERSION >= 0x5004000) #if defined(NEED_mess_sv) static SV * DPPP_(my_mess_sv)(pTHX_ SV * basemsg, bool consume); static #else extern SV * DPPP_(my_mess_sv)(pTHX_ SV * basemsg, bool consume); #endif #if defined(NEED_mess_sv) || defined(NEED_mess_sv_GLOBAL) #ifdef mess_sv # undef mess_sv #endif #define mess_sv(a,b) DPPP_(my_mess_sv)(aTHX_ a,b) #define Perl_mess_sv DPPP_(my_mess_sv) SV * DPPP_(my_mess_sv)(pTHX_ SV *basemsg, bool consume) { SV *tmp; SV *ret; if (SvPOK(basemsg) && SvCUR(basemsg) && *(SvEND(basemsg)-1) == '\n') { if (consume) return basemsg; ret = mess(""); SvSetSV_nosteal(ret, basemsg); return ret; } if (consume) { sv_catsv(basemsg, mess("")); return basemsg; } ret = mess(""); tmp = newSVsv(ret); SvSetSV_nosteal(ret, basemsg); sv_catsv(ret, tmp); sv_dec(tmp); return ret; } #endif #endif #ifndef warn_nocontext #define warn_nocontext warn #endif #ifndef croak_nocontext #define croak_nocontext croak #endif #ifndef croak_no_modify #define croak_no_modify() croak_nocontext("%s", PL_no_modify) #define Perl_croak_no_modify() croak_no_modify() #endif #ifndef croak_memory_wrap #if (PERL_BCDVERSION >= 0x5009002) || ( (PERL_BCDVERSION >= 0x5008006) && (PERL_BCDVERSION < 0x5009000) ) # define croak_memory_wrap() croak_nocontext("%s", PL_memory_wrap) #else # define croak_memory_wrap() croak_nocontext("panic: memory wrap") #endif #endif #ifndef croak_xs_usage #if defined(NEED_croak_xs_usage) static void DPPP_(my_croak_xs_usage)(const CV * const cv, const char * const params); static #else extern void DPPP_(my_croak_xs_usage)(const CV * const cv, const char * const params); #endif #if defined(NEED_croak_xs_usage) || defined(NEED_croak_xs_usage_GLOBAL) #define croak_xs_usage DPPP_(my_croak_xs_usage) #define Perl_croak_xs_usage DPPP_(my_croak_xs_usage) #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) void DPPP_(my_croak_xs_usage)(const CV *const cv, const char *const params) { dTHX; const GV *const gv = CvGV(cv); PERL_ARGS_ASSERT_CROAK_XS_USAGE; if (gv) { const char *const gvname = GvNAME(gv); const HV *const stash = GvSTASH(gv); const char *const hvname = stash ? HvNAME(stash) : NULL; if (hvname) croak("Usage: %s::%s(%s)", hvname, gvname, params); else croak("Usage: %s(%s)", gvname, params); } else { /* Pants. I don't think that it should be possible to get here. */ croak("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); } } #endif #endif #endif #ifndef mPUSHs # define mPUSHs(s) PUSHs(sv_2mortal(s)) #endif #ifndef PUSHmortal # define PUSHmortal PUSHs(sv_newmortal()) #endif #ifndef mPUSHp # define mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l)) #endif #ifndef mPUSHn # define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n)) #endif #ifndef mPUSHi # define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i)) #endif #ifndef mPUSHu # define mPUSHu(u) sv_setuv(PUSHmortal, (UV)(u)) #endif #ifndef mXPUSHs # define mXPUSHs(s) XPUSHs(sv_2mortal(s)) #endif #ifndef XPUSHmortal # define XPUSHmortal XPUSHs(sv_newmortal()) #endif #ifndef mXPUSHp # define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END #endif #ifndef mXPUSHn # define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END #endif #ifndef mXPUSHi # define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END #endif #ifndef mXPUSHu # define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END #endif /* Replace: 1 */ #ifndef call_sv # define call_sv perl_call_sv #endif #ifndef call_pv # define call_pv perl_call_pv #endif #ifndef call_argv # define call_argv perl_call_argv #endif #ifndef call_method # define call_method perl_call_method #endif #ifndef eval_sv # define eval_sv perl_eval_sv #endif #if (PERL_BCDVERSION >= 0x5003098) && (PERL_BCDVERSION < 0x5006000) #ifndef eval_pv # define eval_pv perl_eval_pv #endif #endif /* Replace: 0 */ #if (PERL_BCDVERSION < 0x5006000) #ifndef Perl_eval_sv # define Perl_eval_sv perl_eval_sv #endif #if (PERL_BCDVERSION >= 0x5003098) #ifndef Perl_eval_pv # define Perl_eval_pv perl_eval_pv #endif #endif #endif #ifndef G_LIST # define G_LIST G_ARRAY /* Replace */ #endif #ifndef PERL_LOADMOD_DENY # define PERL_LOADMOD_DENY 0x1 #endif #ifndef PERL_LOADMOD_NOIMPORT # define PERL_LOADMOD_NOIMPORT 0x2 #endif #ifndef PERL_LOADMOD_IMPORT_OPS # define PERL_LOADMOD_IMPORT_OPS 0x4 #endif #if defined(PERL_USE_GCC_BRACE_GROUPS) # define D_PPP_CROAK_IF_ERROR(cond) ({ \ SV *_errsv; \ ( (cond) \ && (_errsv = ERRSV) \ && (SvROK(_errsv) || SvTRUE(_errsv)) \ && (croak_sv(_errsv), 1)); \ }) #else PERL_STATIC_INLINE void D_PPP_CROAK_IF_ERROR(int cond) { dTHX; SV *errsv; if (!cond) return; errsv = ERRSV; if (SvROK(errsv) || SvTRUE(errsv)) croak_sv(errsv); } # define D_PPP_CROAK_IF_ERROR(cond) D_PPP_CROAK_IF_ERROR(cond) #endif #ifndef G_METHOD # define G_METHOD 64 # ifdef call_sv # undef call_sv # endif # if (PERL_BCDVERSION < 0x5006000) # define call_sv(sv, flags) ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \ (flags) & ~G_METHOD) : perl_call_sv(sv, flags)) # else # define call_sv(sv, flags) ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \ (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags)) # endif #endif #ifndef G_RETHROW # define G_RETHROW 8192 # ifdef eval_sv # undef eval_sv # endif # if defined(PERL_USE_GCC_BRACE_GROUPS) # define eval_sv(sv, flags) ({ I32 _flags = (flags); I32 _ret = Perl_eval_sv(aTHX_ sv, (_flags & ~G_RETHROW)); D_PPP_CROAK_IF_ERROR(_flags & G_RETHROW); _ret; }) # else # define eval_sv(sv, flags) ((PL_na = Perl_eval_sv(aTHX_ sv, ((flags) & ~G_RETHROW))), D_PPP_CROAK_IF_ERROR((flags) & G_RETHROW), (I32)PL_na) # endif #endif /* Older Perl versions have broken croak_on_error=1 */ #if (PERL_BCDVERSION < 0x5031002) # ifdef eval_pv # undef eval_pv # if defined(PERL_USE_GCC_BRACE_GROUPS) # define eval_pv(p, croak_on_error) ({ SV *_sv = Perl_eval_pv(aTHX_ p, 0); D_PPP_CROAK_IF_ERROR(croak_on_error); _sv; }) # else # define eval_pv(p, croak_on_error) ((PL_Sv = Perl_eval_pv(aTHX_ p, 0)), D_PPP_CROAK_IF_ERROR(croak_on_error), PL_Sv) # endif # endif #endif /* This is backport for Perl 5.3.97d and older which do not provide perl_eval_pv */ #ifndef eval_pv #if defined(NEED_eval_pv) static SV * DPPP_(my_eval_pv)(const char * p, I32 croak_on_error); static #else extern SV * DPPP_(my_eval_pv)(const char * p, I32 croak_on_error); #endif #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) #ifdef eval_pv # undef eval_pv #endif #define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) #define Perl_eval_pv DPPP_(my_eval_pv) SV* DPPP_(my_eval_pv)(const char *p, I32 croak_on_error) { dSP; SV* sv = newSVpv(p, 0); PUSHMARK(sp); eval_sv(sv, G_SCALAR); SvREFCNT_dec(sv); SPAGAIN; sv = POPs; PUTBACK; D_PPP_CROAK_IF_ERROR(croak_on_error); return sv; } #endif #endif #if ! defined(vload_module) && defined(start_subparse) #if defined(NEED_vload_module) static void DPPP_(my_vload_module)(U32 flags, SV * name, SV * ver, va_list * args); static #else extern void DPPP_(my_vload_module)(U32 flags, SV * name, SV * ver, va_list * args); #endif #if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL) #ifdef vload_module # undef vload_module #endif #define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d) #define Perl_vload_module DPPP_(my_vload_module) void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args) { dTHR; dVAR; OP *veop, *imop; OP * const modname = newSVOP(OP_CONST, 0, name); /* 5.005 has a somewhat hacky force_normal that doesn't croak on SvREADONLY() if PL_compiling is true. Current perls take care in ck_require() to correctly turn off SvREADONLY before calling force_normal_flags(). This seems a better fix than fudging PL_compiling */ SvREADONLY_off(((SVOP*)modname)->op_sv); modname->op_private |= OPpCONST_BARE; if (ver) { veop = newSVOP(OP_CONST, 0, ver); } else veop = NULL; if (flags & PERL_LOADMOD_NOIMPORT) { imop = sawparens(newNULLLIST()); } else if (flags & PERL_LOADMOD_IMPORT_OPS) { imop = va_arg(*args, OP*); } else { SV *sv; imop = NULL; sv = va_arg(*args, SV*); while (sv) { imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv)); sv = va_arg(*args, SV*); } } { const line_t ocopline = PL_copline; COP * const ocurcop = PL_curcop; const int oexpect = PL_expect; utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0), #if (PERL_BCDVERSION > 0x5003000) veop, #endif modname, imop); PL_expect = oexpect; PL_copline = ocopline; PL_curcop = ocurcop; } } #endif #endif #ifndef load_module #if defined(NEED_load_module) static void DPPP_(my_load_module)(U32 flags, SV * name, SV * ver, ...); static #else extern void DPPP_(my_load_module)(U32 flags, SV * name, SV * ver, ...); #endif #if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL) #ifdef load_module # undef load_module #endif #define load_module DPPP_(my_load_module) #define Perl_load_module DPPP_(my_load_module) void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...) { va_list args; va_start(args, ver); vload_module(flags, name, ver, &args); va_end(args); } #endif #endif #ifndef newRV_inc # define newRV_inc(sv) newRV(sv) /* Replace */ #endif #ifndef newRV_noinc #if defined(PERL_USE_GCC_BRACE_GROUPS) # define newRV_noinc(sv) ({ SV *_sv = (SV *)newRV((sv)); SvREFCNT_dec((sv)); _sv; }) #else # define newRV_noinc(sv) ((PL_Sv = (SV *)newRV((sv))), SvREFCNT_dec((sv)), PL_Sv) #endif #endif /* * Boilerplate macros for initializing and accessing interpreter-local * data from C. All statics in extensions should be reworked to use * this, if you want to make the extension thread-safe. See ext/re/re.xs * for an example of the use of these macros. * * Code that uses these macros is responsible for the following: * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" * 2. Declare a typedef named my_cxt_t that is a structure that contains * all the data that needs to be interpreter-local. * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. * 4. Use the MY_CXT_INIT macro such that it is called exactly once * (typically put in the BOOT: section). * 5. Use the members of the my_cxt_t structure everywhere as * MY_CXT.member. * 6. Use the dMY_CXT macro (a declaration) in all the functions that * access MY_CXT. */ #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) #ifndef START_MY_CXT /* This must appear in all extensions that define a my_cxt_t structure, * right after the definition (i.e. at file scope). The non-threads * case below uses it to declare the data as static. */ #define START_MY_CXT #if (PERL_BCDVERSION < 0x5004068) /* Fetches the SV that keeps the per-interpreter data. */ #define dMY_CXT_SV \ SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) #else /* >= perl5.004_68 */ #define dMY_CXT_SV \ SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ sizeof(MY_CXT_KEY)-1, TRUE) #endif /* < perl5.004_68 */ /* This declaration should be used within all functions that use the * interpreter-local data. */ #define dMY_CXT \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) /* Creates and zeroes the per-interpreter data. * (We allocate my_cxtp in a Perl SV so that it will be released when * the interpreter goes away.) */ #define MY_CXT_INIT \ dMY_CXT_SV; \ /* newSV() allocates one more than needed */ \ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ Zero(my_cxtp, 1, my_cxt_t); \ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) /* This macro must be used to access members of the my_cxt_t structure. * e.g. MYCXT.some_data */ #define MY_CXT (*my_cxtp) /* Judicious use of these macros can reduce the number of times dMY_CXT * is used. Use is similar to pTHX, aTHX etc. */ #define pMY_CXT my_cxt_t *my_cxtp #define pMY_CXT_ pMY_CXT, #define _pMY_CXT ,pMY_CXT #define aMY_CXT my_cxtp #define aMY_CXT_ aMY_CXT, #define _aMY_CXT ,aMY_CXT #endif /* START_MY_CXT */ #ifndef MY_CXT_CLONE /* Clones the per-interpreter data. */ #define MY_CXT_CLONE \ dMY_CXT_SV; \ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) #endif #else /* single interpreter */ #ifndef START_MY_CXT #define START_MY_CXT static my_cxt_t my_cxt; #define dMY_CXT_SV dNOOP #define dMY_CXT dNOOP #define MY_CXT_INIT NOOP #define MY_CXT my_cxt #define pMY_CXT void #define pMY_CXT_ #define _pMY_CXT #define aMY_CXT #define aMY_CXT_ #define _aMY_CXT #endif /* START_MY_CXT */ #ifndef MY_CXT_CLONE #define MY_CXT_CLONE NOOP #endif #endif #ifndef SvREFCNT_inc # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc(sv) \ ({ \ SV * const _sv = (SV*)(sv); \ if (_sv) \ (SvREFCNT(_sv))++; \ _sv; \ }) # else # define SvREFCNT_inc(sv) \ ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL) # endif #endif #ifndef SvREFCNT_inc_simple # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc_simple(sv) \ ({ \ if (sv) \ (SvREFCNT(sv))++; \ (SV *)(sv); \ }) # else # define SvREFCNT_inc_simple(sv) \ ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL) # endif #endif #ifndef SvREFCNT_inc_NN # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc_NN(sv) \ ({ \ SV * const _sv = (SV*)(sv); \ SvREFCNT(_sv)++; \ _sv; \ }) # else # define SvREFCNT_inc_NN(sv) \ (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv) # endif #endif #ifndef SvREFCNT_inc_void # ifdef PERL_USE_GCC_BRACE_GROUPS # define SvREFCNT_inc_void(sv) \ ({ \ SV * const _sv = (SV*)(sv); \ if (_sv) \ (void)(SvREFCNT(_sv)++); \ }) # else # define SvREFCNT_inc_void(sv) \ (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0) # endif #endif #ifndef SvREFCNT_inc_simple_void # define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END #endif #ifndef SvREFCNT_inc_simple_NN # define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv)) #endif #ifndef SvREFCNT_inc_void_NN # define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) #endif #ifndef SvREFCNT_inc_simple_void_NN # define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) #endif #ifndef newSV_type #if defined(PERL_USE_GCC_BRACE_GROUPS) # define newSV_type(t) ({ SV *_sv = newSV(0); sv_upgrade(_sv, (t)); _sv; }) #else # define newSV_type(t) ((PL_Sv = newSV(0)), sv_upgrade(PL_Sv, (t)), PL_Sv) #endif #endif #if (PERL_BCDVERSION < 0x5006000) # define D_PPP_CONSTPV_ARG(x) ((char *) (x)) #else # define D_PPP_CONSTPV_ARG(x) (x) #endif #ifndef newSVpvn # define newSVpvn(data,len) ((data) \ ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ : newSV(0)) #endif #ifndef newSVpvn_utf8 # define newSVpvn_utf8(s, len, u) newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) #endif #ifndef SVf_UTF8 # define SVf_UTF8 0 #endif #ifndef newSVpvn_flags # if defined(PERL_USE_GCC_BRACE_GROUPS) # define newSVpvn_flags(s, len, flags) \ ({ \ SV * sv = newSVpvn(D_PPP_CONSTPV_ARG(s), (len)); \ SvFLAGS(sv) |= ((flags) & SVf_UTF8); \ if ((flags) & SVs_TEMP) sv = sv_2mortal(sv); \ sv; \ }) # else PERL_STATIC_INLINE SV* D_PPP_newSVpvn_flags(const char *const s, const STRLEN len, const U32 flags) { dTHX; SV * sv = newSVpvn(s, len); SvFLAGS(sv) |= (flags & SVf_UTF8); if (flags & SVs_TEMP) return sv_2mortal(sv); return sv; } # define newSVpvn_flags(s, len, flags) D_PPP_newSVpvn_flags((s), (len), (flags)) # endif #endif #ifndef SV_NOSTEAL # define SV_NOSTEAL 16 #endif #if ( (PERL_BCDVERSION >= 0x5007003) && (PERL_BCDVERSION < 0x5008007) ) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009002) ) #undef sv_setsv_flags #if defined(PERL_USE_GCC_BRACE_GROUPS) #define sv_setsv_flags(dstr, sstr, flags) \ STMT_START { \ if (((flags) & SV_NOSTEAL) && (sstr) && (SvFLAGS((SV *)(sstr)) & SVs_TEMP)) { \ SvTEMP_off((SV *)(sstr)); \ Perl_sv_setsv_flags(aTHX_ (dstr), (sstr), (flags) & ~SV_NOSTEAL); \ SvTEMP_on((SV *)(sstr)); \ } else { \ Perl_sv_setsv_flags(aTHX_ (dstr), (sstr), (flags) & ~SV_NOSTEAL); \ } \ } STMT_END #else #define sv_setsv_flags(dstr, sstr, flags) \ ( \ (((flags) & SV_NOSTEAL) && (sstr) && (SvFLAGS((SV *)(sstr)) & SVs_TEMP)) ? ( \ SvTEMP_off((SV *)(sstr)), \ Perl_sv_setsv_flags(aTHX_ (dstr), (sstr), (flags) & ~SV_NOSTEAL), \ SvTEMP_on((SV *)(sstr)), \ 1 \ ) : ( \ Perl_sv_setsv_flags(aTHX_ (dstr), (sstr), (flags) & ~SV_NOSTEAL), \ 1 \ ) \ ) #endif #endif #if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef sv_setsv_flags # define sv_setsv_flags(dstr, sstr, flags) \ STMT_START { \ if (((flags) & SV_NOSTEAL) && (sstr) && (SvFLAGS((SV *)(sstr)) & SVs_TEMP)) { \ SvTEMP_off((SV *)(sstr)); \ if (!((flags) & SV_GMAGIC) && (sstr) && SvGMAGICAL((SV *)(sstr))) { \ SvGMAGICAL_off((SV *)(sstr)); \ sv_setsv((dstr), (sstr)); \ SvGMAGICAL_on((SV *)(sstr)); \ } else { \ sv_setsv((dstr), (sstr)); \ } \ SvTEMP_on((SV *)(sstr)); \ } else { \ if (!((flags) & SV_GMAGIC) && (sstr) && SvGMAGICAL((SV *)(sstr))) { \ SvGMAGICAL_off((SV *)(sstr)); \ sv_setsv((dstr), (sstr)); \ SvGMAGICAL_on((SV *)(sstr)); \ } else { \ sv_setsv((dstr), (sstr)); \ } \ } \ } STMT_END #endif #else #ifndef sv_setsv_flags # define sv_setsv_flags(dstr, sstr, flags) \ ( \ (((flags) & SV_NOSTEAL) && (sstr) && (SvFLAGS((SV *)(sstr)) & SVs_TEMP)) ? ( \ SvTEMP_off((SV *)(sstr)), \ (!((flags) & SV_GMAGIC) && (sstr) && SvGMAGICAL((SV *)(sstr))) ? ( \ SvGMAGICAL_off((SV *)(sstr)), \ sv_setsv((dstr), (sstr)), \ SvGMAGICAL_on((SV *)(sstr)), \ 1 \ ) : ( \ sv_setsv((dstr), (sstr)), \ 1 \ ), \ SvTEMP_on((SV *)(sstr)), \ 1 \ ) : ( \ (!((flags) & SV_GMAGIC) && (sstr) && SvGMAGICAL((SV *)(sstr))) ? ( \ SvGMAGICAL_off((SV *)(sstr)), \ sv_setsv((dstr), (sstr)), \ SvGMAGICAL_on((SV *)(sstr)), \ 1 \ ) : ( \ sv_setsv((dstr), (sstr)), \ 1 \ ) \ ) \ ) #endif #endif #ifndef newSVsv_flags # if defined(PERL_USE_GCC_BRACE_GROUPS) # define newSVsv_flags(sv, flags) \ ({ \ SV *n= newSV(0); \ sv_setsv_flags(n, (sv), (flags)); \ n; \ }) # else PERL_STATIC_INLINE SV* D_PPP_newSVsv_flags(SV *const old, I32 flags) { dTHX; SV *n= newSV(0); sv_setsv_flags(n, old, flags); return n; } # define newSVsv_flags(sv, flags) D_PPP_newSVsv_flags(sv, flags) # endif #endif #ifndef newSVsv_nomg # define newSVsv_nomg(sv) newSVsv_flags((sv), SV_NOSTEAL) #endif #if (PERL_BCDVERSION >= 0x5017005) #ifndef sv_mortalcopy_flags # define sv_mortalcopy_flags(sv, flags) Perl_sv_mortalcopy_flags(aTHX_ (sv), (flags)) #endif #else #ifndef sv_mortalcopy_flags # define sv_mortalcopy_flags(sv, flags) sv_2mortal(newSVsv_flags((sv), (flags))) #endif #endif #ifndef SvMAGIC_set # define SvMAGIC_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END #endif #if (PERL_BCDVERSION < 0x5009003) #ifndef SvPVX_const # define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) #endif #ifndef SvPVX_mutable # define SvPVX_mutable(sv) (0 + SvPVX(sv)) #endif #ifndef SvRV_set # define SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END #endif #else #ifndef SvPVX_const # define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) #endif #ifndef SvPVX_mutable # define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) #endif #ifndef SvRV_set # define SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ((sv)->sv_u.svu_rv = (val)); } STMT_END #endif #endif #ifndef SvSTASH_set # define SvSTASH_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END #endif #if (PERL_BCDVERSION < 0x5004000) #ifndef SvUV_set # define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END #endif #else #ifndef SvUV_set # define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END #endif #endif /* Hint: newSVpvn_share * The SVs created by this function only mimic the behaviour of * shared PVs without really being shared. Only use if you know * what you're doing. */ #ifndef newSVpvn_share #if defined(NEED_newSVpvn_share) static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char * s, I32 len, U32 hash); static #else extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char * s, I32 len, U32 hash); #endif #if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL) #ifdef newSVpvn_share # undef newSVpvn_share #endif #define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c) #define Perl_newSVpvn_share DPPP_(my_newSVpvn_share) SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *s, I32 len, U32 hash) { SV *sv; if (len < 0) len = -len; if (!hash) PERL_HASH(hash, (char*) s, len); sv = newSVpvn((char *) s, len); sv_upgrade(sv, SVt_PVIV); SvIVX(sv) = hash; SvREADONLY_on(sv); SvPOK_on(sv); return sv; } #endif #endif #ifndef SvSHARED_HASH # define SvSHARED_HASH(sv) (0 + SvUVX(sv)) #endif #ifndef HvNAME_get # define HvNAME_get(hv) HvNAME(hv) #endif #ifndef HvNAMELEN_get # define HvNAMELEN_get(hv) (HvNAME_get(hv) ? (I32)strlen(HvNAME_get(hv)) : 0) #endif #if (PERL_BCDVERSION >= 0x5009002) && (PERL_BCDVERSION <= 0x5009003) /* 5.9.2 and 5.9.3 ignore the length param */ #undef gv_fetchpvn_flags #endif #ifdef GV_NOADD_MASK # define D_PPP_GV_NOADD_MASK GV_NOADD_MASK #else # define D_PPP_GV_NOADD_MASK 0xE0 #endif #ifndef gv_fetchpvn_flags # define gv_fetchpvn_flags(name, len, flags, sv_type) gv_fetchpv(SvPVX(sv_2mortal(newSVpvn((name), (len)))), ((flags) & D_PPP_GV_NOADD_MASK) ? FALSE : TRUE, (I32)(sv_type)) #endif #ifndef GvSVn # define GvSVn(gv) GvSV(gv) #endif #ifndef isGV_with_GP # define isGV_with_GP(gv) isGV(gv) #endif #ifndef gv_fetchsv # define gv_fetchsv(name, flags, svt) gv_fetchpv(SvPV_nolen_const(name), flags, svt) #endif #ifndef get_cvn_flags # define get_cvn_flags(name, namelen, flags) get_cv(name, flags) #endif #ifndef gv_init_pvn # define gv_init_pvn(gv, stash, ptr, len, flags) gv_init(gv, stash, ptr, len, flags & GV_ADDMULTI ? TRUE : FALSE) #endif /* concatenating with "" ensures that only literal strings are accepted as argument * note that STR_WITH_LEN() can't be used as argument to macros or functions that * under some configurations might be macros */ #ifndef STR_WITH_LEN # define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) #endif #ifndef newSVpvs # define newSVpvs(str) newSVpvn(str "", sizeof(str) - 1) #endif #ifndef newSVpvs_flags # define newSVpvs_flags(str, flags) newSVpvn_flags(str "", sizeof(str) - 1, flags) #endif #ifndef newSVpvs_share # define newSVpvs_share(str) newSVpvn_share(str "", sizeof(str) - 1, 0) #endif #ifndef sv_catpvs # define sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1) #endif #ifndef sv_setpvs # define sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1) #endif #ifndef hv_fetchs # define hv_fetchs(hv, key, lval) hv_fetch(hv, key "", sizeof(key) - 1, lval) #endif #ifndef hv_stores # define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0) #endif #ifndef gv_fetchpvs # define gv_fetchpvs(name, flags, svt) gv_fetchpvn_flags(name "", sizeof(name) - 1, flags, svt) #endif #ifndef gv_stashpvs # define gv_stashpvs(name, flags) gv_stashpvn(name "", sizeof(name) - 1, flags) #endif #ifndef get_cvs # define get_cvs(name, flags) get_cvn_flags(name "", sizeof(name)-1, flags) #endif #undef SvGETMAGIC #ifndef SvGETMAGIC # define SvGETMAGIC(x) ((void)(UNLIKELY(SvGMAGICAL(x)) && mg_get(x))) #endif /* That's the best we can do... */ #ifndef sv_catpvn_nomg # define sv_catpvn_nomg sv_catpvn #endif #ifndef sv_catsv_nomg # define sv_catsv_nomg sv_catsv #endif #ifndef sv_setsv_nomg # define sv_setsv_nomg sv_setsv #endif #ifndef sv_pvn_nomg # define sv_pvn_nomg sv_pvn #endif #ifdef SVf_IVisUV #if defined(PERL_USE_GCC_BRACE_GROUPS) #ifndef SvIV_nomg # define SvIV_nomg(sv) (!SvGMAGICAL((sv)) ? SvIV((sv)) : ({ SV *_sviv = sv_mortalcopy_flags((sv), SV_NOSTEAL); IV _iv = SvIV(_sviv); SvFLAGS((sv)) = (SvFLAGS((sv)) & ~SVf_IVisUV) | (SvFLAGS(_sviv) & SVf_IVisUV); _iv; })) #endif #ifndef SvUV_nomg # define SvUV_nomg(sv) (!SvGMAGICAL((sv)) ? SvUV((sv)) : ({ SV *_svuv = sv_mortalcopy_flags((sv), SV_NOSTEAL); UV _uv = SvUV(_svuv); SvFLAGS((sv)) = (SvFLAGS((sv)) & ~SVf_IVisUV) | (SvFLAGS(_svuv) & SVf_IVisUV); _uv; })) #endif #else #ifndef SvIV_nomg # define SvIV_nomg(sv) (!SvGMAGICAL((sv)) ? SvIV((sv)) : ((PL_Sv = sv_mortalcopy_flags((sv), SV_NOSTEAL)), sv_upgrade(PL_Sv, SVt_PVIV), (SvIVX(PL_Sv) = SvIV(PL_Sv)), (SvFLAGS((sv)) = (SvFLAGS((sv)) & ~SVf_IVisUV) | (SvFLAGS(PL_Sv) & SVf_IVisUV)), SvIVX(PL_Sv))) #endif #ifndef SvUV_nomg # define SvUV_nomg(sv) (!SvGMAGICAL((sv)) ? SvIV((sv)) : ((PL_Sv = sv_mortalcopy_flags((sv), SV_NOSTEAL)), sv_upgrade(PL_Sv, SVt_PVIV), (SvUVX(PL_Sv) = SvUV(PL_Sv)), (SvFLAGS((sv)) = (SvFLAGS((sv)) & ~SVf_IVisUV) | (SvFLAGS(PL_Sv) & SVf_IVisUV)), SvUVX(PL_Sv))) #endif #endif #else #ifndef SvIV_nomg # define SvIV_nomg(sv) (!SvGMAGICAL((sv)) ? SvIV((sv)) : SvIVx(sv_mortalcopy_flags((sv), SV_NOSTEAL))) #endif #ifndef SvUV_nomg # define SvUV_nomg(sv) (!SvGMAGICAL((sv)) ? SvUV((sv)) : SvUVx(sv_mortalcopy_flags((sv), SV_NOSTEAL))) #endif #endif #ifndef SvNV_nomg # define SvNV_nomg(sv) (!SvGMAGICAL((sv)) ? SvNV((sv)) : SvNVx(sv_mortalcopy_flags((sv), SV_NOSTEAL))) #endif #ifndef SvTRUE_nomg # define SvTRUE_nomg(sv) (!SvGMAGICAL((sv)) ? SvTRUE((sv)) : SvTRUEx(sv_mortalcopy_flags((sv), SV_NOSTEAL))) #endif #ifndef sv_catpv_mg # define sv_catpv_mg(sv, ptr) \ STMT_START { \ SV *TeMpSv = sv; \ sv_catpv(TeMpSv,ptr); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_catpvn_mg # define sv_catpvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_catpvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_catsv_mg # define sv_catsv_mg(dsv, ssv) \ STMT_START { \ SV *TeMpSv = dsv; \ sv_catsv(TeMpSv,ssv); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setiv_mg # define sv_setiv_mg(sv, i) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setiv(TeMpSv,i); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setnv_mg # define sv_setnv_mg(sv, num) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setnv(TeMpSv,num); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setpv_mg # define sv_setpv_mg(sv, ptr) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setpv(TeMpSv,ptr); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setpvn_mg # define sv_setpvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setpvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setsv_mg # define sv_setsv_mg(dsv, ssv) \ STMT_START { \ SV *TeMpSv = dsv; \ sv_setsv(TeMpSv,ssv); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_setuv_mg # define sv_setuv_mg(sv, i) \ STMT_START { \ SV *TeMpSv = sv; \ sv_setuv(TeMpSv,i); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef sv_usepvn_mg # define sv_usepvn_mg(sv, ptr, len) \ STMT_START { \ SV *TeMpSv = sv; \ sv_usepvn(TeMpSv,ptr,len); \ SvSETMAGIC(TeMpSv); \ } STMT_END #endif #ifndef SvVSTRING_mg # define SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL) #endif /* Hint: sv_magic_portable * This is a compatibility function that is only available with * Devel::PPPort. It is NOT in the perl core. * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when * it is being passed a name pointer with namlen == 0. In that * case, perl 5.8.0 and later store the pointer, not a copy of it. * The compatibility can be provided back to perl 5.004. With * earlier versions, the code will not compile. */ #if (PERL_BCDVERSION < 0x5004000) /* code that uses sv_magic_portable will not compile */ #elif (PERL_BCDVERSION < 0x5008000) # define sv_magic_portable(sv, obj, how, name, namlen) \ STMT_START { \ SV *SvMp_sv = (sv); \ char *SvMp_name = (char *) (name); \ I32 SvMp_namlen = (namlen); \ if (SvMp_name && SvMp_namlen == 0) \ { \ MAGIC *mg; \ sv_magic(SvMp_sv, obj, how, 0, 0); \ mg = SvMAGIC(SvMp_sv); \ mg->mg_len = -42; /* XXX: this is the tricky part */ \ mg->mg_ptr = SvMp_name; \ } \ else \ { \ sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \ } \ } STMT_END #else # define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e) #endif #if !defined(mg_findext) #if defined(NEED_mg_findext) static MAGIC * DPPP_(my_mg_findext)(const SV * sv, int type, const MGVTBL * vtbl); static #else extern MAGIC * DPPP_(my_mg_findext)(const SV * sv, int type, const MGVTBL * vtbl); #endif #if defined(NEED_mg_findext) || defined(NEED_mg_findext_GLOBAL) #define mg_findext DPPP_(my_mg_findext) #define Perl_mg_findext DPPP_(my_mg_findext) MAGIC * DPPP_(my_mg_findext)(const SV * sv, int type, const MGVTBL *vtbl) { if (sv) { MAGIC *mg; #ifdef AvPAD_NAMELIST assert(!(SvTYPE(sv) == SVt_PVAV && AvPAD_NAMELIST(sv))); #endif for (mg = SvMAGIC (sv); mg; mg = mg->mg_moremagic) { if (mg->mg_type == type && mg->mg_virtual == vtbl) return mg; } } return NULL; } #endif #endif #if !defined(sv_unmagicext) #if defined(NEED_sv_unmagicext) static int DPPP_(my_sv_unmagicext)(pTHX_ SV * const sv, const int type, const MGVTBL * vtbl); static #else extern int DPPP_(my_sv_unmagicext)(pTHX_ SV * const sv, const int type, const MGVTBL * vtbl); #endif #if defined(NEED_sv_unmagicext) || defined(NEED_sv_unmagicext_GLOBAL) #ifdef sv_unmagicext # undef sv_unmagicext #endif #define sv_unmagicext(a,b,c) DPPP_(my_sv_unmagicext)(aTHX_ a,b,c) #define Perl_sv_unmagicext DPPP_(my_sv_unmagicext) int DPPP_(my_sv_unmagicext)(pTHX_ SV *const sv, const int type, const MGVTBL *vtbl) { MAGIC* mg; MAGIC** mgp; if (SvTYPE(sv) < SVt_PVMG || !SvMAGIC(sv)) return 0; mgp = &(SvMAGIC(sv)); for (mg = *mgp; mg; mg = *mgp) { const MGVTBL* const virt = mg->mg_virtual; if (mg->mg_type == type && virt == vtbl) { *mgp = mg->mg_moremagic; if (virt && virt->svt_free) virt->svt_free(aTHX_ sv, mg); if (mg->mg_ptr && mg->mg_type != PERL_MAGIC_regex_global) { if (mg->mg_len > 0) Safefree(mg->mg_ptr); else if (mg->mg_len == HEf_SVKEY) /* Questionable on older perls... */ SvREFCNT_dec(MUTABLE_SV(mg->mg_ptr)); else if (mg->mg_type == PERL_MAGIC_utf8) Safefree(mg->mg_ptr); } if (mg->mg_flags & MGf_REFCOUNTED) SvREFCNT_dec(mg->mg_obj); Safefree(mg); } else mgp = &mg->mg_moremagic; } if (SvMAGIC(sv)) { if (SvMAGICAL(sv)) /* if we're under save_magic, wait for restore_magic; */ mg_magical(sv); /* else fix the flags now */ } else { SvMAGICAL_off(sv); SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT; } return 0; } #endif #endif #ifdef USE_ITHREADS #ifndef CopFILE # define CopFILE(c) ((c)->cop_file) #endif #ifndef CopFILEGV # define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) #endif #ifndef CopFILE_set # define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) #endif #ifndef CopFILESV # define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) #endif #ifndef CopFILEAV # define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) #endif #ifndef CopSTASHPV # define CopSTASHPV(c) ((c)->cop_stashpv) #endif #ifndef CopSTASHPV_set # define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) #endif #ifndef CopSTASH # define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) #endif #ifndef CopSTASH_set # define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) #endif #ifndef CopSTASH_eq # define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ || (CopSTASHPV(c) && HvNAME(hv) \ && strEQ(CopSTASHPV(c), HvNAME(hv))))) #endif #else #ifndef CopFILEGV # define CopFILEGV(c) ((c)->cop_filegv) #endif #ifndef CopFILEGV_set # define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) #endif #ifndef CopFILE_set # define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) #endif #ifndef CopFILESV # define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) #endif #ifndef CopFILEAV # define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) #endif #ifndef CopFILE # define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) #endif #ifndef CopSTASH # define CopSTASH(c) ((c)->cop_stash) #endif #ifndef CopSTASH_set # define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) #endif #ifndef CopSTASHPV # define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) #endif #ifndef CopSTASHPV_set # define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) #endif #ifndef CopSTASH_eq # define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) #endif #endif /* USE_ITHREADS */ #if (PERL_BCDVERSION >= 0x5006000) #ifndef caller_cx # if defined(NEED_caller_cx) || defined(NEED_caller_cx_GLOBAL) static I32 DPPP_dopoptosub_at(const PERL_CONTEXT *cxstk, I32 startingblock) { I32 i; for (i = startingblock; i >= 0; i--) { const PERL_CONTEXT * const cx = &cxstk[i]; switch (CxTYPE(cx)) { default: continue; case CXt_EVAL: case CXt_SUB: case CXt_FORMAT: return i; } } return i; } # endif # if defined(NEED_caller_cx) static const PERL_CONTEXT * DPPP_(my_caller_cx)(pTHX_ I32 level, const PERL_CONTEXT * * dbcxp); static #else extern const PERL_CONTEXT * DPPP_(my_caller_cx)(pTHX_ I32 level, const PERL_CONTEXT * * dbcxp); #endif #if defined(NEED_caller_cx) || defined(NEED_caller_cx_GLOBAL) #ifdef caller_cx # undef caller_cx #endif #define caller_cx(a,b) DPPP_(my_caller_cx)(aTHX_ a,b) #define Perl_caller_cx DPPP_(my_caller_cx) const PERL_CONTEXT * DPPP_(my_caller_cx)(pTHX_ I32 level, const PERL_CONTEXT **dbcxp) { I32 cxix = DPPP_dopoptosub_at(cxstack, cxstack_ix); const PERL_CONTEXT *cx; const PERL_CONTEXT *ccstack = cxstack; const PERL_SI *top_si = PL_curstackinfo; for (;;) { /* we may be in a higher stacklevel, so dig down deeper */ while (cxix < 0 && top_si->si_type != PERLSI_MAIN) { top_si = top_si->si_prev; ccstack = top_si->si_cxstack; cxix = DPPP_dopoptosub_at(ccstack, top_si->si_cxix); } if (cxix < 0) return NULL; /* caller() should not report the automatic calls to &DB::sub */ if (PL_DBsub && GvCV(PL_DBsub) && cxix >= 0 && ccstack[cxix].blk_sub.cv == GvCV(PL_DBsub)) level++; if (!level--) break; cxix = DPPP_dopoptosub_at(ccstack, cxix - 1); } cx = &ccstack[cxix]; if (dbcxp) *dbcxp = cx; if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT) { const I32 dbcxix = DPPP_dopoptosub_at(ccstack, cxix - 1); /* We expect that ccstack[dbcxix] is CXt_SUB, anyway, the field below is defined for any cx. */ /* caller() should not report the automatic calls to &DB::sub */ if (PL_DBsub && GvCV(PL_DBsub) && dbcxix >= 0 && ccstack[dbcxix].blk_sub.cv == GvCV(PL_DBsub)) cx = &ccstack[dbcxix]; } return cx; } # endif #endif /* caller_cx */ #endif /* 5.6.0 */ #ifndef IN_PERL_COMPILETIME # define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) #endif #ifndef IN_LOCALE_RUNTIME # define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) #endif #ifndef IN_LOCALE_COMPILETIME # define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) #endif #ifndef IN_LOCALE # define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) #endif #ifndef IS_NUMBER_IN_UV # define IS_NUMBER_IN_UV 0x01 #endif #ifndef IS_NUMBER_GREATER_THAN_UV_MAX # define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 #endif #ifndef IS_NUMBER_NOT_INT # define IS_NUMBER_NOT_INT 0x04 #endif #ifndef IS_NUMBER_NEG # define IS_NUMBER_NEG 0x08 #endif #ifndef IS_NUMBER_INFINITY # define IS_NUMBER_INFINITY 0x10 #endif #ifndef IS_NUMBER_NAN # define IS_NUMBER_NAN 0x20 #endif #ifndef GROK_NUMERIC_RADIX # define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) #endif #ifndef PERL_SCAN_GREATER_THAN_UV_MAX # define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 #endif #ifndef PERL_SCAN_SILENT_ILLDIGIT # define PERL_SCAN_SILENT_ILLDIGIT 0x04 #endif #ifndef PERL_SCAN_ALLOW_UNDERSCORES # define PERL_SCAN_ALLOW_UNDERSCORES 0x01 #endif #ifndef PERL_SCAN_DISALLOW_PREFIX # define PERL_SCAN_DISALLOW_PREFIX 0x02 #endif #ifndef grok_numeric_radix #if defined(NEED_grok_numeric_radix) static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char * * sp, const char * send); static #else extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char * * sp, const char * send); #endif #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) #ifdef grok_numeric_radix # undef grok_numeric_radix #endif #define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) #define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) bool DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) { #ifdef USE_LOCALE_NUMERIC #ifdef PL_numeric_radix_sv if (PL_numeric_radix_sv && IN_LOCALE) { STRLEN len; char* radix = SvPV(PL_numeric_radix_sv, len); if (*sp + len <= send && memEQ(*sp, radix, len)) { *sp += len; return TRUE; } } #else /* older perls don't have PL_numeric_radix_sv so the radix * must manually be requested from locale.h */ #include dTHR; /* needed for older threaded perls */ struct lconv *lc = localeconv(); char *radix = lc->decimal_point; if (radix && IN_LOCALE) { STRLEN len = strlen(radix); if (*sp + len <= send && memEQ(*sp, radix, len)) { *sp += len; return TRUE; } } #endif #endif /* USE_LOCALE_NUMERIC */ /* always try "." if numeric radix didn't match because * we may have data from different locales mixed */ if (*sp < send && **sp == '.') { ++*sp; return TRUE; } return FALSE; } #endif #endif #ifndef grok_number #if defined(NEED_grok_number) static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); static #else extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); #endif #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) #ifdef grok_number # undef grok_number #endif #define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) #define Perl_grok_number DPPP_(my_grok_number) int DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) { const char *s = pv; const char *send = pv + len; const UV max_div_10 = UV_MAX / 10; const char max_mod_10 = UV_MAX % 10; int numtype = 0; int sawinf = 0; int sawnan = 0; while (s < send && isSPACE(*s)) s++; if (s == send) { return 0; } else if (*s == '-') { s++; numtype = IS_NUMBER_NEG; } else if (*s == '+') s++; if (s == send) return 0; /* next must be digit or the radix separator or beginning of infinity */ if (isDIGIT(*s)) { /* UVs are at least 32 bits, so the first 9 decimal digits cannot overflow. */ UV value = *s - '0'; /* This construction seems to be more optimiser friendly. (without it gcc does the isDIGIT test and the *s - '0' separately) With it gcc on arm is managing 6 instructions (6 cycles) per digit. In theory the optimiser could deduce how far to unroll the loop before checking for overflow. */ if (++s < send) { int digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { digit = *s - '0'; if (digit >= 0 && digit <= 9) { value = value * 10 + digit; if (++s < send) { /* Now got 9 digits, so need to check each time for overflow. */ digit = *s - '0'; while (digit >= 0 && digit <= 9 && (value < max_div_10 || (value == max_div_10 && digit <= max_mod_10))) { value = value * 10 + digit; if (++s < send) digit = *s - '0'; else break; } if (digit >= 0 && digit <= 9 && (s < send)) { /* value overflowed. skip the remaining digits, don't worry about setting *valuep. */ do { s++; } while (s < send && isDIGIT(*s)); numtype |= IS_NUMBER_GREATER_THAN_UV_MAX; goto skip_value; } } } } } } } } } } } } } } } } } } numtype |= IS_NUMBER_IN_UV; if (valuep) *valuep = value; skip_value: if (GROK_NUMERIC_RADIX(&s, send)) { numtype |= IS_NUMBER_NOT_INT; while (s < send && isDIGIT(*s)) /* optional digits after the radix */ s++; } } else if (GROK_NUMERIC_RADIX(&s, send)) { numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ /* no digits before the radix means we need digits after it */ if (s < send && isDIGIT(*s)) { do { s++; } while (s < send && isDIGIT(*s)); if (valuep) { /* integer approximation is valid - it's 0. */ *valuep = 0; } } else return 0; } else if (*s == 'I' || *s == 'i') { s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; s++; if (s < send && (*s == 'I' || *s == 'i')) { s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; s++; if (s == send || (*s != 'T' && *s != 't')) return 0; s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; s++; } sawinf = 1; } else if (*s == 'N' || *s == 'n') { /* XXX TODO: There are signaling NaNs and quiet NaNs. */ s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; s++; sawnan = 1; } else return 0; if (sawinf) { numtype &= IS_NUMBER_NEG; /* Keep track of sign */ numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; } else if (sawnan) { numtype &= IS_NUMBER_NEG; /* Keep track of sign */ numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; } else if (s < send) { /* we can have an optional exponent part */ if (*s == 'e' || *s == 'E') { /* The only flag we keep is sign. Blow away any "it's UV" */ numtype &= IS_NUMBER_NEG; numtype |= IS_NUMBER_NOT_INT; s++; if (s < send && (*s == '-' || *s == '+')) s++; if (s < send && isDIGIT(*s)) { do { s++; } while (s < send && isDIGIT(*s)); } else return 0; } } while (s < send && isSPACE(*s)) s++; if (s >= send) return numtype; if (len == 10 && memEQ(pv, "0 but true", 10)) { if (valuep) *valuep = 0; return IS_NUMBER_IN_UV; } return 0; } #endif #endif /* * The grok_* routines have been modified to use warn() instead of * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, * which is why the stack variable has been renamed to 'xdigit'. */ #ifndef grok_bin #if defined(NEED_grok_bin) static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); static #else extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); #endif #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) #ifdef grok_bin # undef grok_bin #endif #define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) #define Perl_grok_bin DPPP_(my_grok_bin) UV DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_2 = UV_MAX / 2; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { /* strip off leading b or 0b. for compatibility silently suffer "b" and "0b" as valid binary numbers. */ if (len >= 1) { if (s[0] == 'b') { s++; len--; } else if (len >= 2 && s[0] == '0' && s[1] == 'b') { s+=2; len-=2; } } } for (; len-- && *s; s++) { char bit = *s; if (bit == '0' || bit == '1') { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. With gcc seems to be much straighter code than old scan_bin. */ redo: if (!overflowed) { if (value <= max_div_2) { value = (value << 1) | (bit - '0'); continue; } /* Bah. We're just overflowed. */ warn("Integer overflow in binary number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 2.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount. */ value_nv += (NV)(bit - '0'); continue; } if (bit == '_' && len && allow_underscores && (bit = s[1]) && (bit == '0' || bit == '1')) { --len; ++s; goto redo; } if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal binary digit '%c' ignored", *s); break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Binary number > 0b11111111111111111111111111111111 non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #ifndef grok_hex #if defined(NEED_grok_hex) static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); static #else extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); #endif #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) #ifdef grok_hex # undef grok_hex #endif #define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) #define Perl_grok_hex DPPP_(my_grok_hex) UV DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_16 = UV_MAX / 16; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; const char *xdigit; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { /* strip off leading x or 0x. for compatibility silently suffer "x" and "0x" as valid hex numbers. */ if (len >= 1) { if (s[0] == 'x') { s++; len--; } else if (len >= 2 && s[0] == '0' && s[1] == 'x') { s+=2; len-=2; } } } for (; len-- && *s; s++) { xdigit = strchr((char *) PL_hexdigit, *s); if (xdigit) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. With gcc seems to be much straighter code than old scan_hex. */ redo: if (!overflowed) { if (value <= max_div_16) { value = (value << 4) | ((xdigit - PL_hexdigit) & 15); continue; } warn("Integer overflow in hexadecimal number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 16.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 16-tuples. */ value_nv += (NV)((xdigit - PL_hexdigit) & 15); continue; } if (*s == '_' && len && allow_underscores && s[1] && (xdigit = strchr((char *) PL_hexdigit, s[1]))) { --len; ++s; goto redo; } if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal hexadecimal digit '%c' ignored", *s); break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Hexadecimal number > 0xffffffff non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #ifndef grok_oct #if defined(NEED_grok_oct) static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); static #else extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); #endif #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) #ifdef grok_oct # undef grok_oct #endif #define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) #define Perl_grok_oct DPPP_(my_grok_oct) UV DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_8 = UV_MAX / 8; bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; for (; len-- && *s; s++) { /* gcc 2.95 optimiser not smart enough to figure that this subtraction out front allows slicker code. */ int digit = *s - '0'; if (digit >= 0 && digit <= 7) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. */ redo: if (!overflowed) { if (value <= max_div_8) { value = (value << 3) | digit; continue; } /* Bah. We're just overflowed. */ warn("Integer overflow in octal number"); overflowed = TRUE; value_nv = (NV) value; } value_nv *= 8.0; /* If an NV has not enough bits in its mantissa to * represent a UV this summing of small low-order numbers * is a waste of time (because the NV cannot preserve * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 8-tuples. */ value_nv += (NV)digit; continue; } if (digit == ('_' - '0') && len && allow_underscores && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) { --len; ++s; goto redo; } /* Allow \octal to work the DWIM way (that is, stop scanning * as soon as non-octal characters are seen, complain only iff * someone seems to want to use the digits eight and nine). */ if (digit == 8 || digit == 9) { if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) warn("Illegal octal digit '%c' ignored", *s); } break; } if ( ( overflowed && value_nv > 4294967295.0) #if UVSIZE > 4 || (!overflowed && value > 0xffffffff ) #endif ) { warn("Octal number > 037777777777 non-portable"); } *len_p = s - start; if (!overflowed) { *flags = 0; return value; } *flags = PERL_SCAN_GREATER_THAN_UV_MAX; if (result) *result = value_nv; return UV_MAX; } #endif #endif #if !defined(my_snprintf) #if defined(NEED_my_snprintf) static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); static #else extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); #endif #if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL) #define my_snprintf DPPP_(my_my_snprintf) #define Perl_my_snprintf DPPP_(my_my_snprintf) int DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...) { dTHX; int retval; va_list ap; va_start(ap, format); #ifdef HAS_VSNPRINTF retval = vsnprintf(buffer, len, format, ap); #else retval = vsprintf(buffer, format, ap); #endif va_end(ap); if (retval < 0 || (len > 0 && (Size_t)retval >= len)) Perl_croak(aTHX_ "panic: my_snprintf buffer overflow"); return retval; } #endif #endif #if !defined(my_sprintf) #if defined(NEED_my_sprintf) static int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); static #else extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); #endif #if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL) #define my_sprintf DPPP_(my_my_sprintf) /* Warning: my_sprintf It's safer to use my_snprintf instead */ /* Replace my_sprintf with my_snprintf */ int DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...) { va_list args; va_start(args, pat); vsprintf(buffer, pat, args); va_end(args); return strlen(buffer); } #endif #endif #ifdef NO_XSLOCKS # ifdef dJMPENV # define dXCPT dJMPENV; int rEtV = 0 # define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) # define XCPT_TRY_END JMPENV_POP; # define XCPT_CATCH if (rEtV != 0) # define XCPT_RETHROW JMPENV_JUMP(rEtV) # else # define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 # define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) # define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); # define XCPT_CATCH if (rEtV != 0) # define XCPT_RETHROW Siglongjmp(top_env, rEtV) # endif #endif #if !defined(my_strlcat) #if defined(NEED_my_strlcat) static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); static #else extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); #endif #if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL) #define my_strlcat DPPP_(my_my_strlcat) #define Perl_my_strlcat DPPP_(my_my_strlcat) Size_t DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size) { Size_t used, length, copy; used = strlen(dst); length = strlen(src); if (size > 0 && used < size - 1) { copy = (length >= size - used) ? size - used - 1 : length; memcpy(dst + used, src, copy); dst[used + copy] = '\0'; } return used + length; } #endif #endif #if !defined(my_strlcpy) #if defined(NEED_my_strlcpy) static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); static #else extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); #endif #if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL) #define my_strlcpy DPPP_(my_my_strlcpy) #define Perl_my_strlcpy DPPP_(my_my_strlcpy) Size_t DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size) { Size_t length, copy; length = strlen(src); if (size > 0) { copy = (length >= size) ? size - 1 : length; memcpy(dst, src, copy); dst[copy] = '\0'; } return length; } #endif #endif #ifdef SVf_UTF8 #ifndef SvUTF8 # define SvUTF8(sv) (SvFLAGS(sv) & SVf_UTF8) #endif #endif #if (PERL_BCDVERSION == 0x5019001) /* 5.19.1 does not have UTF8fARG, only broken UTF8f */ #undef UTF8f #endif #ifdef SVf_UTF8 #ifndef UTF8f # define UTF8f SVf #endif #ifndef UTF8fARG # define UTF8fARG(u,l,p) newSVpvn_flags((p), (l), ((u) ? SVf_UTF8 : 0) | SVs_TEMP) #endif #endif #define D_PPP_MIN(a,b) (((a) <= (b)) ? (a) : (b)) #ifndef UNICODE_REPLACEMENT # define UNICODE_REPLACEMENT 0xFFFD #endif #ifdef UTF8_MAXLEN #ifndef UTF8_MAXBYTES # define UTF8_MAXBYTES UTF8_MAXLEN #endif #endif #ifndef UTF_START_MARK # define UTF_START_MARK(len) \ (((len) > 7) ? 0xFF : (0xFF & (0xFE << (7-(len))))) #endif /* On non-EBCDIC was valid for some releases earlier than this, but easier to * just do one check */ #if (PERL_BCDVERSION < 0x5018000) # undef UTF8_MAXBYTES_CASE #endif #if 'A' == 65 # define D_PPP_BYTE_INFO_BITS 6 /* 6 bits meaningful in continuation bytes */ #ifndef UTF8_MAXBYTES_CASE # define UTF8_MAXBYTES_CASE 13 #endif #else # define D_PPP_BYTE_INFO_BITS 5 /* 5 bits meaningful in continuation bytes */ #ifndef UTF8_MAXBYTES_CASE # define UTF8_MAXBYTES_CASE 15 #endif #endif #ifndef UTF_ACCUMULATION_SHIFT # define UTF_ACCUMULATION_SHIFT D_PPP_BYTE_INFO_BITS #endif #ifdef NATIVE_TO_UTF #ifndef NATIVE_UTF8_TO_I8 # define NATIVE_UTF8_TO_I8(c) NATIVE_TO_UTF(c) #endif #else /* System doesn't support EBCDIC */ #ifndef NATIVE_UTF8_TO_I8 # define NATIVE_UTF8_TO_I8(c) (c) #endif #endif #ifdef UTF_TO_NATIVE #ifndef I8_TO_NATIVE_UTF8 # define I8_TO_NATIVE_UTF8(c) UTF_TO_NATIVE(c) #endif #else /* System doesn't support EBCDIC */ #ifndef I8_TO_NATIVE_UTF8 # define I8_TO_NATIVE_UTF8(c) (c) #endif #endif #ifndef UTF_START_MASK # define UTF_START_MASK(len) \ (((len) >= 7) ? 0x00 : (0x1F >> ((len)-2))) #endif #ifndef UTF_IS_CONTINUATION_MASK # define UTF_IS_CONTINUATION_MASK \ ((U8) (0xFF << UTF_ACCUMULATION_SHIFT)) #endif #ifndef UTF_CONTINUATION_MARK # define UTF_CONTINUATION_MARK \ (UTF_IS_CONTINUATION_MASK & 0xB0) #endif #ifndef UTF_MIN_START_BYTE # define UTF_MIN_START_BYTE \ ((UTF_CONTINUATION_MARK >> UTF_ACCUMULATION_SHIFT) | UTF_START_MARK(2)) #endif #ifndef UTF_MIN_ABOVE_LATIN1_BYTE # define UTF_MIN_ABOVE_LATIN1_BYTE \ ((0x100 >> UTF_ACCUMULATION_SHIFT) | UTF_START_MARK(2)) #endif #if (PERL_BCDVERSION < 0x5007000) /* Was the complement of what should have been */ # undef UTF8_IS_DOWNGRADEABLE_START #endif #ifndef UTF8_IS_DOWNGRADEABLE_START # define UTF8_IS_DOWNGRADEABLE_START(c) \ inRANGE(NATIVE_UTF8_TO_I8(c), \ UTF_MIN_START_BYTE, UTF_MIN_ABOVE_LATIN1_BYTE - 1) #endif #ifndef UTF_CONTINUATION_MASK # define UTF_CONTINUATION_MASK \ ((U8) ((1U << UTF_ACCUMULATION_SHIFT) - 1)) #endif #ifndef UTF8_ACCUMULATE # define UTF8_ACCUMULATE(base, added) \ (((base) << UTF_ACCUMULATION_SHIFT) \ | ((NATIVE_UTF8_TO_I8(added)) \ & UTF_CONTINUATION_MASK)) #endif #ifndef UTF8_ALLOW_ANYUV # define UTF8_ALLOW_ANYUV 0 #endif #ifndef UTF8_ALLOW_EMPTY # define UTF8_ALLOW_EMPTY 0x0001 #endif #ifndef UTF8_ALLOW_CONTINUATION # define UTF8_ALLOW_CONTINUATION 0x0002 #endif #ifndef UTF8_ALLOW_NON_CONTINUATION # define UTF8_ALLOW_NON_CONTINUATION 0x0004 #endif #ifndef UTF8_ALLOW_SHORT # define UTF8_ALLOW_SHORT 0x0008 #endif #ifndef UTF8_ALLOW_LONG # define UTF8_ALLOW_LONG 0x0010 #endif #ifndef UTF8_ALLOW_OVERFLOW # define UTF8_ALLOW_OVERFLOW 0x0080 #endif #ifndef UTF8_ALLOW_ANY # define UTF8_ALLOW_ANY ( UTF8_ALLOW_CONTINUATION \ |UTF8_ALLOW_NON_CONTINUATION \ |UTF8_ALLOW_SHORT \ |UTF8_ALLOW_LONG \ |UTF8_ALLOW_OVERFLOW) #endif #if defined UTF8SKIP /* Don't use official versions because they use MIN, which may not be available */ #undef UTF8_SAFE_SKIP #undef UTF8_CHK_SKIP #ifndef UTF8_SAFE_SKIP # define UTF8_SAFE_SKIP(s, e) ( \ ((((e) - (s)) <= 0) \ ? 0 \ : D_PPP_MIN(((e) - (s)), UTF8SKIP(s)))) #endif #ifndef UTF8_CHK_SKIP # define UTF8_CHK_SKIP(s) \ (s[0] == '\0' ? 1 : ((U8) D_PPP_MIN(my_strnlen((char *) (s), UTF8SKIP(s)), \ UTF8SKIP(s)))) #endif /* UTF8_CHK_SKIP depends on my_strnlen */ #ifndef UTF8_SKIP # define UTF8_SKIP(s) UTF8SKIP(s) #endif #endif #if 'A' == 65 #ifndef UTF8_IS_INVARIANT # define UTF8_IS_INVARIANT(c) isASCII(c) #endif #else #ifndef UTF8_IS_INVARIANT # define UTF8_IS_INVARIANT(c) (isASCII(c) || isCNTRL_L1(c)) #endif #endif #ifndef UVCHR_IS_INVARIANT # define UVCHR_IS_INVARIANT(c) UTF8_IS_INVARIANT(c) #endif #ifdef UVCHR_IS_INVARIANT # if 'A' != 65 || UVSIZE < 8 /* 32 bit platform, which includes UTF-EBCDIC on the releases this is * backported to */ # define D_PPP_UVCHR_SKIP_UPPER(c) 7 # else # define D_PPP_UVCHR_SKIP_UPPER(c) \ (((WIDEST_UTYPE) (c)) < \ (((WIDEST_UTYPE) 1) << (6 * D_PPP_BYTE_INFO_BITS)) ? 7 : 13) # endif #ifndef UVCHR_SKIP # define UVCHR_SKIP(c) \ UVCHR_IS_INVARIANT(c) ? 1 : \ (WIDEST_UTYPE) (c) < (32 * (1U << ( D_PPP_BYTE_INFO_BITS))) ? 2 : \ (WIDEST_UTYPE) (c) < (16 * (1U << (2 * D_PPP_BYTE_INFO_BITS))) ? 3 : \ (WIDEST_UTYPE) (c) < ( 8 * (1U << (3 * D_PPP_BYTE_INFO_BITS))) ? 4 : \ (WIDEST_UTYPE) (c) < ( 4 * (1U << (4 * D_PPP_BYTE_INFO_BITS))) ? 5 : \ (WIDEST_UTYPE) (c) < ( 2 * (1U << (5 * D_PPP_BYTE_INFO_BITS))) ? 6 : \ D_PPP_UVCHR_SKIP_UPPER(c) #endif #endif #ifdef is_ascii_string #ifndef is_invariant_string # define is_invariant_string(s,l) is_ascii_string(s,l) #endif #ifndef is_utf8_invariant_string # define is_utf8_invariant_string(s,l) is_ascii_string(s,l) #endif /* Hint: is_ascii_string, is_invariant_string is_utf8_invariant_string() does the same thing and is preferred because its name is more accurate as to what it does */ #endif #ifdef ibcmp_utf8 #ifndef foldEQ_utf8 # define foldEQ_utf8(s1,pe1,l1,u1,s2,pe2,l2,u2) \ cBOOL(! ibcmp_utf8(s1,pe1,l1,u1,s2,pe2,l2,u2)) #endif #endif #if defined(is_utf8_string) && defined(UTF8SKIP) #ifndef isUTF8_CHAR # define isUTF8_CHAR(s, e) ( \ (e) <= (s) || ! is_utf8_string(s, UTF8_SAFE_SKIP(s, e)) \ ? 0 \ : UTF8SKIP(s)) #endif #endif #if 'A' == 65 #ifndef BOM_UTF8 # define BOM_UTF8 "\xEF\xBB\xBF" #endif #ifndef REPLACEMENT_CHARACTER_UTF8 # define REPLACEMENT_CHARACTER_UTF8 "\xEF\xBF\xBD" #endif #elif '^' == 95 #ifndef BOM_UTF8 # define BOM_UTF8 "\xDD\x73\x66\x73" #endif #ifndef REPLACEMENT_CHARACTER_UTF8 # define REPLACEMENT_CHARACTER_UTF8 "\xDD\x73\x73\x71" #endif #elif '^' == 176 #ifndef BOM_UTF8 # define BOM_UTF8 "\xDD\x72\x65\x72" #endif #ifndef REPLACEMENT_CHARACTER_UTF8 # define REPLACEMENT_CHARACTER_UTF8 "\xDD\x72\x72\x70" #endif #else # error Unknown character set #endif #if (PERL_BCDVERSION < 0x5035010) /* Versions prior to 5.31.4 accepted things that are now considered * malformations, and didn't return -1 on error with warnings enabled. * Versions before 5.35.10 dereferenced empty input without checking */ # undef utf8_to_uvchr_buf #endif /* This implementation brings modern, generally more restricted standards to * utf8_to_uvchr_buf. Some of these are security related, and clearly must * be done. But its arguable that the others need not, and hence should not. * The reason they're here is that a module that intends to play with the * latest perls should be able to work the same in all releases. An example is * that perl no longer accepts any UV for a code point, but limits them to * IV_MAX or below. This is for future internal use of the larger code points. * If it turns out that some of these changes are breaking code that isn't * intended to work with modern perls, the tighter restrictions could be * relaxed. khw thinks this is unlikely, but has been wrong in the past. */ /* 5.6.0 is the first release with UTF-8, and we don't implement this function * there due to its likely lack of still being in use, and the underlying * implementation is very different from later ones, without the later * safeguards, so would require extra work to deal with */ #if (PERL_BCDVERSION >= 0x5006001) && ! defined(utf8_to_uvchr_buf) /* Choose which underlying implementation to use. At least one must be * present or the perl is too early to handle this function */ # if defined(utf8n_to_uvchr) || defined(utf8_to_uvchr) || defined(utf8_to_uv) # if defined(utf8n_to_uvchr) /* This is the preferred implementation */ # define D_PPP_utf8_to_uvchr_buf_callee utf8n_to_uvchr # elif /* Must be at least 5.6.1 from #if above; \ If have both regular and _simple, regular has all args */ \ defined(utf8_to_uv) && defined(utf8_to_uv_simple) # define D_PPP_utf8_to_uvchr_buf_callee utf8_to_uv # elif defined(utf8_to_uvchr) /* The below won't work well on error input */ # define D_PPP_utf8_to_uvchr_buf_callee(s, curlen, retlen, flags) \ utf8_to_uvchr((U8 *)(s), (retlen)) # else # define D_PPP_utf8_to_uvchr_buf_callee(s, curlen, retlen, flags) \ utf8_to_uv((U8 *)(s), (retlen)) # endif # endif # if defined(NEED_utf8_to_uvchr_buf) static UV DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 * s, const U8 * send, STRLEN * retlen); static #else extern UV DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 * s, const U8 * send, STRLEN * retlen); #endif #if defined(NEED_utf8_to_uvchr_buf) || defined(NEED_utf8_to_uvchr_buf_GLOBAL) #ifdef utf8_to_uvchr_buf # undef utf8_to_uvchr_buf #endif #define utf8_to_uvchr_buf(a,b,c) DPPP_(my_utf8_to_uvchr_buf)(aTHX_ a,b,c) #define Perl_utf8_to_uvchr_buf DPPP_(my_utf8_to_uvchr_buf) UV DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) { # if (PERL_BCDVERSION >= 0x5031004) /* But from above, must be < 5.35.10 */ # if (PERL_BCDVERSION != 0x5035009) /* Versions less than 5.35.9 could dereference s on zero length, so * pass it something where no harm comes from that. */ if (send <= s) s = send = (U8 *) "?"; return Perl_utf8_to_uvchr_buf_helper(aTHX_ s, send, retlen); # else /* Below is 5.35.9, which also works on non-empty input, but for empty input, can wrongly dereference, and additionally is also just plain broken */ if (send > s) return Perl_utf8_to_uvchr_buf_helper(aTHX_ s, send, retlen); if (! ckWARN_d(WARN_UTF8)) { if (retlen) *retlen = 0; return UNICODE_REPLACEMENT; } else { s = send = (U8 *) "?"; /* Call just for its warning */ (void) Perl__utf8n_to_uvchr_msgs_helper(s, 0, NULL, 0, NULL, NULL); if (retlen) *retlen = (STRLEN) -1; return 0; } # endif # else UV ret; STRLEN curlen; bool overflows = 0; const U8 *cur_s = s; const bool do_warnings = ckWARN_d(WARN_UTF8); # if (PERL_BCDVERSION < 0x5026000) && ! defined(EBCDIC) STRLEN overflow_length = 0; # endif if (send > s) { curlen = send - s; } else { assert(0); /* Modern perls die under this circumstance */ curlen = 0; if (! do_warnings) { /* Handle empty here if no warnings needed */ if (retlen) *retlen = 0; return UNICODE_REPLACEMENT; } } # if (PERL_BCDVERSION < 0x5026000) && ! defined(EBCDIC) /* Perl did not properly detect overflow for much of its history on * non-EBCDIC platforms, often returning an overlong value which may or may * not have been tolerated in the call. Also, earlier versions, when they * did detect overflow, may have disallowed it completely. Modern ones can * replace it with the REPLACEMENT CHARACTER, depending on calling * parameters. Therefore detect it ourselves in releases it was * problematic in. */ if (curlen > 0 && UNLIKELY(*s >= 0xFE)) { /* First, on a 32-bit machine the first byte being at least \xFE * automatically is overflow, as it indicates something requiring more * than 31 bits */ if (sizeof(ret) < 8) { overflows = 1; overflow_length = (*s == 0xFE) ? 7 : 13; } else { const U8 highest[] = /* 2*63-1 */ "\xFF\x80\x87\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF"; const U8 *cur_h = highest; for (cur_s = s; cur_s < send; cur_s++, cur_h++) { if (UNLIKELY(*cur_s == *cur_h)) { continue; } /* If this byte is larger than the corresponding highest UTF-8 * byte, the sequence overflows; otherwise the byte is less * than (as we handled the equality case above), and so the * sequence doesn't overflow */ overflows = *cur_s > *cur_h; break; } /* Here, either we set the bool and broke out of the loop, or got * to the end and all bytes are the same which indicates it doesn't * overflow. If it did overflow, it would be this number of bytes * */ overflow_length = 13; } } if (UNLIKELY(overflows)) { ret = 0; if (! do_warnings && retlen) { *retlen = overflow_length; } } else # endif /* < 5.26 */ /* Here, we are either in a release that properly detects overflow, or * we have checked for overflow and the next statement is executing as * part of the above conditional where we know we don't have overflow. * * The modern versions allow anything that evaluates to a legal UV, but * not overlongs nor an empty input */ ret = D_PPP_utf8_to_uvchr_buf_callee( (U8 *) /* Early perls: no const */ s, curlen, retlen, (UTF8_ALLOW_ANYUV & ~(UTF8_ALLOW_LONG|UTF8_ALLOW_EMPTY))); # if (PERL_BCDVERSION >= 0x5026000) && (PERL_BCDVERSION < 0x5028000) /* But actually, more modern versions restrict the UV to being no more than * what an IV can hold, so it could still have gotten it wrong about * overflowing. */ if (UNLIKELY(ret > IV_MAX)) { overflows = 1; } # endif if (UNLIKELY(overflows)) { if (! do_warnings) { if (retlen) { *retlen = D_PPP_MIN(*retlen, UTF8SKIP(s)); *retlen = D_PPP_MIN(*retlen, curlen); } return UNICODE_REPLACEMENT; } else { /* We use the error message in use from 5.8-5.26 */ Perl_warner(aTHX_ packWARN(WARN_UTF8), "Malformed UTF-8 character (overflow at 0x%" UVxf ", byte 0x%02x, after start byte 0x%02x)", ret, *cur_s, *s); if (retlen) { *retlen = (STRLEN) -1; } return 0; } } /* Here, did not overflow, but if it failed for some other reason, and * warnings are off, to emulate the behavior of the real utf8_to_uvchr(), * try again, allowing anything. (Note a return of 0 is ok if the input * was '\0') */ if (UNLIKELY(ret == 0 && (curlen == 0 || *s != '\0'))) { /* If curlen is 0, we already handled the case where warnings are * disabled, so this 'if' will be true, and so later on, we know that * 's' is dereferencible */ if (do_warnings) { if (retlen) { *retlen = (STRLEN) -1; } } else { ret = D_PPP_utf8_to_uvchr_buf_callee( (U8 *) /* Early perls: no const */ s, curlen, retlen, UTF8_ALLOW_ANY); /* Override with the REPLACEMENT character, as that is what the * modern version of this function returns */ ret = UNICODE_REPLACEMENT; # if (PERL_BCDVERSION < 0x5016000) /* Versions earlier than this don't necessarily return the proper * length. It should not extend past the end of string, nor past * what the first byte indicates the length is, nor past the * continuation characters */ if (retlen && (IV) *retlen >= 0) { unsigned int i = 1; *retlen = D_PPP_MIN(*retlen, curlen); *retlen = D_PPP_MIN(*retlen, UTF8SKIP(s)); do { # ifdef UTF8_IS_CONTINUATION if (! UTF8_IS_CONTINUATION(s[i])) # else /* Versions without the above don't support EBCDIC anyway */ if (s[i] < 0x80 || s[i] > 0xBF) # endif { *retlen = i; break; } } while (++i < *retlen); } # endif /* end of < 5.16.0 */ } } return ret; # endif /* end of < 5.31.4 */ } # endif #endif #if defined(UTF8SKIP) && defined(utf8_to_uvchr_buf) #undef utf8_to_uvchr /* Always redefine this unsafe function so that it refuses to read past a NUL, making it much less likely to read off the end of the buffer. A NUL indicates the start of the next character anyway. If the input isn't NUL-terminated, the function remains unsafe, as it always has been. */ #ifndef utf8_to_uvchr # define utf8_to_uvchr(s, lp) \ ((*(s) == '\0') \ ? utf8_to_uvchr_buf(s,((s)+1), lp) /* Handle single NUL specially */ \ : utf8_to_uvchr_buf(s, (s) + UTF8_CHK_SKIP(s), (lp))) #endif #endif /* Hint: utf8_to_uvchr Use utf8_to_uvchr_buf() instead. But ONLY if you KNOW the upper bound of the input string (not resorting to using UTF8SKIP, etc., to infer it). The backported utf8_to_uvchr() will do a better job to prevent most cases of trying to read beyond the end of the buffer */ /* Replace utf8_to_uvchr with utf8_to_uvchr_buf */ #ifdef sv_len_utf8 # if (PERL_BCDVERSION >= 0x5017005) # ifndef sv_len_utf8_nomg # if defined(PERL_USE_GCC_BRACE_GROUPS) # define sv_len_utf8_nomg(sv) \ ({ \ SV *sv_ = (sv); \ sv_len_utf8(!SvGMAGICAL(sv_) \ ? sv_ \ : sv_mortalcopy_flags(sv_, SV_NOSTEAL)); \ }) # else PERL_STATIC_INLINE STRLEN D_PPP_sv_len_utf8_nomg(SV * sv) { dTHX; if (SvGMAGICAL(sv)) return sv_len_utf8(sv_mortalcopy_flags(sv, SV_NOSTEAL)); else return sv_len_utf8(sv); } # define sv_len_utf8_nomg(sv) D_PPP_sv_len_utf8_nomg(sv) # endif # endif # else /* < 5.17.5 */ /* Older Perl versions have broken sv_len_utf8() when passed sv does not * have SVf_UTF8 flag set */ /* Also note that SvGETMAGIC() may change presence of SVf_UTF8 flag */ # undef sv_len_utf8 # if defined(PERL_USE_GCC_BRACE_GROUPS) # define sv_len_utf8_nomg(sv) \ ({ \ SV *sv2 = (sv); \ STRLEN len; \ if (SvUTF8(sv2)) { \ if (SvGMAGICAL(sv2)) \ len = Perl_sv_len_utf8(aTHX_ \ sv_mortalcopy_flags(sv2, \ SV_NOSTEAL));\ else \ len = Perl_sv_len_utf8(aTHX_ sv2); \ } \ else SvPV_nomg(sv2, len); \ len; \ }) # define sv_len_utf8(sv) ({ SV *_sv1 = (sv); \ SvGETMAGIC(_sv1); \ sv_len_utf8_nomg(_sv1); \ }) # else /* Below is no brace groups */ PERL_STATIC_INLINE STRLEN D_PPP_sv_len_utf8_nomg(SV * sv) { dTHX; STRLEN len; if (SvUTF8(sv)) { if (SvGMAGICAL(sv)) len = Perl_sv_len_utf8(aTHX_ sv_mortalcopy_flags(sv, SV_NOSTEAL)); else len = Perl_sv_len_utf8(aTHX_ sv); } else SvPV_nomg(sv, len); return len; } # define sv_len_utf8_nomg(sv) D_PPP_sv_len_utf8_nomg(sv) PERL_STATIC_INLINE STRLEN D_PPP_sv_len_utf8(SV * sv) { dTHX; SvGETMAGIC(sv); return sv_len_utf8_nomg(sv); } # define sv_len_utf8(sv) D_PPP_sv_len_utf8(sv) # endif # endif /* End of < 5.17.5 */ #endif #ifndef PERL_PV_ESCAPE_QUOTE # define PERL_PV_ESCAPE_QUOTE 0x0001 #endif #ifndef PERL_PV_PRETTY_QUOTE # define PERL_PV_PRETTY_QUOTE PERL_PV_ESCAPE_QUOTE #endif #ifndef PERL_PV_PRETTY_ELLIPSES # define PERL_PV_PRETTY_ELLIPSES 0x0002 #endif #ifndef PERL_PV_PRETTY_LTGT # define PERL_PV_PRETTY_LTGT 0x0004 #endif #ifndef PERL_PV_ESCAPE_FIRSTCHAR # define PERL_PV_ESCAPE_FIRSTCHAR 0x0008 #endif #ifndef PERL_PV_ESCAPE_UNI # define PERL_PV_ESCAPE_UNI 0x0100 #endif #ifndef PERL_PV_ESCAPE_UNI_DETECT # define PERL_PV_ESCAPE_UNI_DETECT 0x0200 #endif #ifndef PERL_PV_ESCAPE_ALL # define PERL_PV_ESCAPE_ALL 0x1000 #endif #ifndef PERL_PV_ESCAPE_NOBACKSLASH # define PERL_PV_ESCAPE_NOBACKSLASH 0x2000 #endif #ifndef PERL_PV_ESCAPE_NOCLEAR # define PERL_PV_ESCAPE_NOCLEAR 0x4000 #endif #ifndef PERL_PV_ESCAPE_RE # define PERL_PV_ESCAPE_RE 0x8000 #endif #ifndef PERL_PV_PRETTY_NOCLEAR # define PERL_PV_PRETTY_NOCLEAR PERL_PV_ESCAPE_NOCLEAR #endif #ifndef PERL_PV_PRETTY_DUMP # define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE #endif #ifndef PERL_PV_PRETTY_REGPROP # define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE #endif /* Hint: pv_escape * Note that unicode functionality is only backported to * those perl versions that support it. For older perl * versions, the implementation will fall back to bytes. */ #ifndef pv_escape #if defined(NEED_pv_escape) static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); static #else extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); #endif #if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL) #ifdef pv_escape # undef pv_escape #endif #define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f) #define Perl_pv_escape DPPP_(my_pv_escape) char * DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags) { const char esc = flags & PERL_PV_ESCAPE_RE ? '%' : '\\'; const char dq = flags & PERL_PV_ESCAPE_QUOTE ? '"' : esc; char octbuf[32] = "%123456789ABCDF"; STRLEN wrote = 0; STRLEN chsize = 0; STRLEN readsize = 1; #if defined(is_utf8_string) && defined(utf8_to_uvchr_buf) bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0; #endif const char *pv = str; const char * const end = pv + count; octbuf[0] = esc; if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) sv_setpvs(dsv, ""); #if defined(is_utf8_string) && defined(utf8_to_uvchr_buf) if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count)) isuni = 1; #endif for (; pv < end && (!max || wrote < max) ; pv += readsize) { const UV u = #if defined(is_utf8_string) && defined(utf8_to_uvchr_buf) isuni ? utf8_to_uvchr_buf((U8*)pv, end, &readsize) : #endif (U8)*pv; const U8 c = (U8)u & 0xFF; if (u > 255 || (flags & PERL_PV_ESCAPE_ALL)) { if (flags & PERL_PV_ESCAPE_FIRSTCHAR) chsize = my_snprintf(octbuf, sizeof octbuf, "%" UVxf, u); else chsize = my_snprintf(octbuf, sizeof octbuf, "%cx{%" UVxf "}", esc, u); } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) { chsize = 1; } else { if (c == dq || c == esc || !isPRINT(c)) { chsize = 2; switch (c) { case '\\' : /* fallthrough */ case '%' : if (c == esc) octbuf[1] = esc; else chsize = 1; break; case '\v' : octbuf[1] = 'v'; break; case '\t' : octbuf[1] = 't'; break; case '\r' : octbuf[1] = 'r'; break; case '\n' : octbuf[1] = 'n'; break; case '\f' : octbuf[1] = 'f'; break; case '"' : if (dq == '"') octbuf[1] = '"'; else chsize = 1; break; default: chsize = my_snprintf(octbuf, sizeof octbuf, pv < end && isDIGIT((U8)*(pv+readsize)) ? "%c%03o" : "%c%o", esc, c); } } else { chsize = 1; } } if (max && wrote + chsize > max) { break; } else if (chsize > 1) { sv_catpvn(dsv, octbuf, chsize); wrote += chsize; } else { char tmp[2]; my_snprintf(tmp, sizeof tmp, "%c", c); sv_catpvn(dsv, tmp, 1); wrote++; } if (flags & PERL_PV_ESCAPE_FIRSTCHAR) break; } if (escaped != NULL) *escaped= pv - str; return SvPVX(dsv); } #endif #endif #ifndef pv_pretty #if defined(NEED_pv_pretty) static char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); static #else extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); #endif #if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL) #ifdef pv_pretty # undef pv_pretty #endif #define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g) #define Perl_pv_pretty DPPP_(my_pv_pretty) char * DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags) { const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%'; STRLEN escaped; if (!(flags & PERL_PV_PRETTY_NOCLEAR)) sv_setpvs(dsv, ""); if (dq == '"') sv_catpvs(dsv, "\""); else if (flags & PERL_PV_PRETTY_LTGT) sv_catpvs(dsv, "<"); if (start_color != NULL) sv_catpv(dsv, D_PPP_CONSTPV_ARG(start_color)); pv_escape(dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR); if (end_color != NULL) sv_catpv(dsv, D_PPP_CONSTPV_ARG(end_color)); if (dq == '"') sv_catpvs(dsv, "\""); else if (flags & PERL_PV_PRETTY_LTGT) sv_catpvs(dsv, ">"); if ((flags & PERL_PV_PRETTY_ELLIPSES) && escaped < count) sv_catpvs(dsv, "..."); return SvPVX(dsv); } #endif #endif #ifndef pv_display #if defined(NEED_pv_display) static char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); static #else extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); #endif #if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL) #ifdef pv_display # undef pv_display #endif #define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e) #define Perl_pv_display DPPP_(my_pv_display) char * DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) { pv_pretty(dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP); if (len > cur && pv[cur] == '\0') sv_catpvs(dsv, "\\0"); return SvPVX(dsv); } #endif #endif #if PERL_VERSION_LT(5,27,9) #ifndef LC_NUMERIC_LOCK # define LC_NUMERIC_LOCK #endif #ifndef LC_NUMERIC_UNLOCK # define LC_NUMERIC_UNLOCK #endif # if PERL_VERSION_LT(5,19,0) # undef STORE_LC_NUMERIC_SET_STANDARD # undef RESTORE_LC_NUMERIC # undef DECLARATION_FOR_LC_NUMERIC_MANIPULATION # ifdef USE_LOCALE #ifndef DECLARATION_FOR_LC_NUMERIC_MANIPULATION # define DECLARATION_FOR_LC_NUMERIC_MANIPULATION char *LoC_ #endif #ifndef STORE_NUMERIC_SET_STANDARD # define STORE_NUMERIC_SET_STANDARD() \ LoC_ = savepv(setlocale(LC_NUMERIC, NULL)); \ SAVEFREEPV(LoC_); \ setlocale(LC_NUMERIC, "C"); #endif #ifndef RESTORE_LC_NUMERIC # define RESTORE_LC_NUMERIC() \ setlocale(LC_NUMERIC, LoC_); #endif # else #ifndef DECLARATION_FOR_LC_NUMERIC_MANIPULATION # define DECLARATION_FOR_LC_NUMERIC_MANIPULATION #endif #ifndef STORE_LC_NUMERIC_SET_STANDARD # define STORE_LC_NUMERIC_SET_STANDARD() #endif #ifndef RESTORE_LC_NUMERIC # define RESTORE_LC_NUMERIC() #endif # endif # endif #endif #ifndef LOCK_NUMERIC_STANDARD # define LOCK_NUMERIC_STANDARD() #endif #ifndef UNLOCK_NUMERIC_STANDARD # define UNLOCK_NUMERIC_STANDARD() #endif /* The names of these changed in 5.28 */ #ifndef LOCK_LC_NUMERIC_STANDARD # define LOCK_LC_NUMERIC_STANDARD LOCK_NUMERIC_STANDARD #endif #ifndef UNLOCK_LC_NUMERIC_STANDARD # define UNLOCK_LC_NUMERIC_STANDARD UNLOCK_NUMERIC_STANDARD #endif /* If this doesn't exist, it's not needed, so is void noop */ #ifndef switch_to_global_locale # define switch_to_global_locale() #endif /* Originally, this didn't return a value, but in perls like that, the value * should always be TRUE. Add a return to Perl_sync_locale() when it's * available. And actually do a sync when its not, if locales are available on * this system. */ #ifdef sync_locale # if (PERL_BCDVERSION < 0x5027009) # if (PERL_BCDVERSION >= 0x5021003) # undef sync_locale # define sync_locale() (Perl_sync_locale(aTHX), 1) # elif defined(sync_locale) /* These should only be the 5.20 maints*/ # undef sync_locale /* Just copy their defn and return 1 */ # define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), \ new_collate(setlocale(LC_COLLATE, NULL)), \ set_numeric_local(), \ new_numeric(setlocale(LC_NUMERIC, NULL)), \ 1) # elif defined(new_ctype) && defined(LC_CTYPE) # define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), 1) # endif # endif #endif #ifndef sync_locale # define sync_locale() 1 #endif #endif /* _P_P_PORTABILITY_H_ */ /* End of File dbipport.h */ DBI-1.648/dbilogstrip.PL0000644000031300001440000000364114656646601014170 0ustar00merijnusers#!/usr/bin/perl # -*- perl -*- my $file = $ARGV[0] || 'dbilogstrip'; my $script = <<'SCRIPT'; ~startperl~ =head1 NAME dbilogstrip - filter to normalize DBI trace logs for diff'ing =head1 SYNOPSIS Read DBI trace file C and write out a stripped version to C dbilogstrip dbitrace.log > dbitrace_stripped.log Run C twice, each with different sets of arguments, with DBI_TRACE enabled. Filter the output and trace through C into a separate file for each run. Then compare using diff. (This example assumes you're using a standard shell.) DBI_TRACE=2 perl yourscript.pl ...args1... 2>&1 | dbilogstrip > dbitrace1.log DBI_TRACE=2 perl yourscript.pl ...args2... 2>&1 | dbilogstrip > dbitrace2.log diff -u dbitrace1.log dbitrace2.log =head1 DESCRIPTION Replaces any hex addresses, e.g, C<0x128f72ce> with C<0xN>. Replaces any references to process id or thread id, like C with C. So a DBI trace line like this: -> STORE for DBD::DBM::st (DBI::st=HASH(0x19162a0)~0x191f9c8 'f_params' ARRAY(0x1922018)) thr#1800400 will look like this: -> STORE for DBD::DBM::st (DBI::st=HASH(0xN)~0xN 'f_params' ARRAY(0xN)) thrN =cut use strict; while (<>) { # normalize hex addresses: 0xDEADHEAD => 0xN s/ \b 0x [0-9a-f]+ /0xN/gx; # normalize process and thread id number s/ \b (pid|tid|thr) \W? \d+ /${1}N/gx; } continue { print or die "-p destination: $!\n"; } SCRIPT require Config; my $config = {}; $config->{'startperl'} = $Config::Config{'startperl'}; $script =~ s/\~(\w+)\~/$config->{$1}/eg; if (!(open(FILE, ">$file")) || !(print FILE $script) || !(close(FILE))) { die "Error while writing $file: $!\n"; } chmod 0755, $file; print "Extracted $file from ",__FILE__," with variable substitutions.\n"; # syntax check resulting file, but only for developers exit 1 if -d ".svn" and system($^X, '-wc', '-Mblib', $file) != 0; DBI-1.648/DBI.pm0000644000031300001440000116242415206027403012334 0ustar00merijnusers# $Id$ # vim: ts=8:sw=4:et # # Copyright (c) 2024-2026 DBI Team # Copyright (c) 1994-2024 Tim Bunce Ireland # # See COPYRIGHT section in pod text below for usage and distribution rights. # package DBI; require 5.008001; use strict; use warnings; our ($XS_VERSION, $VERSION); BEGIN { $VERSION = "1.648"; # ==> ALSO update the version in the pod text below! $XS_VERSION = $VERSION; $VERSION =~ tr/_//d; } =head1 NAME DBI - Database independent interface for Perl =head1 SYNOPSIS use DBI; @driver_names = DBI->available_drivers; %drivers = DBI->installed_drivers; @data_sources = DBI->data_sources($driver_name, \%attr); $dbh = DBI->connect($data_source, $username, $auth, \%attr); $rv = $dbh->do($statement); $rv = $dbh->do($statement, \%attr); $rv = $dbh->do($statement, \%attr, @bind_values); $ary_ref = $dbh->selectall_arrayref($statement); $hash_ref = $dbh->selectall_hashref($statement, $key_field); $ary_ref = $dbh->selectcol_arrayref($statement); $ary_ref = $dbh->selectcol_arrayref($statement, \%attr); @row_ary = $dbh->selectrow_array($statement); $ary_ref = $dbh->selectrow_arrayref($statement); $hash_ref = $dbh->selectrow_hashref($statement); $sth = $dbh->prepare($statement); $sth = $dbh->prepare_cached($statement); $rc = $sth->bind_param($p_num, $bind_value); $rc = $sth->bind_param($p_num, $bind_value, $bind_type); $rc = $sth->bind_param($p_num, $bind_value, \%attr); $rv = $sth->execute; $rv = $sth->execute(@bind_values); $rv = $sth->execute_array(\%attr, ...); $rc = $sth->bind_col($col_num, \$col_variable); $rc = $sth->bind_columns(@list_of_refs_to_vars_to_bind); @row_ary = $sth->fetchrow_array; $ary_ref = $sth->fetchrow_arrayref; $hash_ref = $sth->fetchrow_hashref; $ary_ref = $sth->fetchall_arrayref; $ary_ref = $sth->fetchall_arrayref( $slice, $max_rows ); $hash_ref = $sth->fetchall_hashref( $key_field ); $rv = $sth->rows; $rc = $dbh->begin_work; $rc = $dbh->commit; $rc = $dbh->rollback; $quoted_string = $dbh->quote($string); $rc = $h->err; $str = $h->errstr; $rv = $h->state; $rc = $dbh->disconnect; I =head2 GETTING HELP =head3 General Before asking any questions, reread this document, consult the archives and read the DBI FAQ. The archives are listed at the end of this document and on the DBI home page L You might also like to read the Advanced DBI Tutorial at L To help you make the best use of the dbi-users mailing list, and any other lists or forums you may use, I recommend that you read "Getting Answers" by Mike Ash: L. =head3 Mailing Lists If you have questions about DBI, or DBD driver modules, you can get help from the I mailing list. This is the best way to get help. You don't have to subscribe to the list in order to post, though I'd recommend it. You can get help on subscribing and using the list by emailing I. Please note that Tim Bunce does not maintain the mailing lists or the web pages (generous volunteers do that). So please don't send mail directly to him; he just doesn't have the time to answer questions personally. The I mailing list has lots of experienced people who should be able to help you if you need it. If you do email Tim he is very likely to just forward it to the mailing list. =head3 IRC DBI IRC Channel: #dbi on irc.perl.org (L) =for html (click for instant chatroom login) =head3 Online StackOverflow has a DBI tag L with over 800 questions. The DBI home page at L might be worth a visit. It includes links to other resources, but I. =head3 Reporting a Bug If you think you've found a bug then please read "How to Report Bugs Effectively" by Simon Tatham: L. If you think you've found a memory leak then read L. Your problem is most likely related to the specific DBD driver module you're using. If that's the case then click on the 'Bugs' link on the L page for your driver. Only submit a bug report against the DBI itself if you're sure that your issue isn't related to the driver you're using. =head2 NOTES This is the DBI specification that corresponds to DBI version 1.648 (see L for details). The DBI is evolving at a steady pace, so it's good to check that you have the latest copy. The significant user-visible changes in each release are documented in the L module so you can read them by executing C. Some DBI changes require changes in the drivers, but the drivers can take some time to catch up. Newer versions of the DBI have added features that may not yet be supported by the drivers you use. Talk to the authors of your drivers if you need a new feature that is not yet supported. Features added after DBI 1.21 (February 2002) are marked in the text with the version number of the DBI release they first appeared in. Extensions to the DBI API often use the C namespace. See L. DBI extension modules can be found at L. And all modules related to the DBI can be found at L. =cut # The POD text continues at the end of the file. use Scalar::Util (); use Carp(); use XSLoader (); use Exporter (); our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); BEGIN { @ISA = qw(Exporter); # Make some utility functions available if asked for @EXPORT = (); # we export nothing by default @EXPORT_OK = qw(%DBI %DBI_methods hash); # also populated by export_ok_tags: %EXPORT_TAGS = ( sql_types => [ qw( SQL_GUID SQL_WLONGVARCHAR SQL_WVARCHAR SQL_WCHAR SQL_BIGINT SQL_BIT SQL_TINYINT SQL_LONGVARBINARY SQL_VARBINARY SQL_BINARY SQL_LONGVARCHAR SQL_UNKNOWN_TYPE SQL_ALL_TYPES SQL_CHAR SQL_NUMERIC SQL_DECIMAL SQL_INTEGER SQL_SMALLINT SQL_FLOAT SQL_REAL SQL_DOUBLE SQL_DATETIME SQL_DATE SQL_INTERVAL SQL_TIME SQL_TIMESTAMP SQL_VARCHAR SQL_BOOLEAN SQL_UDT SQL_UDT_LOCATOR SQL_ROW SQL_REF SQL_BLOB SQL_BLOB_LOCATOR SQL_CLOB SQL_CLOB_LOCATOR SQL_ARRAY SQL_ARRAY_LOCATOR SQL_MULTISET SQL_MULTISET_LOCATOR SQL_TYPE_DATE SQL_TYPE_TIME SQL_TYPE_TIMESTAMP SQL_TYPE_TIME_WITH_TIMEZONE SQL_TYPE_TIMESTAMP_WITH_TIMEZONE SQL_INTERVAL_YEAR SQL_INTERVAL_MONTH SQL_INTERVAL_DAY SQL_INTERVAL_HOUR SQL_INTERVAL_MINUTE SQL_INTERVAL_SECOND SQL_INTERVAL_YEAR_TO_MONTH SQL_INTERVAL_DAY_TO_HOUR SQL_INTERVAL_DAY_TO_MINUTE SQL_INTERVAL_DAY_TO_SECOND SQL_INTERVAL_HOUR_TO_MINUTE SQL_INTERVAL_HOUR_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND ) ], sql_cursor_types => [ qw( SQL_CURSOR_FORWARD_ONLY SQL_CURSOR_KEYSET_DRIVEN SQL_CURSOR_DYNAMIC SQL_CURSOR_STATIC SQL_CURSOR_TYPE_DEFAULT ) ], # for ODBC cursor types utils => [ qw( neat neat_list $neat_maxlen dump_results looks_like_number data_string_diff data_string_desc data_diff sql_type_cast DBIstcf_DISCARD_STRING DBIstcf_STRICT ) ], profile => [ qw( dbi_profile dbi_profile_merge dbi_profile_merge_nodes dbi_time ) ], # notionally "in" DBI::Profile and normally imported from there ); $DBI::dbi_debug = 0; # mixture of bit fields and int sub-fields $DBI::neat_maxlen = 1000; $DBI::stderr = 2_000_000_000; # a very round number below 2**31 # If you get an error here like "Can't find loadable object ..." # then you haven't installed the DBI correctly. Read the README # then install it again. if ( $ENV{DBI_PUREPERL} ) { eval { XSLoader::load('DBI', $XS_VERSION) } if $ENV{DBI_PUREPERL} == 1; require DBI::PurePerl if $@ or $ENV{DBI_PUREPERL} >= 2; $DBI::PurePerl ||= 0; # just to silence "only used once" warnings } else { XSLoader::load( 'DBI', $XS_VERSION); } $EXPORT_TAGS{preparse_flags} = [ grep { /^DBIpp_\w\w_/ } keys %DBI:: ]; Exporter::export_ok_tags(keys %EXPORT_TAGS); } # Alias some handle methods to also be DBI class methods for (qw(trace_msg set_err parse_trace_flag parse_trace_flags)) { no strict; *$_ = \&{"DBD::_::common::$_"}; } DBI->trace(split /=/, $ENV{DBI_TRACE}, 2) if $ENV{DBI_TRACE}; $DBI::connect_via ||= "connect"; # check if user wants a persistent database connection ( Apache + mod_perl ) if ($INC{'Apache/DBI.pm'} && $ENV{MOD_PERL}) { $DBI::connect_via = "Apache::DBI::connect"; DBI->trace_msg("DBI connect via $DBI::connect_via in $INC{'Apache/DBI.pm'}\n"); } %DBI::installed_drh = (); # maps driver names to installed driver handles sub installed_drivers { %DBI::installed_drh } %DBI::installed_methods = (); # XXX undocumented, may change sub installed_methods { %DBI::installed_methods } # Setup special DBI dynamic variables. See DBI::var::FETCH for details. # These are dynamically associated with the last handle used. tie $DBI::err, 'DBI::var', '*err'; # special case: referenced via IHA list tie $DBI::state, 'DBI::var', '"state'; # special case: referenced via IHA list tie $DBI::lasth, 'DBI::var', '!lasth'; # special case: return boolean tie $DBI::errstr, 'DBI::var', '&errstr'; # call &errstr in last used pkg tie $DBI::rows, 'DBI::var', '&rows'; # call &rows in last used pkg sub DBI::var::TIESCALAR{ my $var = $_[1]; bless \$var, 'DBI::var'; } sub DBI::var::STORE { Carp::croak("Can't modify \$DBI::${$_[0]} special variable") } # --- Driver Specific Prefix Registry --- my $dbd_prefix_registry = { ad_ => { class => 'DBD::AnyData', }, ad2_ => { class => 'DBD::AnyData2', }, ado_ => { class => 'DBD::ADO', }, amzn_ => { class => 'DBD::Amazon', }, best_ => { class => 'DBD::BestWins', }, csv_ => { class => 'DBD::CSV', }, cubrid_ => { class => 'DBD::cubrid', }, db2_ => { class => 'DBD::DB2', }, dbi_ => { class => 'DBI', }, dbm_ => { class => 'DBD::DBM', }, df_ => { class => 'DBD::DF', }, examplep_ => { class => 'DBD::ExampleP', }, f_ => { class => 'DBD::File', }, file_ => { class => 'DBD::TextFile', }, go_ => { class => 'DBD::Gofer', }, ib_ => { class => 'DBD::InterBase', }, ing_ => { class => 'DBD::Ingres', }, ix_ => { class => 'DBD::Informix', }, jdbc_ => { class => 'DBD::JDBC', }, mariadb_ => { class => 'DBD::MariaDB', }, mem_ => { class => 'DBD::Mem', }, mo_ => { class => 'DBD::MO', }, monetdb_ => { class => 'DBD::monetdb', }, msql_ => { class => 'DBD::mSQL', }, mvsftp_ => { class => 'DBD::MVS_FTPSQL', }, mysql_ => { class => 'DBD::mysql', }, multi_ => { class => 'DBD::Multi' }, mx_ => { class => 'DBD::Multiplex', }, neo_ => { class => 'DBD::Neo4p', }, nullp_ => { class => 'DBD::NullP', }, odbc_ => { class => 'DBD::ODBC', }, ora_ => { class => 'DBD::Oracle', }, pg_ => { class => 'DBD::Pg', }, pgpp_ => { class => 'DBD::PgPP', }, plb_ => { class => 'DBD::Plibdata', }, po_ => { class => 'DBD::PO', }, proxy_ => { class => 'DBD::Proxy', }, ram_ => { class => 'DBD::RAM', }, rdb_ => { class => 'DBD::RDB', }, sapdb_ => { class => 'DBD::SAP_DB', }, snmp_ => { class => 'DBD::SNMP', }, solid_ => { class => 'DBD::Solid', }, spatialite_ => { class => 'DBD::Spatialite', }, sponge_ => { class => 'DBD::Sponge', }, sql_ => { class => 'DBI::DBD::SqlEngine', }, sqlite_ => { class => 'DBD::SQLite', }, syb_ => { class => 'DBD::Sybase', }, sys_ => { class => 'DBD::Sys', }, tdat_ => { class => 'DBD::Teradata', }, tmpl_ => { class => 'DBD::Template', }, tmplss_ => { class => 'DBD::TemplateSS', }, tree_ => { class => 'DBD::TreeData', }, tuber_ => { class => 'DBD::Tuber', }, uni_ => { class => 'DBD::Unify', }, vt_ => { class => 'DBD::Vt', }, wmi_ => { class => 'DBD::WMI', }, x_ => { }, # for private use xbase_ => { class => 'DBD::XBase', }, xmlsimple_ => { class => 'DBD::XMLSimple', }, xl_ => { class => 'DBD::Excel', }, yaswi_ => { class => 'DBD::Yaswi', }, }; my %dbd_class_registry = map { $dbd_prefix_registry->{$_}->{class} => { prefix => $_ } } grep { exists $dbd_prefix_registry->{$_}->{class} } keys %{$dbd_prefix_registry}; sub dump_dbd_registry { require Data::Dumper; local $Data::Dumper::Sortkeys=1; local $Data::Dumper::Indent=1; print Data::Dumper->Dump([$dbd_prefix_registry], [qw($dbd_prefix_registry)]); } # --- Dynamically create the DBI Standard Interface my $keeperr = { O=>0x0004 }; %DBI::DBI_methods = ( # Define the DBI interface methods per class: common => { # Interface methods common to all DBI handle classes 'DESTROY' => { O=>0x004|0x10000 }, 'CLEAR' => $keeperr, 'EXISTS' => $keeperr, 'FETCH' => { O=>0x0404 }, 'FETCH_many' => { O=>0x0404 }, 'FIRSTKEY' => $keeperr, 'NEXTKEY' => $keeperr, 'STORE' => { O=>0x0418 | 0x4 }, 'DELETE' => { O=>0x0404 }, can => { O=>0x0100 }, # special case, see dispatch debug => { U =>[1,2,'[$debug_level]'], O=>0x0004 }, # old name for trace dump_handle => { U =>[1,3,'[$message [, $level]]'], O=>0x0004 }, err => $keeperr, errstr => $keeperr, state => $keeperr, func => { O=>0x0006 }, parse_trace_flag => { U =>[2,2,'$name'], O=>0x0404, T=>8 }, parse_trace_flags => { U =>[2,2,'$flags'], O=>0x0404, T=>8 }, private_data => { U =>[1,1], O=>0x0004 }, set_err => { U =>[3,6,'$err, $errmsg [, $state, $method, $rv]'], O=>0x0010 }, trace => { U =>[1,3,'[$trace_level, [$filename]]'], O=>0x0004 }, trace_msg => { U =>[2,3,'$message_text [, $min_level ]' ], O=>0x0004, T=>8 }, swap_inner_handle => { U =>[2,3,'$h [, $allow_reparent ]'] }, private_attribute_info => { }, visit_child_handles => { U => [2,3,'$coderef [, $info ]'], O=>0x0404, T=>4 }, }, dr => { # Database Driver Interface 'connect' => { U =>[1,5,'[$db [,$user [,$passwd [,\%attr]]]]'], H=>3, O=>0x8000, T=>0x200 }, 'connect_cached'=>{U=>[1,5,'[$db [,$user [,$passwd [,\%attr]]]]'], H=>3, O=>0x8000, T=>0x200 }, 'disconnect_all'=>{ U =>[1,1], O=>0x0800, T=>0x200 }, data_sources => { U =>[1,2,'[\%attr]' ], O=>0x0800, T=>0x200 }, default_user => { U =>[3,4,'$user, $pass [, \%attr]' ], T=>0x200 }, dbixs_revision => $keeperr, }, db => { # Database Session Class Interface data_sources => { U =>[1,2,'[\%attr]' ], O=>0x0200 }, take_imp_data => { U =>[1,1], O=>0x10000 }, clone => { U =>[1,2,'[\%attr]'], T=>0x200 }, connected => { U =>[1,0], O => 0x0004, T=>0x200, H=>3 }, begin_work => { U =>[1,2,'[ \%attr ]'], O=>0x0400, T=>0x1000 }, commit => { U =>[1,1], O=>0x0480|0x0800, T=>0x1000 }, rollback => { U =>[1,1], O=>0x0480|0x0800, T=>0x1000 }, 'do' => { U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'], O=>0x3200 }, last_insert_id => { U =>[1,6,'[$catalog [,$schema [,$table_name [,$field_name [, \%attr ]]]]]'], O=>0x2800 }, preparse => { }, # XXX prepare => { U =>[2,3,'$statement [, \%attr]'], O=>0xA200 }, prepare_cached => { U =>[2,4,'$statement [, \%attr [, $if_active ] ]'], O=>0xA200 }, selectrow_array => { U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'], O=>0x2000 }, selectrow_arrayref=>{U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'], O=>0x2000 }, selectrow_hashref=>{ U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'], O=>0x2000 }, selectall_arrayref=>{U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'], O=>0x2000 }, selectall_array =>{U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'], O=>0x2000 }, selectall_hashref=>{ U =>[3,0,'$statement, $keyfield [, \%attr [, @bind_params ] ]'], O=>0x2000 }, selectcol_arrayref=>{U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'], O=>0x2000 }, ping => { U =>[1,1], O=>0x0404 }, disconnect => { U =>[1,1], O=>0x0400|0x0800|0x10000, T=>0x200 }, quote => { U =>[2,3, '$string [, $data_type ]' ], O=>0x0430, T=>2 }, quote_identifier=> { U =>[2,6, '$name [, ...] [, \%attr ]' ], O=>0x0430, T=>2 }, rows => $keeperr, tables => { U =>[1,6,'$catalog, $schema, $table, $type [, \%attr ]' ], O=>0x2200 }, table_info => { U =>[1,6,'$catalog, $schema, $table, $type [, \%attr ]' ], O=>0x2200|0x8800 }, column_info => { U =>[5,6,'$catalog, $schema, $table, $column [, \%attr ]'],O=>0x2200|0x8800 }, primary_key_info=> { U =>[4,5,'$catalog, $schema, $table [, \%attr ]' ], O=>0x2200|0x8800 }, primary_key => { U =>[4,5,'$catalog, $schema, $table [, \%attr ]' ], O=>0x2200 }, foreign_key_info=> { U =>[7,8,'$pk_catalog, $pk_schema, $pk_table, $fk_catalog, $fk_schema, $fk_table [, \%attr ]' ], O=>0x2200|0x8800 }, statistics_info => { U =>[6,7,'$catalog, $schema, $table, $unique_only, $quick, [, \%attr ]' ], O=>0x2200|0x8800 }, type_info_all => { U =>[1,1], O=>0x2200|0x0800 }, type_info => { U =>[1,2,'$data_type'], O=>0x2200 }, get_info => { U =>[2,2,'$info_type'], O=>0x2200|0x0800 }, }, st => { # Statement Class Interface bind_col => { U =>[3,4,'$column, \\$var [, \%attr]'] }, bind_columns => { U =>[2,0,'\\$var1 [, \\$var2, ...]'] }, bind_param => { U =>[3,4,'$parameter, $var [, \%attr]'] }, bind_param_inout=> { U =>[4,5,'$parameter, \\$var, $maxlen, [, \%attr]'] }, execute => { U =>[1,0,'[@args]'], O=>0x1040 }, last_insert_id => { U =>[1,6,'[$catalog [,$schema [,$table_name [,$field_name [, \%attr ]]]]]'], O=>0x2800 }, bind_param_array => { U =>[3,4,'$parameter, $var [, \%attr]'] }, bind_param_inout_array => { U =>[4,5,'$parameter, \\@var, $maxlen, [, \%attr]'] }, execute_array => { U =>[2,0,'\\%attribs [, @args]'], O=>0x1040|0x4000 }, execute_for_fetch => { U =>[2,3,'$fetch_sub [, $tuple_status]'], O=>0x1040|0x4000 }, fetch => undef, # alias for fetchrow_arrayref fetchrow_arrayref => undef, fetchrow_hashref => undef, fetchrow_array => undef, fetchrow => undef, # old alias for fetchrow_array fetchall_arrayref => { U =>[1,3, '[ $slice [, $max_rows]]'] }, fetchall_hashref => { U =>[2,2,'$key_field'] }, blob_read => { U =>[4,5,'$field, $offset, $len [, \\$buf [, $bufoffset]]'] }, blob_copy_to_file => { U =>[3,3,'$field, $filename_or_handleref'] }, dump_results => { U =>[1,5,'$maxfieldlen, $linesep, $fieldsep, $filehandle'] }, more_results => { U =>[1,1] }, finish => { U =>[1,1] }, cancel => { U =>[1,1], O=>0x0800 }, rows => $keeperr, _get_fbav => undef, _set_fbav => { T=>6 }, }, ); while ( my ($class, $meths) = each %DBI::DBI_methods ) { my $ima_trace = 0+($ENV{DBI_IMA_TRACE}||0); while ( my ($method, $info) = each %$meths ) { my $fullmeth = "DBI::${class}::$method"; if (($DBI::dbi_debug & 0xF) == 15) { # quick hack to list DBI methods # and optionally filter by IMA flags my $O = $info->{O}||0; printf "0x%04x %-20s\n", $O, $fullmeth unless $ima_trace && !($O & $ima_trace); } DBI->_install_method($fullmeth, 'DBI.pm', $info); } } { package DBI::common; @DBI::dr::ISA = ('DBI::common'); @DBI::db::ISA = ('DBI::common'); @DBI::st::ISA = ('DBI::common'); } # End of init code END { return unless defined &DBI::trace_msg; # return unless bootstrap'd ok local ($!,$?); DBI->trace_msg(sprintf(" -- DBI::END (\$\@: %s, \$!: %s)\n", $@||'', $!||''), 2); # Let drivers know why we are calling disconnect_all: $DBI::PERL_ENDING = $DBI::PERL_ENDING = 1; # avoid typo warning DBI->disconnect_all() if %DBI::installed_drh; } sub CLONE { _clone_dbis() unless $DBI::PurePerl; # clone the DBIS structure DBI->trace_msg("CLONE DBI for new thread\n"); while ( my ($driver, $drh) = each %DBI::installed_drh) { no strict 'refs'; next if defined &{"DBD::${driver}::CLONE"}; warn("$driver has no driver CLONE() function so is unsafe threaded\n"); } %DBI::installed_drh = (); # clear loaded drivers so they have a chance to reinitialize } sub parse_dsn { my ($class, $dsn) = @_; $dsn =~ s/^(dbi):(\w*?)(?:\((.*?)\))?://i or return; my ($scheme, $driver, $attr, $attr_hash) = (lc($1), $2, $3); $driver ||= $ENV{DBI_DRIVER} || ''; $attr_hash = { split /\s*=>?\s*|\s*,\s*/, $attr, -1 } if $attr; return ($scheme, $driver, $attr, $attr_hash, $dsn); } sub visit_handles { my ($class, $code, $outer_info) = @_; $outer_info = {} if not defined $outer_info; my %drh = DBI->installed_drivers; for my $h (values %drh) { my $child_info = $code->($h, $outer_info) or next; $h->visit_child_handles($code, $child_info); } return $outer_info; } # --- The DBI->connect Front Door methods sub connect_cached { # For library code using connect_cached() with mod_perl # we redirect those calls to Apache::DBI::connect() as well my ($class, $dsn, $user, $pass, $attr) = @_; my $dbi_connect_method = ($DBI::connect_via eq "Apache::DBI::connect") ? 'Apache::DBI::connect' : 'connect_cached'; $attr = { $attr ? %$attr : (), # clone, don't modify callers data dbi_connect_method => $dbi_connect_method, }; return $class->connect($dsn, $user, $pass, $attr); } sub connect { my $class = shift; my ($dsn, $user, $pass, $attr, $old_driver) = my @orig_args = @_; my $driver; if ($attr and !ref($attr)) { # switch $old_driver<->$attr if called in old style Carp::carp("DBI->connect using 'old-style' syntax is deprecated and will be an error in future versions"); ($old_driver, $attr) = ($attr, $old_driver); } my $connect_meth = $attr->{dbi_connect_method}; $connect_meth ||= $DBI::connect_via; # fallback to default $dsn ||= $ENV{DBI_DSN} || $ENV{DBI_DBNAME} || '' unless $old_driver; if ($DBI::dbi_debug) { no warnings; pop @_ if $connect_meth ne 'connect'; my @args = @_; $args[2] = '****'; # hide password DBI->trace_msg(" -> $class->$connect_meth(".join(", ",@args).")\n"); } Carp::croak('Usage: $class->connect([$dsn [,$user [,$passwd [,\%attr]]]])') if (ref $old_driver or ($attr and not ref $attr) or (ref $pass and not defined Scalar::Util::blessed($pass))); # extract dbi:driver prefix from $dsn into $1 my $orig_dsn = $dsn; $dsn =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i or '' =~ /()/; # ensure $1 etc are empty if match fails my $driver_attrib_spec = $2 || ''; # Set $driver. Old style driver, if specified, overrides new dsn style. $driver = $old_driver || $1 || $ENV{DBI_DRIVER} or Carp::croak("Can't connect to data source '$orig_dsn' " ."because I can't work out what driver to use " ."(it doesn't seem to contain a 'dbi:driver:' prefix " ."and the DBI_DRIVER env var is not set)"); my $proxy; if ($ENV{DBI_AUTOPROXY} && $driver ne 'Proxy' && $driver ne 'Sponge' && $driver ne 'Switch') { my $dbi_autoproxy = $ENV{DBI_AUTOPROXY}; $proxy = 'Proxy'; if ($dbi_autoproxy =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i) { $proxy = $1; $driver_attrib_spec = join ",", ($driver_attrib_spec) ? $driver_attrib_spec : (), ($2 ) ? $2 : (); } $dsn = "$dbi_autoproxy;dsn=dbi:$driver:$dsn"; $driver = $proxy; DBI->trace_msg(" DBI_AUTOPROXY: dbi:$driver($driver_attrib_spec):$dsn\n"); } # avoid recursion if proxy calls DBI->connect itself local $ENV{DBI_AUTOPROXY} if $ENV{DBI_AUTOPROXY}; my %attributes; # take a copy we can delete from if ($old_driver) { %attributes = %$attr if $attr; } else { # new-style connect so new default semantics %attributes = ( PrintError => 1, AutoCommit => 1, ref $attr ? %$attr : (), # attributes in DSN take precedence over \%attr connect parameter $driver_attrib_spec ? (split /\s*=>?\s*|\s*,\s*/, $driver_attrib_spec, -1) : (), ); } $attr = \%attributes; # now set $attr to refer to our local copy my $drh = $DBI::installed_drh{$driver} || $class->install_driver($driver) or die "panic: $class->install_driver($driver) failed"; # attributes in DSN take precedence over \%attr connect parameter $user = $attr->{Username} if defined $attr->{Username}; $pass = $attr->{Password} if defined $attr->{Password}; delete $attr->{Password}; # always delete Password as closure stores it securely if ( !(defined $user && defined $pass) ) { ($user, $pass) = $drh->default_user($user, $pass, $attr); } $attr->{Username} = $user; # force the Username to be the actual one used my $connect_closure = sub { my ($old_dbh, $override_attr) = @_; #use Data::Dumper; #warn "connect_closure: ".Data::Dumper::Dumper([$attr,\%attributes, $override_attr]); my $dbh; unless ($dbh = $drh->$connect_meth($dsn, $user, $pass, $attr)) { $user = '' if !defined $user; $dsn = '' if !defined $dsn; # $drh->errstr isn't safe here because $dbh->DESTROY may not have # been called yet and so the dbh errstr would not have been copied # up to the drh errstr. Certainly true for connect_cached! my $errstr = $DBI::errstr; # Getting '(no error string)' here is a symptom of a ref loop $errstr = '(no error string)' if !defined $errstr; my $msg = "$class connect('$dsn','$user',...) failed: $errstr"; DBI->trace_msg(" $msg\n"); # XXX HandleWarn unless ($attr->{HandleError} && $attr->{HandleError}->($msg, $drh, $dbh)) { Carp::croak($msg) if $attr->{RaiseError}; Carp::carp ($msg) if $attr->{PrintError}; } $! = 0; # for the daft people who do DBI->connect(...) || die "$!"; return $dbh; # normally undef, but HandleError could change it } # merge any attribute overrides but don't change $attr itself (for closure) my $apply = { ($override_attr) ? (%$attr, %$override_attr ) : %$attr }; # handle basic RootClass subclassing: my $rebless_class = $apply->{RootClass} || ($class ne 'DBI' ? $class : ''); if ($rebless_class) { no strict 'refs'; if ($apply->{RootClass}) { # explicit attribute (ie not static method call class) delete $apply->{RootClass}; DBI::_load_class($rebless_class, 0); } unless (@{"$rebless_class\::db::ISA"} && @{"$rebless_class\::st::ISA"}) { Carp::carp("DBI subclasses '$rebless_class\::db' and ::st are not setup, RootClass ignored"); $rebless_class = undef; $class = 'DBI'; } else { $dbh->{RootClass} = $rebless_class; # $dbh->STORE called via plain DBI::db DBI::_set_isa([$rebless_class], 'DBI'); # sets up both '::db' and '::st' DBI::_rebless($dbh, $rebless_class); # appends '::db' } } if (%$apply) { if ($apply->{DbTypeSubclass}) { my $DbTypeSubclass = delete $apply->{DbTypeSubclass}; DBI::_rebless_dbtype_subclass($dbh, $rebless_class||$class, $DbTypeSubclass); } my $a; foreach $a (qw(Profile RaiseError PrintError AutoCommit)) { # do these first next unless exists $apply->{$a}; $dbh->{$a} = delete $apply->{$a}; } while ( my ($a, $v) = each %$apply) { eval { $dbh->{$a} = $v }; # assign in void context to avoid re-FETCH warn $@ if $@; } } # confirm to driver (ie if subclassed) that we've connected successfully # and finished the attribute setup. pass in the original arguments $dbh->connected(@orig_args); #if ref $dbh ne 'DBI::db' or $proxy; DBI->trace_msg(" <- connect= $dbh\n") if $DBI::dbi_debug & 0xF; return $dbh; }; my $dbh = &$connect_closure(undef, undef); $dbh->{dbi_connect_closure} = $connect_closure if $dbh; return $dbh; } sub disconnect_all { keys %DBI::installed_drh; # reset iterator while ( my ($name, $drh) = each %DBI::installed_drh ) { $drh->disconnect_all() if ref $drh; } } sub disconnect { # a regular beginners bug Carp::croak("DBI->disconnect is not a DBI method (read the DBI manual)"); } sub install_driver { # croaks on failure my $class = shift; my($driver, $attr) = @_; my $drh; $driver ||= $ENV{DBI_DRIVER} || ''; # allow driver to be specified as a 'dbi:driver:' string $driver = $1 if $driver =~ s/^DBI:(.*?)://i; Carp::croak("usage: $class->install_driver(\$driver [, \%attr])") unless ($driver and @_<=3); # already installed return $drh if $drh = $DBI::installed_drh{$driver}; $class->trace_msg(" -> $class->install_driver($driver" .") for $^O perl=$] pid=$$ ruid=$< euid=$>\n") if $DBI::dbi_debug & 0xF; # --- load the code my $driver_class = "DBD::$driver"; eval qq{package # hide from PAUSE DBI::_firesafe; # just in case require $driver_class; # load the driver }; if ($@) { my $err = $@; my $advice = ""; if ($err =~ /Can't find loadable object/) { $advice = "Perhaps DBD::$driver was statically linked into a new perl binary." ."\nIn which case you need to use that new perl binary." ."\nOr perhaps only the .pm file was installed but not the shared object file." } elsif ($err =~ /Can't locate.*?DBD\/$driver\.pm in \@INC/) { my @drv = $class->available_drivers(1); $advice = "Perhaps the DBD::$driver perl module hasn't been fully installed,\n" ."or perhaps the capitalisation of '$driver' isn't right.\n" ."Available drivers: ".join(", ", @drv)."."; } elsif ($err =~ /Can't load .*? for module DBD::/) { $advice = "Perhaps a required shared library or dll isn't installed where expected"; } elsif ($err =~ /Can't locate .*? in \@INC/) { $advice = "Perhaps a module that DBD::$driver requires hasn't been fully installed"; } Carp::croak("install_driver($driver) failed: $err$advice\n"); } if ($DBI::dbi_debug & 0xF) { no strict 'refs'; (my $driver_file = $driver_class) =~ s/::/\//g; my $dbd_ver = ${"$driver_class\::VERSION"} || "undef"; $class->trace_msg(" install_driver: $driver_class version $dbd_ver" ." loaded from $INC{qq($driver_file.pm)}\n"); } # --- do some behind-the-scenes checks and setups on the driver $class->setup_driver($driver_class); # --- run the driver function $drh = eval { $driver_class->driver($attr || {}) }; unless ($drh && ref $drh && !$@) { my $advice = ""; $@ ||= "$driver_class->driver didn't return a handle"; # catch people on case in-sensitive systems using the wrong case $advice = "\nPerhaps the capitalisation of DBD '$driver' isn't right." if $@ =~ /locate object method/; Carp::croak("$driver_class initialisation failed: $@$advice"); } $DBI::installed_drh{$driver} = $drh; $class->trace_msg(" <- install_driver= $drh\n") if $DBI::dbi_debug & 0xF; $drh; } *driver = \&install_driver; # currently an alias, may change sub setup_driver { my ($class, $driver_class) = @_; my $h_type; foreach $h_type (qw(dr db st)){ my $h_class = $driver_class."::$h_type"; no strict 'refs'; push @{"${h_class}::ISA"}, "DBD::_::$h_type" unless UNIVERSAL::isa($h_class, "DBD::_::$h_type"); # The _mem class stuff is (IIRC) a crufty hack for global destruction # timing issues in early versions of perl5 and possibly no longer needed. my $mem_class = "DBD::_mem::$h_type"; push @{"${h_class}_mem::ISA"}, $mem_class unless UNIVERSAL::isa("${h_class}_mem", $mem_class) or $DBI::PurePerl; } } sub _rebless { my $dbh = shift; my ($outer, $inner) = DBI::_handles($dbh); my $class = shift(@_).'::db'; bless $inner => $class; bless $outer => $class; # outer last for return } sub _set_isa { my ($classes, $topclass) = @_; my $trace = DBI->trace_msg(" _set_isa([@$classes])\n"); foreach my $suffix ('::db','::st') { my $previous = $topclass || 'DBI'; # trees are rooted here foreach my $class (@$classes) { my $base_class = $previous.$suffix; my $sub_class = $class.$suffix; my $sub_class_isa = "${sub_class}::ISA"; no strict 'refs'; if (@$sub_class_isa) { DBI->trace_msg(" $sub_class_isa skipped (already set to @$sub_class_isa)\n") if $trace; } else { @$sub_class_isa = ($base_class) unless @$sub_class_isa; DBI->trace_msg(" $sub_class_isa = $base_class\n") if $trace; } $previous = $class; } } } sub _rebless_dbtype_subclass { my ($dbh, $rootclass, $DbTypeSubclass) = @_; # determine the db type names for class hierarchy my @hierarchy = DBI::_dbtype_names($dbh, $DbTypeSubclass); # add the rootclass prefix to each ('DBI::' or 'MyDBI::' etc) $_ = $rootclass.'::'.$_ foreach (@hierarchy); # load the modules from the 'top down' DBI::_load_class($_, 1) foreach (reverse @hierarchy); # setup class hierarchy if needed, does both '::db' and '::st' DBI::_set_isa(\@hierarchy, $rootclass); # finally bless the handle into the subclass DBI::_rebless($dbh, $hierarchy[0]); } sub _dbtype_names { # list dbtypes for hierarchy, ie Informix=>ADO=>ODBC my ($dbh, $DbTypeSubclass) = @_; if ($DbTypeSubclass && $DbTypeSubclass ne '1' && ref $DbTypeSubclass ne 'CODE') { # treat $DbTypeSubclass as a comma separated list of names my @dbtypes = split /\s*,\s*/, $DbTypeSubclass; $dbh->trace_msg(" DbTypeSubclass($DbTypeSubclass)=@dbtypes (explicit)\n"); return @dbtypes; } # XXX will call $dbh->get_info(17) (=SQL_DBMS_NAME) in future? my $driver = $dbh->{Driver}->{Name}; if ( $driver eq 'Proxy' ) { # XXX Looking into the internals of DBD::Proxy is questionable! ($driver) = $dbh->{proxy_client}->{application} =~ /^DBI:(.+?):/i or die "Can't determine driver name from proxy"; } my @dbtypes = (ucfirst($driver)); if ($driver eq 'ODBC' || $driver eq 'ADO') { # XXX will move these out and make extensible later: my $_dbtype_name_regexp = 'Oracle'; # eg 'Oracle|Foo|Bar' my %_dbtype_name_map = ( 'Microsoft SQL Server' => 'MSSQL', 'SQL Server' => 'Sybase', 'Adaptive Server Anywhere' => 'ASAny', 'ADABAS D' => 'AdabasD', ); my $name; $name = $dbh->func(17, 'GetInfo') # SQL_DBMS_NAME if $driver eq 'ODBC'; $name = $dbh->{ado_conn}->Properties->Item('DBMS Name')->Value if $driver eq 'ADO'; die "Can't determine driver name! ($DBI::errstr)\n" unless $name; my $dbtype; if ($_dbtype_name_map{$name}) { $dbtype = $_dbtype_name_map{$name}; } else { if ($name =~ /($_dbtype_name_regexp)/) { $dbtype = lc($1); } else { # generic mangling for other names: $dbtype = lc($name); } $dbtype =~ s/\b(\w)/\U$1/g; $dbtype =~ s/\W+/_/g; } # add ODBC 'behind' ADO push @dbtypes, 'ODBC' if $driver eq 'ADO'; # add discovered dbtype in front of ADO/ODBC unshift @dbtypes, $dbtype; } @dbtypes = &$DbTypeSubclass($dbh, \@dbtypes) if (ref $DbTypeSubclass eq 'CODE'); $dbh->trace_msg(" DbTypeSubclass($DbTypeSubclass)=@dbtypes\n"); return @dbtypes; } sub _load_class { my ($load_class, $missing_ok) = @_; DBI->trace_msg(" _load_class($load_class, $missing_ok)\n", 2); no strict 'refs'; return 1 if @{"$load_class\::ISA"}; # already loaded/exists (my $module = $load_class) =~ s!::!/!g; DBI->trace_msg(" _load_class require $module\n", 2); eval { require "$module.pm"; }; return 1 unless $@; return 0 if $missing_ok && $@ =~ /^Can't locate \Q$module.pm\E/; die $@; } sub init_rootclass { # deprecated return 1; } *internal = \&DBD::Switch::dr::driver; sub driver_prefix { my ($class, $driver) = @_; return $dbd_class_registry{$driver}->{prefix} if exists $dbd_class_registry{$driver}; return; } sub available_drivers { my($quiet) = @_; my(@drivers, $d, $f); local(*DBI::DIR, $@); my(%seen_dir, %seen_dbd); my $haveFileSpec = eval { require File::Spec }; foreach $d (@INC){ chomp($d); # Perl 5 beta 3 bug in #!./perl -Ilib from Test::Harness my $dbd_dir = ($haveFileSpec ? File::Spec->catdir($d, 'DBD') : "$d/DBD"); next unless -d $dbd_dir; next if $seen_dir{$d}; $seen_dir{$d} = 1; # XXX we have a problem here with case insensitive file systems # XXX since we can't tell what case must be used when loading. opendir(DBI::DIR, $dbd_dir) || Carp::carp "opendir $dbd_dir: $!\n"; foreach $f (readdir(DBI::DIR)){ next unless $f =~ s/\.pm$//; next if $f eq 'NullP'; if ($seen_dbd{$f}){ Carp::carp "DBD::$f in $d is hidden by DBD::$f in $seen_dbd{$f}\n" unless $quiet; } else { push(@drivers, $f); } $seen_dbd{$f} = $d; } closedir(DBI::DIR); } # "return sort @drivers" will not DWIM in scalar context. return wantarray ? sort @drivers : @drivers; } sub installed_versions { my ($class, $quiet) = @_; my %error; my %version; for my $driver ($class->available_drivers($quiet)) { next if $DBI::PurePerl && grep { -d "$_/auto/DBD/$driver" } @INC; my $drh = eval { local $SIG{__WARN__} = sub {}; $class->install_driver($driver); }; ($error{"DBD::$driver"}=$@),next if $@; no strict 'refs'; my $vers = ${"DBD::$driver" . '::VERSION'}; $version{"DBD::$driver"} = $vers || '?'; } if (wantarray) { return map { m/^DBD::(\w+)/ ? ($1) : () } sort keys %version; } $version{"DBI"} = $DBI::VERSION; $version{"DBI::PurePerl"} = $DBI::PurePerl::VERSION if $DBI::PurePerl; if (!defined wantarray) { # void context require Config; # add more detail $version{OS} = "$^O\t($Config::Config{osvers})"; $version{Perl} = "$]\t($Config::Config{archname})"; $version{$_} = (($error{$_} =~ s/ \(\@INC.*//s),$error{$_}) for keys %error; printf " %-16s: %s\n",$_,$version{$_} for reverse sort keys %version; } return \%version; } sub data_sources { my ($class, $driver, @other) = @_; my $drh = $class->install_driver($driver); my @ds = $drh->data_sources(@other); return @ds; } sub neat_list { my ($listref, $maxlen, $sep) = @_; $maxlen = 0 unless defined $maxlen; # 0 == use internal default $sep = ", " unless defined $sep; join($sep, map { neat($_,$maxlen) } @$listref); } sub dump_results { # also aliased as a method in DBD::_::st my ($sth, $maxlen, $lsep, $fsep, $fh) = @_; return 0 unless $sth; $maxlen ||= 35; $lsep ||= "\n"; $fh ||= \*STDOUT; my $rows = 0; my $ref; while($ref = $sth->fetch) { print $fh $lsep if $rows++ and $lsep; my $str = neat_list($ref,$maxlen,$fsep); print $fh $str; # done on two lines to avoid 5.003 errors } print $fh "\n$rows rows".($DBI::err ? " ($DBI::err: $DBI::errstr)" : "")."\n"; $rows; } sub data_diff { my ($a, $b, $logical) = @_; my $diff = data_string_diff($a, $b); return "" if $logical and !$diff; my $a_desc = data_string_desc($a); my $b_desc = data_string_desc($b); return "" if !$diff and $a_desc eq $b_desc; $diff ||= "Strings contain the same sequence of characters" if length($a); $diff .= "\n" if $diff; return "a: $a_desc\nb: $b_desc\n$diff"; } sub data_string_diff { # Compares 'logical' characters, not bytes, so a latin1 string and an # an equivalent Unicode string will compare as equal even though their # byte encodings are different. my ($a, $b) = @_; unless (defined $a and defined $b) { # one undef return "" if !defined $a and !defined $b; return "String a is undef, string b has ".length($b)." characters" if !defined $a; return "String b is undef, string a has ".length($a)." characters" if !defined $b; } my @a_chars = (utf8::is_utf8($a)) ? unpack("U*", $a) : unpack("C*", $a); my @b_chars = (utf8::is_utf8($b)) ? unpack("U*", $b) : unpack("C*", $b); my $i = 0; while (@a_chars && @b_chars) { ++$i, shift(@a_chars), shift(@b_chars), next if $a_chars[0] == $b_chars[0];# compare ordinal values my @desc = map { $_ > 255 ? # if wide character... sprintf("\\x{%04X}", $_) : # \x{...} chr($_) =~ /[[:cntrl:]]/ ? # else if control character ... sprintf("\\x%02X", $_) : # \x.. chr($_) # else as themselves } ($a_chars[0], $b_chars[0]); # highlight probable double-encoding? foreach my $c ( @desc ) { next unless $c =~ m/\\x\{08(..)}/; $c .= "='" .chr(hex($1)) ."'" } return sprintf "Strings differ at index $i: a[$i]=$desc[0], b[$i]=$desc[1]"; } return "String a truncated after $i characters" if @b_chars; return "String b truncated after $i characters" if @a_chars; return ""; } sub data_string_desc { # describe a data string my ($a) = @_; require bytes; # Give sufficient info to help diagnose at least these kinds of situations: # - valid UTF8 byte sequence but UTF8 flag not set # (might be ascii so also need to check for hibit to make it worthwhile) # - UTF8 flag set but invalid UTF8 byte sequence # could do better here, but this'll do for now my $utf8 = sprintf "UTF8 %s%s", utf8::is_utf8($a) ? "on" : "off", utf8::valid($a||'') ? "" : " but INVALID encoding"; return "$utf8, undef" unless defined $a; my $is_ascii = $a =~ m/^[\000-\177]*$/; return sprintf "%s, %s, %d characters %d bytes", $utf8, $is_ascii ? "ASCII" : "non-ASCII", length($a), bytes::length($a); } sub connect_test_perf { my($class, $dsn,$dbuser,$dbpass, $attr) = @_; Carp::croak("connect_test_perf needs hash ref as fourth arg") unless ref $attr; # these are non standard attributes just for this special method my $loops ||= $attr->{dbi_loops} || 5; my $par ||= $attr->{dbi_par} || 1; # parallelism my $verb ||= $attr->{dbi_verb} || 1; my $meth ||= $attr->{dbi_meth} || 'connect'; print "$dsn: testing $loops sets of $par connections:\n"; require "FileHandle.pm"; # don't let toke.c create empty FileHandle package local $| = 1; my $drh = $class->install_driver($dsn) or Carp::croak("Can't install $dsn driver\n"); # test the connection and warm up caches etc $drh->connect($dsn,$dbuser,$dbpass) or Carp::croak("connect failed: $DBI::errstr"); my $t1 = dbi_time(); my $loop; for $loop (1..$loops) { my @cons; print "Connecting... " if $verb; for (1..$par) { print "$_ "; push @cons, ($drh->connect($dsn,$dbuser,$dbpass) or Carp::croak("connect failed: $DBI::errstr\n")); } print "\nDisconnecting...\n" if $verb; for (@cons) { $_->disconnect or warn "disconnect failed: $DBI::errstr" } } my $t2 = dbi_time(); my $td = $t2 - $t1; printf "$meth %d and disconnect them, %d times: %.4fs / %d = %.4fs\n", $par, $loops, $td, $loops*$par, $td/($loops*$par); return $td; } # Help people doing DBI->errstr, might even document it one day # XXX probably best moved to cheaper XS code if this gets documented sub err { $DBI::err } sub errstr { $DBI::errstr } # --- Private Internal Function for Creating New DBI Handles # XXX move to PurePerl? *DBI::dr::TIEHASH = \&DBI::st::TIEHASH; *DBI::db::TIEHASH = \&DBI::st::TIEHASH; # These three special constructors are called by the drivers # The way they are called is likely to change. our $shared_profile; sub _new_drh { # called by DBD::::driver() my ($class, $initial_attr, $imp_data) = @_; # Provide default storage for State,Err and Errstr. # Note that these are shared by all child handles by default! XXX # State must be undef to get automatic faking in DBI::var::FETCH my ($h_state_store, $h_err_store, $h_errstr_store) = (undef, undef, ''); my $attr = { # these attributes get copied down to child handles by default 'State' => \$h_state_store, # Holder for DBI::state 'Err' => \$h_err_store, # Holder for DBI::err 'Errstr' => \$h_errstr_store, # Holder for DBI::errstr 'TraceLevel' => 0, FetchHashKeyName=> 'NAME', %$initial_attr, }; my ($h, $i) = _new_handle('DBI::dr', '', $attr, $imp_data, $class); # XXX DBI_PROFILE unless DBI::PurePerl because for some reason # it kills the t/zz_*_pp.t tests (they silently exit early) if (($ENV{DBI_PROFILE} && !$DBI::PurePerl) || $shared_profile) { # The profile object created here when the first driver is loaded # is shared by all drivers so we end up with just one set of profile # data and thus the 'total time in DBI' is really the true total. if (!$shared_profile) { # first time $h->{Profile} = $ENV{DBI_PROFILE}; # write string $shared_profile = $h->{Profile}; # read and record object } else { $h->{Profile} = $shared_profile; } } return $h unless wantarray; ($h, $i); } sub _new_dbh { # called by DBD::::dr::connect() my ($drh, $attr, $imp_data) = @_; my $imp_class = $drh->{ImplementorClass} or Carp::croak("DBI _new_dbh: $drh has no ImplementorClass"); substr($imp_class,-4,4) = '::db'; my $app_class = ref $drh; substr($app_class,-4,4) = '::db'; $attr->{Err} ||= \my $err; $attr->{Errstr} ||= \my $errstr; $attr->{State} ||= \my $state; _new_handle($app_class, $drh, $attr, $imp_data, $imp_class); } sub _new_sth { # called by DBD::::db::prepare) my ($dbh, $attr, $imp_data) = @_; my $imp_class = $dbh->{ImplementorClass} or Carp::croak("DBI _new_sth: $dbh has no ImplementorClass"); substr($imp_class,-4,4) = '::st'; my $app_class = ref $dbh; substr($app_class,-4,4) = '::st'; _new_handle($app_class, $dbh, $attr, $imp_data, $imp_class); } # end of DBI package # -------------------------------------------------------------------- # === The internal DBI Switch pseudo 'driver' class === { package # hide from PAUSE DBD::Switch::dr; DBI->setup_driver('DBD::Switch'); # sets up @ISA $DBD::Switch::dr::imp_data_size = 0; $DBD::Switch::dr::imp_data_size = 0; # avoid typo warning my $drh; sub driver { return $drh if $drh; # a package global my $inner; ($drh, $inner) = DBI::_new_drh('DBD::Switch::dr', { 'Name' => 'Switch', 'Version' => $DBI::VERSION, 'Attribution' => "DBI $DBI::VERSION by Tim Bunce", }); Carp::croak("DBD::Switch init failed!") unless ($drh && $inner); return $drh; } sub CLONE { undef $drh; } sub FETCH { my($drh, $key) = @_; return DBI->trace if $key eq 'DebugDispatch'; return undef if $key eq 'DebugLog'; # not worth fetching, sorry return $drh->DBD::_::dr::FETCH($key); undef; } sub STORE { my($drh, $key, $value) = @_; if ($key eq 'DebugDispatch') { DBI->trace($value); } elsif ($key eq 'DebugLog') { DBI->trace(-1, $value); } else { $drh->DBD::_::dr::STORE($key, $value); } } } # -------------------------------------------------------------------- # === OPTIONAL MINIMAL BASE CLASSES FOR DBI SUBCLASSES === # We only define default methods for harmless functions. # We don't, for example, define a DBD::_::st::prepare() { package # hide from PAUSE DBD::_::common; # ====== Common base class methods ====== use strict; # methods common to all handle types: # generic TIEHASH default methods: sub FIRSTKEY { } sub NEXTKEY { } sub EXISTS { defined($_[0]->FETCH($_[1])) } # XXX undef? sub CLEAR { Carp::carp "Can't CLEAR $_[0] (DBI)" } sub FETCH_many { # XXX should move to C one day my $h = shift; # scalar is needed to workaround drivers that return an empty list # for some attributes return map { scalar $h->FETCH($_) } @_; } *dump_handle = \&DBI::dump_handle; sub install_method { # special class method called directly by apps and/or drivers # to install new methods into the DBI dispatcher # DBD::Foo::db->install_method("foo_mumble", { usage => [...], options => '...' }); my ($class, $method, $attr) = @_; Carp::croak("Class '$class' must begin with DBD:: and end with ::db or ::st") unless $class =~ /^DBD::(\w+)::(dr|db|st)$/; my ($driver, $subtype) = ($1, $2); Carp::croak("invalid method name '$method'") unless $method =~ m/^([a-z][a-z0-9]*_)\w+$/; my $prefix = $1; my $reg_info = $dbd_prefix_registry->{$prefix}; Carp::carp("method name prefix '$prefix' is not associated with a registered driver") unless $reg_info; my $full_method = "DBI::${subtype}::$method"; $DBI::installed_methods{$full_method} = $attr; my (undef, $filename, $line) = caller; # XXX reformat $attr as needed for _install_method my %attr = %{$attr||{}}; # copy so we can edit DBI->_install_method("DBI::${subtype}::$method", "$filename at line $line", \%attr); } sub parse_trace_flags { my ($h, $spec) = @_; my $level = 0; my $flags = 0; my @unknown; for my $word (split /\s*[|&,]\s*/, $spec) { if (DBI::looks_like_number($word) && $word <= 0xF && $word >= 0) { $level = $word; } elsif ($word eq 'ALL') { $flags = 0x7FFFFFFF; # XXX last bit causes negative headaches last; } elsif (my $flag = $h->parse_trace_flag($word)) { $flags |= $flag; } else { push @unknown, $word; } } if (@unknown && (ref $h ? $h->FETCH('Warn') : 1)) { Carp::carp("$h->parse_trace_flags($spec) ignored unknown trace flags: ". join(" ", map { DBI::neat($_) } @unknown)); } $flags |= $level; return $flags; } sub parse_trace_flag { my ($h, $name) = @_; # 0xddDDDDrL (driver, DBI, reserved, Level) return 0x00000100 if $name eq 'SQL'; return 0x00000200 if $name eq 'CON'; return 0x00000400 if $name eq 'ENC'; return 0x00000800 if $name eq 'DBD'; return 0x00001000 if $name eq 'TXN'; return; } sub private_attribute_info { return undef; } sub visit_child_handles { my ($h, $code, $info) = @_; $info = {} if not defined $info; for my $ch (@{ $h->{ChildHandles} || []}) { next unless $ch; my $child_info = $code->($ch, $info) or next; $ch->visit_child_handles($code, $child_info); } return $info; } } { package # hide from PAUSE DBD::_::dr; # ====== DRIVER ====== our @ISA = qw(DBD::_::common); use strict; sub default_user { my ($drh, $user, $pass, $attr) = @_; $user = $ENV{DBI_USER} unless defined $user; $pass = $ENV{DBI_PASS} unless defined $pass; return ($user, $pass); } sub connect { # normally overridden, but a handy default my ($drh, $dsn, $user, $auth) = @_; my ($this) = DBI::_new_dbh($drh, { 'Name' => $dsn, }); # XXX debatable as there's no "server side" here # (and now many uses would trigger warnings on DESTROY) # $this->STORE(Active => 1); # so drivers should set it in their own connect $this; } sub connect_cached { my $drh = shift; my ($dsn, $user, $auth, $attr) = @_; my $cache = $drh->{CachedKids} ||= {}; my $key = do { no warnings; join "!\001", $dsn, $user, $auth, DBI::_concat_hash_sorted($attr, "=\001", ",\001", 0, 0) }; my $dbh = $cache->{$key}; $drh->trace_msg(sprintf(" connect_cached: key '%s', cached dbh %s\n", DBI::neat($key), DBI::neat($dbh))) if (($DBI::dbi_debug & 0xF) >= 4); my $cb = $attr->{Callbacks}; # take care not to autovivify if ($dbh && $dbh->FETCH('Active') && eval { $dbh->ping }) { # If the caller has provided a callback then call it if ($cb and $cb = $cb->{"connect_cached.reused"}) { local $_ = "connect_cached.reused"; $cb->($dbh, $dsn, $user, $auth, $attr); } return $dbh; } # If the caller has provided a callback then call it if ($cb and (my $new_cb = $cb->{"connect_cached.new"})) { local $_ = "connect_cached.new"; $new_cb->($dbh, $dsn, $user, $auth, $attr); # $dbh is dead or undef } $dbh = $drh->connect(@_); $cache->{$key} = $dbh; # replace prev entry, even if connect failed if ($cb and (my $conn_cb = $cb->{"connect_cached.connected"})) { local $_ = "connect_cached.connected"; $conn_cb->($dbh, $dsn, $user, $auth, $attr); } return $dbh; } } { package # hide from PAUSE DBD::_::db; # ====== DATABASE ====== our @ISA = qw(DBD::_::common); use strict; sub clone { my ($old_dbh, $attr) = @_; my $closure = $old_dbh->{dbi_connect_closure} or return $old_dbh->set_err($DBI::stderr, "Can't clone handle"); unless ($attr) { # XXX deprecated, caller should always pass a hash ref # copy attributes visible in the attribute cache keys %$old_dbh; # reset iterator while ( my ($k, $v) = each %$old_dbh ) { # ignore non-code refs, i.e., caches, handles, Err etc next if ref $v && ref $v ne 'CODE'; # HandleError etc $attr->{$k} = $v; } # explicitly set attributes which are unlikely to be in the # attribute cache, i.e., boolean's and some others $attr->{$_} = $old_dbh->FETCH($_) for (qw( AutoCommit ChopBlanks InactiveDestroy AutoInactiveDestroy LongTruncOk PrintError PrintWarn Profile RaiseError RaiseWarn ShowErrorStatement TaintIn TaintOut )); } # use Data::Dumper; warn Dumper([$old_dbh, $attr]); my $new_dbh = &$closure($old_dbh, $attr); unless ($new_dbh) { # need to copy err/errstr from driver back into $old_dbh my $drh = $old_dbh->{Driver}; return $old_dbh->set_err($drh->err, $drh->errstr, $drh->state); } $new_dbh->{dbi_connect_closure} = $closure; return $new_dbh; } sub quote_identifier { my ($dbh, @id) = @_; my $attr = (@id > 3 && ref($id[-1])) ? pop @id : undef; my $info = $dbh->{dbi_quote_identifier_cache} ||= [ $dbh->get_info(29) || '"', # SQL_IDENTIFIER_QUOTE_CHAR $dbh->get_info(41) || '.', # SQL_CATALOG_NAME_SEPARATOR $dbh->get_info(114) || 1, # SQL_CATALOG_LOCATION ]; my $quote = $info->[0]; foreach (@id) { # quote the elements next unless defined; s/$quote/$quote$quote/g; # escape embedded quotes $_ = qq{$quote$_$quote}; } # strip out catalog if present for special handling my $catalog = (@id >= 3) ? shift @id : undef; # join the dots, ignoring any null/undef elements (ie schema) my $quoted_id = join '.', grep { defined } @id; if ($catalog) { # add catalog correctly if ($quoted_id) { $quoted_id = ($info->[2] == 2) # SQL_CL_END ? $quoted_id . $info->[1] . $catalog : $catalog . $info->[1] . $quoted_id; } else { $quoted_id = $catalog; } } return $quoted_id; } sub quote { my ($dbh, $str, $data_type) = @_; return "NULL" unless defined $str; unless ($data_type) { $str =~ s/'/''/g; # ISO SQL2 return "'$str'"; } my $dbi_literal_quote_cache = $dbh->{'dbi_literal_quote_cache'} ||= [ {} , {} ]; my ($prefixes, $suffixes) = @$dbi_literal_quote_cache; my $lp = $prefixes->{$data_type}; my $ls = $suffixes->{$data_type}; if ( ! defined $lp || ! defined $ls ) { my $ti = $dbh->type_info($data_type); $lp = $prefixes->{$data_type} = $ti ? $ti->{LITERAL_PREFIX} || "" : "'"; $ls = $suffixes->{$data_type} = $ti ? $ti->{LITERAL_SUFFIX} || "" : "'"; } return $str unless $lp || $ls; # no quoting required # XXX don't know what the standard says about escaping # in the 'general case' (where $lp != "'"). # So we just do this and hope: $str =~ s/$lp/$lp$lp/g if $lp && $lp eq $ls && ($lp eq "'" || $lp eq '"'); return "$lp$str$ls"; } sub rows { -1 } # here so $DBI::rows 'works' after using $dbh sub do { my($dbh, $statement, $attr, @params) = @_; my $sth = $dbh->prepare($statement, $attr) or return undef; $sth->execute(@params) or return undef; my $rows = $sth->rows; ($rows == 0) ? "0E0" : $rows; } sub _do_selectrow { my ($method, $dbh, $stmt, $attr, @bind) = @_; my $sth = ((ref $stmt) ? $stmt : $dbh->prepare($stmt, $attr)) or return undef; $sth->execute(@bind) or return undef; my $row = $sth->$method() and $sth->finish; return $row; } sub selectrow_hashref { return _do_selectrow('fetchrow_hashref', @_); } # XXX selectrow_array/ref also have C implementations in Driver.xst sub selectrow_arrayref { return _do_selectrow('fetchrow_arrayref', @_); } sub selectrow_array { my $row = _do_selectrow('fetchrow_arrayref', @_) or return; return $row->[0] unless wantarray; return @$row; } sub selectall_array { return @{ shift->selectall_arrayref(@_) || [] }; } # XXX selectall_arrayref also has C implementation in Driver.xst # which fallsback to this if a slice is given sub selectall_arrayref { my ($dbh, $stmt, $attr, @bind) = @_; my $sth = (ref $stmt) ? $stmt : $dbh->prepare($stmt, $attr) or return; $sth->execute(@bind) || return; my $slice = $attr->{Slice}; # typically undef, else hash or array ref if (!$slice and $slice=$attr->{Columns}) { if (ref $slice eq 'ARRAY') { # map col idx to perl array idx $slice = [ @{$attr->{Columns}} ]; # take a copy for (@$slice) { $_-- } } } my $rows = $sth->fetchall_arrayref($slice, my $MaxRows = $attr->{MaxRows}); $sth->finish if defined $MaxRows; return $rows; } sub selectall_hashref { my ($dbh, $stmt, $key_field, $attr, @bind) = @_; my $sth = (ref $stmt) ? $stmt : $dbh->prepare($stmt, $attr); return unless $sth; $sth->execute(@bind) || return; return $sth->fetchall_hashref($key_field); } sub selectcol_arrayref { my ($dbh, $stmt, $attr, @bind) = @_; my $sth = (ref $stmt) ? $stmt : $dbh->prepare($stmt, $attr); return unless $sth; $sth->execute(@bind) || return; my @columns = ($attr->{Columns}) ? @{$attr->{Columns}} : (1); my @values = (undef) x @columns; my $idx = 0; for (@columns) { $sth->bind_col($_, \$values[$idx++]) || return; } my @col; if (my $max = $attr->{MaxRows}) { push @col, @values while 0 < $max-- && $sth->fetch; } else { push @col, @values while $sth->fetch; } return \@col; } sub prepare_cached { my ($dbh, $statement, $attr, $if_active) = @_; # Needs support at dbh level to clear cache before complaining about # active children. The XS template code does this. Drivers not using # the template must handle clearing the cache themselves. my $cache = $dbh->{CachedKids} ||= {}; my $key = do { no warnings; join "!\001", $statement, DBI::_concat_hash_sorted($attr, "=\001", ",\001", 0, 0) }; my $sth = $cache->{$key}; if ($sth) { return $sth unless $sth->FETCH('Active'); Carp::carp("prepare_cached($statement) statement handle $sth still Active") unless ($if_active ||= 0); $sth->finish if $if_active <= 1; return $sth if $if_active <= 2; } $sth = $dbh->prepare($statement, $attr); $cache->{$key} = $sth if $sth; return $sth; } sub ping { my $dbh = shift; # "0 but true" is a special kind of true 0 that is used here so # applications can check if the ping was a real ping or not ($dbh->FETCH('Active')) ? "0 but true" : 0; } sub begin_work { my $dbh = shift; return $dbh->set_err($DBI::stderr, "Already in a transaction") unless $dbh->FETCH('AutoCommit'); $dbh->STORE('AutoCommit', 0); # will croak if driver doesn't support it $dbh->STORE('BegunWork', 1); # trigger post commit/rollback action return 1; } sub primary_key { my ($dbh, @args) = @_; my $sth = $dbh->primary_key_info(@args) or return; my ($row, @col); push @col, $row->[3] while ($row = $sth->fetch); Carp::croak("primary_key method not called in list context") unless wantarray; # leave us some elbow room return @col; } sub tables { my ($dbh, @args) = @_; my $sth = $dbh->table_info(@args[0,1,2,3,4]) or return; my $tables = $sth->fetchall_arrayref or return; my @tables; if (defined($args[3]) && $args[3] eq '%' # special case for tables('','','','%') && grep {defined($_) && $_ eq ''} @args[0,1,2] ) { @tables = map { $_->[3] } @$tables; } elsif ($dbh->get_info(29)) { # SQL_IDENTIFIER_QUOTE_CHAR @tables = map { $dbh->quote_identifier( @{$_}[0,1,2] ) } @$tables; } else { # temporary old style hack (yeach) @tables = map { my $name = $_->[2]; if ($_->[1]) { my $schema = $_->[1]; # a sad hack (mostly for Informix I recall) my $quote = ($schema eq uc($schema)) ? '' : '"'; $name = "$quote$schema$quote.$name" } $name; } @$tables; } return @tables; } sub type_info { # this should be sufficient for all drivers my ($dbh, $data_type) = @_; my $idx_hash; my $tia = $dbh->{dbi_type_info_row_cache}; if ($tia) { $idx_hash = $dbh->{dbi_type_info_idx_cache}; } else { my $temp = $dbh->type_info_all; return unless $temp && @$temp; # we cache here because type_info_all may be expensive to call # (and we take a copy so the following shift can't corrupt # the data that may be returned by future calls to type_info_all) $tia = $dbh->{dbi_type_info_row_cache} = [ @$temp ]; $idx_hash = $dbh->{dbi_type_info_idx_cache} = shift @$tia; } my $dt_idx = $idx_hash->{DATA_TYPE} || $idx_hash->{data_type}; Carp::croak("type_info_all returned non-standard DATA_TYPE index value ($dt_idx != 1)") if $dt_idx && $dt_idx != 1; # --- simple DATA_TYPE match filter my @ti; my @data_type_list = (ref $data_type) ? @$data_type : ($data_type); foreach $data_type (@data_type_list) { if (defined($data_type) && $data_type != DBI::SQL_ALL_TYPES()) { push @ti, grep { $_->[$dt_idx] == $data_type } @$tia; } else { # SQL_ALL_TYPES push @ti, @$tia; } last if @ti; # found at least one match } # --- format results into list of hash refs my $idx_fields = keys %$idx_hash; my @idx_names = map { uc($_) } keys %$idx_hash; my @idx_values = values %$idx_hash; Carp::croak "type_info_all result has $idx_fields keys but ".(@{$ti[0]})." fields" if @ti && @{$ti[0]} != $idx_fields; my @out = map { my %h; @h{@idx_names} = @{$_}[ @idx_values ]; \%h; } @ti; return $out[0] unless wantarray; return @out; } sub data_sources { my ($dbh, @other) = @_; my $drh = $dbh->{Driver}; # XXX proxy issues? return $drh->data_sources(@other); } } { package # hide from PAUSE DBD::_::st; # ====== STATEMENT ====== our @ISA = qw(DBD::_::common); use strict; sub bind_param { Carp::croak("Can't bind_param, not implement by driver") } # # ******************************************************** # # BEGIN ARRAY BINDING # # Array binding support for drivers which don't support # array binding, but have sufficient interfaces to fake it. # NOTE: mixing scalars and arrayrefs requires using bind_param_array # for *all* params...unless we modify bind_param for the default # case... # # 2002-Apr-10 D. Arnold sub bind_param_array { my $sth = shift; my ($p_id, $value_array, $attr) = @_; return $sth->set_err($DBI::stderr, "Value for parameter $p_id must be a scalar or an arrayref, not a ".ref($value_array)) if defined $value_array and ref $value_array and ref $value_array ne 'ARRAY'; return $sth->set_err($DBI::stderr, "Can't use named placeholder '$p_id' for non-driver supported bind_param_array") unless DBI::looks_like_number($p_id); # because we rely on execute(@ary) here return $sth->set_err($DBI::stderr, "Placeholder '$p_id' is out of range") if $p_id <= 0; # can't easily/reliably test for too big # get/create arrayref to hold params my $hash_of_arrays = $sth->{ParamArrays} ||= { }; # If the bind has attribs then we rely on the driver conforming to # the DBI spec in that a single bind_param() call with those attribs # makes them 'sticky' and apply to all later execute(@values) calls. # Since we only call bind_param() if we're given attribs then # applications using drivers that don't support bind_param can still # use bind_param_array() so long as they don't pass any attribs. $$hash_of_arrays{$p_id} = $value_array; return $sth->bind_param($p_id, undef, $attr) if $attr; 1; } sub bind_param_inout_array { my $sth = shift; # XXX not supported so we just call bind_param_array instead # and then return an error my ($p_num, $value_array, $attr) = @_; $sth->bind_param_array($p_num, $value_array, $attr); return $sth->set_err($DBI::stderr, "bind_param_inout_array not supported"); } sub bind_columns { my $sth = shift; my $fields = $sth->FETCH('NUM_OF_FIELDS') || 0; if ($fields <= 0 && !$sth->{Active}) { return $sth->set_err($DBI::stderr, "Statement has no result columns to bind" ." (perhaps you need to successfully call execute first, or again)"); } # Backwards compatibility for old-style call with attribute hash # ref as first arg. Skip arg if undef or a hash ref. my $attr; $attr = shift if !defined $_[0] or ref($_[0]) eq 'HASH'; my $idx = 0; $sth->bind_col(++$idx, shift, $attr) or return while (@_ and $idx < $fields); return $sth->set_err($DBI::stderr, "bind_columns called with ".($idx+@_)." values but $fields are needed") if @_ or $idx != $fields; return 1; } sub execute_array { my $sth = shift; my ($attr, @array_of_arrays) = @_; my $NUM_OF_PARAMS = $sth->FETCH('NUM_OF_PARAMS'); # may be undef at this point # get tuple status array or hash attribute my $tuple_sts = $attr->{ArrayTupleStatus}; return $sth->set_err($DBI::stderr, "ArrayTupleStatus attribute must be an arrayref") if $tuple_sts and ref $tuple_sts ne 'ARRAY'; # bind all supplied arrays if (@array_of_arrays) { $sth->{ParamArrays} = { }; # clear out old params return $sth->set_err($DBI::stderr, @array_of_arrays." bind values supplied but $NUM_OF_PARAMS expected") if defined ($NUM_OF_PARAMS) && @array_of_arrays != $NUM_OF_PARAMS; $sth->bind_param_array($_, $array_of_arrays[$_-1]) or return foreach (1..@array_of_arrays); } my $fetch_tuple_sub; if ($fetch_tuple_sub = $attr->{ArrayTupleFetch}) { # fetch on demand return $sth->set_err($DBI::stderr, "Can't use both ArrayTupleFetch and explicit bind values") if @array_of_arrays; # previous bind_param_array calls will simply be ignored if (UNIVERSAL::isa($fetch_tuple_sub,'DBI::st')) { my $fetch_sth = $fetch_tuple_sub; return $sth->set_err($DBI::stderr, "ArrayTupleFetch sth is not Active, need to execute() it first") unless $fetch_sth->{Active}; # check column count match to give more friendly message my $NUM_OF_FIELDS = $fetch_sth->{NUM_OF_FIELDS}; return $sth->set_err($DBI::stderr, "$NUM_OF_FIELDS columns from ArrayTupleFetch sth but $NUM_OF_PARAMS expected") if defined($NUM_OF_FIELDS) && defined($NUM_OF_PARAMS) && $NUM_OF_FIELDS != $NUM_OF_PARAMS; $fetch_tuple_sub = sub { $fetch_sth->fetchrow_arrayref }; } elsif (!UNIVERSAL::isa($fetch_tuple_sub,'CODE')) { return $sth->set_err($DBI::stderr, "ArrayTupleFetch '$fetch_tuple_sub' is not a code ref or statement handle"); } } else { my $NUM_OF_PARAMS_given = keys %{ $sth->{ParamArrays} || {} }; return $sth->set_err($DBI::stderr, "$NUM_OF_PARAMS_given bind values supplied but $NUM_OF_PARAMS expected") if defined($NUM_OF_PARAMS) && $NUM_OF_PARAMS != $NUM_OF_PARAMS_given; # get the length of a bound array my $maxlen; my %hash_of_arrays = %{$sth->{ParamArrays}}; foreach (keys(%hash_of_arrays)) { my $ary = $hash_of_arrays{$_}; next unless ref $ary eq 'ARRAY'; $maxlen = @$ary if !$maxlen || @$ary > $maxlen; } # if there are no arrays then execute scalars once $maxlen = 1 unless defined $maxlen; my @bind_ids = 1..keys(%hash_of_arrays); my $tuple_idx = 0; $fetch_tuple_sub = sub { return if $tuple_idx >= $maxlen; my @tuple = map { my $a = $hash_of_arrays{$_}; ref($a) ? $a->[$tuple_idx] : $a } @bind_ids; ++$tuple_idx; return \@tuple; }; } # pass thru the callers scalar or list context return $sth->execute_for_fetch($fetch_tuple_sub, $tuple_sts); } sub execute_for_fetch { my ($sth, $fetch_tuple_sub, $tuple_status) = @_; # start with empty status array ($tuple_status) ? @$tuple_status = () : $tuple_status = []; my $rc_total = 0; my $err_count; while ( my $tuple = &$fetch_tuple_sub() ) { if ( my $rc = $sth->execute(@$tuple) ) { push @$tuple_status, $rc; $rc_total = ($rc >= 0 && $rc_total >= 0) ? $rc_total + $rc : -1; } else { $err_count++; push @$tuple_status, [ $sth->err, $sth->errstr, $sth->state ]; # XXX drivers implementing execute_for_fetch could opt to "last;" here # if they know the error code means no further executes will work. } } my $tuples = @$tuple_status; return $sth->set_err($DBI::stderr, "executing $tuples generated $err_count errors") if $err_count; $tuples ||= "0E0"; return $tuples unless wantarray; return ($tuples, $rc_total); } sub last_insert_id { return shift->{Database}->last_insert_id(@_); } sub fetchall_arrayref { # ALSO IN Driver.xst my ($sth, $slice, $max_rows) = @_; # when batch fetching with $max_rows were very likely to try to # fetch the 'next batch' after the previous batch returned # <=$max_rows. So don't treat that as an error. return undef if $max_rows and not $sth->FETCH('Active'); my $mode = ref($slice) || 'ARRAY'; my @rows; if ($mode eq 'ARRAY') { my $row; # we copy the array here because fetch (currently) always # returns the same array ref. XXX if ($slice && @$slice) { $max_rows = -1 unless defined $max_rows; push @rows, [ @{$row}[ @$slice] ] while($max_rows-- and $row = $sth->fetch); } elsif (defined $max_rows) { push @rows, [ @$row ] while($max_rows-- and $row = $sth->fetch); } else { push @rows, [ @$row ] while($row = $sth->fetch); } return \@rows } my %row; if ($mode eq 'REF' && ref($$slice) eq 'HASH') { # \{ $idx => $name } keys %$$slice; # reset the iterator while ( my ($idx, $name) = each %$$slice ) { $sth->bind_col($idx+1, \$row{$name}); } } elsif ($mode eq 'HASH') { if (keys %$slice) { # resets the iterator my $name2idx = $sth->FETCH('NAME_lc_hash'); while ( my ($name, $unused) = each %$slice ) { my $idx = $name2idx->{lc $name}; return $sth->set_err($DBI::stderr, "Invalid column name '$name' for slice") if not defined $idx; $sth->bind_col($idx+1, \$row{$name}); } } else { my @column_names = @{ $sth->FETCH($sth->FETCH('FetchHashKeyName')) || [] }; return [] if !@column_names; $sth->bind_columns( \( @row{@column_names} ) ); } } else { return $sth->set_err($DBI::stderr, "fetchall_arrayref($mode) invalid"); } if (not defined $max_rows) { push @rows, { %row } while ($sth->fetch); # full speed ahead! } else { push @rows, { %row } while ($max_rows-- and $sth->fetch); } return \@rows; } sub fetchall_hashref { my ($sth, $key_field) = @_; my $hash_key_name = $sth->{FetchHashKeyName} || 'NAME'; my $names_hash = $sth->FETCH("${hash_key_name}_hash"); my @key_fields = (ref $key_field) ? @$key_field : ($key_field); my @key_indexes; my $num_of_fields = $sth->FETCH('NUM_OF_FIELDS'); foreach (@key_fields) { my $index = $names_hash->{$_}; # perl index not column $index = $_ - 1 if !defined $index && DBI::looks_like_number($_) && $_>=1 && $_ <= $num_of_fields; return $sth->set_err($DBI::stderr, "Field '$_' does not exist (not one of @{[keys %$names_hash]})") unless defined $index; push @key_indexes, $index; } my $rows = {}; my $NAME = $sth->FETCH($hash_key_name); my @row = (undef) x $num_of_fields; $sth->bind_columns(\(@row)); while ($sth->fetch) { my $ref = $rows; $ref = $ref->{$row[$_]} ||= {} for @key_indexes; @{$ref}{@$NAME} = @row; } return $rows; } *dump_results = \&DBI::dump_results; sub blob_copy_to_file { # returns length or undef on error my($self, $field, $filename_or_handleref, $blocksize) = @_; my $fh = $filename_or_handleref; my($len, $buf) = (0, ""); $blocksize ||= 512; # not too ambitious local(*FH); unless(ref $fh) { open(FH, ">$fh") || return undef; $fh = \*FH; } while(defined($self->blob_read($field, $len, $blocksize, \$buf))) { print $fh $buf; $len += length $buf; } close(FH); $len; } sub more_results { shift->{syb_more_results}; # handy grandfathering } } unless ($DBI::PurePerl) { # See install_driver { @DBD::_mem::dr::ISA = qw(DBD::_mem::common); } { @DBD::_mem::db::ISA = qw(DBD::_mem::common); } { @DBD::_mem::st::ISA = qw(DBD::_mem::common); } # DBD::_mem::common::DESTROY is implemented in DBI.xs } 1; __END__ =head1 DESCRIPTION The DBI is a database access module for the Perl programming language. It defines a set of methods, variables, and conventions that provide a consistent database interface, independent of the actual database being used. It is important to remember that the DBI is just an interface. The DBI is a layer of "glue" between an application and one or more database I modules. It is the driver modules which do most of the real work. The DBI provides a standard interface and framework for the drivers to operate within. This document often uses terms like I, I, I. If you're not familiar with those terms then it would be a good idea to read at least the following perl manuals first: L, L, L, and L. =head2 Architecture of a DBI Application |<- Scope of DBI ->| .-. .--------------. .-------------. .-------. | |---| XYZ Driver |---| XYZ Engine | | Perl | | | `--------------' `-------------' | script| |A| |D| .--------------. .-------------. | using |--|P|--|B|---|Oracle Driver |---|Oracle Engine| | DBI | |I| |I| `--------------' `-------------' | API | | |... |methods| | |... Other drivers `-------' | |... `-' The API, or Application Programming Interface, defines the call interface and variables for Perl scripts to use. The API is implemented by the Perl DBI extension. The DBI "dispatches" the method calls to the appropriate driver for actual execution. The DBI is also responsible for the dynamic loading of drivers, error checking and handling, providing default implementations for methods, and many other non-database specific duties. Each driver contains implementations of the DBI methods using the private interface functions of the corresponding database engine. Only authors of sophisticated/multi-database applications or generic library functions need be concerned with drivers. =head2 Notation and Conventions The following conventions are used in this document: $dbh Database handle object $sth Statement handle object $drh Driver handle object (rarely seen or used in applications) $h Any of the handle types above ($dbh, $sth, or $drh) $rc General Return Code (boolean: true=ok, false=error) $rv General Return Value (typically an integer) @ary List of values returned from the database, typically a row of data $rows Number of rows processed (if available, else -1) $fh A filehandle undef NULL values are represented by undefined values in Perl \%attr Reference to a hash of attribute values passed to methods Note that Perl will automatically destroy database and statement handle objects if all references to them are deleted. =head2 Outline Usage To use DBI, first you need to load the DBI module: use DBI; use strict; (The C isn't required but is strongly recommended.) Then you need to L to your data source and get a I for that connection: $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1, AutoCommit => 0 }); Since connecting can be expensive, you generally just connect at the start of your program and disconnect at the end. Explicitly defining the required C behaviour is strongly recommended and may become mandatory in a later version. This determines whether changes are automatically committed to the database when executed, or need to be explicitly committed later. The DBI allows an application to "prepare" statements for later execution. A prepared statement is identified by a statement handle held in a Perl variable. We'll call the Perl variable C<$sth> in our examples. The typical method call sequence for a C statement is: prepare, execute, execute, execute. for example: $sth = $dbh->prepare("INSERT INTO table(foo,bar,baz) VALUES (?,?,?)"); while() { chomp; my ($foo,$bar,$baz) = split /,/; $sth->execute( $foo, $bar, $baz ); } The C method is a wrapper of prepare and execute that can be simpler for non repeated I-C statement. =head1 THE DBI PACKAGE AND CLASS In this section, we cover the DBI class methods, utility functions, and the dynamic attributes associated with generic DBI handles. =head2 DBI Constants Constants representing the values of the SQL standard types can be imported individually by name, or all together by importing the special C<:sql_types> tag. The names and values of all the defined SQL standard types can be produced like this: foreach (@{ $DBI::EXPORT_TAGS{sql_types} }) { printf "%s=%d\n", $_, &{"DBI::$_"}; } These constants are defined by SQL/CLI, ODBC or both. C has conflicting codes in SQL/CLI and ODBC, DBI uses the ODBC one. See the L, L, and L methods for possible uses. Note that just because the DBI defines a named constant for a given data type doesn't mean that drivers will support that data type. =head2 DBI Class Methods The following methods are provided by the DBI class: =head3 C ($scheme, $driver, $attr_string, $attr_hash, $driver_dsn) = DBI->parse_dsn($dsn) or die "Can't parse DBI DSN '$dsn'"; Breaks apart a DBI Data Source Name (DSN) and returns the individual parts. If $dsn doesn't contain a valid DSN then parse_dsn() returns an empty list. $scheme is the first part of the DSN and is currently always 'dbi'. $driver is the driver name, possibly defaulted to $ENV{DBI_DRIVER}, and may be undefined. $attr_string is the contents of the optional attribute string, which may be undefined. If $attr_string is not empty then $attr_hash is a reference to a hash containing the parsed attribute names and values. $driver_dsn is the last part of the DBI DSN string. For example: ($scheme, $driver, $attr_string, $attr_hash, $driver_dsn) = DBI->parse_dsn("dbi:MyDriver(RaiseError=>1):db=test;port=42"); $scheme = 'dbi'; $driver = 'MyDriver'; $attr_string = 'RaiseError=>1'; $attr_hash = { 'RaiseError' => '1' }; $driver_dsn = 'db=test;port=42'; The parse_dsn() method was added in DBI 1.43. =head3 C $dbh = DBI->connect($data_source, $username, $password) or die $DBI::errstr; $dbh = DBI->connect($data_source, $username, $password, \%attr) or die $DBI::errstr; Establishes a database connection, or session, to the requested C<$data_source>. Returns a database handle object if the connection succeeds. Use C<$dbh-Edisconnect> to terminate the connection. If the connect fails (see below), it returns C and sets both C<$DBI::err> and C<$DBI::errstr>. (It does I explicitly set C<$!>.) You should generally test the return status of C and C if it has failed. Multiple simultaneous connections to multiple databases through multiple drivers can be made via the DBI. Simply make one C call for each database and keep a copy of each returned database handle. The C<$data_source> value must begin with "CIC<:>". The I specifies the driver that will be used to make the connection. (Letter case is significant.) As a convenience, if the C<$data_source> parameter is undefined or empty, the DBI will substitute the value of the environment variable C. If just the I part is empty (i.e., the C<$data_source> prefix is "C"), the environment variable C is used. If neither variable is set, then C dies. Examples of C<$data_source> values are: dbi:DriverName:database_name dbi:DriverName:database_name@hostname:port dbi:DriverName:database=database_name;host=hostname;port=port There is I for the text following the driver name. Each driver is free to use whatever syntax it wants. The only requirement the DBI makes is that all the information is supplied in a single string. You must consult the documentation for the drivers you are using for a description of the syntax they require. It is recommended that drivers support the ODBC style, shown in the last example above. It is also recommended that they support the three common names 'C', 'C', and 'C' (plus 'C' as an alias for C). This simplifies automatic construction of basic DSNs: C<"dbi:$driver:database=$db;host=$host;port=$port">. Drivers should aim to 'do something reasonable' when given a DSN in this form, but if any part is meaningless for that driver (such as 'port' for Informix) it should generate an error if that part is not empty. If the environment variable C is defined (and the driver in C<$data_source> is not "C") then the connect request will automatically be changed to: $ENV{DBI_AUTOPROXY};dsn=$data_source C is typically set as "C". If $ENV{DBI_AUTOPROXY} doesn't begin with 'C' then "dbi:Proxy:" will be prepended to it first. See the DBD::Proxy documentation for more details. If C<$username> or C<$password> are undefined (rather than just empty), then the DBI will substitute the values of the C and C environment variables, respectively. The DBI will warn if the environment variables are not defined. However, the everyday use of these environment variables is not recommended for security reasons. The mechanism is primarily intended to simplify testing. See below for alternative way to specify the username and password. Cconnect> automatically installs the driver if it has not been installed yet. Driver installation either returns a valid driver handle, or it I with an error message that includes the string "C" and the underlying problem. So Cconnect> will die on a driver installation failure and will only return C on a connect failure, in which case C<$DBI::errstr> will hold the error message. Use C if you need to catch the "C" error. The C<$data_source> argument (with the "C" prefix removed) and the C<$username> and C<$password> arguments are then passed to the driver for processing. The DBI does not define any interpretation for the contents of these fields. The driver is free to interpret the C<$data_source>, C<$username>, and C<$password> fields in any way, and supply whatever defaults are appropriate for the engine being accessed. (Oracle, for example, uses the ORACLE_SID and TWO_TASK environment variables if no C<$data_source> is specified.) The C and C attributes for each connection default to "on". (See L and L for more information.) However, it is strongly recommended that you explicitly define C rather than rely on the default. The C attribute defaults to true. The C attribute defaults to false. The C<\%attr> parameter can be used to alter the default settings of C, C, C, and other attributes. For example: $dbh = DBI->connect($data_source, $user, $pass, { PrintError => 0, AutoCommit => 0 }); The username and password can also be specified using the attributes C and C, in which case they take precedence over the C<$username> and C<$password> parameters. You can also define connection attribute values within the C<$data_source> parameter. For example: dbi:DriverName(PrintWarn=>0,PrintError=>0,Taint=>1):... Individual attributes values specified in this way take precedence over any conflicting values specified via the C<\%attr> parameter to C. The C attribute can be used to specify which driver method should be called to establish the connection. The only useful values are 'connect', 'connect_cached', or some specialized case like 'Apache::DBI::connect' (which is automatically the default when running within Apache). Where possible, each session (C<$dbh>) is independent from the transactions in other sessions. This is useful when you need to hold cursors open across transactions--for example, if you use one session for your long lifespan cursors (typically read-only) and another for your short update transactions. For compatibility with old DBI scripts, the driver can be specified by passing its name as the fourth argument to C (instead of C<\%attr>): $dbh = DBI->connect($data_source, $user, $pass, $driver); In this "old-style" form of C, the C<$data_source> should not start with "C". (If it does, the embedded driver_name will be ignored). Also note that in this older form of C, the C<$dbh-E{AutoCommit}> attribute is I, the C<$dbh-E{PrintError}> attribute is off, and the old C environment variable is checked if C is not defined. Beware that this "old-style" C will soon be withdrawn in a future version of DBI. =head3 C $dbh = DBI->connect_cached($data_source, $username, $password) or die $DBI::errstr; $dbh = DBI->connect_cached($data_source, $username, $password, \%attr) or die $DBI::errstr; C is like L, except that the database handle returned is also stored in a hash associated with the given parameters. If another call is made to C with the same parameter values, then the corresponding cached C<$dbh> will be returned if it is still valid. The cached database handle is replaced with a new connection if it has been disconnected or if the C method fails. Note that the behaviour of this method differs in several respects from the behaviour of persistent connections implemented by Apache::DBI. However, if Apache::DBI is loaded then C will use it. Caching connections can be useful in some applications, but it can also cause problems, such as too many connections, and so should be used with care. In particular, avoid changing the attributes of a database handle created via connect_cached() because it will affect other code that may be using the same handle. When connect_cached() returns a handle the attributes will be reset to their initial values. This can cause problems, especially with the C attribute. Also, to ensure that the attributes passed are always the same, avoid passing references inline. For example, the C attribute is specified as a hash reference. Be sure to declare it external to the call to connect_cached(), such that the hash reference is not re-created on every call. A package-level lexical works well: package MyDBH; my $cb = { 'connect_cached.reused' => sub { delete $_[4]->{AutoCommit} }, }; sub dbh { DBI->connect_cached( $dsn, $username, $auth, { Callbacks => $cb }); } Where multiple separate parts of a program are using connect_cached() to connect to the same database with the same (initial) attributes it is a good idea to add a private attribute to the connect_cached() call to effectively limit the scope of the caching. For example: DBI->connect_cached(..., { private_foo_cachekey => "Bar", ... }); Handles returned from that connect_cached() call will only be returned by other connect_cached() call elsewhere in the code if those other calls also pass in the same attribute values, including the private one. (I've used C here as an example, you can use any attribute name with a C prefix.) Taking that one step further, you can limit a particular connect_cached() call to return handles unique to that one place in the code by setting the private attribute to a unique value for that place: DBI->connect_cached(..., { private_foo_cachekey => __FILE__.__LINE__, ... }); By using a private attribute you still get connection caching for the individual calls to connect_cached() but, by making separate database connections for separate parts of the code, the database handles are isolated from any attribute changes made to other handles. The cache can be accessed (and cleared) via the L attribute: my $CachedKids_hashref = $dbh->{Driver}->{CachedKids}; %$CachedKids_hashref = () if $CachedKids_hashref; =head3 C @ary = DBI->available_drivers; @ary = DBI->available_drivers($quiet); Returns a list of all available drivers by searching for C modules through the directories in C<@INC>. By default, a warning is given if some drivers are hidden by others of the same name in earlier directories. Passing a true value for C<$quiet> will inhibit the warning. =head3 C %drivers = DBI->installed_drivers(); Returns a list of driver name and driver handle pairs for all drivers 'installed' (loaded) into the current process. The driver name does not include the 'DBD::' prefix. To get a list of all drivers available in your perl installation you can use L. Added in DBI 1.49. =head3 C DBI->installed_versions; @ary = DBI->installed_versions; $hash = DBI->installed_versions; Calls available_drivers() and attempts to load each of them in turn using install_driver(). For each load that succeeds the driver name and version number are added to a hash. When running under L drivers which appear not be pure-perl are ignored. When called in array context the list of successfully loaded drivers is returned (without the 'DBD::' prefix). When called in scalar context an extra entry for the C is added (and C if appropriate) and a reference to the hash is returned. When called in a void context the installed_versions() method will print out a formatted list of the hash contents, one per line, along with some other information about the DBI version and OS. Due to the potentially high memory cost and unknown risks of loading in an unknown number of drivers that just happen to be installed on the system, this method is not recommended for general use. Use available_drivers() instead. The installed_versions() method is primarily intended as a quick way to see from the command line what's installed. For example: perl -MDBI -e 'DBI->installed_versions' The installed_versions() method was added in DBI 1.38. =head3 C @ary = DBI->data_sources($driver); @ary = DBI->data_sources($driver, \%attr); Returns a list of data sources (databases) available via the named driver. If C<$driver> is empty or C, then the value of the C environment variable is used. The driver will be loaded if it hasn't been already. Note that if the driver loading fails then data_sources() I with an error message that includes the string "C" and the underlying problem. Data sources are returned in a form suitable for passing to the L method (that is, they will include the "C" prefix). Note that many drivers have no way of knowing what data sources might be available for it. These drivers return an empty or incomplete list or may require driver-specific attributes. There is also a data_sources() method defined for database handles. =head3 C DBI->trace($trace_setting) DBI->trace($trace_setting, $trace_filename) DBI->trace($trace_setting, $trace_filehandle) $trace_setting = DBI->trace; The Ctrace> method sets the I trace settings and returns the I trace settings. It can also be used to change where the trace output is sent. There's a similar method, C<$h-Etrace>, which sets the trace settings for the specific handle it's called on. See the L section for full details about the DBI's powerful tracing facilities. =head3 C DBI->visit_handles( $coderef ); DBI->visit_handles( $coderef, $info ); Where $coderef is a reference to a subroutine and $info is an arbitrary value which, if undefined, defaults to a reference to an empty hash. Returns $info. For each installed driver handle, if any, $coderef is invoked as: $coderef->($driver_handle, $info); If the execution of $coderef returns a true value then L is called on that child handle and passed the returned value as $info. For example: my $info = $dbh->{Driver}->visit_child_handles(sub { my ($h, $info) = @_; ++$info->{ $h->{Type} }; # count types of handles (dr/db/st) return $info; # visit kids }); See also L. =head2 DBI Utility Functions In addition to the DBI methods listed in the previous section, the DBI package also provides several utility functions. These can be imported into your code by listing them in the C statement. For example: use DBI qw(neat data_diff); Alternatively, all these utility functions (except hash) can be imported using the C<:utils> import tag. For example: use DBI qw(:utils); =head3 C $description = data_string_desc($string); Returns an informal description of the string. For example: UTF8 off, ASCII, 42 characters 42 bytes UTF8 off, non-ASCII, 42 characters 42 bytes UTF8 on, non-ASCII, 4 characters 6 bytes UTF8 on but INVALID encoding, non-ASCII, 4 characters 6 bytes UTF8 off, undef The initial C on/off refers to Perl's internal SvUTF8 flag. If $string has the SvUTF8 flag set but the sequence of bytes it contains are not a valid UTF-8 encoding then data_string_desc() will report C. The C vs C portion shows C if I the characters in the string are ASCII (have code points <= 127). The data_string_desc() function was added in DBI 1.46. =head3 C $diff = data_string_diff($a, $b); Returns an informal description of the first character difference between the strings. If both $a and $b contain the same sequence of characters then data_string_diff() returns an empty string. For example: Params a & b Result ------------ ------ 'aaa', 'aaa' '' 'aaa', 'abc' 'Strings differ at index 2: a[2]=a, b[2]=b' 'aaa', undef 'String b is undef, string a has 3 characters' 'aaa', 'aa' 'String b truncated after 2 characters' Unicode characters are reported in C<\x{XXXX}> format. Unicode code points in the range U+0800 to U+08FF are unassigned and most likely to occur due to double-encoding. Characters in this range are reported as C<\x{08XX}='C'> where C is the corresponding latin-1 character. The data_string_diff() function only considers logical I and not the underlying encoding. See L for an alternative. The data_string_diff() function was added in DBI 1.46. =head3 C $diff = data_diff($a, $b); $diff = data_diff($a, $b, $logical); Returns an informal description of the difference between two strings. It calls L and L and returns the combined results as a multi-line string. For example, C will return: a: UTF8 off, ASCII, 3 characters 3 bytes b: UTF8 on, non-ASCII, 3 characters 5 bytes Strings differ at index 2: a[2]=c, b[2]=\x{263A} If $a and $b are identical in both the characters they contain I their physical encoding then data_diff() returns an empty string. If $logical is true then physical encoding differences are ignored (but are still reported if there is a difference in the characters). The data_diff() function was added in DBI 1.46. =head3 C $str = neat($value); $str = neat($value, $maxlen); Return a string containing a neat (and tidy) representation of the supplied value. Strings will be quoted, although internal quotes will I be escaped. Values known to be numeric will be unquoted. Undefined (NULL) values will be shown as C (without quotes). If the string is flagged internally as utf8 then double quotes will be used, otherwise single quotes are used and unprintable characters will be replaced by dot (.). For result strings longer than C<$maxlen> the result string will be truncated to C<$maxlen-4> and "C<...'>" will be appended. If C<$maxlen> is 0 or C, it defaults to C<$DBI::neat_maxlen> which, in turn, defaults to 400. This function is designed to format values for human consumption. It is used internally by the DBI for L output. It should typically I be used for formatting values for database use. (See also L.) =head3 C $str = neat_list(\@listref, $maxlen, $field_sep); Calls C on each element of the list and returns a string containing the results joined with C<$field_sep>. C<$field_sep> defaults to C<", ">. =head3 C @bool = looks_like_number(@array); Returns true for each element that looks like a number. Returns false for each element that does not look like a number. Returns C for each element that is undefined or empty. =head3 C $hash_value = DBI::hash($buffer, $type); Return a 32-bit integer 'hash' value corresponding to the contents of $buffer. The $type parameter selects which kind of hash algorithm should be used. For the technically curious, type 0 (which is the default if $type isn't specified) is based on the Perl 5.1 hash except that the value is forced to be negative (for obscure historical reasons). Type 1 is the better "Fowler / Noll / Vo" (FNV) hash. See L for more information. Both types are implemented in C and are very fast. This function doesn't have much to do with databases, except that it can sometimes be handy to store such values in a database. It also doesn't have much to do with perl hashes, like %foo. =head3 C $sts = DBI::sql_type_cast($sv, $sql_type, $flags); sql_type_cast attempts to cast C<$sv> to the SQL type (see L) specified in C<$sql_type>. At present only the SQL types C, C and C are supported. For C the effect is similar to using the value in an expression that requires an integer. It gives the perl scalar an 'integer aspect'. (Technically the value gains an IV, or possibly a UV or NV if the value is too large for an IV.) For C the effect is similar to using the value in an expression that requires a general numeric value. It gives the perl scalar a 'numeric aspect'. (Technically the value gains an NV.) C is similar to C or C but more general and more cautious. It will look at the string first and if it looks like an integer (that will fit in an IV or UV) it will act like C, if it looks like a floating point value it will act like C, if it looks like neither then it will do nothing - and thereby avoid the warnings that would be generated by C and C when given non-numeric data. C<$flags> may be: =over 4 =item C If this flag is specified then when the driver successfully casts the bound perl scalar to a non-string type then the string portion of the scalar will be discarded. =item C If C<$sv> cannot be cast to the requested C<$sql_type> then by default it is left untouched and no error is generated. If you specify C and the cast fails, this will generate an error. =back The returned C<$sts> value is: -2 sql_type is not handled -1 sv is undef so unchanged 0 sv could not be cast cleanly and DBIstcf_STRICT was used 1 sv could not be cast and DBIstcf_STRICT was not used 2 sv was cast successfully This method is exported by the :utils tag and was introduced in DBI 1.611. =head2 DBI Dynamic Attributes Dynamic attributes are always associated with the I (that handle is represented by C<$h> in the descriptions below). Where an attribute is equivalent to a method call, then refer to the method call for all related documentation. Warning: these attributes are provided as a convenience but they do have limitations. Specifically, they have a short lifespan: because they are associated with the last handle used, they should only be used I after calling the method that "sets" them. If in any doubt, use the corresponding method call. =head3 C<$DBI::err> Equivalent to C<$h-Eerr>. =head3 C<$DBI::errstr> Equivalent to C<$h-Eerrstr>. =head3 C<$DBI::state> Equivalent to C<$h-Estate>. =head3 C<$DBI::rows> Equivalent to C<$h-Erows>. Please refer to the documentation for the L method. =head3 C<$DBI::lasth> Returns the DBI object handle used for the most recent DBI method call. If the last DBI method call was a DESTROY then $DBI::lasth will return the handle of the parent of the destroyed handle, if there is one. =head1 METHODS COMMON TO ALL HANDLES The following methods can be used by all types of DBI handles. =head3 C $rv = $h->err; Returns the I database engine error code from the last driver method called. The code is typically an integer but you should not assume that. The DBI resets $h->err to undef before almost all DBI method calls, so the value only has a short lifespan. Also, for most drivers, the statement handles share the same error variable as the parent database handle, so calling a method on one handle may reset the error on the related handles. (Methods which don't reset err before being called include err() and errstr(), obviously, state(), rows(), func(), trace(), trace_msg(), ping(), and the tied hash attribute FETCH() and STORE() methods.) If you need to test for specific error conditions I have your program be portable to different database engines, then you'll need to determine what the corresponding error codes are for all those engines and test for all of them. The DBI uses the value of $DBI::stderr as the C value for internal errors. Drivers should also do likewise. The default value for $DBI::stderr is 2000000000. A driver may return C<0> from err() to indicate a warning condition after a method call. Similarly, a driver may return an empty string to indicate a 'success with information' condition. In both these cases the value is false but not undef. The errstr() and state() methods may be used to retrieve extra information in these cases. See L for more information. =head3 C $str = $h->errstr; Returns the native database engine error message from the last DBI method called. This has the same lifespan issues as the L method described above. The returned string may contain multiple messages separated by newline characters. The errstr() method should not be used to test for errors, use err() for that, because drivers may return 'success with information' or warning messages via errstr() for methods that have not 'failed'. See L for more information. =head3 C $str = $h->state; Returns a state code in the standard SQLSTATE five character format. Note that the specific success code C<00000> is translated to any empty string (false). If the driver does not support SQLSTATE (and most don't), then state() will return C (General Error) for all errors. The driver is free to return any value via C, e.g., warning codes, even if it has not declared an error by returning a true value via the L method described above. The state() method should not be used to test for errors, use err() for that, because drivers may return a 'success with information' or warning state code via state() for methods that have not 'failed'. =head3 C $rv = $h->set_err($err, $errstr); $rv = $h->set_err($err, $errstr, $state); $rv = $h->set_err($err, $errstr, $state, $method); $rv = $h->set_err($err, $errstr, $state, $method, $rv); Set the C, C, and C values for the handle. This method is typically only used by DBI drivers and DBI subclasses. If the L attribute holds a reference to a subroutine it is called first. The subroutine can alter the $err, $errstr, $state, and $method values. See L for full details. If the subroutine returns a true value then the handle C, C, and C values are not altered and set_err() returns an empty list (it normally returns $rv which defaults to undef, see below). Setting C to a I value indicates an error and will trigger the normal DBI error handling mechanisms, such as C and C, if they are enabled, when execution returns from the DBI back to the application. Setting C to C<""> indicates an 'information' state, and setting it to C<"0"> indicates a 'warning' state. Setting C to C also sets C to undef, and C to C<"">, irrespective of the values of the $errstr and $state parameters. The $method parameter provides an alternate method name for the C/C/C/C error string instead of the fairly unhelpful 'C'. The C method normally returns undef. The $rv parameter provides an alternate return value. Some special rules apply if the C or C values for the handle are I set... If C is true then: "C< [err was %s now %s]>" is appended if $err is true and C is already true and the new err value differs from the original one. Similarly "C< [state was %s now %s]>" is appended if $state is true and C is already true and the new state value differs from the original one. Finally "C<\n>" and the new $errstr are appended if $errstr differs from the existing errstr value. Obviously the C<%s>'s above are replaced by the corresponding values. The handle C value is set to $err if: $err is true; or handle C value is undef; or $err is defined and the length is greater than the handle C length. The effect is that an 'information' state only overrides undef; a 'warning' overrides undef or 'information', and an 'error' state overrides anything. The handle C value is set to $state if $state is true and the handle C value was set (by the rules above). Support for warning and information states was added in DBI 1.41. =head3 C $h->trace($trace_settings); $h->trace($trace_settings, $trace_filename); $trace_settings = $h->trace; The trace() method is used to alter the trace settings for a handle (and any future children of that handle). It can also be used to change where the trace output is sent. There's a similar method, Ctrace>, which sets the global default trace settings. See the L section for full details about the DBI's powerful tracing facilities. =head3 C $h->trace_msg($message_text); $h->trace_msg($message_text, $min_level); Writes C<$message_text> to the trace file if the trace level is greater than or equal to $min_level (which defaults to 1). Can also be called as Ctrace_msg($msg)>. See L for more details. =head3 C $h->func(@func_arguments, $func_name) or die ...; The C method can be used to call private non-standard and non-portable methods implemented by the driver. Note that the function name is given as the I argument. It's also important to note that the func() method does not clear a previous error ($DBI::err etc.) and it does not trigger automatic error detection (RaiseError etc.) so you must check the return status and/or $h->err to detect errors. (This method is not directly related to calling stored procedures. Calling stored procedures is currently not defined by the DBI. Some drivers, such as DBD::Oracle, support it in non-portable ways. See driver documentation for more details.) See also install_method() in L for how you can avoid needing to use func() and gain direct access to driver-private methods. =head3 C $is_implemented = $h->can($method_name); Returns true if $method_name is implemented by the driver or a default method is provided by the DBI's driver base class. It returns false where a driver hasn't implemented a method and the default method is provided by the DBI's driver base class is just an empty stub. =head3 C $trace_settings_integer = $h->parse_trace_flags($trace_settings); Parses a string containing trace settings and returns the corresponding integer value used internally by the DBI and drivers. The $trace_settings argument is a string containing a trace level between 0 and 15 and/or trace flag names separated by vertical bar ("C<|>") or comma ("C<,>") characters. For example: C<"SQL|3|foo">. It uses the parse_trace_flag() method, described below, to process the individual trace flag names. The parse_trace_flags() method was added in DBI 1.42. =head3 C $bit_flag = $h->parse_trace_flag($trace_flag_name); Returns the bit flag corresponding to the trace flag name in $trace_flag_name. Drivers are expected to override this method and check if $trace_flag_name is a driver specific trace flags and, if not, then call the DBI's default parse_trace_flag(). The parse_trace_flag() method was added in DBI 1.42. =head3 C $hash_ref = $h->private_attribute_info(); Returns a reference to a hash whose keys are the names of driver-private handle attributes available for the kind of handle (driver, database, statement) that the method was called on. For example, the return value when called with a DBD::Sybase $dbh could look like this: { syb_dynamic_supported => undef, syb_oc_version => undef, syb_server_version => undef, syb_server_version_string => undef, } and when called with a DBD::Sybase $sth they could look like this: { syb_types => undef, syb_proc_status => undef, syb_result_type => undef, } The values should be undef. Meanings may be assigned to particular values in future. =head3 C $rc = $h1->swap_inner_handle( $h2 ); $rc = $h1->swap_inner_handle( $h2, $allow_reparent ); Brain transplants for handles. You don't need to know about this unless you want to become a handle surgeon. A DBI handle is a reference to a tied hash. A tied hash has an I hash that actually holds the contents. The swap_inner_handle() method swaps the inner hashes between two handles. The $h1 and $h2 handles still point to the same tied hashes, but what those hashes are tied to has been swapped. In effect $h1 I $h2 and vice-versa. This is powerful stuff, expect problems. Use with care. As a small safety measure, the two handles, $h1 and $h2, have to share the same parent unless $allow_reparent is true. The swap_inner_handle() method was added in DBI 1.44. Here's a quick kind of 'diagram' as a worked example to help think about what's happening: Original state: dbh1o -> dbh1i sthAo -> sthAi(dbh1i) dbh2o -> dbh2i swap_inner_handle dbh1o with dbh2o: dbh2o -> dbh1i sthAo -> sthAi(dbh1i) dbh1o -> dbh2i create new sth from dbh1o: dbh2o -> dbh1i sthAo -> sthAi(dbh1i) dbh1o -> dbh2i sthBo -> sthBi(dbh2i) swap_inner_handle sthAo with sthBo: dbh2o -> dbh1i sthBo -> sthAi(dbh1i) dbh1o -> dbh2i sthAo -> sthBi(dbh2i) =head3 C $h->visit_child_handles( $coderef ); $h->visit_child_handles( $coderef, $info ); Where $coderef is a reference to a subroutine and $info is an arbitrary value which, if undefined, defaults to a reference to an empty hash. Returns $info. For each child handle of $h, if any, $coderef is invoked as: $coderef->($child_handle, $info); If the execution of $coderef returns a true value then C is called on that child handle and passed the returned value as $info. For example: # count database connections with names (DSN) matching a pattern my $connections = 0; $dbh->{Driver}->visit_child_handles(sub { my ($h, $info) = @_; ++$connections if $h->{Name} =~ /foo/; return 0; # don't visit kids }) See also L. =head1 ATTRIBUTES COMMON TO ALL HANDLES These attributes are common to all types of DBI handles. Some attributes are inherited by child handles. That is, the value of an inherited attribute in a newly created statement handle is the same as the value in the parent database handle. Changes to attributes in the new statement handle do not affect the parent database handle and changes to the database handle do not affect existing statement handles, only future ones. Attempting to set or get the value of an unknown attribute generates a warning, except for private driver specific attributes (which all have names starting with a lowercase letter). Example: $h->{AttributeName} = ...; # set/write ... = $h->{AttributeName}; # get/read =head3 C Type: boolean, inherited The C attribute enables useful warnings for certain bad practices. It is enabled by default and should only be disabled in rare circumstances. Since warnings are generated using the Perl C function, they can be intercepted using the Perl C<$SIG{__WARN__}> hook. The C attribute is not related to the C attribute. =head3 C Type: boolean, read-only The C attribute is true if the handle object is "active". This is rarely used in applications. The exact meaning of active is somewhat vague at the moment. For a database handle it typically means that the handle is connected to a database (C<$dbh-Edisconnect> sets C off). For a statement handle it typically means that the handle is a C statements that either cannot be prepared in advance (due to a limitation of the driver) or do not need to be executed repeatedly. It should not be used for C". Drivers using any approach like this should issue a warning if C is true because it is generally unsafe - another process may have modified the table between your insert and the select. For situations where you know it is safe, such as when you have locked the table, you can silence the warning by passing C => 0 in \%attr. B<*> If no insert has been performed yet, or the last insert failed, then the value is implementation defined. Given all the caveats above, it's clear that this method must be used with care. The C method was added in DBI 1.38. =head3 C @row_ary = $dbh->selectrow_array($statement); @row_ary = $dbh->selectrow_array($statement, \%attr); @row_ary = $dbh->selectrow_array($statement, \%attr, @bind_values); This utility method combines L, L and L into a single call. If called in a list context, it returns the first row of data from the statement. The C<$statement> parameter can be a previously prepared statement handle, in which case the C is skipped. If any method fails, and L is not set, C will return an empty list. If called in a scalar context for a statement handle that has more than one column, it is undefined whether the driver will return the value of the first column or the last. So don't do that. Also, in a scalar context, an C is returned if there are no more rows or if an error occurred. That C can't be distinguished from an C returned because the first field value was NULL. For these reasons you should exercise some caution if you use C in a scalar context, or just don't do that. =head3 C $ary_ref = $dbh->selectrow_arrayref($statement); $ary_ref = $dbh->selectrow_arrayref($statement, \%attr); $ary_ref = $dbh->selectrow_arrayref($statement, \%attr, @bind_values); This utility method combines L, L and L into a single call. It returns the first row of data from the statement. The C<$statement> parameter can be a previously prepared statement handle, in which case the C is skipped. If any method fails, and L is not set, C will return undef. =head3 C $hash_ref = $dbh->selectrow_hashref($statement); $hash_ref = $dbh->selectrow_hashref($statement, \%attr); $hash_ref = $dbh->selectrow_hashref($statement, \%attr, @bind_values); This utility method combines L, L and L into a single call. It returns the first row of data from the statement. The C<$statement> parameter can be a previously prepared statement handle, in which case the C is skipped. If any method fails, and L is not set, C will return undef. =head3 C $ary_ref = $dbh->selectall_arrayref($statement); $ary_ref = $dbh->selectall_arrayref($statement, \%attr); $ary_ref = $dbh->selectall_arrayref($statement, \%attr, @bind_values); This utility method combines L, L and L into a single call. It returns a reference to an array containing a reference to an array (or hash, see below) for each row of data fetched. The C<$statement> parameter can be a previously prepared statement handle, in which case the C is skipped. This is recommended if the statement is going to be executed many times. If L is not set and any method except C fails then C will return C; if C fails then it will return with whatever data has been fetched thus far. You should check C<$dbh-Eerr> afterwards (or use the C attribute) to discover if the data is complete or was truncated due to an error. The L method called by C supports a $max_rows parameter. You can specify a value for $max_rows by including a 'C' attribute in \%attr. In which case finish() is called for you after fetchall_arrayref() returns. The L method called by C also supports a $slice parameter. You can specify a value for $slice by including a 'C' or 'C' attribute in \%attr. The only difference between the two is that if C is not defined and C is an array ref, then the array is assumed to contain column index values (which count from 1), rather than perl array index values. In which case the array is copied and each value decremented before passing to C. You may often want to fetch an array of rows where each row is stored as a hash. That can be done simply using: my $emps = $dbh->selectall_arrayref( "SELECT ename FROM emp ORDER BY ename", { Slice => {} } ); foreach my $emp ( @$emps ) { print "Employee: $emp->{ename}\n"; } Or, to fetch into an array instead of an array ref: @result = @{ $dbh->selectall_arrayref($sql, { Slice => {} }) }; See L method for more details. =head3 C @ary = $dbh->selectall_array($statement); @ary = $dbh->selectall_array($statement, \%attr); @ary = $dbh->selectall_array($statement, \%attr, @bind_values); This is a convenience wrapper around L that returns the rows directly as a list, rather than a reference to an array of rows. Note that if L is not set then you can't tell the difference between returning no rows and an error. Using RaiseError is best practice. The C method was added in DBI 1.635. =head3 C $hash_ref = $dbh->selectall_hashref($statement, $key_field); $hash_ref = $dbh->selectall_hashref($statement, $key_field, \%attr); $hash_ref = $dbh->selectall_hashref($statement, $key_field, \%attr, @bind_values); This utility method combines L, L and L into a single call. It returns a reference to a hash containing one entry, at most, for each row, as returned by fetchall_hashref(). The C<$statement> parameter can be a previously prepared statement handle, in which case the C is skipped. This is recommended if the statement is going to be executed many times. The C<$key_field> parameter defines which column, or columns, are used as keys in the returned hash. It can either be the name of a single field, or a reference to an array containing multiple field names. Using multiple names yields a tree of nested hashes. If a row has the same key as an earlier row then it replaces the earlier row. If any method except C fails, and L is not set, C will return C. If C fails and L is not set, then it will return with whatever data it has fetched thus far. $DBI::err should be checked to catch that. See fetchall_hashref() for more details. =head3 C $ary_ref = $dbh->selectcol_arrayref($statement); $ary_ref = $dbh->selectcol_arrayref($statement, \%attr); $ary_ref = $dbh->selectcol_arrayref($statement, \%attr, @bind_values); This utility method combines L, L, and fetching one column from all the rows, into a single call. It returns a reference to an array containing the values of the first column from each row. The C<$statement> parameter can be a previously prepared statement handle, in which case the C is skipped. This is recommended if the statement is going to be executed many times. If any method except C fails, and L is not set, C will return C. If C fails and L is not set, then it will return with whatever data it has fetched thus far. $DBI::err should be checked to catch that. The C method defaults to pushing a single column value (the first) from each row into the result array. However, it can also push another column, or even multiple columns per row, into the result array. This behaviour can be specified via a 'C' attribute which must be a ref to an array containing the column number or numbers to use. For example: # get array of id and name pairs: my $ary_ref = $dbh->selectcol_arrayref("select id, name from table", { Columns=>[1,2] }); my %hash = @$ary_ref; # build hash from key-value pairs so $hash{$id} => name You can specify a maximum number of rows to fetch by including a 'C' attribute in \%attr. =head3 C $sth = $dbh->prepare($statement) or die $dbh->errstr; $sth = $dbh->prepare($statement, \%attr) or die $dbh->errstr; Prepares a statement for later execution by the database engine and returns a reference to a statement handle object. The returned statement handle can be used to get attributes of the statement and invoke the L method. See L. Drivers for engines without the concept of preparing a statement will typically just store the statement in the returned handle and process it when C<$sth-Eexecute> is called. Such drivers are unlikely to give much useful information about the statement, such as C<$sth-E{NUM_OF_FIELDS}>, until after C<$sth-Eexecute> has been called. Portable applications should take this into account. In general, DBI drivers do not parse the contents of the statement (other than simply counting any L). The statement is passed directly to the database engine, sometimes known as pass-thru mode. This has advantages and disadvantages. On the plus side, you can access all the functionality of the engine being used. On the downside, you're limited if you're using a simple engine, and you need to take extra care if writing applications intended to be portable between engines. Portable applications should not assume that a new statement can be prepared and/or executed while still fetching results from a previous statement. Some command-line SQL tools use statement terminators, like a semicolon, to indicate the end of a statement. Such terminators should not normally be used with the DBI. =head3 C $sth = $dbh->prepare_cached($statement) $sth = $dbh->prepare_cached($statement, \%attr) $sth = $dbh->prepare_cached($statement, \%attr, $if_active) Like L except that the statement handle returned will be stored in a hash associated with the C<$dbh>. If another call is made to C with the same C<$statement> and C<%attr> parameter values, then the corresponding cached C<$sth> will be returned without contacting the database server. Be sure to understand the cautions and caveats noted below. The C<$if_active> parameter lets you adjust the behaviour if an already cached statement handle is still Active. There are several alternatives: =over 4 =item B<0>: A warning will be generated, and finish() will be called on the statement handle before it is returned. This is the default behaviour if $if_active is not passed. =item B<1>: finish() will be called on the statement handle, but the warning is suppressed. =item B<2>: Disables any checking. =item B<3>: The existing active statement handle will be removed from the cache and a new statement handle prepared and cached in its place. This is the safest option because it doesn't affect the state of the old handle, it just removes it from the cache. [Added in DBI 1.40] =back Here are some examples of C: sub insert_hash { my ($table, $field_values) = @_; # sort to keep field order, and thus sql, stable for prepare_cached my @fields = sort keys %$field_values; my @values = @{$field_values}{@fields}; my $sql = sprintf "insert into %s (%s) values (%s)", $table, join(",", @fields), join(",", ("?")x@fields); my $sth = $dbh->prepare_cached($sql); return $sth->execute(@values); } sub search_hash { my ($table, $field_values) = @_; # sort to keep field order, and thus sql, stable for prepare_cached my @fields = sort keys %$field_values; my @values = @{$field_values}{@fields}; my $qualifier = ""; $qualifier = "where ".join(" and ", map { "$_=?" } @fields) if @fields; $sth = $dbh->prepare_cached("SELECT * FROM $table $qualifier"); return $dbh->selectall_arrayref($sth, {}, @values); } I This caching can be useful in some applications, but it can also cause problems and should be used with care. Here is a contrived case where caching would cause a significant problem: my $sth = $dbh->prepare_cached('SELECT * FROM foo WHERE bar=?'); $sth->execute(...); while (my $data = $sth->fetchrow_hashref) { # later, in some other code called within the loop... my $sth2 = $dbh->prepare_cached('SELECT * FROM foo WHERE bar=?'); $sth2->execute(...); while (my $data2 = $sth2->fetchrow_arrayref) { do_stuff(...); } } In this example, since both handles are preparing the exact same statement, C<$sth2> will not be its own statement handle, but a duplicate of C<$sth> returned from the cache. The results will certainly not be what you expect. Typically the inner fetch loop will work normally, fetching all the records and terminating when there are no more, but now that $sth is the same as $sth2 the outer fetch loop will also terminate. You'll know if you run into this problem because prepare_cached() will generate a warning by default (when $if_active is false). The cache used by prepare_cached() is keyed by both the statement and any attributes so you can also avoid this issue by doing something like: $sth = $dbh->prepare_cached("...", { dbi_dummy => __FILE__.__LINE__ }); which will ensure that prepare_cached only returns statements cached by that line of code in that source file. Also, to ensure the attributes passed are always the same, avoid passing references inline. For example, the Slice attribute is specified as a reference. Be sure to declare it external to the call to prepare_cached(), such that a new hash reference is not created on every call. See L for more details and examples. If you'd like the cache to managed intelligently, you can tie the hashref returned by C to an appropriate caching module, such as L: my $cache; tie %$cache, 'Tie::Cache::LRU', 500; $dbh->{CachedKids} = $cache; =head3 C $rc = $dbh->commit or die $dbh->errstr; Commit (make permanent) the most recent series of database changes if the database supports transactions and AutoCommit is off. If C is on, then calling C will issue a "commit ineffective with AutoCommit" warning. See also L in the L section below. =head3 C $rc = $dbh->rollback or die $dbh->errstr; Rollback (undo) the most recent series of uncommitted database changes if the database supports transactions and AutoCommit is off. If C is on, then calling C will issue a "rollback ineffective with AutoCommit" warning. See also L in the L section below. =head3 C $rc = $dbh->begin_work or die $dbh->errstr; Enable transactions (by turning C off) until the next call to C or C. After the next C or C, C will automatically be turned on again. If C is already off when C is called then it does nothing except return an error. If the driver does not support transactions then when C attempts to set C off the driver will trigger a fatal error. See also L in the L section below. =head3 C $rc = $dbh->disconnect or warn $dbh->errstr; Disconnects the database from the database handle. C is typically only used before exiting the program. The handle is of little use after disconnecting. The transaction behaviour of the C method is, sadly, undefined. Some database systems (such as Oracle and Ingres) will automatically commit any outstanding changes, but others (such as Informix) will rollback any outstanding changes. Applications not using C should explicitly call C or C before calling C. The database is automatically disconnected by the C method if still connected when there are no longer any references to the handle. The C method for each driver should implicitly call C to undo any uncommitted changes. This is vital behaviour to ensure that incomplete transactions don't get committed simply because Perl calls C on every object before exiting. Also, do not rely on the order of object destruction during "global destruction", as it is undefined. Generally, if you want your changes to be committed or rolled back when you disconnect, then you should explicitly call L or L before disconnecting. If you disconnect from a database while you still have active statement handles (e.g., SELECT statement handles that may have more data to fetch), you will get a warning. The warning may indicate that a fetch loop terminated early, perhaps due to an uncaught error. To avoid the warning call the C method on the active handles. =head3 C $rc = $dbh->ping; Attempts to determine, in a reasonably efficient way, if the database server is still running and the connection to it is still working. Individual drivers should implement this function in the most suitable manner for their database engine. The current I implementation always returns true without actually doing anything. Actually, it returns "C<0 but true>" which is true but zero. That way you can tell if the return value is genuine or just the default. Drivers should override this method with one that does the right thing for their type of database. Few applications would have direct use for this method. See the specialized Apache::DBI module for one example usage. =head3 C $value = $dbh->get_info( $info_type ); Returns information about the implementation, i.e. driver and data source capabilities, restrictions etc. It returns C for unknown or unimplemented information types. For example: $database_version = $dbh->get_info( 18 ); # SQL_DBMS_VER $max_select_tables = $dbh->get_info( 106 ); # SQL_MAXIMUM_TABLES_IN_SELECT See L for more detailed information about the information types and their meanings and possible return values. The L module exports a %GetInfoType hash that can be used to map info type names to numbers. For example: $database_version = $dbh->get_info( $GetInfoType{SQL_DBMS_VER} ); The names are a merging of the ANSI and ODBC standards (which differ in some cases). See L for more details. Because some DBI methods make use of get_info(), drivers are strongly encouraged to support I the following very minimal set of information types to ensure the DBI itself works properly: Type Name Example A Example B ---- -------------------------- ------------ ---------------- 17 SQL_DBMS_NAME 'ACCESS' 'Oracle' 18 SQL_DBMS_VER '03.50.0000' '08.01.0721 ...' 29 SQL_IDENTIFIER_QUOTE_CHAR '`' '"' 41 SQL_CATALOG_NAME_SEPARATOR '.' '@' 114 SQL_CATALOG_LOCATION 1 2 Values from 9000 to 9999 for get_info are officially reserved for use by Perl DBI. Values in that range which have been assigned a meaning are defined here: C<9000>: true if a backslash character (C<\>) before placeholder-like text (e.g. C, C<:foo>) will prevent it being treated as a placeholder by the driver. The backslash will be removed before the text is passed to the backend. =head3 C $sth = $dbh->table_info( $catalog, $schema, $table, $type ); $sth = $dbh->table_info( $catalog, $schema, $table, $type, \%attr ); # then $sth->fetchall_arrayref or $sth->fetchall_hashref etc Returns an active statement handle that can be used to fetch information about tables and views that exist in the database. The arguments $catalog, $schema and $table may accept search patterns according to the database/driver, for example: $table = '%FOO%'; Remember that the underscore character ('C<_>') is a search pattern that means match any character, so 'FOO_%' is the same as 'FOO%' and 'FOO_BAR%' will match names like 'FOO1BAR'. The value of $type is a comma-separated list of one or more types of tables to be returned in the result set. Each value may optionally be quoted, e.g.: $type = "TABLE"; $type = "'TABLE','VIEW'"; In addition the following special cases may also be supported by some drivers: =over 4 =item * If the value of $catalog is '%' and $schema and $table name are empty strings, the result set contains a list of catalog names. For example: $sth = $dbh->table_info('%', '', ''); =item * If the value of $schema is '%' and $catalog and $table are empty strings, the result set contains a list of schema names. =item * If the value of $type is '%' and $catalog, $schema, and $table are all empty strings, the result set contains a list of table types. =back If your driver doesn't support one or more of the selection filter parameters then you may get back more than you asked for and can do the filtering yourself. This method can be expensive, and can return a large amount of data. (For example, small Oracle installation returns over 2000 rows.) So it's a good idea to use the filters to limit the data as much as possible. The statement handle returned has at least the following fields in the order show below. Other fields, after these, may also be present. B: Table catalog identifier. This field is NULL (C) if not applicable to the data source, which is usually the case. This field is empty if not applicable to the table. B: The name of the schema containing the TABLE_NAME value. This field is NULL (C) if not applicable to data source, and empty if not applicable to the table. B: Name of the table (or view, synonym, etc). B: One of the following: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM" or a type identifier that is specific to the data source. B: A description of the table. May be NULL (C). Note that C might not return records for all tables. Applications can use any valid table regardless of whether it's returned by C. See also L, L and L. =head3 C $sth = $dbh->column_info( $catalog, $schema, $table, $column ); # then $sth->fetchall_arrayref or $sth->fetchall_hashref etc Returns an active statement handle that can be used to fetch information about columns in specified tables. The arguments $schema, $table and $column may accept search patterns according to the database/driver, for example: $table = '%FOO%'; Note: The support for the selection criteria is driver specific. If the driver doesn't support one or more of them then you may get back more than you asked for and can do the filtering yourself. Note: If your driver does not support column_info an undef is returned. This is distinct from asking for something which does not exist in a driver which supports column_info as a valid statement handle to an empty result-set will be returned in this case. If the arguments don't match any tables then you'll still get a statement handle, it'll just return no rows. The statement handle returned has at least the following fields in the order shown below. Other fields, after these, may also be present. B: The catalog identifier. This field is NULL (C) if not applicable to the data source, which is often the case. This field is empty if not applicable to the table. B: The schema identifier. This field is NULL (C) if not applicable to the data source, and empty if not applicable to the table. B: The table identifier. Note: A driver may provide column metadata not only for base tables, but also for derived objects like SYNONYMS etc. B: The column identifier. B: The concise data type code. B: A data source dependent data type name. B: The column size. This is the maximum length in characters for character data types, the number of digits or bits for numeric data types or the length in the representation of temporal types. See the relevant specifications for detailed information. B: The length in bytes of transferred data. B: The total number of significant digits to the right of the decimal point. B: The radix for numeric precision. The value is 10 or 2 for numeric data types and NULL (C) if not applicable. B: Indicates if a column can accept NULLs. The following values are defined: SQL_NO_NULLS 0 SQL_NULLABLE 1 SQL_NULLABLE_UNKNOWN 2 B: A description of the column. B: The default value of the column, in a format that can be used directly in an SQL statement. Note that this may be an expression and not simply the text used for the default value in the original CREATE TABLE statement. For example, given: col1 char(30) default current_user -- a 'function' col2 char(30) default 'string' -- a string literal where "current_user" is the name of a function, the corresponding C values would be: Database col1 col2 -------- ---- ---- Oracle: current_user 'string' Postgres: "current_user"() 'string'::text MS SQL: (user_name()) ('string') B: The SQL data type. B: The subtype code for datetime and interval data types. B: The maximum length in bytes of a character or binary data type column. B: The column sequence number (starting with 1). B: Indicates if the column can accept NULLs. Possible values are: 'NO', 'YES' and ''. SQL/CLI defines the following additional columns: CHAR_SET_CAT CHAR_SET_SCHEM CHAR_SET_NAME COLLATION_CAT COLLATION_SCHEM COLLATION_NAME UDT_CAT UDT_SCHEM UDT_NAME DOMAIN_CAT DOMAIN_SCHEM DOMAIN_NAME SCOPE_CAT SCOPE_SCHEM SCOPE_NAME MAX_CARDINALITY DTD_IDENTIFIER IS_SELF_REF Drivers capable of supplying any of those values should do so in the corresponding column and supply undef values for the others. Drivers wishing to provide extra database/driver specific information should do so in extra columns beyond all those listed above, and use lowercase field names with the driver-specific prefix (i.e., 'ora_...'). Applications accessing such fields should do so by name and not by column number. The result set is ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION. Note: There is some overlap with statement handle attributes (in perl) and SQLDescribeCol (in ODBC). However, SQLColumns provides more metadata. See also L and L. =head3 C $sth = $dbh->primary_key_info( $catalog, $schema, $table ); # then $sth->fetchall_arrayref or $sth->fetchall_hashref etc Returns an active statement handle that can be used to fetch information about columns that make up the primary key for a table. The arguments don't accept search patterns (unlike table_info()). The statement handle will return one row per column, ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and KEY_SEQ. If there is no primary key then the statement handle will fetch no rows. Note: The support for the selection criteria, such as $catalog, is driver specific. If the driver doesn't support catalogs and/or schemas, it may ignore these criteria. The statement handle returned has at least the following fields in the order shown below. Other fields, after these, may also be present. B: The catalog identifier. This field is NULL (C) if not applicable to the data source, which is often the case. This field is empty if not applicable to the table. B: The schema identifier. This field is NULL (C) if not applicable to the data source, and empty if not applicable to the table. B: The table identifier. B: The column identifier. B: The column sequence number (starting with 1). Note: This field is named B in SQL/CLI. B: The primary key constraint identifier. This field is NULL (C) if not applicable to the data source. See also L and L. =head3 C @key_column_names = $dbh->primary_key( $catalog, $schema, $table ); Simple interface to the primary_key_info() method. Returns a list of the column names that comprise the primary key of the specified table. The list is in primary key column sequence order. If there is no primary key then an empty list is returned. =head3 C $sth = $dbh->foreign_key_info( $pk_catalog, $pk_schema, $pk_table , $fk_catalog, $fk_schema, $fk_table ); $sth = $dbh->foreign_key_info( $pk_catalog, $pk_schema, $pk_table , $fk_catalog, $fk_schema, $fk_table , \%attr ); # then $sth->fetchall_arrayref or $sth->fetchall_hashref etc Returns an active statement handle that can be used to fetch information about foreign keys in and/or referencing the specified table(s). The arguments don't accept search patterns (unlike table_info()). C<$pk_catalog>, C<$pk_schema>, C<$pk_table> identify the primary (unique) key table (B). C<$fk_catalog>, C<$fk_schema>, C<$fk_table> identify the foreign key table (B). If both B and B are given, the function returns the foreign key, if any, in table B that refers to the primary (unique) key of table B. (Note: In SQL/CLI, the result is implementation-defined.) If only B is given, then the result set contains the primary key of that table and all foreign keys that refer to it. If only B is given, then the result set contains all foreign keys in that table and the primary keys to which they refer. (Note: In SQL/CLI, the result includes unique keys too.) For example: $sth = $dbh->foreign_key_info( undef, $user, 'master'); $sth = $dbh->foreign_key_info( undef, undef, undef , undef, $user, 'detail'); $sth = $dbh->foreign_key_info( undef, $user, 'master', undef, $user, 'detail'); # then $sth->fetchall_arrayref or $sth->fetchall_hashref etc Note: The support for the selection criteria, such as C<$catalog>, is driver specific. If the driver doesn't support catalogs and/or schemas, it may ignore these criteria. The statement handle returned has the following fields in the order shown below. Because ODBC never includes unique keys, they define different columns in the result set than SQL/CLI. SQL/CLI column names are shown in parentheses. B: The primary (unique) key table catalog identifier. This field is NULL (C) if not applicable to the data source, which is often the case. This field is empty if not applicable to the table. B: The primary (unique) key table schema identifier. This field is NULL (C) if not applicable to the data source, and empty if not applicable to the table. B: The primary (unique) key table identifier. B: The primary (unique) key column identifier. B: The foreign key table catalog identifier. This field is NULL (C) if not applicable to the data source, which is often the case. This field is empty if not applicable to the table. B: The foreign key table schema identifier. This field is NULL (C) if not applicable to the data source, and empty if not applicable to the table. B: The foreign key table identifier. B: The foreign key column identifier. B: The column sequence number (starting with 1). B: The referential action for the UPDATE rule. The following codes are defined: CASCADE 0 RESTRICT 1 SET NULL 2 NO ACTION 3 SET DEFAULT 4 B: The referential action for the DELETE rule. The codes are the same as for UPDATE_RULE. B: The foreign key name. B: The primary (unique) key name. B: The deferrability of the foreign key constraint. The following codes are defined: INITIALLY DEFERRED 5 INITIALLY IMMEDIATE 6 NOT DEFERRABLE 7 B< ( UNIQUE_OR_PRIMARY )>: This column is necessary if a driver includes all candidate (i.e. primary and alternate) keys in the result set (as specified by SQL/CLI). The value of this column is UNIQUE if the foreign key references an alternate key and PRIMARY if the foreign key references a primary key, or it may be undefined if the driver doesn't have access to the information. See also L and L. =head3 C $sth = $dbh->statistics_info( $catalog, $schema, $table, $unique_only, $quick ); # then $sth->fetchall_arrayref or $sth->fetchall_hashref etc Returns an active statement handle that can be used to fetch statistical information about a table and its indexes. The arguments don't accept search patterns (unlike L). If the boolean argument $unique_only is true, only UNIQUE indexes will be returned in the result set, otherwise all indexes will be returned. If the boolean argument $quick is set, the actual statistical information columns (CARDINALITY and PAGES) will only be returned if they are readily available from the server, and might not be current. Some databases may return stale statistics or no statistics at all with this flag set. The statement handle will return at most one row per column name per index, plus at most one row for the entire table itself, ordered by NON_UNIQUE, TYPE, INDEX_QUALIFIER, INDEX_NAME, and ORDINAL_POSITION. Note: The support for the selection criteria, such as $catalog, is driver specific. If the driver doesn't support catalogs and/or schemas, it may ignore these criteria. The statement handle returned has at least the following fields in the order shown below. Other fields, after these, may also be present. B: The catalog identifier. This field is NULL (C) if not applicable to the data source, which is often the case. This field is empty if not applicable to the table. B: The schema identifier. This field is NULL (C) if not applicable to the data source, and empty if not applicable to the table. B: The table identifier. B: Unique index indicator. Returns 0 for unique indexes, 1 for non-unique indexes B: Index qualifier identifier. The identifier that is used to qualify the index name when doing a C; NULL (C) is returned if an index qualifier is not supported by the data source. If a non-NULL (defined) value is returned in this column, it must be used to qualify the index name on a C statement; otherwise, the TABLE_SCHEM should be used to qualify the index name. B: The index identifier. B: The type of information being returned. Can be any of the following values: 'table', 'btree', 'clustered', 'content', 'hashed', or 'other'. In the case that this field is 'table', all fields other than TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TYPE, CARDINALITY, and PAGES will be NULL (C). B: Column sequence number (starting with 1). B: The column identifier. B: Column sort sequence. C for Ascending, C for Descending, or NULL (C) if not supported for this index. B: Cardinality of the table or index. For indexes, this is the number of unique values in the index. For tables, this is the number of rows in the table. If not supported, the value will be NULL (C). B: Number of storage pages used by this table or index. If not supported, the value will be NULL (C). B: The index filter condition as a string. If the index is not a filtered index, or it cannot be determined whether the index is a filtered index, this value is NULL (C). If the index is a filtered index, but the filter condition cannot be determined, this value is the empty string C<''>. Otherwise it will be the literal filter condition as a string, such as C. See also L and L. =head3 C @names = $dbh->tables( $catalog, $schema, $table, $type ); @names = $dbh->tables; # deprecated Simple interface to table_info(). Returns a list of matching table names, possibly including a catalog/schema prefix. See L for a description of the parameters. If C<$dbh-Eget_info(29)> returns true (29 is SQL_IDENTIFIER_QUOTE_CHAR) then the table names are constructed and quoted by L to ensure they are usable even if they contain whitespace or reserved words etc. This means that the table names returned will include quote characters. =head3 C $type_info_all = $dbh->type_info_all; Returns a reference to an array which holds information about each data type variant supported by the database and driver. The array and its contents should be treated as read-only. The first item is a reference to an 'index' hash of CE C pairs. The items following that are references to arrays, one per supported data type variant. The leading index hash defines the names and order of the fields within the arrays that follow it. For example: $type_info_all = [ { TYPE_NAME => 0, DATA_TYPE => 1, COLUMN_SIZE => 2, # was PRECISION originally LITERAL_PREFIX => 3, LITERAL_SUFFIX => 4, CREATE_PARAMS => 5, NULLABLE => 6, CASE_SENSITIVE => 7, SEARCHABLE => 8, UNSIGNED_ATTRIBUTE=> 9, FIXED_PREC_SCALE => 10, # was MONEY originally AUTO_UNIQUE_VALUE => 11, # was AUTO_INCREMENT originally LOCAL_TYPE_NAME => 12, MINIMUM_SCALE => 13, MAXIMUM_SCALE => 14, SQL_DATA_TYPE => 15, SQL_DATETIME_SUB => 16, NUM_PREC_RADIX => 17, INTERVAL_PRECISION=> 18, }, [ 'VARCHAR', SQL_VARCHAR, undef, "'","'", undef,0, 1,1,0,0,0,undef,1,255, undef ], [ 'INTEGER', SQL_INTEGER, undef, "", "", undef,0, 0,1,0,0,0,undef,0, 0, 10 ], ]; More than one row may have the same value in the C field if there are different ways to spell the type name and/or there are variants of the type with different attributes (e.g., with and without C set, with and without C, etc). The rows are ordered by C first and then by how closely each type maps to the corresponding ODBC SQL data type, closest first. The meaning of the fields is described in the documentation for the L method. An 'index' hash is provided so you don't need to rely on index values defined above. However, using DBD::ODBC with some old ODBC drivers may return older names, shown as comments in the example above. Another issue with the index hash is that the lettercase of the keys is not defined. It is usually uppercase, as show here, but drivers may return names with any lettercase. Drivers are also free to return extra driver-specific columns of information - though it's recommended that they start at column index 50 to leave room for expansion of the DBI/ODBC specification. The type_info_all() method is not normally used directly. The L method provides a more usable and useful interface to the data. =head3 C @type_info = $dbh->type_info($data_type); Returns a list of hash references holding information about one or more variants of $data_type. The list is ordered by C first and then by how closely each type maps to the corresponding ODBC SQL data type, closest first. If called in a scalar context then only the first (best) element is returned. If $data_type is undefined or C, then the list will contain hashes for all data type variants supported by the database and driver. If $data_type is an array reference then C returns the information for the I type in the array that has any matches. The keys of the hash follow the same letter case conventions as the rest of the DBI (see L). The following uppercase items should always exist, though may be undef: =over 4 =item TYPE_NAME (string) Data type name for use in CREATE TABLE statements etc. =item DATA_TYPE (integer) SQL data type number. =item COLUMN_SIZE (integer) For numeric types, this is either the total number of digits (if the NUM_PREC_RADIX value is 10) or the total number of bits allowed in the column (if NUM_PREC_RADIX is 2). For string types, this is the maximum size of the string in characters. For date and interval types, this is the maximum number of characters needed to display the value. =item LITERAL_PREFIX (string) Characters used to prefix a literal. A typical prefix is "C<'>" for characters, or possibly "C<0x>" for binary values passed as hexadecimal. NULL (C) is returned for data types for which this is not applicable. =item LITERAL_SUFFIX (string) Characters used to suffix a literal. Typically "C<'>" for characters. NULL (C) is returned for data types where this is not applicable. =item CREATE_PARAMS (string) Parameter names for data type definition. For example, C for a C would be "C" if the DECIMAL type should be declared as CIC<)> where I and I are integer values. For a C it would be "C". NULL (C) is returned for data types for which this is not applicable. =item NULLABLE (integer) Indicates whether the data type accepts a NULL value: C<0> or an empty string = no, C<1> = yes, C<2> = unknown. =item CASE_SENSITIVE (boolean) Indicates whether the data type is case sensitive in collations and comparisons. =item SEARCHABLE (integer) Indicates how the data type can be used in a WHERE clause, as follows: 0 - Cannot be used in a WHERE clause 1 - Only with a LIKE predicate 2 - All comparison operators except LIKE 3 - Can be used in a WHERE clause with any comparison operator =item UNSIGNED_ATTRIBUTE (boolean) Indicates whether the data type is unsigned. NULL (C) is returned for data types for which this is not applicable. =item FIXED_PREC_SCALE (boolean) Indicates whether the data type always has the same precision and scale (such as a money type). NULL (C) is returned for data types for which this is not applicable. =item AUTO_UNIQUE_VALUE (boolean) Indicates whether a column of this data type is automatically set to a unique value whenever a new row is inserted. NULL (C) is returned for data types for which this is not applicable. =item LOCAL_TYPE_NAME (string) Localized version of the C for use in dialog with users. NULL (C) is returned if a localized name is not available (in which case C should be used). =item MINIMUM_SCALE (integer) The minimum scale of the data type. If a data type has a fixed scale, then C holds the same value. NULL (C) is returned for data types for which this is not applicable. =item MAXIMUM_SCALE (integer) The maximum scale of the data type. If a data type has a fixed scale, then C holds the same value. NULL (C) is returned for data types for which this is not applicable. =item SQL_DATA_TYPE (integer) This column is the same as the C column, except for interval and datetime data types. For interval and datetime data types, the C field will return C or C, and the C field below will return the subcode for the specific interval or datetime data type. If this field is NULL, then the driver does not support or report on interval or datetime subtypes. =item SQL_DATETIME_SUB (integer) For interval or datetime data types, where the C field above is C or C, this field will hold the I for the specific interval or datetime data type. Otherwise it will be NULL (C). Although not mentioned explicitly in the standards, it seems there is a simple relationship between these values: DATA_TYPE == (10 * SQL_DATA_TYPE) + SQL_DATETIME_SUB =item NUM_PREC_RADIX (integer) The radix value of the data type. For approximate numeric types, C contains the value 2 and C holds the number of bits. For exact numeric types, C contains the value 10 and C holds the number of decimal digits. NULL (C) is returned either for data types for which this is not applicable or if the driver cannot report this information. =item INTERVAL_PRECISION (integer) The interval leading precision for interval types. NULL is returned either for data types for which this is not applicable or if the driver cannot report this information. =back For example, to find the type name for the fields in a select statement you can do: @names = map { scalar $dbh->type_info($_)->{TYPE_NAME} } @{ $sth->{TYPE} } Since DBI and ODBC drivers vary in how they map their types into the ISO standard types you may need to search for more than one type. Here's an example looking for a usable type to store a date: $my_date_type = $dbh->type_info( [ SQL_DATE, SQL_TIMESTAMP ] ); Similarly, to more reliably find a type to store small integers, you could use a list starting with C, C, C, etc. See also L. =head3 C $sql = $dbh->quote($value); $sql = $dbh->quote($value, $data_type); Quote a string literal for use as a literal value in an SQL statement, by escaping any special characters (such as quotation marks) contained within the string and adding the required type of outer quotation marks. $sql = sprintf "SELECT foo FROM bar WHERE baz = %s", $dbh->quote("Don't"); For most database types, at least those that conform to SQL standards, quote would return C<'Don''t'> (including the outer quotation marks). For others it may return something like C<'Don\'t'> An undefined C<$value> value will be returned as the string C (without single quotation marks) to match how NULLs are represented in SQL. If C<$data_type> is supplied, it is used to try to determine the required quoting behaviour by using the information returned by L. As a special case, the standard numeric types are optimized to return C<$value> without calling C. Quote will probably I be able to deal with all possible input (such as binary data or data containing newlines), and is not related in any way with escaping or quoting shell meta-characters. It is valid for the quote() method to return an SQL expression that evaluates to the desired string. For example: $quoted = $dbh->quote("one\ntwo\0three") may return something like: CONCAT('one', CHAR(12), 'two', CHAR(0), 'three') The quote() method should I be used with L. =head3 C $sql = $dbh->quote_identifier( $name ); $sql = $dbh->quote_identifier( $catalog, $schema, $table, \%attr ); Quote an identifier (table name etc.) for use in an SQL statement, by escaping any special characters (such as double quotation marks) it contains and adding the required type of outer quotation marks. Undefined names are ignored and the remainder are quoted and then joined together, typically with a dot (C<.>) character. For example: $id = $dbh->quote_identifier( undef, 'Her schema', 'My table' ); would, for most database types, return C<"Her schema"."My table"> (including all the double quotation marks). If three names are supplied then the first is assumed to be a catalog name and special rules may be applied based on what L returns for SQL_CATALOG_NAME_SEPARATOR (41) and SQL_CATALOG_LOCATION (114). For example, for Oracle: $id = $dbh->quote_identifier( 'link', 'schema', 'table' ); would return C<"schema"."table"@"link">. =head3 C $imp_data = $dbh->take_imp_data; Leaves the $dbh in an almost dead, zombie-like, state and returns a binary string of raw implementation data from the driver which describes the current database connection. Effectively it detaches the underlying database API connection data from the DBI handle. After calling take_imp_data(), all other methods except C will generate a warning and return undef. Why would you want to do this? You don't, forget I even mentioned it. Unless, that is, you're implementing something advanced like a multi-threaded connection pool like C. The returned $imp_data can be passed as a C attribute to a later connect() call, even in a separate thread in the same process, where the driver can use it to 'adopt' the existing connection that the implementation data was taken from. Some things to keep in mind... B<*> the $imp_data holds the only reference to the underlying database API connection data. That connection is still 'live' and won't be cleaned up properly unless the $imp_data is used to create a new $dbh which is then allowed to disconnect() normally. B<*> using the same $imp_data to create more than one other new $dbh at a time may well lead to unpleasant problems. Don't do that. Any child statement handles are effectively destroyed when take_imp_data() is called. The C method was added in DBI 1.36 but wasn't useful till 1.49. =head2 Database Handle Attributes This section describes attributes specific to database handles. Changes to these database handle attributes do not affect any other existing or future database handles. Attempting to set or get the value of an unknown attribute generates a warning, except for private driver-specific attributes (which all have names starting with a lowercase letter). Example: $h->{AutoCommit} = ...; # set/write ... = $h->{AutoCommit}; # get/read =head3 C Type: boolean If true, then database changes cannot be rolled-back (undone). If false, then database changes automatically occur within a "transaction", which must either be committed or rolled back using the C or C methods. Drivers should always default to C mode (an unfortunate choice largely forced on the DBI by ODBC and JDBC conventions.) Attempting to set C to an unsupported value is a fatal error. This is an important feature of the DBI. Applications that need full transaction behaviour can set C<$dbh-E{AutoCommit} = 0> (or set C to 0 via L) without having to check that the value was assigned successfully. For the purposes of this description, we can divide databases into three categories: Databases which don't support transactions at all. Databases in which a transaction is always active. Databases in which a transaction must be explicitly started (C<'BEGIN WORK'>). B<* Databases which don't support transactions at all> For these databases, attempting to turn C off is a fatal error. C and C both issue warnings about being ineffective while C is in effect. B<* Databases in which a transaction is always active> These are typically mainstream commercial relational databases with "ANSI standard" transaction behaviour. If C is off, then changes to the database won't have any lasting effect unless L is called (but see also L). If L is called then any changes since the last commit are undone. If C is on, then the effect is the same as if the DBI called C automatically after every successful database operation. So calling C or C explicitly while C is on would be ineffective because the changes would have already been committed. Changing C from off to on will trigger a L. For databases which don't support a specific auto-commit mode, the driver has to commit each statement automatically using an explicit C after it completes successfully (and roll it back using an explicit C if it fails). The error information reported to the application will correspond to the statement which was executed, unless it succeeded and the commit or rollback failed. B<* Databases in which a transaction must be explicitly started> For these databases, the intention is to have them act like databases in which a transaction is always active (as described above). To do this, the driver will automatically begin an explicit transaction when C is turned off, or after a L or L (or when the application issues the next database operation after one of those events). In this way, the application does not have to treat these databases as a special case. See L, L and L for other important notes about transactions. =head3 C Type: handle Holds the handle of the parent driver. The only recommended use for this is to find the name of the driver using: $dbh->{Driver}->{Name} =head3 C Type: string Holds the "name" of the database. Usually (and recommended to be) the same as the "C" string used to connect to the database, but with the leading "C" removed. =head3 C Type: string, read-only Returns the statement string passed to the most recent L or L method called in this database handle, even if that method failed. This is especially useful where C is enabled and the exception handler checks $@ and sees that a 'prepare' method call failed. =head3 C Type: integer A hint to the driver indicating the size of the local row cache that the application would like the driver to use for future C 1 - Disable the local row cache >1 - Cache this many rows <0 - Cache as many rows that will fit into this much memory for each C statement, C returns the number of rows affected, if known. If no rows were affected, then C returns "C<0E0>", which Perl will treat as 0 but will regard as true. Note that it is I an error for no rows to be affected by a statement. If the number of rows affected is not known, then C returns -1. For C statement by checking if C<$sth-E{NUM_OF_FIELDS}> is greater than zero after calling C. If any arguments are given, then C will effectively call L for each value before executing the statement. Values bound in this way are usually treated as C types unless the driver can determine the correct type (which is rare), or unless C (or C) has already been used to specify the type. Note that passing C an empty array is the same as passing no arguments at all, which will execute the statement with previously bound values. That's probably not what you want. If execute() is called on a statement handle that's still active ($sth->{Active} is true) then it should effectively call finish() to tidy up the previous execution results before starting this new execution. =head3 C $tuples = $sth->execute_array(\%attr) or die $sth->errstr; $tuples = $sth->execute_array(\%attr, @bind_values) or die $sth->errstr; ($tuples, $rows) = $sth->execute_array(\%attr) or die $sth->errstr; ($tuples, $rows) = $sth->execute_array(\%attr, @bind_values) or die $sth->errstr; Execute the prepared statement once for each parameter tuple (group of values) provided either in the @bind_values, or by prior calls to L, or via a reference passed in \%attr. When called in scalar context the execute_array() method returns the number of tuples executed, or C if an error occurred. Like execute(), a successful execute_array() always returns true regardless of the number of tuples executed, even if it's zero. If there were any errors the ArrayTupleStatus array can be used to discover which tuples failed and with what errors. When called in list context the execute_array() method returns two scalars; $tuples is the same as calling execute_array() in scalar context and $rows is the number of rows affected for each tuple, if available or -1 if the driver cannot determine this. NOTE, some drivers cannot determine the number of rows affected per tuple but can provide the number of rows affected for the batch. If you are doing an update operation the returned rows affected may not be what you expect if, for instance, one or more of the tuples affected the same row multiple times. Some drivers may not yet support list context, in which case $rows will be undef, or may not be able to provide the number of rows affected when performing this batch operation, in which case $rows will be -1. Bind values for the tuples to be executed may be supplied row-wise by an C attribute, or else column-wise in the C<@bind_values> argument, or else column-wise by prior calls to L. Where column-wise binding is used (via the C<@bind_values> argument or calls to bind_param_array()) the maximum number of elements in any one of the bound value arrays determines the number of tuples executed. Placeholders with fewer values in their parameter arrays are treated as if padded with undef (NULL) values. If a scalar value is bound, instead of an array reference, it is treated as a I length array with all elements having the same value. It does not influence the number of tuples executed, so if all bound arrays have zero elements then zero tuples will be executed. If I bound values are scalars then one tuple will be executed, making execute_array() act just like execute(). The C attribute can be used to specify a reference to a subroutine that will be called to provide the bind values for each tuple execution. The subroutine should return an reference to an array which contains the appropriate number of bind values, or return an undef if there is no more data to execute. As a convenience, the C attribute can also be used to specify a statement handle. In which case the fetchrow_arrayref() method will be called on the given statement handle in order to provide the bind values for each tuple execution. The values specified via bind_param_array() or the @bind_values parameter may be either scalars, or arrayrefs. If any C<@bind_values> are given, then C will effectively call L for each value before executing the statement. Values bound in this way are usually treated as C types unless the driver can determine the correct type (which is rare), or unless C, C, C, or C has already been used to specify the type. See L for details. The C attribute can be used to specify a reference to an array which will receive the execute status of each executed parameter tuple. Note the C attribute was mandatory until DBI 1.38. For tuples which are successfully executed, the element at the same ordinal position in the status array is the resulting rowcount (or -1 if unknown). If the execution of a tuple causes an error, then the corresponding status array element will be set to a reference to an array containing L, L and L set by the failed execution. If B tuple execution returns an error, C will return C. In that case, the application should inspect the status array to determine which parameter tuples failed. Some databases may not continue executing tuples beyond the first failure. In this case the status array will either hold fewer elements, or the elements beyond the failure will be undef. If all parameter tuples are successfully executed, C returns the number tuples executed. If no tuples were executed, then execute_array() returns "C<0E0>", just like execute() does, which Perl will treat as 0 but will regard as true. For example: $sth = $dbh->prepare("INSERT INTO staff (first_name, last_name) VALUES (?, ?)"); my $tuples = $sth->execute_array( { ArrayTupleStatus => \my @tuple_status }, \@first_names, \@last_names, ); if ($tuples) { print "Successfully inserted $tuples records\n"; } else { for my $tuple (0..@last_names-1) { my $status = $tuple_status[$tuple]; $status = [0, "Skipped"] unless defined $status; next unless ref $status; printf "Failed to insert (%s, %s): %s\n", $first_names[$tuple], $last_names[$tuple], $status->[1]; } } Support for data returning statements such as SELECT is driver-specific and subject to change. At present, the default implementation provided by DBI only supports non-data returning statements. Transaction semantics when using array binding are driver and database specific. If C is on, the default DBI implementation will cause each parameter tuple to be individually committed (or rolled back in the event of an error). If C is off, the application is responsible for explicitly committing the entire set of bound parameter tuples. Note that different drivers and databases may have different behaviours when some parameter tuples cause failures. In some cases, the driver or database may automatically rollback the effect of all prior parameter tuples that succeeded in the transaction; other drivers or databases may retain the effect of prior successfully executed parameter tuples. Be sure to check your driver and database for its specific behaviour. Note that, in general, performance will usually be better with C turned off, and using explicit C after each C call. The C method was added in DBI 1.22, and ArrayTupleFetch was added in 1.36. =head3 C $tuples = $sth->execute_for_fetch($fetch_tuple_sub); $tuples = $sth->execute_for_fetch($fetch_tuple_sub, \@tuple_status); ($tuples, $rows) = $sth->execute_for_fetch($fetch_tuple_sub); ($tuples, $rows) = $sth->execute_for_fetch($fetch_tuple_sub, \@tuple_status); The execute_for_fetch() method is used to perform bulk operations and although it is most often used via the execute_array() method you can use it directly. The main difference between execute_array and execute_for_fetch is the former does column or row-wise binding and the latter uses row-wise binding. The fetch subroutine, referenced by $fetch_tuple_sub, is expected to return a reference to an array (known as a 'tuple') or undef. The execute_for_fetch() method calls $fetch_tuple_sub, without any parameters, until it returns a false value. Each tuple returned is used to provide bind values for an $sth->execute(@$tuple) call. In scalar context execute_for_fetch() returns C if there were any errors and the number of tuples executed otherwise. Like execute() and execute_array() a zero is returned as "0E0" so execute_for_fetch() is only false on error. If there were any errors the @tuple_status array can be used to discover which tuples failed and with what errors. When called in list context execute_for_fetch() returns two scalars; $tuples is the same as calling execute_for_fetch() in scalar context and $rows is the sum of the number of rows affected for each tuple, if available or -1 if the driver cannot determine this. If you are doing an update operation the returned rows affected may not be what you expect if, for instance, one or more of the tuples affected the same row multiple times. Some drivers may not yet support list context, in which case $rows will be undef, or may not be able to provide the number of rows affected when performing this batch operation, in which case $rows will be -1. If \@tuple_status is passed then the execute_for_fetch method uses it to return status information. The tuple_status array holds one element per tuple. If the corresponding execute() did not fail then the element holds the return value from execute(), which is typically a row count. If the execute() did fail then the element holds a reference to an array containing ($sth->err, $sth->errstr, $sth->state). If the driver detects an error that it knows means no further tuples can be executed then it may return, with an error status, even though $fetch_tuple_sub may still have more tuples to be executed. Although each tuple returned by $fetch_tuple_sub is effectively used to call $sth->execute(@$tuple_array_ref) the exact timing may vary. Drivers are free to accumulate sets of tuples to pass to the database server in bulk group operations for more efficient execution. However, the $fetch_tuple_sub is specifically allowed to return the same array reference each time (which is what fetchrow_arrayref() usually does). For example: my $sel = $dbh1->prepare("select foo, bar from table1"); $sel->execute; my $ins = $dbh2->prepare("insert into table2 (foo, bar) values (?,?)"); my $fetch_tuple_sub = sub { $sel->fetchrow_arrayref }; my @tuple_status; $rc = $ins->execute_for_fetch($fetch_tuple_sub, \@tuple_status); my @errors = grep { ref $_ } @tuple_status; Similarly, if you already have an array containing the data rows to be processed you'd use a subroutine to shift off and return each array ref in turn: $ins->execute_for_fetch( sub { shift @array_of_arrays }, \@tuple_status); The C method was added in DBI 1.38. =head3 C $rv = $sth->last_insert_id(); $rv = $sth->last_insert_id($catalog, $schema, $table, $field); $rv = $sth->last_insert_id($catalog, $schema, $table, $field, \%attr); Returns a value 'identifying' the row inserted by last execution of the statement C<$sth>, if possible. For some drivers the value may be 'identifying' the row inserted by the last executed statement, not by C<$sth>. See database handle method last_insert_id for all details. The C statement method was added in DBI 1.642. =head3 C $ary_ref = $sth->fetchrow_arrayref; $ary_ref = $sth->fetch; # alias Fetches the next row of data and returns a reference to an array holding the field values. Null fields are returned as C values in the array. This is the fastest way to fetch data, particularly if used with C<$sth-Ebind_columns>. If there are no more rows or if an error occurs, then C returns an C. You should check C<$sth-Eerr> afterwards (or use the C attribute) to discover if the C returned was due to an error. Note that the same array reference is returned for each fetch, so don't store the reference and then use it after a later fetch. Also, the elements of the array are also reused for each row, so take care if you want to take a reference to an element. See also L. =head3 C @ary = $sth->fetchrow_array; An alternative to C. Fetches the next row of data and returns it as a list containing the field values. Null fields are returned as C values in the list. If there are no more rows or if an error occurs, then C returns an empty list. You should check C<$sth-Eerr> afterwards (or use the C attribute) to discover if the empty list returned was due to an error. If called in a scalar context for a statement handle that has more than one column, it is undefined whether the driver will return the value of the first column or the last. So don't do that. Also, in a scalar context, an C is returned if there are no more rows or if an error occurred. That C can't be distinguished from an C returned because the first field value was NULL. For these reasons you should exercise some caution if you use C in a scalar context. =head3 C $hash_ref = $sth->fetchrow_hashref; $hash_ref = $sth->fetchrow_hashref($name); An alternative to C. Fetches the next row of data and returns it as a reference to a hash containing field name and field value pairs. Null fields are returned as C values in the hash. If there are no more rows or if an error occurs, then C returns an C. You should check C<$sth-Eerr> afterwards (or use the C attribute) to discover if the C returned was due to an error. The optional C<$name> parameter specifies the name of the statement handle attribute. For historical reasons it defaults to "C", however using either "C" or "C" is recommended for portability. The keys of the hash are the same names returned by C<$sth-E{$name}>. If more than one field has the same name, there will only be one entry in the returned hash for those fields, so statements like "C" or "C statement, the driver will automatically call C for you. So you should I call it explicitly I when you know that you've not fetched all the data from a statement handle I the handle won't be destroyed soon. The most common example is when you only want to fetch just one row, but in that case the C methods are usually better anyway. Consider a query like: SELECT foo FROM table WHERE bar=? ORDER BY baz on a very large table. When executed, the database server will have to use temporary buffer space to store the sorted rows. If, after executing the handle and selecting just a few rows, the handle won't be re-executed for some time and won't be destroyed, the C method can be used to tell the server that the buffer space can be freed. Calling C resets the L attribute for the statement. It may also make some statement handle attributes (such as C and C) unavailable if they have not already been accessed (and thus cached). The C method does not affect the transaction status of the database connection. It has nothing to do with transactions. It's mostly an internal "housekeeping" method that is rarely needed. See also L and the L attribute. The C method should have been called C. =head3 C $rv = $sth->rows; Returns the number of rows affected by the last row affecting command, or -1 if the number of rows is not known or not available. Generally, you can only rely on a row count after a I-C statement. For C statements is not recommended. One alternative method to get a row count for a C statement. Column numbers count up from 1. You do not need to bind output columns in order to fetch data. For maximum portability between drivers, bind_col() should be called after execute() and not before. See also L for an example. The binding is performed at a low level using Perl aliasing. Whenever a row is fetched from the database $var_to_bind appears to be automatically updated simply because it now refers to the same memory location as the corresponding column value. This makes using bound variables very efficient. Binding a tied variable doesn't work, currently. The L method performs a similar, but opposite, function for input variables. B The C<\%attr> parameter can be used to hint at the data type formatting the column should have. For example, you can use: $sth->bind_col(1, undef, { TYPE => SQL_DATETIME }); to specify that you'd like the column (which presumably is some kind of datetime type) to be returned in the standard format for SQL_DATETIME, which is 'YYYY-MM-DD HH:MM:SS', rather than the native formatting the database would normally use. There's no $var_to_bind in that example to emphasize the point that bind_col() works on the underlying column and not just a particular bound variable. As a short-cut for the common case, the data type can be passed directly, in place of the C<\%attr> hash reference. This example is equivalent to the one above: $sth->bind_col(1, undef, SQL_DATETIME); The C value indicates the standard (non-driver-specific) type for this parameter. To specify the driver-specific type, the driver may support a driver-specific attribute, such as C<{ ora_type =E 97 }>. The SQL_DATETIME and other related constants can be imported using use DBI qw(:sql_types); See L for more information. Few drivers support specifying a data type via a C call (most will simply ignore the data type). Fewer still allow the data type to be altered once set. If you do set a column type the type should remain sticky through further calls to bind_col for the same column if the type is not overridden (this is important for instance when you are using a slice in fetchall_arrayref). The TYPE attribute for bind_col() was first specified in DBI 1.41. From DBI 1.611, drivers can use the C attribute to attempt to cast the bound scalar to a perl type which more closely matches C. At present DBI supports C, C and C. See L for details of how types are cast. B The C<\%attr> parameter may also contain the following attributes: =over =item C If a C attribute is passed to bind_col, then the driver will attempt to change the bound perl scalar to match the type more closely. If the bound value cannot be cast to the requested C then by default it is left untouched and no error is generated. If you specify C as 1 and the cast fails, this will generate an error. This attribute was first added in DBI 1.611. When 1.611 was released few drivers actually supported this attribute but DBD::Oracle and DBD::ODBC should from versions 1.24. =item C When the C attribute is passed to L and the driver successfully casts the bound perl scalar to a non-string type then if C is set to 1, the string portion of the scalar will be discarded. By default, C is not set. This attribute was first added in DBI 1.611. When 1.611 was released few drivers actually supported this attribute but DBD::Oracle and DBD::ODBC should from versions 1.24. =back =head3 C $rc = $sth->bind_columns(@list_of_refs_to_vars_to_bind); Calls L for each column of the C statement. If it doesn't then C will bind the elements given, up to the number of columns, and then return an error. For maximum portability between drivers, bind_columns() should be called after execute() and not before. For example: $dbh->{RaiseError} = 1; # do this, or check every call for errors $sth = $dbh->prepare(q{ SELECT region, sales FROM sales_by_region }); $sth->execute; my ($region, $sales); # Bind Perl variables to columns: $rv = $sth->bind_columns(\$region, \$sales); # you can also use Perl's \(...) syntax (see perlref docs): # $sth->bind_columns(\($region, $sales)); # Column binding is the most efficient way to fetch data while ($sth->fetch) { print "$region: $sales\n"; } For compatibility with old scripts, the first parameter will be ignored if it is C or a hash reference. Here's a more fancy example that binds columns to the values I a hash (thanks to H.Merijn Brand): $sth->execute; my %row; $sth->bind_columns (\( @row{ @{$sth->{NAME_lc} }} )); while ($sth->fetch) { print "$row{region}: $row{sales}\n"; } but has a small drawback: If the data has already been fetched, the call to L will flush current values. If you want to bind_columns after you have fetched, you can use: use feature "refaliasing"; no warnings "experimental::refaliasing"; while (my $row = $sth->fetchrow_arrayref) { \(@$data{ $sth->{NAME_lc}->@* }) = \(@$row); } or, with older perl versions: use Data::Alias; alias @$data{ $sth->{NAME_lc}->@* } = @$row; This is useful in situations when you have many left joins, but want to join your %$data hash to only subset of fetched values. =head3 C $rows = $sth->dump_results($maxlen, $lsep, $fsep, $fh); Fetches all the rows from C<$sth>, calls C for each row, and prints the results to C<$fh> (defaults to C) separated by C<$lsep> (default C<"\n">). C<$fsep> defaults to C<", "> and C<$maxlen> defaults to 35. This method is designed as a handy utility for prototyping and testing queries. Since it uses L to format and edit the string for reading by humans, it is not recommended for data transfer applications. =head2 Statement Handle Attributes This section describes attributes specific to statement handles. Most of these attributes are read-only. Changes to these statement handle attributes do not affect any other existing or future statement handles. Attempting to set or get the value of an unknown attribute generates a warning, except for private driver specific attributes (which all have names starting with a lowercase letter). Example: ... = $h->{NUM_OF_FIELDS}; # get/read Some drivers cannot provide valid values for some or all of these attributes until after C<$sth-Eexecute> has been successfully called. Typically the attribute will be C in these situations. Some attributes, like NAME, are not appropriate to some types of statement, like SELECT. Typically the attribute will be C in these situations. For drivers which support stored procedures and multiple result sets (see L) these attributes relate to the I result set. See also L to learn more about the effect it may have on some attributes. =head3 C Type: integer, read-only Number of fields (columns) in the data the prepared statement may return. Statements that don't return rows of data, like C and C set C to 0 (though it may be undef in some drivers). =head3 C Type: integer, read-only The number of parameters (placeholders) in the prepared statement. See SUBSTITUTION VARIABLES below for more details. =head3 C Type: array-ref, read-only Returns a reference to an array of field names for each column. The names may contain spaces but should not be truncated or have any trailing space. Note that the names have the letter case (upper, lower or mixed) as returned by the driver being used. Portable applications should use L or L. print "First column name: $sth->{NAME}->[0]\n"; Also note that the name returned for (aggregate) functions like C or C is determined by the database server and not by C or the C backend. =head3 C Type: array-ref, read-only Like C but always returns lowercase names. =head3 C Type: array-ref, read-only Like C but always returns uppercase names. =head3 C Type: hash-ref, read-only =head3 C Type: hash-ref, read-only =head3 C Type: hash-ref, read-only The C, C, and C attributes return column name information as a reference to a hash. The keys of the hash are the names of the columns. The letter case of the keys corresponds to the letter case returned by the C, C, and C attributes respectively (as described above). The value of each hash entry is the perl index number of the corresponding column (counting from 0). For example: $sth = $dbh->prepare("select Id, Name from table"); $sth->execute; @row = $sth->fetchrow_array; print "Name $row[ $sth->{NAME_lc_hash}{name} ]\n"; =head3 C Type: array-ref, read-only Returns a reference to an array of integer values for each column. The value indicates the data type of the corresponding column. The values correspond to the international standards (ANSI X3.135 and ISO/IEC 9075) which, in general terms, means ODBC. Driver-specific types that don't exactly match standard types should generally return the same values as an ODBC driver supplied by the makers of the database. That might include private type numbers in ranges the vendor has officially registered with the ISO working group: ftp://sqlstandards.org/SC32/SQL_Registry/ Where there's no vendor-supplied ODBC driver to be compatible with, the DBI driver can use type numbers in the range that is now officially reserved for use by the DBI: -9999 to -9000. All possible values for C should have at least one entry in the output of the C method (see L). =head3 C Type: array-ref, read-only Returns a reference to an array of integer values for each column. For numeric columns, the value is the maximum number of digits (without considering a sign character or decimal point). Note that the "display size" for floating point types (REAL, FLOAT, DOUBLE) can be up to 7 characters greater than the precision (for the sign + decimal point + the letter E + a sign + 2 or 3 digits). For any character type column the value is the OCTET_LENGTH, in other words the number of bytes, not characters. (More recent standards refer to this as COLUMN_SIZE but we stick with PRECISION for backwards compatibility.) =head3 C Type: array-ref, read-only Returns a reference to an array of integer values for each column. NULL (C) values indicate columns where scale is not applicable. =head3 C Type: array-ref, read-only Returns a reference to an array indicating the possibility of each column returning a null. Possible values are C<0> (or an empty string) = no, C<1> = yes, C<2> = unknown. print "First column may return NULL\n" if $sth->{NULLABLE}->[0]; =head3 C Type: string, read-only Returns the name of the cursor associated with the statement handle, if available. If not available or if the database driver does not support the C<"where current of ..."> SQL syntax, then it returns C. =head3 C Type: dbh, read-only Returns the parent $dbh of the statement handle. =head3 C Type: string, read-only Returns the statement string passed to the L method. =head3 C Type: hash ref, read-only Returns a reference to a hash containing the values currently bound to placeholders. The keys of the hash are the 'names' of the placeholders, typically integers starting at 1. Returns undef if not supported by the driver. See L for an example of how this is used. * Keys: If the driver supports C but no values have been bound yet then the driver should return a hash with placeholders names in the keys but all the values undef, but some drivers may return a ref to an empty hash because they can't pre-determine the names. It is possible that the keys in the hash returned by C are not exactly the same as those implied by the prepared statement. For example, DBD::Oracle translates 'C' placeholders into 'C<:pN>' where N is a sequence number starting at 1. * Values: It is possible that the values in the hash returned by C are not I the same as those passed to bind_param() or execute(). The driver may have slightly modified values in some way based on the TYPE the value was bound with. For example a floating point value bound as an SQL_INTEGER type may be returned as an integer. The values returned by C can be passed to another bind_param() method with the same TYPE and will be seen by the database as the same value. See also L below. The C attribute was added in DBI 1.28. =head3 C Type: hash ref, read-only Returns a reference to a hash containing the type information currently bound to placeholders. Returns undef if not supported by the driver. * Keys: See L above. * Values: The hash values are hashrefs of type information in the same form as that passed to the various bind_param() methods (See L for the format and values). It is possible that the values in the hash returned by C are not exactly the same as those passed to bind_param() or execute(). Param attributes specified using the abbreviated form, like this: $sth->bind_param(1, SQL_INTEGER); are returned in the expanded form, as if called like this: $sth->bind_param(1, { TYPE => SQL_INTEGER }); The driver may have modified the type information in some way based on the bound values, other hints provided by the prepare()'d SQL statement, or alternate type mappings required by the driver or target database system. The driver may also add private keys (with names beginning with the drivers reserved prefix, e.g., odbc_xxx). * Example: The keys and values in the returned hash can be passed to the various bind_param() methods to effectively reproduce a previous param binding. For example: # assuming $sth1 is a previously prepared statement handle my $sth2 = $dbh->prepare( $sth1->{Statement} ); my $ParamValues = $sth1->{ParamValues} || {}; my $ParamTypes = $sth1->{ParamTypes} || {}; $sth2->bind_param($_, $ParamValues->{$_}, $ParamTypes->{$_}) for keys %{ {%$ParamValues, %$ParamTypes} }; $sth2->execute(); The C attribute was added in DBI 1.49. Implementation is the responsibility of individual drivers; the DBI layer default implementation simply returns undef. =head3 C Type: hash ref, read-only Returns a reference to a hash containing the values currently bound to placeholders with L or L. The keys of the hash are the 'names' of the placeholders, typically integers starting at 1. Returns undef if not supported by the driver or no arrays of parameters are bound. Each key value is an array reference containing a list of the bound parameters for that column. For example: $sth = $dbh->prepare("INSERT INTO staff (id, name) values (?,?)"); $sth->execute_array({},[1,2], ['fred','dave']); if ($sth->{ParamArrays}) { foreach $param (keys %{$sth->{ParamArrays}}) { printf "Parameters for %s : %s\n", $param, join(",", @{$sth->{ParamArrays}->{$param}}); } } It is possible that the values in the hash returned by C are not I the same as those passed to L or L. The driver may have slightly modified values in some way based on the TYPE the value was bound with. For example a floating point value bound as an SQL_INTEGER type may be returned as an integer. It is also possible that the keys in the hash returned by C are not exactly the same as those implied by the prepared statement. For example, DBD::Oracle translates 'C' placeholders into 'C<:pN>' where N is a sequence number starting at 1. =head3 C Type: integer, read-only If the driver supports a local row cache for C statement handle that's a child of the same database handle. A typical way round this is to connect the the database twice and use one connection for C statement (unlike other data types), some special handling is required. In this situation, the value of the C<$h-E{LongReadLen}> attribute is used to determine how much buffer space to allocate when fetching such fields. The C<$h-E{LongTruncOk}> attribute is used to determine how to behave if a fetched value can't fit into the buffer. See the description of L for more information. When trying to insert long or binary values, placeholders should be used since there are often limits on the maximum size of an C statement and the L method generally can't cope with binary data. See L. =head2 Simple Examples Here's a complete example program to select and fetch some data: my $data_source = "dbi::DriverName:db_name"; my $dbh = DBI->connect($data_source, $user, $password) or die "Can't connect to $data_source: $DBI::errstr"; my $sth = $dbh->prepare( q{ SELECT name, phone FROM mytelbook }) or die "Can't prepare statement: $DBI::errstr"; my $rc = $sth->execute or die "Can't execute statement: $DBI::errstr"; print "Query will return $sth->{NUM_OF_FIELDS} fields.\n\n"; print "Field names: @{ $sth->{NAME} }\n"; while (($name, $phone) = $sth->fetchrow_array) { print "$name: $phone\n"; } # check for problems which may have terminated the fetch early die $sth->errstr if $sth->err; $dbh->disconnect; Here's a complete example program to insert some data from a file. (This example uses C to avoid needing to check each call). my $dbh = DBI->connect("dbi:DriverName:db_name", $user, $password, { RaiseError => 1, AutoCommit => 0 }); my $sth = $dbh->prepare( q{ INSERT INTO table (name, phone) VALUES (?, ?) }); open FH, ") { chomp; my ($name, $phone) = split /,/; $sth->execute($name, $phone); } close FH; $dbh->commit; $dbh->disconnect; Here's how to convert fetched NULLs (undefined values) into empty strings: while($row = $sth->fetchrow_arrayref) { # this is a fast and simple way to deal with nulls: foreach (@$row) { $_ = '' unless defined } print "@$row\n"; } The C style quoting used in these examples avoids clashing with quotes that may be used in the SQL statement. Use the double-quote like C operator if you want to interpolate variables into the string. See L for more details. =head2 Threads and Thread Safety Perl 5.7 and later support a new threading model called iThreads. (The old "5.005 style" threads are not supported by the DBI.) In the iThreads model each thread has its own copy of the perl interpreter. When a new thread is created the original perl interpreter is 'cloned' to create a new copy for the new thread. If the DBI and drivers are loaded and handles created before the thread is created then it will get a cloned copy of the DBI, the drivers and the handles. However, the internal pointer data within the handles will refer to the DBI and drivers in the original interpreter. Using those handles in the new interpreter thread is not safe, so the DBI detects this and croaks on any method call using handles that don't belong to the current thread (except for DESTROY). Because of this (possibly temporary) restriction, newly created threads must make their own connections to the database. Handles can't be shared across threads. But BEWARE, some underlying database APIs (the code the DBD driver uses to talk to the database, often supplied by the database vendor) are not thread safe. If it's not thread safe, then allowing more than one thread to enter the code at the same time may cause subtle/serious problems. In some cases allowing more than one thread to enter the code, even if I at the same time, can cause problems. You have been warned. Using DBI with perl threads is not yet recommended for production environments. For more information see L Note: There is a bug in perl 5.8.2 when configured with threads and debugging enabled (bug #24463) which would cause some DBI tests to fail. These tests have been disabled for perl-5.8.2 and below. Tests for inner method cache are disabled for perl-5.10.x =head2 Signal Handling and Canceling Operations [The following only applies to systems with unix-like signal handling. I'd welcome additions for other systems, especially Windows.] The first thing to say is that signal handling in Perl versions less than 5.8 is I safe. There is always a small risk of Perl crashing and/or core dumping when, or after, handling a signal because the signal could arrive and be handled while internal data structures are being changed. If the signal handling code used those same internal data structures it could cause all manner of subtle and not-so-subtle problems. The risk was reduced with 5.4.4 but was still present in all perls up through 5.8.0. Beginning in perl 5.8.0 perl implements 'safe' signal handling if your system has the POSIX sigaction() routine. Now when a signal is delivered perl just makes a note of it but does I run the %SIG handler. The handling is 'deferred' until a 'safe' moment. Although this change made signal handling safe, it also lead to a problem with signals being deferred for longer than you'd like. If a signal arrived while executing a system call, such as waiting for data on a network connection, the signal is noted and then the system call that was executing returns with an EINTR error code to indicate that it was interrupted. All fine so far. The problem comes when the code that made the system call sees the EINTR code and decides it's going to call it again. Perl doesn't do that, but database code sometimes does. If that happens then the signal handler doesn't get called until later. Maybe much later. Fortunately there are ways around this which we'll discuss below. Unfortunately they make signals unsafe again. The two most common uses of signals in relation to the DBI are for canceling operations when the user types Ctrl-C (interrupt), and for implementing a timeout using C and C<$SIG{ALRM}>. =over 4 =item Cancel The DBI provides a C method for statement handles. The C method should abort the current operation and is designed to be called from a signal handler. For example: $SIG{INT} = sub { $sth->cancel }; However, few drivers implement this (the DBI provides a default method that just returns C) and, even if implemented, there is still a possibility that the statement handle, and even the parent database handle, will not be usable afterwards. If C returns true, then it has successfully invoked the database engine's own cancel function. If it returns false, then C failed. If it returns C, then the database driver does not have cancel implemented - very few do. =item Timeout The traditional way to implement a timeout is to set C<$SIG{ALRM}> to refer to some code that will be executed when an ALRM signal arrives and then to call alarm($seconds) to schedule an ALRM signal to be delivered $seconds in the future. For example: my $failed; eval { local $SIG{ALRM} = sub { die "TIMEOUT\n" }; # N.B. \n required eval { alarm($seconds); ... code to execute with timeout here (which may die) ... 1; } or $failed = 1; # outer eval catches alarm that might fire JUST before this alarm(0) alarm(0); # cancel alarm (if code ran fast) die "$@" if $failed; 1; } or $failed = 1; if ( $failed ) { if ( defined $@ and $@ eq "TIMEOUT\n" ) { ... } else { ... } # some other error } The first (outer) eval is used to avoid the unlikely but possible chance that the "code to execute" dies and the alarm fires before it is cancelled. Without the outer eval, if this happened your program will die if you have no ALRM handler or a non-local alarm handler will be called. Unfortunately, as described above, this won't always work as expected, depending on your perl version and the underlying database code. With Oracle for instance (DBD::Oracle), if the system which hosts the database is down the DBI->connect() call will hang for several minutes before returning an error. =back The solution on these systems is to use the C routine to gain low level access to how the signal handler is installed. The code would look something like this (for the DBD-Oracle connect()): use POSIX qw(:signal_h); my $mask = POSIX::SigSet->new( SIGALRM ); # signals to mask in the handler my $action = POSIX::SigAction->new( sub { die "connect timeout\n" }, # the handler code ref $mask, # not using (perl 5.8.2 and later) 'safe' switch or sa_flags ); my $oldaction = POSIX::SigAction->new(); sigaction( SIGALRM, $action, $oldaction ); my $dbh; my $failed; eval { eval { alarm(5); # seconds before time out $dbh = DBI->connect("dbi:Oracle:$dsn" ... ); 1; } or $failed = 1; alarm(0); # cancel alarm (if connect worked fast) die "$@\n" if $failed; # connect died 1; } or $failed = 1; sigaction( SIGALRM, $oldaction ); # restore original signal handler if ( $failed ) { if ( defined $@ and $@ eq "connect timeout\n" ) {...} else { # connect died } } See previous example for the reasoning around the double eval. Similar techniques can be used for canceling statement execution. Unfortunately, this solution is somewhat messy, and it does I work with perl versions less than perl 5.8 where C appears to be broken. For a cleaner implementation that works across perl versions, see Lincoln Baxter's Sys::SigAction module at L. The documentation for Sys::SigAction includes an longer discussion of this problem, and a DBD::Oracle test script. Be sure to read all the signal handling sections of the L manual. And finally, two more points to keep firmly in mind. Firstly, remember that what we've done here is essentially revert to old style I handling of these signals. So do as little as possible in the handler. Ideally just die(). Secondly, the handles in use at the time the signal is handled may not be safe to use afterwards. =head2 Subclassing the DBI DBI can be subclassed and extended just like any other object oriented module. Before we talk about how to do that, it's important to be clear about the various DBI classes and how they work together. By default C<$dbh = DBI-Econnect(...)> returns a $dbh blessed into the C class. And the C<$dbh-Eprepare> method returns an $sth blessed into the C class (actually it simply changes the last four characters of the calling handle class to be C<::st>). The leading 'C' is known as the 'root class' and the extra 'C<::db>' or 'C<::st>' are the 'handle type suffixes'. If you want to subclass the DBI you'll need to put your overriding methods into the appropriate classes. For example, if you want to use a root class of C and override the do(), prepare() and execute() methods, then your do() and prepare() methods should be in the C class and the execute() method should be in the C class. To setup the inheritance hierarchy the @ISA variable in C should include C and the @ISA variable in C should include C. The C root class itself isn't currently used for anything visible and so, apart from setting @ISA to include C, it can be left empty. So, having put your overriding methods into the right classes, and setup the inheritance hierarchy, how do you get the DBI to use them? You have two choices, either a static method call using the name of your subclass: $dbh = MySubDBI->connect(...); or specifying a C attribute: $dbh = DBI->connect(..., { RootClass => 'MySubDBI' }); If both forms are used then the attribute takes precedence. The only differences between the two are that using an explicit RootClass attribute will a) make the DBI automatically attempt to load a module by that name if the class doesn't exist, and b) won't call your MySubDBI::connect() method, if you have one. When subclassing is being used then, after a successful new connect, the DBI->connect method automatically calls: $dbh->connected($dsn, $user, $pass, \%attr); The default method does nothing. The call is made just to simplify any post-connection setup that your subclass may want to perform. The parameters are the same as passed to DBI->connect. If your subclass supplies a connected method, it should be part of the MySubDBI::db package. One more thing to note: you must let the DBI do the handle creation. If you want to override the connect() method in your *::dr class then it must still call SUPER::connect to get a $dbh to work with. Similarly, an overridden prepare() method in *::db must still call SUPER::prepare to get a $sth. If you try to create your own handles using bless() then you'll find the DBI will reject them with an "is not a DBI handle (has no magic)" error. Here's a brief example of a DBI subclass. A more thorough example can be found in F in the DBI distribution. package MySubDBI; use strict; use DBI; our @ISA = qw(DBI); package MySubDBI::db; our @ISA = qw(DBI::db); sub prepare { my ($dbh, @args) = @_; my $sth = $dbh->SUPER::prepare(@args) or return; $sth->{private_mysubdbi_info} = { foo => 'bar' }; return $sth; } package MySubDBI::st; our @ISA = qw(DBI::st); sub fetch { my ($sth, @args) = @_; my $row = $sth->SUPER::fetch(@args) or return; do_something_magical_with_row_data($row) or return $sth->set_err(1234, "The magic failed", undef, "fetch"); return $row; } When calling a SUPER::method that returns a handle, be careful to check the return value before trying to do other things with it in your overridden method. This is especially important if you want to set a hash attribute on the handle, as Perl's autovivification will bite you by (in)conveniently creating an unblessed hashref, which your method will then return with usually baffling results later on like the error "dbih_getcom handle HASH(0xa4451a8) is not a DBI handle (has no magic". It's best to check right after the call and return undef immediately on error, just like DBI would and just like the example above. If your method needs to record an error it should call the set_err() method with the error code and error string, as shown in the example above. The error code and error string will be recorded in the handle and available via C<$h-Eerr> and C<$DBI::errstr> etc. The set_err() method always returns an undef or empty list as appropriate. Since your method should nearly always return an undef or empty list as soon as an error is detected it's handy to simply return what set_err() returns, as shown in the example above. If the handle has C, C, or C etc. set then the set_err() method will honour them. This means that if C is set then set_err() won't return in the normal way but will 'throw an exception' that can be caught with an C block. You can stash private data into DBI handles via C<$h-E{private_..._*}>. See the entry under L for info and important caveats. =head2 Memory Leaks When tracking down memory leaks using tools like L you'll find that some DBI internals are reported as 'leaking' memory. This is very unlikely to be a real leak. The DBI has various caches to improve performance and the apparent leaks are simply the normal operation of these caches. The most frequent sources of the apparent leaks are L, L and L. For example http://stackoverflow.com/questions/13338308/perl-dbi-memory-leak Given how widely the DBI is used, you can rest assured that if a new release of the DBI did have a real leak it would be discovered, reported, and fixed immediately. The leak you're looking for is probably elsewhere. Good luck! =head1 TRACING The DBI has a powerful tracing mechanism built in. It enables you to see what's going on 'behind the scenes', both within the DBI and the drivers you're using. =head2 Trace Settings Which details are written to the trace output is controlled by a combination of a I, an integer from 0 to 15, and a set of I that are either on or off. Together these are known as the I and are stored together in a single integer. For normal use you only need to set the trace level, and generally only to a value between 1 and 4. Each handle has its own trace settings, and so does the DBI. When you call a method the DBI merges the handles settings into its own for the duration of the call: the trace flags of the handle are OR'd into the trace flags of the DBI, and if the handle has a higher trace level then the DBI trace level is raised to match it. The previous DBI trace settings are restored when the called method returns. =head2 Trace Levels Trace I are as follows: 0 - Trace disabled. 1 - Trace top-level DBI method calls returning with results or errors. 2 - As above, adding tracing of top-level method entry with parameters. 3 - As above, adding some high-level information from the driver and some internal information from the DBI. 4 - As above, adding more detailed information from the driver. This is the first level to trace all the rows being fetched. 5 to 15 - As above but with more and more internal information. Trace level 1 is best for a simple overview of what's happening. Trace levels 2 thru 4 a good choice for general purpose tracing. Levels 5 and above are best reserved for investigating a specific problem, when you need to see "inside" the driver and DBI. The trace output is detailed and typically very useful. Much of the trace output is formatted using the L function, so strings in the trace output may be edited and truncated by that function. =head2 Trace Flags Trace I are used to enable tracing of specific activities within the DBI and drivers. The DBI defines some trace flags and drivers can define others. DBI trace flag names begin with a capital letter and driver specific names begin with a lowercase letter, as usual. Currently the DBI defines these trace flags: ALL - turn on all DBI and driver flags (not recommended) SQL - trace SQL statements executed (not yet implemented in DBI but implemented in some DBDs) CON - trace connection process ENC - trace encoding (unicode translations etc) (not yet implemented in DBI but implemented in some DBDs) DBD - trace only DBD messages (not implemented by all DBDs yet) TXN - trace transactions (not implemented in all DBDs yet) The L and L methods are used to convert trace flag names into the corresponding integer bit flags. =head2 Enabling Trace The C<$h-Etrace> method sets the trace settings for a handle and Ctrace> does the same for the DBI. In addition to the L method, you can enable the same trace information, and direct the output to a file, by setting the C environment variable before starting Perl. See L for more information. Finally, you can set, or get, the trace settings for a handle using the C attribute. All of those methods use parse_trace_flags() and so allow you set both the trace level and multiple trace flags by using a string containing the trace level and/or flag names separated by vertical bar ("C<|>") or comma ("C<,>") characters. For example: local $h->{TraceLevel} = "3|SQL|foo"; =head2 Trace Output Initially trace output is written to C. Both the C<$h-Etrace> and Ctrace> methods take an optional $trace_file parameter, which may be either the name of a file to be opened by DBI in append mode, or a reference to an existing writable (possibly layered) filehandle. If $trace_file is a filename, and can be opened in append mode, or $trace_file is a writable filehandle, then I trace output (currently including that from other handles) is redirected to that file. A warning is generated if $trace_file can't be opened or is not writable. Further calls to trace() without $trace_file do not alter where the trace output is sent. If $trace_file is undefined, then trace output is sent to C and, if the prior trace was opened with $trace_file as a filename, the previous trace file is closed; if $trace_file was a filehandle, the filehandle is B closed. B: If $trace_file is specified as a filehandle, the filehandle should not be closed until all DBI operations are completed, or the application has reset the trace file via another call to C that changes the trace file. =head2 Tracing to Layered Filehandles B: =over 4 =item * Tied filehandles are not currently supported, as tie operations are not available to the PerlIO methods used by the DBI. =item * PerlIO layer support requires Perl version 5.8 or higher. =back As of version 5.8, Perl provides the ability to layer various "disciplines" on an open filehandle via the L module. A simple example of using PerlIO layers is to use a scalar as the output: my $scalar = ''; open( my $fh, "+>:scalar", \$scalar ); $dbh->trace( 2, $fh ); Now all trace output is simply appended to $scalar. A more complex application of tracing to a layered filehandle is the use of a custom layer (IL I). Consider an application with the following logger module: package MyFancyLogger; sub new { my $self = {}; my $fh; open $fh, '>', 'fancylog.log'; $self->{_fh} = $fh; $self->{_buf} = ''; return bless $self, shift; } sub log { my $self = shift; return unless exists $self->{_fh}; my $fh = $self->{_fh}; $self->{_buf} .= shift; # # DBI feeds us pieces at a time, so accumulate a complete line # before outputting # print $fh "At ", scalar localtime(), ':', $self->{_buf}, "\n" and $self->{_buf} = '' if $self->{_buf}=~tr/\n//; } sub close { my $self = shift; return unless exists $self->{_fh}; my $fh = $self->{_fh}; print $fh "At ", scalar localtime(), ':', $self->{_buf}, "\n" and $self->{_buf} = '' if $self->{_buf}; close $fh; delete $self->{_fh}; } 1; To redirect DBI traces to this logger requires creating a package for the layer: package PerlIO::via::MyFancyLogLayer; sub PUSHED { my ($class,$mode,$fh) = @_; my $logger; return bless \$logger,$class; } sub OPEN { my ($self, $path, $mode, $fh) = @_; # # $path is actually our logger object # $$self = $path; return 1; } sub WRITE { my ($self, $buf, $fh) = @_; $$self->log($buf); return length($buf); } sub CLOSE { my $self = shift; $$self->close(); return 0; } 1; The application can then cause DBI traces to be routed to the logger using use PerlIO::via::MyFancyLogLayer; open my $fh, '>:via(MyFancyLogLayer)', MyFancyLogger->new(); $dbh->trace('SQL', $fh); Now all trace output will be processed by MyFancyLogger's log() method. =head2 Trace Content Many of the values embedded in trace output are formatted using the neat() utility function. This means they may be quoted, sanitized, and possibly truncated if longer than C<$DBI::neat_maxlen>. See L for more details. =head2 Tracing Tips You can add tracing to your own application code using the L method. It can sometimes be handy to compare trace files from two different runs of the same script. However using a tool like C on the original log output doesn't work well because the trace file is full of object addresses that may differ on each run. The DBI includes a handy utility called dbilogstrip that can be used to 'normalize' the log content. It can be used as a filter like this: DBI_TRACE=2 perl yourscript.pl ...args1... 2>&1 | dbilogstrip > dbitrace1.log DBI_TRACE=2 perl yourscript.pl ...args2... 2>&1 | dbilogstrip > dbitrace2.log diff -u dbitrace1.log dbitrace2.log See L for more information. =head1 DBI ENVIRONMENT VARIABLES The DBI module recognizes a number of environment variables, but most of them should not be used most of the time. It is better to be explicit about what you are doing to avoid the need for environment variables, especially in a web serving system where web servers are stingy about which environment variables are available. =head2 DBI_DSN The DBI_DSN environment variable is used by DBI->connect if you do not specify a data source when you issue the connect. It should have a format such as "dbi:Driver:databasename". =head2 DBI_DRIVER The DBI_DRIVER environment variable is used to fill in the database driver name in DBI->connect if the data source string starts "dbi::" (thereby omitting the driver). If DBI_DSN omits the driver name, DBI_DRIVER can fill the gap. =head2 DBI_AUTOPROXY The DBI_AUTOPROXY environment variable takes a string value that starts "dbi:Proxy:" and is typically followed by "hostname=...;port=...". It is used to alter the behaviour of DBI->connect. For full details, see DBI::Proxy documentation. =head2 DBI_USER The DBI_USER environment variable takes a string value that is used as the user name if the DBI->connect call is given undef (as distinct from an empty string) as the username argument. Be wary of the security implications of using this. =head2 DBI_PASS The DBI_PASS environment variable takes a string value that is used as the password if the DBI->connect call is given undef (as distinct from an empty string) as the password argument. Be extra wary of the security implications of using this. =head2 DBI_DBNAME (obsolete) The DBI_DBNAME environment variable takes a string value that is used only when the obsolescent style of DBI->connect (with driver name as fourth parameter) is used, and when no value is provided for the first (database name) argument. =head2 DBI_TRACE The DBI_TRACE environment variable specifies the global default trace settings for the DBI at startup. Can also be used to direct trace output to a file. When the DBI is loaded it does: DBI->trace(split /=/, $ENV{DBI_TRACE}, 2) if $ENV{DBI_TRACE}; So if C contains an "C<=>" character then what follows it is used as the name of the file to append the trace to. output appended to that file. If the name begins with a number followed by an equal sign (C<=>), then the number and the equal sign are stripped off from the name, and the number is used to set the trace level. For example: DBI_TRACE=1=dbitrace.log perl your_test_script.pl On Unix-like systems using a Bourne-like shell, you can do this easily on the command line: DBI_TRACE=2 perl your_test_script.pl See L for more information. =head2 PERL_DBI_DEBUG (obsolete) An old variable that should no longer be used; equivalent to DBI_TRACE. =head2 DBI_PROFILE The DBI_PROFILE environment variable can be used to enable profiling of DBI method calls. See L for more information. =head2 DBI_PUREPERL The DBI_PUREPERL environment variable can be used to enable the use of DBI::PurePerl. See L for more information. =head1 WARNING AND ERROR MESSAGES =head2 Fatal Errors =over 4 =item Can't call method "prepare" without a package or object reference The C<$dbh> handle you're using to call C is probably undefined because the preceding C failed. You should always check the return status of DBI methods, or use the L attribute. =item Can't call method "execute" without a package or object reference The C<$sth> handle you're using to call C is probably undefined because the preceding C failed. You should always check the return status of DBI methods, or use the L attribute. =item DBI/DBD internal version mismatch The DBD driver module was built with a different version of DBI than the one currently being used. You should rebuild the DBD module under the current version of DBI. (Some rare platforms require "static linking". On those platforms, there may be an old DBI or DBD driver version actually embedded in the Perl executable being used.) =item DBD driver has not implemented the AutoCommit attribute The DBD driver implementation is incomplete. Consult the author. =item Can't [sg]et %s->{%s}: unrecognised attribute You attempted to set or get an unknown attribute of a handle. Make sure you have spelled the attribute name correctly; case is significant (e.g., "Autocommit" is not the same as "AutoCommit"). =back =head1 Pure-Perl DBI A pure-perl emulation of the DBI is included in the distribution for people using pure-perl drivers who, for whatever reason, can't install the compiled DBI. See L. =head1 SEE ALSO =head2 Driver and Database Documentation Refer to the documentation for the DBD driver that you are using. Refer to the SQL Language Reference Manual for the database engine that you are using. =head2 ODBC and SQL/CLI Standards Reference Information More detailed information about the semantics of certain DBI methods that are based on ODBC and SQL/CLI standards is available on-line via microsoft.com, for ODBC, and www.jtc1sc32.org for the SQL/CLI standard: DBI method ODBC function SQL/CLI Working Draft ---------- ------------- --------------------- column_info SQLColumns Page 124 foreign_key_info SQLForeignKeys Page 163 get_info SQLGetInfo Page 214 primary_key_info SQLPrimaryKeys Page 254 table_info SQLTables Page 294 type_info SQLGetTypeInfo Page 239 statistics_info SQLStatistics To find documentation on the ODBC function you can use the MSDN search facility at: http://msdn.microsoft.com/Search and search for something like C<"SQLColumns returns">. And for SQL/CLI standard information on SQLColumns you'd read page 124 of the (very large) SQL/CLI Working Draft available from: http://jtc1sc32.org/doc/N0701-0750/32N0744T.pdf =head2 Standards Reference Information A hyperlinked, browsable version of the BNF syntax for SQL92 (plus Oracle 7 SQL and PL/SQL) is available here: http://cui.unige.ch/db-research/Enseignement/analyseinfo/SQL92/BNFindex.html You can find more information about SQL standards online by searching for the appropriate standard names and numbers. For example, searching for "ANSI/ISO/IEC International Standard (IS) Database Language SQL - Part 1: SQL/Framework" you'll find a copy at: ftp://ftp.iks-jena.de/mitarb/lutz/standards/sql/ansi-iso-9075-1-1999.pdf =head2 Books and Articles Programming the Perl DBI, by Alligator Descartes and Tim Bunce. L Programming Perl 3rd Ed. by Larry Wall, Tom Christiansen & Jon Orwant. L Learning Perl by Randal Schwartz. L Details of many other books related to perl can be found at L =head2 Perl Modules Index of DBI related modules available from CPAN: L L L For a good comparison of RDBMS-OO mappers and some OO-RDBMS mappers (including Class::DBI, Alzabo, and DBIx::RecordSet in the former category and Tangram and SPOPS in the latter) see the Perl Object-Oriented Persistence project pages at: http://poop.sourceforge.net A similar page for Java toolkits can be found at: http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison =head2 Mailing List The I mailing list is the primary means of communication among users of the DBI and its related modules. For details send email to: L There are typically between 700 and 900 messages per month. You have to subscribe in order to be able to post. However you can opt for a 'post-only' subscription. Mailing list archives (of variable quality) are held at: http://groups.google.com/groups?group=perl.dbi.users http://www.xray.mpe.mpg.de/mailing-lists/dbi/ http://www.mail-archive.com/dbi-users%40perl.org/ =head2 Assorted Related Links The DBI "Home Page": http://dbi.perl.org/ Other DBI related links: http://www.perlmonks.org/?node=DBI%20recipes http://www.perlmonks.org/?node=Speeding%20up%20the%20DBI Other database related links: http://www.connectionstrings.com/ Security, especially the "SQL Injection" attack: http://bobby-tables.com/ http://online.securityfocus.com/infocus/1644 =head2 FAQ See L =head1 AUTHORS DBI by Tim Bunce (1994-2024), The DBI developer group (2024..) This pod text by Tim Bunce, J. Douglas Dunlop, Jonathan Leffler and others. Perl by Larry Wall and the C. =head1 COPYRIGHT The DBI module is Copyright (c) 1994-2024 Tim Bunce. Ireland. The DBI developer group (2024-2024) All rights reserved. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl 5.10.0 README file. =head1 SUPPORT / WARRANTY The DBI is free Open Source software. IT COMES WITHOUT WARRANTY OF ANY KIND. =head2 Support My consulting company, Data Plan Services, offers annual and multi-annual support contracts for the DBI. These provide sustained support for DBI development, and sustained value for you in return. Contact me for details. =head2 Sponsor Enhancements If your company would benefit from a specific new DBI feature, please consider sponsoring its development. Work is performed rapidly, and usually on a fixed-price payment-on-delivery basis. Contact me for details. Using such targeted financing allows you to contribute to DBI development, and rapidly get something specific and valuable in return. =head1 ACKNOWLEDGEMENTS I would like to acknowledge the valuable contributions of the many people I have worked with on the DBI project, especially in the early years (1992-1994). In no particular order: Kevin Stock, Buzz Moschetti, Kurt Andersen, Ted Lemon, William Hails, Garth Kennedy, Michael Peppler, Neil S. Briscoe, Jeff Urlwin, David J. Hughes, Jeff Stander, Forrest D Whitcher, Larry Wall, Jeff Fried, Roy Johnson, Paul Hudson, Georg Rehfeld, Steve Sizemore, Ron Pool, Jon Meek, Tom Christiansen, Steve Baumgarten, Randal Schwartz, and a whole lot more. Then, of course, there are the poor souls who have struggled through untold and undocumented obstacles to actually implement DBI drivers. Among their ranks are Jochen Wiedmann, Alligator Descartes, Jonathan Leffler, Jeff Urlwin, Michael Peppler, Henrik Tougaard, Edwin Pratomo, Davide Migliavacca, Jan Pazdziora, Peter Haworth, Edmund Mergl, Steve Williams, Thomas Lowery, and Phlip Plumlee. Without them, the DBI would not be the practical reality it is today. I'm also especially grateful to Alligator Descartes for starting work on the first edition of the "Programming the Perl DBI" book and letting me jump on board. The DBI and DBD::Oracle were originally developed while I was Technical Director (CTO) of the Paul Ingram Group in the UK. So I'd especially like to thank Paul for his generosity and vision in supporting this work for many years. A couple of specific DBI features have been sponsored by enlightened companies: The development of the swap_inner_handle() method was sponsored by BizRate.com The development of DBD::Gofer and related modules was sponsored by Shopzilla.com (L). =head1 CONTRIBUTING As you can see above, many people have contributed to the DBI and drivers in many ways over many years. If you'd like to help then see L. If you'd like the DBI to do something new or different then a good way to make that happen is to do it yourself and send me a patch to the source code that shows the changes. (But read "Speak before you patch" below.) =head2 Browsing the source code repository Use https://github.com/perl5-dbi/dbi =head2 How to create a patch using Git The DBI source code is maintained using Git. To access the source you'll need to install a Git client. Then, to get the source code, do: git clone https://github.com/perl5-dbi/dbi.git DBI-git The source code will now be available in the new subdirectory C. When you want to synchronize later, issue the command git pull --all Make your changes, test them, test them again until everything passes. If there are no tests for the new feature you added or a behaviour change, the change should include a new test. Then commit the changes. Either use git gui or git commit -a -m 'Message to my changes' If you get any conflicts reported you'll need to fix them first. Then generate the patch file to be mailed: git format-patch -1 --attach which will create a file 0001-*.patch (where * relates to the commit message). Read the patch file, as a sanity check, and then email it to dbi-dev@perl.org. If you have a L account, you can also fork the repository, commit your changes to the forked repository and then do a pull request. =head2 How to create a patch without Git Unpack a fresh copy of the distribution: wget http://cpan.metacpan.org/authors/id/T/TI/TIMB/DBI-1.627.tar.gz tar xfz DBI-1.627.tar.gz Rename the newly created top level directory: mv DBI-1.627 DBI-1.627.your_foo Edit the contents of DBI-1.627.your_foo/* till it does what you want. Test your changes and then remove all temporary files: make test && make distclean Go back to the directory you originally unpacked the distribution: cd .. Unpack I copy of the original distribution you started with: tar xfz DBI-1.627.tar.gz Then create a patch file by performing a recursive C on the two top level directories: diff -purd DBI-1.627 DBI-1.627.your_foo > DBI-1.627.your_foo.patch =head2 Speak before you patch For anything non-trivial or possibly controversial it's a good idea to discuss (on dbi-dev@perl.org) the changes you propose before actually spending time working on them. Otherwise you run the risk of them being rejected because they don't fit into some larger plans you may not be aware of. You can also reach the developers on IRC (chat). If they are on-line, the most likely place to talk to them is the #dbi channel on irc.perl.org =head1 TRANSLATIONS A German translation of this manual (possibly slightly out of date) is available, thanks to O'Reilly, at: http://www.oreilly.de/catalog/perldbiger/ =head1 OTHER RELATED WORK AND PERL MODULES =over 4 =item L To be used with the Apache daemon together with an embedded Perl interpreter like C. Establishes a database connection which remains open for the lifetime of the HTTP daemon. This way the CGI connect and disconnect for every database access becomes superfluous. =item SQL Parser See also the L module, SQL parser and engine. =back =head1 TODO =head2 Documentation These entries are still to be written: =over 2 =item DBIf_TRACE_CON =item DBIf_TRACE_DBD =item DBIf_TRACE_ENC =item DBIf_TRACE_SQL =item DBIf_TRACE_TXN =item DBIpp_cm_XX =item DBIpp_cm_br =item DBIpp_cm_cs =item DBIpp_cm_dd =item DBIpp_cm_dw =item DBIpp_cm_hs =item DBIpp_ph_XX =item DBIpp_ph_cn =item DBIpp_ph_cs =item DBIpp_ph_qm =item DBIpp_ph_sp =item DBIpp_st_XX =item DBIpp_st_bs =item DBIpp_st_qq =item SQL_ALL_TYPES =item SQL_ARRAY =item SQL_ARRAY_LOCATOR =item SQL_BIGINT =item SQL_BINARY =item SQL_BIT =item SQL_BLOB =item SQL_BLOB_LOCATOR =item SQL_BOOLEAN =item SQL_CHAR =item SQL_CLOB =item SQL_CLOB_LOCATOR =item SQL_CURSOR_DYNAMIC =item SQL_CURSOR_FORWARD_ONLY =item SQL_CURSOR_KEYSET_DRIVEN =item SQL_CURSOR_STATIC =item SQL_CURSOR_TYPE_DEFAULT =item SQL_DATE =item SQL_DATETIME =item SQL_DECIMAL =item SQL_DOUBLE =item SQL_FLOAT =item SQL_GUID =item SQL_INTEGER =item SQL_INTERVAL =item SQL_INTERVAL_DAY =item SQL_INTERVAL_DAY_TO_HOUR =item SQL_INTERVAL_DAY_TO_MINUTE =item SQL_INTERVAL_DAY_TO_SECOND =item SQL_INTERVAL_HOUR =item SQL_INTERVAL_HOUR_TO_MINUTE =item SQL_INTERVAL_HOUR_TO_SECOND =item SQL_INTERVAL_MINUTE =item SQL_INTERVAL_MINUTE_TO_SECOND =item SQL_INTERVAL_MONTH =item SQL_INTERVAL_SECOND =item SQL_INTERVAL_YEAR =item SQL_INTERVAL_YEAR_TO_MONTH =item SQL_LONGVARBINARY =item SQL_LONGVARCHAR =item SQL_MULTISET =item SQL_MULTISET_LOCATOR =item SQL_NUMERIC =item SQL_REAL =item SQL_REF =item SQL_ROW =item SQL_SMALLINT =item SQL_TIME =item SQL_TIMESTAMP =item SQL_TINYINT =item SQL_TYPE_DATE =item SQL_TYPE_TIME =item SQL_TYPE_TIMESTAMP =item SQL_TYPE_TIMESTAMP_WITH_TIMEZONE =item SQL_TYPE_TIME_WITH_TIMEZONE =item SQL_UDT =item SQL_UDT_LOCATOR =item SQL_UNKNOWN_TYPE =item SQL_VARBINARY =item SQL_VARCHAR =item SQL_WCHAR =item SQL_WLONGVARCHAR =item SQL_WVARCHAR =item connect_test_perf =item constant =item dbi_profile =item dbi_profile_merge =item dbi_profile_merge_nodes =item dbi_time =item disconnect_all =item driver_prefix =item dump_dbd_registry =item dump_handle =item init_rootclass =item install_driver =item installed_methods =item setup_driver =back =cut # LocalWords: DBI DBI-1.648/INSTALL0000644000031300001440000000354312162112277012426 0ustar00merijnusersBEFORE BUILDING, TESTING AND INSTALLING this you will need to: Build, test and install a recent version of Perl 5 It is very important to test it and actually install it! (You can use "Configure -Dprefix=..." to build a private copy.) BUILDING perl Makefile.PL make make test make test TEST_VERBOSE=1 (if any of the t/* tests fail) make install (if the tests look okay) The perl you use to execute Makefile.PL should be the first one in your PATH. If you want to use some installed perl then modify your PATH to match. IF YOU HAVE PROBLEMS --- If you get an error like "gcc: command not found" or "cc: command not found" you need to either install a compiler, or you may be able to install a precompiled binary of DBI using a package manager (e.g., ppm for ActiveState, Synaptic for Ubuntu, port for FreeBSD etc) --- If you get compiler errors referring to Perl's own header files (.../CORE/...h) or the compiler complains about bad options etc then there is something wrong with your perl installation. If the compiler complains of missing files (.../perl.h: error: sys/types.h: No such file) then you may need to install extra packages for your operating system. Generally it's best to use a Perl that was built on the system you are trying to use and it's also important to use the same compiler that was used to build the Perl you are using. If you installed Perl using a binary distribution, such as ActiveState Perl, or if Perl came installed with the operating system you use, such as Debian or Ubuntu, then you may be able to install a precompiled binary of DBI using a package manager. Check the package manager for your distribution of Perl (e.g. ppm for ActiveState) or for your operating system (e.g Synaptic for Ubuntu). --- If you get compiler warnings like "value computed is not used" and "unused variable" you can ignore them. DBI-1.648/README.md0000644000031300001440000000677514742423677012705 0ustar00merijnusers# DBI - The Perl Database Interface. [![Build Status](https://github.com/perl5-dbi/dbi/workflows/Test/badge.svg)](https://github.com/perl5-dbi/dbi/actions) See [COPYRIGHT](https://metacpan.org/module/DBI#COPYRIGHT) section in DBI.pm for usage and distribution rights. See [GETTING HELP](https://metacpan.org/module/DBI#GETTING-HELP) section in DBI.pm for how to get help. # QUICK START GUIDE: The DBI requires one or more 'driver' modules to talk to databases, but they are not needed to build or install the DBI. Check that a DBD::* module exists for the database you wish to use. Install the DBI using a installer like cpanm, cpanplus, cpan, or whatever is recommened by the perl distribution you're using. Make sure the DBI tests run successfully before installing. Use the 'perldoc DBI' command to read the DBI documentation. Install the DBD::* driver module you wish to use in the same way. It is often important to read the driver README file carefully. Make sure the driver tests run successfully before installing. The DBI.pm file contains the DBI specification and other documentation. PLEASE READ IT. It'll save you asking questions on the mailing list which you will be told are already answered in the documentation. For more information and to keep informed about progress you can join the a mailing list via mailto:dbi-users-help@perl.org You can post to the mailing list without subscribing. (Your first post may be delayed a day or so while it's being moderated.) To help you make the best use of the dbi-users mailing list, and any other lists or forums you may use, I strongly recommend that you read "How To Ask Questions The Smart Way" by Eric Raymond: http://www.catb.org/~esr/faqs/smart-questions.html Much useful information and online archives of the mailing lists can be found at http://dbi.perl.org/ See also http://metacpan.org/pod/DBI # IF YOU HAVE PROBLEMS: First, read the notes in the INSTALL file. If you can't fix it your self please post details to dbi-users@perl.org. Please include: 1. A complete log of a complete build, e.g.: perl Makefile.PL (do a make realclean first) make make test make test TEST_VERBOSE=1 (if any of the t/* tests fail) 2. The output of perl -V 3. If you get a core dump, try to include a stack trace from it. Try installing the Devel::CoreStack module to get a stack trace. If the stack trace mentions XS_DynaLoader_dl_load_file then rerun make test after setting the environment variable PERL_DL_DEBUG to 2. 4. If your installation succeeds, but your script does not behave as you expect, the problem is possibly in your script. Before sending to dbi-users, try writing a small, easy to use test case to reproduce your problem. Also, use the DBI->trace method to trace your database calls. Please don't post problems to usenet, google groups or perl5-porters. This software is supported via the dbi-users mailing list. For more information and to keep informed about progress you can join the mailing list via mailto:dbi-users-help@perl.org (please note that I do not run or manage the mailing list). It is important to check that you are using the latest version before posting. If you're not then we're very likely to simply say "upgrade to the latest". You would do yourself a favour by upgrading beforehand. Please remember that we're all busy. Try to help yourself first, then try to help us help you by following these guidelines carefully. Regards, Tim Bunce and the perl5-dbi team. DBI-1.648/META.yml0000664000031300001440000000167115210302710012636 0ustar00merijnusers--- abstract: 'Database independent interface for Perl' author: - 'DBI team (dbi-users@perl.org)' build_requires: ExtUtils::MakeMaker: '6.48' Test::Simple: '0.90' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.78, CPAN::Meta::Converter version 2.150013' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: DBI no_index: directory: - t - inc requires: perl: '5.008001' resources: IRC: irc://irc.perl.org/#dbi MailingList: mailto:dbi-dev@perl.org bugtracker: https://github.com/perl5-dbi/dbi/issues homepage: http://dbi.perl.org/ license: http://dev.perl.org/licenses/ repository: https://github.com/perl5-dbi/dbi version: '1.648' x_serialization_backend: 'CPAN::Meta::YAML version 0.020' x_suggests: Clone: 0.47 DB_File: 0 MLDBM: 0 Net::Daemon: 0 RPC::PlServer: 0.202 SQL::Statement: 1.414 DBI-1.648/META.json0000664000031300001440000000310615210302710013001 0ustar00merijnusers{ "abstract" : "Database independent interface for Perl", "author" : [ "DBI team (dbi-users@perl.org)" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.78, CPAN::Meta::Converter version 2.150013", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "DBI", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "6.48", "Test::Simple" : "0.90" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "perl" : "5.008001" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/perl5-dbi/dbi/issues" }, "homepage" : "http://dbi.perl.org/", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "https://github.com/perl5-dbi/dbi" }, "x_IRC" : "irc://irc.perl.org/#dbi", "x_MailingList" : "mailto:dbi-dev@perl.org" }, "version" : "1.648", "x_serialization_backend" : "JSON::PP version 4.18", "x_suggests" : { "Clone" : 0.47, "DB_File" : 0, "MLDBM" : 0, "Net::Daemon" : 0, "RPC::PlServer" : 0.202, "SQL::Statement" : 1.414 } }