summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorbwarken <bwarken>2013-04-25 00:21:14 +0000
committerbwarken <bwarken>2013-04-25 00:21:14 +0000
commiteeee598f31bbf1551a6fc1c642b6a16dd6c9d394 (patch)
treecce18b0a7892dbdbd1a31006eccaec44a9e3b1fc /contrib
parenta2c1c353871850fc092b4b52dd6998fb89f2a61e (diff)
downloadgroff-eeee598f31bbf1551a6fc1c642b6a16dd6c9d394.tar.gz
Public `glilypond' version `v1.1'.
args.pl, sub.pl, glilypond.man: Change option `-v' to mean `--verbose' instead of former `--version' such as many GNU programs do. Correct sub `&usage()' and man-page. args.pl, glilypond.pl, oop_fh.pl, subs.pl: Remove spaces in ` -> ', some `( ... )', and some `{ ... }' places for better readability of the Perl source code.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/glilypond/ChangeLog14
-rw-r--r--contrib/glilypond/args.pl120
-rw-r--r--contrib/glilypond/glilypond.man18
-rwxr-xr-xcontrib/glilypond/glilypond.pl218
-rw-r--r--contrib/glilypond/oop_fh.pl38
-rw-r--r--contrib/glilypond/subs.pl134
6 files changed, 278 insertions, 264 deletions
diff --git a/contrib/glilypond/ChangeLog b/contrib/glilypond/ChangeLog
index 8eb2e75f..428afaeb 100644
--- a/contrib/glilypond/ChangeLog
+++ b/contrib/glilypond/ChangeLog
@@ -1,9 +1,21 @@
2013-04-24 Bernd Warken <groff-bernd.warken-72@web.de>
+ Public `glilypond' version `v1.1'.
+
+ * args.pl, sub.pl, glilypond.man: Change option `-v' to mean
+ `--verbose' instead of former `--version' such as many GNU
+ programs do. Correct sub `&usage()' and man-page.
+
+ * args.pl, glilypond.pl, oop_fh.pl, subs.pl: Remove spaces in
+ ` -> ', some `( ... )', and some `{ ... }' places for better
+ readability of the Perl source code.
+
+2013-04-24 Bernd Warken <groff-bernd.warken-72@web.de>
+
* args.pl, oop_fh.pl: Remove 1st line calling `perl'.
* subs.pl: Remove 1st line calling `perl'. Remove sub
- `&perl_version'. Adjust sub `&usage'.
+ `&perl_version()'. Adjust sub `&usage()'.
* glilypond.pl: Keep 1st line, which will be reset by running
`make'. Remove all parts of Perl testing.
diff --git a/contrib/glilypond/args.pl b/contrib/glilypond/args.pl
index 8b2fc0e2..dbfe7562 100644
--- a/contrib/glilypond/args.pl
+++ b/contrib/glilypond/args.pl
@@ -1,8 +1,8 @@
-my $License = q*
########################################################################
# Legalese
########################################################################
+my $License = q*
groff_lilypond - integrate `lilypond' into `groff' files
Source file position: `<groff-source>/contrib/lilypond/groff_lilypond.pl'
@@ -11,7 +11,7 @@ Installed position: `<prefix>/bin/groff_lilypond'
Copyright (C) 2013 Free Software Foundation, Inc.
Written by Bernd Warken <groff-bernd.warken-72@web.de>
-Last update: 26 Mar 2013
+Last update: 25 Apr 2013
This file is part of `GNU groff'.
@@ -51,19 +51,19 @@ my %opts_with_arg =
(
'--eps_dir' => sub {
- $Args -> { 'eps_dir' } = shift;
+ $Args->{'eps_dir'} = shift;
},
'--output' => sub {
- $Args -> { 'output' } = shift;
+ $Args->{'output'} = shift;
},
'--prefix' => sub {
- $Args -> { 'prefix' } = shift;
+ $Args->{'prefix'} = shift;
},
'--temp_dir' => sub {
- $Args -> { 'temp_dir' } = shift;
+ $Args->{'temp_dir'} = shift;
},
); # end of %opts_with_arg
@@ -78,7 +78,7 @@ my %opts_noarg =
},
'--keep_all' => sub {
- $Args -> { 'keep_all' } = TRUE;
+ $Args->{'keep_all'} = TRUE;
},
'--license' => sub {
@@ -87,15 +87,15 @@ my %opts_noarg =
},
'--ly2eps' => sub {
- $Args -> { 'eps_func' } = 'ly';
+ $Args->{'eps_func'} = 'ly';
},
'--pdf2eps' => sub {
- $Args -> { 'eps_func' } = 'pdf';
+ $Args->{'eps_func'} = 'pdf';
},
'--verbose' => sub {
- $Args -> { 'verbose' } = TRUE;
+ $Args->{'verbose'} = TRUE;
},
'--version' => sub {
@@ -123,8 +123,9 @@ my $arg = EMPTYSTRING;
my $has_arg = FALSE;
-# split short option collections and transfer these to suitable
-# long options from above
+# Split short option collections and transfer these to suitable long
+# options from above. Note that `-v' now means `--verbose' in version
+# `v1.1', earlier versions had `--version' for `-v'.
my %short_opts =
(
@@ -136,7 +137,7 @@ my %short_opts =
'o' => '--output',
'p' => '--prefix',
't' => '--temp_dir',
- 'v' => '--version',
+ 'v' => '--verbose',
'V' => '--verbose',
);
@@ -183,23 +184,23 @@ my $split_short = sub {
CHARS: while ( @chars ) {
my $c = shift @chars;
- unless ( exists $short_opts{ $c } ) {
- $stderr -> print( "Unknown short option `-$c'." );
+ unless ( exists $short_opts{$c} ) {
+ $stderr->print( "Unknown short option `-$c'." );
next CHARS;
}
# short option exists
# map or transfer to special long option from above
- my $transopt = $short_opts{ $c };
+ my $transopt = $short_opts{$c};
- if ( exists $opts_noarg{ $transopt } ) {
+ if ( exists $opts_noarg{$transopt} ) {
push @splitted_args, $transopt;
- $Args -> { 'verbose' } = TRUE if ( $transopt eq '--verbose' );
+ $Args->{'verbose'} = TRUE if ( $transopt eq '--verbose' );
next CHARS;
}
- if ( exists $opts_with_arg{ $transopt } ) {
+ if ( exists $opts_with_arg{$transopt} ) {
push @splitted_args, $transopt;
if ( @chars ) {
@@ -240,25 +241,25 @@ my $split_long = sub {
# no match, so luck for fewer number of chars
next N unless ( $argn );
- next N unless ( exists $long_opts[ $n ] -> { $argn } );
+ next N unless ( exists $long_opts[$n]->{$argn} );
# not in $n hash, so go on to next loop for $n
# now $n-hash has arg
# map or transfer to special long opt from above
- my $transopt = $long_opts[ $n ] -> { $argn };
+ my $transopt = $long_opts[$n]->{$argn};
# test on option without arg
- if ( exists $opts_noarg{ $transopt } ) { # opt has no arg
+ if ( exists $opts_noarg{$transopt} ) { # opt has no arg
$stderr->print( 'Option ' . $transopt . 'has no argument: ' .
- $from_arg . '.') if ( defined($optarg) );
+ $from_arg . '.' ) if ( defined($optarg) );
push @splitted_args, $transopt;
- $Args -> { 'verbose' } = TRUE if ( $transopt eq '--verbose' );
+ $Args->{'verbose'} = TRUE if ( $transopt eq '--verbose' );
return TRUE; # use `next SPLIT' afterwards
} # end of if %opts_noarg
# test on option with arg
- if ( exists $opts_with_arg{ $transopt } ) { # opt has arg
+ if ( exists $opts_with_arg{$transopt} ) { # opt has arg
push @splitted_args, $transopt;
# test on optarg in arg
@@ -273,8 +274,8 @@ my $split_long = sub {
} # end of if %opts_with_arg
# not with and without option, so is not permitted
- $stderr -> print( "`" . $transopt .
- "' is unknown long option from `" . $from_arg . "'" );
+ $stderr->print( "`" . $transopt .
+ "' is unknown long option from `" . $from_arg . "'" );
return TRUE; # use `next SPLIT' afterwards
} # end of for N
return FALSE; # do nothing
@@ -323,12 +324,12 @@ sub run_first {
)
$
/x ) {
- $split_short -> ( $1 );
+ $split_short->($1);
next SPLIT;
} # end of short option
if ( /^--/ ) { # starts with 2 dashes, a long option
- $split_long -> ( $_ );
+ $split_long->($_);
next SPLIT;
} # end of long option
@@ -338,7 +339,7 @@ sub run_first {
} # end of foreach SPLIT
# all args are considered
- $stderr -> print( "Option `$has_arg' needs an argument." )
+ $stderr->print( "Option `$has_arg' needs an argument." )
if ( $has_arg );
@@ -352,45 +353,48 @@ sub run_first {
# open or ignore verbose output
#----------
sub install_verbose {
- if ( $Args -> { 'verbose' } ) { # `--verbose' was used
+ if ( $Args->{'verbose'} ) { # `--verbose' was used
# make verbose output into $v
- my $s = $v -> get(); # get content of string so far as array ref, close
+ my $s = $v->get(); # get content of string so far as array ref, close
$v = new FH_STDERR(); # make verbose output into STDERR
if ( $s ) {
for ( @$s ) {
# print the file content into new verbose output
- $v -> print( $_ );
+ $v->print($_);
}
}
# verbose output is now active (into STDERR)
+ $v->print( "Option `-v' means `--verbose'." );
+ $v->print( "Version information is printed by option `--version'." );
+ $v->print( "#" x 72 );
} else { # `--verbose' was not used
# do not be verbose, make verbose invisible
- $v -> close(); # close and ignore the string content
+ $v->close(); # close and ignore the string content
$v = new FH_NULL();
# this is either into /dev/null or in an ignored string
} # end if-else about verbose
- # `$v -> print' works now in any case
+ # `$v->print' works now in any case
- $v -> print( "Verbose output was chosen." );
+ $v->print( "Verbose output was chosen." );
- my $s = $Globals -> { 'prog_is_installed' } ? '' : ' not';
- $v -> print( $Globals -> { 'prog' } . " is" . $s .
- " installed." );
+ my $s = $Globals->{'prog_is_installed'} ? '' : ' not';
+ $v->print( $Globals->{'prog'} . " is" . $s .
+ " installed." );
- $v -> print( 'The command line options are:' );
+ $v->print( 'The command line options are:' );
$s = " options:";
$s .= " `" . $_ . "'" for ( @ARGV );
- $v -> print( $s );
+ $v->print( $s );
$s = " file names:";
$s .= " `" . $_ . "'\n" for ( @files );
- $v -> print( $s );
+ $v->print( $s );
} # end install_verbose()
@@ -410,29 +414,29 @@ sub run_second {
last ARGS if ( $arg eq '--' );
if ( $has_arg ) {
- unless ( exists $opts_with_arg{ $has_arg } ) {
- $stderr -> print( "`\%opts_with_args' does not have key `" .
+ unless ( exists $opts_with_arg{$has_arg} ) {
+ $stderr->print( "`\%opts_with_args' does not have key `" .
$has_arg . "'." );
next ARGS;
}
- $opts_with_arg{ $has_arg } -> ( $arg );
+ $opts_with_arg{$has_arg}->($arg);
$has_arg = FALSE;
next ARGS;
} # end of $has_arg
- if ( exists $opts_with_arg{ $arg } ) {
+ if ( exists $opts_with_arg{$arg} ) {
$has_arg = $arg;
next ARGS;
}
- if ( exists $opts_noarg{ $arg } ) {
- $opts_noarg { $arg } -> ();
+ if ( exists $opts_noarg{$arg} ) {
+ $opts_noarg{$arg}->();
next ARGS;
}
# not a suitable option
- $stderr -> print( "Wrong option `" . $arg . "'." );
+ $stderr->print( "Wrong option `" . $arg . "'." );
next ARGS;
} # end of for ARGS:
@@ -448,26 +452,26 @@ sub run_second {
sub handle_args {
# handling the output of args
- if ( $Args -> { 'output' } ) { # `--output' was set in the arguments
- my $out_path = &path2abs( $Args -> { 'output' } );
- die "Output file name `$Args -> { 'output' } cannot be used."
+ if ( $Args->{'output'} ) { # `--output' was set in the arguments
+ my $out_path = &path2abs($Args->{'output'});
+ die "Output file name $Args->{'output'} cannot be used."
unless ( $out_path );
my ( $file, $dir );
- ( $file, $dir ) = File::Basename::fileparse( $out_path )
+ ( $file, $dir ) = File::Basename::fileparse($out_path)
or die "Could not handle output file path `" . $out_path . "': " .
"directory name `" . $dir . "' and file name `" . $file . "'.";
- die "Could not find output directory for `" . $Args -> { 'output' } . "'"
+ die "Could not find output directory for `" . $Args->{'output'} . "'"
unless ( $dir );
- die "Could not find output file: `" . $Args -> { 'output' } .
+ die "Could not find output file: `" . $Args->{'output'} .
"'" unless ( $file );
if ( -d $dir ) {
die "Could not write to output directory `" . $dir . "'."
unless ( -w $dir );
} else {
- $dir = &make_dir( $dir );
+ $dir = &make_dir($dir);
die "Could not create output directory in: `" . $out_path . "'."
unless ( $dir );
}
@@ -480,13 +484,13 @@ sub handle_args {
}
$out = new FH_FILE( $out_path );
- $v -> print( "Output goes to file `" . $out_path . "'." );
+ $v->print( "Output goes to file `" . $out_path . "'." );
} else { # `--output' was not set
$out = new FH_STDOUT();
}
# no $out is the right behavior for standard output
-# $Args -> { 'prefix' } .= '_' . $Args -> { 'eps_func' } . '2eps';
+# $Args->{'prefix'} .= '_' . $Args->{'eps_func'} . '2eps';
@ARGV = @files;
}
diff --git a/contrib/glilypond/glilypond.man b/contrib/glilypond/glilypond.man
index 80532730..7e35019c 100644
--- a/contrib/glilypond/glilypond.man
+++ b/contrib/glilypond/glilypond.man
@@ -13,7 +13,7 @@ This file was written by Bernd Warken
.MT groff\-bernd.warken\-72@web.de
.ME .
.
-Last update: 24 Mar 2013
+Last update: 25 Apr 2013
..
.
.
@@ -93,7 +93,7 @@ If not, see the GNU licenses at
.\" like .OP, but with 1st arg split and and optional final character
.\" Example: `.OP+ -p | --prefix ly .' gets `[-t|--prefix ly].'
.\" Example: `.OP+ -h | --help | --usage' gets `[-h|--help|--usage]'
-.\" Example: `.OP+ -v | --version "" ,' gets `[-v|--version],'
+.\" Example: `.OP+ -v | --verbose "" ,' gets `[-v|--verbose],'
.\"
.de1 OP+
. if ( \\n[.$] == 0 ) \{\
@@ -167,7 +167,7 @@ can be provided as arguments.
.OP+ -? | -h | --help | --usage
.YS
.SY
-.OP+ -v | --version
+.OP+ --version
.YS
.SY
.OP+ -l | --license
@@ -275,7 +275,7 @@ into a file named in the option argument
.
.
.TP
-.OP+ -V | --verbose
+.OP+ -v | -V | --verbose
A lot more of information is sent to STDERR.
.
.
@@ -325,7 +325,7 @@ is a collection of the short options
and
.FONT CB \-V
without option argument, followed by the short option
-.FONT \-e
+.FONT CB \-e
with option argument that is the following part of the argument
.FONT CB some_dir R .
.
@@ -390,13 +390,13 @@ whose name starts with the character
.
.P
On the other hand, the option
-.FONT \-\-version
+.FONT CB \-\-version
cannot be abbreviated further than
-.FONT \-\-vers
+.FONT CB \-\-vers
because there is also the
.FONT CI "long option " CB \-\-verbose
that can be abbreviated up to
-.FONT \-\-verb R .
+.FONT CB \-\-verb R .
.
.
.P
@@ -419,7 +419,7 @@ style.
.
.P
For example, the
-.FONT CI long option
+.FONT CI "long option"
.FONT CB \-\-keep_all
can as well be written as
.FONT CB \-\-Keep_All
diff --git a/contrib/glilypond/glilypond.pl b/contrib/glilypond/glilypond.pl
index 72f45613..165aa277 100755
--- a/contrib/glilypond/glilypond.pl
+++ b/contrib/glilypond/glilypond.pl
@@ -14,8 +14,8 @@ use diagnostics;
our $Legalese;
{
- use constant VERSION => 'v1.0'; # version of glilypond
- use constant LASTUPDATE => '12 Apr 2013'; # date of last update
+ use constant VERSION => 'v1.1'; # version of glilypond
+ use constant LASTUPDATE => '25 Apr 2013'; # date of last update
### This constant `LICENSE' is the license for this file `GPL' >= 3
use constant LICENSE => q*
@@ -227,16 +227,16 @@ our $Temp =
{ # `Temp'
- if ( $Args -> { 'temp_dir' } ) {
+ if ( $Args->{'temp_dir'} ) {
#----------
# temporary directory was set by `--temp_dir'
#----------
- my $dir = $Args -> { 'temp_dir' };
+ my $dir = $Args->{'temp_dir'};
- $dir = &path2abs( $dir );
- $dir = &make_dir ( $dir ) or
+ $dir = &path2abs($dir);
+ $dir = &make_dir($dir) or
die "The directory `$dir' cannot be used temporarily: $!";
@@ -246,14 +246,14 @@ our $Temp =
die "Could not open temporary directory `$dir': $!";
my $file_name;
my $found = FALSE;
- my $prefix = $Args -> { 'prefix' };
+ my $prefix = $Args->{'prefix'};
my $re = qr<
^
$prefix
_
>x;
- READDIR: while ( defined( $file_name = readdir ( $dh ) ) ) {
+ READDIR: while ( defined($file_name = readdir($dh)) ) {
chomp $file_name;
if ( $file_name =~ /$re/ ) { # file name starts with $prefix_
$found = TRUE;
@@ -262,22 +262,22 @@ our $Temp =
next;
}
- $Temp -> { 'temp_dir' } = $dir;
+ $Temp->{'temp_dir'} = $dir;
my $n = 0;
while ( $found ) {
- $dir = File::Spec -> catdir( $Temp -> { 'temp_dir' }, ++$n );
+ $dir = File::Spec->catdir( $Temp->{'temp_dir'}, ++$n );
next if ( -e $dir );
- $dir = &make_dir ( $dir ) or next;
+ $dir = &make_dir($dir) or next;
$found = FALSE;
last;
}
- $Temp -> { 'temp_dir' } = $dir;
+ $Temp->{'temp_dir'} = $dir;
- } else { # $Args -> { 'temp_dir' } not given by `--temp_dir'
+ } else { # $Args->{'temp_dir'} not given by `--temp_dir'
#----------
# temporary directory was not set
@@ -287,21 +287,21 @@ our $Temp =
my @tempdirs = EMPTYARRAY;
{
- my $tmpdir = File::Spec -> tmpdir();
+ my $tmpdir = File::Spec->tmpdir();
push @tempdirs, $tmpdir if ( $tmpdir && -d $tmpdir && -w $tmpdir );
- my $root_dir = File::Spec -> rootdir(); # `/' in Unix
- my $root_tmp = File::Spec -> catdir( $root_dir, 'tmp' );
+ my $root_dir = File::Spec->rootdir(); # `/' in Unix
+ my $root_tmp = File::Spec->catdir($root_dir, 'tmp');
push @tempdirs, $root_tmp
if ( $root_tmp ne $tmpdir && -d $root_tmp && -w $root_tmp );
# home directory of the actual user
- my $home = File::HomeDir -> my_home;
- my $home_tmp = File::Spec -> catdir ( $home, 'tmp' );
+ my $home = File::HomeDir->my_home;
+ my $home_tmp = File::Spec->catdir($home, 'tmp');
push @tempdirs, $home_tmp if ( -d $home_tmp && -w $home_tmp );
# `/var/tmp' in Unix
- my $var_tmp = File::Spec -> catdir( '', 'var', 'tmp' );
+ my $var_tmp = File::Spec->catdir('', 'var', 'tmp');
push @tempdirs, $var_tmp if ( -d $var_tmp && -w $var_tmp );
}
@@ -310,7 +310,7 @@ our $Temp =
{
# `$<' is UID of actual user,
# `getpwuid' gets user name in scalar context
- my $user = getpwuid( $< );
+ my $user = getpwuid($<);
push @path_extension, $user if ( $user );
push @path_extension, qw( lilypond );
@@ -320,19 +320,19 @@ our $Temp =
TEMPS: foreach ( @tempdirs ) {
my $dir; # final directory name in `while' loop
- $dir = &path2abs ( $_ );
+ $dir = &path2abs($_);
next TEMPS unless ( $dir );
# beginning of directory name
my @dir_begin =
- ( File::Spec -> splitdir( $dir ), @path_extension );
+ ( File::Spec->splitdir($dir), @path_extension );
my $n = 0;
my $dir_blocked = TRUE;
BLOCK: while ( $dir_blocked ) {
# should become the final dir name
- $dir = File::Spec -> catdir ( @dir_begin, ++$n );
+ $dir = File::Spec->catdir(@dir_begin, ++$n);
next BLOCK if ( -d $dir );
# dir name is now free, create it, and end the blocking
@@ -346,19 +346,19 @@ our $Temp =
next TEMPS unless ( -d $dir && -w $dir );
# $dir is now a writable directory
- $Temp -> { 'temp_dir' } = $dir; # tmp/groff/USER/lilypond/TIME
+ $Temp->{'temp_dir'} = $dir; # tmp/groff/USER/lilypond/TIME
last TEMPS;
} # end foreach tmp directories
} # end to create a temporary directory
die "Could not find a temporary directory" unless
- ( $Temp -> { 'temp_dir' } && -d $Temp -> { 'temp_dir' } &&
- -w $Temp -> { 'temp_dir' } );
+ ( $Temp->{'temp_dir'} && -d $Temp->{'temp_dir'} &&
+ -w $Temp->{'temp_dir'} );
} # end temporary directory
- $v -> print( "Temporary directory: `" . $Temp -> { 'temp_dir' } . "'\n" );
- $v -> print( "file_prefix: `" . $Args -> { 'prefix' } . "'" );
+ $v->print( "Temporary directory: `" . $Temp->{'temp_dir'} . "'\n" );
+ $v->print( "file_prefix: `" . $Args->{'prefix'} . "'" );
#----------
@@ -366,10 +366,10 @@ our $Temp =
#----------
my $make_dir = FALSE;
- if ( $Args -> { 'eps_dir' } ) { # set by `--eps_dir'
- my $dir = $Args -> { 'eps_dir' };
+ if ( $Args->{'eps_dir'} ) { # set by `--eps_dir'
+ my $dir = $Args->{'eps_dir'};
- $dir = &path2abs( $dir );
+ $dir = &path2abs($dir);
if ( -e $dir ) {
goto EMPTY unless ( -w $dir );
@@ -380,14 +380,14 @@ our $Temp =
my $found = FALSE;
opendir( my $dh, $upper_dir ) or $found = TRUE;
- my $prefix = $Args -> { 'prefix' };
+ my $prefix = $Args->{'prefix'};
my $re = qr<
^
$prefix
_
>x;
while ( not $found ) {
- my $file_name = readdir ( $dh );
+ my $file_name = readdir($dh);
if ( $file_name =~ /$re/ ) { # file name starts with $prefix_
$found = TRUE;
last;
@@ -397,19 +397,19 @@ our $Temp =
my $n = 0;
while ( $found ) {
- $dir = File::Spec -> catdir( $upper_dir, ++$n );
+ $dir = File::Spec->catdir($upper_dir, ++$n);
next if ( -d $dir );
$found = FALSE;
}
$make_dir = TRUE;
- $Temp -> { 'eps_dir' } = $dir;
+ $Temp->{'eps_dir'} = $dir;
} else { # `$dir' is not a dir, so unlink it to create it as dir
if ( unlink $dir ) { # could remove `$dir'
- $Temp -> { 'eps_dir' } = $dir;
+ $Temp->{'eps_dir'} = $dir;
$make_dir = TRUE;
} else { # could not remove
- stderr -> print( "Could not use EPS dir `" . $dir .
- "', use temp dir." );
+ stderr->print( "Could not use EPS dir `" . $dir .
+ "', use temp dir." );
} # end of unlink
} # end test of -d $dir
} else {
@@ -419,24 +419,24 @@ our $Temp =
if ( $make_dir ) { # make directory `$dir'
my $made = FALSE;
- $dir = &make_dir ( $dir ) and $made = TRUE;
+ $dir = &make_dir($dir) and $made = TRUE;
if ( $made ) {
- $Temp -> { 'eps_dir' } = $dir;
- $v -> print( "Directory for useful EPS files is `" . $dir . "'." );
+ $Temp->{'eps_dir'} = $dir;
+ $v->print( "Directory for useful EPS files is `" . $dir . "'." );
} else {
- $v -> print( "The EPS directory `" . $dir . "' cannot be used: $!" );
+ $v->print( "The EPS directory `" . $dir . "' cannot be used: $!" );
}
} else { # `--eps_dir' was not set, so take the temporary directory
- $Temp -> { 'eps_dir' } = $Args -> { 'temp_dir' };
+ $Temp->{'eps_dir'} = $Args->{'temp_dir'};
} # end of make dir
}
- EMPTY: unless ( $Temp -> { 'eps_dir' } ) {
+ EMPTY: unless ( $Temp->{'eps_dir'} ) {
# EPS-dir not set or available, use temp dir,
- # but leave $Temp -> { '}eps_dir' } empty
- $v -> print( "Directory for useful EPS files is the " .
- "temporary directory `" . $Temp -> { 'temp_dir' } . "'." );
+ # but leave $Temp->{'}eps_dir'} empty
+ $v->print( "Directory for useful EPS files is the " .
+ "temporary directory `" . $Temp->{'temp_dir'} . "'." );
}
} # end `Temp'
@@ -456,7 +456,7 @@ our $Read =
my $ly_number = 0; # number of lilypond file
- # `$Args -> { 'prefix' }_[0-9]'
+ # `$Args->{'prefix'}_[0-9]'
my $lilypond_mode = FALSE;
@@ -468,7 +468,7 @@ our $Read =
my $check_file = sub { # for argument of `.lilypond include'
my $file = shift; # argument is a file name
- $file = &path2abs( $file );
+ $file = &path2abs($file);
unless ( $file ) {
die "Line `.lilypond include' without argument";
return '';
@@ -483,10 +483,9 @@ our $Read =
my $increase_ly_number = sub {
++$ly_number;
- $Read -> { 'file_numbered' } = $Args -> { 'prefix' } . '_' . $ly_number;
- $Read -> { 'file_ly' } = $Read -> { 'file_numbered' } . '.ly';
- $path_ly = File::Spec -> catdir ( $Temp -> { 'temp_dir' },
- $Read -> { 'file_ly' } );
+ $Read->{'file_numbered'} = $Args->{'prefix'} . '_' . $ly_number;
+ $Read->{'file_ly'} = $Read->{'file_numbered'} . '.ly';
+ $path_ly = File::Spec->catdir($Temp->{'temp_dir'}, $Read->{'file_ly'} );
};
@@ -504,29 +503,29 @@ our $Read =
(
'start' => sub {
- $v -> print( "\nline: `.lilypond start'" );
+ $v->print( "\nline: `.lilypond start'" );
die "Line `.lilypond stop' expected." if ( $lilypond_mode );
$lilypond_mode = TRUE;
&$increase_ly_number;
- $v -> print( "ly-file: `" . $path_ly . "'" );
+ $v->print( "ly-file: `" . $path_ly . "'" );
- $ly = new FH_FILE( $path_ly );
+ $ly = new FH_FILE($path_ly);
},
'end' => sub {
- $v -> print( "line: `.lilypond end'\n" );
+ $v->print( "line: `.lilypond end'\n" );
die "Expected line `.lilypond start'." unless ( $lilypond_mode );
$lilypond_mode = FALSE;
- $ly -> close();
+ $ly->close();
- if ( exists $eps_subs{ $Args -> { 'eps_func' } } ) {
- $eps_subs{ $Args -> { 'eps_func' } } -> ();
+ if ( exists $eps_subs{ $Args->{'eps_func'} } ) {
+ $eps_subs{ $Args->{'eps_func'} }->();
} else {
- die "Wrong argument for \%eps_subs: " . $Args -> { 'eps_func' } . "'";
+ die "Wrong argument for \%eps_subs: " . $Args->{'eps_func'} . "'";
}
},
@@ -538,7 +537,7 @@ our $Read =
my $file_arg = shift;
- my $file = &$check_file( $file_arg );
+ my $file = &$check_file($file_arg);
next LILYPOND unless ( $file );
# file can be read now
@@ -546,21 +545,20 @@ our $Read =
# `$fh_write_ly' must be opened
&$increase_ly_number;
- $ly = new FH_FILE( $path_ly );
+ $ly = new FH_FILE($path_ly);
- my $include = new FH_READ_FILE( $file );
- my $res = $include -> read-all(); # is a refernce to an array
+ my $include = new FH_READ_FILE($file);
+ my $res = $include->read-all(); # is a refernce to an array
foreach ( @$res ) {
chomp;
- $ly -> print( $_ );
+ $ly->print($_);
}
- $ly -> close();
+ $ly->close();
- if ( exists $eps_subs{ $Args -> { 'eps_func' } } ) {
- $eps_subs{ $Args -> { 'eps_func' } } -> ();
+ if ( exists $eps_subs{ $Args->{'eps_func'} } ) {
+ $eps_subs{ $Args->{'eps_func'} }->();
} else {
- die "Wrong argument for \$eps_subs: `" .
- $Args -> { 'eps_func' } . "'";
+ die "Wrong argument for \$eps_subs: `" . $Args->{'eps_func'} . "'";
}
}, # end `.lilypond include'
@@ -604,12 +602,12 @@ our $Read =
$args =~ s/["'`]//g;
my $arg2 = $args; # file argument for `.lilypond include'
- if ( exists $lilypond_args{ $arg1 } ) {
- $lilypond_args{ $arg1 } -> ( $arg2 );
+ if ( exists $lilypond_args{$arg1} ) {
+ $lilypond_args{$arg1}->($arg2);
next;
} else {
# not a suitable argument of `.lilypond'
- $stderr -> print( "Unknown command: `$arg1' `$arg2': `$line'" );
+ $stderr->print( "Unknown command: `$arg1' `$arg2': `$line'" );
}
next LILYPOND;
@@ -618,7 +616,7 @@ our $Read =
if ( $lilypond_mode ) { # do lilypond-mode
# see `.lilypond start'
- $ly -> print( $line );
+ $ly->print( $line );
next LILYPOND;
} # do lilypond-mode
@@ -629,7 +627,7 @@ our $Read =
\s*
lilypond
/x ) { # not a `.lilypond' line
- $out -> print( $line );
+ $out->print($line);
next LILYPOND;
}
@@ -643,15 +641,15 @@ our $Read =
END {
- exit unless ( defined($Temp -> { 'temp_dir' }));
+ exit unless ( defined($Temp->{'temp_dir'}) );
- if ( $Args -> { 'keep_all' } ) {
+ if ( $Args->{'keep_all'} ) {
# With --keep_all, no temporary files are removed.
- $v -> print( "keep_all: `TRUE'" );
- $v -> print( "No temporary files will be deleted:" );
+ $v->print( "keep_all: `TRUE'" );
+ $v->print( "No temporary files will be deleted:" );
- opendir my $dh_temp, $Temp -> { 'temp_dir' } or
- die "Cannot open " . $Temp -> { 'temp_dir' } . ": $!";
+ opendir my $dh_temp, $Temp->{'temp_dir'} or
+ die "Cannot open " . $Temp->{'temp_dir'} . ": $!";
for ( sort readdir $dh_temp ) {
next if ( / # omit files starting with a dot
^
@@ -659,11 +657,11 @@ END {
/x );
if ( /
^
- $Args -> { 'prefix' }
+ $Args->{'prefix'}
_
/x ) {
- my $file = File::Spec -> catfile( $Temp -> { 'temp_dir' }, $_ );
- $v -> print( "- " . $file );
+ my $file = File::Spec->catfile( $Temp->{'temp_dir'}, $_ );
+ $v->print( "- " . $file );
next;
}
next;
@@ -673,30 +671,30 @@ END {
} else { # keep_all is not set
# Remove all temporary files except the eps files.
- $v -> print( "keep_all: `FALSE'" );
- $v -> print( "All temporary files except *.eps will be deleted" );
+ $v->print( "keep_all: `FALSE'" );
+ $v->print( "All temporary files except *.eps will be deleted" );
- if ( $Temp -> { 'eps_dir' } ) {
+ if ( $Temp->{'eps_dir'} ) {
# EPS files are in another dir, remove temp dir
- if ( &is_subdir( $Temp -> { 'eps_dir' }, $Temp -> { 'temp_dir' } ) ) {
- $v -> print( "EPS dir is subdir of temp dir, so keep both." );
+ if ( &is_subdir( $Temp->{'eps_dir'}, $Temp->{'temp_dir'} ) ) {
+ $v->print( "EPS dir is subdir of temp dir, so keep both." );
} else { # remove temp dir
- $v -> print( "Try to remove temporary directory `" .
- $Temp -> { 'temp_dir' } ."':" );
- if ( File::Path::remove_tree( $Temp -> { 'temp_dir' } ) ) {
+ $v->print( "Try to remove temporary directory `" .
+ $Temp->{'temp_dir'} ."':" );
+ if ( File::Path::remove_tree($Temp->{'temp_dir'}) ) {
# remove succeeds
- $v -> print( "...done." );
+ $v->print( "...done." );
} else { # did not remove
- $v -> print( "Failure to remove temporary directory." );
+ $v->print( "Failure to remove temporary directory." );
} # end test on remove
} # end is subdir
} else { # no EPS dir, so keep EPS files
- opendir my $dh_temp, $Temp -> { 'temp_dir' } or
- die "Cannot open " . $Temp -> { 'temp_dir' } . ": $!";
+ opendir my $dh_temp, $Temp->{'temp_dir'} or
+ die "Cannot open " . $Temp->{'temp_dir'} . ": $!";
for ( sort readdir $dh_temp ) {
next if ( / # omit files starting with a dot
^
@@ -708,12 +706,12 @@ END {
/x );
if ( /
^
- $Args -> { 'prefix' }
+ $Args->{'prefix'}
_
/x ) { # this includes `PREFIX_temp*'
- my $file = File::Spec -> catfile( $Temp -> { 'temp_dir' }, $_ );
- $v -> print( "Remove `" . $file . "'" );
- unlink $file or $stderr -> print( "Could not remove `$file': $!" );
+ my $file = File::Spec->catfile( $Temp->{'temp_dir'}, $_ );
+ $v->print( "Remove `" . $file . "'" );
+ unlink $file or $stderr->print( "Could not remove `$file': $!" );
next;
} # end if prefix
next;
@@ -723,13 +721,13 @@ END {
} # end if-else keep files
- if ( $Temp -> { 'eps_dir' } ) {
- # EPS files in $Temp -> { 'eps_dir' } are always kept
- $v -> print( "As EPS directrory is set as `" .
- $Temp -> { 'eps_dir' } . "', no EPS files there will be deleted." );
+ if ( $Temp->{'eps_dir'} ) {
+ # EPS files in $Temp->{'eps_dir'} are always kept
+ $v->print( "As EPS directrory is set as `" .
+ $Temp->{'eps_dir'} . "', no EPS files there will be deleted." );
- opendir my $dh_temp, $Temp -> { 'eps_dir' } or
- die "Cannot open `" . $Temp -> { 'eps_dir' } . ": $!";
+ opendir my $dh_temp, $Temp->{'eps_dir'} or
+ die "Cannot open `" . $Temp->{'eps_dir'} . ": $!";
for ( sort readdir $dh_temp ) {
next if ( / # omit files starting with a dot
^
@@ -737,14 +735,14 @@ END {
/x );
if ( /
^
- $Args -> { 'prefix' }
+ $Args->{'prefix'}
_
.*
\.eps
$
/x ) {
- my $file = File::Spec -> catfile( $Temp -> { 'eps_dir' }, $_ );
- $v -> print( "- " . $file );
+ my $file = File::Spec->catfile( $Temp->{'eps_dir'}, $_ );
+ $v->print( "- " . $file );
next;
} # end if *.eps
next;
diff --git a/contrib/glilypond/oop_fh.pl b/contrib/glilypond/oop_fh.pl
index 2fbee5e6..e256221f 100644
--- a/contrib/glilypond/oop_fh.pl
+++ b/contrib/glilypond/oop_fh.pl
@@ -9,7 +9,7 @@ Installed position: `<prefix>/lib/groff/lilypond/oop_fh.pl'
Copyright (C) 2013 Free Software Foundation, Inc.
Written by Bernd Warken <groff-bernd.warken-72@web.de>
-Last update: 17 Mar 2013
+Last update: 25 Apr 2013
This file is part of `glilypond', which is part of `GNU groff'.
@@ -67,7 +67,7 @@ use integer;
sub print {
my $self = shift;
for ( @_ ) {
- print { $self -> { 'fh' } } $_;
+ print { $self->{'fh'} } $_;
}
}
@@ -126,32 +126,32 @@ use integer;
sub DESTROY {
my $self = shift;
- $self -> close();
+ $self->close();
}
sub open {
my $self = shift;
- my $file = $self -> { 'file' };
+ my $file = $self->{'file'};
if ( $file && -e $file ) {
die "file $file is not writable" unless ( -w $file );
die "$file is a directory" if ( -d $file );
}
- open $self -> { 'fh' }, ">", $self -> { 'file' }
+ open $self->{'fh'}, ">", $self->{'file'}
or die "could not open file `$file' for writing: $!";
- $self -> { 'opened' } = main::TRUE;
+ $self->{'opened'} = main::TRUE;
}
sub close {
my $self = shift;
- close $self -> { 'fh' } if ( $self -> { 'opened' } );
- $self -> { 'opened' } = main::FALSE;
+ close $self->{'fh'} if ( $self->{'opened'} );
+ $self->{'opened'} = main::FALSE;
}
sub print {
my $self = shift;
- $self -> open() unless ( $self -> { 'opened' } );
+ $self->open() unless ( $self->{'opened'} );
for ( @_ ) {
- print { $self -> { 'fh' } } $_;
+ print { $self->{'fh'} } $_;
}
}
@@ -178,16 +178,16 @@ use integer;
sub open {
my $self = shift;
- open $self->{'fh'}, ">", \ $self -> { 'string' }
+ open $self->{'fh'}, ">", \ $self->{'string'}
or die "could not open string for writing: $!";
- $self -> { 'opened' } = main::TRUE;
+ $self->{'opened'} = main::TRUE;
}
sub get { # get string, move to array ref, close, and return array ref
my $self = shift;
- return '' unless ( $self -> { 'opened' } );
- my $a = &string2array( $self -> { 'string' } );
- $self -> close();
+ return '' unless ( $self->{'opened'} );
+ my $a = &string2array( $self->{'string'} );
+ $self->close();
return $a;
}
@@ -204,7 +204,7 @@ use integer;
use File::Spec;
- my $devnull = File::Spec -> devnull();
+ my $devnull = File::Spec->devnull();
$devnull = '' unless ( -e $devnull && -w $devnull );
sub new {
@@ -260,7 +260,7 @@ use integer;
sub close {
my $self = shift;
close $self->{'fh'} if ( $self->{'opened'} );
- $self -> { 'opened' } = main::FALSE;
+ $self->{'opened'} = main::FALSE;
}
sub read_line {
@@ -270,7 +270,7 @@ use integer;
$self->open() unless ( $self->{'opened'} );
my $res;
- if ( defined ( $res = CORE::readline( $self->{'fh'} ) ) ) {
+ if ( defined($res = CORE::readline($self->{'fh'}) ) ) {
chomp $res;
return $res;
} else {
@@ -284,7 +284,7 @@ use integer;
# Close the read handle at the end.
# Return array reference.
my $self = shift;
- $self -> open() unless ( $self->{'opened'} );
+ $self->open() unless ( $self->{'opened'} );
my $res = [];
my $line;
diff --git a/contrib/glilypond/subs.pl b/contrib/glilypond/subs.pl
index d90d9f39..548224a5 100644
--- a/contrib/glilypond/subs.pl
+++ b/contrib/glilypond/subs.pl
@@ -11,7 +11,7 @@ Installed position: `<prefix>/lib7groff/lilypond/subs.pl'
Copyright (C) 2013 Free Software Foundation, Inc.
Written by Bernd Warken <groff-bernd.warken-72@web.de>
- Last update: 24 Apr 2013
+ Last update: 25 Apr 2013
This file is part of `glilypond', which is part of `GNU groff'.
@@ -50,7 +50,7 @@ use feature 'state';
sub create_ly2eps { # `--ly2eps' default
our ( $out, $Read, $Temp );
- my $prefix = $Read -> { 'file_numbered' }; # with dir change to temp dir
+ my $prefix = $Read->{'file_numbered'}; # with dir change to temp dir
# `$ lilypond --ps -dbackend=eps -dgs-load-fonts \
# output=file_without_extension file.ly'
@@ -59,12 +59,12 @@ sub create_ly2eps { # `--ly2eps' default
"--output=$prefix $prefix";
&run_lilypond("$opts");
- Cwd::chdir $Temp -> { 'cwd' } or
+ Cwd::chdir $Temp->{'cwd'} or
die "Could not change to former directory `" .
- $Temp -> { 'cwd' } . "': $!";
+ $Temp->{'cwd'} . "': $!";
- my $eps_dir = $Temp -> { 'eps_dir' };
- my $dir = $Temp -> { 'temp_dir' };
+ my $eps_dir = $Temp->{'eps_dir'};
+ my $dir = $Temp->{'temp_dir'};
opendir( my $dh, $dir ) or
die "could not open temporary directory `$dir': $!";
@@ -81,17 +81,17 @@ sub create_ly2eps { # `--ly2eps' default
chomp;
$file = $_;
if ( /$re/ ) {
- my $file_path = File::Spec -> catfile( $dir, $file );
+ my $file_path = File::Spec->catfile($dir, $file);
if ( $eps_dir ) {
my $could_copy = FALSE;
- File::Copy::copy ( $file_path, $eps_dir )
+ File::Copy::copy($file_path, $eps_dir)
and $could_copy = TRUE;
if ( $could_copy ) {
unlink $file_path;
- $file_path = File::Spec -> catfile( $eps_dir, $_ );
+ $file_path = File::Spec->catfile($eps_dir, $_);
}
}
- $out -> print( '.PSPIC ' . $file_path );
+ $out->print( '.PSPIC ' . $file_path );
}
} # end while readdir
closedir( $dh );
@@ -101,7 +101,7 @@ sub create_ly2eps { # `--ly2eps' default
sub create_pdf2eps { # `--pdf2eps'
our ( $v, $stdout, $stderr, $out, $Read, $Temp );
- my $prefix = $Read -> { 'file_numbered' }; # with dir change to temp dir
+ my $prefix = $Read->{'file_numbered'}; # with dir change to temp dir
&run_lilypond("--pdf --output=$prefix $prefix");
@@ -110,43 +110,43 @@ sub create_pdf2eps { # `--pdf2eps'
# pdf2ps in temp dir
my $temp_file = &next_temp_file;
- $v -> print( "\n##### run of `pdf2ps'" );
+ $v->print( "\n##### run of `pdf2ps'" );
# `$ pdf2ps file.pdf file.ps'
my $output = `pdf2ps $file_pdf $file_ps 2> $temp_file`;
die 'Program pdf2ps does not work.' if ( $? );
- &shell_handling ( $output, $temp_file );
- $v -> print( "##### end run of `pdf2ps'\n" );
+ &shell_handling($output, $temp_file);
+ $v->print( "##### end run of `pdf2ps'\n" );
# ps2eps in temp dir
$temp_file = &next_temp_file;
- $v -> print( "\n##### run of `ps2eps'" );
+ $v->print( "\n##### run of `ps2eps'" );
# `$ ps2eps file.ps'
$output = `ps2eps $file_ps 2> $temp_file`;
die 'Program ps2eps does not work.' if ( $? );
- &shell_handling ( $output, $temp_file );
- $v -> print( "##### end run of `ps2eps'\n" );
+ &shell_handling($output, $temp_file);
+ $v->print( "##### end run of `ps2eps'\n" );
# change back to former dir
- Cwd::chdir $Temp -> { 'cwd' } or
+ Cwd::chdir $Temp->{'cwd'} or
die "Could not change to former directory `" .
- $Temp -> { 'cwd' } . "': $!";
+ $Temp->{'cwd'} . "': $!";
# handling of .eps file
my $file_eps = $prefix . '.eps';
- my $eps_path = File::Spec -> catfile( $Temp -> { 'temp_dir' }, $file_eps );
- if ( $Temp -> { 'eps_dir' } ) {
+ my $eps_path = File::Spec->catfile($Temp->{'temp_dir'}, $file_eps);
+ if ( $Temp->{'eps_dir'} ) {
my $has_copied = FALSE;
- File::Copy::copy( $eps_path, $Temp -> { 'eps_dir' } )
+ File::Copy::copy( $eps_path, $Temp->{'eps_dir'} )
and $has_copied = TRUE;
if ( $has_copied ) {
unlink $eps_path;
- $eps_path = File::Spec -> catfile( $Temp -> { 'eps_dir' }, $file_eps );
+ $eps_path = File::Spec->catfile( $Temp->{'eps_dir'}, $file_eps );
} else {
- $stderr -> print( "Could not use EPS-directory." );
- } # end Temp -> { 'eps_dir' }
+ $stderr->print( "Could not use EPS-directory." );
+ } # end Temp->{'eps_dir'}
}
# print into groff output
- $out -> print( '.PSPIC ' . $eps_path );
+ $out->print( '.PSPIC ' . $eps_path );
} # end sub create_pdf2eps()
@@ -154,8 +154,8 @@ sub is_subdir { # arg1 is subdir of arg2 (is longer)
my ( $dir1, $dir2 ) = @_;
$dir1 = &path2abs( $dir1 );;
$dir2 = &path2abs( $dir2 );;
- my @split1 = File::Spec -> splitdir( $dir1 );
- my @split2 = File::Spec -> splitdir( $dir2 );
+ my @split1 = File::Spec->splitdir($dir1);
+ my @split2 = File::Spec->splitdir($dir2);
for ( @split2 ) {
next if ( $_ eq shift @split1 );
return FALSE;
@@ -167,7 +167,7 @@ sub is_subdir { # arg1 is subdir of arg2 (is longer)
sub license {
our ( $Legalese, $stdout );
&version;
- $stdout -> print( $Legalese -> { 'license' } );
+ $stdout->print( $Legalese->{'license'} );
} # end sub license()
@@ -179,13 +179,13 @@ sub make_dir { # make directory or check if it exists
$dir_arg =~ s/^\s*(.*)\s*$/$1/;
unless ( $dir_arg ) {
- $v -> print( "make_dir(): empty argument" );
+ $v->print( "make_dir(): empty argument" );
return FALSE;
}
- unless ( File::Spec->file_name_is_absolute( $dir_arg ) ) {
- my $res = Cwd::realpath( $dir_arg );
- $res = File::Spec -> canonpath ( $dir_arg ) unless ( $res );
+ unless ( File::Spec->file_name_is_absolute($dir_arg) ) {
+ my $res = Cwd::realpath($dir_arg);
+ $res = File::Spec->canonpath($dir_arg) unless ( $res );
$dir_arg = $res if ( $res );
}
@@ -193,7 +193,7 @@ sub make_dir { # make directory or check if it exists
# search thru the dir parts
- my @dir_parts = File::Spec -> splitdir( $dir_arg );
+ my @dir_parts = File::Spec->splitdir($dir_arg);
my @dir_grow;
my $dir_grow;
my $can_create = FALSE; # dir could be created if TRUE
@@ -203,7 +203,7 @@ sub make_dir { # make directory or check if it exists
next DIRPARTS unless ( $_ ); # empty string for root directory
# from array to path dir string
- $dir_grow = File::Spec -> catdir ( @dir_grow );
+ $dir_grow = File::Spec->catdir(@dir_grow);
next DIRPARTS if ( -d $dir_grow );
@@ -220,9 +220,9 @@ sub make_dir { # make directory or check if it exists
# $dir_grow does no longer exist, so the former dir must be writable
# in order to create the directory
pop @dir_grow;
- $dir_grow = File::Spec -> catdir ( @dir_grow );
+ $dir_grow = File::Spec->catdir(@dir_grow);
- die "`$dir_grow' is not writable, " .
+ die "`$dir_grow' is not writable, " .
"so directory `$dir_arg' can't be createdd."
unless ( -w $dir_grow );
@@ -230,8 +230,8 @@ sub make_dir { # make directory or check if it exists
File::Path::make_path( $dir_arg,
{
- mask => oct( '0700' ),
- verbose => $Args -> { 'verbose' },
+ mask => oct('0700'),
+ verbose => $Args->{'verbose'},
}
) # `mkdir -P'
or die "Could not create directory `$dir_arg': $!";
@@ -251,10 +251,10 @@ my $number = 0;
sub next_temp_file {
our ( $Temp, $v, $Args );
++$number;
- my $temp_basename = $Args -> { 'prefix' } . '_temp_' . $number;
- my $temp_file = File::Spec -> catfile( $Temp -> { 'temp_dir' } ,
- $temp_basename );
- $v -> print( "next temporary file: `$temp_file'" );
+ my $temp_basename = $Args->{'prefix'} . '_temp_' . $number;
+ my $temp_file = File::Spec->catfile( $Temp->{'temp_dir'} ,
+ $temp_basename );
+ $v->print( "next temporary file: `$temp_file'" );
return $temp_file;
} # end sub next_temp_file()
@@ -281,7 +281,7 @@ sub path2abs {
~
/x ) {
if ( $path eq '~' ) { # only own home
- $path = File::HomeDir -> my_home;
+ $path = File::HomeDir->my_home;
} elsif ( $path =~ m<
^
~ /
@@ -290,7 +290,7 @@ sub path2abs {
)
$
>x ) { # subdir of own home
- $path = File::Spec -> catdir( $Temp -> { 'cwd' }, $1 );
+ $path = File::Spec->catdir( $Temp->{'cwd'}, $1 );
} elsif ( $path =~ m<
^
~
@@ -299,7 +299,7 @@ sub path2abs {
)
$
>x ) { # home of other user
- $path = File::HomeDir -> users_home( $1 );
+ $path = File::HomeDir->users_home($1);
} elsif ( $path =~ m<
^
~
@@ -312,12 +312,12 @@ sub path2abs {
)
$
>x ) { # subdir of other home
- $path = File::Spec ->
- catdir( File::HomeDir -> users_home( $1 ), $2 );
+ $path = File::Spec->
+ catdir( File::HomeDir->users_home($1), $2 );
}
}
- $path = File::Spec -> rel2abs ( $path );
+ $path = File::Spec->rel2abs($path);
# now $path is absolute
return $path;
@@ -337,17 +337,17 @@ sub run_lilypond {
my $output = EMPTYSTRING;
# change to temp dir
- Cwd::chdir $Temp -> { 'temp_dir' } or
+ Cwd::chdir $Temp->{'temp_dir'} or
die "Could not change to temporary directory `" .
- $Temp -> { 'temp_dir' } . "': $!";
+ $Temp->{'temp_dir'} . "': $!";
- $v -> print( "\n##### run of `lilypond " . $opts . "'" );
+ $v->print( "\n##### run of `lilypond " . $opts . "'" );
$output = `lilypond $opts 2>$temp_file`;
die "Program lilypond does not work, see `$temp_file': $?"
if ( $? );
chomp $output;
- &shell_handling( $output, $temp_file );
- $v -> print( "##### end run of `lilypond'\n" );
+ &shell_handling($output, $temp_file);
+ $v->print( "##### end run of `lilypond'\n" );
# stay in temp dir
} # end sub run_lilypond()
@@ -362,21 +362,21 @@ sub shell_handling {
my $out_string = shift;
my $temp_file = shift;
- my $a = &string2array( $out_string ); # array ref
+ my $a = &string2array($out_string); # array ref
for ( @$a ) {
- $out -> print( $_ );
+ $out->print( $_ );
}
$temp_file && -f $temp_file && -r $temp_file ||
die "shell_handling(): $temp_file is not a readable file.";
- my $temp = new FH_READ_FILE( $temp_file );
- my $res = $temp -> read_all();
+ my $temp = new FH_READ_FILE($temp_file);
+ my $res = $temp->read_all();
for ( @$res ) {
chomp;
- $v -> print( $_ );
+ $v->print($_);
}
- unlink $temp_file unless ( $Args -> { 'keep_all' } );
+ unlink $temp_file unless ( $Args->{'keep_all'} );
} # end sub shell_handling()
@@ -408,7 +408,7 @@ include a complete `lilypond' file into the `groff' document.
# Breaking options:
$p -?|-h|--help|--usage # usage
-$p -v|--version # version information
+$p --version # version information
$p --license # the license is GPL >= 3
@@ -421,7 +421,7 @@ There are 2 options for influencing the way how the `EPS' files for the
--pdf2eps `lilypond' generates a `PDF' file that is transformed
-k|--keep_all do not delete any temporary files
--V|--verbose print much information to STDERR
+-v|--verbose print much information to STDERR
Options with an argument:
-e|--eps_dir=... use a directory for the EPS files
@@ -443,19 +443,19 @@ The directories set are created when they do not exist.
sub version { # for `--version'
our ( $Globals, $Legalese, $stdout, $Args );
my $end;
- if ( $Globals -> { 'groff_version' } ) {
- $end = " version $Globals -> { 'groff_version' }";
+ if ( $Globals->{'groff_version'} ) {
+ $end = " version $Globals->{'groff_version'}";
} else {
$end = '.';
}
my $output = EMPTYSTRING;
- $output = "###### version:\n" if ( $Args -> { 'verbose' } );
- $output .= "`" . $Globals -> { 'prog' } . "' version `" .
+ $output = "###### version:\n" if ( $Args->{'verbose'} );
+ $output .= "`" . $Globals->{'prog'} . "' version `" .
$Legalese->{'version'} . "' of `" .
$Legalese->{'last_update'} . "' is part of `GNU groff'" . $end;
- $stdout -> print( $output );
+ $stdout->print($output);
} # end sub version()