Commit Graph

21 Commits

Author SHA1 Message Date
Thomas von Dein
78d7f3d6f9 added ::getbypath() which allows to fetch subhashes by specifying
a path (just like xpath)


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@88 be1acefe-a474-0410-9a34-9b3221f2030f
2010-08-25 13:23:58 +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
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
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
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
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
577e668192 2.23
- still versioning problem, stupid white man ;-)
	   Extended.pm is now 2.00 which *is* higher than 1.10.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@49 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:29:15 +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
8167848582 2.20
- fixed bug reported by Stefano di Sandro <stedis@ulis.it>: in
 	   OOP mode (extended access) the obj() method returned the whole
	   config object if the given key does not exist. Now it returns
	   a new empty object.

	 - added patch by David Dick <david_dick@iprimus.com.au> which
	   sets $/ if it is unset.

	 - added patch by David Dick <david_dick@iprimus.com.au> which
	   calls the binmode() function in case the modules is being
	   used under win32 systems. Read perldoc -f binmode for more
	   informations on this issue.

	 - added feature suggested by Chase Phillips <cmp@uiuc.edu>:
	   the new() method has a new parameter -Tie which takes the
	   name of a Tie class that each new hash should be based off
	   of. This makes it possible to create a config hash with
	   ordered contents across nested structures.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@46 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:28:06 +00:00
Thomas von Dein
f25e2cfb1e 2.09 - added bugfix in '#' comment parsing. If current state
was within a block, then /^   #/ was not ignored as
	   comment but instead added as variable. Reported by
	   Lupe Christoph <lupe@lupe-christoph.de>

	 - added -StrictObjects parameter support in the following
	   ::Extended methods: hash() and value().

	 - added better parameter checks in the ::Extended::obj()
	   method. Its now no more possible to create a new (sub-)
	   object from an undefined key or a key which does not
	   point to a hash reference.

	 - simplified storing of ConfigFile and ConfigHash in new()
	   removed my variable $configfile.

	 - the original parameter list will now be saved, which is
	   required for ::Extended to create new objects with the
	   same config as their parents.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@35 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:24:24 +00:00
Thomas von Dein
41b311f7a0 2.07 - fixed cpan bugid #1351, SaveConfig contained a deprecated
function call which caused the module to croak.
         - added feature request, if in extended mode (OOP turned
           on with -ExtendedAccess => 1 access to non-existent keys	
           caused a croak. While this is still the default behavior
           it is now possible to turn this off using -StrictObjects => 0.
         - added this to the related pod section in ::Extended.
         - fixed bug in new() which caused a couple of errors
           if the ConfigFile parameter is not set, or is set to
           undef. In this case it will now simply create an empty
           object.
         - fixed related bug in save_file() which will save "" to
           a file now if the config is uninitialized (i.e. the case
           mentioned below arrived).


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@33 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:23:39 +00:00
Thomas von Dein
ffe3d8a79b 2.05 - fixed bug in ::Extended. It exported for some weird
reason I cant remember all of its methods. This included
	   keys() exists() and delete(), which are perl internals.
	   If one used keys() on a normal hash, then the ::Extended
	   own keys() were used instead of perls own one. I removed
	   the export line.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@31 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:22:44 +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
c3eced799c 1.36 - simplified new() parameter parsing, should be now a little
bit better to understand.

	 - added new parameter -DefaultConfig, which can hold a hashref
	   or a string, which will be used to pre-define values
	   of the resulting hash after parsing a config.
	   Thanks to Mark Hampton <mark.hampton@qualis.com> for the
	   suggestion.

	 - added new parameter -MergeDuplicateOptions, which allows
	   one to overwrite duplicate options, which is required,
	   if you turn on -DefaultConfig, because otherwise a
 	   array would be created, which is probably not what you
	   wanted.

	 - added patch by Danial Pearce <danial@infoxchange.net.au>
	   to Config::General::Extended::keys(), which allows to
	   retrieve the keys of the object itself (which was not
	   directly possible before)

	 - added patch by Danial Pearce <danial@infoxchange.net.au>
	   to Config::General::Extended::value(), which allows to
	   set a value to a (perlish-) nontrue value. This was a
	   bug.

	 - added patch by Danial Pearce <danial@infoxchange.net.au>
	   to Config::General::_parse_value, which fixes a bug in
	   this method, which in prior versions caused values of
	   "0" (zero digit) to be wiped out of the config.

	 - added tests in t/run.t for the new default config feature.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@25 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:19:00 +00:00
Thomas von Dein
31144f9e4f 1.34 - Danial Pearce <danial@infoxchange.net.au> reported a bug
in _store(), which caused the module to create scalar
	   entries even if the entry contained newlines. While
	   Danial supplied a patch to fix this - thx(TM) - I
	   did not apply it, because I "outsourced" this kind of
	   stuff to the subroutine _write_scalar(), see next.

         - added internal methods _write_scalar() and _write_hash()
	   to simplify _store(), which did the same thing more
	   than once, which is a good time to create a sub which
	   does the job.

         - fixed cut'n paste bug in General/Extended.pm reported by
	   Danial Pearce <danial@infoxchange.net.au>, which caused
	   Config::General::Extended::is_scalar() to return true even
	   when the key you pass in is an array.

         - added new method Config::General::Extended::delete() suggested
	   by Danial Pearce <danial@infoxchange.net.au>, which deletes
	   the given key from the config.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@23 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:18:02 +00:00
Thomas von Dein
f9c0a5a8f3 1.32 - *argl* ... I forgot Interpolated.pm, don't know how that
could happen, in 1.29 it was "lost". However - 
	   I added it again now.
	 - added patch by Peder Stray <peder@linpro.no> to
	   the _store() method, which makes it possible to catch
	   arrays of hashes to be stored correctly.
	 - cleaned up the t/run.t testscript to reflect the
	   changes (in fact I did not touch it since 1.18 or so).
	 - added test number 16 to test variable interpolation
	   using ::Interpolated in t/run.t.
	 - fixed bug with new() parameter -AllowMultiOptions which
	   generated a croak() if set to something other than "no".
	 - changed Extended::save() to reflect the API change,
	   it calls now save_file(). 


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@21 be1acefe-a474-0410-9a34-9b3221f2030f
2009-10-10 16:17:24 +00:00
Thomas von Dein
95195c0038 i 1.24: - AllowMultiOptions printed out the value and not the
option itself, if more than one of this particular
           option occured.
         - added -UseApacheInclude feature, contributed by
           Thomas Klausner <domm@zsi.at>
         - fixed bug with multiple options stuff, which did not
           work with blocks or named blocks. Pointed out by
           Thomas Klausner <domm@zsi.at>, who meant it being
           feature request, but in fact it was a bug (IMHO).
	 - Config::General does now contain also it's OO-sister
	   Config::General::Extended, which is from now on
 	   no more available as an extra module, because it
	   lived a shadowy existence.
	 - finally(!) created a Changelog file (this one, yes).


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