App-Music-PlayTab
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/Music/PlayTab.pm view on Meta::CPAN
# Update Count : 568
# Status : Unknown, Use with caution!
################ Common stuff ################
use strict;
use warnings;
use App::Music::PlayTab::Version;
our $VERSION = $App::Music::PlayTab::Version::VERSION;
# Package name.
my $my_package = 'Sciurix';
# Program name and version.
my ($my_name, $my_version) = ( 'playtab', $VERSION );
use base qw(Exporter);
our @EXPORT = qw(run);
################ Command line parameters ################
use Getopt::Long;
sub app_options();
my $output;
my $generate;
my $preamble;
my $gxpose = 0; # global xpose value
my $verbose = 0; # verbose processing
my $lilypond = 0; # use LilyPond syntax
my $bpm = 4;
my $syntax; # show syntax help
# Development options (not shown with -help).
my $debug = 0; # debugging
my $trace = 0; # trace (show process)
my $test = 0; # test
################ The Process ################
my $line; # current line (for messages)
my $xpose = $gxpose;
my $data; # opus being constructed
my $entry; # entry under construction
my $width = 30; # horizontal 'step' for chords
my $height = -15; # vertical 'step' for lines
my $margin = 40; # default indentation, if required
my $indent = 0; # actual indentation
my $barno; # barnumber (slightly magical)
my $s_margin = $margin; # save values
my $s_indent = 0; # save values
use App::Music::PlayTab::Output;
use Encode;
use Clone qw(clone);
sub run {
local (@ARGV) = @_ ? @_ : @ARGV;
app_options();
binmode( STDERR, ':utf8' );
print STDOUT ("ok 1\n") if $test;
if ( defined $output ) {
open(OUTPUT, ">$output") or print STDOUT ("not ") if $test;
print STDOUT ("ok 2\n") if $test;
}
else {
die("Test mode requires -output option to be set\n") if $test;
*OUTPUT = *STDOUT;
}
# Options post-processing.
$trace |= ($debug || $test);
$xpose = $gxpose;
# Actually we should probe all backends and let them register what
# they can handle.
$generate = 'PDF' if $Cava::Packager::PACKAGED;
if ( $generate ) {
if ( $generate eq 'ps' ) {
$generate = 'PostScript';
}
elsif ( $generate eq 'pdf' ) {
$generate = 'PDF';
}
}
elsif ( $output ) {
if ( $output =~ /\.ps$/i ) {
$generate = 'PostScript';
}
elsif ( $output =~ /\.pdf$/i ) {
$generate = 'PDF';
}
elsif ( $output =~ /\.dmp$/i ) {
$generate = 'Dump';
}
}
$generate ||= 'PDF';
my $gen = App::Music::PlayTab::Output->new({
generate => $generate,
output => $output,
});
print STDOUT ("ok 3\n") if $test;
reset_globals();
while ( <> ) {
# Skip comment lines.
next if /^\s*#/;
# Skip LilyPond comment lines.
next if $lilypond && /^\s*%/;
# Remove LilyPond line number comments.
$lilypond && s/\s+\%\s*\d+.*//;
# Skip empty lines.
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.458 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )