Skip Menu |

This queue is for tickets about the Spectrum-CLI CPAN distribution.

Report information
The Basics
Id: 74085
Status: new
Priority: 0/
Queue: Spectrum-CLI

People
Owner: Nobody in particular
Requestors: jlbastos [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: show_attributes fail when value is an embedded XML
Date: Tue, 17 Jan 2012 10:47:32 -0200
To: bug-Spectrum-CLI [...] rt.cpan.org
From: Jorge Bastos <jlbastos [...] gmail.com>
Some attributes have an embedded XML as value, and this is messing up the results of show_attributes() The attributes are "UserPreferences", "GroupPreferences", "UserGroupPreferences" and possibly others. I sugest the following patch: *** Spectrum/CLI.pm 2012-01-16 18:43:46.000000000 -0200 --- Spectrum/CLI.pm.new 2012-01-16 18:44:29.000000000 -0200 *************** *** 254,259 **** --- 254,269 ---- $self->{status} } + sub need_hacked_show { + my $self = shift; + die unless ref($self); + if (@_) { + $self->{need_hacked_show} = shift + } else { + $self->{need_hacked_show} + } + } + sub AUTOLOAD { my $self = shift; my $call = $Spectrum::CLI::AUTOLOAD; *************** *** 346,351 **** --- 356,371 ---- $val =~ s/\s+$//; $results[$index]{$headings[$lcv]} = $val } + if ( $self->{need_hacked_show} == 1 ) { + while (<$fh>) { + my $val; + push(@{$self->{results}}, $_); + chomp; + $val = $_; + $val =~ s/\s+$//; + $results[$index]{$headings[$lcv-1]} .= $val; + } + } } # } waitpid($pid, 0); *************** *** 657,662 **** --- 677,694 ---- This method returns the exit status of the last vnmsh command that was executed. + =item B<need_hacked_show> + + $obj->need_hacked_show(1); + $User_Preference = $cli->show_attributes( "attr=" . $Attributes{'UserPreferences'}{'Id'}, "mh=" . $User_MH); + $obj->need_hacked_show(0); + + This method changes the processing of the show command. + When this hack is active only the first line after the header is processed normally, the others are appended to the last field contents. + This hack is needed when showing attributes that have an embedded XML as value ("UserPreferences", "GroupPreferences", "UserGroupPreferences", + and possibly others) + This function only when showing one attribute. + =back =head1 IMPLEMENTATION