r22883 - in /trunk/libsysadm-install-perl: Changes MANIFEST META.yml Makefile.PL README debian/changelog lib/Sysadm/Install.pm t/002tar.t t/003slurp.t t/005qquote.t t/011defor.t t/012tap.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun Jul 6 21:10:41 UTC 2008


Author: gregoa
Date: Sun Jul  6 21:10:41 2008
New Revision: 22883

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=22883
Log:
New upstream release.

Added:
    trunk/libsysadm-install-perl/t/011defor.t
      - copied unchanged from r22882, branches/upstream/libsysadm-install-perl/current/t/011defor.t
    trunk/libsysadm-install-perl/t/012tap.t
      - copied unchanged from r22882, branches/upstream/libsysadm-install-perl/current/t/012tap.t
Modified:
    trunk/libsysadm-install-perl/Changes
    trunk/libsysadm-install-perl/MANIFEST
    trunk/libsysadm-install-perl/META.yml
    trunk/libsysadm-install-perl/Makefile.PL
    trunk/libsysadm-install-perl/README
    trunk/libsysadm-install-perl/debian/changelog
    trunk/libsysadm-install-perl/lib/Sysadm/Install.pm
    trunk/libsysadm-install-perl/t/002tar.t
    trunk/libsysadm-install-perl/t/003slurp.t
    trunk/libsysadm-install-perl/t/005qquote.t

Modified: trunk/libsysadm-install-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/Changes?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/Changes (original)
+++ trunk/libsysadm-install-perl/Changes Sun Jul  6 21:10:41 2008
@@ -1,6 +1,40 @@
 ########################################
 Revision history for Sysadm::Install
 ########################################
+
+0.27 2008/03/26
+    (ms) Fixes a broken CPAN upload.
+
+0.26 2008/03/25
+    (ms) Added rc/stdout/stderr debug output to tap()
+    (ms) Added perm_get/set to export list
+    (ms) Added shell escapes for tap()
+
+0.25 2008/02/07
+    (ms) Fixed directory stack bug in cdback()
+
+0.24 2007/10/24
+    (ms) Added def_or() function to emulate the //= operator
+    (ms) Added blurt_atomic() to write data to a file, guaranteeing that
+         the operation either fully succeeds or fails. It makes sure that
+         we're not left with a partially written file in case the
+         operation gets interrupted.
+    (ms) fixed password_read() documentation bug
+
+0.23 2007/04/01
+    (ms) Added nice_time() and password_read().
+    (ms) Fixed quote($str, ":shell") to escape single quotes within
+         single quotes in a shell-compatible way.
+
+0.22 2006/09/19
+    (ms) Skipping Archive::Tar tests if A:T isn't installed
+
+0.21 2006/02/02
+    (ms) Added log messages to cp, mv, download, make.
+    (ms) untar() and untar_in() now pass the cwd value to
+         Archive::Tar's extract function to avoid excessive
+         and expensive cwd() calls (thanks to Greg Olszewski
+         for finding this performance bottleneck).
 
 0.20 2005/08/13
     (ms) Requiring Log4perl-1.00 now to avoid a problem with the
@@ -10,10 +44,6 @@
     (ms) Greg Olszewski reported a bug in untar_in() with tarfiles
          on relative paths, fixed by using one-argument version of
          rel2abs.
-
-0.19 2005/07/28
-
-0.19 2005/07/28
 
 0.18 2005/07/14
     (ms) Requiring File::Temp 0.16 now (S:I needs OO-API).
@@ -26,7 +56,7 @@
          commands, every writing function (cp(), mv(), untar(), pie(),
          blurt(), ...) will ask the user for confirmation before actually
          performing what's been requested. Sysadm::Install::confirm(0)
-	 switches back to normal.
+         switches back to normal.
     (ms) Added patch by Jud Dagnall to allow slurp() to process
          @ARGV like <> does.
     (ms) Archive::Tar is no longer mandatory for installation, just

Modified: trunk/libsysadm-install-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/MANIFEST?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/MANIFEST (original)
+++ trunk/libsysadm-install-perl/MANIFEST Sun Jul  6 21:10:41 2008
@@ -21,5 +21,7 @@
 t/008dry.t
 t/009snip.t
 t/010carp.t
