| 1 | # $Id: Rules.pm 2258 2006-11-25 08:12:37Z joern $ | ||
| 2 | |||
| 3 | #----------------------------------------------------------------------- | ||
| 4 | # Copyright (C) 2001-2006 Jörn Reder <joern AT zyn.de>. | ||
| 5 | # All Rights Reserved. See file COPYRIGHT for details. | ||
| 6 | # | ||
| 7 | # This module is part of Video::DVDRip, which is free software; you can | ||
| 8 | # redistribute it and/or modify it under the same terms as Perl itself. | ||
| 9 | #----------------------------------------------------------------------- | ||
| 10 | |||
| 11 | package Video::DVDRip::GUI::Rules; | ||
| 12 | |||
| 13 | use strict; | ||
| 14 | |||
| 15 | use base qw(Gtk2::Ex::FormFactory::Rules); | ||
| 16 | |||
| 17 | sub new { | ||
| 18 | my $class = shift; | ||
| 19 | |||
| 20 | my $self = $class->SUPER::new(@_); | ||
| 21 | |||
| 22 | my $rules = $self->get_rules; | ||
| 23 | my $msg = $self->get_rules_messages; | ||
| 24 | |||
| 25 | $rules->{"project-name"} = sub { $_[0] =~ m!^[-\w.]+$!i }; | ||
| 26 | $rules->{"project-path"} = sub { $_[0] =~ m!^[-\w./]+$!i }; | ||
| 27 | |||
| 28 | $msg->{"project-name"} = "Project name must contain no special characters"; | ||
| 29 | $msg->{"project-path"} = "Path must contain no special characters"; | ||
| 30 | |||
| 31 | return $self; | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; |