Re: [Catalyst] Bug with $c->request->query_keywords ?

2008-06-19 Thread Lindolfo "Lorn" Rodrigues
Works fine here.

MyApp on Catalyst 5.7010
This is perl, v5.8.8 built for darwin-thread-multi-2level

On Thu, Jun 19, 2008 at 3:33 PM, Larry Leszczynski <[EMAIL PROTECTED]>
wrote:

> I've run into what appears to be a query keyword bug using Catalyst
> 5.701[02]:
>
>   % catalyst.pl MyApp
>   % cd MyApp
>   % perl script/myapp_server.pl
>
> Request:
>
>   http://localhost:3000/ -> works
>   http://localhost:3000/?a=123   -> works
>   http://localhost:3000/?123 -> fails
>
> The error message is:
>
>   [error] Caught exception in engine "Can't locate object
>   method "query_keywords" via package "Catalyst::Request"
>   at /Library/Perl/5.8.8/Catalyst/Engine.pm line 446."
>
> It does not happen on boxes that are running 5.7007.  Is anyone else
> seeing this?
>
>
> Thanks,
> Larry
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



-- 
--Lindolfo "Lorn" Rodrigues
www.slackwarezine.com.br
http://lornlab.org
http://sao-paulo.pm.org
use Catalyst;
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Graceful handling of database failure

2008-06-19 Thread Oleg Pronin
You can use DBIx::Class with DBIx::RetryOverDisconnects as DBI handle and
you will never got db server away message (it will reconnect as long as
required until database is up and no queries and transactions will be lost).

2008/6/18 Mitchell K. Jackson <[EMAIL PROTECTED]>:

> Good afternoon,
>
> Is there a graceful way for a catalyst app to handle when the database
> server goes away?  If this happens while a process is holding open a
> database connection it's already been using, there's not even a
> database error to the log. The only error is "read data timeout in 40
> seconds", and an error 500 to the web browser.
>
> I would like my app to be able to deliver a  more useful error to the
> end user, such as "Lost database connection."  If I can retain control
> of the app in this event, I'll have it send me an sms for good
> measure.  Any ideas how I could go about this?
>
> Regards,
>
> /Mitchell K. Jackson
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Graceful handling of database failure

