in reply to Array of Hashes Svn::Log confusion
Because I came across my own question when I searched on this topic (having apparently given up the previous time) and I am now working on the same problem. I thought I would post my own solution (which I expect deserves to be savaged). So the poor schmuck wrestling with the same problem, has something to reflect on.
For the record I read the suggestions (thanking contributors very much for your assistance). It must have been a bit above my ability to grok apparently. Yes, I may be a dope. For me it's always the syntax that baffles me and I confess I do not completely understand what I am doing even now, yet have to do it anyway.
So here is my solution in part.
use strict; use warnings; use SVN::Log; my $SVNrevs=SVN::Log::retrieve($branchURL, $firstTagRev, $secondTagRev +); $i=0; #need this because part the data structure demands it. foreach @$SVNrevs){ # the easy part print $SVNrevs->[$i]{revision}, ","; print $SVNrevs->[$i]{date }, ","; print $SVNrevs->[$i]{author }, "\n"; # This is the pissy bit. Getting the path and the action which are chi +ldren of the path element (the embedded hash) foreach my $recordpath ( keys $SVNrevs->[$i] ) { for my $path ( keys %{ $SVNrevs->[$i]{$recordpath} } ) { foreach my $action ($SVNrevs->[$i]{$recordpath}{$path}{'actio +n'}) { print "\t$action\t$path\n"; } } } my $message=$SVNrevs->[$i]{message }; $_=$message; s/\n/ /gi; #cleaning up random newlines in the message $message = $_; print "\n\t $message \n\n"; # } $i++; #iterate for the next record }
Incidentally much of the example code (in the module doc and elsewhere including O'Reilly's Perl books for general concepts and examples, which I rely heavily upon) caused unexpected results (the way I applied it) such as duplicating the array (@SVNrevs) which was unnecessary, and I found the while loop to be tricky to figure out how many times to iterate. I made it work. It may not be elegant, but it's doing the job.
Thanks all for your suggestions which in part finally helped me help myself.
|
|---|