Re: [Catalyst] how do you distribute a catalyst app

2009-06-12 Thread Hans Dieter Pearcey
On Fri, Jun 12, 2009 at 08:43:08AM +0300, Octavian Rasnita wrote:
 Could it be possible to use local::lib and specify that I want to skip the
 tests for the current module?

This also doesn't have anything to do with local::lib.  Look for 'notest' in
the CPAN.pm docs.

(This is a potentially bad idea for all the same reasons 'force' is.)

local::lib has nothing to do with how CPAN.pm behaves.  Any questions you have
about how can I do X while using CPAN.pm should be looked up in the CPAN.pm
documentation.

local::lib sets environment variables that Module::Build and
ExtUtils::MakeMaker use to determine what directory they should go into, and
for perl to add extra paths to @INC, and corresponding variables for both
inside a Perl process that you use it in.  That's all.  You seem to have the
impression that it touches much more than it actually does, and I think you'll
be less confused and have an easier time answering your own questions if you
understand local::lib's scope.

hdp.

___
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] Killing the standalone perl server programatically

2009-06-12 Thread Stefan Washietl
I'm developing a desktop application using Catalyst and the brand new 
Titanium framework (http://www.appcelerator.com/).


I need to start/stop the standalone server programatically. Starting is 
easy, but stopping the server (and its forks) again is tricky. I'd like 
a solution without keeping track of the PID and explicitely kill it from 
outside. I want to have something like


http://localhost:3000/kill

that calls something in the controller to shut down. The obvious thing

exit(0);

does not work. Any ideas how to do this?

Stefan

___
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] Killing the standalone perl server programatically

2009-06-12 Thread Kieren Diment

 sub quit : Local {
 exit 1;
 }

and a href=[% c.uri_for('quit') %] onClick=return confirm('This  
will terminate  your session. Are you sure?')Quit/a


both worked fine for me when I did this the other day.

But that was using a desktop OS (Windows and OS X fwiw), not a mobile  
platform.




On 12/06/2009, at 11:19 PM, Stefan Washietl wrote:

I'm developing a desktop application using Catalyst and the brand  
new Titanium framework (http://www.appcelerator.com/).


I need to start/stop the standalone server programatically. Starting  
is easy, but stopping the server (and its forks) again is tricky.  
I'd like a solution without keeping track of the PID and explicitely  
kill it from outside. I want to have something like


http://localhost:3000/kill

that calls something in the controller to shut down. The obvious thing

exit(0);

does not work. Any ideas how to do this?

Stefan

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




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


Re: [Catalyst] Can't call method run on an undefined value

2009-06-12 Thread Ascii King
That solved it, thanks!  I had replaced the wrong line in the 
lib\MyApp.pm when following the tutorial.


Ian Wells wrote:

2009/6/11 Ascii King t...@swattermatter.com:
  

When I create and run a new Catalyst app form the CPAN tutorial, I get the
following error:

Can't call method run on an undefined value at
C:/Perl/site/lib/Catalyst.pm line 2094.



Just had this myself.  Do you have a call to __PACKAGE__-setup in
lib/MyApp.pm ?  In an autocreated application it should be there, but
this is the error you get if you remove it.

  


___
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] Killing the standalone perl server programatically

2009-06-12 Thread Hans Dieter Pearcey
On Fri, Jun 12, 2009 at 02:19:19PM +0100, Stefan Washietl wrote:
 The obvious thing

 exit(0);

 does not work. Any ideas how to do this?

  purl Look buddy, doesn't work is a strong statement. Does it sit on the
 couch all day?  Is it making faces at you? Does it want more money? Is
 it sleeping with your girlfriend?  Please be specific!

You will get much more useful help if you tell us exactly what code you wrote,
what you expected, and what happened instead, including error messages (if
any), instead of summing it all up as exit(0) does not work.

You mentioned the standalone server (and its forks), but by default the
standalone server doesn't fork, so you should also be more specific about how
you're running it.

hdp.

___
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] Killing the standalone perl server programatically

