now get non-dual lived code
authorRicardo SIGNES <rjbs@cpan.org>
Tue, 20 Jan 2009 23:32:17 +0000 (18:32 -0500)
committerVincent Pit <vince@profvince.com>
Wed, 21 Jan 2009 15:54:16 +0000 (16:54 +0100)
lib/Benchmark.pm
lib/DirHandle.pm
lib/Dumpvalue.pm
lib/FileHandle.pm
lib/I18N/Collate.pm
lib/SelectSaver.pm
lib/Term/ReadLine.pm
lib/overload.pm

index 7e744a6..19a0343 100644 (file)
@@ -81,9 +81,9 @@ countit - see how many times a chunk of code runs in a given time
 Returns the current time.   Example:
 
     use Benchmark;
-    $t0 = new Benchmark;
+    $t0 = Benchmark->new;
     # ... your code here ...
-    $t1 = new Benchmark;
+    $t1 = Benchmark->new;
     $td = timediff($t1, $t0);
     print "the code took:",timestr($td),"\n";
 
@@ -91,9 +91,9 @@ Returns the current time.   Example:
 
 Enables or disable debugging by setting the C<$Benchmark::Debug> flag:
 
-    debug Benchmark 1;
+    Benchmark->debug(1);
     $t = timeit(10, ' 5 ** $Global ');
-    debug Benchmark 0;
+    Benchmark->debug(0);
 
 =item iters
 
index 0bddec2..757bf4b 100644 (file)
@@ -9,7 +9,7 @@ DirHandle - supply object methods for directory handles
 =head1 SYNOPSIS
 
     use DirHandle;
