[Catalyst] Building a PAR file

2009-02-26 Thread Octavian Râşniţă

Hello,

I've tried to create a PAR archive from a Catalyst app and I've done:

1. Put catalyst_par(); in Makefile.PL.

2. Run perl Makefile.PL

3. Run nmake catalyst_par

But it gave the following error:

Writing PAR acces.par
NMAKE : fatal error U1077: 'E:\perl510\bin\perl.exe' : return code '0x2'
Stop. 


Do you have any idea what could be the problem? PAR? Catalyst?

Can't a PAR archive of a Catalyst app be built under Windows?

Thanks.

Octavian


___
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] Add a /doc/ path at the end of all paths?

2009-02-26 Thread Ovid
Hi all,

We're trying to make our REST API a bit more friendly,  We have a base class 
for our REST API which inherits from Catalyst::Controller::REST.   Our various 
REST classes which inherit from this and each class can identify the query 
parameters it accepts.  So we thought it would be nice to put this into the 
base class:

  sub doc : Regex('/doc$') {
  my ($self, $c) = @_;
  $c-stash-{params} = $c-forward('allowed_query_params');
  }

And from there, every REST url could have /doc/ added to the end to show which 
query parameters it accepts.

It doesn't work.  $self is *always* a PIPs::C::API::V1::Franchise instance, no 
matter which URL is called.  This appears to be because of this:

  [26 Feb 2009 15:07:40,509] [Catalyst.Dispatcher] [DEBUG] Loaded Private 
actions:
  
.---+--+--.
  | Private   | Class| Method   
|
  
+---+--+--+
  ...
  | /api/v1/franchise/doc | PIPs::C::Api::V1::Franchise  | doc  
|

So the very first instance of the doc method dispatches through Franchise, 
even if the controller for a given URL would be API::V1::Warning or something 
like that.

How can I work around this?  LocalRegex doesn't work, obviously, and chained 
actions don't seem appropriate because, due to the nature of our app, we never 
know how many path parts will be between '/api/v1/' and '/doc/'.

What am I missing? :)

Cheers,
Ovid
 --
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog- http://use.perl.org/~Ovid/journal/
Twitter  - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6


___
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 on Windows: fork issues

2009-02-26 Thread Rodrigo
Stefan, I've had similar problems in windows with prefork, which can be
started up after some tweaking, but will hang after a few requests. Perl's
fork() is a no-no in windows. FCGI can be painful to setup, so I ended up
giving up on it. I went on to use mod_perl with Apache, which has problems
of its own too, but a more trivial setup. Finally, the approach I'm using
right now is to setup a pool of single-threaded Catalyst dev servers,
starting them up in a startup.bat such as this:

start /b perl script\myapp_server.pl -p 3000
start /b perl script\myapp_server.pl -p 3001
start /b perl script\myapp_server.pl -p 3002
...

If you wish to keep all your logs in one place:

startup.bat myapp.log 21

Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to
balance the load among dev servers. Make sure you understand the drawbacks
of using catalyst dev servers in this manner, even though they work
superbly.

httpd.conf (or apache2.conf or etc.):

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Proxy balancer://cat
  BalancerMember http://localhost:3000
  BalancerMember http://localhost:3001
   BalancerMember http://localhost:3002
/Proxy

ProxyPass / balancer://cat/
ProxyPassReverse / balancer://cat/

Take a look around the web for other settings that you may need, such as
catalyst's using_frontend_proxy and apache's static aliases, balancer
features, etc. Apache is extremely lightweight if you only run it for
reverse proxy load-balancing.

If you want to startup your catalyst server pool from a windows service
using a configuration file, I have a perl script that does that somewhere.
Just let me know.

Hope this works for you.

--rodrigo
___
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 on Windows: fork issues

2009-02-26 Thread Kieren Diment
Good call.  Lighttpd will be much simpler than  apache, as it's a  
single standalone executable, just run it with lighttpd -f  
my_config_file


