Re: [Catalyst] Suggestions for sending email from cron jobusing'Catalyst' templates?
From: Peter Edwards On 12 April 2011 00:50, Charlie Garrison garri...@zeta.org.au wrote: Good morning, On 11/04/11 at 6:58 PM +0300, Octavian Rasnita orasn...@gmail.com wrote: The TT templates used by the Catalyst app might contain many things like c.user, c.uri_for_action, may display images, may depend on other templates which are loaded automaticly when those templates are specified in the app config file. So there is no sane way of using those wrapper templates for sending email from a cron job. That was the conclusion I was reaching; I wanted feedback from others before I tried to make my own garden path. Put the logic in a model class that reads a config shared with but independent from your controller so you can run it outside of Catalyst. This article outlines how to do this http://www.catalystframework.org/calendar/2007/14 At the top of that article appears: UPDATE: As of 2008, there is a new module which avoids the kludgy solution mentioned below: Config::JFDI. At a certain moment, Config::JFDI started to support __path_to(). The problem is not the model only, but the templates that use the Catalyst context in them. As it is not very recommended to access the entire Catalyst context in a model, it should be not recommended to use the context in the templates, because those templates won't be usable in external applications without loading the entire Cat app, but because using the Catalyst context in the templates is very handy, most of us probably prefer to create separate templates for using them in external apps than to provide only sane variables to all the templates. 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] DBIC related: schema VS model
dear catalystlist, after doing a try-run of bringing all modules (catalyst, dbix::class, ...) up-to-date, i ran into some problems. i found a solution for the problem, but there are still some open questions. i am creating some onthefly relations at after catalyst setup is completed. (see full-details below this mail). the resultset class was accessed via: my $myclass = $schema-class(Someclass); $myclass is MyApp::Model::DB::Someclass now. creating a many2many relation on $myclass did not work as it should with latest dbix::class. the solution was to access the class via MyApp::Schema::Result::Someclass so the question is: why is using $schema-class(...) ending in a different behavior that using the bare result class name ? or am i doing things terribly wrong ? thanks for tipps and helps, bernhard Begin forwarded message: From: Bernhard Bauch ba...@zsi.at Date: 30. März 2011 00:04:58 MESZ To: dbix-cl...@lists.scsys.co.uk Subject: [Dbix-class] bug or misuse of $schema-register_class after upgrade ? Reply-To: DBIx::Class user and developer list dbix-cl...@lists.scsys.co.uk dear dbix::class list, i just tried upgrading my dbix::class from 0.08123 to the lastest 0.08127. but some things not working right... i am using catalyst with dbix::class. in my App.pm after __PACKAGE__-setup(); depending on config-files, i dynamically add some relations to some result-classes. this worked fine with version 0.8123, but its not working as it should with the lastest version. how i add a many2many relation after setup looks like this.. my $myclass = $schema-class(Someclass); $myclass-has_many(linktable_accessor, MyApp::Schema::Result::Linktable , 'link_id', ); $myclass-many_to_many(accessor, linktable_accessor , 'accessor', ); $schema-unregister_source(Someclass); $schema-register_class(SomeClass , $myclass); (the results for linktable and foreignclass are well defined) after the upgrade ... this is not working. the hasmany accessor and many2many accessors are not available for row-items.. (Can't locate object method ...) if i put the two 2 statements (-has_many ... and many_to_many) in my the Result::Someclass module , dbix::class warnings appear, that some functions have already been defined. (eg. add_to_..) asking the result for available relations with -relationships, the linktable_accessor appears, but can not be accessed from a row-item. i tried to find the difference between the 2 versions...and i figured out what part of the code is the responsible for this .. in DBIx/Class/Schema.pm in line #925 this was added: weaken ${${target_class}::__cag_result_source_instance}; if i remove this line, everything is working like expected or like before. what can i do to keep my code working ? any ideas ? thanks alot for help, bernhard -- Bernhard Bauch, Webdevelopment ZSI - Zentrum für soziale Innovation ba...@zsi.at ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-cl...@lists.scsys.co.uk -- Bernhard Bauch, Webdevelopment ZSI - Zentrum für soziale Innovation ba...@zsi.at ___ 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] HTML::FormHandler performance issue in Catalyst app -- 50 seconds?!
On 12 April 2011 02:53, will trillich will.trill...@serensoft.com wrote: Hi folks -- this may be more of a FormHandler question than a Catalyst question but I thought I'd check here to see if it's just us: We've been using HTML::FormHandler and are basically happy with it... until the performance issue mentioned below hit us. Any Catalystas running into 50-second turnaround time with H:FH? [info] Request took 51.956100s (0.019/s) .+---. | Action | Time | ++---+ | /auto | 0.000181s | | /auth | 0.001857s | | /ticket/base | 0.004652s | | /ticket/item | 0.005865s | | /ticket/edit | 51.88091s | | Base:EDIT | 51.88050s | | get FORM | 0.78s | | process FORM | *51.87286s*| | /end | 0.000290s | '+---' Turnaround time ranges from 6 seconds to 50+ seconds, with no discernable pattern to the delay. (We can edit the same record multiple times and get wildly differing lags.) Run your test server with perl -d:NYTProf myapp.pl and see which routines use the time http://search.cpan.org/perldoc?Devel::NYTProf . Maybe it is blocking on DNS network lookups. Or if the time isused around the database calls, run with DBIC_TRACE=1 perl myapp.pl and watch and see which are the slow ones, then run your database query optimiser like EXPLAIN SELECT foo; http://dev.mysql.com/doc/refman/5.0/en/explain.html http://www.postgresql.org/docs/8.3/static/sql-explain.html Are other processes/users accessing the same database? If so check for lock competition. Also disk space. Regards, Peter ___ 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] server memory usage
On 4/11/2011 8:54 AM, Jorge Gonzalez jorge.gonzalez-at-daikon.es |Catalyst/Allow to home| wrote: You can be assured that it's being done that way. Certainly all modern operating systems do Copy-On-Write on memory pages, which means that several processes with a common set of code will share much of it. This is not being done by Apache/fastcgi/Catalyst, but by the very operating system itself. I don't think so. If two different Perl processes are started up, and each loads modules and loads data, they will be writing all that to separate pages. Rather, it needs to load all the stuff and _then_ fork, so that the stuff is identical and shared. Thanks for the pointer to the top command; I'll read up on 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] Validation of entered content
Thanks for the comprehensive reply! That will keep my busy for a while. On 4/11/2011 10:25 AM, Peter Edwards peter-at-dragonstaff.co.uk |Catalyst/Allow to home| wrote: There are two main JS editors, the one above and TinyMCE, you have to be careful though. 1) People paste a Word document paragraph in as HTML and it becomes invalid. Try offering a paste-from-word button to bring up a box they paste into, then send that to the backend to be run through http://search.cpan.org/perldoc?Text::Demoroniser before you add it to the content area. 2) Hitting bugs in these editors giving you invalid XHTML. What you can do is - validate by sending the content server-side before save and check with a DTD schema validator like http://htmlhelp.com/tools/validator/ and on failure disallow save with a popup warning - then offer an option to correct invalid XHTML where you send the content to the backend, run it through htmltidy, then bring it back to the content area; see the HTML - XHTML docs in http://tidy.sourceforge.net/docs/tidy_man.html ___ 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] What text editor to use?
On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? ___ 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] What text editor to use?
The EPIC plugin for Eclipse works fine for me. I am not sure if anyone mentioned it yet. http://www.epic-ide.org/ Am 12.04.2011 13:41, schrieb John M. Dlugosz: On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? ___ 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] What text editor to use?
I use Komodo Edit, it's free (not open source) and very usefull for me. It supports Perl and TT-synax, I like it ;-) 2011/4/12 John M. Dlugosz wxju46g...@snkmail.com: On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? ___ 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] What text editor to use?
On Tue, 2011-04-12 at 06:41 -0500, John M. Dlugosz wrote: On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? signature.asc Description: This is a digitally signed message part ___ 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] What text editor to use?
I may have missed the suggestion and all the requirements but have you checked out Padre? Sent from my iPad Mini 4. On Apr 12, 2011, at 11:41, John M. Dlugosz wxju46g...@snkmail.com wrote: On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? ___ 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] What text editor to use?
I use Eclipse (EPIC) too with the Amateras HTML Editor to open .tt and .tt2 file extensions: Window - Preferences - General - Editors - File Associations On Tue, 2011-04-12 at 13:50 +0200, Tobias Klug wrote: The EPIC plugin for Eclipse works fine for me. I am not sure if anyone mentioned it yet. http://www.epic-ide.org/ Am 12.04.2011 13:41, schrieb John M. Dlugosz: On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? ___ 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/ -- == united-domains AG - The Domain People. Gautinger Strasse 10 D-82319 Starnberg Tel. + 49 (0) 81 51 / 3 68 67 - 33 Fax + 49 (0) 81 51 / 3 68 67 - 77 http://www.united-domains.de -- Sitz: Starnberg, HRB 127020 (AG München) Vorstand: Florian Huber (Vors.) Alexander Helm, Markus Eggensperger Aufsichtsrat: Norbert Lang (Vors.) == signature.asc Description: This is a digitally signed message part ___ 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] server memory usage
On 11 Apr 2011, at 14:07, John M. Dlugosz wrote: Looking at the server's processes, I see three of script/ myapp_fastcgi.pl, which I suppose co-inside with the Apache configuration option where I said to start 3 fastcgi processes to handle this app. WebMin tells me size, which can't be the actual load of server RAM needed since it doesn't add up with the total usage. Some basics here... is Apache/fastcgi/Catalyst smart enough to load the app and get it running to the point where it is ready to start handling requests, and THEN fork it? The Perl runtime and all the loaded modules can certainly be shared! Do I need more advanced configuration or app tuning to maximize this ability? If you're using dynamic fast cgi, then no, there is no way to do this, as apache dynamically starts / removes workers. if you're using external mode fast cgi, then yes, this 'just works'. 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] Validation of entered content
On 4/11/2011 10:25 AM, Peter Edwards peter-at-dragonstaff.co.uk |Catalyst/Allow to home| wrote: I've used this before - perhaps it will work for you: http://ckeditor.com/ That looks interesting, but digging through the documentation it seems that its native output format is XHTML, and although it mentions that plugin providers _could_ provide processors for BBCode etc. it doesn't link to any page of available plugins, nor do I see that on their site. I'm convinced that as a first step I should make the user-supplied content be stored in some other format. Then, replacing the textarea with a fancy WYSIWYG editor would be an optional step, and I would like that to be invisible to the app. So, the GUI editor should populate the POSTed data with the same kind of markup that I would ask the user to type directly. Of course, I suppose the Catalyst way would be to allow any kind of markup as long as there's an adapter for it. The abstractions I've seen already in CPAN spit out whole HTML files with header and body, not fragments. And I'm not terribly interested in building something like that right now. I will however keep the decision abstracted and isolated in the code. ___ 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] server memory usage
El 12/04/11 12:58, John M. Dlugosz escribió: On 4/11/2011 8:54 AM, Jorge Gonzalez jorge.gonzalez-at-daikon.es |Catalyst/Allow to home| wrote: You can be assured that it's being done that way. Certainly all modern operating systems do Copy-On-Write on memory pages, which means that several processes with a common set of code will share much of it. This is not being done by Apache/fastcgi/Catalyst, but by the very operating system itself. I don't think so. If two different Perl processes are started up, and each loads modules and loads data, they will be writing all that to separate pages. Rather, it needs to load all the stuff and _then_ fork, so that the stuff is identical and shared. You are right in this case: the pages would be shared just after the fork, but would probably start to get copied individually for each process again as soon as the process starts doing something useful. For perl, which works as some kind of JIT compiler, the script executable code is just data and probably gets rewritten very often, so each process would end with its own set of pages. I'd bet for a KSM capable machine and OS. You can activate and deactivate it, so benchmarking it with your app would be trivial. Regards 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/
Re: [Catalyst] server memory usage
You are right in this case: the pages would be shared just after the fork, but would probably start to get copied individually for each process again as soon as the process starts doing something useful. For perl, which works as some kind of JIT compiler, the script executable code is just data and probably gets rewritten very often, so each process would end with its own set of pages. I'd bet for a KSM capable machine and OS. You can activate and deactivate it, so benchmarking it with your app would be trivial. I would suppose that loading all the modules needed would generate the internal perl representation, and that won't change during execution. It doesn't get rewritten unless it's unloaded, which doesn't happen to named package contents. It's plausible that multiple fire-ups of the same program would wind up with identical pages, if no memory allocation ever depends on timing or anything other than static configuration. In Windows, the executable code of a process is backed by the exe file and shares physical pages with every process that loaded it. Paging out just forgets it, and paging it reads it from the exe file again. Would you know if Linux, with its fork/exec model, does likewise? Of course, I know that doesn't help the Perl code, which is data as far as the Kernel is concerned. FWIW, VMWare does its own KSM at a higher level, across virtual machines. So if that is possible it does reduce the real load on the host hardware. But it doesn't change how I'm billed! ___ 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] What text editor to use?
On Apr 12, 2011, at 4:57 AM, dodds wrote: I use Eclipse (EPIC) too with the Amateras HTML Editor to open .tt and .tt2 file extensions: Window - Preferences - General - Editors - File Associations I wrote my own eclipse editor plugin for TT files: https://github.com/hitz/eclipse-tteditor ... I didn't know that there was an existing one (Amateras) that supported TT. Ben On Tue, 2011-04-12 at 13:50 +0200, Tobias Klug wrote: The EPIC plugin for Eclipse works fine for me. I am not sure if anyone mentioned it yet. http://www.epic-ide.org/ Am 12.04.2011 13:41, schrieb John M. Dlugosz: On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? ___ 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/ -- == united-domains AG - The Domain People. Gautinger Strasse 10 D-82319 Starnberg Tel. + 49 (0) 81 51 / 3 68 67 - 33 Fax + 49 (0) 81 51 / 3 68 67 - 77 http://www.united-domains.de -- Sitz: Starnberg, HRB 127020 (AG München) Vorstand: Florian Huber (Vors.) Alexander Helm, Markus Eggensperger Aufsichtsrat: Norbert Lang (Vors.) == ___ 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/ -- Ben Hitz Senior Scientific Programmer ** Saccharomyces Genome Database ** GO Consortium Stanford University ** h...@genome.stanford.edu ___ 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] Fine-grained access control with REST
In our aging Music application where we have the familiar hierarchy Label - CD - Track - Note. We also have an extra table for access control that joins CDs with a User: cd_user. The action PUT /note/* is allowed if the Note object can be joined to the current user via the cd_user table. Now we want to extend this to have fine-grained access control. So, we might have roles owner with full read/write access, reader with only read access, and editor with read/write access but can only update a subset of a Note's columns compared to the owner. Essentially, the owner and editor can both PUT a Note object but the action would use different forms to validate the request and update the database. So, my question is what makes for a good URL scheme? One option is to use PUT /note/123 and before updating determine the type of access and select that correct form object. So, both editors and and owners PUT to the same URL but supplying different columns to update. Another option is separate URLs such as PUT /owner/note/123 and PUT /editor/note/123 making it very explicit. What's your opinion about these options? Is there a better approach? I suppose it's not always a boolean access question: a given user might have multiple roles and may wish to pick which role to act as using different URLs. -- Bill Moseley mose...@hank.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] What text editor to use?
John == John M Dlugosz wxju46g...@snkmail.com writes: John I installed Emacs, and found that it's too alien for me. Basic things like John selecting with the mouse and keyboard together are different from my current John habits. Is there a more GUI front-end? As is the case with vi(m), emacs revolves around the concept that removing your hands from the home row on the keyboard is bad for productivity (touch-typists can do things much faster with a keyboard than with a mouse) and also hampers your ability to edit code remotely in several situations (like debugging code on a headless web server or recovering your screwed X session). If you need an editor that favors mice and GUIs, try Padre. -- 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://blog.edencardim.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] Caching SQL results for speed...?
Mostly thinking out loud here... but we welcome feedback if we're off track... Okay, after some perl -D:NTYProf tester.pl with 200 iterations: 70% of the time is taken up in five modules: 1) SQL::Abstract 2) DBIx::Class::ResultSet 3) Class::Accessor::Grouped 4) DBIx::Class::Storage::DBI 5) HTML::FormHandler::Field ...because in 200 iterations they were called millions of times each. (The form requested has several select/option menus.) Most of the data won't change rapidly -- e.g. client lists, countries, employees just to populate a few popup menus -- so it seems like an opportunity to benefit from caching the results, and only invalidating the cache when a new record gets updated/deleted/added. Whole tables could be cached without having to return to SQL/DBIC for every form-screen. So we're looking for documentation on a best-of-breed approach for doing this in a Catalyst environment... Looking at Catalyst::TraitFor::Model::DBIC::Schema::Caching it looks like you specify when the cache will expire: $c-model('DB::Table')-search({ foo = 'bar' }, { cache_for = 18000 }); whereas we would prefer being able to invalidate-cache-for-table-XYZ-now. Aha, DBIx::Class::Cursor::Cached does include a $rs-cursor-clear_cache; method, we'll be tinkering with that, next! On Tue, Apr 12, 2011 at 8:14 AM, will trillich will.trill...@serensoft.comwrote: Thanks for the tips, Peter -- and for http://dragonstaff.blogspot.com/2009/05/testing-with-perl-catalyst.html! Got some cranking to do... On Tue, Apr 12, 2011 at 2:30 AM, Peter Edwards pe...@dragonstaff.co.ukwrote: On 12 April 2011 02:53, will trillich will.trill...@serensoft.comwrote: Hi folks -- this may be more of a FormHandler question than a Catalyst question but I thought I'd check here to see if it's just us: We've been using HTML::FormHandler and are basically happy with it... until the performance issue mentioned below hit us. Any Catalystas running into 50-second turnaround time with H:FH? [info] Request took 51.956100s (0.019/s) .+---. | Action | Time | ++---+ | /auto | 0.000181s | | /auth | 0.001857s | | /ticket/base | 0.004652s | | /ticket/item | 0.005865s | | /ticket/edit | 51.88091s | | Base:EDIT | 51.88050s | | get FORM | 0.78s | | process FORM | * 51.87286s* | | /end | 0.000290s | '+---' Turnaround time ranges from 6 seconds to 50+ seconds, with no discernable pattern to the delay. (We can edit the same record multiple times and get wildly differing lags.) Run your test server with perl -d:NYTProf myapp.pl and see which routines use the time http://search.cpan.org/perldoc?Devel::NYTProf . Maybe it is blocking on DNS network lookups. Or if the time isused around the database calls, run with DBIC_TRACE=1 perl myapp.pl and watch and see which are the slow ones, then run your database query optimiser like EXPLAIN SELECT foo; http://dev.mysql.com/doc/refman/5.0/en/explain.html http://www.postgresql.org/docs/8.3/static/sql-explain.html Are other processes/users accessing the same database? If so check for lock competition. Also disk space. Regards, Peter ___ 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/ -- 11 cheers for binary! -- 11 cheers for binary! ___ 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/