Re: [Catalyst] Best practice: How to build app parts reusable?

2009-06-10 Thread Robert Krimen
On Tue, Jun 9, 2009 at 1:39 PM, Tomas Doran bobtf...@bobtfish.net wrote:


 This is neat, but in no way taking advantage of the new Moose code.

 I have some code in the CatalystX::DynamicComponent namespace meant to
 solve this problem:

 http://github.com/bobtfish/catalyst-dynamicappdemo/tree/master
 http://search.cpan.org/dist/CatalystX-DynamicComponent/


I actually stumbled on this when I was poking around the AutoCRUD code. It
looked really interesting, but also a lot more complex than what AutoCRUD
was doing

 http://search.cpan.org/dist/CatalystX-DynamicComponent/
 CatalystX::DynamicComponent (which solves around the same problem you're
 solving) is fairly solid at this point. The other things based off it which
 are also in the dist - much less so...


My initial approach was to provide an application class role, but I think I
 may prefer your approach of putting all of the logic into it's own class,
 which you then pass the application class to permute.


My idea was also to provide a Catalyst::Plugin::InjectComponent for people
that wanted to integrate that functionality directly into their Catalyst
application. It would provide an -inject_components stage and an
-inject_component helper... possibly even scanning
$config-{'Plugin::InjectComponent'} for stuff to load


 Would you be interested in collaborating on this? Initially I think I'd
 fork your code and compose my pre-existing role onto it to see how far that
 gets us / how much of the ugly code you inherited from AutoCRUD goes away.

 Sound reasonable?


Sure, I'll take a look. I think there's room enough on CPAN for both
solutions. My stupid simple AutoCRUD reimplementation, and your more
advanced role-based compositing. I'd be happy to include a SEE ALSO and a
mention in DESCRIPTION so that people can find both easily.

Rob
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] [Announce] App::ForExample: Helper to generate Catalyst configurations

2009-06-08 Thread Robert Krimen
Last Tuesday, during a SFPUG Catalyst talk, I announced App::ForExample

 http://search.cpan.org/perldoc?App::ForExample
 http://search.cpan.org/dist/App-ForExample

This is the tool I've written to help with the deployment stage of
publishing a Catalyst application. It will
generate configurations for Apache, lighttpd, nginx:

App::ForExample is a command-line tool for generating sample configurations.
It is not designed to do configuration
management, but rather as a guide to get you 80% of the way there

Besides the usual Apache, lighttpd, nginx, and FastCGI configurations,
App::ForExample can create a FastCGI start-stop script and a monit
configuration for monitoring those processes

Here is some typical usage:

   # To output a FastCGI (ExternalServer)/Apache configuration (with monit
stub and start-stop script), run:
   for-example catalyst/fastcgi apache2 standalone --package My::App
--hostname example.com --output my-app

   # The above command would have created the following:

   my-app.apache2  The Apache2 virtual host configuration (hosted at
(www.)example.com)
   my-app.start-stop   The start/stop script to launch the FastCGI
process
   my-app.monitA monit stub used for monitoring the FastCGI
process

   # This will generate a basic, stripped-down monit configuration (monitrc)
suitable for a non-root user:
   for-example monit --home $HOME/monit --output $HOME/monit/monitrc

   # A mod_perl configuration for Catalyst:
   for-example catalyst/mod_perl --package Project::Xyzzy --hostname
xyzzy.com --home Project-Xyzzy

A tutorial for Apache2 with FastCGI on Ubuntu:

http://search.cpan.org/perldoc?App::ForExample#Apache2_with_FastCGI_on_Ubuntu

You can install App::ForExample by using CPAN:

cpan -i App::ForExample

If that doesn't work properly, you can find help at:

http://sial.org/howto/perl/life-with-cpan/
http://sial.org/howto/perl/life-with-cpan/macosx/ # Help on Mac OS X
http://sial.org/howto/perl/life-with-cpan/non-root/ # Help with a
non-root account

The source repository is:

http://github.com/robertkrimen/App-ForExample/tree/master

Rob
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Jemplate and AJAX woes... [Bump -anyone??]

