File Coverage

blib/lib/Image/Processor/Interface/Console.pm
Criterion Covered Total %
statement 6 35 17.1
branch 0 10 0.0
condition n/a
subroutine 2 8 25.0
pod 0 6 0.0
total 8 59 13.5


line stmt bran cond sub pod time code
1             package Image::Processor::Interface::Console;
2            
3 1     1   5 use strict;
  1         1  
  1         30  
4 1     1   4 use base ( 'Image::Processor::Base' );
  1         2  
  1         404  
5            
6             # handles all the Console interaction
7            
8             sub prompt_for_directory_creation {
9 0     0 0   my ($self,$set) = @_;
10 0 0         return $self->{'prompt_for_directory_creation'} if !$set;
11 0           $self->{'prompt_for_directory_creation'} = $set;
12             }
13            
14             sub console_get_drive {
15 0     0 0   my ($self) = @_;
16 0           $self->running_in('console');
17 0           print "Please indicate which drive your CD is in";
18 0           $_=<>;
19 0           chomp;
20            
21 0           $self->cdrom($_);
22 0           $self->read_info_cd();
23             }
24            
25             sub console_prompt {
26 0     0 0   my ($self,$string) = @_;
27 0           print "$string ";
28 0           $_=<>;
29 0           chomp;
30 0           return $_;
31             }
32            
33             sub prompt_for_output_directory {
34 0     0 0   my ($self) = @_;
35 0           $self->output_directory(
36             $self->console_prompt("Output directory")
37             );
38            
39 0           $self->process();
40             }
41            
42             sub prompt_to_verify_directory_creation {
43 0     0 0   my ($self) = @_;
44 0 0         if (!-d $self->output_directory) {
45 0 0         if ($self->prompt_for_directory_creation) {
46 0 0         if ($self->console_prompt(
47             "Directory - " . $self->output_directory . "\ndoes not exist do you want me to create it?"
48             ) =~ /y/i)
49             {
50 0           $self->create_path($self->output_directory());
51             } else {
52 0           print "Nothing more for me to do then, bye!\n\n";
53 0           die;
54            
55             }
56             } else {
57 0           $self->create_path($self->output_directory());
58             }
59             }
60             }
61            
62             sub prompt_for_caption {
63 0     0 0   my ($self,$set) = @_;
64 0 0         return $self->{'prompt_for_caption'} if !$set;
65 0           $self->{'prompt_for_caption'} = $set;
66             }
67            
68             1;
69            
70             __END__