Re: [Catalyst] CatalystX::CRUD

2007-09-23 Thread Perrin Harkins
On 9/23/07, Matt S Trout [EMAIL PROTECTED] wrote:
 Do you have any thoughts on how to paper over DBIC's ability to chain searches
 vs. the lack of that feature in RDBO?

Isn't it primarily a way to build up your search criteria with
multiple small method calls instead of one big one?  It doesn't seem
very relevant to a CRUD app where all the criteria come in at once
from a web form.

- Perrin

___
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] CatalystX::CRUD

2007-09-23 Thread Perrin Harkins
On 9/23/07, Matt S Trout [EMAIL PROTECTED] wrote:
 You've never implemented a saved search function that allows you to
 'search within' a saved search?

That's usually not a difficult problem, since you already have a way
to turn criteria from a web form into a search, and you're just adding
one more criterion to the pile.

 You've never done a view all posts owned by the selected set of users link?

 This sort of thing in DBIC just becomes

 $posts_rs = $users_rs-search_related('posts');

 whereas (so far as I'm aware, please do correct me if I'm wrong) it's a bit
 more work in RDBO.

I'm not an expert on RDBO, but I believe you would need to call a
different class (the posts class, not the users) and adjust the
criteria you pass, e.g. change last_name = 'Smith' to
user.last_name = 'Smith'.

Any set of ORM tools is going to have different unique features, and a
full abstraction would mean giving up all of the unique features.
However, it looked like Peter was trying to do something at a pretty
high level where hopefully the differences don't come into play much.

- Perrin

___
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] Catalyst and Informix

2007-09-03 Thread Perrin Harkins
On 9/3/07, Robert Carew [EMAIL PROTECTED] wrote:
 Has anyone used Catalyst with an Informix database and if so which ORM are
 you using and what advice can you offer?
 Any pointers in either getting DBIC to work with Informix or RDBO with
 Catalyst would be gratefully received.

If you search the Catalyst archives, you'll find some posts on both
Informix and RDBO:
http://www.mail-archive.com/catalyst@lists.rawmode.org/

- Perrin

___
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] CMS

2007-08-23 Thread Perrin Harkins
On 8/23/07, Cory Watson [EMAIL PROTECTED] wrote:
 I want something manages and
 version my templates and then a view that lets Cat retrieve the
 appropriate template through some means.

You can do something like that with Krang or Bricolage.  They both
publish files rather than serving the content themselves.  You can
publish files that are templates for your Catalyst app to use, and
even publish metadata files with them that tell the app how to behave
on this page.  We did something like this with Krang at Plus Three,
using CGI::Application to serve the published templates.  There's a
thread in the Catalyst archives with more details about it.

However, both Krang and Bricolage are far more complicated than RCS.
They handle permissions, workflow, and templating of static pages.
That may be more than you want.

- Perrin

___
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] A Perl Message Queue?

2007-08-23 Thread Perrin Harkins
On 8/23/07, tprinty [EMAIL PROTECTED] wrote:
 Have you looked at memcache?

Don't put your messages into memcached unless you don't mind losing
some.  It is not a database or reliable storage.  It's just a cache.

- Perrin

___
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] A Perl Message Queue?

2007-08-23 Thread Perrin Harkins
On 8/23/07, Ash Berlin [EMAIL PROTECTED] wrote:
 Don't use a DB as the backing store for a message queue if you will ever
 need to pass a lot of messages thought it - you're just asking for
 trouble doing it that way.

Like most things, it depends.  If you need ACID properties for your
messages, using a database will be a lot easier than building your own
special-purpose ACID database.  And you probably already have some
work invested in making your RDBMS scale, so it doesn't add a new
point of failure.

But sure, if you have the money for commercial IBM stuff, it works.
Some of the open source Java solutions may be viable too.

- Perrin

___
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] Rate limiting password attacks

2007-08-17 Thread Perrin Harkins
On 8/17/07, Bill Moseley [EMAIL PROTECTED] wrote:
 I missed something along the way in this thread.  Cookies?  Is that to
 block a specific client?

Yes, as opposed to an IP that could be a proxy.

 I'm just thinking of blocking specific logins when too many failed
 logins are attempted.

That works if they keep hitting the same login with different
passwords.  Are you concerned about them trying many logins with a
common password?  (secret)  That wouldn't be caught.

- Perrin

___
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] Rate limiting password attacks

2007-08-16 Thread Perrin Harkins
On 8/16/07, Bill Moseley [EMAIL PROTECTED] wrote:
 I'm looking for ideas on how to implement a way to detect and block
 dictionary attacks.  This is not a question of how to implement strong
 passwords, but rather the act of limiting logins when too many failed
 passwords have been attempted in some period of time.
[...]
 Anyone doing something like this already?  Suggestions? Caveats?

Yes, there's a plugin that Sam Tregar developed for CGI::Application:
http://search.cpan.org/~samtregar/CGI-Application-Plugin-RateLimit-1.0/RateLimit.pm

This was used in Krang (http://krangcms.com/) for exactly what you're
describing: limiting login attempts.

You could adapt that design.  It uses a database for storage, which
ought to be fine unless you have massive traffic hitting this login
page, but I don't see any reason your memcached idea wouldn't work.

I also did one of these years ago just to limit the number of hits to
a URL from a specific client within a window of time.  It was based on
Randal's code here:
http://www.stonehenge.com/merlyn/LinuxMag/col17.html

I modified it to use a (verified) cookie instead of an IP if possible
and to count hits rather than CPU.  It just returned a Forbidden error
when people exceeded the limit.  At the time, it was a neat design
because it just used tightly packed data in files, so no locking was
needed and no database.  Today I would use a database instead.

- Perrin

___
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] Serving server-dependent static content

2007-08-12 Thread Perrin Harkins
On 8/12/07, Peter Lytle [EMAIL PROTECTED] wrote:
 If someone has a  solution from the Apache side, that's fine but I suspect 
 that it might be
 easier  to do this with Catalyst::Plugin::Static::Simple

Don't serve static content through perl.  Let your webserver do it.
Usually people just set up virtual hosts with different
DOCUMENT_ROOTs.  Is there a reason that won't work for you?

- Perrin

___
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] Serving server-dependent static content

2007-08-12 Thread Perrin Harkins
On 8/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 a lot of times, 'static' content is found via database queries.  and
 sometimes that content needs to be protected from unauthorized viewers,
 and your authorization mechanisms are already built into your application,
 so you can't just use Alias/Rewrite directives to still have apache serve
 up that tree.

 that said, is there a way to have catalyst defer back to the web server,
 after deciding not to issue a 403?

If you use mod_perl, you can do this with a $r-set_handler call.

Other things that would work:

mod_auth_tkt.  You set an auth token when people log in, and then you
can specify group-based content protection for your static files on
your front-end proxy server.  This works really well.

Perlbal, created by the LiveJournal crew.  It's a proxy server that
can make a request to your backend app just for auth and then server
the static file itself.

- Perrin

___
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] do I need to load Apache::DBI?

2007-08-01 Thread Perrin Harkins
On 7/31/07, Matt S Trout [EMAIL PROTECTED] wrote:
 Except in the DBIx::Class, Class::DBI and plain DBI apps I've brought back
 to production quality stability by removing it.

DBIx::Class and Class::DBI both handle connection caching on their
own, so that is not where one would need Apache::DBI.  It's meant to
be used with plain DBI apps that aren't already doing connection
caching.  I will get the Apache::DBI docs updated to make this clear.

 There's no implication - sometimes it doesn't work. Mostly it does. 
 Producing
 a repeatable test case has proven pretty much impossible due to the hackiness
 of the implementation.

Usually when people have trouble it's due to clashes with some other
code that was trying to cache connections.  If you find a situation
like this again, a bug report of some kind would be appreciated.

- Perrin

___
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] flash with DBIC session storage

2007-07-30 Thread Perrin Harkins
On 7/27/07, Tobias Kremer [EMAIL PROTECTED] wrote:
 While hammering my site with ab (Apache bench) I'm getting loads of the
 the following error message:

 Couldn't render template undef error -
 DBIx::Class::ResultSet::find_or_create(): DBI Exception:
 DBD::mysql::st execute failed: Duplicate entry
 'flash:4f1bddce6c7828c27b2e47265f614109d4c21f19'
 for key 1 [for Statement INSERT INTO sessions (id) VALUES (?)
 with ParamValues: 0='flash:4f1bddce6c7828c27b2e47265f614109d4c21f19']
 at /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/
 Session/Store/DBIC/Delegate.pm line 52

 Any ideas what's going on here and how to fix it?

Looks like you have a unique constraint on session.id and you tried to
insert the same one twice.  That sounds like a bug in your session
module to me.  It should be doing an update here, not an INSERT.
Something must be confusing it.

- Perrin

___
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] do I need to load Apache::DBI?

2007-07-30 Thread Perrin Harkins
On 7/24/07, Matt S Trout [EMAIL PROTECTED] wrote:
 Apache::DBI is an awful hack and should be avoided where possible.

Kind of an exaggeration.  Apache::DBI is a useful module for porting
existing CGI scripts to mod_perl.  If you aren't porting CGI scripts
to mod_perl, you can use other tools like DBI-connect_cached instead.
 The main differences are that Apache::DBI disables disconnect(), to
allow for porting CGI code that disconnects after every request, and
Apache::DBI does a rollback at the end of every request to avoid
accidental commits of bad data when code dies during a request.

- Perrin

___
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: [BULK] - Re: [Catalyst] flash with DBIC session storage

2007-07-30 Thread Perrin Harkins
On 7/27/07, Jonathan T. Rockway [EMAIL PROTECTED] wrote:
 On Fri, Jul 27, 2007 at 11:57:01AM -0700, Mesdaq, Ali wrote:
  Are you sure that InnoDB would solve this issue? Even if just a row was
  locked and you have 2 inserts at the exact same time how would that
  resolve the issue?

 One transaction would succeed and the other would fail.  If you want
 different behavior, you'll have to change the isolation level (or
 actualy, in this case, rethink your app).

