App-sh2p
view release on metacpan or search on metacpan
0.01 Sun Aug 31 12:09:03 2008
- original version; created by h2xs 1.23 with options
-A -n App::sh2p
0.02 Wed Sep 03 17:00:00 2008
- fix for 5.6 and CPAN testers in Builtins.pm
syntax error reported in 5.6 but not in 5.10
- amended version requirement because of above
- changed input parameters - script no longer writes to STDOUT by default
See documentation for details
- implemented unset, chmod, chown
- improved variable assignment to empty strings and integers
- implemented some variable expansion: ${var:?}, $#var
- limited support for case/esac statement
- limited support for basic shell pattern matching
- redirection from echo/print now supported
- fixed a bug where function calls after a conditional were seen as strings
- fixed a bug concerning ++ and --
- fixed a bug where 'echo' was not converted to 'print'
- fixed bug where calculations failed to have a trailing ;
- fixed bug where return without an argument had a \n before ;
- built-in support for touch
- some improvements to string handling
- improvements to cd
- arrays are supported, including set -A, [*] and [@] quoted and non-quoted, ${!array[@]}, ${#array[@]}
- improvements to pipeline handling
- limited support for subshells
- fixed bugs concerning multiple and logical operators in test, [, and [[
- fixed bug when a comment followed a compound statement (while, if, else, etc.)
- fixed bug concerning variable handling in case statement
- fixed bug where some glob constructs were incorrectly quoted
- fixed implementation of chown
- fixed bug where some INSPECT messages could be displayed several times
for each occurence
- Improved error reporting
0.05 Sat Feb 07 17:00:00 2009
- new modules: Trap.pm, Statement.pm
- internal structure changes concerning BREAK markers (which fixed '7' bugs)
- fixed bugs concerning shortcuts (|| and &&) following external calls and print/echo
- fixed bug in Builtins.pm (do_print) where a variable was declared twice
- fixed bug in case statements where the do{} block was not terminated with ;
- fixed bug in case statement where statements were concatenated
- fixed bug where a | embedded in a string was seen as a pipe
- fixed bugs concerning commands embedded in quotes
- conversion of advise command in back-ticks changed to be a concat. string
- support for trap - see documentation for restrictions
- the & operator (run in background) is now placed inside a system call.
- improvements to 'here' document handling
- improvements to $* handling
- improvements to redirection
- improvements to testing, including the provision of main()
0.06 Sun Feb 08 17:00:00 2009
- fixed bug in chmod, chown, chgrp, which gave "Token count wrong!"
- fixed bug in kill which gave "Token count wrong!"
- fixed bug with filename quoting in chmod, et. al.
- fixed bug where a bare Perl reference was displayed
- fixed bug in export where environment vars. on rhs were not recognised
- corrected quoting of bareword value in export
- corrected quoting in source/. command
- corrected quoting in touch command
- fixed bug where variable type (integer, etc.) was sometimes missed
- improved diagnostics when using shopt
lib/App/sh2p/Builtins.pm view on Meta::CPAN
App::sh2p::Handlers::interpolation ("@args");
}
}
out "; $comment\n";
return $ntok;
}
########################################################
sub do_chown {
my ($cmd) = shift;
my ($opt) = shift;
my $ugrp;
my $ntok = 1;
if (substr($opt,0,1) eq '-') {
error_out ("$cmd options not yet supported");
$ugrp = shift;
$ntok++;
lib/App/sh2p/Builtins.pm view on Meta::CPAN
$opt = '';
}
my @args = @_;
my $comment = '';
my $text = '';
if (defined $ugrp) {
$ntok++;
if ($cmd eq 'chown') {
iout "{my(\$uid,\$gid)=(getpwnam(\"$ugrp\"))[2,3];";
}
else { # chgrp
iout "{my (\$name,undef,\$gid)=getgrname(\"$ugrp\");\n";
out " my \$uid=(getpwnam(\$name))[2];\n ";
}
out "chown \$uid, \$gid,"; # There is no chgrp
}
else {
error_out ("No user/group supplied for $cmd");
iout $cmd;
}
if (@args) {
for (my $i=0; $i < @args; $i++) {
lib/App/sh2p/Builtins.pm view on Meta::CPAN
sub general_arg_list
sub advise
sub do_autoload
sub do_break
sub do_colon
sub do_continue
sub do_cd
sub chmod_text_permissions
sub do_chmod
# also used by umask
sub do_chown
sub do_exec
sub do_exit
sub do_export
sub do_expr
sub do_functions
sub do_integer
sub do_kill
sub do_let
sub do_print
sub do_read
lib/App/sh2p/Parser.pm view on Meta::CPAN
'local' => \&App::sh2p::Builtins::do_typeset,
'shopt' => \&App::sh2p::Builtins::do_shopt,
'source' => \&App::sh2p::Builtins::do_source,
);
my %perl_builtins =
( 'awk' => [\&App::sh2p::Builtins::advise,'Perl code, often split'],
'basename'=> [\&App::sh2p::Builtins::advise,'File::Basename::basename'],
'cat' => [\&App::sh2p::Builtins::advise,'ExtUtils::Command::cat'],
'chmod' => [\&App::sh2p::Builtins::do_chmod],
'chown' => [\&App::sh2p::Builtins::do_chown],
'chgrp' => [\&App::sh2p::Builtins::do_chown],
'cp' => [\&App::sh2p::Builtins::advise,'File::Copy'],
'cut' => [\&App::sh2p::Builtins::advise,'split'],
'date' => [\&App::sh2p::Builtins::advise,'localtime or POSIX::strftime'],
'df' => [\&App::sh2p::Builtins::advise,'Filesys::Df'],
'diff' => [\&App::sh2p::Builtins::advise,'File::Compare'],
'dirname' => [\&App::sh2p::Builtins::advise,'File::Basename::dirname'],
'egrep' => [\&App::sh2p::Builtins::advise,'while(<>){print if /re/} or perl grep'],
'eval' => [\&App::sh2p::Builtins::one4one,'eval'],
'exec' => [\&App::sh2p::Builtins::advise,'exec or pipe (co-processes) or open (file descriptors)'],
'expr' => [\&App::sh2p::Builtins::do_expr],
( run in 0.758 second using v1.01-cache-2.11-cpan-71847e10f99 )