Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

CAVEATS and SEE ALSO

  • Loading branch information...
commit 574fd2e187f411974019536aee529aa7b2336969 1 parent 56ea229
Breno G. de Oliveira authored

Showing 1 changed file with 27 additions and 1 deletion. Show diff stats Hide diff stats

  1. 28  lib/Sub/Frequency.pm
28  lib/Sub/Frequency.pm
@@ -15,7 +15,7 @@ our @EXPORT = qw(
15 15
 
16 16
 our @EXPORT_OK = @EXPORT;
17 17
 
18  
-our $VERSION = '0.04';
  18
+our $VERSION = '0.05';
19 19
 
20 20
 my %probabilities = (
21 21
     'Sub::Frequency::Always'    => 1.00,
@@ -251,6 +251,32 @@ or a percentage. Like:
251 251
 In the code above, you should replace 'monkey' with a number
252 252
 between 0 and 1, or a percentage string (such as '15%').
253 253
 
  254
+=head1 CAVEATS
  255
+
  256
+* calling C<return()> will return from the block itself, not from the
  257
+parent C<sub>. For example, the code below will likely B<NOT> do what
  258
+you want:
  259
+
  260
+  sub foo {
  261
+    sometimes { return 1 }; # WRONG! Don't do this
  262
+    return 2;
  263
+  }
  264
+
  265
+To get the desired behavior, you can either play with modules such as
  266
+L<Scope::Upper> or do something like this:
  267
+
  268
+  sub foo {
  269
+     my $value = 2;
  270
+     sometimes { $value = 1 };
  271
+     return $value;
  272
+  }
  273
+
  274
+=head1 SEE ALSO
  275
+
  276
+L<Sub::Rate>
  277
+
  278
+L<Sub::Retry>
  279
+
254 280
 
255 281
 =head1 AUTHORS
256 282
 

0 notes on commit 574fd2e

Please sign in to comment.
Something went wrong with that request. Please try again.