Commit Graph

27 Commits

Author SHA1 Message Date
Todd R
643107150c RT 58262 - fix warning messages from perl 5.12
git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@90 be1acefe-a474-0410-9a34-9b3221f2030f
2010-10-15 19:04:46 +00:00
Thomas von Dein
05d182b37a fixed spelling error ("artificial license" => "artistic license"), added more info to META.yml
git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@79 be1acefe-a474-0410-9a34-9b3221f2030f
2010-04-09 09:07:16 +00:00
Thomas von Dein
045aed9c39 Splat with 2.45
git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@74 be1acefe-a474-0410-9a34-9b3221f2030f
2010-04-08 15:47:22 +00:00
Thomas von Dein
d004e91c54 fixed rt.cpan.org#50329, don't try to interpolate on undefined values.
git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@71 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-19 15:34:31 +00:00
Thomas von Dein
db567b0713 2.43
- fixed rt.cpan.org#40925, $indichar replaced by internal
	  configuration variable EOFseparator, which contains
	  a 256 bit SHA checksum of the date I fixed the bug.
	  This will prevent future conflicts hopefully. In addition
	  it makes it possible to make it customizable, if neccessary,
	  in a future release.

	- fixed rt.cpan.org#42721, return undef for empty values

	- fixed rt.cpan.org#42331, return undef for empty objects

	- fixed rt.cpan.org#44600, comments after blockname
	  causes parser failure.

	- fixed rt.cpan.org#42287, whitespace at beginning or end
	  of a quoted value gets lost after save().

	- fixed rt.cpan.org#46184, variables that were not previously
	  defined are deleted when -InterPolateEnv is enabled. 

	- fixed bug in config loader for FileHandle objects, it
	  supports now any compatible object. Hint by Ingo Schmiegel.

	- applied spelling- and speedup patches by Ville Skyttä.

	- applied documentation patch by Jordan Macdonald.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@69 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:46:35 +00:00
Thomas von Dein
e2819aa525 2.41
- fixed rt.cpan.org#38635. apache-like include now supports
	  quoted strings.

        - fixed rt.cpan.org#41748. saving config with -tie enabled
	  now keeps the tie as documented.

	- added unit test for -tie. For this to work, a copy of
	  Tie::LxHash module is delivered with Config::General
	  source, but will not installed, in fact, it is only
	  used for 'make test' (number 50)

	- fixed rt.cpan.org#39159. documentation of functional interface
          now reflects that qw$method) is now required.

	- applied patch by AlexK fixing rt.cpan.org#41030:
	  if files are included by means of a glob pattern having the -IncludeGlob
	  option activated, paths specified by the -ConfigPath option are being
	  neglected when trying to spot the files. This patch fixes this

	- applied patch by fbicknel, fixes rt.cpan.org#41570: 
	  An array of scalars (eg: option = [1,2,3]) cannot
	  be used for interpolation (which element shall we use?!), so
	  we ignore those types of lists and don't build a __stack for them.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@67 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:45:27 +00:00
