[Catalyst] local server hangs on Windows 7 / Internet Explorer 9

2013-04-19 Thread Dami Laurent (PJ)
Hi Catalysters,

My company just upgraded from Windows XP/MSIE8 to Windows 7 / MSIE9. Since then 
I have problems with Catalyst local HTTP server : sometimes the requests are 
frozen ... but with luck an additional request unlocks the whole thing and all 
responses come at once. I suspect some problem related to new threading 
behaviours in Windows or in Internet Explorer. Oddly enough, if I run Fiddler 
(http://fiddler2.com) as a local proxy, then everything works fine.

Perl 5.14.4, Catalyst 5.90020, Plack 1.0023.

Any help or hints on that problem would be greatly appreciated.

Thanks in advance, 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/


RE: [Catalyst] DB values that change very rarely

2013-01-10 Thread Dami Laurent (PJ)
-Message d'origine-
De : Jesse Sheidlower [mailto:jes...@panix.com]
Envoyé : jeudi, 10. janvier 2013 16:16
À : catalyst@lists.scsys.co.uk
Objet : [Catalyst] DB values that change very rarely


In one of my apps, I have a number of tables that contain values that
change very rarely. 
[...]
This means that almost every page generation hits the database a whole bunch of
unnecessary times, and that all of my controllers are cluttered.

This must be a fairly common problem. What's the best way to deal with
it--both the desire to persist what is mostly static data, and to keep
my controllers clean?

Hi Jesse,

First of all, you need a piece of information that tells you if the 
configuration data has changed. It can be a version number or a timestamp 
column, either associated to each table (if these tables change individually), 
or in a global version table that covers everything. Every time that a power 
user edits such data, your version number or timestamp must be updated. 

Or maybe all this configuration data that doesn't change very often could be 
stored, not in database, but in a config file (using YAML, XML, or 
Config::General). In that case you have the mtime of the file to tell you if 
the data has changed.

Based on this, your controller can use any of the CPAN caching modules to keep 
the data in memory; you still need to go to the datasource to check if the 
version number or timestamp has changed, but that's a much smaller request.

Another way would be to exploit the caching functionality of the browser 
itself. In that case, the configuration data should be at a separate URL, like 
/myApp/config.json. Every page should use client-side javascript to exploit the 
config.json data (for exemple for building the various OPTIONS of a SELECT). 
Each page of the application loads /myApp/config.json, either through a script 
src=..., or through an Ajax call.The controller that serves this config.json 
should implement conditional GET, i.e. read the If-Modified-Since or 
If-None-Match headers, ask the datasource for its timestamp, and return 302 
NOT MODIFIED if the client tag is in sync with the server data. That's a 
client-server round trip, but it's very fast because there is almost no content 
to be exchanged. Furthermore, the advantage is that the /config.json data is 
shared among all pages of your app -- it only travelled once from the server to 
the client.

Hope this helps -- good luck,

 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/


RE: [Catalyst] Fatal errors in chained actions

2011-04-08 Thread Dami Laurent (PJ)
-Message d'origine-
De : Ronald J Kimball [mailto:rkimb...@pangeamedia.com]
Envoyé : jeudi, 7. avril 2011 20:11
À : The elegant MVC web framework
Objet : [Catalyst] Fatal errors in chained actions

I was surprised to discover that when a chained action throws a fatal
error, Catalyst continues executing the remaining actions in the
chain.  Personally, I had assumed that each action in the chain could
depend on the preceeding actions having been executed successfully.

Hi Ronald,

This point was discussed in 2008 : see
http://lists.scsys.co.uk/pipermail/catalyst/2008-March/017748.html
and the rest of the thread.

At that time I also had some IRC chats or private e-mails with Matt Trout about 
this point; he of course suggested me to write a patch ... which I never did ! 
The problem we discussed was that a change of behaviour would perhaps break 
some stuff in existing applications; so what is probably needed is a parameter 
somewhere in Catalyst config to tune the error handling for chained actions.

For the moment, what I do in my applications is quite bad : load 
Catalyst::ActionChain and forcefully overwrite the dispatch() method, applying 
the code change proposed in 
http://lists.scsys.co.uk/pipermail/catalyst/2008-March/017789.html
I really need that hack because, as you mention, if a database call fails in 
the first URL segment, we better stop there instead of applying the following 
segments.

So maybe it's time to really think about proposing a patch to Catalyst ...

Best regards, 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/


[Catalyst] plat_forms 2010/2011 : call for Perl teams

2010-08-26 Thread Dami Laurent (PJ)
[cross-posted from
http://ldami.blogspot.com/2010/08/platforms-20102011-call-for-perl-teams
.html ]

Hi Catalysters,

A new edition of the Plat_Forms programming contest is going to take
place in end 2010 or beginning of 2011 : see
http://www.plat-forms.org/2010/plat-forms-in-2010 . 

The first edition took place in 2007 and our Geneva team on Catalyst was
winner of the Perl track (http://use.perl.org/~dami/journal/33559 ).
Unfortunately we will not be able to participate again this time; but I
wish that another Catalyst team will be present. Reports from that
contest got significant coverage in specialised press , and can play an
important role in propagating a positive image of Perl. See for example
the August 2010 issue of the prestigious Communications of ACM
(http://cacm.acm.org/magazines/2010/8/96637-platforms-is-there-one-best-
web-development-technology/abstract , full text available at
http://page.mi.fu-berlin.de/prechelt/Biblio/platforms07-cacm-2010.pdf );
the conclusion reads :

Is Perl outdated? No. In contrast, the small size of the
solutions and their good modifiability suggest that Perl may be a
particularly strong platform with respect to maintainability.

So, Perl programmers, please build up teams to participate in the
2010/2011 edition!
___
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] Alternatives to DBIx?

2010-04-19 Thread Dami Laurent (PJ)
-Message d'origine-
De : John Karr [mailto:brain...@brainbuz.org] 
Envoyé : samedi, 17. avril 2010 07:02
À : 'The elegant MVC web framework'
Objet : [Catalyst] Alternatives to DBIx?

The alternatives I've been able to discover are DBI and 
RoseDB. Is there any
case (given why I've already stated I dislike DBIx) for RoseDB, and are
there any other alternatives that work well with Catalyst that 
I have not
found?


One alternative that has not been mentioned so far is DBIx::DataModel.

See
http://search.cpan.org/~dami/DBIx-DataModel-1.24/lib/DBIx/DataModel.pm 
for SYNOPSIS,
http://search.cpan.org/~dami/DBIx-DataModel-1.24/lib/DBIx/DataModel/Doc/Design.pod
 
for design principles and some words about comparison to other ORMs, and 
http://search.cpan.org/~dami/DBIx-DataModel-1.24/lib/DBIx/DataModel/Doc/Reference.pod
for complete reference.

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/


RE: [Catalyst] Catalyst::Plugin::Prototype: current state ? / autocompletion

2010-03-21 Thread Dami Laurent (PJ)
 
-Message d'origine-
De : Alex Povolotsky [mailto:tark...@over.ru] 
Envoyé : samedi, 20. mars 2010 14:30

Can anyont point me at

- interoperability with C::P::P and current Prototype
- maybe other Catalyst JS plugins?

I'm mostly interested in COMPLEX autocompletion right now.

BTW, maybe someone can clue me with my current task

I have a large (1+) database of people, and many-to-many 
relationship people-request, so I should write some form to add people 
to request.

Loading all database into selectbox is not suitable for 
obvious reason. 
I'd like to write an Ajax-based autocompletion with add to 
list button 
enabled only when selection is fully done.

Hi Alex,

If you need sophisticated autocompletion, have a look at 
http://cpansearch.perl.org/src/DAMI/Alien-GvaScript-1.21/doc/html/Intro.html
http://cpansearch.perl.org/src/DAMI/Alien-GvaScript-1.21/doc/html/AutoCompleter.html


There is no Catalyst plugin but it's quite simple to integrate it into a 
Catalyst app :

a) write a Controller that will receive the Ajax requests and answer with a 
JSON datastructure (arrayref of possible values, or, if you want more complex 
behaviour on the client-side, arrayref of hashrefs with several fields for each 
returned entry).
b) serve the GvaScript.js file through Static::Simple or directly through your 
HTTP server
c) in your HTML page, include the GvaScript.js and write the JS code for 
initialising the Autocompleter object, giving it the URL for the Ajax 
controller and setting the appropriate options, as described in the doc. You 
can specify delays, case sensitivity, strictness, typeahead features, dependent 
fields, and many other options. 

