[Catalyst] Pedantically thorough one-shot catalyst sandbox installation: eventually intended to install demo/sample apps at one shot as well

2006-12-15 Thread Thomas Hartman

( Originally posted to perlmonks at http://www.perlmonks.org/?node_id=589529 )

I have released an (in progress) catalyst one-shot installer:
pimpmycat -- into Google code project hosting.

a href=http://code.google.com/p/pimpmycat/source;

This is the way I have evolved to manage complexity in perl projects
that have a lot of dependencies. For me, the Catalyst ecosystem is the
quintissential example of this, but I am sure it is not the only one,
and I think this approach could be used in other contexts.

I am curious what the other monks/cat users think of this, both those
involved with catalyst and those not.

By the way, mst, this uses the shadowcat installer once perl, cpan,
and module::build are shiny. And zbi, it targets all dependencies
required for the latest version of Helper::InstantCrud to work. My
next goal is to have it actually compile and start as many demo apps
as possible out of the box. IE, no user interaction whatsoever.
Click and go.

The a href=http://pimpmycat.googlecode.com/svn/trunk/install/README;README
/a documentation is pasted in below.
p
READMORE
Pimpmycat is the easy way to install a sane catalyst development sandbox on a
possibly non-root-account virgin shell. It provides the developer, or the
curious newbie who would like to experiment, with a more or less one
click way to
install a freshly compiled perl, an optimized build system (with an updated CPAN
and Module::Build), Catalyst, many Catalyst helper modules, and finally a number
of Catalyst tutorials and sample applications, which should already be
configured
and ready to run. (This last item is still a work in progress, but that is what
I'm shooting for.)

My hope is that this will ultimately lead to a slick catalyst demo installer
that will run without any babysitting at all. Run it overnight, come
back in the morning
and the final message of the installer is various urls that you can
open in your web browser
to view the various sample and tutorial apps. Not quite there yet, but
I I think I'm close.

Pimpmmycat is ideally suited for users who would like to try out Catalyst on a
shared web host, where there is a large amount of hard disk space but
no root access.
It will also provides a useful tool to help CPAN authors ensure that
their distributions
install cleanly in various scenarios. (EG, a virgin perl install; a
virgin perl with an updated
CPAN, a virgin pwel plus updated CPAN and Module::Build, etc.)

Basically, this is a collection of simple shell scripts. The main
function is to install a collection of external dependencies organized
around perl under a single top level directory. Along with this, there
are user friendly backup and revert helper scripts to snapshot all
external dependencies at any particular point in time. Snapshot backups
are taken during the install at various crucial points. So, for
example, you don't have
to sit through the half-hour perl compile process more than once. The next
time you want to verify if something installs cleanly against a particular
configuration, you can snapshot-revert to it in just a few seconds.

Developers are encouraged to modify the install script to fold in the
particular
dependency idiosynchracies that their individual projects may have.

The motivating idea is that ideally a catalyst web project (or
actually any project) should be re-installable at will on a virgin
system without any babysitting.  However, various rough edges in the
perl ecosystem make this impracticable.  Compiling and installing
takes a long time, and many important CPAN modules are evil in the
sense that they ask for user input, even if only to cocnfirm some
default. Pimpmycat tries to minimize this evil.

Also, I believe that these constraints tempt module authors to release
modules which, for example, pass all tests only when some particular
dependency is there that they have forgotten about. By providing an easy
way for module authors to snapshot-revert all the way back to a fresh perl,
more thorough testing is encouraged.

This approach could be helpful in non-catalyst development scenarios.
I have toyed with the idea of generalizing this concept as Pimpmyperl or
something along those lines, but I explicitly oriented myself around catalyst
for two reasons. First, I am doing a lot of catalyst development now.
Second, the large number of CPAN dependencies required to do useful work
in the Catalyst ecosystem are its greatest strength, but in my opinion also
its achilles heel. So, this is my humble offering to strengthen the strengths
and work around the weakness.  Or maybe I just liked the sound of pimpmycat :)

The pimpmycat installer has been tested to death on a linode user-mode
virtual linux server running ubuntu dappper drake.

To actually get started using it, do as follows.

Checkout pimpmycat from google project hosting

 svn checkout http://pimpmycat.googlecode.com/svn/trunk/ pimpmycat

Configure environment

 edit the

   $EXTERNAL_DEPENDENCIES_TOP

 variable exported by

   

[Catalyst] DateTime Timezone

2006-12-15 Thread Tobias Kremer
My application stores all dates in a MySQL database in the UTC timezone.
Because I'm doing further calculations with these dates after retrieving them
via DBIx::Class I don't want them to get auto-inflated into the timezone
of the current user. The DateTime POD recommends doing date calculations only
with dates of the same timezone and having everything in UTC should make
things work like they're supposed to work (I hope).

I think the DateTime objects should only be converted for displaying purposes
(i.e. when they're going to be displayed in a TT template). Is that correct?
If so, what's the best way (and where's the best place) to achieve this
conversion?

Thanks!

-- Tobias

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

2006-12-15 Thread Sébastien Wagener
On Thu, 2006-12-14 at 18:51 -0800, Andrew Peebles wrote:
 Will Smith wrote: 
 I think you want:
 
 $c-stash-{book} = [$c-model('myappDB::Book')-search( {}, {order_by
 = 'title} )];
The DBIx::Class::ResultSet pod recommends using undef instead of {}, if
I remember right.
 
 That's how I remember doing it ...

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

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


___
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] DateTime Timezone

2006-12-15 Thread Chisel Wright
On Fri, Dec 15, 2006 at 10:34:35AM +0100, Tobias Kremer wrote:
 My application stores all dates in a MySQL database in the UTC timezone.
 Because I'm doing further calculations with these dates after retrieving them
 via DBIx::Class I don't want them to get auto-inflated into the timezone
 of the current user. The DateTime POD recommends doing date calculations only
 with dates of the same timezone and having everything in UTC should make
 things work like they're supposed to work (I hope).
 
 I think the DateTime objects should only be converted for displaying purposes
 (i.e. when they're going to be displayed in a TT template). Is that correct?
 If so, what's the best way (and where's the best place) to achieve this
 conversion?

I tend to use the following in my schema classes to deal with timestamps
in my app(s):


  package MyApp::Schema::TableName;
  use DateTime::Format::Pg;

  # ...

  foreach my $datecol (qw/created last_modified/) {
__PACKAGE__-inflate_column($datecol, {
  inflate = sub { DateTime::Format::Pg-parse_datetime(shift); },
  deflate = sub { DateTime::Format::Pg-format_datetime(shift); },
});
  }


I'm sure it's not all that different for MySql;
http://search.cpan.org/~drolsky/DateTime-Format-MySQL/

Chisel
-- 
Chisel Wright
e: [EMAIL PROTECTED]
w: http://www.herlpacker.co.uk/

  This is not an automated signature.
  I type this in to the bottom of every message.

___
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] DateTime Timezone

2006-12-15 Thread Tobias Kremer
Zitat von Chisel Wright [EMAIL PROTECTED]:

 I tend to use the following in my schema classes to deal with timestamps
 in my app(s):

Yes, that's also what the DBIx::Class::InflateColumn::DateTime component which
I'm using for this purpose does:
http://search.cpan.org/~bricas/DBIx-Class-0.07003/lib/DBIx/Class/InflateColumn/DateTime.pm

Unfortunately I just found out that DateTime::Format::MySQL::parse_datetime
returns dates in the floating timezone (not UTC). Thus I'll now have to revert
to manual inflation to set_time_zone( 'UTC' ) on the date objects or subclass
D::F::MySQL :(

Hmm ... There must be a better way of dealing with DateTime, timezones and
MySQL ...

Ideas are very welcome :)

-- Tobias

___
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] TIP: resolv uri based on delta params

2006-12-15 Thread Dan Dascalescu

to summarize:

a href=[% c.request.uri_with( page = pager.next_page ) %]Next Page/a


Funny that Catalyst::Enzyme reinvented the wheel, too:
http://search.cpan.org/dist/Catalyst-Enzyme/lib/Catalyst/Enzyme/CRUD/View.pm#%24c-%3Ethis_request_except(%25new_params)

___
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::Plugin::Authentication::Store::LDAP settings for Microsoft Active Directory

2006-12-15 Thread Russell Jenkins

Hermida, Leandro wrote:

authentication:
ldap:
ldap_server: myhostname.domain.com
ldap_server_options:
version : 3
binddn: searchuser
bindpw: searchpwd
user_basedn: cn=Users,dc=domain,dc=com
user_filter: ???
user_scope: sub
user_field: ???
user_search_options: ???

Does anyone know the correct settings for the user_* settings?


That is not too far away from what I'm currently using to authenticate 
against an AD. Here's part of my config;

authentication:
ldap:
user_field: uid
user_basedn: ou=grouping,o=Name of Organization,c=country
user_scope: one
user_filter: (uid=%s)

I suggest grabbing the Java LDAP browser at : 
http://www-unix.mcs.anl.gov/~gawor/ldap/download.html
and having a poke around to determine the exact user_field, filter and 
basedn.


Hope that helps!
R.
--
Russell Jenkins
Department of Mathematics and Statistics, University of Melbourne


___
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] TIP: resolv uri based on delta params

