Re: [Catalyst] Duplicate entries with C::P::Session::Store::DBIC and MySQL - new findings

2008-08-26 Thread Tobias Kremer
Quoting Tobias Kremer [EMAIL PROTECTED]:

 just wanted to inform you that switching from MyISAM to InnoDB for the
 session table does NOT solve the duplicate entry problem when
 using flash() :(

Just out of pure curiosity: Why is it that there are dedicated flash:hash
entries in the storage for the flash? Wouldn't the session be enough? I mean a
session is always established on the first request (logged-in or not), why not
just use it for the flash data (actually that's how other *cough* PHP
frameworks are doing it)? Something like this in my MyApp.pm seems to work
perfectly:

sub flash_msg {
my( $c, $value ) = @_;
if( $value ) {
$c-session-{ '__flash__' } = $value;
} else {
return delete $c-session-{ '__flash__' };
}
}

This should solve the race-condition and will reduce the queries per request
from FIVE(!) when using the flash mechanism down to 2.

What am I missing? :)

--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/


[Catalyst] Win32, Data::Alias, bad idea or my bad?

2008-08-26 Thread Kai Andresen
Hello all,

I've been trying to get a nice litle Catalyst application to run on
developers win32 machines the recent week.

Strawberry, ActiveState and Cygwin. All fail on something, but they all fail
on building Data::Alias, which both Configloader and RenderView depends
upon.

Mostly I've tried builds of perl 5.10, but I also tried Strawberry 5.8.8,
only to have Data::Alias demanding = 5.8.9

Reading the documentation of Data::Alias it's not hard to see that removing
that dependency might cost a lot in terms of efficiency, but it would be
nice if one could have an option to at least get Catalyst running for
development.

Does anyone on the list know a way to get Data::Alias to build on windows,
or to do without it?

kind regards
Kai Andresen
___
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] FormFu / FormBuilder + Custom Actions

2008-08-26 Thread Rod Taylor
Both FormFu and FormBuilder controller Actions appear to have issues
with their special variables disappearing when using an additional
ActionClass.

Below is a FormFu example. Carl asked me to repost it here for discussion.

2008/08/22 23:02:23] [catalyst] [ERROR] Caught exception in
SK::Controller::Client-edit Can't call method get_field on an
undefined value at
/usr/home/rbt/work/sk/SK/script/../lib/SK/Controller/Client.pm line
284.

use parent qw{Catalyst::Controller::HTML::FormFu};
...
sub edit : Local FormConfig ActionClass('+SK::Action::Test) {
   my ( $self, $c, $clientName ) = @_;

   my $form = $c-stash-{'form'};

   my $field = $form-get_field(name = 'some_field');
   $field-default('Default Value');

   return $self;
}



Any ActionClass will break it, including one virtually empty as found
in the Catalyst documentation:

package SK::Action::Test;

use strict;
use warnings;
use version 0.74;
our $VERSION = version-new(qw$Revision: 162 $);

use Class::C3;
use base 'Catalyst::Action';

sub execute {
 my $self = shift;
 my ($controller, $c, @args) = @_;

 # put your 'before' code here

 my $r = $self-next::method(@_);

 # put your 'after' code here

 return $r;
}

1;
__END__



Thanks,

Rod

___
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] Duplicate entries with C::P::Session::Store::DBIC and MySQL - new findings

2008-08-26 Thread Daniel Westermann-Clark
On 2008-08-26 09:47:59 +0200, Tobias Kremer wrote:
 a) Patch Catalyst::Plugin::Session::Store::DBIC to wrap the flash
functionality in a transaction (of course, this must be configurable).
Advantages:
  - Easy to implement
  - Most sensible solution.
Disadvantages:
  - Slight performance overhead?
  - Doesn't solve the problem for non-transactional databases

I would be happy to apply a patch that implemented this, at least
until something is done at the DBIx::Class level.

Non-transactional databases will continue to have the problem, and in
my opinion it isn't the job of the session store to fix that problem.
The session store docs can discourage use of MyISAM, for example.

 Please note, that this is ONLY happening with the flash part - my
 sessions work 100% accurate all the time!

How are you interacting with the flash vs. your sessions?  Could you
provide some code illustrating the problem?  A test would be even
better.

-- 
Daniel Westermann-Clark

___
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] Win32, Data::Alias, bad idea or my bad?

2008-08-26 Thread Matt S Trout
On Tue, Aug 26, 2008 at 03:20:14PM +0200, Kai Andresen wrote:
 Hello all,
 
 I've been trying to get a nice litle Catalyst application to run on
 developers win32 machines the recent week.
 
 Strawberry, ActiveState and Cygwin. All fail on something, but they all fail
 on building Data::Alias, which both Configloader and RenderView depends
 upon.
 
 Mostly I've tried builds of perl 5.10, but I also tried Strawberry 5.8.8,
 only to have Data::Alias demanding = 5.8.9

Looking at the CPAN testers results it -should- build under 5.10.0 - there
are a couple of PASS results for 1.07 there on

http://cpantesters.perl.org/show/Data-Alias.html

It's required by Data::Vistor as a dependency, but only for a specific
feature which I -don't- think we actually turn on. It'd suggest you try
forcing Data::Visitor, see if everything else installs ok, and if so
don't worry about it and we'll try and arrange a Data::Visitor release
that makes the dependency optional.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] FormFu / FormBuilder + Custom Actions

2008-08-26 Thread Matt S Trout
On Tue, Aug 26, 2008 at 10:30:47AM -0400, Rod Taylor wrote:
 Both FormFu and FormBuilder controller Actions appear to have issues
 with their special variables disappearing when using an additional
 ActionClass.

An object can't be blessed into two classes at once.

If you want to add an extra class, create an action class that inherits
from both the FormFu one and the additional one and :ActionClass that.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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/