qsos-commits
[Top][All Lists]
Advanced

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

[Qsos-commits] qsos/libs/perl/QSOS-Document/lib/QSOS Document.pm


From: Gonéri Le Bouder
Subject: [Qsos-commits] qsos/libs/perl/QSOS-Document/lib/QSOS Document.pm
Date: Fri, 05 May 2006 10:33:56 +0000

CVSROOT:        /sources/qsos
Module name:    qsos
Branch:         
Changes by:     Gonéri Le Bouder <address@hidden>      06/05/05 10:33:56

Modified files:
        libs/perl/QSOS-Document/lib/QSOS: Document.pm 

Log message:
        new func: getdatevalidation setdatevalidation getdatecreation 
setdatecreation
        *** This lib really need a bit of rewrite/clean up/doc ***

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qsos/qsos/libs/perl/QSOS-Document/lib/QSOS/Document.pm.diff?tr1=1.16&tr2=1.17&r1=text&r2=text

Patches:
Index: qsos/libs/perl/QSOS-Document/lib/QSOS/Document.pm
diff -u qsos/libs/perl/QSOS-Document/lib/QSOS/Document.pm:1.16 
qsos/libs/perl/QSOS-Document/lib/QSOS/Document.pm:1.17
--- qsos/libs/perl/QSOS-Document/lib/QSOS/Document.pm:1.16      Fri May  5 
09:29:10 2006
+++ qsos/libs/perl/QSOS-Document/lib/QSOS/Document.pm   Fri May  5 10:33:56 2006
@@ -1,4 +1,4 @@
-# $Id: Document.pm,v 1.16 2006/05/05 09:29:10 goneri Exp $
+# $Id: Document.pm,v 1.17 2006/05/05 10:33:56 goneri Exp $
 #
 #  Copyright (C) 2006 Atos Origin 
 #
@@ -19,6 +19,12 @@
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
 #
 
+# TODO
+# - sort func
+# - create _item to retrieve xml key and use it with getitem and setitem
+# - doc
+# - update test scripts
+
 package QSOS::Document;
 use XML::Twig;
 use Carp;
@@ -33,7 +39,7 @@
 
 @ISA               = qw(Exporter);
 @EXPORT            = qw(XMLin XMLout);
address@hidden         = qw(new load write content getkeydesc setkeydesc 
setkeycomment getkeycomment setkeyscore getkeyscore getkeytitle setkeytitle 
write getauthors addauthor delauthor getappname setappname getlanguage 
setlanguage getrelease setrelease getlicenselist getlicenseid setlicenseid 
getlicensedesc setlicensedesc geturl seturl getdesc setdesc getdemourl 
setdemourl getqsosformat setqsosformat getqsosspecificformat 
setqsosspecificformat getqsosappfamily setqsosappfamily);
address@hidden         = qw(new load write content getkeydesc setkeydesc 
setkeycomment getkeycomment setkeyscore getkeyscore getkeytitle setkeytitle 
write getauthors addauthor delauthor getappname setappname getlanguage 
setlanguage getrelease setrelease getlicenselist getlicenseid setlicenseid 
getlicensedesc setlicensedesc geturl seturl getdesc setdesc getdemourl 
setdemourl getqsosformat setqsosformat getqsosspecificformat 
setqsosspecificformat getqsosappfamily setqsosappfamily getdatevalidation 
setdatevalidation getdatecreation setdatecreation);
 $VERSION           = '0.01';
 
 
@@ -238,8 +244,11 @@
   $file = $self->{file} unless ($file);
 
   my $aout =  $self->{twig}->sprint;
-
   carp "file is empty !" unless ($aout);
+ 
+  # minor clean up
+  $aout =~ s!<dates></dates!<dates>\n</dates>!;
+  $aout =~ s!<authors></authors>!<authors>\n</authors>!;
 
   open XMLOUT,">".$file or carp "can't open $file $!";
   print XMLOUT $aout;
@@ -258,6 +267,67 @@
   $aout;
 }
 
+sub getdatecreation {
+  my $self = shift;
+
+  my @root = $self->{twig}->root->children;
+  my $header = shift @root;
+  my $authors = $header->first_child('dates');
+  return unless ($authors);
+  my $creation = $authors->first_child('creation');
+
+  return unless ($creation);
+
+  print $creation->text()."\n";
+  $creation->text();
+
+}
+
+sub setdatecreation {
+  my ($self, $date) = @_;
+
+  my @root = $self->{twig}->root->children;
+  my $header = shift @root;
+  my $authors = $header->first_child('dates');
+  return unless ($authors);
+  my $creation = $authors->first_child('creation');
+
+  return unless ($creation);
+
+  $creation->set_text($date);
+}
+
+sub getdatevalidation {
+  my $self = shift;
+
+  my @root = $self->{twig}->root->children;
+  my $header = shift @root;
+  my $authors = $header->first_child('dates');
+  return unless ($authors);
+  my $validation = $authors->first_child('validation');
+
+  return unless ($validation);
+
+  $validation->text();
+
+}
+
+sub setdatevalidation {
+  my ($self, $date) = @_;
+
+  my @root = $self->{twig}->root->children;
+  my $header = shift @root;
+  my $authors = $header->first_child('dates');
+  return unless ($authors);
+  my $validation = $authors->first_child('validation');
+
+  return unless ($validation);
+
+  $validation->set_text($date);
+}
+
+
+
 
 sub getauthors {
   my $self = shift;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]