+t/011defor.t
+t/012tap.t
 t/canned/test.tar
 t/canned/testa.tar

Modified: trunk/libsysadm-install-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/META.yml?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/META.yml (original)
+++ trunk/libsysadm-install-perl/META.yml Sun Jul  6 21:10:41 2008
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Sysadm-Install
-version:      0.20
+version:      0.27
 version_from: lib/Sysadm/Install.pm
 installdirs:  site
 requires:
@@ -12,6 +12,7 @@
     File::Temp:                    0.16
     Log::Log4perl:                 1
     LWP::Simple:                   0
+    Term::ReadKey:                 0
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+generated_by: ExtUtils::MakeMaker version 6.17

Modified: trunk/libsysadm-install-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/Makefile.PL?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/Makefile.PL (original)
+++ trunk/libsysadm-install-perl/Makefile.PL Sun Jul  6 21:10:41 2008
@@ -30,12 +30,13 @@
 WriteMakefile(
     NAME              => 'Sysadm::Install',
     VERSION_FROM      => 'lib/Sysadm/Install.pm', # finds $VERSION
-    EXE_FILES         => ['eg/one-liner'],
+    EXE_FILES         => ['eg/one-liner' ],
     PREREQ_PM         => {
         Log::Log4perl   => 1.00,
         File::Copy      => 0,
         File::Path      => 0,
         File::Basename  => 0,
+        Term::ReadKey   => 0,
         LWP::Simple     => 0,
         Cwd             => 0,
         File::Temp      => 0.16,

Modified: trunk/libsysadm-install-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/README?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/README (original)
+++ trunk/libsysadm-install-perl/README Sun Jul  6 21:10:41 2008
@@ -1,5 +1,5 @@
 ######################################################################
-    Sysadm::Install 0.20
+    Sysadm::Install 0.27
 ######################################################################
 
 NAME
@@ -118,7 +118,11 @@
         the shell.
 
     "cd($dir)"
-        chdir to the given directory.
+        chdir to the given directory. If you don't want to have cd() modify
+        the internal directory stack (used for subsequent cdback() calls),
+        set the stack_update parameter to a false value:
+
+            cd($dir, {stack_update => 0});
 
     "cdback()"
         chdir back to the last directory before a previous "cd".
@@ -162,6 +166,14 @@
         file. If $append is set to a true value, data will be appended to
         the file. Default is false, existing files will be overwritten.
 
+    "blurt_atomic($data, $file)"
+        Write the data in $data to a file $file, guaranteeing that the
+        operation will either complete fully or not at all. This is
+        accomplished by first writing to a temporary file which is then
+        rename()ed to the target file.
+
+        Unlike in "blurt", there is no $append mode in "blurt_atomic".
+
     "($stdout, $stderr, $exit_code) = tap($cmd, @args)"
         Run a command $cmd in the shell, and pass it @args as args. Capture
         STDOUT and STDERR, and return them as strings. If $exit_code is 0,
@@ -274,7 +286,37 @@
             perl -e "print \"hello\\n\"; print \"world\\n\"; "
 
     "$quoted_string = quote($string, [$metachars])"
-        Similar to "qquote()", just puts a string in single quotes.
+        Similar to "qquote()", just puts a string in single quotes and
+        escapes what needs to be escaped.
+
+        Note that shells typically don't support escaped single quotes
+        within single quotes, which means that
+
+            $ echo 'foo\'bar'
+            >
+
+        is invalid and the shell waits until it finds a closing quote.
+        Instead, there is an evil trick which gives the desired result:
+
+            $ echo 'foo'\''bar'  # foo, single quote, \, 2 x single quote, bar
+            foo'bar
+
+        It uses the fact that shells interpret back-to-back strings as one.
+        The construct above consists of three back-to-back strings:
+
+            (1) 'foo'
+            (2) '
+            (3) 'bar'
+
+        which all get concatenated to a single
+
+            foo'bar
+
+        If you call "quote()" with $metachars set to ":shell", it will
+        perform that magic behind the scenes:
+
+            print quote("foo'bar");
+              # prints: 'foo'\''bar'
 
     "perm_cp($src, $dst, ...)"
         Read the $src file's user permissions and modify all $dst files to
@@ -348,11 +390,68 @@
         indicating the length of the original string, the beginning, the
         end, and the number of 'snipped' characters.
 
+    "password_read($prompt)"
+        Reads in a password to be typed in by the user in noecho mode. A
+        call to password_read("password: ") results in
+
+            password: ***** (stars aren't actually displayed)
+
+        This function will switch the terminal back into normal mode after
+        the user hits the 'Return' key.
+
+    "nice_time($time)"
+        Format the time in a human-readable way, less wasteful than the
+        'scalar localtime' formatting.
+
+            print nice_time(), "\n";
+              # 2007/04/01 10:51:24
+
+        It uses the system time by default, but it can also accept epoch
+        seconds:
+
+            print nice_time(1170000000), "\n";
+              # 2007/01/28 08:00:00
+
+        It uses localtime() under the hood, so the outcome of the above will
+        depend on your local time zone setting.
+
+    "def_or($foo, $default)"
+        Perl-5.9 added the //= construct, which helps assigning values to
+        undefined variables. Instead of writing
+
+            if(!defined $foo) {
+                $foo = $default;
+            }
+
+        you can just write
+
+            $foo //= $default;
+
+        However, this is not available on older perl versions (although
+        there's source filter solutions). Often, people use
+
+            $foo ||= $default;
+
+        instead which is wrong if $foo contains a value that evaluates as
+        false. So Sysadm::Install, the everything-and-the-kitchen-sink under
+        the CPAN modules, provides the function "def_or()" which can be used
+        like
+
+            def_or($foo, $default); 
+
+        to accomplish the same as
+
+            $foo //= $default;
+
+        How does it work, how does $foo get a different value, although it's
+        apparently passed in by value? Modifying $_[0] within the subroutine
+        is an old Perl trick to do exactly that.
+
 AUTHOR
     Mike Schilli, <m at perlmeister.com>
 
 COPYRIGHT AND LICENSE
-    Copyright (C) 2004 by Mike Schilli
+    Copyright (C) 2004-2007 by Mike Schilli
 
     This library is free software; you can redistribute it and/or modify it
     under the same terms as Perl itself, either Perl version 5.8.3 or, at

Modified: trunk/libsysadm-install-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/debian/changelog?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/debian/changelog (original)
+++ trunk/libsysadm-install-perl/debian/changelog Sun Jul  6 21:10:41 2008
@@ -1,4 +1,4 @@
-libsysadm-install-perl (0.20-2) UNRELEASED; urgency=low
+libsysadm-install-perl (0.27-1) UNRELEASED; urgency=low
 
   * Take over for the Debian Perl Group with maintainer's permission
     (http://lists.debian.org/debian-perl/2008/06/msg00039.html)
@@ -9,6 +9,8 @@
     <rafl at debianforum.de>); Florian Ragwitz <rafl at debianforum.de> moved
     to Uploaders.
   * Add debian/watch.
+
+  * New upstream release.
 
  -- gregor herrmann <gregoa at debian.org>  Sun, 15 Jun 2008 17:24:46 +0200
 

Modified: trunk/libsysadm-install-perl/lib/Sysadm/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/lib/Sysadm/Install.pm?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/lib/Sysadm/Install.pm (original)
+++ trunk/libsysadm-install-perl/lib/Sysadm/Install.pm Sun Jul  6 21:10:41 2008
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.20';
+our $VERSION = '0.27';
 
 use File::Copy;
 use File::Path;
@@ -16,7 +16,7 @@
 use File::Basename;
 use File::Spec::Functions qw(rel2abs abs2rel);
 use Cwd;
-use File::Temp;
+use File::Temp qw(tempfile);
 
 our $DRY_RUN;
 our $CONFIRM;
@@ -77,11 +77,13 @@
 cdback download untar 
 pie slurp blurt mv tap 
 plough qquote quote perm_cp
+perm_get perm_set
 sysrun untar_in pick ask
 hammer say
 sudo_me bin_find
 fs_read_open fs_write_open pipe_copy
-snip
+snip password_read nice_time
+def_or blurt_atomic
 );
 
 our %EXPORTABLE = map { $_ => 1 } @EXPORTABLE;
@@ -194,6 +196,8 @@
 
     _confirm("cp $_[0] $_[1]") or return 1;
 
+    INFO "cp $_[0] $_[1]";
+
     File::Copy::copy @_ or 
         get_logger("")->logcroak("Cannot copy $_[0] to $_[1] ($!)");
 }
@@ -214,6 +218,8 @@
 
     _confirm("mv $_[0] $_[1]") or return 1;
 
+    INFO "mv $_[0] $_[1]";
+
     File::Copy::move @_ or 
         get_logger("")->logcroak("Cannot move $_[0] to $_[1] ($!)");
 }
@@ -232,6 +238,8 @@
 ###############################################
 
     local($Log::Log4perl::caller_depth) += 1;
+
+    INFO "download $_[0]";
 
     _confirm("Downloading $_[0] => ", basename($_[0])) or return 1;
 
@@ -443,6 +451,8 @@
 
     _confirm "mkd @_" or return 1;
 
+    INFO "mkpath @_";
+
     mkpath @_ or 
         get_logger("")->logcroak("Cannot mkdir @_ ($!)");
 }