2006-12-15 Thread Brian Cassidy

Dan Dascalescu wrote:

to summarize:

a href=[% c.request.uri_with( page = pager.next_page ) %]Next 
Page/a


Funny that Catalyst::Enzyme reinvented the wheel, too:
http://search.cpan.org/dist/Catalyst-Enzyme/lib/Catalyst/Enzyme/CRUD/View.pm#%24c-%3Ethis_request_except(%25new_params) 



Not exactly, uri_with() didin't arrive until version 5.67, on April 
23rd. The last version of Enzyme is dated the 14th of January.


-Brian

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


[Catalyst] Best practice for using transactions?

2006-12-15 Thread Jon Warbrick
Does anyone have any advice on best practise for using transactions in a 
database-based Catalyst app?


I'm using DBIx::Class, and I can see how I can wrap particular processing 
steps with txn_do to impliment transactions. But it seems to me that there 
might, for a general CRUD application, be value in processing each request 
entirely within a transaction by default - read-only requests would then 
get a consistent view of the database, and write requests would be 
all-or-nothing by default.


Trouble is, I can't see how to do this. txn_do seems to be a non-starter 
(no appropriate coderef to wrap), and I can't see where I could 
appropriately call txn_begin/txn_commit/txn_rollback to achieve a useful 
effect.