If you need an example, install the Pod::POM::Web local documentation server 
and see how it works; it uses the autocompleter for perl functions and perl 
variables.

Good luck, 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/


RE: [Catalyst] Login as another user ...

2010-01-18 Thread Dami Laurent (PJ)
 

-Message d'origine-
De : Kiffin Gish [mailto:kiffin.g...@planet.nl] 
Envoyé : lundi, 18. janvier 2010 11:34
À : The elegant MVC web framework
Objet : [Catalyst] Login as another user ...

As system administrator who has root access to everything, I want to be
able to login as another user from my dashboard page.

What's the best way to achieve this? I tried $c-authenticate without a
password, but this doesn't seem to work.

-- 

If authentication is based on cookies, and if you have access to the cookie 
algorithm, then you could have a change user action (of course protected so 
that only admins can do it), and that action replaces the current 
authentication cookie by another one in name of somebody else.

cheers, Laurent D.

___
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: modules for conditional GET ?

2010-01-17 Thread Dami Laurent (PJ)
 

-Message d'origine-
De : Aristotle Pagaltzis [mailto:pagalt...@gmx.de] 
Envoyé : samedi, 16. janvier 2010 15:34
À : catalyst@lists.scsys.co.uk
Objet : [Catalyst] Re: modules for conditional GET ?

