[PATCH] Enable use warnings;, clean up complainy functions, fix a few tab/space formatting issues.<br>

stan stan
Thu Jan 1 12:36:57 CET 2009


<br>
Refactoring KOHAVERSION to be less crufty, enabling use warnings, change formatting slightly in places.<br>
<br>
---<br>
&nbsp;C4/Context.pm | &nbsp; 32 +++++++++++++++-----------------<br>
&nbsp;1 files changed, 15 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/C4/Context.pm b/C4/Context.pm<br>
index 78b9dd7..9c7e0b8 100644<br>
--- a/C4/Context.pm<br>
+++ b/C4/Context.pm<br>
@@ -16,6 +16,7 @@ package C4::Context;<br>
&nbsp;# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,<br>
&nbsp;# Suite 330, Boston, MA &nbsp;02111-1307 USA<br>
<br>
+use warnings;<br>
&nbsp;use strict;<br>
&nbsp;use vars qw($VERSION $AUTOLOAD $context @context_stack);<br>
<br>
@@ -190,17 +191,14 @@ $context = undef; &nbsp; &nbsp; &nbsp; &nbsp;# Initially, no context is set<br>
&nbsp;=cut<br>
<br>
&nbsp;sub KOHAVERSION {<br>
- &nbsp; &nbsp;my $cgidir = C4::Context-&gt;intranetdir .&quot;/cgi-bin&quot;;<br>
-<br>
- &nbsp; &nbsp;# 2 cases here : on CVS install, $cgidir does not need a /cgi-bin<br>
- &nbsp; &nbsp;# on a standard install, /cgi-bin need to be added.<br>
- &nbsp; &nbsp;# test one, then the other<br>
- &nbsp; &nbsp;# FIXME - is this all really necessary?<br>
- &nbsp; &nbsp;unless (opendir(DIR, &quot;$cgidir/cataloguing/value_builder&quot;)) {<br>
- &nbsp; &nbsp; &nbsp; &nbsp;$cgidir = C4::Context-&gt;intranetdir;<br>
- &nbsp; &nbsp; &nbsp; &nbsp;closedir(DIR);<br>
- &nbsp; &nbsp;}<br>
+ &nbsp; &nbsp;my $cgidir = C4::Context-&gt;intranetdir;<br>
<br>
+ &nbsp; &nbsp;# Apparently the GIT code does not run out of a CGI-BIN subdirectory<br>
+ &nbsp; &nbsp;# but distribution code does? &nbsp;(Stan, 1jan08)<br>
+ &nbsp; &nbsp;if(-d $cgidir . &quot;/cgi-bin&quot;){<br>
+ &nbsp; &nbsp; &nbsp; &nbsp;my $cgidir .= &quot;/cgi-bin&quot;;<br>
+ &nbsp; &nbsp;}<br>
+<br>
 &nbsp; &nbsp; do $cgidir.&quot;/kohaversion.pl&quot; || die &quot;NO $cgidir/kohaversion.pl&quot;;<br>
 &nbsp; &nbsp; return kohaversion();<br>
&nbsp;}<br>
@@ -649,13 +647,13 @@ sub _new_Zconn {<br>
&nbsp;sub _new_dbh<br>
&nbsp;{<br>
<br>
-### $context<br>
- &nbsp; &nbsp;##correct name for db_schme<br>
+ &nbsp; &nbsp;## $context<br>
+ &nbsp; &nbsp;## correct name for db_schme<br>
 &nbsp; &nbsp; my $db_driver;<br>
 &nbsp; &nbsp; if ($context-&gt;config(&quot;db_scheme&quot;)){<br>
- &nbsp; &nbsp;$db_driver=db_scheme2dbi($context-&gt;config(&quot;db_scheme&quot;));<br>
+ &nbsp; &nbsp; &nbsp; &nbsp;$db_driver=db_scheme2dbi($context-&gt;config(&quot;db_scheme&quot;));<br>
 &nbsp; &nbsp; }else{<br>
- &nbsp; &nbsp;$db_driver=&quot;mysql&quot;;<br>
+ &nbsp; &nbsp; &nbsp; &nbsp;$db_driver=&quot;mysql&quot;;<br>
 &nbsp; &nbsp; }<br>
<br>
 &nbsp; &nbsp; my $db_name &nbsp; = $context-&gt;config(&quot;database&quot;);<br>
@@ -931,12 +929,12 @@ sub set_userenv{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &quot;cardnumber&quot; =&gt; $usercnum,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &quot;firstname&quot; &nbsp;=&gt; $userfirstname,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &quot;surname&quot; &nbsp; &nbsp;=&gt; $usersurname,<br>
-#possibly a law problem<br>
+ &nbsp; &nbsp; &nbsp; &nbsp;#possibly a law problem<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &quot;branch&quot; &nbsp; &nbsp; =&gt; $userbranch,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &quot;branchname&quot; =&gt; $branchname,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &quot;flags&quot; &nbsp; &nbsp; &nbsp;=&gt; $userflags,<br>
- &nbsp; &nbsp; &nbsp; &nbsp;&quot;emailaddress&quot; &nbsp; &nbsp;=&gt; $emailaddress,<br>
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;branchprinter&quot; &nbsp; &nbsp;=&gt; $branchprinter<br>
+ &nbsp; &nbsp; &nbsp; &nbsp;&quot;emailaddress&quot; &nbsp; &nbsp; =&gt; $emailaddress,<br>
+ &nbsp; &nbsp; &nbsp; &nbsp;&quot;branchprinter&quot; &nbsp; &nbsp;=&gt; $branchprinter<br>
 &nbsp; &nbsp; };<br>
 &nbsp; &nbsp; $context-&gt;{userenv}-&gt;{$var} = $cell;<br>
 &nbsp; &nbsp; return $cell;<br>
<font color="#888888">--<br>
1.5.6.3<br>
<br>
_______________________________________________<br>
Koha-patches mailing list<br>
<a href="mailto:Koha-patches at lists.koha.org">Koha-patches at lists.koha.org</a><br>
<a href="http://lists.koha.org/mailman/listinfo/koha-patches" target="_blank">http://lists.koha.org/mailman/listinfo/koha-patches</a><br>
</font></blockquote></div><br>

------=_Part_205470_18597791.1231513396915--


More information about the Koha-patches mailing list