catalyst

How can I select only specific columns when using prefetch in DBIx-Class?

橙三吉。 提交于 2019-12-07 17:53:32
问题 I'm struggling with fairly fundamental DBIx-Class prefetch usage. I want to limit the columns that are returned from joined tables when prefetch is used. This: my $rs = $schema->resultset('CD')->search( {}, # No searching restrictions through WHERE clause { prefetch => [qw/ artist /], columns => [qw/ title artist.name /], } ); Generates this SQL: SELECT cd.title, artist.* FROM cd JOIN artist ON cd.artist = artist.id But I don't want to haul down all of the artist columns, just the cd.title

Catalyst Controller Questions

让人想犯罪 __ 提交于 2019-12-07 17:22:14
问题 I just used catalyst for my first large project and I was left wondering if I used catalyst in the way it was meant to be used. I have Root.pm and inside of that file I put multiple url handlers. Is it a best practice to have one controller per url or should a grouping be considered? 回答1: One of the beauties of Catalyst is its flexibility. You can do this however it best suits your application. If you only have a handful of URLs you support, then there's nothing intrinsically wrong with

Spark: Explicit caching can interfere with Catalyst optimizer's ability to optimize some queries?

邮差的信 提交于 2019-12-06 13:02:27
I'm studying to take the data bricks to spark certification exam, and their practice exam ( please see > https://databricks-prod-cloudfront.cloud.databricks.com/public/793177bc53e528530b06c78a4fa0e086/0/6221173/100020/latest.html ) requires us to accept this statement as true fact: "Explicit caching can decrease application performance by interfering with the Catalyst optimizer's ability to optimize some queries" I got this question wrong even though I have read up a lot on the catalyst and have a pretty good grasp of the details. So I wanted to shore up my knowledge of this topic and go to

How do I turn Moose objects into JSON for use in Catalyst?

北城以北 提交于 2019-12-06 12:07:20
I have a series of Moose objects that I'm looking to feed to JSON::XS by way of Catalyst::View::JSON . JSON::XS is unable to encode blessed data-structures. I know that there is MooseX::Storage::Format::JSON which can -- kinda -- do what I want; but, it seems pretty overly heavy. What I'm looking for is essentially the same information that XXX.pm provides. I just want the raw-data structures recursively unblessed so JSON::XS (the driver for JSON::Any that C:V:JSON uses internally) can display it. What is the best way go about using Catalyst::View::JSON and JSON::XS with Moose objects? It

Multiple vs. single Catalyst applications

左心房为你撑大大i 提交于 2019-12-06 11:36:28
问题 I have multiple Catalyst applications running as FCGI. Is there a benefit in consolidating them into a single one with multiple constrollers? Thanks, Simone 回答1: RAM, probably? I think the minimum each server is going to hold onto is about 15MB so you might be able to save something like 100MB if you’re running 3 apps with with 3 servers. But that’s pure back of the napkin speculation. Another option, which would likely achieve most of the same savings would be to move to Plack deployment. E

Formatting timestamp field for output in TemplateToolkit

独自空忆成欢 提交于 2019-12-06 09:50:54
问题 I'm using Perl with Catalyst framework, DBIx class as ORM, TT for views, Postgresql as DB. I have a column with 'timestamp without timezone' type, and if I do manual query in Postgres the column value is in such format 2012-08-30 21:30:14 , but when I print the value in TT view file I get it like this 2012-08-30T15:03:13 , so obviously it gets formatted but by what exactly I can't tell. I want to use Template::Plugin::Date to format output timestamps, but I get Catalyst error: Couldn't render

How can I abort a Catalyst upload based on Content-Length or MIME-Type?

ぐ巨炮叔叔 提交于 2019-12-06 07:19:32
I've tried to use parse_on_demand as shown in: http://search.cpan.org/~flora/Catalyst-Runtime-5.80007/lib/Catalyst.pm#ON-DEMAND_PARSER However, I can't seem to stop the upload. I'm testing this simply by creating an action that dies immediately, however the browser seems to upload the very large file I've selected before it ever reaches my action: sub upload :Local { my ($self, $c) = @_; die; # What I'd like to do is this: # if ($c->req->header('Content-Length') > $some_limit) { # die "Upload too large"; # } # ... check filename extension and mime-type... } Is this the right way to approach

How can I select only specific columns when using prefetch in DBIx-Class?

社会主义新天地 提交于 2019-12-06 03:01:16
I'm struggling with fairly fundamental DBIx-Class prefetch usage. I want to limit the columns that are returned from joined tables when prefetch is used. This: my $rs = $schema->resultset('CD')->search( {}, # No searching restrictions through WHERE clause { prefetch => [qw/ artist /], columns => [qw/ title artist.name /], } ); Generates this SQL: SELECT cd.title, artist.* FROM cd JOIN artist ON cd.artist = artist.id But I don't want to haul down all of the artist columns, just the cd.title and artist.name columns (in this example, my real use case is more complex). The columns feature seems to

Catalyst Controller Questions

纵饮孤独 提交于 2019-12-06 02:18:30
I just used catalyst for my first large project and I was left wondering if I used catalyst in the way it was meant to be used. I have Root.pm and inside of that file I put multiple url handlers. Is it a best practice to have one controller per url or should a grouping be considered? One of the beauties of Catalyst is its flexibility. You can do this however it best suits your application. If you only have a handful of URLs you support, then there's nothing intrinsically wrong with putting them all in Root.pm. Particularly if there's no depth, ie localhost:3000/foo and localhost:3000/bar

IE9 loses requests to a local Catalyst server

与世无争的帅哥 提交于 2019-12-05 23:05:18
问题 Okay, this is a hard one. I have a Catalyst server I can access just fine from Firefox 4, Chromium 12, and IE 8 and 9 on other computers. When I try to access it from IE9 on my own machine (the same machine the server is on), I get strange timeouts and delays. The Catalyst server's output doesn't show these delays and the IE9 traffic view doesn't even show that the request was ever sent! While the server is hanging up it's using 100% of a processor core but then it drops back to idle without