2008-08-18 Thread Robert Krimen
On Sat, Aug 16, 2008 at 2:52 PM, Robert Krimen [EMAIL PROTECTED]wrote:



 On Sat, Aug 16, 2008 at 12:45 PM, Ian Tegebo [EMAIL PROTECTED] wrote:


 BTW, it appears Catalyst::View::Jemplate  broke after Jemplate = 0.21
 changed the behaviour of Jemplate::runtime_source_code (see RT 35609,
 37813).  What versions are you running?


 I'll try and take a look to at Jemplate and see what's going on. What you
 *can* do
 is just do a Jemplate compile via a Makefile or something and then serve
 the Jemplate
 .js as you would any other javascript asset.

 Rob


This issue is now taken care of in version 0.23_1

You can install it with pip:

pip
http://search.cpan.org/CPAN/authors/id/R/RK/RKRIMEN/Jemplate-0.23_1.tar.gz
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Jemplate and AJAX woes... [Bump -anyone??]

2008-08-16 Thread Robert Krimen
On Sat, Aug 16, 2008 at 12:45 PM, Ian Tegebo [EMAIL PROTECTED] wrote:


 After a friend had recommend jQuery, I've found I really like it but
 had been under the impression that I wouldn't be able to use Jemplate
 at the same time.


No, Jemplate WILL COEXIST with any other javascript you may be running
client side.
In fact, the latest Jemplate release has the option of using jQuery (or YUI)
to perform
AJAXy stuff (get  post).


 A second read of Rockway's Editable Addressbook in
 chapter 7 of the Catalyst book leaves me wondering how TT, Jemplate,
 and jQuery would best get along.  Is it the case that
 Catalyst::View::Jemplate exists to reduce HTML munging within
 client-side javascript?


Jemplate in general exists for that purpose. The problem with doing heavy
HTML/UI-lifting browser-side is that you end up doing things like:

   var html = 'div class=' + styleClass + 'a href=' + uri ...

It quickly becomes unwieldy. Jemplate basically creates methods that do the
above (and more).

The other option is to use a javascript templating system (interpolating and
parsing in javascript? probably slow) or
use a widget system that may not have the specific look  feel you're going
for.


 If so, then is it correct to think of jQuery, Jemplate, and the
 Catalyst::Controller::REST interface as kind of a browser-side MVC?


jQuery is a really nice way of manipulating DOM + some convenience
functions: no MC
involved (*maybe* the V part)

Jemplate is just a templating system that plugs into javascript: again, no
MC involved (just the V part)

I suppose you can think of C::C::REST as the data-layer for your model, but
then you're still missing the Controller
aspect and a way of representing the Model in javascript.



 I'm imagining the REST calls through jQuery as accessing the model
 while qQuery serves as the controller via its selectors finally
 rendering its view through Jemplate.


Sounds about right, but it's more like making API calls to your C::C::REST
data-layer.



 BTW, it appears Catalyst::View::Jemplate  broke after Jemplate = 0.21
 changed the behaviour of Jemplate::runtime_source_code (see RT 35609,
 37813).  What versions are you running?


I'll try and take a look to at Jemplate and see what's going on. What you
*can* do
is just do a Jemplate compile via a Makefile or something and then serve the
Jemplate
.js as you would any other javascript asset.

Rob
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Troubleshooting FastCGI error

2008-08-13 Thread Robert Krimen
On Wed, Aug 13, 2008 at 3:08 AM, Dermot [EMAIL PROTECTED] wrote:

 Hi,

 I have an odd problem with my tiny app. Under server script
 (MyApp/script/myapp_server -d) it runs without error.  However under
 fascgi I am encountering a problem with one of my controllers that
 uses a FormFU. There an abridged version of the controller is pasted
 below.

 The error in the http error log is:
 :CascadeActions::update(): DBI Exception: DBD::SQLite::st execute
 failed: unable to open database file(14) at dbdimp.c line 403 [for
 Statement UPDATE submissions SET validation_pass = ? WHERE ( id = ?
 )] at ..lib/MyApp/Controller/RecordData.pm line 89, referer: ...

 DBIx::Class::Row::update_or_insert(): DBI Exception: DBD::SQLite::st
 execute failed: unable to open database file(14) at dbdimp.c line 403
 [for Statement UPDATE clipData SET audio = ? WHERE ( id = ? )] at
 /usr/lib/perl5/site_perl/5.8.8/HTML/FormFu/Model/DBIC.pm line 324,

 Server configuration.

 DocumentRoot /var/www/MyApp/root
 Alias /static  /var/www/MyApp/root/static

 FastCgiServer /var/www/MyApp/script/myapp_fastcgi.pl -processes 3
 Alias /motion /var/www/MyApp/script/myapp_fastcgi.pl/

 Does anyone have any ideas what the problem might be? I can't see why
 it might work in one environment and not the other.