2008-06-19 Thread Mitch Jackson
>> sub end : {
>
> "sub end : Private {" is what you need.  The Private attribute is important.

Odd thing was, when I added the Private attribute as per your original
example, it broke the app somehow.  I'll look at that some more.

Thanks,

/Mitch

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


Re: [Catalyst] Graceful handling of database failure

2008-06-19 Thread J. Shirley
On Thu, Jun 19, 2008 at 10:56 AM, Mitch Jackson <[EMAIL PROTECTED]> wrote:
[snip]

> =
> sub render_end : ActionClass('RenderView') {}
>
> sub end : {

"sub end : Private {" is what you need.  The Private attribute is important.

That should do it for you.

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


[Catalyst] Bug with $c->request->query_keywords ?

2008-06-19 Thread Larry Leszczynski
I've run into what appears to be a query keyword bug using Catalyst
5.701[02]:

   % catalyst.pl MyApp
   % cd MyApp
   % perl script/myapp_server.pl

Request:

   http://localhost:3000/ -> works
   http://localhost:3000/?a=123   -> works
   http://localhost:3000/?123 -> fails

The error message is:

   [error] Caught exception in engine "Can't locate object
   method "query_keywords" via package "Catalyst::Request"
   at /Library/Perl/5.8.8/Catalyst/Engine.pm line 446."

It does not happen on boxes that are running 5.7007.  Is anyone else
seeing this?


Thanks,
Larry

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


Re: [Catalyst] Graceful handling of database failure

2008-06-19 Thread Mitch Jackson
> Is there some other way to tie into the error handling, or am I
> missing something?  Following is code I'm using for end action:

Dear self,

It looks like you can overload the internal catalyst function
$c->finalize_error.  Perhaps this is what you're looking for.

/Mitch

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


Re: [Catalyst] Graceful handling of database failure

2008-06-19 Thread Mitch Jackson
> If you are using DBIx::Class, I'd be surprised if it doesn't do the
> right thing already.

> As far as catching the error, make sure that your model throws a
> proper exception and you can catch that in the end action.
>
> Something like this is what I tend to use:
>
> sub render_end : Private ActionClass('RenderView') { }
>
> sub end : Private {
>   my ( $self, $c ) = @_;
>   $c->forward('render_end');
>   if ( @{$c->error} ) {
>  # Handle errors
>   }
> }

J,

Thanks for the help.  I tried the approach you suggested, but it's not
working for me.  Yes, I am using DBix::Class, and yes, it does seem to
do The Right Thing and somehow throw a $c->error that makes it out to
the log.

I wrote an action similar to the one you suggest ( code attached below
) and threw a bad username into the database connection string.

Watching Debug output, it appears the end action is never called when
the error happens.  The debug output looks like this:

=
You can connect to your server at http://myapp.com:3000
DBI connect('table:localhost','bad_username',...) failed: Access
denied for user 'bad_username'@'localhost' (using password: YES) at
/usr/lib/perl5/site_perl/5.8.8/DBIx/Class/Storage/DBI.pm line 839
DBI connect('table:localhost','bad_username',...) failed: Access
denied for user 'bad_username'@'localhost' (using password: YES) at
/usr/lib/perl5/site_perl/5.8.8/DBIx/Class/Storage/DBI.pm line 839
[info] *** Request 1 (0.200/s) [3553] [Thu Jun 19 12:35:54 2008] ***
[debug] "GET" request for "/" from "127.0.0.1"
[debug] Found sessionid "efa809c86e12c56089e8aaaf24e62e56ec23f7ba" in cookie
[error] DBIx::Class::ResultSet::find_or_create(): DBI Connection
failed: Access denied for user 'bad_username'@'localhost' (using
password: YES) at
/usr/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm
line 33
[info] Request took 0.326993s (3.058/s)
.+---.
| Action | Time  |
++---+
| /begin | 0.000333s |
| /index | 0.039518s |
'+---'

[error] Caught exception in engine
"DBIx::Class::ResultSet::find_or_create(): DBI Connection failed:
Access denied for user 'bad_username'@'localhost' (using password:
YES) at 
/usr/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm
line 33"
=

Since /end is never called, the error handling never happens.

Is there some other way to tie into the error handling, or am I
missing something?  Following is code I'm using for end action:

Thanks,

/Mitch

=
sub render_end : ActionClass('RenderView') {}

sub end : {
# The default error handling of Catalyst gets pre-empted here with our own,
# unless the app is operating in debug mode.

# First, we forward to the standard renderer end action.  After, we
# check for errors.  If they exist, we handle the errors and clear them from
# catalyst, but add them to the stash..  Then we override the template
# to use error500 and display an error by forwarding back to the renderview
# a second time.

my ( $self, $c ) = @_;

$c->log->debug( 'On a DBIx::Class Connection error this statement
never happens' );

$c->forward('render_end');
return unless @{ $c->error };

# If we're running under debug mode, allow default error handling
# and stack trace.  Otherwise, override error handling
return if $c->debug();

# Collect and clear catalyst's error stack, creating a copy into stash
my @errors = grep { 1 } shift @{$c->error};
$c->stash->{errors} = [EMAIL PROTECTED];

for my $error ( @errors ) {
$c->log->error( $error );
}

# Re-process final rendering w/o the error stack
$c->stash->{template} = '500.nonav.tt2';
$c->detach('render_end');
}

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


Re: [Catalyst] Unkown error

2008-06-19 Thread Oleg Pronin
This is just a "error somewhere". In 5.10 some of standart perl runtime
exceptions might cause this "Unknown error". You just have to find the error
manually and fix it.

2008/6/19 dab <[EMAIL PROTECTED]>:

> hi,
>
> I use Catalyst 5.7014 and Perl 5.10 and i dont understand why I have
> this type of error
>
> A simple example:
> catalyst.pl myapp
> cd myapp
>
> I add an error in Root.pm
>
> ---
> sub index : Path Args(0) {
>my ( $self, $c ) = @_;
>
># Hello World
>$c->response->body( $c->welcome_message );
>
>TheError;
> }
> --
> ./script/myapp_server.pl
> Unknown error
> Compilation failed in require
> at /home/dab/perl5/lib/perl5/Catalyst/Utils.pm line 270. Compilation
> failed in require at ./script/myapp_server.pl line 55.
>
> It is very difficult to find a mistake with what returns catalyst :(
> How can i debug application with this type of message ?
>
> note: I dont have this problem with Perl 5.8.8
>
> Thank
>
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Unkown error

2008-06-19 Thread Martin Ellison
I've been getting them too... I've been bracketing them with BEGIN {warn
q{#27};} type code and narrowing down the location. In each case there was
some stupid typo or something in there.

2008/6/19 dab <[EMAIL PROTECTED]>:

> Le Wed, 18 Jun 2008 22:53:28 +0200,
> "Frank Wiegand" <[EMAIL PROTECTED]> a écrit :
>
> > Hi,
> >
> > 2008/6/19, dab <[EMAIL PROTECTED]>:
> > >  I use Catalyst 5.7014 and Perl 5.10 and i dont understand why I
> > > have this type of error
> > ...
> > > Unknown error
> >
> > Looks like an error in perl itself:
> > http://rt.perl.org/rt3/Public/Bug/Display.html?id=49472
> >
> > This issue has been fixed in the latest development version of perl
> > (bleadperl).
> >
> > You have three choices (kind of):
> >
> > - don't use 5.10
> > - use bleadperl or 5.8.8
> > - don't write code that triggers that kind of error ;-)
>
> :-)
> ok thank Franck
>
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.org
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Catalyst site design drafts feedback thread

2008-06-19 Thread Tobias Kremer
Hey Mark,

Quoting Mark Keating <[EMAIL PROTECTED]>:
> I have the original .eps file of the Catalyst logo, you will find it at:
> http://www.external.shadowcatprojects.net/data/common/images/catalyst
> logo.eps

Thank you very much! Marcus Ramberg already pointed me to the catalyst
subversion repository where the eps version is also stored :)

--Tobias

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


Re: [Catalyst] Re: Catalyst site design drafts feedback thread

2008-06-19 Thread Mark Keating

I have the original .eps file of the Catalyst logo, you will find it at:

http://www.external.shadowcatprojects.net/data/common/images/catalyst 
logo.eps


It can be scaled to pretty much any size in a IMP but if you would like 
it as a png/gif/jpg of a set size/quality and do not have the 
time/inclination to do it just ask and I will do this for you and post 
it to the same location for retrival.


Marcello Romani wrote:

Tobias Kremer ha scritto:

Quoting Aristotle Pagaltzis <[EMAIL PROTECTED]>:

* Tobias Kremer <[EMAIL PROTECTED]> [2008-06-17 08:40]:

I've incorporated some of the suggestions into the next version
of the mockup which can be found here:

Awesome. There are still nits, but you have already made those
clear yourself, and it’s a huge improvement over the promising
first draft, so I’m confident you’ll get there.


I've started to code the site and the ongoing process is available at
http://www.funkreich.de/catalyst. It's currently known to look good 
in Mozilla
Firefox and Safari. MSIE (as always) still looks a bit odd but I 
think we're

far from browser-optimizing the site :)


Some nits: [...]


Thanks! :)


• The text in the left column: I don’t have a good suggestion off
  hand, but if you want, I can spend some time thinking about it.
  (Are you on IRC? We might confer/brainstorm a bit.)


Good idea! My nick is "soulchild" but I'm currently at work and can't 
promise

that I'll make it into the room.

--Tobias

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: 
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/

Dev site: http://dev.catalyst.perl.org/



It looks great on FF3.0
I think the cat logo could be enlarged and made transparent, so that 
the lower "arm" of the crop circle overlaps a little with the red bar 
below. This way the logo could be enlarged without the need to add 
more white space to the top of the page (which would be a waste of 
space), and would also add a bit of "special effect" to the page, 
without being, IMHO, too intrusive.


Just my .2 cents.

Keep up the good work!



--
Mark Keating BA (Hons)  |  Writer, Photographer, Cat-Herder
Managing Director   |  Shadowcat Systems Limited
Director/Secretary  |  Enlightened Perl Organisation
http://www.shadowcat.co.uk  |  http://www.enlightenedperl.org
http://linkedin.com/in/markkeating  | 'Sufficiently Advanced Technology'


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


Re: [Catalyst] Re: Catalyst site design drafts feedback thread

2008-06-19 Thread Marcello Romani

Tobias Kremer ha scritto:

Quoting Aristotle Pagaltzis <[EMAIL PROTECTED]>:

* Tobias Kremer <[EMAIL PROTECTED]> [2008-06-17 08:40]:

I've incorporated some of the suggestions into the next version
of the mockup which can be found here:

Awesome. There are still nits, but you have already made those
clear yourself, and it’s a huge improvement over the promising
first draft, so I’m confident you’ll get there.


I've started to code the site and the ongoing process is available at
http://www.funkreich.de/catalyst. It's currently known to look good in Mozilla
Firefox and Safari. MSIE (as always) still looks a bit odd but I think we're
far from browser-optimizing the site :)


Some nits: [...]


Thanks! :)


• The text in the left column: I don’t have a good suggestion off
  hand, but if you want, I can spend some time thinking about it.
  (Are you on IRC? We might confer/brainstorm a bit.)


Good idea! My nick is "soulchild" but I'm currently at work and can't promise
that I'll make it into the room.

--Tobias

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



It looks great on FF3.0
I think the cat logo could be enlarged and made transparent, so that the 
lower "arm" of the crop circle overlaps a little with the red bar below. 
This way the logo could be enlarged without the need to add more white 
space to the top of the page (which would be a waste of space), and 
would also add a bit of "special effect" to the page, without being, 
IMHO, too intrusive.


Just my .2 cents.

Keep up the good work!

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com

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