Re: [Catalyst] Hair-pulling over YAML config

2007-01-31 Thread Chisel Wright
On Tue, Jan 30, 2007 at 12:11:22PM -0600, Jonathan Rockway wrote:
  To be read from the unparsable/invalild config file? ;-)
 
 If the config file was parsed OK there's no need to report errors.
 Because there weren't any.


/me heads off to drop a cat with a buttered slice of toast tied to its
back ...

-- 
Chisel Wright
e: [EMAIL PROTECTED]
w: http://www.herlpacker.co.uk/

  Always move fast - you never know who's catching up!

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-31 Thread David Morel


Le 30 janv. 07 à 19:11, Jonathan Rockway a écrit :




Chisel Wright wrote:

On Tue, Jan 30, 2007 at 09:58:00AM -, Carl Vincent wrote:

That's exactly what we need - outputting warnings at on of the
ConfigLoader levels loses the content of the error message. Could
always add a Keep Quiet option...


To be read from the unparsable/invalild config file? ;-)


If the config file was parsed OK there's no need to report errors.
Because there weren't any.


I guess what he meant was : where do you put the options for config  
file parsing other than in the global config file (which won't be  
parsed since it has errors). Only half-joking, so he was :)


David Morel





PGP.sig
Description: Ceci est une signature électronique PGP
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-31 Thread leonard . a . jaffe
On Wednesday 01/31/2007 04:42 AM, Chisel Wright wrote:
 /me heads off to drop a cat with a buttered slice of toast tied to its 
back ...

Feet. Buttered toast tied to its feet.
l.

-- 
Leonard A. Jaffe 


-
This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law.  If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED.  Although this transmission and
any attachments are believed to be free of any virus or other
defect that might affect any computer system into which it is
received and opened, it is the responsibility of the recipient to
ensure that it is virus free and no responsibility is accepted by
JPMorgan Chase  Co., its subsidiaries and affiliates, as
applicable, for any loss or damage arising in any way from its use.
If you received this transmission in error, please immediately
contact the sender and destroy the material in its entirety,
whether in electronic or hard copy format. Thank you.
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-31 Thread Matt S Trout


On 31 Jan 2007, at 14:49, [EMAIL PROTECTED] wrote:



On Wednesday 01/31/2007 04:42 AM, Chisel Wright wrote:
 /me heads off to drop a cat with a buttered slice of toast tied  
to its back ...


Feet. Buttered toast tied to its feet.


Depends which way up the toast is.

--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-31 Thread Jonathan Rockway
Chisel Wright wrote:
 /me heads off to drop a cat with a buttered slice of toast tied to its
 back ...

I tried this this morning.  The cat won.

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-30 Thread Jonathan Rockway


Chisel Wright wrote:
 On Tue, Jan 30, 2007 at 09:58:00AM -, Carl Vincent wrote:
 That's exactly what we need - outputting warnings at on of the
 ConfigLoader levels loses the content of the error message. Could
 always add a Keep Quiet option...
 
 To be read from the unparsable/invalild config file? ;-)

If the config file was parsed OK there's no need to report errors.
Because there weren't any.

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Hair-pulling over YAML config

2007-01-29 Thread Carl Vincent
Hi everyone,

I've just spent an inordinate amount of time debugging a problem which
was actually caused by my Yaml config file not parsing properly.
Catalyst isn't helping much - all it does is skip out the line of debug
that says [debug] Loaded Config ... and that's easy to overlook.

I discovered that when the file is loaded in Config::Any, if there's an
error with the parsing it just skips it and doesn't bother to alert
anyone.

Is there a smart way to test for your config file failing to parse? 

I've patched my Config::Any (attached below) so it throws a warning. Not
sure if this would cause problems if it was included in the distributed
module...

Cheers

Carl

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Carl Vincent http://www.netskills.ac.uk/ (URL)
 Systems Manager   0191 222 5003 (voice)
 Netskills, Newcastle University   0191 222 5001  (fax)
 Training  -  Accreditation  -  Consultancy  -  Development


