r53844 - in /trunk/libstring-format-perl: COPYING Format.pm MANIFEST MANIFEST.SKIP META.yml Makefile.PL README debian/changelog t/04subrefs.t t/06slash-n.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Mar 7 05:41:57 UTC 2010


Author: jawnsy-guest
Date: Sun Mar  7 05:41:48 2010
New Revision: 53844

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

Added:
    trunk/libstring-format-perl/COPYING
      - copied unchanged from r53843, branches/upstream/libstring-format-perl/current/COPYING
    trunk/libstring-format-perl/t/06slash-n.t
      - copied unchanged from r53843, branches/upstream/libstring-format-perl/current/t/06slash-n.t
Modified:
    trunk/libstring-format-perl/Format.pm
    trunk/libstring-format-perl/MANIFEST
    trunk/libstring-format-perl/MANIFEST.SKIP
    trunk/libstring-format-perl/META.yml
    trunk/libstring-format-perl/Makefile.PL
    trunk/libstring-format-perl/README
    trunk/libstring-format-perl/debian/changelog
    trunk/libstring-format-perl/t/04subrefs.t

Modified: trunk/libstring-format-perl/Format.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/Format.pm?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/Format.pm (original)
+++ trunk/libstring-format-perl/Format.pm Sun Mar  7 05:41:48 2010
@@ -1,9 +1,7 @@
 package String::Format;
 
 # ----------------------------------------------------------------------
-# $Id: Format.pm,v 1.4 2005/12/22 17:18:12 dlc Exp $
-# ----------------------------------------------------------------------
-#  Copyright (C) 2002 darren chamberlain <darren at cpan.org>
+#  Copyright (C) 2002,2009 darren chamberlain <darren at cpan.org>
 #
 #  This program is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU General Public License as
@@ -21,12 +19,11 @@
 # -------------------------------------------------------------------
 
 use strict;
-use vars qw($VERSION $REVSION @EXPORT);
+use vars qw($VERSION @EXPORT);
 use Exporter;
 use base qw(Exporter);
 