In custom database code this is true, but usually session APIs handle
this kind of thing for you.  They typically provide exclusive locking
while a session is being used, through SELECT...FOR UPDATE or
similar.  Even a session module that explicitly doesn't provide
exclusive locking should be able to avoid doing a duplicate insert.

- Perrin

___
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] do I need to load Apache::DBI?

2007-07-30 Thread Perrin Harkins
On 7/30/07, Matt S Trout [EMAIL PROTECTED] wrote:
 I used to consider it a neat hack. After some time with the internals,
 some fun explicitly disabling it within DBIC since it sometimes broke our
 reconnect code, and even then discovering I could often solve client mod_perl
 problems by removing the line that loaded it from httpd.conf, I reclassified
 it was 'awful'.

Your implication is that Apache::DBI doesn't work, as opposed to
simply clashing with some of the DBIC code that tries to manage the
same connections.  It works just fine.  It's widely-used and does what
it was intended to without known bugs.

Apache::DBI provides an important service for people trying to port
CGI code to mod_perl, by both making their connections persistent and
fixing the most common mistakes in homegrown persistent connections
(accidental copying across forks, ping check after inactivity, auto
cleanup after crashed requests).

The implementation is sneakier than I normally like to see because not
requiring client code changes is one of its design goals.  For that
reason, I wouldn't recommend it to people who are starting fresh with
a new codebase and are able to write it specifically for a persistent
environment like mod_perl.  Most of them will use another tool that
already handles connection persistence, like an ORM.

If someone out there wants to use DBIC (or another tool that manages
its own connections) in the same process as some code that needs
Apache::DBI, they should feel free to ask for help on the mod_perl
list.  I don't think it would be a hard problem to fix.

- Perrin

___
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] TT2 + CP::Authentication + DBIC gotcha

2007-07-13 Thread Perrin Harkins

On 7/13/07, apv [EMAIL PROTECTED] wrote:

[% vote = Catalyst.user.votes({word = w.id}) IF Catalyst.user_exists %]


Just FYI, you should never do this type of construct in perl.  It will
break in bizarre ways.  I doubt that's the issue with TT, but don't
get in the habit.

my $vote = $foo if ($bar);  # --- bad!

- Perrin

___
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] TT2 + CP::Authentication + DBIC gotcha

2007-07-13 Thread Perrin Harkins

On 7/13/07, J. Shirley [EMAIL PROTECTED] wrote:

As anecdotal evidence to its insidious behavior, I've personally been
involved in a 5 man debugging effort that took 13 days (not full days,
but probably an average of 3-4 hours a day * 5 people * 13 days) to
finally find the bug.  Which was simply my $foo = $bar if $baz;

The reason why it was so hard to track down was because ot he
wonderful undefined behavior.


I had a similar experience, which is why I always mention when I see
it in other people's code now.  It's a real problem and very hard to
track down if you haven't heard of it before.

- Perrin

___
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] using a persistent hash in a model

2007-07-10 Thread Perrin Harkins

On 7/10/07, Jonathan Rockway [EMAIL PROTECTED] wrote:

BerkeleyDB has an RPC layer for talking to remote clients.


Interesting.  I had never heard of this before.  It looks kind of
rudimentary.  The docs say it's only single-process at this point, so
it serializes all data access.


I find the docs sufficient:


They can be rough going for someone who doesn't speak C and is trying
to figure out the right flags to use or how to deal with deadlocks.
It's all there though.


I don't think the word database implies anything about locking (or
relations, or ACID)...


The OP used the word database to mean RDBMS.  That's what I was referring to.


BerkeleyDB locking is pretty flexible.  The transaction system supports all
the isolation levels that you would expect.


I was specifically thinking of multi-version concurrency control.
According to the docs, BerkeleyDB added this in version 4.3, which is
great.  That means you can set it so that readers don't block writers.

The biggest problem I've had with the fancier locking modes was
deadlocks.  The included deadlock daemon didn't seem to help, probably
because I wasn't using it correctly.  This may have improved as well.

- Perrin

___
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] Apache strange output with mod_perl

2007-07-10 Thread Perrin Harkins

On 7/10/07, Cookie [EMAIL PROTECTED] wrote:

When I start my apache server with mod_perl,I found some strange
output.I don't know how to solve this problem?


Usually this means you upgraded perl and didn't recompile mod_perl, or
your modules.

- Perrin

___
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] using a persistent hash in a model

2007-07-07 Thread Perrin Harkins

On 7/7/07, Daniel McBrearty [EMAIL PROTECTED] wrote:

Is there any easy way to keep some ad-hoc persistent data out of the database?


Sure.  Most of them are either lossy or tricky to use, and tend to be
poor for concurrent reading/writing.

The obvious options are:
- BerkeleyDB.  Fast, but limited to one machine, and tricky to get
right because of insufficient docs for the advanced locking features.
Still, a good bet.
- Cache::FastMmap.  Fast, but lossy.  Will silently drop your data if
you go over the limit you set.  Limited to one machine.
- Cache::Memcached.  Fast (although much slower than BerkeleyDB or
Cache::FastMmap), but lossy.  Silently drops data if you go over the
limit you set.  Loses everything if the daemon is stopped for any
reason.  Works for a cluster though.

None of these have the same locking capabilities that a database does,
i.e. writers block readers and there's no easy way to do pessimistic
locking.  (I think BerkeleyDB supports pessimistic locking, but I
can't remember for sure.)

If you already have a database, using it will be easier than getting
any of these right.

- Perrin

___
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] Re: How to access current MyApp instance ?

2007-07-05 Thread Perrin Harkins

On 7/4/07, Jonathan Rockway [EMAIL PROTECTED] wrote:

I agree that this is a terrible way to do things.  Perl has the right idea
with $sigils, so at least functions look different from other @things.  Oh,
and you know... a lexical scope.


If you feel the need for complicated scoping rules in your templates,
you probably should be using in-line perl in them rather than a
mini-language.  There are plenty of options for that, including TT2.

For those out there who like TT2's mini-language, I've been using it
for many years without ever encountering any of the problems described
in this thread.  I never add any variables to the stash from inside my
templates (temporary loop variables excluded), avoid MACRO (I only use
PROCESS), and generally keep the templates  very, very simple.  And I
have documentation that describes the data structure that will be in
the stash for each page.

Templates aren't normal code (even with in-line perl) and they don't
handle complexity like real code does, so you have to control your
impulse to turn them into thousands of little components.  It just
gets too confusing.

- Perrin

___
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] Re: How to access current MyApp instance ?

2007-07-05 Thread Perrin Harkins

On 7/5/07, A. Pagaltzis [EMAIL PROTECTED] wrote:

That's what I was advising, basically, except that I would tell
people to use INCLUDE instead of PROCESS.

Else you'll be violating your own rule not to add variables to
the stash from inside a template, as soon as any of your blocks
are parametrisable.


I don't normally make blocks parameterizable.  I treat them like dumb SSI.


The question is whether this is intrinsic to templates or simply
a consequence of the extensive limitations of the TT language.


I think it's intrinsic to templates.  They lack the resources that a
real programming language has for managing complexity.  I think the
only way around the need for simple templates would be to take a
widget-based approach where you don't directly write any HTML.  The
Bivio guys made this work.  It's not for everyone though.  It takes
discipline.

My other motivation for simple templates is that I like to get other
people to write the HTML.  They have to simple enough to hand to a
stranger without elaborate explanations.

- Perrin

___
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] apache2/mod_perl virtualhost misfire --

2007-06-28 Thread Perrin Harkins

On 6/28/07, Dwalu Z. Khasu [EMAIL PROTECTED] wrote:

I'm hoping someone with more sleep than I, can help me spot what seems to
be a simple  nasty misconfiguration :s


I don't think you've shown enough of the config file to help you.  You
could look at the examples in the apache docs:
http://httpd.apache.org/docs/2.0/vhosts/examples.html


However I can't access the app via the vhost config.


Try accessing a static file through the vhost.  If that doesn't work
either, then you know it's not a Catalyst problem.  Check the headers
you're sending to make sure they include a Host: header matching your
ServerName directive.

- Perrin

___
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] :Template() Attribute

2007-06-15 Thread Perrin Harkins

On 6/15/07, Christopher H. Laco [EMAIL PROTECTED] wrote:

Imho, :Template('foo') is a lot more elegant than $c-stash-{'template'}


The trouble with putting things in attributes instead is that the sub
declarations start to get really long and ugly, and you can't wrap
attributes to another line.  Readability of attributes in general is
pretty poor, IMO.

- Perrin

___
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] flexible attributes on db objects

2007-06-08 Thread Perrin Harkins

On 6/8/07, Daniel McBrearty [EMAIL PROTECTED] wrote:

Comments? horrendous hackery? laziness? a landmine? ok in some cases?


It's pretty well covered by Wikipedia here:
http://en.wikipedia.org/wiki/Entity-Attribute-Value_model

I sometimes use this in places where I have to let end users add
attributes to objects, but the poor performance and lack of integrity
constraints make it a poor choice for anything else in my opinion.

- Perrin

___
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] template toolkit caching

2007-05-31 Thread Perrin Harkins

Hi guys,


I believe Template::Plugin::Cache will do what you want. Perrin (the author) has
a patch from me that lets you pass in the Cache object from Catalyst and use
that, so any supported backend is available. If you bug him, I'll bet he'll get
a new version up on CPAN. ;)


Yes, sorry I haven't put that up yet, Peter.  Coming soon.

John, are you trying to change the way that TT stores the compiled
templates?  My module doesn't affect that.  It offers a way to cache
the generated output from templates.