Any advice from people who've been here before (even if it's 'you don't 
want to do that') would be very welcome.


Jon.

--
Jon Warbrick
Web/News Development, Computing Service, University of Cambridge

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


[Catalyst] Happy Hanukkah

2006-12-15 Thread Len Jaffe

Happy Hanukkah everybody.
Len.
--
[EMAIL PROTECTED]
614-404-4214

___
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] Best practice for using transactions?

2006-12-15 Thread Robert 'phaylon' Sedlacek
Brandon Black wrote:

 Or on the other hand, you could probably do it as a Controller
 base-class using the begin and end methods there too, and then you
 still have the option of some readonly controller not using
 transactions.

While we're at making transaction-scopes smaller, I'd even go further
and make a Catalyst::Action::TransactionDBIC. As I understand DBICs
current handling of nested txn_do's, you could use such an action class
for all actions which should occur in a transaction and it will DTRT and
run it all in one big transaction. Well, except you forward to multiple
actions with TransactionDBIC from one without. But this might still be
the right thing to do, depending on what you want.

gr.,
Robert

-- 
# Robert 'phaylon' Sedlacek
# Perl 5/Catalyst Developer in Hamburg, Germany
{ EMail = ' [EMAIL PROTECTED] ', Web = ' http://474.at ' }

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


[Catalyst] Modifying the base url

2006-12-15 Thread Julien GILLES
Hi,

is-it possible to add a default base address to Catalyst urls ?

I have a classical application with /foo, /bar/123 urls, and I want to call them
as http://localhost:3000/baz/foo, http://localhost:3000/baz/bar/123, having all 
Catalyst.uri_for with the complete base part.

I can of course update all controllers, bu I need something configurable (in 
myapp.yml it would be fine).


-- 
Julien Gilles.

___
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] Modifying the base url

2006-12-15 Thread Krzysztof Krzyżaniak
Julien GILLES [EMAIL PROTECTED] writes:

 Hi,

 is-it possible to add a default base address to Catalyst urls ?

 I have a classical application with /foo, /bar/123 urls, and I want to call
 them
 as http://localhost:3000/baz/foo, http://localhost:3000/baz/bar/123, having 
 all
 Catalyst.uri_for with the complete base part.

 I can of course update all controllers, bu I need something configurable (in
 myapp.yml it would be fine).

overload uri_for in lib/MyApplication.pm


  eloy
-- 
[EMAIL PROTECTED]

   jak to dobrze, że są oceany - bez nich byłoby jeszcze smutniej

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

2006-12-15 Thread Will Smith
Thank you for pointing me to the right doc. Sometimes I could not find the 
right doc to read. 
 Thanks again for all your help
 
 Happy holidays

Sébastien Wagener [EMAIL PROTECTED] wrote: On Thu, 2006-12-14 at 18:51 -0800, 
Andrew Peebles wrote:
 Will Smith wrote: 
 I think you want:
 
 $c-stash-{book} = [$c-model('myappDB::Book')-search( {}, {order_by
 = 'title} )];
The DBIx::Class::ResultSet pod recommends using undef instead of {}, if
I remember right.
 
 That's how I remember doing it ...

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

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


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


 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ___
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] Modifying the base url

2006-12-15 Thread Jonathan Rockway
Julien GILLES wrote:
 I can of course update all controllers, bu I need something configurable (in
 myapp.yml it would be fine).

I think this is a webserver issue.  `Alias /baz /path/to/myapp.fcgi/`
should be sufficient for Apache.  You might also want to try:

  base: /baz

in your myapp.yml.  I don't know what effect this has on handling
requests (in the dev server), but it will change what uri_for thinks the
base of your application is.  Use with care.

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;

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


[Catalyst] C::P::Email and testing

2006-12-15 Thread Daniel McBrearty

if you have an action that sends an email, how do you write tests for it?

perhaps print the email to a temp file in test mode? what do you guys do?

--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131

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