Re: [Catalyst] stripping path parts and then redispatch?

2009-02-24 Thread Bill Moseley
On Wed, Feb 25, 2009 at 01:12:57AM +, Tomas Doran wrote:
>
> On 24 Feb 2009, at 18:49, Larry Leszczynski wrote:
>>
>> I'll be happy to give it a go, if someone can suggest appropriate  
>> places
>> to add this to the POD and/or wiki...
>
> How about here: http://dev.catalyst.perl.org/wiki/wikicookbook
>
  $c->SUPER::prepare_path(@_);

>
> Tiny nit pick - you probably want to say $c->next::method(@_) rather  
> than SUPER::.

Or what I sent to Larry:

$c->NEXT::prepare_path;

At what catalyst version can you use $c->next:: ?

-- 
Bill Moseley
mose...@hank.org
Sent from my iMutt


___
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] stripping path parts and then redispatch?

2009-02-24 Thread Tomas Doran


On 24 Feb 2009, at 18:49, Larry Leszczynski wrote:


I'll be happy to give it a go, if someone can suggest appropriate  
places

to add this to the POD and/or wiki...


How about here: http://dev.catalyst.perl.org/wiki/wikicookbook


 $c->SUPER::prepare_path(@_);



Tiny nit pick - you probably want to say $c->next::method(@_) rather  
than SUPER::.


I don't think it matters one jot in this case, but this is  
recommended as general practice :)


Cheers
t0m

___
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] Requirements for Catalyst

2009-02-24 Thread Roland Lammel
On Sun, Feb 22, 2009 at 00:04, Jonathan Rockway  wrote:
> * On Sat, Feb 21 2009, Octavian Râşniţă wrote:
>> Hello,
>>
>> It is very clear that a Catalyst app can't run on a shared host, but
>> it requires either a dedicated server or a VPS.
>> I am searching for web space providers that offer VPS and I've seen
>> that they use to set their tariff plans mainly on the guaranteed
>> memory, but I don't know which would be the necessary memory for a VPS
>> that runs an OS like Fedora or CentOS, Apache, Perl and Catalyst.
>>
>> Could be 256 MB of memory enough? Or 512? Or I would need 1 GB or more
>> if I would like to run a Catalyst app?

We're running a small online course management application with a
JavaScript based frontend and a catalyst/dbic backend (mostly accessed
via JSON based API, 25 tables, quite some logic in 20 controllers).

Cat is using only approx. 50MB of memory, which is great. Although we
do no great deal of caching yet. But this will be done using dbd or
memcached anyway, so it won't increase the memsize of cat.
And we have yet to find any memleaks, the app is running for months with now...

+rl

-- 
Roland Lammel
QuikIT - IT Lösungen - flexibel und schnell
Web: http://www.quikit.at
Email: i...@quikit.at

"Enjoy your job, make lots of money, work within the law. Choose any two."

___
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] Requirements for Catalyst

2009-02-24 Thread Scott McWhirter
On Tue, Feb 24, 2009 at 13:38, Jason Kohles  wrote:
> EC2 has persistent storage now (now meaning as of last April), so you can
> have volumes on your hosts that are backed by S3, so you don't lose your
> data when the instance goes away.

EBS volumes aren't backed on S3. They are simply persistent block
devices (run on NAS storage) that you can attach and detach from EC2
instances. However, you can "snapshot" the volume and these snapshots
are stored on S3. The benefit to snapshots is that the snapshots are
incremental backups (only store what has changed since the last
snapshot) and they are stored compressed. To re-initialize a snapshot,
you can simply create a new EBS volume based on a snapshot.

Also important to note is that with EBS volumes, you get charged based
on IO requests as well as the storage space used by the size of the
volume (ie: you have a volume of 180Gb, you get charges for 180Gb of
storage even if you have nothing on it).

> Ultimately though, if you don't need the flexibility of EC2 and are planning
> to just have one host running 24/7, then EC2 is roughly the same price as
> just getting a colocated server somewhere.

For a small instance it's about $75 a month on average to run
(instance hours charges). A large instance is about $300 a month. If
you want to run a database server, i recommend backing onto an EBS
volume and running a "large" instance... there are some serious
problems with IO performance on the "small" ec2 instances.

ta!


-- 
-Scott McWhirter- | -konobi-
[ Technology Consultant - Cloudtone Studios ]