To change how compiled templates are stored, you would override (I
think) Template::Provider and change the Template configuration to use
your version.  In my opinion, this wouldn't really be worth the effort
though, since the compiled code is stored in memory after the first
hit in each process.

- Perrin

___
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] template toolkit caching

2007-05-31 Thread Perrin Harkins

On 5/31/07, John Goulah [EMAIL PROTECTED] wrote:

Thanks for the feedback.  Yes I was looking more for a way to cache the
compiled templates in memcache.  The reason being with many servers the
compiled template could  be shared amongst the servers so that its only
compiled once.  Maybe that doesn't buy much, but it probably depends on how
many templates and servers are in the mix-


Maybe less than you think.  TT uses a two-step caching process.
First, it compiles your template to perl code and caches that
generated code to disk.  This step is the slowest part, and it's done
once per machine.  That's what you would be saving by using memcached
-- one compile per template per machine.  This compile doesn't happen
again until you change the templates.

The second step is loading that perl code and compiling it to a sub in
memory.  That happens once per process and no external cache can help
with it, since it's compiled perl code in memory.

- Perrin

___
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] Duplicate session ids

2007-05-26 Thread Perrin Harkins

On 5/26/07, Bill Moseley [EMAIL PROTECTED] wrote:

Perhaps an easier way to show the problem with duplicate created
sessions would help.


Do you mean duplicate or multiple?  The session ID generation code in
Catalyst::Plugin::Session does look like it could generate duplicates
to me, but that would be rare and unpredictable.

- Perrin

___
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] Duplicate session ids

2007-05-26 Thread Perrin Harkins

On 5/26/07, Jonathan Rockway [EMAIL PROTECTED] wrote:

Please keep in mind that by rare, he means that you would have to generate
2317195645184714165087019331424 sessions per second for 100 years in
order to have a 50% chance of colliding with an existing session.


Or you could have it happen on the first try.  It's just probability.

If duplicate session IDs are a major concern for your application,
generating them from mod_unique_id or a database sequence should
prevent the possibility, and verifying your cookies with a MAC of some
kind will prevent people from taking advantage of predictable IDs.

It doesn't sound like this is the problem Bill was talking about though.

- Perrin

___
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] Two Strange Catalyst/Apache Issues

2007-05-24 Thread Perrin Harkins

On 5/24/07, Randy J. Ray [EMAIL PROTECTED] wrote:

PerlModule Bylines# This is line 259


This recommended way to do this in mod_perl is actually to make a
separate startup.pl file that loads your modules, not to list them in
httpd.conf.  Then you call it with PerlRequire.  You can find
documentation and examples here:
http://modperlbook.org/html/ch04_02.html

To try it with your setup, just make file called startup.pl with this in it:
use Bylines;

and then call it from httpd.conf:
PerlRequire startup.pl

- Perrin

___
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] Constants that refer to rows in a lookup table.

2007-05-23 Thread Perrin Harkins

On 5/22/07, Bill Moseley [EMAIL PROTECTED] wrote:

So, what have you found that works nicely?

use MyApp::Const qw/ cart_pending /;  # potentially long list
cart_status = cart_pending  # runtime checking

use MyApp::Const qw/ :cart /; # Shorter list :)


cart_status = MyApp::CONST::pending, # global constants


# Make it very clear where a constant should be used
# by adding the constants as methods to the cart namespace

cart_status = $cart_class-pending_status


I think I've done all of these over the years.  Adding them as methods
is probably my favorite, but importing constants is okay (although I
use $CART_PENDING_STATUS so it will interpolate in strings).  Put the
constants in the cart class -- MyApp::Const becomes a mess very
quickly.

What bothers me about these is that I have the constants in two
places, but elaborate schemes to read them on startup always seemed
like they create more problems than they solve.

If I had one where the contents changed a lot at runtime, I would just
make a real ORM class for the lookup table and hope that my database
caches queries well.

- Perrin

___
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] ActiveRecord for Perl

2007-05-22 Thread Perrin Harkins

On 5/22/07, mla [EMAIL PROTECTED] wrote:

If I may ask, Perrin, what do you use?


I have a large system that was started back when Class::DBI was a hot
new thing.  It still uses CDBI and hasn't really had a good reason to
change, since we use a lot of custom SQL and that's pretty easy to do
with CDBI (and performs well).  For new projects, I'm trying
Rose::DB::Object.  I had good success using the query builder from
RDBO on its own for one project.  A lot of the database work I do
doesn't go through any ORM because it involves complex reporting.

There are some good features in the other ones too.  Tangram is a
pretty amazing accomplishment.  DBIx::Class abstracts some things that
the others don't, making it more flexible.  RDBO seems to suit me best
at the moment though.

- Perrin

___
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] Catalyst with apache, how to auto restart like run myapp_server.pl -r?

2007-05-21 Thread Perrin Harkins

On 5/21/07, Cookie [EMAIL PROTECTED] wrote:

But I don't think when I modify my lib files,the modification seems not any
effect.And I must restart my apache to make it available.
My question is:
Is there any way to configurate my apache configuration files to be
available that I don't need to restart my apache server?(Like I run
myapp_server.pl -r)


The usual way to handle this during development on mod_perl is to use
Apache::Reload.  However, there were reports that this doesn't work
with Catalyst because of the way it stores state information.  You can
try it and see.

There is no way to automatically pick up changes which is really
recommended for use in a production environment running mod_perl.  The
problem with things like Apache::Reload is that they ruin the
copy-on-write sharing of memory by modifying memory in each child
process, and this makes your application use more real memory.

It typically only takes a couple of seconds to do a stop and start of
a mod_perl server, so in practice this isn't a big deal for most
people.  A larger site will usually have a cluster of servers and a
load balancer that lets them restart their servers in sections.  You
can find more discussions of this in the mod_perl mailing list
archives.

- Perrin

___
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] Form validation in insert() and update()?

2007-05-15 Thread Perrin Harkins

On 5/14/07, Dave Rolsky [EMAIL PROTECTED] wrote:

  eval
  {
  $user-update( %bunch_of_stuff );
  };

  if ( my $e = Exception::Class-caught( 'My::App::Exception::DataValidation') )
  {
  # $e-errors contains multiple data validation error messages
  # stuff them in the session
  # save the user's form submission in the session
  # redirect back to form
  }
  elsif ( my $e = $@ )
  {
  die $e;
  }


Although there's no real problem I know of with using exceptions this
way, I've gotten away from using them for expected user input
mistakes.  There's no need for the flow control they provide in this
kind of scenario, since you're going to keep going long enough to
collect all the input mistakes anyway.  It makes more sense to me to
just use a separate validate call and a normal data structure for this
and save exceptions for times when you actually need to bail out of
something.

Right now, I just check the input with Data::Form::Validator and
convert the results it returns into error message names, which are
then mapped to strings for display.  The mapping allows the messages
to be overridden for a specific form (this code uses
Class::PhraseBook) so that they can be context-specific.

- Perrin

___
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] running catalyst through mod_perl

2007-05-15 Thread Perrin Harkins

On 5/15/07, John Goulah [EMAIL PROTECTED] wrote:

I would assume 256 MB is enough to start apache.


It is.  Apache's memory requirements are pretty light and mod_perl
doesn't have much overhead either.  It's really the perl interpreter
and the code you're loading that matters, as well as whatever else is
on that box that would use up memory.

A good tool for checking this on Linux is /usr/bin/free.


I assume mod_perl has been tested and runs fine
under apache 2.2.x


It does, although the APIs for the new auth features are not all
available from perl yet.

- Perrin

___
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] Form validation in insert() and update()?

2007-05-15 Thread Perrin Harkins

On 5/15/07, mla [EMAIL PROTECTED] wrote:

And where do you handle the validation? Only in the controller or in
both the model and controller?


In the form processing code.  This system has a CMS where users get to
generate forms and decide which fields will be on specific forms, so
the required fields depend on the actual form being used.  It could be
separated out better, MVC-wise, but in practice that would be wasted
effort for this system.

There are additional constraints in the database to prevent
accidentally putting in broken data, and a few in perl (with
Params::Validate in the model objects) where they would be difficult
to code in the database.


Could you give a short example of taking an actual field from the
request parameters, validating it, and updating a row with it?


The actual system has a lot of complexity coming from things that
aren't directly related to your question, so it's hard to show a
literal code snip.  The form handling classes are structured so they
follow this basic recipe when a form is submitted:

- Get a Data::FormValidator profile from the form class.
- If the input passes validation:
 - Run the fullfill_request() method for this class.
 - Show the response page.
- If the input fails:
 - Translate the Data::FormValidator results object into error codes
 - Hand the codes to our message class which looks up the local error
text and adds it to the template data.
 - Re-display the form with the messages at the top and the problem
fields highlighted.

This is handled by a base class so in most cases you only need to
write a form profile and a fulfill_request() method to add a new type
of form.

No attempt is made to handle errors that come from the database or
model objects called from fulfill_request().  Errors at that point are
real errors, i.e. unexpected and indicating a bug, not a user input
mistake.  They result in a friendly error screen and a detailed log
message.

- Perrin

___
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] Deployment of many Catalyst sites on the same machine

2007-05-15 Thread Perrin Harkins

On 5/15/07, Ian Docherty [EMAIL PROTECTED] wrote:

What would you suggest for multiple instances of the same application?

MyApp  = 'first.example.com'
MyApp = 'second.example.com'

I presume there would be no choice in this case but to use an fcgi
handler for each one and mod-perl can't be used at all in this case?


It seems like most applications should support that with no problem.
The only time it's an issue is when you want to run separate versions
of the same module in each one, i.e. Foo.pm is different under the
first and second.  Or if you used package variables for data that
should have been instance specific.

The standard solution for mod_perl in that case would be to run a
separate mod_perl backend for each, essentially the same as for FCGI.

