| 1 | package Audio::Beep::Linux::beep; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | $Audio::Beep::Linux::beep::VERSION = 0.11; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 8 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 9 | 1 | my %hash = @_; | |||||||||||||||||||||||||||
| 10 | 1 | ▶ | $hash{path} ||= _search_path(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$hash{"path"} ||= _search_path()
MC/DC0%0/2
$hash{"path"} ||= _search_path()
$hash{"path"}
_search_path()
Truth table33%1/3
A ||= B
A= $hash{"path"}B= _search_path()
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | return unless $hash{path}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 12 | 0 | return bless \%hash, $class; | |||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub play { | ||||||||||||||||||||||||||
|
Subroutine
play: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 17 | 0 | my ($pitch, $duration) = @_; | |||||||||||||||||||||||||||
| 18 | 0 | return `\Q$self->{path}\E -l $duration -f $pitch`; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub rest { | ||||||||||||||||||||||||||
|
Subroutine
rest: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 22 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 23 | 0 | my ($duration) = @_; | |||||||||||||||||||||||||||
| 24 | 0 | select undef, undef, undef, $duration/1000; | |||||||||||||||||||||||||||
| 25 | 0 | return 1; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 1 | ▶ | sub _search_path { | ||||||||||||||||||||||||||
|
Subroutine
_search_path: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||
| 29 | 1 | my @prob_paths = qw( | |||||||||||||||||||||||||||
| 30 | /usr/bin/beep | ||||||||||||||||||||||||||||
| 31 | /usr/local/bin/beep | ||||||||||||||||||||||||||||
| 32 | /bin/beep | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | 1 | ▶ | do { return $_ if -e and -x _ } for @prob_paths; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-e $_ and -x _
MC/DC0%0/2
-e $_ and -x _
-e $_
-x _
Truth table33%1/3
A and B
A= -e $_B= -x _
| |||||||||||||||||||||||||||||
| 35 | 1 | return; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 NAME | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | Audio::Beep::Linux::beep - Audio::Beep player module using the B<beep> program | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 SYNOPIS | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | my $player = Audio::Beep::Linux::beep->new([%options]); | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =head1 USAGE | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | The C<new> class method can receive as option in hash fashion the following | ||||||||||||||||||||||||||||
| 49 | directives | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =over 4 | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =item path => '/full/path/to/beep' | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | With the path option you can set the full path to the B<beep> program in | ||||||||||||||||||||||||||||
| 56 | the object. If you don't use this option the new method will look anyway | ||||||||||||||||||||||||||||
| 57 | in some likely places where B<beep> should be before returning undef. | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =back | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 NOTES | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | The B<beep> program is a Linux program wrote by Johnathan Nightingale. | ||||||||||||||||||||||||||||
| 64 | You should find C sources in the tarball where you found this file. | ||||||||||||||||||||||||||||
| 65 | The B<beep> program needs to be (usually) executed as root to actually work. | ||||||||||||||||||||||||||||
| 66 | Please check C<beep(1)> for more info. | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =head1 BUGS | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | None known. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | Copyright 2003-2004 Giulio Motta L<giulienk@cpan.org>. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | This library is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||
| 77 | modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =cut | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 1 | 1; | |||||||||||||||||||||||||||