* Dami Laurent (PJ) laurent.d...@justice.ge.ch [2010-01-14 16:05]:
 For some actions of a Catalyst app, I would like to implement
 conditional GET (using If-Modified-Since HTTP header), where
 the timestamp of one config file decides whether the page
 should be refreshed or not  --- this is because that page is
 quite expensive to compute.

I agree with the others who have responded, but they didn't
explain why theirs was the right answer, so:

You're not checking whether any state has changed since the
last GET to decide whether to recompute. That is the case in
which conditional GET would be appropriate. That would allow
you to avoid recomputing the page indefinitely as long as no
state changes necessitate it, but it requires that the clients
keep asking.


Indeed, this is exactly what I want to do. The app has a config file (not a 
Catalyst
config file, but another file having to do with business logic), and some 
super-users
have a mechanism for hot uploading of a new config to the server, at any time. 
A few app pages are expensive to compute, and they depend on the client and on 
that config file. So clients should keep asking for those pages at each 
request, and depending on the If-Modified-Since header and on the timestamp for 
the config file, the server can decide if it's worth recomputing the page for 
that client, or rather send a cheap 304 Not Modified.

Cheers, L. 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/


[Catalyst] modules for conditional GET ?

2010-01-14 Thread Dami Laurent (PJ)
Hi Catalysters,

For some actions of a Catalyst app, I would like to implement
conditional GET (using If-Modified-Since HTTP header), where the
timestamp of one config file decides whether the page should be
refreshed or not  --- this is because that page is quite expensive to
compute.

This scenario sounds like a common thing to do, so I expected to find
some Catalyst plugins/extensions in CPAN to do that, but didn't find
any. Did I just miss some CPAN modules, or should I really start from
scratch ?

Thanks in advance for any hints,

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/


RE: [Catalyst] Catalyst Book

2009-08-28 Thread Dami Laurent (PJ)
Hi, I just started reading the book, I can do a review. Let me know 
where/when/how long.

Cheers,

Laurent Dami 

-Message d'origine-
De : Kieren Diment [mailto:dim...@gmail.com] 
Envoyé : vendredi, 28. août 2009 11:15
À : The elegant MVC web framework
Objet : [Catalyst] Catalyst Book

Who wants to write a review of the book for slashdot?

___
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] autocomplete forms?

2009-01-04 Thread Dami Laurent (PJ)
 

-Message d'origine-
De : Michael Higgins [mailto:li...@evolone.org] 
Envoyé : mercredi, 31. décembre 2008 18:45
À : The elegant MVC web framework
Objet : [Catalyst] autocomplete forms?

Hey, all --

Using formbuilder forms with Controller::FormBuilder. But. 
What I'd like (actually, probably need) is to have some of the 
list select boxes asynchronously populated with lists that 
would autocomplete.

Am I painted into a corner, or can I shoehorn some AJAX-y 
goodness into Controller::FormBuilder? If so, how? 