- Perrin

___
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] Shoot out -- Catalyst / RoR / Other MVC apps --

2007-05-08 Thread Perrin Harkins

On 5/8/07, Luis Azevedo [EMAIL PROTECTED] wrote:

What I still not understand is why he says RoR isn't MVC O:).


The way most people use Rails and Catalyst is somewhat different from
the MVC concept.  The traditional role of the controller is just to
map user input to a method, and nothing more.  All of the business
logic is supposed to be in the model.

Most users of RoR and Catalyst put a bunch of code in what gets
referred to as the controller and call auto-generated ORM classes the
model.  Most of the code they put in the controller is really the
model too.

If you just change your naming and refer to RoR/Catalyst controllers
as models and your web server + the RoR/Catalyst code as the
controller, it would fit the MVC concept better.  It won't solve the
issue of wanting to reuse your model code in a non-web environment
though.  For that, you'd need to keep that code in some kind of
separate model classes, or fold it into your ORM classes.

All that said, the typical approach works fine for most people.  It
just doesn't fit MVC very well.  Maybe it needs its own name, like HDT
(Handlers, Database objects, Templates).

- Perrin

___
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] Shoot out -- Catalyst / RoR / Other MVC apps --

2007-05-08 Thread Perrin Harkins

On 5/8/07, Dave Rolsky [EMAIL PROTECTED] wrote:

There's a little more than just mapping input to a method. I think of it
as a translation layer between how the web server presents data and how my
model API wants it. And then there's reverse mapping, for example
translating exceptions thrown by the model into error messages we can show
to the user.


Both good points.  My post was over-generalized and glossed over some
things.  Your point about separating the model from the environment is
the real heart of the issue.


One consequence of doing MVC the right way, though, is that you tend to
up with rather large and complex sets of model classes.


I think it's fine for people to shortcut this and shove model stuff
into their RoR/Catalyst controller classes, as long as they understand
the trade-off they are making, i.e. it will be difficult to separate
this code and reuse it elsewhere.

- Perrin

___
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] Handling slow uploads externally

2007-04-12 Thread Perrin Harkins

On 4/12/07, Brian Kirkbride [EMAIL PROTECTED] wrote:

Now I'd like to avoid tying up the heavy procs for slow uploads.  Many suggest
to run upload handlers as CGI rather than mod_perl because the 1s startup time
is negligent compared to the time required to upload.  I have tried this and it
works, but it still creates a 60+ MB process to sit around for 2 minutes while a
dial up user uploads a huge image.


Yeah, I was reading that and thinking that you'll probably use more
memory for CGI, since you still have to run perl but you don't get any
copy-on-write benefit.  It could be offset by loading as few modules
as possible into the CGI, but that seems kind of ugly.

A better solution would be a proxy that buffers uploads.  I thought
mod_proxy would do this for you.  Are you certain that it doesn't?  If
so, take a look at the other proxy options out there.

- Perrin

___
List: [EMAIL PROTECTED]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Handling slow uploads externally

2007-04-12 Thread Perrin Harkins

On 4/12/07, Brian Kirkbride [EMAIL PROTECTED] wrote:

It doesn't look like mod_proxy, which I am currently using, supports this.  It
looks like Perlbal does however.  Any other suggestions?


Since I always use mod_proxy, I can't vouch for any others.  I've seen
people mention nginx, pound, and pen.

It might also be worth asking about this on the mod_proxy list, or
checking the archives.

- Perrin

___
List: [EMAIL PROTECTED]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] streaming output to view in real time

2007-04-11 Thread Perrin Harkins

On 4/10/07, Jimmy Cooksey [EMAIL PROTECTED] wrote:

I'm looking for a way to redirect STDOUT from an external application
directly into my website, updating in real time.


Randal Schwartz wrote a good example of how to do this with a forked
process and some kind of shared data store:
http://www.stonehenge.com/merlyn/LinuxMag/col39.html

- Perrin

___
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] Swish-e

2007-03-22 Thread Perrin Harkins

On 3/22/07, Jim Spath [EMAIL PROTECTED] wrote:

I was just wondering if anyone here had used Swish-e in a Catalyst
application before.


I have used it from CGI::Application, but not from Catalyst.  It's a
great search system.  Very fast, easy to configure and customize,
indexes large sets of documents very quickly.  I recommend it.

- Perrin

___
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] Swish-e

2007-03-22 Thread Perrin Harkins

On 3/22/07, Jim Spath [EMAIL PROTECTED] wrote:

What about Xapian?


Never used it.


I noticed that it has some Catalyst support in the form of
Catalyst::Model::Xapian.


As long as a module has a decent perl API, you don't really need a
Catalyst::Model class to use it.  You should be able to use any of the
ones you mentioned from Catalyst.


Xapian also seems like a possible long term solution as it can handle
more documents that Swish-e or KinoSeach.


Could be.  The biggest complaints about SWISH-E are lack of UTF-8
support and lack of incremental indexing.  It indexes very quickly, so
in practice I haven't seen the latter as an issue, even on large
sites.

- Perrin

___
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] Apache2+fcgid or Lighttpd

2007-03-19 Thread Perrin Harkins

On 3/19/07, Toby Corkindale [EMAIL PROTECTED] wrote:

ie. Where apache would spawn more and more processes, chew loads of
memory, and then hit MaxClients and stop accepting connections


Incidentally, apache doesn't stop accepting connection when it hits
MaxClients.  It just stops spawning processes.  The rest of the
connections get accepted and queued up to a configurable limit.  See
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients

- Perrin

___
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] PageCache and Apache

2007-03-15 Thread Perrin Harkins

On 3/13/07, vti [EMAIL PROTECTED] wrote:

I have something strange happening while using PageCache plugin and Apache 
server.


If you have apache, you'd probably be better off using mod_cache.  It
will be a lot faster.

- Perrin

___
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: [BULK] - Re: [Catalyst] Template Engine

2007-03-14 Thread Perrin Harkins

On 3/13/07, Mesdaq, Ali [EMAIL PROTECTED] wrote:

 I like the idea of OO based modules and systems. Is that the main
difference between TT and Mason? That is that Mason is OO based and TT
is not?


No.  The main difference is that TT is usually used with it's own
templating language (it supports in-line perl but is very rarely used
that way), and Mason is always used with in-line perl.  In terms of
templating, they really have very similar feature sets.  Mason is much
more than a templating system, and provides a full web development
environment, but you won't get to use most of that from Catalyst.

- Perrin

___
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] Performance

2007-03-09 Thread Perrin Harkins

On 3/9/07, Bill Moseley [EMAIL PROTECTED] wrote:

I just checked and on some pages I'm calling uri_for a few hundred
times.  If that's a bottle neck then optimization would be most
welcome.


I'm sure it depends on your usage, but for Jim Spath it was only about
4% of his time.  It would help, but you probably won't be able to see
the difference.

- Perrin

___
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] Sharing session and login data

2007-02-28 Thread Perrin Harkins

On 2/28/07, Jeffrey Ng [EMAIL PROTECTED] wrote:

we have just improved our session implementation. instead of storing
our session table in mysql database, we stored them in memcache.


Memcached does things like silently drop your data when it runs out of
room.  If the daemon stops for any reason, all of your sessions are
instantly gone (unlike a database where they are safely on disk and
you can restart it).  It is designed to be unreliable storage, since
it's a cache and not a database.

Some sites can get away with it, because they just don't care if they
use all their users' sessions.  Just be sure that your site is one of
those before your start putting your sessions into lossy storage.

- Perrin

___
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] Sharing session and login data

2007-02-28 Thread Perrin Harkins

On 2/28/07, Jeffrey Ng [EMAIL PROTECTED] wrote:

right! thanks for reminding. we probably will put it on a separate
dedicated memcache server then.


That won't help.  If you want reliable session storage with caching,
use memcached as a write-through cache for your database, i.e. when
you write, write to both the database and memcached.  When you read,
try memcached first and then fall back to the database if you don't
find the session.

- Perrin

___
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] Re: memory usage of mod_perl process

2007-02-09 Thread Perrin Harkins

On 2/9/07, Jeffrey Ng [EMAIL PROTECTED] wrote:

  here's the result on a live server:
 
   total   used   free sharedbuffers
cached
  Mem:   415097226540161496956  0
 275481313344
  -/+ buffers/cache:13131242837848
  Swap:  8385912   69208378992

[...]

hi how can you tell our apache is just using 1.3 GB? what king of files does
the rest of it cache?...


Look at the second line of output from free (or free -m, for
megabytes).  It's telling you that you're only using 1313124 bytes for
applications, and the rest is buffers and  cache.

For more info on buffers and cache, try googling it:
http://www.google.com/search?hl=ensafe=offq=linux+free+buffers+cachebtnG=Search

The first hit looks pretty good:
http://gentoo-wiki.com/FAQ_Linux_Memory_Management


can we run devel::DProf with mod_perl catatlyst? or do we have to use
apache::Dprof?


Apache::DProf should work, but I think people often profile catalyst
apps on the test server using Devel::DProf.  There's probably
something on the catalyst site about this if you search for it.

- Perrin

___
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] save session data

2007-02-09 Thread Perrin Harkins

On 2/9/07, Fernan Aguero [EMAIL PROTECTED] wrote:

Now, if I want to have this session data stored into a
diffent db table and with additional data, I imagine I'd have
to write my own Session-Store-DBIC workalike ... or perhaps
it's easier to just dump the structure, encode it somehow
(base64?) and store this as text?


I can't see why you wouldn't store it like any other data in a
database table.  Just make a table structure that fits it and use it
the way you normally use your database.

- Perrin

___
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] memory usage of mod_perl process

2007-02-08 Thread Perrin Harkins

On 2/8/07, Fayland Lam [EMAIL PROTECTED] wrote:

I want to ask you guys how many memory usage for your Catalyst App? and
is FastCGI any better?


