Advanced-Config

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  - Fixed t/t/09-basic_date.t to explicitly allow 2-year dates in it's
    tests as well.
  - Added option date_dl_conversion to allow the use of Date:Language:str2time()
    to optionally enhance parse_date().
  - Fixed bug in the dynamic DBUG/DBUG::OFF module selection in all module BEGIN
    blocks.
  Never uploaded to CPAN.

1.02 2019-01-08 08:30:00
  - Corrected some significant errors in the POD text.
  - Added some usage errors in move_tag, rename_tag, and delete_tag.
  - Merged rule 5 & 6 tests in lookup_one_variable().  But left
    separate in POD.
  - Added toHash() method to convert object into a hash.
  - Fixed sensitive bug in Options.pm.
  - Now uses DBUG's built in argument masking method instead of hacking the
    code to enforce masking.  Enables us to put the arguments in a more sane
    order in the future and eliminated convoluted code for masking what wasn't
    needed for module functionality.
  - Updated min version of DBUG allowed in Makefile.PL so previous fix works!
    (version: 1.03)

Config.pm  view on Meta::CPAN


   unless ( $worked ) {
      warn ("You may not use \"${tag}\" as your tag name!\n");
   }

   DBUG_RETURN ($worked);
}

#######################################

=item $bool = $cfg->rename_tag ( $old_tag, $new_tag );

Renames the tag found in the current section to it's new name.  If the
I<$new_tag> already exists it is overwritting by I<$old_tag>.  If I<$old_tag>
doesn't exist the rename fails.

Returns B<1> on success, B<0> on failure.

=cut

sub rename_tag
{
   DBUG_ENTER_FUNC (@_);
   my $self    = shift;
   my $old_tag = shift;
   my $new_tag = shift;

   unless ( defined $old_tag && defined $new_tag ) {
      warn ("All arguments to rename_tag() are required!\n");
      return DBUG_RETURN (0);
   }

   if ( $new_tag =~ m/^shft3+$/i ) {
      warn ("You may not use \"${new_tag}\" as your new tag name!\n");
      return DBUG_RETURN (0);
   }

   # Get the main/parent section to work against!
   my $pcfg = $self->{PARENT} || $self;

Config.pm  view on Meta::CPAN

   if ( $pcfg->{CONTROL}->{read_opts}->{tag_case} ) {
      $old_tag = lc ($old_tag)  if ( $old_tag );
      $new_tag = lc ($new_tag)  if ( $new_tag );
   }

   if ( $old_tag eq $new_tag ) {
      warn ("The new tag name must be different from the old tag name!\n");
      return DBUG_RETURN (0);
   }

   # Was there something to rename ???
   if ( exists $self->{DATA}->{$old_tag} ) {
      $self->{DATA}->{$new_tag} = $self->{DATA}->{$old_tag};
      delete ( $self->{DATA}->{$old_tag} );
      return DBUG_RETURN (1);
   }

   DBUG_RETURN (0);
}

#######################################

LICENSE  view on Meta::CPAN

changed that file, and provided that you do at least ONE of the following:

  a) place your modifications in the Public Domain or otherwise make them
     Freely Available, such as by posting said modifications to Usenet or an
     equivalent medium, or placing the modifications on a major archive site
     such as ftp.uu.net, or by allowing the Copyright Holder to include your
     modifications in the Standard Version of the Package.

  b) use the modified Package only within your corporation or organization.

  c) rename any non-standard executables so the names do not conflict with
     standard executables, which must also be provided, and provide a separate
     manual page for each non-standard executable that clearly documents how it
     differs from the Standard Version.

  d) make other distribution arrangements with the Copyright Holder.

4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:

  a) distribute a Standard Version of the executables and library files,

lib/Advanced/Config/Options.pm  view on Meta::CPAN

for B<alias>, B<pass_phrase> and B<encrypt_by_user> are not inherited.  But the
remaining options are.  See option B<source_cb> if you need to set them in this
caes.

=over 4

B<alias> - Defaults to the empty string.  (Meaning no alias provided.)  This
option is used to override using the file's I<basename> as one of the
encrytion/decryption keys with the I<basename> of the value you provide here.

If you encrypt a file with no I<alias>, and then rename the config file, you
must set the I<alias> to the original filename to be able to decrypt anything.
If you encrypt a file with an I<alias>, you must use the same I<alias> to
decrypt things again.

If your config file is a symbolic link to another name, it will auto set this
option for you using the file's real name as the alias if you don't override
it by setting the alias yourself.

B<pass_phrase> - Defaults to the empty string.  If you used a pass phrase to
encrypt the value, then you need to use the same pass phrase again when

t/30-alt_symbols_cfg.t  view on Meta::CPAN

   };
   if ( $@ ) {
      unless (defined $iCfg) {
         dbug_isa_ok ($iCfg, 'Advanced::Config');
      }
      dbug_ok (0, "Advanced::Config object has been loaded into memory!");
      DBUG_LEAVE (3);
   }

   if ( $space_sep ) {
      DBUG_PRINT ("SPECIAL CASE", "Need to rename all tags with '=' in their names!");
      fix_space_sep_issue ( $iCfg );
   }

   DBUG_RETURN ( $iCfg );
}

# ====================================================================
# This function is a hack!!!
# There must normally never be an "=" in a tag's name for this to work!
# ====================================================================

t/30-alt_symbols_cfg.t  view on Meta::CPAN

sub fix_space_sep_issue
{
   DBUG_ENTER_FUNC (@_);
   my $cfg = shift;    # The config file to fix ...

   foreach my $name ( $cfg->find_sections () ) {
      my $s = $cfg->get_section ($name);
      foreach my $t ( $s->find_tags ("=") ) {
         my $new = $t;
         $new =~ s/=/ /g;
         $s->rename_tag ($t, $new);
      }
   }

   DBUG_VOID_RETURN ();
}

# ====================================================================
# Simulates the normal initialize_config () call ...
# By merging in the expected files ...



( run in 0.495 second using v1.01-cache-2.11-cpan-131fc08a04b )