@@ -469,6 +479,8 @@
         return;
     }
 
+    INFO "rmtree @_";
+
     rmtree $_[0] or 
         get_logger("")->logcroak("Cannot rmtree $_[0] ($!)");
 }
@@ -477,7 +489,11 @@
 
 =item C<cd($dir)>
 
-chdir to the given directory.
+chdir to the given directory. If you don't want to have cd() modify
+the internal directory stack (used for subsequent cdback() calls), 
+set the stack_update parameter to a false value:
+
+    cd($dir, {stack_update => 0});
 
 =cut
 
@@ -488,7 +504,10 @@
     local($Log::Log4perl::caller_depth) += 1;
     INFO "cd $_[0]";
 
-    push @DIR_STACK, getcwd();
+    my $opts = { stack_update => 1 };
+    $opts = $_[1] if ref $_[1] eq "HASH";
+
+    push @DIR_STACK, getcwd() if $opts->{stack_update};
     chdir($_[0]) or 
         get_logger("")->logcroak("Cannot cd $_[0] ($!)");
 }
@@ -511,7 +530,7 @@
 
     my $old_dir = pop @DIR_STACK;
     INFO "cdback to $old_dir";
-    cd($old_dir);
+    cd($old_dir, {stack_update => 0});
 }
 
 =pod