*** /opt/sandbox/lib/perl5/site_perl/5.8.8/Config/Any.pm
2006-08-22 22:35:28.0 +0100
--- lib/Config/Any.pm   2007-01-29 14:06:33.0 +
***
*** 160,166 
eval {
$config = $loader-load( $filename );
};
!   next if $EVAL_ERROR;
  next if !$config;
delete $files{$filename};
  # warn loader $loader loaded file $filename\n;
--- 160,170 
eval {
$config = $loader-load( $filename );
};
!   if ($EVAL_ERROR) {
!   warn( $EVAL_ERROR\n );
! next;
!   }
! # next if $EVAL_ERROR;
  next if !$config;
delete $files{$filename};
  # warn loader $loader loaded file $filename\n;

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-29 Thread Carl Franks

On 29/01/07, Carl Vincent [EMAIL PROTECTED] wrote:

Hi everyone,

I've just spent an inordinate amount of time debugging a problem which
was actually caused by my Yaml config file not parsing properly.
Catalyst isn't helping much - all it does is skip out the line of debug
that says [debug] Loaded Config ... and that's easy to overlook.

I discovered that when the file is loaded in Config::Any, if there's an
error with the parsing it just skips it and doesn't bother to alert
anyone.

Is there a smart way to test for your config file failing to parse?

I've patched my Config::Any (attached below) so it throws a warning. Not
sure if this would cause problems if it was included in the distributed
module...


I've had the same troubles today too!

How about a Test::YAML, in the same vein as Test::Pod, providing a
all_yaml_files_ok() rountine which accepts a list of files or
directories to check?

Carl

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-29 Thread Jonathan Rockway
Carl Vincent wrote:
 I've patched my Config::Any (attached below) so it throws a warning. Not
 sure if this would cause problems if it was included in the distributed
 module...

This is something I've been worried about for a while.  Config::Any
tries to load every config file with every backend, so printing
warnings is going to lead to a lot of spurious garbage.

Perhaps making ConfigLoader louder would help?  If no config is loaded
(but ConfigLoader is loaded), then perhaps we need to

  [warn] Config file found but failed to load.  Errors
  [warn] YAML_OMG_YOU_FORGOT_SOMETHING (Line 42, Column 32)
etc.
  [warn] XML::Parser error: no ?xml ? declaration
  [warn] JSON ...

As you can see it's kind of verbose that way.  What do other people think?


-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-29 Thread Matt S Trout


On 29 Jan 2007, at 16:19, Carl Vincent wrote:


Hi everyone,

I've just spent an inordinate amount of time debugging a problem which
was actually caused by my Yaml config file not parsing properly.


Which is why I don't use YAML. Try JSON or COnfig::General for sanity.

I discovered that when the file is loaded in Config::Any, if  
there's an

error with the parsing it just skips it and doesn't bother to alert
anyone.


Patches should be diff -ur, really.

And you seem to have missed off the test cases as well

--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-29 Thread David Morel
Jonathan Rockway a écrit :
 Perhaps making ConfigLoader louder would help?  If no config is loaded
 (but ConfigLoader is loaded), then perhaps we need to
 
   [warn] Config file found but failed to load.  Errors
   [warn] YAML_OMG_YOU_FORGOT_SOMETHING (Line 42, Column 32)
 etc.
   [warn] XML::Parser error: no ?xml ? declaration
   [warn] JSON ...
 
 As you can see it's kind of verbose that way.  What do other people think?

+1 : better verbose than silent
-- 
David Morel



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Hair-pulling over YAML config

2007-01-29 Thread Jonathan Rockway


Carl Franks wrote:

 How about a Test::YAML, in the same vein as Test::Pod, providing a
 all_yaml_files_ok() rountine which accepts a list of files or
 directories to check?

How's Test::YAML::Valid?

 The uploaded file
 
 Test-YAML-Valid-0.01.tar.gz
 
 has entered CPAN as
 
   file: $CPAN/authors/id/J/JR/JROCKWAY/Test-YAML-Valid-0.01.tar.gz
   size: 24085 bytes
md5: 149c0d49b41c52e302d4393448f866ef


-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/