It's Perl itself taking the memory, so I doubt you'll see much
difference, but go ahead and try it.  I'd be curious.

There is plenty of documentation on how to reduce the memory size of
applications running on mod_perl.  Take a look at this to get you
started:
http://modperlbook.org/html/ch10_01.html
http://modperlbook.org/html/ch14_01.html

- Perrin

___
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] Re: memory usage of mod_perl process

2007-02-08 Thread Perrin Harkins

On 2/8/07, Jeffrey Ng [EMAIL PROTECTED] wrote:

I have read practical mod_perl. I tried to preload many of our modules in
startup.pl. But the shared memory value doesnt change at all. Also, doesnt
5.7M shared memory usage sound too small comparing to the 92.6M total size?


You're not looking at the right thing there.  This is not actual
shared memory, but rather copy-on-write sharing.  It will never show
in your SHARE section.  On versions of Linux with a 2.6 kernel, you
can use the techniques in Apache::SizeLimit to get a sesne of how much
sharing is going.  This doesn't work with older kernels.

A reliable way to tell if your sharing is improved is to start up
apache without preloading and look at the available memory from
free, and then put in the preloading and restart apache and check it
again.  You should have more free memory after preloading, allowing
you to run more processes.

- Perrin

___
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] Re: memory usage of mod_perl process

2007-02-08 Thread Perrin Harkins

On 2/8/07, Jeffrey Ng [EMAIL PROTECTED] wrote:

when i run this free test, should i run it on the live server, or on a
test server with single process apache mode?


I wouldn't mess with things on your live server, but you want to run
in normal mode, not single-process.


here's the result on a live server:

 total   used   free sharedbuffers cached
Mem:   415097226540161496956  0  275481313344
-/+ buffers/cache:13131242837848
Swap:  8385912   69208378992

[...]

Our CPU load is extremely high. But the actual RAM usage is not high at all.
we are using only 260 gig out of 400 gig.


Not even that much.  You're using about 1.3 GB and the rest of that
2.6 is just being used to cache files.  You should be able to run a
lot more apache processes on this machine, or maybe give some RAM to
whatever else needs it on there, like a database.


From our top results, does it look
like the memory usage of our processes is the bottleneck?


No, you have tons of free RAM.  It sounds like something else is
slowing you down.  You have a lot of CPU being used on there (about
60%) which might mean you need to profile your code for CPU
bottlenecks.  You may also be waiting on database queries, which you
can find out with Devel::DProf or the DBI profiler.

- Perrin

___
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] catalystinstaller.sh - Automated Catalyst installation for FC6

2007-01-17 Thread Perrin Harkins

Thomas Hartman wrote:

If the only with your script is the user has to know to accept the
defaults, you may want to have a look at:

http://search.cpan.org/~mschilli/Sysadm-Install-0.22/lib/Sysadm/Install.pm


See also Expect.  We use it in our installer script to deal with 
chatty module installs that ask questions.  Good for when you need more 
than just hitting ENTER.


- Perrin

___
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] catalystinstaller.sh - Automated Catalyst installation for FC6

2007-01-17 Thread Perrin Harkins
On Wed, 2007-01-17 at 15:03 +0100, Thomas Hartman wrote:
 Is your cat installer script available to the public?

It's not a Cat installer, but it is available to the public.  This is
the installer for the Krang CMS, and you can see an example of how it
uses Expect here:
http://svn.krangcms.com/trunk/krang/lib/Krang/Platform.pm

It basically builds every module in a specified src/ directory for local
use, so you could adapt it for Catalyst or anything else if you wanted
to.

- Perrin


___
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] Re: Catalyst vs Rails vs Django Cook off

2007-01-17 Thread Perrin Harkins
On Wed, 2007-01-17 at 15:12 +0100, Robert 'phaylon' Sedlacek wrote:
 When I request a resource from a Catalyst application, two things are
 executed: The framework logic, and my application logic. But this is not a
 first the one, then the other execution. During the request, the
 framework calls my application logic to get some response together, and my
 application logic uses the framework logic in a convenient way. The
 dispatching (read: The decisio on what part of my application logic to
 execute) is a rather small part.

That was my point actually: the dispatching (plus the abstraction layer
for accessing things like the query string from the web environment) is
nearly all of it, in terms of performance.  A couple of calls to
$c-forward() and $c-stash() are negligible, and all the rest is either
your code or some non-Catalyst CPAN module.

Regarding the DBI analogy, the thinking is pretty simple:

- DBI is big, much bigger than Catalyst.
- DBI has tons of functionality in it, like a profiler, database schema
introspection, and a proxy system.
- If someone made a benchmark comparing DBI to JDBC based on query
speed, no one would complain that they didn't test the speed of the
other features, even though you might use them.  Query speed is the most
relevant thing to benchmark for DBI, just like mapping URLs to methods
is the most relevant thing to benchmark for Catalyst.

The benchmark still sucks though, even as a dispatcher test.  He gave it
the easiest possible URL.

- Perrin


___
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] Re: Catalyst vs Rails vs Django Cook off

2007-01-17 Thread Perrin Harkins
On Wed, 2007-01-17 at 19:24 +0100, Sébastien Wagener wrote:
 On my production server, database requests are usually quite fast, so
 most of the time is spent in perl code, and here are the first lines of
 a dprofpp -r on my local 2.8 Ghz Laptop (production database,
 Algorithm::C3 0.06, mod_perl deployment, as I do not want to use FastCGI
 and dprofpp -F), for a repeated lost-password/login/change
 password/logout cycle (totally about 1000 requests)

One tip for profiling with mod_perl:
If you preload your modules in httpd.conf (or a startup.pl called from
it), make sure you initialize the debugger before you load them or else
they will not show up in DProf output.

For example, put this before any PerlModule or PerlRequire statements:
Perl
require Apache::DB;
Apache::DB-init;
/Perl

- Perrin


___
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] Catalyst vs Rails vs Django Cook off

2007-01-16 Thread Perrin Harkins

Robert 'phaylon' Sedlacek wrote:

Perrin Harkins wrote:

I think it's a lame benchmark too, but isn't a dispatcher mostly what
Catalyst is?  DBIx::Class and TT are not Catalyst, as people often
mention on the list.


I wouldn't say so. You can build applications that only use the
dispatcher of Catalyst, but the model interface, the view (not TT, just
the view classes), the plugin system, inherited actions, the config
system, action classes, etc. are pretty well used in most of my apps too.


In the context of benchmarks, those things all seem pretty minimal to 
me.  The model interface is a razor-thin wrapper over calls to your ORM 
of choice.  There's not much reason to use it that I can see.  Same with 
the view: very little difference from calling templating tools directly. 
 (Somewhat more reason to use it though, since people often mess up the 
caching in TT when they write their own calls to it.)


Most plugins don't do anything except pass your config to some module 
and put a method in $c for something you could call directly.  A few 
specific plugins that contain some code do add real value -- session, 
auth, pagecache -- and are frequently used, so I would consider them a 
core part of Catalyst's functionality.  Those would be fair game for a 
benchmark.


Inherited actions and action classes are part of the dispatcher in a 
broad sense (i.e. part of how URLs get mapped to methods).


The config system does provide convenient centralization but is mostly a 
call to YAML or similar and won't contribute to runtime performance.


The biggest other thing that Catalyst itself provides is an abstraction 
layer over runtime environments.  That's a standard part of all modern 
web framework, and shows up in any benchmark naturally.


The point being, saying that benchmarking the mapping of URLs to methods 
isn't a good test of Catalyst is like saying that running SQL queries 
isn't a good test of DBI.  The bulk of the actual Catalyst code (not ORM 
or templating) that will run on any request to a Catalyst app is the 
dispatcher and the runtime environment abstraction.  It's a *terrible* 
test of the real-world performance of real web applications, which is 
mostly about the database access and templates, but a good test of the 
Catalyst code.


- Perrin

___
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] Catalyst vs Rails vs Django Cook off

2007-01-15 Thread Perrin Harkins
On Mon, 2007-01-15 at 11:35 +0100, Robert 'phaylon' Sedlacek wrote:
 To summarize (again): The benchmark doesn't benchmark Catalyst, only
 it's dispatcher

I think it's a lame benchmark too, but isn't a dispatcher mostly what
Catalyst is?  DBIx::Class and TT are not Catalyst, as people often
mention on the list.

- Perrin


___
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] [OT] what would constitute a sensible set of benchmarks?

2007-01-15 Thread Perrin Harkins
On Mon, 2007-01-15 at 13:24 +0100, Robert 'phaylon' Sedlacek wrote:
 Daniel McBrearty wrote:
 
  Personally, I don't care about templating and ORM benchmarks,
  
  why not?
 
 Well, templating benchmarks maybe, but for an ORM I just have the
 feeling the larger factor is how you use it, not which.

This is true, but the SQL generated by an ORM can have a big effect on
performance.  I usually hand-code the parts where I need the most
performance, but many people will just rely on their ORM and hope for
the best, and that can vary quite a bit between implementations (e.g.
deleting multiple rows in one statement vs. thousands).

- Perrin


___
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] Catalyst vs Rails vs Django Cook off

2007-01-15 Thread Perrin Harkins
On Mon, 2007-01-15 at 14:51 +0200, Octavian Rasnita wrote:
 I would like to say that it is not true, but I cannot see any benchmarks

I don't think anyone disputes that Perl (and Python and Java) are much
faster than Ruby.  You can find benchmarks showing that all over the
web.  The RoR boosters are usually the ones on the defensive over
performance, saying that language performance doesn't matter because the
database is always the bottleneck (which I agree with, most of the
time).  It would be very hard to justify choosing RoR for a project
based on performance.

- Perrin


___
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] serving static files