Here's a vbs that will get your .bat file that does all of the jiggery- 
pokery running without a cmd.exe window at startup.  I put everything  
in %APPLICATION_DATA% except for this start.vbs script which goes in ~/ 
Startup or whatever the stupid naming convention is in windows.




On 27/02/2009, at 10:45 AM, Rodrigo wrote:

Stefan, I've had similar problems in windows with prefork, which can  
be
started up after some tweaking, but will hang after a few requests.  
Perl's
fork() is a no-no in windows. FCGI can be painful to setup, so I  
ended up
giving up on it. I went on to use mod_perl with Apache, which has  
problems
of its own too, but a more trivial setup. Finally, the approach I'm  
using

right now is to setup a pool of single-threaded Catalyst dev servers,
starting them up in a startup.bat such as this:

start /b perl script\myapp_server.pl -p 3000
start /b perl script\myapp_server.pl -p 3001
start /b perl script\myapp_server.pl -p 3002
...

If you wish to keep all your logs in one place:

startup.bat myapp.log 21

Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to
balance the load among dev servers. Make sure you understand the  
drawbacks

of using catalyst dev servers in this manner, even though they work
superbly.

httpd.conf (or apache2.conf or etc.):

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Proxy balancer://cat
BalancerMember http://localhost:3000
BalancerMember http://localhost:3001
 BalancerMember http://localhost:3002
/Proxy

ProxyPass / balancer://cat/
ProxyPassReverse / balancer://cat/

Take a look around the web for other settings that you may need,  
such as
catalyst's using_frontend_proxy and apache's static aliases,  
balancer

features, etc. Apache is extremely lightweight if you only run it for
reverse proxy load-balancing.

If you want to startup your catalyst server pool from a windows  
service
using a configuration file, I have a perl script that does that  
somewhere.

Just let me know.

Hope this works for you.

--rodrigo
___
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] Catalyst on Windows: fork issues

2009-02-26 Thread Kieren Diment

Haha, here's the vbs:

Set fso = CreateObject(Scripting.FileSystemObject)
Set WshShell = CreateObject(WScript.Shell)
WshShell.Run chr(34)
fso.GetParentFolderName(wscript.ScriptFullName)  \perl

shell.bat Chr(34), 0
Set WshShell = Nothing

And I put a shortcut to this in ~/startup, Shortcut.exe (free  
download) seems to work.  Here's my install.bat script ;) :



@echo off
set bindir=%~dp0
set bindir=%bindir:~0,-1%
mkdir %APPDATA%\MyPersonalHomePage
echo ...
echo Copying application to hard drive, please be patient 
xcopy /E /C /Y /Q  %bindir% %APPDATA%\MyPersonalHomePage
echo ...
echo Creating link in  startup folder
echo ...
mkdir %APPDATA%\..\Start Menu\Programs\Startup
Shortcut.exe /R:7 /A:C /T:%APPDATA%\MyPersonalHomePage 
\startmyphp.vbs  /F:%AP
PDATA%\..\Start Menu\Programs\Startup\Start Personal Home Page  
Server.lnk

%APPDATA%\MyPersonalHomePage\startmyphp.vbs

On 27/02/2009, at 10:45 AM, Rodrigo wrote:

Stefan, I've had similar problems in windows with prefork, which can  
be
started up after some tweaking, but will hang after a few requests.  
Perl's
fork() is a no-no in windows. FCGI can be painful to setup, so I  
ended up
giving up on it. I went on to use mod_perl with Apache, which has  
problems
of its own too, but a more trivial setup. Finally, the approach I'm  
using

right now is to setup a pool of single-threaded Catalyst dev servers,
starting them up in a startup.bat such as this:

start /b perl script\myapp_server.pl -p 3000
start /b perl script\myapp_server.pl -p 3001
start /b perl script\myapp_server.pl -p 3002
...

If you wish to keep all your logs in one place:

startup.bat myapp.log 21

Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to
balance the load among dev servers. Make sure you understand the  
drawbacks

of using catalyst dev servers in this manner, even though they work
superbly.

httpd.conf (or apache2.conf or etc.):

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Proxy balancer://cat
BalancerMember http://localhost:3000
BalancerMember http://localhost:3001
 BalancerMember http://localhost:3002
