[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [914] trunk/LedgerSMB.pm



Revision: 914
          http://svn.sourceforge.net/ledger-smb/?rev=914&view=rev
Author:   einhverfr
Date:     2007-03-15 20:46:18 -0700 (Thu, 15 Mar 2007)

Log Message:
-----------
Added LedgerSMB::is_run_mode

Modified Paths:
--------------
    trunk/LedgerSMB.pm

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-03-16 03:27:50 UTC (rev 913)
+++ trunk/LedgerSMB.pm	2007-03-16 03:46:18 UTC (rev 914)
@@ -47,6 +47,10 @@
 This function returns true if $self->{$string} only consists of whitespace
 characters or is an empty string.
 
+=item is_run_mode ('(cli|cgi|mod_perl)')
+This function returns 1 if the run mode is what is specified.  Otherwise
+returns 0.
+
 =item num_text_rows (string => $string, cols => $number, max => $number);
 
 This function determines the likely number of rows needed to hold text in a 
@@ -201,6 +205,21 @@
 	$rc;
 }
 
+sub is_run_mode {
+	my $self = shift @_;
+	my $mode = lc shift @_;
+	my $rc = 0;
+	if ($mode eq 'cgi' && $ENV{GATEWAY_INTERFACE}){
+		$rc = 1;
+	}
+	elsif ($mode eq 'cli' && ! ($ENV{GATEWAY_INTERFACE} || $ENV{MOD_PERL})){
+		$rc = 1;
+	} elsif ($mode eq 'mod_perl' &&  $ENV{MOD_PERL}){
+		$rc = 1;
+	}
+	$rc;
+}
+
 sub num_text_rows {
 	my $self = shift @_;
 	my %args = @_;
@@ -546,10 +565,10 @@
 
 sub redo_rows {
 
-	$self = shift @_;
-	%args = @_;
-	@flds = @{$args{fields}};
-	$count = $args{count};
+	my $self = shift @_;
+	my %args = @_;
+	my @flds = @{$args{fields}};
+	my $count = $args{count};
 
 }
 
@@ -566,6 +585,7 @@
 		@keys = keys %{$src};
 	}
 	for my $arg (keys %$src){
+		my $dst_arg;
 		if ($index){
 			$dst_arg = $arg . "_$index";
 		} else {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.