Commits

Anonymous committed 9ff47aa

Got all tests to pass.

  • Participants
  • Parent commits 2a597bb

Comments (0)

Files changed (3)

modules/Text-Sprintf-Named/Changes

 Revision history for Text::Sprintf::Named
 
-0.01    Date/time
+0.01    TODO : Fill the time.
         First version, released on an unsuspecting world.
 

modules/Text-Sprintf-Named/README

 Text::Sprintf::Named
 
-The README is used to introduce the module and provide instructions on
-how to install the module, any machine dependencies it may have (for
-example C compilers and installed libraries) and any other information
-that should be provided before the module is installed.
+This module provides a sprintf-like function with named conversions (similar 
+to the one in Python). So for example the call:
 
-A README file is required for CPAN modules since CPAN extracts the README
-file from a module distribution so that people browsing the archive
-can use it get an idea of the modules uses. It is usually a good idea
-to provide version information here so that people can decide whether
-fixes for the module are worth downloading.
+    named_sprintf("Hello %(name)s! Happy new %(year)d!", 
+        { name => "Sophie", year => 2007 }
+    );
+
+Will return "Hello Sophie! Happy new 2006!".
 
 INSTALLATION
 
 
 Copyright (C) 2006 Shlomi Fish
 
-This program is released under the following license: bsd
+This program is released under the following license: MIT X11. 

modules/Text-Sprintf-Named/lib/Text/Sprintf/Named.pm

 
 =head1 NAME
 
-Text::Sprintf::Named - The great new Text::Sprintf::Named!
+Text::Sprintf::Named - sprintf-like function with named conversions
 
 =head1 VERSION
 
 
 =head1 SYNOPSIS
 
-Quick summary of what the module does.
-
-Perhaps a little code snippet.
-
     use Text::Sprintf::Named;
 
-    my $foo = Text::Sprintf::Named->new();
-    ...
+    my $formatter =
+        Text::Sprintf::Named->new(
+            {fmt => "Hello %(name)s! Today is %(day)s!"
+        );
+
+    # Returns "Hello Ayeleth! Today is Sunday!"
+    $formmater->format({'name' => "Ayeleth", 'day' => "Sunday"});
+
+    # Returns "Hello John! Today is Thursday!"
+    $formatter->format({'name' => "John", 'day' => "Thursday"});
+
+=head1 DESCRIPTION
+
+Text::Sprintf::Named provides a sprintf equivalent with named conversions.
+Named conversions are sprintf field specifiers (like C<"%s"> or C<"%4d>")
+only they are associated with the key of an associative array of
+parameters. So for example C<"%(name)s"> will emit the C<'name'> parameter
+as a string, and C<"%(num)4d"> will emit the C<'num'> parameter 
+as a variable with a width of 4.
+
+=head1 FUNCTIONS
 
 =head1 EXPORT
 
 A list of functions that can be exported.  You can delete this section
 if you don't export anything, such as for a purely object-oriented module.
 
-=head1 FUNCTIONS
-
-=head2 function1
-
-=cut
-
-sub function1 {
-}
-
-=head2 function2
-
-=cut
-
-sub function2 {
-}
-
 =head1 AUTHOR
 
 Shlomi Fish, C<< <shlomif at cpan.org> >>
 
 Copyright 2006 Shlomi Fish, all rights reserved.
 
-This program is released under the following license: bsd
+This program is released under the following license: MIT X11. 
+
+(Note that the module's meta-data specifies it's distributed under the BSD 
+license, which is the closest option to the MIT X11 license.)
 
 =cut