___
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] Requirements for Catalyst

2009-02-24 Thread Jason Kohles

On Feb 22, 2009, at 12:10 AM, Jonathan Rockway wrote:

Oh yeah, one other option is Amazon EC2.  They are very scalable (a  
perl

script can buy you a new machine on demand), but not quite as friendly
(if your instance crashes, all your data is lost).  They are also kind
of expensive.  If you use S3, though, you can save a lot of money with
the free EC2 <-> S3 transfers.



EC2 has persistent storage now (now meaning as of last April), so you  
can have volumes on your hosts that are backed by S3, so you don't  
lose your data when the instance goes away.


Ultimately though, if you don't need the flexibility of EC2 and are  
planning to just have one host running 24/7, then EC2 is roughly the  
same price as just getting a colocated server somewhere.


--
Jason Kohles, RHCA RHCDS RHCE
em...@jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire



___
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] stripping path parts and then redispatch?

2009-02-24 Thread Larry Leszczynski

On Tue, 24 Feb 2009 05:54 +0200, "Octavian Râsnita" 
wrote:
> I think this solution should be put at least in a wiki if not in the POD 
> manual.
> 
> Octavian

I'll be happy to give it a go, if someone can suggest appropriate places
to add this to the POD and/or wiki...

Larry



> 
> - Original Message - 
> From: "Larry Leszczynski" 
> To: "Bill Moseley" ; "Catalyst Framework" 
> 
> Sent: Tuesday, February 24, 2009 3:44 AM
> Subject: Re: [Catalyst] stripping path parts and then redispatch?
> 
> 
> > Just wanted to pass along some solutions...
> >
> > To recap briefly:
> >
> > URLs are prefixed with the page language, e.g "/en/foo/bar".  The
> > language needs to be stripped off and stashed, and the remainder of the
> > request processed as if the language part had not been there, e.g.
> > "/foo/bar".
> >
> > I was trying to use $c->go("/foo/bar"), which works if there is a
> > Foo::bar() action, but which breaks if the action is supposed to be
> > Foo::default() with the argument "bar" (or Foo::Bar::default() with no
> > arguments).
> >
> >
> > 1) Bill Moseley suggested a different approach which is seeming to work
> > pretty well so far (thanks Bill), it involves subclassing
> > MyApp->prepare_path() to tweak the path at beginning of processing,
> > something like this:
> >
> >  sub prepare_path
> >  {
> >  my $c = shift;
> >
> >  $c->SUPER::prepare_path(@_);
> >
> >  my @path_chunks = split m[/], $c->request->path, -1;
> >
> >  return unless (   @path_chunks
> > && $valid_languages{$path_chunks[0]});
> >
> >  # Pull off first path chunk:
> >  my $language = shift @path_chunks;
> >  $c->stash->{language} = $language;
> >
> >  # Create a request path from the remaining chunks:
> >  my $path = join('/', @path_chunks) || '/';
> >
> >  # Stuff modified request path back into request:
> >  $c->request->path($path);
> >
> >  # Update request base to include whatever
> >  # was stripped from the request path:
> >  my $base = $c->request->base;
> >  $base->path($base->path . $language . '/');
> >  }
> >
> > A nice side effect is that tweaking $c->request->base to include the
> > language means the language is automatically included when you call
> > $c->uri_for().
> >
> >
> > 2) In the process of trying to get $c->go() to work for an arbitrary
> > path, I found a way that seems to make it work consistently even if the
> > path is supposed to hit a default action:
> >
> ># Create your request path to wherever:
> >my $path = "/foo/bar/baz";
> >
> ># Stuff modified request path back into request:
> >$c->request->path($path);
> >
> ># Create a new $c->action using $c->request->path.
> ># Updates $c->action and $c->request->args.
> >$c->dispatcher->prepare_action($c);
> >
> >$c->go($c->action, $c->request->args);
> >
> > This should work for any of $c->forward(), $c->detach(), $c->visit(),
> > $c->go().
> >
> >
> > Thanks for all the suggestions,
> > Larry
> >
> > ___
> > 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/

___
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] Plugin::Authentication overrides $c->req->user