@@ -529,6 +548,8 @@
     local($Log::Log4perl::caller_depth) += 1;
 
     _confirm "make @_" or return 1;
+
+    INFO "make @_";
 
     system("make @_") and 
         get_logger("")->logcroak("Cannot make @_ ($!)");
@@ -733,6 +754,8 @@
 
     local($Log::Log4perl::caller_depth) += 1;
 
+    $append = 0 unless defined $append;
+
     _confirm(($append ? "Appending" : "Writing") . " " .
          length($data) . " bytes to $file") or return 1;
 
@@ -743,6 +766,36 @@
     close FILE;
 
     DEBUG "Wrote ", snip($data, $DATA_SNIPPED_LEN), " to $file";
+}
+
+=pod
+
+=item C<blurt_atomic($data, $file)>
+
+Write the data in $data to a file $file, guaranteeing that the operation
+will either complete fully or not at all. This is accomplished by first
+writing to a temporary file which is then rename()ed to the target file.
+
+Unlike in C<blurt>, there is no C<$append> mode in C<blurt_atomic>.
+
+=cut
+
+###############################################
+sub blurt_atomic {
+###############################################
+    my($data, $file) = @_;
+
+    _confirm("Writing atomically " .
+         length($data) . " bytes to $file") or return 1;
+
+    my($fh, $tmpname) = tempfile(DIR => dirname($file));
+
+    blurt($data, $tmpname);
+
+    rename $tmpname, $file or
+        LOGDIE "Can't rename $tmpname to $file";
+
+    DEBUG "Wrote ", snip($data, $DATA_SNIPPED_LEN), " atomically to $file";
 }
 
 =pod
