Entry.pm 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #
  2. # Parse::DebianChangelog::Entry
  3. #
  4. # Copyright 2005 Frank Lichtenheld <frank@lichtenheld.de>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. #
  20. =head1 NAME
  21. Parse::DebianChangelog::Entry - represents one entry in a Debian changelog
  22. =head1 SYNOPSIS
  23. =head1 DESCRIPTION
  24. =head2 Methods
  25. =head3 init
  26. Creates a new object, no options.
  27. =head3 new
  28. Alias for init.
  29. =head3 is_empty
  30. Checks if the object is actually initialized with data. Due to limitations
  31. in Parse::DebianChangelog this currently simply checks if one of the
  32. fields Source, Version, Maintainer, Date, or Changes is initalized.
  33. =head2 Accessors
  34. The following fields are available via accessor functions (all
  35. fields are string values unless otherwise noted):
  36. =over 4
  37. =item *
  38. Source
  39. =item *
  40. Version
  41. =item *
  42. Distribution
  43. =item *
  44. Urgency
  45. =item *
  46. ExtraFields (all fields except for urgency as hash)
  47. =item *
  48. Header (the whole header in verbatim form)
  49. =item *
  50. Changes (the actual content of the bug report, in verbatim form)
  51. =item *
  52. Trailer (the whole trailer in verbatim form)
  53. =item *
  54. Closes (Array of bug numbers)
  55. =item *
  56. Maintainer (name B<and> email address)
  57. =item *
  58. Date
  59. =item *
  60. Timestamp (Date expressed in seconds since the epoche)
  61. =item *
  62. ERROR (last parse error related to this entry in the format described
  63. at Parse::DebianChangelog::get_parse_errors.
  64. =back
  65. =cut
  66. package Parse::DebianChangelog::Entry;
  67. use strict;
  68. use warnings;
  69. use base qw( Class::Accessor );
  70. use Parse::DebianChangelog::Util qw( :all );
  71. Parse::DebianChangelog::Entry->mk_accessors(qw( Closes Changes Maintainer
  72. MaintainerEmail Date
  73. Urgency Distribution
  74. Source Version ERROR
  75. ExtraFields Header
  76. Trailer Timestamp ));
  77. sub new {
  78. return init(@_);
  79. }
  80. sub init {
  81. my $classname = shift;
  82. my $self = {};
  83. bless( $self, $classname );
  84. return $self;
  85. }
  86. sub is_empty {
  87. my ($self) = @_;
  88. return !($self->{Changes}
  89. || $self->{Source}
  90. || $self->{Version}
  91. || $self->{Maintainer}
  92. || $self->{Date});
  93. }
  94. 1;
  95. __END__
  96. =head1 SEE ALSO
  97. Parse::DebianChangelog
  98. =head1 AUTHOR
  99. Frank Lichtenheld, E<lt>frank@lichtenheld.deE<gt>
  100. =head1 COPYRIGHT AND LICENSE
  101. Copyright (C) 2005 by Frank Lichtenheld
  102. This program is free software; you can redistribute it and/or modify
  103. it under the terms of the GNU General Public License as published by
  104. the Free Software Foundation; either version 2 of the License, or
  105. (at your option) any later version.
  106. This program is distributed in the hope that it will be useful,
  107. but WITHOUT ANY WARRANTY; without even the implied warranty of
  108. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  109. GNU General Public License for more details.
  110. You should have received a copy of the GNU General Public License
  111. along with this program; if not, write to the Free Software
  112. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  113. =cut