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

2008-09-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).

I've released a new version which includes this functionality:

0.07  Wed Sep 24 17:08:34 EDT 2008
- Code was silently truncating storage to MySQL, rendering the
  session unreadable. Patched to check DBIx::Class size from
  column_info (if available)
- Wrap find_or_create calls in a transaction to (hopefully)
  avoid issues with duplicate flash rows

Thanks,

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


[Catalyst] minor typo in Catalyst::Authentication::Store::DBIx::Class::User

2008-09-26 Thread John Romkey

In 0.106, line 89 calls Catalyst::Exeption->throw

should be Catalyst::Exception->throw


johns-macbook:tmp romkey$ diff -u User.pm.orig User.pm
--- User.pm.orig2008-09-26 11:05:07.0 -0400
+++ User.pm 2008-09-26 11:08:08.0 -0400
@@ -86,7 +86,7 @@
 if (keys %{$searchargs}) {
 $self->_user($self->resultset->search($searchargs)- 
>first);

 } else {
-Catalyst::Exeption->throw("User retrieval failed: no  
columns from " . $self->config->{'user_class'} . " were provided");
+Catalyst::Exception->throw("User retrieval failed: no  
columns from " . $self->config->{'user_class'} . " were provided");

 }
 }


- john romkey
http://www.romkey.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/


Re: [Catalyst] Slow template processing on debian lenny

2008-09-26 Thread Carl Franks
2008/9/26 Terence Monteiro <[EMAIL PROTECTED]>:

> The only thing with Template::Alloy is that
> it does'nt seem to support the list import vmethod, does someone have a
> patch, or do I modify my template to get import working?

In my experience, the Template::Alloy author has been very good about
accepting patches / suggestions - so I'd suggest emailing him.

Carl

___
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] Slow template processing on debian lenny

2008-09-26 Thread Terence Monteiro
Moritz Onken wrote:
> 
>> Hi,
>>
>> I've been using TT for years and enjoy the features it provides. In
>> one of
>> my Catalyst applications, I'm processing a template which generates
>> HTML to
>> give me a table with counts taken from a hash. I'm using a lot of nested
>> FOREACH to generate the table.
>>
>> On my machine, an ubuntu hardy, it works fast - about 2.5 seconds to
>> process the template. On a production server using debian lenny, it
>> used to
>> take around the same amount of time. But recently, I upgraded it to
>> libperl
>> 5.10 and updated the different Perl modules including Template and
>> Catalyst::View::TT. After this upgrade, the same template takes 25
>> seconds
>> on average to process. The times I am mentioning are the times taken
>> on the
>> server side, as shown by the Catalyst application debug logs.
>>
>> I tried to work around the problem by bypassing C::V::TT and using the
>> following code to process the template inside the controller, but to
>> no avail:
>>
>>  my $tmpl = Template->new({
>>INCLUDE_PATH => $c->config->{home} . '/root',
>>RELATIVE => 1
>>  });
>>  my $output = '';
>>  $tmpl->process('index.tt', { %{$c->stash}, c => $c }, \$output);
>>  $c->res->body($output);
>>
> 
> Try Template::Alloy instead. It's a fully compatible faster
> implementation of TT.
> 
> replace
>>  my $tmpl = Template->new({
>>INCLUDE_PATH => $c->config->{home} . '/root',
>>RELATIVE => 1
>>  });
> 
> with
> 
>>  my $tmpl = Template::Alloy->new({
>>INCLUDE_PATH => $c->config->{home} . '/root',
>>RELATIVE => 1
>>  });
> 
> and install Template::alloy, of course.

Thanks! Template::Alloy does the trick. Some conflict when the Template
module runs inside of Catalyst on this particular server. Nothing else
seems to work, and outside of catalyst the same template was processing
much faster with the same data. The only thing with Template::Alloy is that
it does'nt seem to support the list import vmethod, does someone have a
patch, or do I modify my template to get import working?

-- 
Thanks and Regards,
Terence Monteiro.

DeepRoot Linux,
http://www.deeproot.in
Ph: +91 (80) 4112 4781 / 84 / 85
Getting GNU/Linux to work for you. Faster. Better. Today. Every way


___
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] How to send raw HTTP response

2008-09-26 Thread Christian Lackas
* Tomas Doran <[EMAIL PROTECTED]> [080925 23:06]:

Hi Tomas,

thanks for the prompt reply (also to all others).

> Looking at the source code for Catalyst::write, and 
> Catalyst::Engine::write, you need to say $c->finalize_headers, after
> which just writing to STDOUT as above should do the right thing..

This is supposed to print out the HTTP header immediately, right?

I tried this here:

sub download : Local {
my ($self, $c) = @_;
my ($filename, @files) = getAllfiles();
$c->response->content_type('application/zip');
$c->response->header('Content-Disposition' => "attachment; 
filename=$filename.zip");
$c->finalize_headers();
$c->response->{body} = undef;

my $ZIP = Archive::Zip->new();

foreach my $file (@files) {
my ($basename) = $file =~ m{.*/(.*)};
$ZIP->addFile($file, $basename);
}
$ZIP->writeToFileHandle(*STDOUT);
}

However, with this code I don't get a HTTP header at all (when run under
Catalyst server) and additionally Catalyst appends an error message
after my ZIP file.

So my questions are:
How do I tell Catalyst:
- to either send no HTTP header at all, or to force it to print the
  header at a time convenient for me (e.g. just before the ZIP)?
- that I handled everything in the controller and that it should just
  stop with processing the request (so nothing is send afterwards).

> However, I'd have thought that clients on the other end would be
> somewhat unhappy with not getting a Content-Length header...

As pointed out in this thread already, this mainly means that a browser
is not able to show a proper progress bar. If the ZIP is downloaded
incompletely, even though the browser may not able to report that
correctly, the uncompressing will fail with a truncation warning.

Christian


___
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] ANNOUNCE: DBIx::DataModel 1.04

2008-09-26 Thread Dami Laurent (PJ)
Hi all,

For info : DBIx::DataModel v1.04 has been released to CPAN. This is
a major revision from previous v0.35, with several architectural 
changes and added functionalities.

DBIx::DataModel is an Object-Relational mapping layer (ORM). Some of its
strong points are :

- UML-style declaration of relationships (instead of 'has_many', 
  'belongs_to', etc.)

- efficiency through fine control of collaboration with the 
  DBI layer (prepare/execute, fetch into reusable memory location, etc.)

- improved API for SQL::Abstract (named parameters, simplified
'orderBy')

- clear conceptual distinction between 
- data sources (tables and views),
- database statements  (stateful objects representing stepwise
building
of an SQL query and stepwise retrieval of
results),
- data rows(lightweight hashrefs containing nothing but
column
names and values)

- joins with simple syntax and possible override of default
  INNER JOIN/LEFT JOIN properties; instances of joins multiply
  inherit from their member tables

- named placeholders at the ORM level

- nested, cross-database transactions

The synopsis is in 
http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel.pm;
the design principles and general architecture are explained
in
http://search.cpan.org/dist/DBIx-DataModel/lib/DBIx/DataModel/Doc/Design
.pod


Enjoy,

Laurent Dami

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