File Coverage

lib/Clearcase/Element.pm
Criterion Covered Total %
statement 12 176 6.8
branch 0 118 0.0
condition n/a
subroutine 4 31 12.9
pod 25 27 92.5
total 41 352 11.6


line stmt bran cond sub pod time code
1              
2             =pod
3              
4             =head1 NAME Element.pm
5              
6             Object oriented interface to Clearcase Elements
7              
8             =head1 VERSION
9              
10             =over
11              
12             =item Author
13              
14             Andrew DeFaria
15              
16             =item Revision
17              
18             $Revision: 1.18 $
19              
20             =item Created
21              
22             Thu Dec 29 12:07:59 PST 2005
23              
24             =item Modified
25              
26             $Date: 2011/11/16 19:46:13 $
27              
28             =back
29              
30             =head1 SYNOPSIS
31              
32             Provides access to information about Clearcase Elements.
33              
34             my $element = new Clearcase::Element (pname => "element");
35              
36             print "Element:\t" . $element->pname . "\n";
37             print "Version:\t" . $element->version . "\n";
38             print "Pred:\t\t" . $element->pred . "\n";
39              
40             print "Activities:\n";
41              
42             if (my %activities = $element->activities) {
43             print "\t\t$_: $activities{$_}\n" foreach (keys %activities);
44             } else {
45             print "\t\tNone\n";
46             } # if
47              
48             print "Attributes:\n";
49              
50             if (my %attributes = $element->attributes) {
51             print "\t\t$_=$attributes{$_}\n" foreach (keys %attributes);
52             } else {
53             print"\t\tNone\n";
54             } # if
55              
56             print "Hyperlinks:\n";
57              
58             if (my @hyperlinks = $element->hyperlinks) {
59             print "\t\t$_\n" foreach (@hyperlinks);
60             } else {
61             print "\t\tNone\n";
62             } # if
63              
64             print "Comments:\n";
65              
66             if ($element->comments) {
67             print "\t\t" . $element->comments . "\n";
68             } else {
69             print "\t\tNone\n";
70             } # if
71              
72             print "Create_date:\t" . $element->create_date . "\n";
73             print "User:\t\t" . $element->user . "\n";
74             print "Group:\t\t" . $element->group . "\n";
75             print "User_mode:\t" . $element->user_mode . "\n";
76             print "Group_mode:\t" . $element->group_mode . "\n";
77             print "Other_mode:\t" . $element->other_mode . "\n";
78             print "Mode:\t\t" . $element->mode . "\n";
79              
80             print "Labels:\n";
81              
82             if (my @labels = $element->labels) {
83             print "\t\t$_\n" foreach (@labels);
84             } else {
85             print "\t\tNone\n";
86             } # if
87              
88             print "Rule:\t\t" . $element->rule . "\n";
89             print "Xname:\t\t" . $element->xname . "\n";
90              
91             =head1 DESCRIPTION
92              
93             This module implements a Clearcase Element object.
94              
95             =head1 ROUTINES
96              
97             The following routines are exported:
98              
99             =cut
100              
101             package Clearcase::Element;
102              
103 2     2   2227 use strict;
  2         7  
  2         91  
104 2     2   14 use warnings;
  2         5  
  2         186  
105              
106 2     2   82 use lib '..';
  2         8  
  2         37  
107              
108 2     2   543 use Clearcase;
  2         4  
  2         6787  
