[Catalyst] Advice needed on porting 5.7 plugin (monkeypatches Cat::Request)
Hi, I need some advice about an old 5.7 plugin that I came across at a client site. The plugin wraps CGI::Expand to deal with hierarchical parameters (see expand_cgi export in CGI::Expand docs). They want to migrate the app to 5.8 and this plugin was doing some nasty stuff - monkeypatching Catalyst::Request like this: package Catalyst::Request; __PACKAGE__-mk_accessors('hparams'); This is of course a no-no with CatMoose. Reading through the docs, I see that I can subclass the Catalyst::Request class and use the $c-request_class to setup the new one. I've done that like this: package My::Request; use Moose; BEGIN { extends 'Catalyst::Request' } has hparams = ( isa = 'HashRef', is = 'rw', default = sub { {} }, ); no Moose; __PACKAGE__-meta-make_immutable; 1; I have two questions: * is it possible for a plugin, at setup time, to set the request_class()? * is there a better way? Best regards, ___ 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] Advice needed on porting 5.7 plugin (monkeypatches Cat::Request)
On Fri, Aug 21, 2009 at 11:37:00AM +0100, Pedro Melo wrote: Reading through the docs, I see that I can subclass the Catalyst::Request class and use the $c-request_class to setup the new one. I've done that like this: It's probably better to create a role to apply to the request class and, optionally, use CatalystX::RoleApplicator to apply it. See Catalyst::TraitFor::Request::BrowserDetect for an example. * is it possible for a plugin, at setup time, to set the request_class()? Yes. See Catalyst::Plugin::Browser for that. * is there a better way? Other than not doing it and using CX::RoleApplicator instead? None that i've found so far. -- BOFH excuse #383: Your processor has taken a ride to Heaven's Gate on the UFO behind Hale-Bopp's comet. signature.asc Description: Digital signature ___ 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] DBI SQLite driver missing after Catalyst update.
I've tried both formulations of the config string __PACKAGE__-config( schema_class = 'wppig::Schema', connect_info = { dsn = 'dbi:SQLite:wppig.db3', }, ); __PACKAGE__-config( schema_class = 'wppig::Schema', connect_info = 'dbi:SQLite:wppig.db3', ); and even from the docs that you cite __PACKAGE__-config( schema_class = 'wppig::Schema', connect_info = { dsn = 'dbi:SQLite:dbname=wppig.db3', }, ); But I still get the same error message. No matter if I've got a hashref or a string set for connect_info I still see the Can't connect to data source 'HASH(0x9e139e0)' error. Interestingly, when I remove the connect_info line I see this in the logs: Couldn't instantiate component wppig::Model::wppigDB, Either -config-{connect_info} must be defined for wppig::Model::wppigDB or wppig::Schema must have connect info defined on it. I'd suggest testing placing the connect_info in the app's config file (designated for the model), or in the schema file. With the info in the schema file it isolates the connection within DBIC. Since the the wppig/Schema.pm file has no config information in it, it must mean there's probably no other config file squirreled away affecting the connection. As a side not you may want to meditate on the fact that you apparently simultaneously introduced instability into a development and a production environment (according to the other reply thread) Guilty as charged, I'll fix it as soon as I can get to it. Debugging says the piece of code that it's hanging on looks like this: my $result = $c-model('DB::Result::Tag')-search( { }, { join = { 'items_tag' = 'tag' } } ); while ( my $tag = $result-next ) { # Hangs here $tag_count{ $tag-tag }++; } So it looks like the class is loading but I can't do anything with the ResultSet. Any idea of why this is failing? Did I miss a step somewhere in the conversion? I'd be happy to provide more information if needed. Thanks in advance for your help. If there's something else about my app that I can show you to help solve this problem, please let me know. Thanks again for your help. Collin Condray @ccondray condray.net http://condray.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/ ___ 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] Bug with re-occuring nested related tables with CP FormFu?
You are missing the counter_name and new_rows_max for the repeatables. Look at this bit of YAML that Moritz gave me. You might also look at the empty_rows option. Your problem is the counter_name, though. - type: Hidden name: count constraints: - Required - type: Repeatable nested_name: appointment counter_name: count model_config: new_rows_max: 100 elements: ... Toby Corkindale wrote: Hi, I'm using FormFu in Catalyst, with a DBIC schema, and have a problem with a particular usage of nested relationships in the form. The table in question has a might_have relationship with another table, let's say like: book (id, title, blurb) book_extra (book_id, num_pages, in_stock) Now, I setup a form like: --- elements: - name: title type: Text - type: Block tag: div nested_name: book_extra elements: - name: num_pages type: Text - name: blurb type: Textarea - type: Block tag: div nested_name: book_extra elements: - name: in_stock type: Checkbox - The idea being that num_pages and in_stock are sent to the related table instead. This *does* work for the first nested item, in this case num_pages. However the second time it comes up, it doesn't do anything - ie. in_stock is never saved to the DB. If I move the in_stock element higher up, in the same Block as num_pages, then it does work. Is this a known bug/limitation, or is this supposed to work? Am I doing something wrong? thanks, Toby ___ 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] Advice needed on porting 5.7 plugin (monkeypatches Cat::Request)
Pedro Melo wrote: * is it possible for a plugin, at setup time, to set the request_class()? Yes. before setup_finalize = sub { my $self = shift; $self-request_class(New::Request::Class); }; * is there a better way? Yes. Make a request class role, then use CatalystX::RoleApplicator to apply it to the request class. See Catalyst::Plugin::Browser for an example of it being used in a plugin. 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/
[Catalyst] [ANNOUNCE] Catalyst-Runtime-5.80008
The Catalyst core team is pleased to announce the availability of the latest maintenance release of Catalyst-Runtime, version 5.80008. A number of bugs have been fixed, and a load of small but useful features have been added. A full changelog is included below. Thanks to everybody who contributed to this release, and I hope you enjoy it. Cheers t0m Bug fixes: - Fix replace_constructor warning to actually work if you make your application class immutable without that option. - Depend on Module::Pluggable 3.9 to prevent a bug wherein components in inner packages might not be registered. This especially affected tests. - Catalyst::Engine::FastCGI - relax the check for versions of Microsoft IIS. Provides compatibility with Windows 2008 R2 as well as (hopefully) future versions. - In tests which depend on the values of environment variables, localise the environment, then delete only relevant environment variables (RT#48555) - Fix issue with Engine::HTTP not sending headers properly in some cases (RT#48623) - Make Catalyst::Engine write at least once when finalizing the response body from a filehandle, even if the write is empty. This avoids fail when trying to send out an empty response body from a filehandle. - Catalyst::Engine::HTTP - Accept a fully qualified absolute URI in the Request-URI of the Request-Line Refactoring / cleanups: - Deleted the Restarter engine and its Watcher code. Use the new Catalyst::Restarter in a recent Catalyst::Devel instead. - New unit test for Catalyst::Action 'unit_core_action.t' - Bump minimum supported perl version from 5.8.1 to 5.8.6 as there are known issues with 5.8.3, and nobody is prepared to fix / support perl older than 5.8.6 any more. Patches to regain compatibility to older perls would be welcome. - Debug output uses dynamic column sizing to create more readable output when using a larger $ENV{COLUMNS} setting. (groditi) New features: - Added private_path method for Catalyst::Action - Allow uri_for($controller_instance) which will produce a URI for the controller namespace - Break setup_components into two more parts: locate_components and expand_component_module (rjbs) - Allow Components to return anon classed from their COMPONENT method correctly, and have action registration work on Controllers returned as such by adding a catalyst_component_name accessor for all components which returns the component instance's name to be used when building actions etc. - Adding X-Forwarded-Port to allow the frontend proxy to dictate the frontend port (jshirley) - Added Catalyst::Stats-created accessor for the time at the start of the request. Documentation: - Fix POD to refer to -config(key = $val), rather than -config-{key} = $val, as the latter form is deprecated. - Clearer docs for the 'uri_for' method. - Fix POD refering to CGI::Cookie. We're using CGI::Simple::Cookie. (Forrest Cahoon) ___ 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] DBI SQLite driver missing after Catalyst update.
* On Thu, Aug 20 2009, Collin Condray wrote: stuff So the debugging technique you should use is to find the message that's printing HASH(0x123456), and then use DDS or something to actually dump that hash. (Carp::cluck is also very helpful here.) Then you can see where you are and what data is there, and then you can better guess *why* it's there. Regards, Jonathan Rockway -- print just = another = perl = hacker = if $,=$ ___ 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] [ANNOUNCE] Catalyst-Runtime-5.80009
Unfortunately, Catalyst-Runtime 5.80008 introduced a serious regression. Catalyst-Runtime 5.80009 has just been uploaded, which corrects and adds tests for the issue, with no other changes. The Changelog is included below as always. Cheers t0m Bug fixes: - Fix and add tests for generating inner packages inside the COMPONENT method, and those packages being correctly registered as components. This fixes Catalyst::Model::DBIC among others. ___ 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] [ANNOUNCE] Catalyst-Runtime-5.80010
Apparently the issue fixed in 5.80009 wasn't the only regression introduced in 5.80008. Catalyst-Runtime 5.80010 has just been uploaded, which corrects and adds tests for yet another issue, with no other changes. The Changelog is included below as always. Cheers rafl Bug fixes: - Fix and add tests for a regression introduced by 5.80008. Catalyst::Engine is now able to send out data from filehandles larger than the default chunksize of 64k again. -- BOFH excuse #315: The recent proliferation of Nuclear Testing signature.asc Description: Digital signature ___ 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/