If not, what should I use?


Hi Michael,

There is an autocompleter component in Alien::GvaScript -- 
see 
http://search.cpan.org/~DAMI/Alien-GvaScript/lib/Alien/GvaScript/AutoCompleter.pod
This is perhaps more complex than other libraries, but it has many options 
(strict/non-strict, case sensitive or not, autosuggest, multivalued, typeAhead, 
etc.)

This is pure javascript, so it should work well together with FormBuilder; you 
will need to declare the Autocompleter object in the HTML head, and then add an 
'onfocus' attribute on the field(s) to be autocompleted. You will also need to 
setup your datasources for autocompletion, which can be either inline objects 
in your page, or some controllers in your app that return JSON data.

Best regards, 

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/


[Catalyst] vote for Catalyst in Enterprise Open Source Directory

2008-12-11 Thread Dami Laurent (PJ)
Hi Catalysters,

If you are happy users of Catalyst, please vote for it on the Enterprise
Open Source Directory.

Currently the user rating is good but there are only 4 votes; more votes
could improve the visibility of Catalyst, especially for Enterprise
deciders.

http://www.eosdirectory.com/project/382/Catalyst+Framework.html

Best regards,

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/


[Catalyst] RE: [sqlite] experiencing SQLite crash (Apache/mod_perl/Catalyst)

2008-10-16 Thread Dami Laurent (PJ)

Hi all,

I have a Perl Catalyst app using SQLite as storage. It has been running
for several months without any problem.
Now in the last few days we had several crashes of SQLite (file gets
corrupted). This is just incomprehensible because all development and
production engineers claim that nothing has changed in 
application code,
nor in Catalyst, DBD::Sqlite, Apache, or operating system 
(Solaris), and
we can't reproduce the problem in dev. So we don't even know where to
start our investigations.

Any hints, suggestions, related info, etc. would be welcome.

The production server is running Apache 2.2.8 Solaris / mod_perl 2.04 /
Perl 5.7.8 / Catalyst 5.7007 / DBD::SQlite 1.13.

Thanks in advance, 

   Laurent Dami



For info : we partially understood the problem.

The production server uses a private Apache authentication module
written in C.
That module was accidentally compiled with a debug flag and therefore
was sending
printf(..) statements to STDOUT (probably a very bad idea, instead of
going through Apache logging methods!). 
This went undetected for several months -- the printf were written God
knows where.

What happened in the last few days is that in some occasions the file
descriptor
for accessing SQLite was the same as the stdout used by C printf --
so some logging data was overwriting some blocks inside the SQLite
binary file!
No idea if this sharing of file descriptor is because of Apache or
mod_perl or 
DBD::Sqlite or still something else, nor why this sharing only started a
few
days ago  (maybe a difference in load of the server).

Anyway, the fix is of course to disable debug flag in that C module, so
that
it no longer prints to stdout.

Many thanks to people who responded to my previous call for help.

Best regards,

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/


[Catalyst] experiencing SQLite crash

2008-10-15 Thread Dami Laurent (PJ)
Hi all,

I have a Catalyst app using SQLite as storage. It has been running for
several months without any problem.
Now in the last few days we has several crashes of SQLite (file gets
corrupted). This is just incomprehensible because all development and
production engineers claim that nothing has changed in application code,
nor in Catalyst, DBD::Sqlite, Apache, or operating system (Solaris), and
we can't reproduce the problem in dev. So we don't even know where to
start our investigations.

Any hints, suggestions, related info, etc. would be welcome.

The production server is running Apache 2.2.8 Solaris / Catalyst 5.7007
/ DBD::SQlite 1.13.

Thanks in advance, 

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/


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


RE: [Catalyst] IE has problems with catalyst

2008-09-10 Thread Dami Laurent (PJ)
 