2007-01-10 Thread Perrin Harkins
On Wed, 2007-01-10 at 22:20 +0200, Octavian Rasnita wrote:
 I guess that authorizing the users, then read() -ing the selected file and 
 serving to the browser is not very efficient, especially under mod_perl.
 Is there a better way?

Yes.  Writing an auth handler and then letting the normal handler deal
with serving the file is more efficient than that.  The most efficient
is using mod_auth_tkt on your proxy server and setting the ticket cookie
from your perl code when people log in.  Then the static files don't
need to touch mod_perl at all.

http://www.openfusion.com.au/labs/mod_auth_tkt/

- Perrin


___
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] serving static files

2007-01-10 Thread Perrin Harkins
On Wed, 2007-01-10 at 23:36 +0200, Octavian Rasnita wrote:
 Ok, thanks for suggestion.
 Unfortunately I don't know how to use a proxy - reverse proxy server at all, 
 so I'll need to also learn that.

If you're serving static files and running mod_perl without a reverse
proxy, that should be the first thing you change.  It has a very
significant effect on performance.

- Perrin


___
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] serving static files

2007-01-10 Thread Perrin Harkins
On Thu, 2007-01-11 at 00:38 +0200, Octavian Rasnita wrote:
 Sorry for off topicness, but please tell me, does it have a bad effect if
 the files are just some files sitting in a directory, and they are served by
 apache directly, with no relations with the directories that are handled by
 a perl-script handler?

Yes, because the apache processes are large (they contain a perl
interpreter) and may be holding an open database connection.  You don't
want them sitting around sending bytes to someone's slow modem.  Run a
proxy server that just handles the static stuff and you solve the issue.

 Does it happen the same in case of FastCGI applications?

No, FastCGI is essentially the same architecture as mod_perl with a
proxy server.

 Do you have a recommendation for a text for learning how to use a reverse 
 proxy?

This is all documented pretty well on the mod_perl site and in books
like this one: http://modperlbook.org/

- Perrin


___
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] Browser window/tab independent sessions

2007-01-09 Thread Perrin Harkins

Carl Franks wrote:

Can you describe how to replicate this behaviour?


You just did.  You had two windows open, and both of them worked.


When I clicked the View  edit your browsing history link in each
window, they both displayed all the books I had viewed in /both/
windows - which as far as I understand, isn't the desired behaviour.


Right, that is global state.  An example of window-specific state is the 
search terms entered.  Open two windows, do a different search in each 
one, and page through the results.  The search term you entered is 
displayed at the top of each page.  If you click next in one window, it 
doesn't get confused and display the term from the other window, or the 
results for the other term.  If they stored the search term in a 
cookie-based session, it would.


I once saw some highly paid Java contractors build a web search which 
cached the full results of each search in the person's session.  Not 
only is this a terrible abuse of sessions, it caused absolute mayhem 
when people opened two windows.  Clicking next in one would start 
showing you results from the other.  It was terrible.


- Perrin

___
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] Browser window/tab independent sessions

2007-01-08 Thread Perrin Harkins

Ian Docherty wrote:
I used URI session variables previously where cookies were not 
available. It occurs to me that if the are being used to have separate 
sessions for each tab or window then the security issues could be 
eliminated by making the session a combination of a cookie (fixed for 
all windows/tabs) and the URI parameter (different for all windows/tabs).


I still don't know how to ensure each new window/tab gets it's own 
unique session in the URI however?


There's no need to do that.  Just put the data you want to preserve in 
the URI rather than putting the session ID there.


- Perrin

___
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] Browser window/tab independent sessions

2007-01-08 Thread Perrin Harkins

Octavian Rasnita wrote:

Well, it seems that Internet Explorer doesn't work that way.


Sometimes it does.  It depends on whether you open new windows from the 
File menu or an existing browser (or right click on a link) or by 
starting a new browser from your IE icon.



No cookie file was created.


No cookie file is ever created for session cookies, but that doesn't 
mean the cookie isn't available to other windows.


- Perrin

___
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] Browser window/tab independent sessions

2007-01-08 Thread Perrin Harkins
On Mon, 2007-01-08 at 23:34 +0200, Octavian Rasnita wrote:
 And I think this is what is wanted, because I can't see other needs for 
 having 2 separate sessions on the same computer.

Go back and read the original post again.  The problem is with storing
non-global information, like the current search term, in global storage,
i.e. a cookie or something tied to a session ID in a cookie.

If you try opening multiple windows on amazon.com, with separate
searches in each, they will not interfere with each other.  You can page
through each separately, and your search terms are maintained.  This is
true regardless of how you opened the window.  That's what this person
is trying to achieve.

- Perrin


___
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] How safe are database transactions?

2007-01-04 Thread Perrin Harkins

Xavier Robin wrote:
I mean, my application died once before the rollback and everything went 
wrong. I think this is because Catalyst connects only once, so all the work 
is done under the same connexion.


That doesn't really make sense.  It can't use the same connection from 
different processes, and within one process you usually want it to use 
the same connection.  I don't think that's the problem.


When a database error happens in most DBI drivers, an automatic rollback 
is issued.  What you have to watch out for is your perl code dying and 
leaving a transaction open, without the database knowing about it.  This 
can lead to accidental commits of partial data when the next request 
comes along, or to locks being held and blocking other requests.


Using an eval block to trap exceptions should be enough to prevent this 
problem.  For additional safety, I also add cleanup handler to mod_perl 
to issue a rollback on the open connections after each request is done.


I will be more careful from now, but could 
it still happen that some data of another user is being lost if he sends a 
command at the same time?


Due to transactions?  No.  When you use transactions and two connections 
try to update the same data, one of them ends up waiting for the other. 
 That's a major purpose of transactions.  You do have to write your SQL 
correctly though.  In some cases, you have to declare your intention to 
modify some data that you read within a transaction, in order to prevent 
anyone else from touching it until you're done, using things like SELECT 
... FOR UPDATE.


It's still possible to lose data by doing things that the database 
doesn't know about.  This gets into concepts like optimistic locking and 
versioning, which are way beyond the scope of your original question, so 
I'll leave it there.


- Perrin

___
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] Fast CGI vs ModPerl

2006-12-08 Thread Perrin Harkins

Octavian Rasnita wrote:

Which of Fast CGI and mod_perl do you recommend for using with Catalyst?


This has been discussed before on the list pretty thoroughly.  Please 
see the archives.


- Perrin

___
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] Coverage tests in Catalyst

2006-12-05 Thread Perrin Harkins

Ian Docherty wrote:
Is it possible to do coverage tests in a Catalyst application? If so 
how? I can't find any references that help.


If you're using mod_perl, there is a brief section in the Devel::Cover 
man page that tells you how to do it.



- Perrin

___
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] question from tutorial - does creating HTML in a controller using HTML::Widget violate MVC?

2006-12-05 Thread Perrin Harkins

Nilson Santos Figueiredo Junior wrote:

c) write a TT plugin.

[...]

c is arguably clumsy and not practical at all.


It can be really easy to add custom view code to TT templates.  You can 
immediately load any class and just call it:


[% USE MyView %]
[% MyView.method(arg) %]

If it supports a new() constructor, you can even have instances of it 
with different constructor args:


[% USE two_column = View::MultiColumn(2) %]

Or you can pass a sub ref to the stash with your data and just call it:

[% sub_ref(arg) %]

There's no need to do anything special for TT or make a plugin unless 
you want to do something that requires access to the TT internals.


- Perrin

___
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] question from tutorial - does creating HTML in a controller using HTML::Widget violate MVC?

2006-12-05 Thread Perrin Harkins

Nilson Santos Figueiredo Junior wrote:

On 12/5/06, Perrin Harkins [EMAIL PROTECTED] wrote:

It can be really easy to add custom view code to TT templates.  You can
immediately load any class and just call it:

[% USE MyView %]
[% MyView.method(arg) %]


Yes, but you'd need to manually use the correct class in every
template and then call the appropriate method. This can be automated
for the general case.


You can just add it to your TT configuration, which is probably set in 
your view class.  It's the PLUGINS option to Template-new().



Or you can pass a sub ref to the stash with your data and just call it:

[% sub_ref(arg) %]


Yes, but this sub ref would need to be created somewhere else, which
would probably end up being at the controller, which is wrong.


Or, again, you could do it in your view class.


There's no need to do anything special for TT or make a plugin unless
you want to do something that requires access to the TT internals.


By plugin, I meant anything that is called Template::Plugin::* and can
be USEd inside a template (since [% USE Module %] will map to
Template::Plugin::Module).


That's what I'm saying: it does not need to be called Template::Plugin:: 
or inherit from any Template module in order to use it this way.  Check 
out the TT docs for the USE directive and the LOAD_PERL and PLUGIN_BASE 
config options for more details.


- Perrin

___
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] [OT] Universal::CAN warning from TT?

2006-11-22 Thread Perrin Harkins

Daniel McBrearty wrote:

Some of my tests give this warning, lots :

Called UNIVERSAL::can() as a function, not a method at
/usr/local/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi/Template/Provider.pm 


line 277


This is because you have installed chromatic's UNIVERSAL::can module. 
Maybe you installed Test::MockObject and it grabbed this too?  The 
normal UNIVERSAL.pm that ships with perl doesn't do this.


- Perrin

___
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] Catalyst Bricolage Integration

2006-11-22 Thread Perrin Harkins

Tobias Kremer wrote:

This sounds like a cool idea. However, I must admit that I don't fully
understand it. Can you give an example of what your metadata files contain?


Sure.  In some cases, we let people use the CMS to choose which fields 
will be required on a form.  The application needs to know this in a 
programmatic way.  It's anything specific to this instance of the 
application.  The most important thing is the name of the controller 
class to call.



I suppose your stub scripts contain perl code which are eval'd by the
CGI::Application backend?


Yes, but that's an unimportant implementation detail.  An XML file read 
by Catalyst would work just as well.