Thomas von Dein
5f92f52e0a 2.39
- fixed rt.cpan.org#35122. This one was one of the most
	  intriguing bugs I've ever observed in my own code. The
	  internal temporary __stack hashref were copied from one
	  subhash to another to enable inheritance of variables.
	  However, the hashes were copied by reference, so once a
	  value changed later, that value were overwritten because
	  the __stack in question were just a reference. I introduced
	  a simple function _copy() which copies the contents of
	  the __stack by value, which solved the bug.
	  Conclusion: beware of perl hash refs!

	- fixed rt.cpan.org#36607, accept whitespaces in heredoc
	  names if split delimiter is gues (equalsign or whitespace)

	- fixed rt.cpan.org#34080 (typo)

	- fixed rt.cpan.org#35766. Variables inside single quoted
	  strings will no more interpolated (as the docu states).
	  Also added test case for this.

	- fixed bug rt.cpan.org#33766. Checking for defined not true
	  in ::Extended::AUTOLOAD().

	- added -UTF8 flag, which opens files in utf8 mode
	  (suggested by KAORU, rt.cpan.org#35583)
	  I decided not to add a test case for this, since perls
	  utf8 support is not stable with all versions.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@65 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:43:54 +00:00
Thomas von Dein
61397677d3 2.38
- fixed rt.cpan.org#31529 variable inheritance failed
	  with multiple named blocks.

	- fixed rt.cpan.org#33447, regex to catch variable
	  names were too strict, now - . + or : are allowed too.

	- fixed rt.cpan.org#33385 and #32978 - using arrayrefs
	  as param to -String didn't work anymore (sic)

	- fixed rt.cpan.org#33216 - variable stack were not properly
	  re-constructed for pre-existing variables if 
	  -MergeDuplicateOptions is turned on.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@64 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:43:18 +00:00
Thomas von Dein
f85e18462c 2.37
- "fixed" rt.cpan.org#30199 - check for invalid and
	  unsupported structures, especially mixing blocks
	  and scalars with identical names.

	- added checks to 'make test' to test for the above
	  checks.

	- revoked patch of rt.cpan.org#27225, it broke running
	  code.

	- fixed rt.cpan.org#30063 (and #27225!) by reimplementing
	  the whole interpolation code. The internal stack is
	  no more a class variable of the module but stored
	  directly within the generated config hash and cleaned
	  before returning to the user.

	- added (modified) patch rt.cpan.org#30063 to check
	  if interpolation works with supplied default config
	  works.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@63 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:42:58 +00:00
Thomas von Dein
a644abce36 2.33
- fixed rt.cpan.org#26333 - just return $con if env var
	  is undefined.

	- applied part of a patch supplied by Vincent Rivellino <vince@cuz.cx>
	  which turns off explicit empty block support if in
	  apache compatibility mode, see next.

	- added new option -ApacheCompatible, which makes the
	  module behave really apache compatible by setting the
	  required options.

	- a little bit re-organized the code, most of the stuff
	  in new() is now outsourced into several extra subs to
	  make maintenance of the code easier. The old new() sub
	  in fact was a nightmare.

	- fixed a bug reported by Otto Hirr <otto.hirr@olabinc.com>:
	  the _store() sub used sort() to sort the keys, which conflicts
	  with sorted hashes (eg. tied using Tie::IxHash).

	- fixed tie bug reported by King, Jason <kingj@newsltd.com.au>,
	  loading of the tie module didn't work.



git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@59 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:39:07 +00:00
Thomas von Dein
72fdf51f16 2.32
- fixed rt.cpan.org#24232 - import ENV vars only if defined

	- fixed rt.cpan.org#20742 - dont' overwrite a var if re-defined
	  in current scope, interpolation failed for re-defined vars and used
	  the value of the var defined in outer scope, not the current one.

	- fixed rt.cpan.org#17852 - a 0 as blockname were ignored. applied
	  patch by SCOP to t/run.t to test for 0 in blocks.

	- applied most hints Perl::Critic had about Config::General:
	  o the functions ParseConfig SaveConfig SaveConfigString must
	    now imported implicitly. This might break existing code, but
	    is easily to fix.
	  o using IO::File instead of open().
	  o General.pm qualifies for "stern" level after all.

	- added much more tests to t/run.t for 'make test'.

	- using Test::More now.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@58 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:38:28 +00:00
Thomas von Dein
80bcb7ddae 2.31
- applied patches by Jason Rhinelander <jagerman@jagerman.com>:
	  	o bugfix: multiple levels if include files didn't
		  work properly.

		o new option -IncludeDirectories, which allows
		  to include all files of a directory. The directory
		  must be specified by -ConfigFile as usual.

		o new option -IncludeGlob, which allows to
		  use globs (wildcards) to include multiple files.

		o -ConfigPath can be speciefied using a single
		  scalar value instead of an array if there is only
		  one path.

		o bugfix: quotes from quoted block names were
		  not removed properly.

		o fixes and updates for tests (make test) for
		  the above patches.
	   
	   Thanks a lot Jason.

	 - fixed number of tests in run.t

	 - applied suggestion by Eric Kisiel <eric.kisiel@adelphia.com>:
	   ::Extended::keys() returns an empty hash if the
	   referring object is not hash.

	 - fixed bug #14770, "Use of uninitialized value.." during
	   environment variable interpolation.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@57 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:36:29 +00:00
Thomas von Dein
57244f6eea 2.30
- applied patch by Branislav Zahradnik
	   <brano@blueorange.sk> which adds -InterPolateEnv.
	   This allows to use environment variables too. It
	   implies -InterPolateVars.

	 - added object list capability for the ::Extended::obj()
	   method. If a certain key points to an array of
	   hashrefs, then the whole arrayref is returned.
	   Suggested by Alan Hodgkinson <alan@softxs.ch>.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@56 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:35:18 +00:00
Thomas von Dein
ef504ee7f4 2.29
- applied patch by brian@kronos.com via rt.cpan.org
	   #11211.
	
	 - applied patch by plasmaball@pchome.com.tw via
	   rt.cpan.org #5846

	 - added new files to MANIFEST file.

 	 - added example.cfg to show the config format.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@55 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:32:11 +00:00
Thomas von Dein
c0eafd9b8f 2.28
- fixed bug in save(), now blocks containing whitespaces
	   will be saved using quotes, in addition the parser observes
	   the quoting feature, added portion about this to the pod
	   doc. pointed out by Jeff Murphy <jcmurphy@jeffmurphy.org>.

	 - added internal list of files opened so far to avoid
	   reading in the same file multiple times.
	   Suggested by Michael Graham.

	 - added new method files() which returns the above list.

	 - added workaround for foolish perl installation on
	   debian systems (croak() doesn't work anymore as of
	   5.8.4, it's a shame!)

	 - applied patch by Michael Graham which fixes IncludeRelative
	   feature, now an included file is being included relative
	   to the calling config file, not the first one.

	 - added 'make test' targets for files() and include
	   stuff. (by Michael too)


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@54 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:31:34 +00:00
Thomas von Dein
8f517dd929 2.25
- fixed bug with not working -IncludeRelative setting when
	   including a config file. It were only included from the
	   location relative to the underlying config if it were
	   non-existent. reported by Dmitry Koteroff <dmitry@koteroff.ru>.

	 - applied patch by Danial Pearce <danial@infoxchange.net.au>
	   which adds the -BackslashEscape parameter to enable
	   general escaping of special characters using the 
	   backslash.

	 - fixed bug reported by Harold van Oostrom <cpan@lanceerplaats.nl>:
	   according to the documentation one can call new() with
	   a hash-ref as its single parameter which would then
	   used as the config. This didn't work and were fixed.

	 - added feature suggested by Eric Andreychek <eric@openthought.net>:
	   now block statements like this are allowed: "<directory blah/>"
	   which is called an explicit empty block. This generates just
	   an empty hash-ref and saves writing. In fact, internally it
	   will be converted to:
	      <directory blah>
	      </directory>

	 - fixed Makefile.PL: it cleans now files generated by 'make test'
	   properly. reported by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

	 - updated MANIFEST (in fact I did this some years ago the last time!)
	   also reported by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@51 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:30:01 +00:00
Thomas von Dein
2a0006a8d8 2.24
- fixed Bug #3869 (rt.cpan.org) reported by
	   "Mike Depot" <mdepot@comcast.net>

	 - applied patch by Roland Huss <Roland.Huss@consol.de>,
	   which fixes a bug with the -Tie option, sub-hashes of
	   named blocks were not properly created (in fact, not
	   tied).

	 - added documentation to Interpolated.pm that it does not
	   interpolate variables in keys, see bug #3773 (rt.cpan.org).


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@50 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:29:34 +00:00
Thomas von Dein
86933eefad 2.22
- incremented all version numbers because of cpan problem.
	   no further changes. See Bug #3347 (rt.cpan.org).


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@48 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:28:54 +00:00
Thomas von Dein
4575d2a052 2.16
- applied patch by Michael Gray <mjg17@eng.cam.ac.uk> which
	   fixes a bug in the Interpolate.pm submodule. A second variable,
	   when immediately following the first, did not get interpolated,
	   i.e. ${var1}${var2}.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@42 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:26:58 +00:00
Thomas von Dein
5e99e1f8b2 2.15 - fixed Bug in SaveConfig***, which didn't work.
- applied patch by Robb Canfield <robb@canfield.com>,
	   which fixes a bug in the variable interpolation
	   scheme. It did not interpolate blocks nor
	   blocknames. This patch fixes this. Patch slightly
	   modified by me(interpolation on block and blocknames).
	 - enhanced test for variable interpolation to
	   reflect this.
	 - added check if a named block occurs after the underlying
	   block is already an array, which is not possible.
	   perl cannot add a hashref to an array. i.e.:
	   <bl>
 	     a = 1
	   </bl>
	   <bl>
 	     b = 1
	   </bl>
	   <bl blubber>
 	     c = 1
	   </bl>
	   As you can see, "<bl>" will be an array, and "blubber"
	   cannot be stored in any way on this array.
	   The module croaks now if such construct occurs.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@41 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:26:40 +00:00
Thomas von Dein
39d25e3738 2.12 - fixed cpan bugid #1768, stuff inside a hash given
by the -DefaultConfig parameter was ignored by
	   the new interpolation code, this has been fixed.

	 - fixed another bug in the new interpolation code,
	   which made variable global, the variable scope
	   were ignored. Now a special constructed hash
	   exists, which makes sure, that variables only
	   valid within its correct scope.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@38 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:25:41 +00:00
Thomas von Dein
c5e268e9f6 2.11 - heavy change in the variable interpolation code.
Peter Sergeant <pete@clueball.com> reported this
	   mis-behavior. The problem was that the whole hash
	   was feeded to ::Interpolated.pm, but as we all
	   know, perl hashes doesn't preserve the order. So,
	   in our case the module sometimes was unable to
	   resolve variablenames, because they were stored
	   in a different location as it occured in the config.
	   The change is, that Config::General now calls
	   ::Interpolate.pm (new sub: _interpolate()) itself
	   directly on a per-key/value pair basis. The internal
	   varstack is now stored on $this globally. So, now
	   a variable will be known when it occurs. period :-


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@37 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:25:20 +00:00
Thomas von Dein
e3ca417573 2.08 - added option -StrictVars, which causes Interpolate.pm to
ignore undefined variables and replaces such occurences
	   with the emppty string.

	 - applied patch by Stefan Moser <sm@open.ch>, which fixes
	   some weird bevavior if -MergeDuplicateOptions was turned
	   on, the parser croaked regardless -MergeDuplicateBlocks
	   was set or not. Now the two options behave almost independent
	   from each other, which allows one to merge duplicate
	   blocks but duplicate options not.

	 - changed behavior of setting -MergeDuplicateOptions which
	   implied in previous versions -AllowMultiOptions to be
	   false. Now this will only be done if the user does not
	   set -AllowMultiOptions by himself. This allows one to
	   have duplicate blocks which will be turned into an
	   array but duplicate options to be merged.

	 - applied patch by Matthias Pitzl <matthias@izb.net>, which	
	   fixes a bug at parsing apache-like include directive
	   (Include ...). It did not properly trim unnecessary whitespaces
	   so that the filename to be included became invalid. This
	   bug espessially occurred if one saved a hash containing
	   a key/value pair like this: "Include" => "/etc/grs.cfg",
	   which was then saved as "Include   /etc/grs.cfg", the
	   parser returned "  /etc/grs.cfg" which, of course, does
	   not exists. odd...


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@34 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:24:01 +00:00
Thomas von Dein
ee04074296 2.04 - added RFE from rt.cpan.org (ID: 1218). the ::Interpolate
module populates now uses of uninitialized variables in
	   config files itself instead of just letting perl die().
	   The other suggestion of the RFE was declined.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@30 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:22:27 +00:00
Thomas von Dein
8a7ed54c44 2.02 - added patch by Jens Heunemann, which allows to use
whitespaces in option names.

         - changed the save() calls in the test script (t/run.t)
           to save_file()

	 - removed new() from ::Interpolated and ::Extended.
	   This may break existing code (they will need to
	   move to the flags of Config::General::new() ), but
	   this decision must be made. The problem was that
	   both the old way of directly using the subclasses
	   and the enw way did not work together. So, now
	   subclasses are only method holders and used by
	   Config::General on request. Direct use of subclasses
	   is prohibited. (you receive a warning if you do).


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@28 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:21:31 +00:00
Thomas von Dein
76502a240e i 2.00 - fixed a bug in the ::Extended::keys() method, which
caused a beloved "use of uninitialized ..." message.
	   Reported by Danial Pearce <danial@infoxchange.net.au>.

         - Removed all deprecated methods (in fact, they are still
	   there for shouting out a warn that its deprecated. But
	   the pod sections are removed. These are NoMultiOptions()
	   and save().

	 - added two new parameters to new(): -InterPolateVars and
	   -ExtendedAccess, which allows one to use the functionalites
	   of the supplied submodules without the need to decide
	   for one of them. This makes it possible to use variable
	   interpolation and oop access in the same time. Suggested
	   by Jared Rhine <jared@wordzoo.com>.

	 - added new parameter -BaseHash which makes it possible
	   to supply your own hash which stores the parsed contents
	   of the config. This can be a tied hash o the like.
	   Suggested by Jared Rhine <jared@wordzoo.com> too.

	 - switched to release 2.00 because the above is a major
	   change.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@26 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:20:14 +00:00
Thomas von Dein
b906f49050 1.28:
- added contributed sub module Config::General::Interpolated
	   by "Wei-Hon Chen" <plasmaball@pchome.com.tw> with
	   help from "Autrijus Tang" <autrijus@autrijus.org>
	   which makes it possible to use variables inside
	   config files.
	 - _read() accepts now c-comments inside c-comments if
	   they are on a single line.
	 - _read() is now more tolerant to here-identifiers
	   (the ends of here-docs), whitespaces right after
	   such an identifier are allowed (i.e. "EOF  ").
	 - _read() does now behave somewhat different with
	   C-comments, they will be the first thing being
	   processed in a config, so the parser really
	   ignores everything inside C-comments. Previously
	   it did not do that, for example here-docs has
	   not been ignored.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@16 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:14:18 +00:00