-Message d'origine-
De : snookums [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi, 10. septembre 2008 12:03
À : catalyst@lists.scsys.co.uk
Objet : [Catalyst] IE has problems with catalyst


I hope someone can point out to me what's wrong here. I have a catalyst
application that I've been developing. It takes a submitted 
link, processes
it, and regurgitates it with some changes. It's a get request. The
processing can take up to about 10 seconds. I thought 
everything was going
fine, but I'm developing on mac. I've been testing it in 
Safari. I quickly
found that IE users couldn't access my application. They can get to the
front page, but when they submit a link, the browser runs for 
a little while
and then gives a dns error page: cannot access this page, page not
available, etc. Apache error and access logs don't even show the hit.

I looked online and found that the problem might have 
something to do with
the keep-alive option. I changed my main app file to look like this.

use parent qw/Catalyst/;
use Catalyst qw/-k
-Debug
ConfigLoader
Static::Simple
UserAgent
Unicode
Compress::Gzip/;
our $VERSION = '0.01';

That didn't fix the problem, but I noticed some improvement for slower
connections that weren't even getting the front page before. I 
also should
mention that I'm using Catalyst with the latest versions of 
perl, apache,
and mod_perl. I tried changing a few of my keep-alive options 
in apache conf
as well to increase the time before dropping a connection. I 
haven't noticed
any difference.

Can anyone tell me how -k works? Is there a default timeout 
value that I can
change? Is this even the problem?
-- 

Hi,

If your hypothesis about needing Keepalive is correct, and if your application 
in production runs under Apache, then you you need to activate Keepalive in 
your Apache configuration; its not a Catalyst property. So edit your httpd.conf 
and add

  KeepAlive On

One reason why this might be important is if you use the Microsoft NTLM 
protocol for
authentifying your users (mod_auth_ntlm or mod_auth_sspi or PerlAuthenHandler 
Apache2::AuthenNTLM); these definitely need KeepAlive to be on.

Hope this helps,

Best regards,

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/


RE: [Catalyst] Re: [again] die() in an action chain : does not breakthe chain !

2008-03-17 Thread Dami Laurent (PJ)
Hi all,

It seems that the discussion on how to break a chain now has moved to
let's write a special method for breaking the chain, and let's find a
good name for it (candidates : die, abort, halt, fail, error_out,
explode, collapse, stop_that, ...)

However, this approach still implies that one would have to eval{...} in
almost every method, in order to catch exceptions possibly raised deep
in some remote packages. Spreading eval{...} all around the Catalyst app
is not nice!

So I think something more radical is needed, at the core of the chained
actions mechanism. I tried the following modification to
Catalyst::ActionChain

   sub dispatch {
   my ( $self, $c ) = @_;
   my @captures = @{$c-req-captures||[]};
   my @chain = @{ $self-chain };
   my $last = pop(@chain);
   foreach my $action ( @chain ) {
   my @args;
   if (my $cap = $action-attributes-{CaptureArgs}) {
 @args = splice(@captures, 0, $cap-[0]);
   }
   local $c-request-{arguments} = [EMAIL PROTECTED];
   $action-dispatch( $c );

   # ADDED LINE HERE
   return if $c-error;

   }
   $last-dispatch( $c );
   }  

and it seems to work fine. However, I don't know if this would create
undesirable side-effects, nor if the modification above should become
default, or something that would be toggled by a global Catalyst option.

Any thoughts on that ?

Best regards, Laurent


___
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] exceptions and chained actions

2008-03-11 Thread Dami Laurent (PJ)
Hi Catalysters,

It seems that if an exception is raised in the entry point to an action
chain, Catalyst still tries to forward to the other chain components,
accumulating all exceptions into $c-errors.

Is there a way to stop the chain at the first exception ?

Thanks in advance,

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/


RE: [Catalyst] POD viewer