-    $d = new DirHandle ".";
+    $d = DirHandle->new(".");
     if (defined $d) {
         while (defined($_ = $d->read)) { something($_); }
         $d->rewind;
@@ -46,7 +46,7 @@ use Carp;
 use Symbol;
 
 sub new {
-    @_ >= 1 && @_ <= 2 or croak 'usage: new DirHandle [DIRNAME]';
+    @_ >= 1 && @_ <= 2 or croak 'usage: DirHandle->new( [DIRNAME] )';
     my $class = shift;
     my $dh = gensym;
     if (@_) {
index f182297..d5d93c7 100644 (file)
@@ -488,7 +488,7 @@ Dumpvalue - provides screen dump of Perl data.
 =head1 SYNOPSIS
 
   use Dumpvalue;
-  my $dumper = new Dumpvalue;
+  my $dumper = Dumpvalue->new;
   $dumper->set(globPrint => 1);
   $dumper->dumpValue(\*::);
   $dumper->dumpvars('main');
@@ -500,7 +500,7 @@ Dumpvalue - provides screen dump of Perl data.
 
 A new dumper is created by a call
 
-  $d = new Dumpvalue(option1 => value1, option2 => value2)
+  $d = Dumpvalue->new(option1 => value1, option2 => value2)
 
 Recognized options:
 
index 6be2242..b609614 100644 (file)
@@ -111,25 +111,25 @@ FileHandle - supply object methods for filehandles
 
     use FileHandle;
 
-    $fh = new FileHandle;
+    $fh = FileHandle->new;
     if ($fh->open("< file")) {
         print <$fh>;
         $fh->close;
     }
 
-    $fh = new FileHandle "> FOO";
+    $fh = FileHandle->new("> FOO");
     if (defined $fh) {
         print $fh "bar\n";
         $fh->close;
     }
 
-    $fh = new FileHandle "file", "r";
+    $fh = FileHandle->new("file", "r");
     if (defined $fh) {
         print <$fh>;
         undef $fh;       # automatically closes the file
     }
 
-    $fh = new FileHandle "file", O_WRONLY|O_APPEND;
+    $fh = FileHandle->new("file", O_WRONLY|O_APPEND);
     if (defined $fh) {
         print $fh "corge\n";
         undef $fh;       # automatically closes the file
index 132b425..257390f 100644 (file)
@@ -11,8 +11,8 @@ I18N::Collate - compare 8-bit scalar data according to the current locale
 
     use I18N::Collate;
     setlocale(LC_COLLATE, 'locale-of-your-choice'); 
-    $s1 = new I18N::Collate "scalar_data_1";
-    $s2 = new I18N::Collate "scalar_data_2";
+    $s1 = I18N::Collate->new("scalar_data_1");
+    $s2 = I18N::Collate->new("scalar_data_2");
 
 =head1 DESCRIPTION
 
@@ -81,8 +81,8 @@ European character set.
 #
 # Usage:       use I18N::Collate;
 #              setlocale(LC_COLLATE, 'locale-of-your-choice'); # 4)
-#              $s1 = new I18N::Collate "scalar_data_1";
-#              $s2 = new I18N::Collate "scalar_data_2";
+#              $s1 = I18N::Collate->("scalar_data_1");
+#              $s2 = I18N::Collate->("scalar_data_2");
 #              
 #              now you can compare $s1 and $s2: $s1 le $s2
 #              to extract the data itself, you need to deref: $$s1
index 1207b88..f0900a5 100644 (file)
@@ -11,13 +11,13 @@ SelectSaver - save and restore selected file handle
     use SelectSaver;
 
     {
-       my $saver = new SelectSaver(FILEHANDLE);
+       my $saver = SelectSaver->new(FILEHANDLE);
        # FILEHANDLE is selected
     }
     # previous handle is selected
 
     {
-       my $saver = new SelectSaver;
+       my $saver = SelectSaver->new;
        # new handle may be selected, or not
     }
     # previous handle is selected
@@ -39,7 +39,7 @@ use Carp;
 use Symbol;
 
 sub new {
-    @_ >= 1 && @_ <= 2 or croak 'usage: new SelectSaver [FILEHANDLE]';
+    @_ >= 1 && @_ <= 2 or croak 'usage: SelectSaver->new( [FILEHANDLE] )';
     my $fh = select;
     my $self = bless \$fh, $_[0];
     select qualify($_[1], caller) if @_ > 1;
index c1d1762..d251271 100644 (file)
@@ -6,7 +6,7 @@ If no real package is found, substitutes stubs instead of basic functions.
 =head1 SYNOPSIS
 
   use Term::ReadLine;
-  my $term = new Term::ReadLine 'Simple Perl calc';
+  my $term = Term::ReadLine->new('Simple Perl calc');
   my $prompt = "Enter your arithmetic expression: ";
   my $OUT = $term->OUT || \*STDOUT;
   while ( defined ($_ = $term->readline($prompt)) ) {
@@ -26,7 +26,7 @@ CPAN (under the C<Term::ReadLine::*> namespace).
 
 All the supported functions should be called as methods, i.e., either as 
 
-  $term = new Term::ReadLine 'name';
+  $term = Term::ReadLine->new('name');
 
 or as 
 
index ba0202d..c5ac87a 100644 (file)
@@ -194,7 +194,7 @@ overload - Package for overloading Perl operations
     ...
 
     package main;
-    $a = new SomeThing 57;
+    $a = SomeThing->new( 57 );
     $b=5+$a;
     ...
     if (overload::Overloaded $b) {...}
@@ -902,7 +902,7 @@ If some mutator methods are directly applied to the overloaded values,
 one may need to I<explicitly unlink> other values which references the
 same value:
 
-    $a = new Data 23;
+    $a = Data->new(23);
     ...
     $b = $a;           # $b is "linked" to $a
     ...
@@ -911,13 +911,13 @@ same value:
 
 Note that overloaded access makes this transparent:
 
-    $a = new Data 23;
+    $a = Data->new(23);
     $b = $a;           # $b is "linked" to $a
     $a += 4;           # would unlink $b automagically
 
 However, it would not make
 
-    $a = new Data 23;
+    $a = Data->new(23);
     $a = 4;            # Now $a is a plain 4, not 'Data'
 
 preserve "objectness" of $a.  But Perl I<has> a way to make assignments
@@ -947,7 +947,7 @@ Put this in F<two_face.pm> in your Perl library directory:
 Use it as follows:
 
   require two_face;
-  my $seven = new two_face ("vii", 7);
+  my $seven = two_face->new("vii", 7);
   printf "seven=$seven, seven=%d, eight=%d\n", $seven, $seven+1;
   print "seven contains `i'\n" if $seven =~ /i/;
 
@@ -994,7 +994,7 @@ array reference and a hash reference.
 
 Now one can access an object using both the array and hash syntax:
 
-  my $bar = new two_refs 3,4,5,6;
+  my $bar = two_refs->new(3,4,5,6);
   $bar->[2] = 11;
   $bar->{two} == 11 or die 'bad hash fetch';
 
@@ -1099,15 +1099,15 @@ This module is very unusual as overloaded modules go: it does not
 provide any usual overloaded operators, instead it provides the L<Last
 Resort> operator C<nomethod>.  In this example the corresponding
 subroutine returns an object which encapsulates operations done over
-the objects: C<new symbolic 3> contains C<['n', 3]>, C<2 + new
-symbolic 3> contains C<['+', 2, ['n', 3]]>.
+the objects: C<< symbolic->new(3) >> contains C<['n', 3]>, C<< 2 +
+symbolic->new(3) >> contains C<['+', 2, ['n', 3]]>.
 
 Here is an example of the script which "calculates" the side of
 circumscribed octagon using the above package:
 
   require symbolic;
   my $iter = 1;                        # 2**($iter+2) = 8
-  my $side = new symbolic 1;
+  my $side = symbolic->new(1);
   my $cnt = $iter;
 
   while ($cnt--) {
@@ -1231,8 +1231,8 @@ explicit recursion in num()?  (Answer is at the end of this section.)
 Use this module like this:
 
   require symbolic;
-  my $iter = new symbolic 2;   # 16-gon
-  my $side = new symbolic 1;
+  my $iter = symbolic->new(2); # 16-gon
+  my $side = symbolic->new(1);
   my $cnt = $iter;
 
   while ($cnt) {
@@ -1352,8 +1352,8 @@ To see it in action, add a method
 
 to the package C<symbolic>.  After this change one can do
 
-  my $a = new symbolic 3;
-  my $b = new symbolic 4;
+  my $a = symbolic->new(3);
+  my $b = symbolic->new(4);
   my $c = sqrt($a**2 + $b**2);
 
 and the numeric value of $c becomes 5.  However, after calling