This looks like a permissions issue to me. You're running the server
script as one
user and then running the application via Apache (which is a different user
like nobody or www).

Apache doesn't have write (or maybe even read) access to your SQLite
database file or directory.

Rob
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Jemplate and AJAX woes... [Bump -anyone??]

2008-08-13 Thread Robert Krimen
On Wed, Aug 13, 2008 at 2:39 PM, [EMAIL PROTECTED] wrote:



 2) I have been looking (googling) for Jemplates and got no luck really.
 Most of the AJAX tutes do not talk about Catalyst enough (what more of
 Jemplates)...  Any good tutorials for Jemplates especially in terms of
 what I want to achieve (as described above)?


I would start out by setting up an API controller
(MyApplication::Controller::API)
which is a Catalyst::Controller::REST.

Flesh out your API methods and have jQuery act as an intermediary between
your API controller and Jemplate (using $.get, $.post, etc.)

Rob
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Catalyst::*::REST and Javascript

2008-08-11 Thread Robert Krimen
Hi,

I'm starting to play around with Catalyst::Action::REST and was wondering if
anyone had any recommendations on a javascript utility/library to
play nice with RESTful services.

I'm thinking of something more comprehensive than the basic YUI, jQuery, or
Dojo AJAX functions.

Jester (http://thoughtbot.com/projects/jester) is one but it's dependent on
prototypejs.

Thanks,
Rob
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [SOT] cat webmail app?

2008-08-05 Thread Robert Krimen
On Tue, Aug 5, 2008 at 11:10 AM, Roderick A. Anderson [EMAIL PROTECTED]wrote:

 J. Shirley wrote:

  Then, just a simple adapter class to use that model will bind it into
 Catalyst and away you go with a webmail client.


 Yes!  I'll have to look at the PEP site again to see what has been done.
  The Mailing list is pretty low volume so I mostly just glance at the
 messages.


To take this idea further down the rabbit hole, you could build most of the
interface with javascript and HTML (Jemplate, YUI, Dojo, jQuery, ...) and
then have
Catalyst provide a JSON API (View::JSON) layer between your adapter class
and the javascript.

Rob
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Running java inside Catalyst

2008-06-22 Thread Robert Krimen
On Sat, Jun 21, 2008 at 6:36 PM,  [EMAIL PROTECTED] wrote:
 Hi,

 Just curious, yesterday I was playing with Java inside Catalyst, and I put a
 code like:

 system(java);

 in one of my controllers, and when I accessed the URL, the whole computer:
 Fedora Core 8, froze and I had to restart. I am not sure whether it is an OS
 problem, since I later tried the same program on Windows XP with colinux(FC
 7)/cygwin and the java ran as expected.

 Anyone had a similar experience before ?

What engine were you running when this happened?

Rob

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Using URIs for my app in another program

2008-05-01 Thread Robert Krimen
The most straightforward method I can think of is to factor out the URIs to
a common config file.

You can have your daemon read in the config file and generate URIs from
that. Your Catalyst application can either continue to use
base to generate URIs or you can generate some special URIs from the config
file as well.

The problem with having your daemon load up Catalyst to generate a URI is
that I'm not sure how that would work. Catalyst generates URIs
given a HTTP request. No HTTP request, no base URI.

Another safety measure is that you can have your Catalyst appl do a sanity
check against the URI config file to make sure it doesn't become out of date
(maybe a startup test request).

Rob

On Thu, May 1, 2008 at 2:27 PM, Byron Young [EMAIL PROTECTED]
wrote:

 Hi all

 I've run into a situation that I can't find a good solution to and am
 hoping to solicit some ideas from people on the list here.

 An app I've been working on consists of two main parts - a Catalyst-based
 web app which provides the UI, and a daemon that does the heavy lifting.
  They are totally separate applications that talk to one another via
 database.  The daemon will sometimes send emails to users when it finishes
 certain tasks that the users are interested in, and I want to include links
 in the emails that would bring the user to a Results page on the web app
 where they can get more information about the result of the task.

 So, what I would like is to be able to call $c-uri_for() from my daemon.
  Is there any 'sanctioned' way of doing that?  If possible, I'd like to
 avoid loading my whole catalyst app and somehow tricking it into believing
 its running under the same environment as my real app.

 Another option is to use the database to pass URIs around.  Maybe a URI
 table that maps finished tasks to URIs.  However, I would rather just be
 able to arbitrarily call $c-uri_for() whenever I decide I need to include a
 URI in my daemon instead of having to create a table or column whenever I
 decide I want to send a link to a new type of resource.

 Any suggestions?  Maybe I'm just going about it all wrong?

 Thanks!

 Byron

 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
 Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] YUI uploader example