109              
110             sub collapseOverExtendedVersionPathname ($) {
111 0     0 1   my ($versionStr) = @_;
112              
113             =pod
114              
115             =head2 collapseOverExtendedVersionPathname
116              
117             This utility function will collapse an "over extended" version pathname. These
118             over extended pathnames can occur when we are not operating in the UCM view
119             from which the version was generated. Clearcase gives us enormous,technically
120             correct but hard to read, view/vob extended path names. Here's an example
121             (broken by lines for readability):
122              
123             /vob/component/branch1@@/main/branch1_Integration/1/src/main/branch1_
124             /2/com/main/branch1_Integration/2/company/main/branch1_Integration/2/
125             ManagerPlatform/main/branch1_Integration/2/nma/main/
126             branch1_Integration/devbranch_17/1/common/main/devbranch_17/3/exception/
127             main/mainline/devbranch_r17/1/Exception.java/main/mainline/1
128            
129             We want this to read:
130              
131             element: /vob/component/src/com/company/ManagerPlatform/nma/
132             common/exception/Exception.java
133             version: /main/mainline/1
134              
135             Parameters:
136              
137             =for html
138              
139             =over
140              
141             =item $versionStr
142              
143             This is the over extended version pathname
144              
145             =back
146              
147             =for html
148              
149             Returns:
150              
151             =for html
152              
153             =over
154              
155             =item %element hash
156              
157             A hash containing the element's name and version string collapsed
158              
159             =back
160              
161             =for html
162              
163             =cut
164              
165             return
166 0 0         unless $versionStr;
167              
168 0           $versionStr =~ s/\\/\//g;
169              
170 0           my ($name, $version) = split /$Clearcase::SFX/, $versionStr;
171              
172 0           my %element = (
173             extended_name => $versionStr,
174             name => $name,
175             version => $version,
176             );
177              
178             return
179 0 0         unless $element{version};
180              
181 0           while ($element{version} =~ s/.*?\/\d+\/(.*?)\///) {
182 0           $element{name} .= "/$1";
183             } # while
184              
185             $element{version} = "/$element{version}"
186 0 0         if $element{version} !~ /^\//;
187              
188 0           return %element;
189             } # collapseOverExtendedVersionPathname
190              
191             sub new ($) {
192 0     0 1   my ($class, $pname) = @_;
193              
194             =pod
195              
196             =head2 new
197              
198             Construct a new Clearcase Element object.
199              
200             Parameters:
201              
202             =for html
203              
204             =over
205              
206             =item element name
207              
208             =back
209              
210             =for html
211              
212             Returns:
213              
214             =for html
215              
216             =over
217              
218             =item Clearcase Element object
219              
220             =back
221              
222             =for html
223              
224             =cut
225              
226 0           my $self = bless {pname => $pname,}, $class;
227              
228 0           my ($version, $rule);
229              
230 0           my ($status, @output) = $Clearcase::CC->execute ("ls -d $pname");
231              
232 0 0         return $self
233             if $status;
234              
235             # Sometimes ls -d puts out more than one line. Join them...
236 0 0         if ((join ' ', @output) =~ m{^.*\Q$Clearcase::SFX\E(\S+)\s+Rule: (.*)$}m) {
237 0           $version = $1;
238 0           $rule = $2;
239             } # if
240              
241 0           $self->{rule} = $rule;
242 0           $self->{version} = $version;
243              
244 0           return $self;
245             } # new
246              
247             sub describe () {
248 0     0 0   my ($self) = @_;
249              
250             # Get information that can only be gotten with describe -long. These fields
251             # lack a -fmt option.
252              
253 0           my ($status, @output) =
254             $Clearcase::CC->execute ("describe -long $self->{pname}");
255              
256             return
257 0 0         if $status != 0;
258              
259 0           my $section;
260              
261 0           foreach (@output) {
262 0 0         if (/Hyperlinks:/) {
    0          
263 0           $section = 'hyperlinks';
264 0           next;
265             } elsif (/Attached activities:/) {
266 0           $section = 'activities';
267 0           next;
268             } # if
269              
270 0 0         if ($section) {
271 0 0         if ($section eq 'activities') {
    0          
272 0 0         if (/activity:(.*)\s+\"(.*)\"/) {
273 0           ${$self->{activities}}{$1} = $2;
  0            
274             } # if
275             } elsif ($section eq "hyperlinks") {
276 0 0         if (/\s+(.*)/) {
277 0           push @{$self->{hyperlinks}}, $1;
  0            
278             } # if
279             } # if
280              
281 0           next;
282             } # if
283              
284 0 0         if (/User : \S+\s*: (.*)/) {
    0          
    0          
285 0           $self->{user_mode} = $1;
286             } elsif (/Group: \S+\s*: (.*)/) {
287 0           $self->{group_mode} = $1;
288             } elsif (/Other:\s+: (.*)/) {
289 0           $self->{other_mode} = $1;
290             } # if
291             } # foreach
292              
293             # Change modes to numeric
294 0           $self->{mode} = 0;
295              
296 0 0         $self->{mode} += 400 if $self->{user_mode} =~ /r/;
297 0 0         $self->{mode} += 200 if $self->{user_mode} =~ /w/;
298 0 0         $self->{mode} += 100 if $self->{user_mode} =~ /x/;
299 0 0         $self->{mode} += 40 if $self->{group_mode} =~ /r/;
300 0 0         $self->{mode} += 20 if $self->{group_mode} =~ /w/;
301 0 0         $self->{mode} += 10 if $self->{group_mode} =~ /x/;
302 0 0         $self->{mode} += 4 if $self->{other_mode} =~ /r/;
303 0 0         $self->{mode} += 2 if $self->{other_mode} =~ /w/;
304 0 0         $self->{mode} += 1 if $self->{other_mode} =~ /x/;
305              
306 0           return;
307             } # describe
308              
309             sub activities () {
310 0     0 1   my ($self) = @_;
311              
312             =pod
313              
314             =head2 activities
315              
316             Returns a hash of activity name/value pairs
317              
318             Parameters:
319              
320             =for html
321              
322             =over
323              
324             =item none
325              
326             =back
327              
328             =for html
329              
330             Returns:
331              
332             =for html
333              
334             =over
335              
336             =item Hash of activity name/value pairs
337              
338             =back
339              
340             =for html
341              
342             =cut
343              
344             $self->describe
345 0 0         unless $self->{activities};
346              
347 0 0         return $self->{activities} ? %{$self->{activities}} : ();
  0            
348             } # activities
349              
350             sub attributes () {
351 0     0 1   my ($self) = @_;
352              
353             =pod
354              
355             =head2 attributes
356              
357             Returns a hash of attribute name/value pairs
358              
359             Parameters:
360              
361             =for html
362              
363             =over
364              
365             =item none
366              
367             =back
368              
369             =for html
370              
371             Returns:
372              
373             =for html
374              
375             =over
376              
377             =item Hash of attribute name/value pairs
378              
379             =back
380              
381             =for html
382              
383             =cut
384              
385             $self->updateElementInfo
386 0 0         unless $self->{attributes};
387              
388 0           return %{$self->{attributes}};
  0            
389             } # attributes
390              
391             sub comments () {
392 0     0 1   my ($self) = @_;
393              
394             =pod
395              
396             =head2 comments
397              
398             Returns the comments associated with the current version element.
399              
400             Parameters:
401              
402             =for html
403              
404             =over
405              
406             =item none
407              
408             =back
409              
410             =for html
411              
412             Returns:
413              
414             =for html
415              
416             =over
417              
418             =item comment
419              
420             =back
421              
422             =for html
423              
424             =cut
425              
426             $self->updateElementInfo
427 0 0         unless $self->{comments};
428              
429 0           return $self->{comments};
430             } # comments
431              
432             sub create_date () {
433 0     0 1   my ($self) = @_;
434              
435             =pod
436              
437             =head2 create_date
438              
439             Returns the date of creation of the element.
440              
441             Parameters:
442              
443             =for html
444              
445             =over
446              
447             =item none
448              
449             =back
450              
451             =for html
452              
453             Returns:
454              
455             =for html
456              
457             =over
458              
459             =item create date
460              
461             =back
462              
463             =for html
464              
465             =cut
466              
467             $self->updateElementInfo
468 0 0         unless $self->{create_date};
469              
470 0           return $self->{create_date};
471             } # create_date
472              
473             sub group () {
474 0     0 1   my ($self) = @_;
475              
476             =pod
477              
478             =head2 group
479              
480             Returns the group of the element.
481              
482             Parameters:
483              
484             =for html
485              
486             =over
487              
488             =item none
489              
490             =back
491              
492             =for html
493              
494             Returns:
495              
496             =for html
497              
498             =over
499              
500             =item group
501              
502             =back
503              
504             =for html
505              
506             =cut
507              
508             $self->updateElementInfo
509 0 0         unless $self->{group};
510              
511 0           return $self->{group};
512             } # group
513              
514             sub group_mode () {
515 0     0 1   my ($self) = @_;
516              
517             =pod
518              
519             =head2 group_mode
520              
521             Returns the group mode of the element
522              
523             Parameters:
524              
525             =for html
526              
527             =over
528              
529             =item none
530              
531             =back
532              
533             =for html
534              
535             Returns:
536              
537             =for html
538              
539             =over
540              
541             =item group mode
542              
543             =back
544              
545             =for html
546              
547             =cut
548              
549             $self->describe
550 0 0         unless $self->{group_mode};
551              
552 0           return $self->{group_mode};
553             } # group_mode
554              
555             sub hyperlinks () {
556 0     0 1   my ($self) = @_;
557              
558             =pod
559              
560             =head2 hyperlinks
561              
562             Returns a hash of hyperlink name/value pairs
563              
564             Parameters:
565              
566             =for html
567              
568             =over
569              
570             =item none
571              
572             =back
573              
574             =for html
575              
576             Returns:
577              
578             =for html
579              
580             =over
581              
582             =item Hash of hyperlink name/value pairs
583              
584             =back
585              
586             =for html
587              
588             =cut
589              
590             $self->describe
591 0 0         unless $self->{hyperlinks};
592              
593 0           return @{$self->{hyperlinks}};
  0            
594             } # hyperlinks
595              
596             sub labels () {
597 0     0 1   my ($self) = @_;
598              
599             =pod
600              
601             =head2 labels
602              
603             Returns an array of labels
604              
605             Parameters:
606              
607             =for html
608              
609             =over
610              
611             =item none
612              
613             =back
614              
615             =for html
616              
617             Returns:
618              
619             =for html
620              
621             =over
622              
623             =item Array of labels
624              
625             =back
626              
627             =for html
628              
629             =cut
630              
631             $self->updateElementInfo
632 0 0         unless $self->{labels};
633              
634 0           return @{$self->{labels}};
  0            
635             } # labels
636              
637             sub mode () {
638 0     0 1   my ($self) = @_;
639              
640             =pod
641              
642             =head2 mode
643              
644             Returns the numeric mode representing the element's access mode
645              
646             Parameters:
647              
648             =for html
649              
650             =over
651              
652             =item none
653              
654             =back
655              
656             =for html
657              
658             Returns:
659              
660             =for html
661              
662             =over
663              
664             =item Array of activities
665              
666             =back
667              
668             =for html
669              
670             =cut
671              
672             $self->describe
673 0 0         unless $self->{mode};
674              
675 0           return $self->{mode};
676             } # mode
677              
678             sub other_mode () {
679 0     0 1   my ($self) = @_;
680              
681             =pod
682              
683             =head2 other_mode
684              
685             Returns the mode for other for the element.
686              
687             Parameters:
688              
689             =for html
690              
691             =over
692              
693             =item none
694              
695             =back
696              
697             =for html
698              
699             Returns:
700              
701             =for html
702              
703             =over
704              
705             =item A string repesenting the other mode
706              
707             =back
708              
709             =for html
710              
711             =cut
712              
713             $self->describe
714 0 0         unless $self->{other_mode};
715              
716 0           return $self->{other_mode};
717             } # other_mode
718              
719             sub pname () {
720 0     0 1   my ($self) = @_;
721              
722             =pod
723              
724             =head2 pname
725              
726             Returns the pname of the element.
727              
728             Parameters:
729              
730             =for html
731              
732             =over
733              
734             =item none
735              
736             =back
737              
738             =for html
739              
740             Returns:
741              
742             =for html
743              
744             =over
745              
746             =item pname
747              
748             =back
749              
750             =for html
751              
752             =cut
753              
754 0           return $self->{pname};
755             } # pname
756              
757             sub pred () {
758 0     0 1   my ($self) = @_;
759              
760             =pod
761              
762             =head2 pred
763              
764             Returns the predecessor version of this element
765              
766             Parameters:
767              
768             =for html
769              
770             =over
771              
772             =item none
773              
774             =back
775              
776             =for html
777              
778             Returns:
779              
780             =for html
781              
782             =over
783              
784             =item Predecessor version
785              
786             =back
787              
788             =for html
789              
790             =cut
791              
792             $self->updateElementInfo
793 0 0         unless $self->{pred};
794              
795 0           return $self->{pred};
796             } # pred
797              
798             sub rule () {
799 0     0 1   my ($self) = @_;
800              
801             =pod
802              
803             =head2 rule
804              
805             Returns the config spec rule that selected this element's version.
806              
807             Parameters:
808              
809             =for html
810              
811             =over
812              
813             =item none
814              
815             =back
816              
817             =for html
818              
819             Returns:
820              
821             =for html
822              
823             =over
824              
825             =item rule
826              
827             =back
828              
829             =for html
830              
831             =cut
832              
833 0           return $self->{rule};
834             } # rule
835              
836             sub type () {
837 0     0 1   my ($self) = @_;
838              
839             =pod
840              
841             =head2 type
842              
843             Returns the element's type
844              
845             Parameters:
846              
847             =for html
848              
849             =over
850              
851             =item none
852              
853             =back
854              
855             =for html
856              
857             Returns:
858              
859             =for html
860              
861             =over
862              
863             =item element type
864              
865             =back
866              
867             =for html
868              
869             =cut
870              
871             $self->updateElementInfo
872 0 0         unless $self->{type};
873              
874 0           return $self->{type};
875             } # type
876              
877             sub objkind () {
878 0     0 1   my ($self) = @_;
879              
880             =pod
881              
882             =head2 objkind
883              
884             Returns the element's object kind
885              
886             Parameters:
887              
888             =for html
889              
890             =over
891              
892             =item none
893              
894             =back
895              
896             =for html
897              
898             Returns:
899              
900             =for html
901              
902             =over
903              
904             =item element's object kind
905              
906             =back
907              
908             =for html
909              
910             =cut
911              
912             $self->updateElementInfo
913 0 0         unless $self->{objkind};
914              
915 0           return $self->{objkind};
916             } # objkind
917              
918             sub oid ($) {
919 0     0 1   my ($version) = @_;
920              
921             =pod
922              
923             =head2 oid
924              
925             Returns the element's OID
926              
927             Parameters:
928              
929             =for html
930              
931             =over
932              
933             =item none
934              
935             =back
936              
937             =for html
938              
939             Returns:
940              
941             =for html
942              
943             =over
944              
945             =item element's OID
946              
947             =back
948              
949             =for html
950              
951             =cut
952              
953 0 0         $version .= $Clearcase::SFX
954             unless $version =~ /$Clearcase::SFX$/;
955              
956 0           my ($status, @output) = $Clearcase::CC->execute ('dump "' . $version . '"');
957              
958             return
959 0 0         unless $status == 0;
960              
961 0           @output = grep {/^oid=/} @output;
  0            
962              
963 0 0         if ($output[0] =~ /oid=(.+?)\s+/) {
964 0           return $1;
965             } # if
966             } # oid
967              
968             sub user () {
969 0     0 1   my ($self) = @_;
970              
971             =pod
972              
973             =head2 user
974              
975             Returns the username of the owner of this element.
976              
977             Parameters:
978              
979             =for html
980              
981             =over
982              
983             =item none
984              
985             =back
986              
987             =for html
988              
989             Returns:
990              
991             =for html
992              
993             =over
994              
995             =item user name
996              
997             =back
998              
999             =for html
1000              
1001             =cut
1002              
1003             $self->updateElementInfo
1004 0 0         unless $self->{user};
1005              
1006 0           return $self->{user};
1007             } # user
1008              
1009             sub user_mode () {
1010 0     0 1   my ($self) = @_;
1011              
1012             =pod
1013              
1014             =head2 user_mode
1015              
1016             Returns the mode for the user for the element.
1017              
1018             Parameters:
1019              
1020             =for html
1021              
1022             =over
1023              
1024             =item none
1025              
1026             =back
1027              
1028             =for html
1029              
1030             Returns:
1031              
1032             =for html
1033              
1034             =over
1035              
1036             =item A string repesenting the other mode
1037              
1038             =back
1039              
1040             =for html
1041              
1042             =cut
1043              
1044             $self->describe
1045 0 0         unless $self->{user_mode};
1046              
1047 0           return $self->{user_mode};
1048             } # user_mode
1049              
1050             sub version () {
1051 0     0 1   my ($self) = @_;
1052              
1053             =pod
1054              
1055             =head2 version
1056              
1057             Returns this element's version
1058              
1059             Parameters:
1060              
1061             =for html
1062              
1063             =over
1064              
1065             =item none
1066              
1067             =back
1068              
1069             =for html
1070              
1071             Returns:
1072              
1073             =for html
1074              
1075             =over
1076              
1077             =item version
1078              
1079             =back
1080              
1081             =for html
1082              
1083             =cut
1084              
1085 0           return $self->{version};
1086             } # version
1087              
1088             sub xname () {
1089 0     0 1   my ($self) = @_;
1090              
1091             =pod
1092              
1093             =head2 xname
1094              
1095             Returns the view extended path name (xname) of an element version.
1096              
1097             Parameters:
1098              
1099             =for html
1100              
1101             =over
1102              
1103             =item none
1104              
1105             =back
1106              
1107             =for html
1108              
1109             Returns:
1110              
1111             =for html
1112              
1113             =over
1114              
1115             =item xname
1116              
1117             =back
1118              
1119             =for html
1120              
1121             =cut
1122              
1123             $self->updateElementInfo
1124 0 0         unless $self->{xname};
1125              
1126 0           return $self->{xname};
1127             } # xname
1128              
1129             sub mkelem (;$) {
1130 0     0 1   my ($self, $comment) = @_;
1131              
1132             =pod
1133              
1134             =head2 mkelem
1135              
1136             Returns creates a new element
1137              
1138             Parameters:
1139              
1140             =for html
1141              
1142             =over
1143              
1144             =item Comment
1145              
1146             Creation comment. Default -nc.
1147              
1148             =back
1149              
1150             =for html
1151              
1152             Returns:
1153              
1154             =for html
1155              
1156             =over
1157              
1158             =item $status
1159              
1160             Status from cleartool
1161              
1162             =item @output
1163              
1164             Ouput from cleartool
1165              
1166             =back
1167              
1168             =for html
1169              
1170             =cut
1171              
1172 0           $comment = Clearcase::setComment $comment;
1173              
1174 0           return $Clearcase::CC->execute ("mkelem $comment $self->{pname}");
1175             } # mkelem
1176              
1177             sub checkout (;$) {
1178 0     0 1   my ($self, $comment) = @_;
1179              
1180             =pod
1181              
1182             =head2 checkout
1183              
1184             Checks out the element
1185              
1186             Parameters:
1187              
1188             =for html
1189              
1190             =over
1191              
1192             =item comment
1193              
1194             Checkout comment. Default -nc.
1195              
1196             =back
1197              
1198             =for html
1199              
1200             Returns:
1201              
1202             =for html
1203              
1204             =over
1205              
1206             =item $status
1207              
1208             Status from cleartool
1209              
1210             =item @output
1211              
1212             Ouput from cleartool
1213              
1214             =back
1215              
1216             =for html
1217              
1218             =cut
1219              
1220 0           $comment = Clearcase::setComment $comment;
1221              
1222 0           return $Clearcase::CC->execute ("checkout $comment $self->{pname}");
1223             } # checkout
1224              
1225             sub checkin (;$) {
1226 0     0 1   my ($self, $comment) = @_;
1227              
1228             =pod
1229              
1230             =head2 checkin
1231              
1232             Checks in the element
1233              
1234             Parameters:
1235              
1236             =for html
1237              
1238             =over
1239              
1240             =item comment
1241              
1242             Check in comment. Default -nc.
1243              
1244             =back
1245              
1246             =for html
1247              
1248             Returns:
1249              
1250             =for html
1251              
1252             =over
1253              
1254             =item $status
1255              
1256             Status from cleartool
1257              
1258             =item @output
1259              
1260             Ouput from cleartool
1261              
1262             =back
1263              
1264             =for html
1265              
1266             =cut
1267              
1268 0           $comment = Clearcase::setComment $comment;
1269              
1270 0           return $Clearcase::CC->execute ("checkin $comment $self->{pname}");
1271             } # checkout
1272              
1273             sub updateElementInfo () {
1274 0     0 0   my ($self) = @_;
1275              
1276             # Get all information that can be gotten using -fmt
1277 0           my $fmt =
1278             'Attributes:%aEndAttributes:'
1279             . 'Comment:%cEndComment:'
1280             . 'Create_date:%dEndCreate_date:'
1281             . 'Group:%[group]pEndGroup:'
1282             . 'Labels:%NlEndLabels:'
1283             . 'Pred:%PSnEndPred:'
1284             . 'Type:%[type]pEndType:'
1285             . 'ObjectKind:%mEndObjectKind:'
1286             . 'User:%[owner]pEndUser:'
1287             . 'Xname:%XnEndXname:';
1288              
1289 0           my ($status, @output) =
1290             $Clearcase::CC->execute ("describe -fmt \"$fmt\" $self->{pname}");
1291              
1292             return
1293 0 0         unless $status == 0;
1294              
1295             # We need to make sure that fields are filled in or empty because we are using
1296             # undef as an indication that we have not called updateElementInfo yet.
1297             $self->{attributes} = $self->{labels} =
1298 0           ();
1299              
1300             $self->{comments} = $self->{create_date} = $self->{group} = $self->{pred} =
1301 0           $self->{type} = $self->{objkind} = $self->{user} = $self->{xname} = '';
1302              
1303 0           foreach (@output) {
1304              
1305             # This output is wrapped with parenthesis...
1306 0 0         if (/Attributes:\((.*)\)EndAttributes:/) {
1307 0           my @attributes = split ", ", $1;
1308 0           my %attributes;
1309              
1310 0           foreach (@attributes) {
1311 0 0         if (/(\w+)=(\w+)/) {
1312 0           $attributes{$1} = $2;
1313             } # if
1314             } # foreach
1315              
1316 0 0         $self->{attributes} = %attributes ? \%attributes : ();
1317             } # if
1318              
1319 0 0         if (/Comments:(.*)EndComments:/) {
1320 0           $self->{comments} = $1;
1321             } # if
1322              
1323 0 0         if (/Create_date:(.*)EndCreate_date:/) {
1324 0           $self->{create_date} = $1;
1325             } # if
1326              
1327 0 0         if (/Group:(.*)EndGroup:/) {
1328 0           $self->{group} = $1;
1329             } # if
1330              
1331 0 0         if (/Labels:(.*)EndLabels:/) {
1332 0           my @labels = split " ", $1;
1333 0 0         $self->{labels} = @labels ? \@labels : ();
1334             } # if
1335              
1336 0 0         if (/Pred:(.*)EndPred:/) {
1337 0           $self->{pred} = $1;
1338             } # if
1339              
1340 0 0         if (/Type:(.*)EndType:/) {
1341 0           $self->{type} = $1;
1342             } # if
1343              
1344 0 0         if (/ObjectKind:(.*)EndObjectKind:/) {
1345 0           $self->{objkind} = $1;
1346             } # if
1347              
1348 0 0         if (/User:(.*)EndUser:/) {
1349 0           $self->{user} = $1;
1350             } # if
1351              
1352 0 0         if (/Xname:(.*)EndXname:/) {
1353 0           $self->{xname} = $1;
1354             } # if
1355             } # foreach
1356              
1357 0           return;
1358             } # updateElementInfo
1359              
1360             1;
1361              
1362             =head2 DEPENDENCIES
1363              
1364             =head2 Modules
1365              
1366             =over
1367              
1368             =back
1369              
1370             =head2 INCOMPATABILITIES
1371              
1372             None
1373              
1374             =head2 BUGS AND LIMITATIONS
1375              
1376             There are no known bugs in this module.
1377              
1378             Please report problems to Andrew DeFaria .
1379              
1380             =head1 COPYRIGHT AND LICENSE
1381              
1382             Copyright (C) 2020 by Andrew@DeFaria.com
1383              
1384             This library is free software; you can redistribute it and/or modify
1385             it under the same terms as Perl itself, either Perl version 5.38.0 or,
1386             at your option, any later version of Perl 5 you may have available.
1387              
1388             =cut