5 =head1 NAME $RCSfile: speak,v $
7 Simply speaks the passed in message, clipboard or file
15 Andrew DeFaria <Andrew@DeFaria.com>
23 Wed 24 Feb 2021 12:01:12 PM PST
31 Usage: speak [-usa|ge] [-h|elp] [-v|erbose] [-de|bug]
32 [-c|lipboard] [-f|ile <filename>] ["message"]
35 -usa|ge: Print this usage
37 -v|erbose: Verbose mode (Default: -verbose)
38 -de|bug: Turn on debugging (Default: Off)
39 -c|lipboard: Speak the contents of the clipboard
40 -f|ile <filename> Speak the contents of <filename>
41 "message" Speak the message
45 This script speaks the contents of the passed in message, clipboard or file
56 use lib"$FindBin::Bin/../lib";
63 usage => sub { pod2usage },
64 help => sub { pod2usage(-verbose => 2)},
65 verbose => sub { set_verbose },
66 debug => sub { set_debug },
80 my $msg = join ' ', @ARGV;
82 if ($opts{clipboard}) {
84 error 'Cannot specify both -clipboard and -file', 1;
86 error 'Cannot specify both -clipboard and <message>', 1;
88 $msg = Clipboard->paste;
90 } elsif ($opts{file}) {
92 error 'Cannot specify both -file and <message>', 1;
94 open my $file, '<', $opts{file} or
95 error "Unable to open $opts{file} - $!", 1;