1. Fabrice Gabolde
  2. Floop


Fabrice Gabolde  committed f52743d

Document get_with_default in Configuration.

  • Participants
  • Parent commits e6d3472
  • Branches default

Comments (0)

Files changed (1)

File lib/Floop/Configuration.pm

View file
 Returns a value for the given key.  If the key does not exist in the
 current configuration, an exception is thrown instead.
+=head2 get_with_default
+  my $value = $configuration->get('key', {});
+Like C<get>, but returns the default value provided instead of
+throwing an exception when the key does not exist.  This is merely a
+helper to allow you to quickly do things like
+  $configuration->get_with_default('stuff', {})->{things}
+It does not set the value in the configuration.  Please note that this
+is not the best way to set default values; usage of this method in
+Floop itself is considered a bug.
 =head2 set
   $configuration->set('key', $value);