home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / perl5 / Dpkg / Vars.pm < prev    next >
Encoding:
Perl POD Document  |  2012-09-17  |  1.5 KB  |  54 lines

  1. # Copyright ┬⌐ 2007 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.  
  16. package Dpkg::Vars;
  17.  
  18. use strict;
  19. use warnings;
  20.  
  21. our $VERSION = "0.01";
  22.  
  23. use Dpkg::ErrorHandling;
  24. use Dpkg::Gettext;
  25.  
  26. use base qw(Exporter);
  27. our @EXPORT = qw($sourcepackage set_source_package);
  28.  
  29. our $sourcepackage;
  30.  
  31. sub check_package_name {
  32.     my $name = shift || '';
  33.     $name =~ m/[^-+.0-9a-z]/o &&
  34.         error(_g("source package name `%s' contains illegal character `%s'"),
  35.               $name, $&);
  36.     $name =~ m/^[0-9a-z]/o ||
  37.         error(_g("source package name `%s' starts with non-alphanum"), $name);
  38. }
  39.  
  40. sub set_source_package {
  41.     my $v = shift;
  42.  
  43.     check_package_name($v);
  44.     if (defined($sourcepackage)) {
  45.         $v eq $sourcepackage ||
  46.             error(_g("source package has two conflicting values - %s and %s"),
  47.                   $sourcepackage, $v);
  48.     } else {
  49.         $sourcepackage = $v;
  50.     }
  51. }
  52.  
  53. 1;
  54.