2009-06-12 Thread J. Shirley
On Fri, Jun 12, 2009 at 6:50 AM, J. Shirley jshir...@gmail.com wrote:

 On Fri, Jun 12, 2009 at 6:19 AM, Stefan Washietl w...@paperpile.orgwrote:

 I'm developing a desktop application using Catalyst and the brand new
 Titanium framework (http://www.appcelerator.com/).

 I need to start/stop the standalone server programatically. Starting is
 easy, but stopping the server (and its forks) again is tricky. I'd like a
 solution without keeping track of the PID and explicitely kill it from
 outside. I want to have something like

 http://localhost:3000/kill

 that calls something in the controller to shut down. The obvious thing

 exit(0);

 does not work. Any ideas how to do this?

 Stefan


 I just set this up with a combination of HTTP::Prefork and
 FCGI::Engine::Manager.  I'm still floundering away a bit at a refactor of
 FCGI::Engine::Manager that is semantically more sound, but it works well
 enough right now.

 You'll have to grab Catalyst::Engine::HTTP::Prefork out of svn, or prod
 andyg enough so he releases (HEY ANDY!)

 http://dev.catalystframework.org/repos/Catalyst/trunk/Catalyst-Engine-HTTP-Prefork/


 Here's all the yummy bits from my setup: http://gist.github.com/128642

 You can just run script/myapp_admin.pl start|stop

 One thing, I copied the script/myapp_server.pl over to
 script/myapp_prefork.pl and changed the default CATALYST_ENGINE to
 HTTP::Prefork.

 This is because I couldn't figure out a clean way to set the ENV in
 FCGI::Engine::Manager::Server classes, but it's a temporary hack until I
 wrap that up.

 Hope this helps,


I forgot to finish this off, you can have the kill action then run the stop
command and then everything is going from the same point.  Just executing a
system call to kill it means that the current request should finish cleanly,
along with everything else.

It may be overkill, but that's how I'd do it (just so any post-shutdown
scripts are always executed, etc)

-J
___
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] [OT] CGI glue to FastCGI servers

2009-06-12 Thread Ian Wells
Anyone know of a CGI script that forwards a request to a FastCGI server?

I'd like to deploy something under Catalyst on a shared machine, and
I'm not in control of the Apache configuration.  It has CGI set up,
but no FastCGI or mod_perl, so I was thinking stopgap measures.

Cheers,
-- 
Ian.

___
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] Killing the standalone perl server programatically

2009-06-12 Thread Stefan Washietl

 On Fri, Jun 12, 2009 at 6:50 AM, J. Shirley jshir...@gmail.com
 mailto:jshir...@gmail.com wrote:

ou'll have to grab Catalyst::Engine::HTTP::Prefork out of svn, or
prod andyg enough so he releases (HEY ANDY!)
http://dev.catalystframework.org/repos/Catalyst/trunk/Catalyst-Engine-HTTP-Prefork/


Thank you. I'll have a look at this solution. It is probably a good idea 
to use Engine::HTTP::Prefork anyway instead of the simple 
test/development-server.



J. Shirley wrote:
On Fri, Jun 12, 2009 at 6:50 AM, J. Shirley jshir...@gmail.com 
mailto:jshir...@gmail.com wrote:


On Fri, Jun 12, 2009 at 6:19 AM, Stefan Washietl w...@paperpile.org
mailto:w...@paperpile.org wrote:

I'm developing a desktop application using Catalyst and the
brand new Titanium framework (http://www.appcelerator.com/).

I need to start/stop the standalone server programatically.
Starting is easy, but stopping the server (and its forks) again
is tricky. I'd like a solution without keeping track of the PID
and explicitely kill it from outside. I want to have something like

http://localhost:3000/kill

that calls something in the controller to shut down. The obvious
thing

exit(0);

does not work. Any ideas how to do this?

Stefan


I just set this up with a combination of HTTP::Prefork and
FCGI::Engine::Manager.  I'm still floundering away a bit at a
refactor of FCGI::Engine::Manager that is semantically more sound,
but it works well enough right now.

You'll have to grab Catalyst::Engine::HTTP::Prefork out of svn, or
prod andyg enough so he releases (HEY ANDY!)

http://dev.catalystframework.org/repos/Catalyst/trunk/Catalyst-Engine-HTTP-Prefork/


Here's all the yummy bits from my setup: http://gist.github.com/128642

You can just run script/myapp_admin.pl start|stop

One thing, I copied the script/myapp_server.pl over to
script/myapp_prefork.pl and changed the default CATALYST_ENGINE to
HTTP::Prefork.

This is because I couldn't figure out a clean way to set the ENV in
FCGI::Engine::Manager::Server classes, but it's a temporary hack
until I wrap that up.

Hope this helps,


I forgot to finish this off, you can have the kill action then run the 
stop command and then everything is going from the same point.  Just 
executing a system call to kill it means that the current request should 
finish cleanly, along with everything else.


It may be overkill, but that's how I'd do it (just so any post-shutdown 
scripts are always executed, etc)


-J




___
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] Catalyst-Model-Validated example broken?

2009-06-12 Thread Guillaume Chambriat
Hello,

wishing to use Moose type constraints to validate my actions input,
I eventually discovered examples/Catalyst-Model-Validated in the SVN
repository.

