Skip to content

Instantly share code, notes, and snippets.

@kowey
Created March 15, 2010 12:06
Show Gist options
  • Select an option

  • Save kowey/332783 to your computer and use it in GitHub Desktop.

Select an option

Save kowey/332783 to your computer and use it in GitHub Desktop.
use XML::Simple;
use File::Slurp;
my $foo = read_file "foo.xml";
my $xml = eval { XMLin($foo); };
for my $patch_name (keys %{ $xml->{patch} }) {
print "saw: $patch_name \n";
}
# $xml structure returned looks like this:
# 'patch' => {
# 'resolved issue123: adding t.t' => {
# 'hash' => '20080215033723-20bb4-54f935f89817985a3e98f3de8e8ac9dad5e8e0e5.gz',
# 'inverted' => 'False',
# 'date' => '20080215033723',
# 'author' => 'Mark Stosberg <mark@summersault.com>',
# 'local_date' => 'Thu Feb 14 22:37:23 EST 2008'
# },
# 'some other patch' => { ... },
<!-- what happens when you comment out one of the patches here? -->
<changelog>
<patch author='Ganesh Sittampalam &lt;ganesh@earth.li&gt;' date='20100314224948' local_date='Sun Mar 14 22:49:48 GMT 2010' inverted='False' hash='20100314224948-81bb2-fcda5a7f7a6aedb5e7783a772c286b9d0cd21574.gz'>
<name>resolve issue1767: send CRC warnings to stderr</name>
<comment>Ignore-this: b0555759c3fa55fc9689f9a957d9eb1</comment>
</patch>
<patch author='Reinier Lamers &lt;tux_rocker@reinier.de&gt;' date='20100221113357' local_date='Sun Feb 21 11:33:57 GMT 2010' inverted='False' hash='20100221113357-ead41-0d966e6b74660b574d2d6de4e6c4cc0c6cf9b0e0.gz'>
<name>resolve issue1749: refuse to remove nonempty directories in makeRemovePatch</name>
<comment>Ignore-this: ad57e75a8f336ca97a981e16933a74ea</comment>
</patch>
</changelog>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment