summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Control
diff options
context:
space:
mode:
authorRaphaël Hertzog <hertzog@debian.org>2010-02-20 23:39:15 +0100
committerRaphaël Hertzog <hertzog@debian.org>2010-02-21 00:07:32 +0100
commit513baa2c1e20036528fd8fb986ef407d4aa8d415 (patch)
treeeb9b65323f061cffe250b6371ad44439a1f7cde4 /scripts/Dpkg/Control
parentd13625a19aa5e49e71ea1c08317198c0094a0047 (diff)
downloaddpkg-513baa2c1e20036528fd8fb986ef407d4aa8d415.tar.gz
Dpkg::Control::Info: provide an array representation of the object
Add non-regression test for this interface.
Diffstat (limited to 'scripts/Dpkg/Control')
-rw-r--r--scripts/Dpkg/Control/Info.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/Dpkg/Control/Info.pm b/scripts/Dpkg/Control/Info.pm
index 14bdad149..3f3ef2604 100644
--- a/scripts/Dpkg/Control/Info.pm
+++ b/scripts/Dpkg/Control/Info.pm
@@ -1,4 +1,4 @@
-# Copyright © 2007 Raphaël Hertzog <hertzog@debian.org>
+# Copyright © 2007-2010 Raphaël Hertzog <hertzog@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +24,9 @@ use Dpkg::Gettext;
use base qw(Dpkg::Interface::Storable);
+use overload
+ '@{}' => sub { return [ $_[0]->{source}, @{$_[0]->{packages}} ] };
+
=head1 NAME
Dpkg::Control::Info - parse files like debian/control
@@ -108,6 +111,7 @@ sub parse {
}
}
+=item $c->[0]
=item $c->get_source()
Returns a Dpkg::Control object containing the fields concerning the
@@ -176,6 +180,16 @@ sub output {
return $str;
}
+=item "$c"
+
+Return a string representation of the content.
+
+=item @{$c}
+
+Return a list of Dpkg::Control objects, the first one is corresponding to
+source information and the following ones are the binary packages
+information.
+
=back
=head1 AUTHOR