Does anyone use this code? If not, what are you using instead?

As it seems to be quite an elegant way to achieve my needs, despite
the apparent alpha status, I wanted to give it a try, but I ran into
a few problems.

1. there seems to be some inconsistency in it: both Makefile.PL and
   POD reference the nonexistent Catalyst::Model::ValidatedAction
   instead of Catalyst::Model::Validated

2. more importantly, after fixing this, running the test server with
   Catalyst::Runtime 5.80005 fails with the following error, which
   I was unfortunately not able to fix:

Couldn't instantiate component MyApp::Model::User, COMPONENT()
method (from Catalyst::Model::Validated) didn't return an object-like
value (value was MyApp::Model::User). at script/myapp_server.pl line
55
Compilation failed in require at script/myapp_server.pl line 55.

3. using Class::MOP 0.85, the test suite fails.

Not only it outputs a bunch of deprecation warnings (which might be
the root of the other encountered problems... or not):

  The compute_all_applicable_attributes method has been deprecated.
  Use get_all_attributes instead.
  at /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm line 974

But 01-basic.t's test #12 fails:

  Use of uninitialized value $value in length at
  
/home/intrigeri/tmp/spamker/examples/Catalyst-Model-Validated/blib/lib/Catalyst/Model/Validated.pm
  line 190.

  #   Failed test at t/01-basic.t line 75.
  # Structures begin differing at:
  #  $got-{baz}[0] = 'required'
  # $expected-{baz}[0] = 'HashRef'
  # Looks like you failed 1 test of 12.
  t/01-basic.t .. Dubious, test returned 1 (wstat 256, 0x100)
  Failed 1/12 subtests

Any idea?

Bye,
-- 
  Guillaume Chambriat g...@riseup.net
 

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


Re: [Catalyst] Catalyst-Model-Validated example broken?

2009-06-12 Thread Eden Cardim
On Fri, Jun 12, 2009 at 12:11 PM, Guillaume Chambriatg...@riseup.net wrote:
 wishing to use Moose type constraints to validate my actions input,
 I eventually discovered examples/Catalyst-Model-Validated in the SVN
 repository.

 Does anyone use this code? If not, what are you using instead?

This is an unmaintained oversimplification of how Reaction works. I
put the example up as proof-of-concept code. I believe castaway has
gone a bit further and integrated this into a production app.

-- 
   Eden Cardim   Need help with your Catalyst or DBIx::Class project?
  Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://edenc.vox.com/http://www.shadowcat.co.uk/servers/

___
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] uri_for() corrupts query parameters hash for caller

2009-06-12 Thread Byron Young
Hey everybody,

I ran into an issue at $work where we keep passing the same $query_params 
hashref to a number of uri_for() calls successively, but if there are 
characters in the query params that need to be escaped they get escaped each 
time, leading to sequences like

?filter=Not%25252BRun 

after the same $query_params have been run through uri_for a few of times 
(because the '%' keeps getting escaped).  The query hash was originally { 
filter = 'Not Run' }.

So, we patched uri_for() here at work to create a copy of $params and work with 
that, and that fixes the issue.  However, it seems like such a simple fix that 
I feel like it must have been thought of and discussed and shot down in the 
past, but I didn't find anything in the list archives indicating that.  Is 
there some reason uri_for() does things that way?

If not I'll gladly supply patch + test.

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/


[Catalyst] RE: uri_for() corrupts query parameters hash for caller

2009-06-12 Thread Byron Young
Byron Young wrote on 2009-06-12:
 Hey everybody,
 
 I ran into an issue at $work where we keep passing the same
 $query_params hashref to a number of uri_for() calls successively,
 but if there are characters in the query params that need to be
 escaped they get escaped each time, leading to sequences like
 
 ?filter=Not%25252BRun
 
 after the same $query_params have been run through uri_for a few of
 times (because the '%' keeps getting escaped).  The query hash was
 originally { filter = 'Not Run' }.
 
 So, we patched uri_for() here at work to create a copy of $params
 and work with that, and that fixes the issue.  However, it seems
 like such a simple fix that I feel like it must have been thought
 of and discussed and shot down in the past, but I didn't find
 anything in the list archives indicating that.  Is there some
 reason uri_for() does things that way?
 
 If not I'll gladly supply patch + test.
 
 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/

I also noticed that the docs for uri_for used to warn of the destructiveness 
but that warning has been removed in more recent versions.  I'd like to suggest 
that it be added back and made more prominent if there really is a good reason 
for mangling the caller's data.  I can provide a doc patch in that case, too.

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/