2008-01-08 Thread Dami Laurent (PJ)
-Message d'origine-
De : Ashley [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi, 9. janvier 2008 04:05
À : The elegant MVC web framework
Objet : [Catalyst] POD viewer

Through a somewhat shallow search (difficult terms to search out  
effectively) of the archives and search.CPAN I can't find if anyone  
has hacked up a Cat based POD viewer/Controller; like the modperl  
Apache one but, one hopes, without the (early?) security issues.

I want to be able to share internal POD at work to encourage both its  
reading and writing.

Thanks!
-Ashley


Hi Ashley,

I've hacked up a pod viewing app : see Pod::POM::Web. It's not a Catalyst app, 
but it's a web app, sitting in mod_perl or cgi-bin or its own Http server, and 
serving all pod installed in your @INC.

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/


RE: [Catalyst] State of the art in form validation; opinion poll. Model based forms/validation?

2007-12-05 Thread Dami Laurent (PJ)
-Message d'origine-
De : Ashley Pond V [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi, 5. décembre 2007 02:47
À : The elegant MVC web framework
Objet : [Catalyst] State of the art in form validation; 
opinion poll... Model based forms/validation?

I'm playing with CP::FormValidator::Simple and I like it all right  
but I feel like there must be something better than it and  
CP::FormValidator.

[snip]
I'm leaning more and more to having *all* of this stuff defined  
(validation patterns, user messages for invalid input, clues for CGI  
fields) in the Model (DBIC; I love it and never find time to try  
Rose). Sort of a super phat Model. If it's not defined exclusively  
there, it ends up defined there (via schema), the controller,  
possibly the templates (messages), and even client-side in JS. I know  
I'm showing my tremendous grasp of the obvious when I say, this is  
just effing awful.

What are best practices? DBIx::Class::Validation reusing your form  
package profiles? But you still have to write your own forms. I've  
searched around a lot and can't find a thorough, coherent Catalyst  
related doc about it.

I really want one, final approach to this I'll use every time from  
now on instead of experimenting with packages and home rolled stuff  
over and over. If someone is there, or even close. Please kick down.

As always, I appreciate everyone's time and expertise.

Thanks!
-Ashley


Hi Ashley,

We are building a big application for State of Geneva, and here is what we do :

- assemble HTML forms using plain Template Toolkit. Initial values are all 
empty. Field names use a dot notation à la CGI::Expand.

- initial data is passed as a JSON tree, and some javascript code on the 
client-side fills the form from that tree. Users can also save the tree locally 
and reload it into the form later.

- upon submit, the form data is sent through Ajax. The server pipes that data 
into CGI::Expand, and then into Data::Domain. If the data is OK, it performs 
the action; otherwise it returns a JSON tree of error messages. Javascript code 
on the client-side navigates through these messages and puts the focus on 
appropriate fields.

So all business rules and error messages are described in Data::Domain. The 
actual data storage is maintained independently by the DBA, directly within the 
database. Inbetween sits DBIx::DataModel, a thin ORM that deals mostly with 
associations through primary and foreign keys, but knows very little about 
other columns (data just passes through). 

So in contrast with some other approaches, here the data description is not 
centralized : if you add a new field, you have to act on the database, on the 
Data::Domain validation rules, and on the Template displaying the form. For 
quick scaffolding of an application, this would definitely be slower, but in 
the long run it pays off, because each component does just what it knows best 
to do : storing the data, presenting the data, validating the data. And you can 
have different people with different skills maintaining these 3 sides.

This approach was presented at YAPC::EU::07; you can grab the slides at 
http://laurent.dami.free.fr/slides/YAPC07/

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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Charset best practice

2007-11-01 Thread Dami Laurent (PJ)

-Message d'origine-
De : Dominic Germain [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi, 31. octobre 2007 22:04
À : The elegant MVC web framework
Objet : [Catalyst] Charset best practice

Hi,

We are currently building an application using Catalyst framework and  
have a lot of encoding problem.  Since we use a lot on french  
characters (like é-è-ê-à-ç), we need to take care of the encoding of  
Perl module and TT templates.

We have a running setup with Perl module in ISO-8859-1 (latin1) and  
templates in UTF-8.  That strange match works great under 
Apache using  
mod_perl.  All french characters are parse correctly even if they are  
from templates, Perl code or MySQL db.

If we run the app. under Catalyst dev. server, everything goes  
wrongs.  We have a lot of gremlins instead of correct char.  We are  
unable to figure out what should be done to have correct 
output in all  
case.

Our setup :

   Apache charset : ISO-8859-1
   In TT's view : ENCODING = 'ISO-8859-1'
   All Perl and TT file save in : ISO-8859-1

Are we on the good way?

Dominic Germain
-
Administrateur réseau / Network administrator
Sogetel
www.sogetel.net

[EMAIL PROTECTED]


Salut Dominic,

We also run a Catalyst app in french and iso-8859-1. 

Catalyst::View::TT is hardcoded in UTF8. So the trick is to define a subclass 
in which you override the process() method, and there you set 
$c-response-content_type('text/html; charset=iso-8859-1');

Bonne chance, L. 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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/