Fields.pm 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright © 2007-2009 Raphaël Hertzog <hertzog@debian.org>
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. package Dpkg::Control::Fields;
  16. use strict;
  17. use warnings;
  18. our $VERSION = '1.00';
  19. use Exporter qw(import);
  20. use Dpkg::Control::FieldsCore;
  21. use Dpkg::Vendor qw(run_vendor_hook);
  22. our @EXPORT = @Dpkg::Control::FieldsCore::EXPORT;
  23. # Register vendor specifics fields
  24. foreach my $op (run_vendor_hook('register-custom-fields')) {
  25. next if not (defined $op and ref $op); # Skip when not implemented by vendor
  26. my $func = shift @$op;
  27. if ($func eq 'register') {
  28. &field_register(@$op);
  29. } elsif ($func eq 'insert_before') {
  30. &field_insert_before(@$op);
  31. } elsif ($func eq 'insert_after') {
  32. &field_insert_after(@$op);
  33. } else {
  34. internerr("vendor hook register-custom-fields sent bad data: @$op");
  35. }
  36. }
  37. =encoding utf8
  38. =head1 NAME
  39. Dpkg::Control::Fields - manage (list of official) control fields
  40. =head1 DESCRIPTION
  41. The module contains a list of vendor-neutral and vendor-specific fieldnames
  42. with associated meta-data explaining in which type of control information
  43. they are allowed. The vendor-neutral fieldnames and all functions are
  44. inherited from Dpkg::Control::FieldsCore.
  45. =head1 AUTHOR
  46. Raphaël Hertzog <hertzog@debian.org>.
  47. =cut
  48. 1;