/Proxy

ProxyPass / balancer://cat/
ProxyPassReverse / balancer://cat/

Take a look around the web for other settings that you may need,  
such as
catalyst's using_frontend_proxy and apache's static aliases,  
balancer

features, etc. Apache is extremely lightweight if you only run it for
reverse proxy load-balancing.

If you want to startup your catalyst server pool from a windows  
service
using a configuration file, I have a perl script that does that  
somewhere.

Just let me know.

Hope this works for you.

--rodrigo
___
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] (OT) Navigation parameters in session

2009-02-26 Thread f00li5h
On Fri, 27 Feb 2009 03:54:04 +1100, Zbigniew Lukasiak zzb...@gmail.com wrote:

 Here at work we have this rule that the page urls should not contain
 any parameters (think page number, sorting order etc) - but that
 everything should be hidden in the session.  I think I can have some
 fighting chance to counter that trend if I feed the bosses with some
 authoritative enough documents.  Do you guys know something fitting?
 Or maybe it is me who is mistaken - and this is a great idea indeed?

Is it just GET parameters that are forbidden? Can you get away with using path 
segments?
can you use /foo/cats/paged/3 and still fit this rule?

Also, hiding things in the session will get you silly results (and not the good 
kind of silly) and a confused user when the session expires while the user is 
not looking.

user clicks next page
user meets login page
all state is lost when new session is created
user comes looking for a spine to put an axe in

-- 
=^_^=
($site = $email) =~ s/\@/./;

___
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 on Windows: fork issues

2009-02-26 Thread Chris
 And I put a shortcut to this in ~/startup, Shortcut.exe (free download)
 seems to work.  Here's my install.bat script ;) :



And here's how to create a shortcut in vbs, so you don't need shortcut.exe:
(This creates a link to an access MDE-based app, but the principal applies..)

Set oWS = WScript.CreateObject(WScript.Shell)
sLinkFile = C:\app.LNK
Set oLink = oWS.CreateShortcut(sLinkFile)

oLink.TargetPath = C:\Program Files\Microsoft Office\Office\MSAccess.exe
oLink.Arguments = /wrkgrp M:\app.mdw C:\app\app.mde
oLink.Description = An App
oLink.WorkingDirectory = C:\appdir
oLink.IconLocation = C:\Program Files\Microsoft Office\Office\MSAccess.exe, 1

oLink.Save


- Chris

___
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: (OT) Navigation parameters in session

2009-02-26 Thread Aristotle Pagaltzis
Users will not be e able to use the back button, and they will
not be able to work in multiple tabs. You will not be able to
load-balance as effectively as you could without sessions. A lot
of your content will be hidden from search engines. I could think
of more, but that should be enough for a start.

If you need an argument from authority, ask why none of the
biggest sites like Google, Amayon, etc do it that way.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.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] Re: (OT) Navigation parameters in session

2009-02-26 Thread Zbigniew Lukasiak
On Fri, Feb 27, 2009 at 4:11 AM, Aristotle Pagaltzis pagalt...@gmx.de wrote:
 Users will not be e able to use the back button, and they will
 not be able to work in multiple tabs. You will not be able to
 load-balance as effectively as you could without sessions. A lot
 of your content will be hidden from search engines. I could think
 of more, but that should be enough for a start.


Thanks for you all for the arguments.  The crazy thing is that they
believe that with some
Javascript magic we'll be able to manage the multiple tabs and back
button problem.

 If you need an argument from authority, ask why none of the
 biggest sites like Google, Amayon, etc do it that way.


:) - this has potential.

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

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


Re: [Catalyst] Re: (OT) Navigation parameters in session

2009-02-26 Thread Hans Dieter Pearcey
On Fri, Feb 27, 2009 at 08:12:55AM +0100, Zbigniew Lukasiak wrote:
 Thanks for you all for the arguments.  The crazy thing is that they
 believe that with some
 Javascript magic we'll be able to manage the multiple tabs and back
 button problem.

And now you have three problems.

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/