I don't see a possibility to get Bricolage to publish a template AND some
sort of metadata file at once. Is Krang capable of doing this (publish
little data files WITH the templates that are then read by the backend
application) or am I misunderstanding things here?


You understood correctly.  We publish a template (sometimes multiple 
templates) and a metadata file for every story that will run as an 
application.



I now have a setup which allows me to publish stories from Bricolage
into my Catalyst template space. This is not sufficient because Catalyst
is not able to tell which story (i.e. id of story) it is dealing with to
display dynamic stuff like user feedbacks to an article for example.
That's where your metadata files come in, I suppose?


Yes, that's one of the things we would pass in.  You could get around 
this in various ways though.  You could embed the story in the template, 
in a way that is quick to parse out with a simple regex, or use the URL 
itself as a key (since it's unique).


- Perrin

___
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] pre-loading with PerlModule

2006-11-22 Thread Perrin Harkins

Michael Reece wrote:

PerlModule MyApp


Try this instead:

Perl
  use MyApp;
/Perl

Or do that in a separate startup.pl script called from httpd.conf with 
PerlScript.


- Perrin

___
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] pre-loading with PerlModule

2006-11-22 Thread Perrin Harkins

Michael Reece wrote:

that works!  do you know why this makes a difference?


I believe it's a bug in the way PerlModule works.  It should be the same 
thing as a use but it doesn't seem to respect the module already being 
in %INC in the same way.  This may be fixed in recent versions of 
mod_perl 2.


- Perrin

___
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] Calling form plugin authors: these should not be plugins

2006-11-22 Thread Perrin Harkins

John Napiorkowski wrote:

One thing that would help with this is if there was
some clear instructions about how to add external perl
modules to a global namespace in Catalyst.  I find I
end up with:

package myapp::Controller::foo;

use Other::Module;
use Another::Usefull::Module;

at the top of a lot of controllers.  I usually end up
creating a base controller with all those modules I
typically use and inherit from that instead of from
Catalyst Controller.


That's a good way to do it.


People who did mod_perl
programming are used to preloading stuff and having it
available, however I haven't figured out how this
works in Catalyst.


You mean preloading a bunch of modules in startup.pl and then not 
calling use() on them in modules that need them?  That ought to work in 
Catalyst, but I don't recommend doing it.  Listing the modules you need 
explicitly in your controller makes the dependencies easier to see.  It 
also makes it easier if you use them in test scripts, where the modules 
may not be loaded already.


- Perrin

___
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] Cannot create a cache

2006-11-16 Thread Perrin Harkins

Ian Docherty wrote:
I have a hash which is acting as my cache but even if I put values into 
it, on the next request the hash is empty.


Are you aware that apache runs multiple processes and that each process 
has a different copy of your %cache variable?  You will not get the same 
process each time.  If you want to share between processes, you need 
something like Cache::FastMmap.


- Perrin

___
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] Non-real world irrelevant benchmarks

2006-11-16 Thread Perrin Harkins

Nilson Santos Figueiredo Junior wrote:

Anyone knows how Mason compares to TT, performance-wise?


There are some very old benchmarks here:
http://chamas.com/bench/#2000

These are not ideal though, because they compare the cost of using Mason 
as your controller and templating system to the cost of a simple 
mod_perl handler plus TT.  What you really want is a benchmark comparing 
them through Catalyst.


Regarding your TT performance issues, there are some common things to 
do, which you can find in the TT list archives.  I'd still like to see 
your dprof output sorted by real time, since it seems impossible that a 
TT template could take 4 seconds unless it's doing something like 
fetching from a database or the TT cache is turned off.


- Perrin

___
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] Chained actions usage and DBIC performance

2006-11-10 Thread Perrin Harkins
On Fri, 2006-11-10 at 12:08 -0200, Nilson Santos Figueiredo Junior
wrote:
 On 11/10/06, Matt S Trout [EMAIL PROTECTED] wrote:
  Don't believe so, and it's audreycode so *usually* works first time. Plus I
  know a few active users in the Cat community and it's getting lots of use in
  Jifty, so I'm betting it's pretty solid.
 
 This makes me feel even sorrier for not being able to attend her talk
 at YAPC::SouthAmerica last week. Oh well.

Her talk about Scalar::Defer at OSCON was great.  Larry Wall and Damian
Conway were in the audience, and both of them spent most of it either
laughing or applauding.  You can see the slides (called RHOX) here:
http://pugs.blogs.com/pugs/2006/07/rhox_slides_las.html

Still, I would be careful with this module.  It works by doing a lot of
overloading and tricking perl to some degree (it blesses objects into a
package called 0 so that ref will return a false value).  It would be
a sensible precaution to make sure you have good test coverage of the
code where you use it, so that if your use of it breaks in some way in a
future perl version, you will know.

- Perrin


___
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] FastCgiExternalServer and Remote static content

2006-11-07 Thread Perrin Harkins
On Tue, 2006-11-07 at 13:31 -0800, Andrew Peebles wrote:
 Want to run apache on bare machine inside DMZ.
 Want to run MyApp on second machine, outside the DMZ.
 Will use FastCgiExternalServer to accomplish this.
 
 MyApp's static content is on second machine, not visible on apache 
 machine's file systems.
 
 Seems Catalyst::Plugin::Static is the only solution.  Am trying to get 
 that to work and anticipate success ... however, is there something I am 
 missing?  Is there another way to do this?

If performance is what you're concerned about, you should either find a
way to get the static content onto the apache machine (rsync, NFS) or
use mod_cache to cache it, avoiding trips to the other machine for the
static stuff.

- Perrin


___
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] Re: template comparison (was: why not mason

2006-11-03 Thread Perrin Harkins
On Fri, 2006-11-03 at 15:29 +0100, A. Pagaltzis wrote:
 I know I wouldn’t miss plugins. If expressions were Perl, I’d
 simply be using modules. Plugins are just an artifact of having
 an extensive mini language.

When I say plugins, I mean it in the broadest sense.  I usually just
use modules.  There's no need to use the actual plugin API unless you
need to do something to the TT internals.  For simple formatting things,
I just pass a sub ref in the stash and use it:

[% my_func(some.value) %]

- Perrin



___
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] Re: template comparison (was: why not mason

2006-11-01 Thread Perrin Harkins
On Wed, 2006-11-01 at 17:17 +0100, A. Pagaltzis wrote:
 * Perrin Harkins [EMAIL PROTECTED] [2006-10-28 06:05]:
  You're only supposed to use the TT language for simple things.
  Hairy things are supposed to be encapsulated in plugins,
  written in Perl.
 
 That makes a certain amount of sense; I say a certain amount,
 because I’m not sure what case it makes for TT2:

I'm not trying to make a case for TT2.  Some people will prefer other
things, and I personally use different systems on different projects.
I'm just advising that people who use TT2 would be better off if they
avoid trying to code complex logic in the TT2 mini-language.

 1. Some bits of hairy display logic really are specific to the
particular template they’re in, so putting them in a plugin
just pointlessly moves apart related bits of code.

 2. Sometimes there are still large blocks of static strings
interspersed with such logic, so it’s more of a sub-template
task than a plugin task.

TT provides multiple ways to make sub-templates, which can take
parameters.  If you have some code that's really single-use and you want
to keep it in the template, you could use an in-line perl section in an
included template for that one bit.

Personally, I would use a plugin anyway, because the tools (debugger,
profiler, etc.) work a lot better on a perl module than on a template
with in-line code, and the code is easier to test.

 3. If you’re going to bail out to the Perl layer for complex
stuff (which you should), you might as well pick something
with a more concise markup generation syntax than TT2’s for
the simple stuff. (I admit TT2 fares decently when producing
plain text formats – but I’ve never had to do that.)

Something with fewer keywords, you mean?  What would that be?
HTML::Template?  I think the additional abstraction for data access that
TT provides usually makes for simpler templates and avoids needing to
code a lot of repetitive data copying in perl, and the plugin support
makes it a lot easier to deal with formatting dates and numbers and
handling multi-column lists.  I'd be perfectly happy to see TT remove
some of the current keywords, but the things I don't use don't really
cause any problems for me.

- Perrin


___
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] Re: template comparison

2006-10-30 Thread Perrin Harkins
On Sun, 2006-10-29 at 18:05 +, Jon Warbrick wrote:
 If considering Mason as a templating language for Catalyst, it's worth
 looking at Text::MicroMason (and Catalyst::View::MicroMason).

Agreed.  Mason is not just a templating system but rather a full web
development framework, and you will have no use for most of the code
it's loading if all you want is templates.  You could also look at other
in-line perl solutions like the Embperl view modules (there are two of
them).  It would be easy to make one for Text::Template as well, if you
prefer it, but no one seems to have made one yet.

- Perrin


___
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] Is Catalyst what I want?

2006-10-27 Thread Perrin Harkins
On Fri, 2006-10-27 at 10:56 -0500, Jonathan Rockway wrote:
 Keep in mind that although ClearSilver isn't as syntactically
 expressive, it is *much* faster.  There's a reason Google and Yahoo use
 ClearSilver and not TT.

I had lunch with Rasmus Lerdorf at ApacheCon a couple weeks ago and he
told me Yahoo has dropped ClearSilver from nearly all of their apps, and
intends to drop it from the rest.  They use PHP for their live
templating now.

- Perrin


___
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] Is Catalyst what I want?

2006-10-27 Thread Perrin Harkins
On Fri, 2006-10-27 at 11:41 -0500, [EMAIL PROTECTED] wrote:
 I guess:  s/Google and Yahoo use ClearSilver and not TT./Google uses
 ClearSilver and Yahoo is no where near #1 in search (php)./

The only thing I see mention of Google using it for is Google Groups,
their Usenet thing.  Yahoo gets massive amounts of traffic.  They get
orders of magnitude more hits than a typical popular website.

