ItemDef.pm 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Copyright (C) 2003-2017 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 2, or (at your option)
  5. # any later version.
  6. # This program is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. # GNU General Public License for more details.
  10. # You should have received a copy of the GNU General Public License
  11. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  12. package Automake::ItemDef;
  13. use 5.006;
  14. use strict;
  15. use Carp;
  16. =head1 NAME
  17. Automake::ItemDef - base class for Automake::VarDef and Automake::RuleDef
  18. =head1 DESCRIPTION
  19. =head2 Methods
  20. =over 4
  21. =item C<my $def = Automake::new ($comment, $location, $owner)>
  22. Create a new Makefile-item definition.
  23. C<$comment> is any comment preceding the definition. (Because
  24. Automake reorders items in the output, it also tries to carry comments
  25. around.)
  26. C<$location> is the place where the definition occurred, it should be
  27. an instance of L<Automake::Location>.
  28. C<$owner> specifies who owns the rule.
  29. =cut
  30. sub new ($$$$)
  31. {
  32. my ($class, $comment, $location, $owner) = @_;
  33. my $self = {
  34. comment => $comment,
  35. location => $location,
  36. owner => $owner,
  37. };
  38. bless $self, $class;
  39. return $self;
  40. }
  41. =item C<$def-E<gt>comment>
  42. =item C<$def-E<gt>location>
  43. =item C<$def-E<gt>owner>
  44. Accessors to the various constituents of an C<ItemDef>. See the
  45. documentation of C<new>'s arguments for a description of these.
  46. =cut
  47. sub comment ($)
  48. {
  49. my ($self) = @_;
  50. return $self->{'comment'};
  51. }
  52. sub location ($)
  53. {
  54. my ($self) = @_;
  55. return $self->{'location'};
  56. }
  57. sub owner ($)
  58. {
  59. my ($self) = @_;
  60. return $self->{'owner'};
  61. }
  62. =head1 SEE ALSO
  63. L<Automake::VarDef>, and L<Automake::RuleDef>.
  64. =cut
  65. 1;
  66. ### Setup "GNU" style for perl-mode and cperl-mode.
  67. ## Local Variables:
  68. ## perl-indent-level: 2
  69. ## perl-continued-statement-offset: 2
  70. ## perl-continued-brace-offset: 0
  71. ## perl-brace-offset: 0
  72. ## perl-brace-imaginary-offset: 0
  73. ## perl-label-offset: -2
  74. ## cperl-indent-level: 2
  75. ## cperl-brace-offset: 0
  76. ## cperl-continued-brace-offset: 0
  77. ## cperl-label-offset: -2
  78. ## cperl-extra-newline-before-brace: t
  79. ## cperl-merge-trailing-else: nil
  80. ## cperl-continued-statement-offset: 2
  81. ## End: