CVS: koha/C4 Koha.pm,NONE,1.1 Output.pm,1.4,1.5
Update of /cvsroot/koha/koha/C4 In directory usw-pr-cvs1:/tmp/cvs-serv12125/C4 Modified Files: Output.pm Added Files: Koha.pm Log Message: refactored slashifyDate function out of inline code, created C4/Koha.pm to hold it and wrote tests for it, started marking other places for potential refactoring. --- NEW FILE --- package C4::Koha; use strict; require Exporter; use vars qw($VERSION @ISA @EXPORT); $VERSION = 0.01; @ISA = qw(Exporter); @EXPORT = qw(&slashifyDate); use vars qw(); sub slashifyDate { # accepts a date of the form xx-xx-xx[xx] and returns it in the # form xx/xx/xx[xx] my @dateOut = split('-', shift); return("$dateOut[2]/$dateOut[1]/$dateOut[0]") } 1; __END__ =head1 NAME Koha - Perl Module containing convenience functions for Koha scripts =head1 SYNOPSIS use Koha; $date = slashifyDate("01-01-2002") =head1 DESCRIPTION Koha.pm provides many functions for Koha scripts. slashifyDate() takes a dash separated date string and returns a slash separated date string =head1 AUTHOR Pat Eyler, pate@gnu.org =head1 SEE ALSO perl(1). =cut Index: Output.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Output.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Output.pm 31 Jan 2001 21:38:43 -0000 1.4 --- Output.pm 8 Apr 2002 23:44:43 -0000 1.5 *************** *** 73,78 **** sub startpage{ ! my $string="<html>\n"; ! return($string); } --- 73,77 ---- sub startpage{ ! return("<html>\n"); } *************** *** 134,144 **** sub mktablehdr { ! my $string="<table border=0 cellspacing=0 cellpadding=5>\n"; ! return($string); } sub mktablerow { ! #the last item in data may be a backgroundimage my ($cols,$colour,@data)=@_; my $i=0; --- 133,146 ---- sub mktablehdr { ! return("<table border=0 cellspacing=0 cellpadding=5>\n"); } sub mktablerow { ! #the last item in data may be a backgroundimage ! ! # FIXME ! # should this be a foreach (1..$cols) loop? ! my ($cols,$colour,@data)=@_; my $i=0; *************** *** 163,168 **** sub mktableft { ! my $string="</table>\n"; ! return($string); } --- 165,169 ---- sub mktableft { ! return("</table>\n"); } *************** *** 351,356 **** sub endpage{ ! my $string="</body></html>\n"; ! return($string); } --- 352,356 ---- sub endpage{ ! return("</body></html>\n"); } *************** *** 377,389 **** sub center { ! my ($text)=@_; ! my $string="<CENTER>\n"; ! return ($string); } sub endcenter { ! my ($text)=@_; ! my $string="</CENTER>\n"; ! return ($string); } --- 377,385 ---- sub center { ! return ("<CENTER>\n"); } sub endcenter { ! return ("</CENTER>\n"); } *************** *** 396,397 **** --- 392,395 ---- END { } # module clean-up code here (global destructor) + +
participants (1)
-
Pat Eyler