@@ -814,7 +867,7 @@
         $cmd = join ' ', map { qquote($_, ":shell") } @args;
     } else {
             # Default mode: Single quotes
-        $cmd = join ' ', map { quote($_) } @args;
+        $cmd = join ' ', map { quote($_, ":shell") } @args;
     }
        
     $cmd = "$cmd 2>$tmpfile |";
@@ -828,6 +881,8 @@
     my $exit_code = $?;
 
     my $stderr = slurp($tmpfile);
+
+    DEBUG "tap $cmd results: rc=$exit_code stderr=[$stderr] stdout=[$stdout]";
 
     return ($stdout, $stderr, $exit_code);
 }
@@ -930,7 +985,37 @@
 
 =item C<$quoted_string = quote($string, [$metachars])>
 
-Similar to C<qquote()>, just puts a string in single quotes.
+Similar to C<qquote()>, just puts a string in single quotes and
+escapes what needs to be escaped.
+
+Note that shells typically don't support escaped single quotes within
+single quotes, which means that
+
+    $ echo 'foo\'bar'
+    >
+
+is invalid and the shell waits until it finds a closing quote. 
+Instead, there is an evil trick which gives the desired result:
+
+    $ echo 'foo'\''bar'  # foo, single quote, \, 2 x single quote, bar
+    foo'bar
+
+It uses the fact that shells interpret back-to-back strings as one.
+The construct above consists of three back-to-back strings: 
+
+    (1) 'foo'
+    (2) '
+    (3) 'bar'
+
+which all get concatenated to a single 
+
+    foo'bar
+
+If you call C<quote()> with C<$metachars> set to ":shell", it will
+perform that magic behind the scenes:
+
+    print quote("foo'bar");
+      # prints: 'foo'\''bar'
 
 =cut
 
@@ -939,10 +1024,14 @@
 ###############################################
     my($str, $metas) = @_;
 