2009-02-24 Thread Daniel Westermann-Clark
On 2009-02-21 01:49:51 +, Tomas Doran wrote:
>> Attached is a set of patches to add support for $c->req->remote_user,
>> including a basic test.
>
> Good stuff, thanks. I've branched 5.80 trunk and applied your
> Runtime change, and then I've fiddled the 'do we warn' logic to be a
> bit safer. Have a look and let me know what you think?

Yeah, the 'do we warn' logic was a bit hairy.  I used caller because
the engines would trigger the warning when they call $c->req->user
(every request), even with an empty REMOTE_USER environment variable.

> Is anything in the current test suite triggering the new warning? If
> so, can you switch it over to be calling ->remote_user instead, and
> can you add a call to read ->user which provokes the warning, and
> test you get the expected warning (see t/deprecated.t r9354 - you
> could just add the warning test here/to that app which already has
> its global logger overridden?)

There were no tests for $c->req->user.  I've committed a test to
t/deprecated.t that currently fails due to the problem above (we
should only get one warning); please let me know if you have any
suggestions.

Thanks,

-- 
Daniel Westermann-Clark

___
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::Factory::PerRequest: missing something?

2009-02-24 Thread Alex Povolotsky

Hello!

I'm trying to glue Mail::IMAPTalk to Catalyst::Model with 
C::M::Factory::PerRequest and I'm sorely missing something important.


What should I write to glue module to make it a simple thing - on first 
request to $c->model('IMAP') read server name from config and just 
connect to it?


I need to call 
Mail::IMAPTalk->new(Server=>$c->config()->{'Webmail::Model::IMAP'}->{server}), 
that's all.


Alex.


___
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] windows install issues (Was: RFC: New to Catalystquestions)

2009-02-24 Thread Rodrigo
I set the variable DBICTEST_NO_SQLITE_CHECK to 1 and ignored the error.

The Makefile.PL for DBIx::Class happens to be doing a fork() just before it
connects to dbi:SQLite:memory and runs its tests. And using fork() in
Windows may just-work... or may not. Specially when loading a dll is
involved.

--rodrigo

On Tue, Feb 24, 2009 at 7:45 AM, Dan Dascalescu <
ddascalescu+catal...@gmail.com > wrote:

> >> I also couldn't install DBD::mysql, even though I've also tried without
> >> cpan, because on dmake it gives some errors I don't understand
>
> I had DBD::SQLite fail the stress test that DBIx::Class runs. Any
> solution for that one? I also just posted about it on the Strawberry
> Perl mailing list:
>
> http://www.mail-archive.com/win32-vani...@perl.org/msg00103.html
>
> Dan
>
> ___
> 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] New version of InstantCRUD

2009-02-24 Thread Alexander Hartmaier
I've already done a module I load in the ResultSource class of all my
table classes which consists of a 'sub get_fvs_profile' which uses the
dbic metadata to generate a FormValidator::Simple profile for use with
DBIx::Class::Validation.

I'd say that should go into DBIx::Class::Validation.

-  Alex


Am Montag, den 23.02.2009, 11:33 +0100 schrieb Moritz Onken:
> Am 23.02.2009 um 10:53 schrieb Alexander Hartmaier:
>
> > I'm currently patching the hell out of Controller::DBIC::API.
> > Search by passing a json string and pagination is already in the repo,
> > prefetch support is done but needs some sort of controller side
> > restriction so that someone can't fetch the contents of the whole db
> > by
> > using the rels (api for that welcome).
> >
> > This should/could be the basis for ajax based LFB modules to load data
> > instead of relying on an LFB internal API.
> >
> > What I'd like to see is a more split up LFB so I could use the (extjs)
> > form generation on a per table (=controller) basis wherever I need it
> > (for tables where a customized form isn't needed).
> >
> > -  Alex
>
>
> Hi all,
>
> I'm following a different approach. My current project uses HTML::FormFu
> config files for both validating user input and generating json which
> contains the data of a resultset or result row. I do not use the html
> generation capabilities of FormFu, just validation, filters,
> transformers,
> inflators and deflators.
>
> I wrote http://search.cpan.org/~perler/DBIx-Class-AsObject-0.09_01/
> which
> is far from being stable. But it generates a perl object from a result
> row
> using a HTML::FormFu configuration file.
>
> I think Controller::DBIC::API lacks of the ability to do proper
> validation.
> Maybe we can join forces on that one and add a configuration file to
> each controller.
>
>
> moritz
>
> ___
> 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/


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be 
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*

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