From: Matt S Trout Date: Thu, 6 Jul 2006 22:44:53 +0000 (+0000) Subject: env var X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6fe735fad298585c8d6982d496bcbb7b75400a6b;p=dbsrgits%2FDBIx-Class-Historic.git env var --- diff --git a/Changes b/Changes index 19080c1..9f5bf4b 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for DBIx::Class + - rename DBIX_CLASS_STORAGE_DBI_DEBUG to DBIC_TRACE - rename _parent_rs to _parent_source in ResultSet 0.06999_05 2006-07-04 14:40:01 diff --git a/lib/DBIx/Class/Manual/Troubleshooting.pod b/lib/DBIx/Class/Manual/Troubleshooting.pod index 366bdf2..6087ae3 100644 --- a/lib/DBIx/Class/Manual/Troubleshooting.pod +++ b/lib/DBIx/Class/Manual/Troubleshooting.pod @@ -10,10 +10,10 @@ you got back from connect(). =head2 Tracing SQL -The C environment variable controls +The C environment variable controls SQL tracing, so to see what is happening try - export DBIX_CLASS_STORAGE_DBI_DEBUG=1 + export DBIC_TRACE=1 Alternatively use the C<< storage->debug >> class method:- @@ -25,7 +25,7 @@ To send the output somewhere else set debugfh:- Alternatively you can do this with the environment variable too:- - export DBIX_CLASS_STORAGE_DBI_DEBUG="1=/tmp/trace.out" + export DBIC_TRACE="1=/tmp/trace.out" =head2 Can't locate method result_source_instance diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index dfbb492..6034a91 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -256,15 +256,18 @@ sub new { $new->debugobj(new DBIx::Class::Storage::Statistics()); my $fh; - if (defined($ENV{DBIX_CLASS_STORAGE_DBI_DEBUG}) && - ($ENV{DBIX_CLASS_STORAGE_DBI_DEBUG} =~ /=(.+)$/)) { + + my $debug_env = $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG} + || $ENV{DBIC_TRACE}; + + if (defined($debug_env) && ($debug_env =~ /=(.+)$/)) { $fh = IO::File->new($1, 'w') or $new->throw_exception("Cannot open trace file $1"); } else { $fh = IO::File->new('>&STDERR'); } $new->debugfh($fh); - $new->debug(1) if $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG}; + $new->debug(1) if $debug_env; return $new; } @@ -336,7 +339,7 @@ Causes SQL trace information to be emitted on the C object. Set or retrieve the filehandle used for trace/debug output. This should be an IO::Handle compatible ojbect (only the C method is used. Initially set to be STDERR - although see information on the -L environment variable. +L environment variable. =cut @@ -1065,9 +1068,9 @@ This option can also be set via L. =head1 ENVIRONMENT VARIABLES -=head2 DBIX_CLASS_STORAGE_DBI_DEBUG +=head2 DBIC_TRACE -If C is set then SQL trace information +If C is set then SQL trace information is produced (as when the L method is set). If the value is of the form C<1=/path/name> then the trace output is @@ -1078,6 +1081,10 @@ created (when you call connect on your schema). So, run-time changes to this environment variable will not take effect unless you also re-connect on your schema. +=head2 DBIX_CLASS_STORAGE_DBI_DEBUG + +Old name for DBIC_TRACE + =head1 AUTHORS Matt S. Trout diff --git a/lib/DBIx/Class/Storage/Statistics.pm b/lib/DBIx/Class/Storage/Statistics.pm index 90f6619..60b59cd 100644 --- a/lib/DBIx/Class/Storage/Statistics.pm +++ b/lib/DBIx/Class/Storage/Statistics.pm @@ -40,7 +40,7 @@ sub new { Sets or retrieves the filehandle used for trace/debug output. This should be an IO::Handle compatible object (only the C method is used). Initially should be set to STDERR - although see information on the -L environment variable. +L environment variable. =head2 txn_begin