2008-02-21 Thread Robert Krimen
YUI 2.5 was released yesterday, and one of the new features is a
Flash-based uploader with multi-file select and a progress bar.
It's billed as experimental, but I've put together an example Catalyst
application showing off their simple and advanced examples.

You can download the Catalyst application here:
http://bravo9.com/CatalystX-Example-YUIUploader-0.01.tar.gz
(The javascript could use some cleaning up, but it basically works)

Here's a page with the lowdown on the YUI uploader:
http://developer.yahoo.com/yui/uploader/

Rob

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [ANNOUNCE] New plugin: Catalyst::Plugin::Assets

2008-01-31 Thread Robert Krimen
On Jan 31, 2008 11:24 AM, Thomas Klausner [EMAIL PROTECTED] wrote:
 Hi!
 Currently, Catalyst::Plugin::Assets is not available from CPAN anymore.
 Is there a reason for this? Or is it some CPAN hickup?

 It's still on BackPAN, BTW:
 http://backpan.cpan.org/authors/id/R/RK/RKRIMEN/Catalyst-Plugin-Assets-0.020.tar.gz

 But if it won't be continued, I'd rather not use it :-)

Hi, 0.021 is being processed as this e-mail goes out. Yes,
C::P::Assets will continue, I'm not exactly sure
why it disappeared, but it's probably because an upload to PAUSE
didn't take (for some reason).

Thanks for pointing this out.

Rob

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [ANNOUNCE] New plugin: Catalyst::Plugin::Assets

2008-01-21 Thread Robert Krimen
On Jan 20, 2008 7:59 PM, Matt S Trout [EMAIL PROTECTED] wrote:
 You seem to be using an 'assets' config key; please change this to
 'Plugin::Assets' and deprecate the old one. We're currently moving the 'core'
 plugins over to this standard so you should make the change as soon as
 possible to avoid getting live users with the wrong config key.

Okay, I've gone ahead and made this change. The new version, with new
config key preference and warning message, should be available on CPAN
shortly.

--
Rob

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [ANNOUNCE] New plugin: Catalyst::Plugin::Assets

2008-01-14 Thread Robert Krimen
On Jan 14, 2008 6:35 AM, Bill Moseley [EMAIL PROTECTED] wrote:

 I tend to specify the assets in the templates where they are used
 instead of in the controller as it's a presentation issue.   I don't
 see why your Plugin could not do the same thing by using WRAPPERs.

You can certainly do this, and I do it as well. Right now I have an
assets.tt that bundles
the different assets into blocks (core web site, testing, ajax), and
include the appropiate block
depending on the page (and have a default in case none were specified).

 Is it possible to define print, screen, etc. when specifying css?

Unfortunately not yet, although this is something I've been thinking about.

 Do you cache this?

Yes, built/minified files are cached and not rebuilt unless the file
mtime changes.

--
Rob

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/