All I'm saying is that the speed of the current crop of templating tools
for Perl is unlikely to be the thing holding you back from building a
scalable site.  TT is plenty fast enough, if you don't try to wedge a
bunch of controller logic into it.  But if you prefer the syntax of
ClearSilver, then go ahead and use it.

- Perrin


___
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] Is Catalyst what I want?

2006-10-27 Thread Perrin Harkins
On Fri, 2006-10-27 at 13:14 -0400, Max Afonov wrote:
 Why don't I _ever_ hear about Mason on this list?

Possibly because if you already use Mason, you don't have much use for
Catalyst, and vice versa?  There's a lot of overlap in functionality
between the two, especially in terms of controller duties.  Also, Mason
is heavier and slower than other choices if you all you're using it for
is templates.

 How is TT better than Mason anyway?

The primary differences are that TT is just templates instead of a
whole web framework like Mason, and TT uses a simplified mini-language
rather than in-line Perl.  Whether those things sound good to you or not
determines which one you will prefer.

- Perrin


___
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] Re: template comparison (was: why not mason

2006-10-27 Thread Perrin Harkins

A. Pagaltzis wrote:

TT2 provides a single minilanguage for both, which is
unnecessarily powerful and verbose for the 18% and way
underpowered for the 2%.


You're only supposed to use the TT language for simple things.  Hairy 
things are supposed to be encapsulated in plugins, written in Perl.


- Perrin

___
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] Catalyst Performance issues

2006-10-07 Thread Perrin Harkins
Nilson Santos Figueiredo Junior wrote:
 I've got pages that take 3-4 seconds to render with a single user
 using the application while the database query takes something between
 0.15-0.20s to complete.

How are you measuring those query times?  The DBI profiler is a good 
idea, if you haven't tried it yet.

 So, in my quest for optimization, I tried profiling my Catalyst
 application.

That was a good move, but I think your methodology needs to be changed a 
little to get useful results.

 It saddened me a little bit to find out that, apparently,
 at least 60% of the time (probably more) is spent inside Catalyst, TT
 and DBIC internal routines (a big cycle eater is Class::C3).

I haven't used DBIC, but I understand that the Class::C3 hit is mostly 
during startup.  You don't want to profile that, since it doesn't affect 
the speed of your application.  With mod_perl, you can skip that part by 
looking at the profile of a child process rather than the parent.  I'm 
not sure how to do it with other server environments.

 Particularly, URI handling seems to take a lot of time (maybe this was
 influenced by the fact that I profiled using the builtin server).

I would think so.  Don't profile with a server different from the one 
you run with if you want useful results.

 Thanks for any help and just in case it might be useful in order to
 diagnose what I could've done wrong, here's the profiling output of
 dprofpp -R -O 50 for my application:

That will be mostly useless unless you add the -r flag.  The reason is 
that this profile is sorted by CPU, so I/O intensive things like 
database queries will never show up here.  You could spend 5 minutes 
doing some disk action and you won't see it here because it didn't use 
much CPU.

Re-run your profile on your real server, preferably without all the 
startup time, and sort it by real time with -r, then see what picture 
emerges.

- Perrin

___
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] Catalyst Performance issues

2006-10-07 Thread Perrin Harkins
Jonathan Rockway wrote:
 Maybe it'd be nice if someone came up with a faster drop-in
 replacement for TT... any volunteers? ;-)
   
 I also noticed that TT is way too slow and am already working on it.

I think you'll have a very hard time doing it, unless you drop some of 
the most popular features of TT, like being able to pass it objects 
rather than just pure data structures.

 Anyway, if you Need Something Now, try clearsilver.  The advantage is
 that the entire dataset is fetched before the page is loaded.

There's no reason you can't do that with TT.  It will certainly perform 
faster if you pass it pure data instead of objects that require extra 
method calls.

 There's a reason Google and Yahoo use
 Clearsilver and not TT.

I don't think it has much to do with TT's performance.  They use many 
different languages, not just Perl, and they often write their data 
sources in C.  Those things make a templating tool with a C API a better 
fit for them.

- Perrin

___
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] patch: C::P::Compress::Deflate

2006-09-19 Thread Perrin Harkins
Peter Karman wrote:
 Patch below allows Compress::Deflate plugin to play nicely with 
 Static::Simple 
 and to allow for skipping deflation based on browser. Specifically, we found 
 issues with older versions of IE that claimed to deal with the deflate 
 encoding 
 but balked.

Does this mean you are using Catalyst to serve static pages in 
production?  That's going to hurt your performance quite a bit.  Static 
pages are better left to your web server.  For that matter, compressing 
pages is also better left to your web server.

- Perrin

___
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] Post deployment application management

2006-09-14 Thread Perrin Harkins
On Thu, 2006-09-14 at 06:33 -0700, Bill Moseley wrote:
 My current suggestion is for them (well, me) to put all their content
 under subversion and bite the bullet and learn how to use the shell
 (ok, the Windows users can use TortoiseSVN). [1]

TortoiseSVN is pretty nice, and should be similar enough to FTP for them
to get it.  They will not be able to use it from internet cafes though.

 That would get them off ftp, and allow for a little better user and
 revision management, and also help with line endings.  File encoding
 is still an issue, although maybe a post-commit hook could try and
 detect and re-encode to utf-8.

Yes, all that could be dealt with.  I don't know if normal users will be
capable of understanding the concepts needed to roll back a change, so
problems will still come to you, but at least SVN gives you a way to fix
them.

 Any other suggestions other than subversion?

We use an actual CMS (Krang) to manage these assets for our clients,
because it gives more in the way of workflow support, searchable asset
library, previewing, and easy UI.  I think either TortoiseSVN or some
kind of WebDAV thing is your best bet without using a CMS.

 Another deployment question: I have a staging server (well, it's on
 the same machine) where they can view and test changes.  I'd like to
 have that server get automatically updated with changes quickly after
 checkins.   Any ideas other than having cron run svn update every few
 minutes (e.g.  perhaps a post-commit script)?

The post-commit script is the way to go I think.

- Perrin


___
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] Post deployment application management

2006-09-14 Thread Perrin Harkins
On Thu, 2006-09-14 at 11:22 -0700, Bill Moseley wrote:
 On Thu, Sep 14, 2006 at 01:45:39PM -0400, Perrin Harkins wrote:
  TortoiseSVN is pretty nice, and should be similar enough to FTP for them
  to get it.  They will not be able to use it from internet cafes though.
 
 What's that limitation?

Internet cafes don't have TortoiseSVN installed :)

Maybe you could rig something with a USB key or a CD-ROM if they really
need it.  I doubt they will like the CLI much, especially from the
horrible Windows command shell.

- Perrin


___
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] Fastest Perl HTTPD?

2006-08-27 Thread Perrin Harkins
FYI, I asked about this in the journal comments and it sounds like 
shipping off database queries (and presumably any other blocking I/O) to 
a separate mod_perl/PPerl/whatever is the likely route.

http://use.perl.org/comments.pl?sid=32713cid=49605

- Perrin


___
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] Fastest Perl HTTPD?

2006-08-27 Thread Perrin Harkins
Matt S Trout wrote:
 Perrin Harkins wrote:
 FYI, I asked about this in the journal comments and it sounds like 
 shipping off database queries (and presumably any other blocking I/O) to 
 a separate mod_perl/PPerl/whatever is the likely route.
 
 That's not really what he says; the idea is to have things like database 
 queries served by dedicated child pools, so that the apps in the centre need 
 to block as little as possible.

I think that's what I just said.

 This is much more like the POE approach than 
 anything to do with mod_perl.

PPerl, mod_perl, FastCGI, processes you fork yourself, whatever -- they 
all do the same thing.  They keep a pool of child processes that Perl 
requests can be handed off to and you talk to them through pipes or sockets.

It sounds like he has ideas for making DBI requests transparent, but 
that won't change the underlying architecture.

- Perrin

___
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] Fastest Perl HTTPD?

2006-08-26 Thread Perrin Harkins
Matt S Trout wrote:
 Axkit2 looks like it'll be a lovely candidate for a production-quality 
 scalable standalone server, although it's a single-process affair with 
 optional forking so we'll need to figure out how to manage that appropriately 
 to maximise performance.

 I've been having some fairly sick thoughts about preforked Catalyst handlers 
 and $dbh pools (with some assistance from a Storage subclass) but we'll get 
 to 
 that later :)

Won't that be just like Lighttpd and FastCGI?  That's the trouble with 
any asynchronous I/O approach: you have to do some kind of 
FastCGI/mod_perl backend server to run all the real code in because the 
async server can't talk to any databases.


- Perrin

___
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] Fastest Perl HTTPD?

2006-08-26 Thread Perrin Harkins
Len Jaffe wrote:
 Isn't that the whole point of this architecture.
 
 The lightweight daemon that listens on port 80 either serves static 
 content,
 or asks the heavy app server process to do some work.
 
 That way you have a whole bunch of light processes serving the static 
 stuff,
 and fewer heavy processes.  Once the heavy process is done, and hands it's
 output back to the light process, it is free to work for another light
 process, while the first light process deals with network transfer back to
 the client.

Actually you have one light process doing non-blocking I/O and serving 
all of the static stuff and a bunch of heavy processes doing all of the 
dynamic stuff.  That's what you already have when you use 
Lighttpd/apache with FastCGI or apache/squid as a reverse proxy to a 
separate mod_perl process.  The non-blocking I/O server may be faster 
for the static stuff than apache is, but apache is already so fast at 
static stuff that it won't matter much unless you're using an old 
under-powered machine.

In other words, you can't speed up any of the dynamic stuff using Matt's 
new non-blocking server unless you can figure out a way for it to deal 
with DBI (and any other blocking I/O) that is more efficient than just 
passing off requests to FastCGI/mod_perl processes.

- Perrin

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


  1   2   >