-    $str =~ s/([\\'])/\\$1/g;
-
-    if(defined $metas) {
-        $metas = '' if $metas eq ":shell";
+    if(defined $metas and $metas eq ":shell") {
+        $str =~ s/([\\])/\\$1/g;
+        $str =~ s/(['])/'\\''/g;
+    } else {
+        $str =~ s/([\\'])/\\$1/g;
+    }
+
+    if(defined $metas and $metas ne ":shell") {
         $metas =~ s/\]/\\]/g;
         $str =~ s/([$metas])/\\$1/g;
     }
@@ -1320,6 +1409,114 @@
 
 =pod
 
+=item C<password_read($prompt)>
+
+Reads in a password to be typed in by the user in noecho mode.
+A call to password_read("password: ") results in
+
+    password: ***** (stars aren't actually displayed)
+
+This function will switch the terminal back into normal mode
+after the user hits the 'Return' key.
+
+=cut
+
+###########################################
+sub password_read {
+###########################################
+    my($prompt) = @_;
+
+    use Term::ReadKey;
+    ReadMode 'noecho';
+    $| = 1;
+    print "$prompt";
+    my $pw = ReadLine 0;
+    chomp $pw;
+    ReadMode 'restore';
+    print "\n";
+
+    return $pw;
+}
+
+=pod
+
+=item C<nice_time($time)>
+
+Format the time in a human-readable way, less wasteful than the 
+'scalar localtime' formatting. 
+
+    print nice_time(), "\n";
+      # 2007/04/01 10:51:24
+
+It uses the system time by default, but it can also accept epoch seconds:
+
+    print nice_time(1170000000), "\n";
+      # 2007/01/28 08:00:00
+
+It uses localtime() under the hood, so the outcome of the above will
+depend on your local time zone setting.
+
+=cut
+
+###########################################
+sub nice_time {
+###########################################
+    my($time) = @_;
+
+    $time = time() unless defined $time;
+
+    my ($sec,$min,$hour,$mday,$mon,$year,
+     $wday,$yday,$isdst) = localtime($time);
+
+    return sprintf("%d/%02d/%02d %02d:%02d:%02d",
+     $year+1900, $mon+1, $mday,
+     $hour, $min, $sec);
+}
+
+=item C<def_or($foo, $default)>
+
+Perl-5.9 added the //= construct, which helps assigning values to
+undefined variables. Instead of writing
+
+    if(!defined $foo) {
+        $foo = $default;
+    }
+
+you can just write
+
+    $foo //= $default;
+
+However, this is not available on older perl versions (although there's 
+source filter solutions). Often, people use
+
+    $foo ||= $default;
+
+instead which is wrong if $foo contains a value that evaluates as false.
+So Sysadm::Install, the everything-and-the-kitchen-sink under the CPAN
+modules, provides the function C<def_or()> which can be used like
+
+    def_or($foo, $default); 
+
+to accomplish the same as
+
+    $foo //= $default;
+
+How does it work, how does $foo get a different value, although it's 
+apparently passed in by value? Modifying $_[0] within the subroutine
+is an old Perl trick to do exactly that.
+
+=cut
+
+###########################################
+sub def_or($$) {
+###########################################
+    if(! defined $_[0]) {
+        $_[0] = $_[1];
+    }
+}
+
+=pod
+
 =back
 
 =head1 AUTHOR
@@ -1328,7 +1525,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2004 by Mike Schilli
+Copyright (C) 2004-2007 by Mike Schilli
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself, either Perl version 5.8.3 or,

Modified: trunk/libsysadm-install-perl/t/002tar.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/t/002tar.t?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/t/002tar.t (original)
+++ trunk/libsysadm-install-perl/t/002tar.t Sun Jul  6 21:10:41 2008
@@ -2,13 +2,25 @@
 # Tests for Sysadm::Install/s untar()
 #####################################
 
-use Test::More tests => 9;
+use Test::More;
 
 use Sysadm::Install qw(:all);
 use File::Spec;
 use File::Path;
 #use Log::Log4perl qw(:easy);
 #Log::Log4perl->easy_init($DEBUG);
+
+BEGIN {
+    eval {
+        require Archive::Tar;
+    };
+
+    if ($@) {
+        plan skip_all => "Skipping Archive::Tar tests (not installed)";
+    } else {
+        plan tests => 9;
+    }
+}
 
 my $TEST_DIR = ".";
 $TEST_DIR = "t" if -d 't';

Modified: trunk/libsysadm-install-perl/t/003slurp.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/t/003slurp.t?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/t/003slurp.t (original)
+++ trunk/libsysadm-install-perl/t/003slurp.t Sun Jul  6 21:10:41 2008
@@ -2,7 +2,7 @@
 # Tests for Sysadm::Install/s slurp/blurt/pie
 #############################################
 
-use Test::More tests => 4;
+use Test::More tests => 5;
 use strict;
 use warnings;
 
@@ -27,6 +27,12 @@
 ok(-f $TMP_FILE, "$TMP_FILE exists");
 
 #####################################################################
+# Blurt atomically
+#####################################################################
+blurt_atomic("one\ntwo\nthree", $TMP_FILE);
+ok(-f $TMP_FILE, "$TMP_FILE exists");
+
+#####################################################################
 # Slurp
 #####################################################################
 my $data = slurp($TMP_FILE);

Modified: trunk/libsysadm-install-perl/t/005qquote.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/t/005qquote.t?rev=22883&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/t/005qquote.t (original)
+++ trunk/libsysadm-install-perl/t/005qquote.t Sun Jul  6 21:10:41 2008
@@ -2,7 +2,7 @@
 # Tests for Sysadm::Install/s plough
 #############################################
 
-use Test::More tests => 4;
+use Test::More tests => 5;
 
 use Sysadm::Install qw(:all);
 
@@ -29,3 +29,7 @@
     # single quote
 $escaped = quote("[some]\$thing(weird)'`");
 is($escaped, "'[some]\$thing(weird)\\'`'", "single quote");
+
+    # single quote containing single quote
+$escaped = quote("foo'bar", ":shell");
+is($escaped, "'foo'\\''bar'", "foo'bar");




More information about the Pkg-perl-cvs-commits mailing list