-$VERSION = '1.14';
-$REVSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/;
+$VERSION = '1.16';
 @EXPORT = qw(stringf);
 
 sub _replace {
@@ -81,9 +78,9 @@
 sub stringf {
     my $format = shift || return;
     my $args = UNIVERSAL::isa($_[0], 'HASH') ? shift : { @_ };
-       $args->{'n'} = "\n" unless defined $args->{'n'};
-       $args->{'t'} = "\t" unless defined $args->{'t'};
-       $args->{'%'} = "%"  unless defined $args->{'%'};
+       $args->{'n'} = "\n" unless exists $args->{'n'};
+       $args->{'t'} = "\t" unless exists $args->{'t'};
+       $args->{'%'} = "%"  unless exists $args->{'%'};
 
     $format =~ s/$regex/_replace($args, $1, $2, $3, $4, $5, $6)/ge;
 
@@ -111,11 +108,7 @@
 
 =head1 SYNOPSIS
 
-  # In a script invoked as:
-  # script.pl -f "I like %a, %b, and %g, but not %m or %w."
-
   use String::Format;
-  use Getopt::Std;
 
   my %fruit = (
         'a' => "apples",
@@ -125,10 +118,9 @@
         'w' => "watermelons",
   );
 
-  use vars qw($opt_f);
-  getopt("f");
-
-  print stringf($opt_f, %fruit);
+  my $format = "I like %a, %b, and %g, but not %m or %w.";
+
+  print stringf($format, %fruit);
   
   # prints:
   # I like apples, bannanas, and grapefruits, but not melons or watermelons.
@@ -233,6 +225,13 @@
 
   my $reformed = reformat($format_string);
 
+=head1 LICENSE
+
+C<String::Format> is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; version 2.
+
+
 =head1 AUTHOR
 
 darren chamberlain <darren at cpan.org>

Modified: trunk/libstring-format-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/MANIFEST?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/MANIFEST (original)
+++ trunk/libstring-format-perl/MANIFEST Sun Mar  7 05:41:48 2010
@@ -1,12 +1,14 @@
 Changes
+COPYING
 Format.pm
+Makefile.PL
 MANIFEST
 MANIFEST.SKIP
-Makefile.PL
 README
 t/01load.t
 t/02basic.t
 t/03multiple.t
 t/04subrefs.t
 t/05stringfactory.t
+t/06slash-n.t
 META.yml                                 Module meta-data (added by MakeMaker)

Modified: trunk/libstring-format-perl/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/MANIFEST.SKIP?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/MANIFEST.SKIP (original)
+++ trunk/libstring-format-perl/MANIFEST.SKIP Sun Mar  7 05:41:48 2010
@@ -4,3 +4,4 @@
 ^_build/
 ^pm_to_blib$
 ^blib/
+\.git

Modified: trunk/libstring-format-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/META.yml?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/META.yml (original)
+++ trunk/libstring-format-perl/META.yml Sun Mar  7 05:41:48 2010
@@ -1,11 +1,19 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         String-Format
-version:      1.14
-version_from: 
-installdirs:  site
+--- #YAML:1.0
+name:               String-Format
+version:            1.16
+abstract:           ~
+author:  []
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    Test::More:                    0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+    Test::More:  0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.48
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: trunk/libstring-format-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/Makefile.PL?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/Makefile.PL (original)
+++ trunk/libstring-format-perl/Makefile.PL Sun Mar  7 05:41:48 2010
@@ -6,10 +6,10 @@
 );
 
 WriteMakefile(
-    'NAME'      => 'String::Format',
-    'VERSION'   => '1.14',
-    'clean'     => \%clean,
-    'PREREQ_PM' => {
+    'NAME'          => 'String::Format',
+    'VERSION_FROM'  => 'Format.pm',
+    'clean'         => \%clean,
+    'PREREQ_PM'     => {
         'Test::More' => 0.00,
     },
 );

Modified: trunk/libstring-format-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/README?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/README (original)
+++ trunk/libstring-format-perl/README Sun Mar  7 05:41:48 2010
@@ -1,17 +1,13 @@
 NAME
-    String::Format - sprintf-like string formatting capabilities
-    with arbitrary format definitions
+    String::Format - sprintf-like string formatting capabilities with
+    arbitrary format definitions
 
 ABSTRACT
-    String::Format allows for sprintf-style formatting capabilities
-    with arbitrary format definitions
+    String::Format allows for sprintf-style formatting capabilities with
+    arbitrary format definitions
 
 SYNOPSIS
-      # In a script invoked as:
-      # script.pl -f "I like %a, %b, and %g, but not %m or %w."
-
       use String::Format;
-      use Getopt::Std;
 
       my %fruit = (
             'a' => "apples",
@@ -21,60 +17,53 @@
             'w' => "watermelons",
       );
 
-      use vars qw($opt_f);
-      getopt("f");
+      my $format = "I like %a, %b, and %g, but not %m or %w.";
 
-      print stringf($opt_f, %fruit);
-      
+      print stringf($format, %fruit);
+  
       # prints:
       # I like apples, bannanas, and grapefruits, but not melons or watermelons.
 
 DESCRIPTION
-    String::Format lets you define arbitrary printf-like format
-    sequences to be expanded. This module would be most useful in
-    configuration files and reporting tools, where the results of a
-    query need to be formatted in a particular way. It was inspired
-    by mutt's index_format and related directives (see
-    <URL:http://www.mutt.org/doc/manual/manual-
-    6.html#index_format>).
+    String::Format lets you define arbitrary printf-like format sequences to
+    be expanded. This module would be most useful in configuration files and
+    reporting tools, where the results of a query need to be formatted in a
+    particular way. It was inspired by mutt's index_format and related
+    directives (see
+    <URL:http://www.mutt.org/doc/manual/manual-6.html#index_format>).
 
 FUNCTIONS
   stringf
-
-    String::Format exports a single function called stringf. stringf
-    takes two arguments: a format string (see FORMAT STRINGS, below)
-    and a hash (or reference to a hash) of name => value pairs.
-    These name => value pairs are what will be expanded in the
-    format string.
+    String::Format exports a single function called stringf. stringf takes
+    two arguments: a format string (see FORMAT STRINGS, below) and a
+    reference to a hash of name => value pairs. These name => value pairs
+    are what will be expanded in the format string.
 
 FORMAT STRINGS
     Format strings must match the following regular expression:
 
-      qr!
+      qr/
          (%             # leading '%'
           (-)?          # left-align, rather than right
           (\d*)?        # (optional) minimum field width
           (?:\.(\d*))?  # (optional) maximum field width
           ({.*?})?      # (optional) stuff inside
           (\S)          # actual format character
-         )!x;
+         )/x;
 
-    If the escape character specified does not exist in %args, then
-    the original string is used. The alignment, minimum width, and
-    maximum width options function identically to how they are
-    defined in sprintf(3) (any variation is a bug, and should be
-    reported).
+    If the escape character specified does not exist in %args, then the
+    original string is used. The alignment, minimum width, and maximum width
+    options function identically to how they are defined in sprintf(3) (any
+    variation is a bug, and should be reported).
 
-    Note that Perl's sprintf definition is a little more liberal
-    than the above regex; the deviations were intentional, and all
-    deal with numeric formatting (the #, 0, and + leaders were
-    specifically left out).
+    Note that Perl's sprintf definition is a little more liberal than the
+    above regex; the deviations were intentional, and all deal with numeric
+    formatting (the #, 0, and + leaders were specifically left out).
 
-    The value attached to the key can be a scalar value or a
-    subroutine reference; if it is a subroutine reference, then
-    anything between the '{' and '}' ($5 in the above regex) will be
-    passed as $_[0] to the subroutine reference. This allows for
-    entries such as this:
+    The value attached to the key can be a scalar value or a subroutine
+    reference; if it is a subroutine reference, then anything between the
+    '{' and '}' ($5 in the above regex) will be passed as $_[0] to the
+    subroutine reference. This allows for entries such as this:
 
       %args = (
           d => sub { POSIX::strftime($_[0], localtime) }, 
@@ -88,29 +77,28 @@
 
       It is 17:45 right now, on Monday, February 4.
 
-    Note that since the string is passed unmolested to the
-    subroutine reference, and strftime would Do The Right Thing with
-    this data, the above format string could be written as:
+    Note that since the string is passed unmolested to the subroutine
+    reference, and strftime would Do The Right Thing with this data, the
+    above format string could be written as:
 
       "It is %{%M:%S right now, on %A, %B %e}d."
 
-    By default, the formats 'n', 't', and '%' are defined to be a
-    newline, tab, and '%', respectively, if they are not already
-    defined in the hash of arguments that gets passed it. So we can
-    add carriage returns simply:
+    By default, the formats 'n', 't', and '%' are defined to be a newline,
+    tab, and '%', respectively, if they are not already defined in the
+    hashref of arguments that gets passed it. So we can add carriage returns
+    simply:
 
       "It is %{%M:%S right now, on %A, %B %e}d.%n"
 
-    Because of how the string is parsed, the normal "\n" and "\t"
-    are turned into two characters each, and are not treated as a
-    newline and tab. This is a bug.
+    Because of how the string is parsed, the normal "\n" and "\t" are turned
+    into two characters each, and are not treated as a newline and tab. This
+    is a bug.
 
 FACTORY METHOD
-    String::Format also supports a class method, named
-    stringfactory, which will return reference to a "primed"
-    subroutine. stringfatory should be passed a reference to a hash
-    of value; the returned subroutine will use these values as the
-    %args hash.
+    String::Format also supports a class method, named stringfactory, which
+    will return reference to a "primed" subroutine. stringfatory should be
+    passed a reference to a hash of value; the returned subroutine will use
+    these values as the %args hash.
 
       my $self = Some::Groovy::Package->new($$, $<, $^T);
       my %formats = (
@@ -124,8 +112,8 @@
       print $index_format->($format1);
       print $index_format->($format2);
 
-    This subroutine reference can be assigned to a local symbol
-    table entry, and called normally, of course:
+    This subroutine reference can be assigned to a local symbol table entry,
+    and called normally, of course:
 
       *reformat = String::Format->stringfactory(\%formats);
 

Modified: trunk/libstring-format-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/debian/changelog?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/debian/changelog (original)
+++ trunk/libstring-format-perl/debian/changelog Sun Mar  7 05:41:48 2010
@@ -1,11 +1,12 @@
-libstring-format-perl (1.14-2.1) UNRELEASED; urgency=low
+libstring-format-perl (1.16-1) UNRELEASED; urgency=low
 
   * Adopt this package (Closes: #572530)
+  * New upstream release
   * Update watch location (use dist URL, not author URL)
   * Use new short debhelper rules format
   * Update copyright information to new DEP5 format
 
- -- Jonathan Yu <jawnsy at cpan.org>  Sun, 07 Mar 2010 01:03:09 -0500
+ -- Jonathan Yu <jawnsy at cpan.org>  Sun, 07 Mar 2010 01:05:36 -0500
 
 libstring-format-perl (1.14-2) unstable; urgency=low
 

Modified: trunk/libstring-format-perl/t/04subrefs.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstring-format-perl/t/04subrefs.t?rev=53844&op=diff
==============================================================================
--- trunk/libstring-format-perl/t/04subrefs.t (original)
+++ trunk/libstring-format-perl/t/04subrefs.t Sun Mar  7 05:41:48 2010
@@ -11,10 +11,9 @@
 
 use strict;
 
-use Test::More tests => 3;
+use Test::More tests => 2;
 use String::Format;
 use POSIX qw(strftime); # for test 1
-use Socket; # for test 3
 
 my ($orig, $target, $result);
 
@@ -32,9 +31,8 @@
 # using getpwuid
 # ======================================================================
 SKIP: {
-    use Config;
-    skip "getpwuid not implmented on this platform", 1 
-        unless $Config{'d_getpwuid_r'};
+    skip "Test skipped on this platform", 1 
+        if $^O eq 'MSWin32';
 
     $orig   = "I am %u.";
     $target = "I am " . getpwuid($<) . ".";
@@ -42,13 +40,3 @@
     is $target => $result;
 }
 
-# ======================================================================
-# Test 3
-# hostname lookups
-# ======================================================================
-sub ip { inet_ntoa inet_aton $_[0] }
-$orig   = q(The address for localhost is %{localhost}i.);
-$target = q(The address for localhost is 127.0.0.1.);
-$result = stringf $orig, "i" => \&ip;
-is $target => $result;
-




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