Re: [Catalyst] error "Objects supplied as 'foreign_values' usually should inherit from the related ResultClass"
Hey y'all -- if there's something I can do to clarify my question, let me know :) This has me puzzled! On Thu, Sep 7, 2017 at 9:23 AM, will trillich <will.trill...@serensoft.com> wrote: > This is a weird one. > > > > Short version: > > $userexam->user is defined as Auth::User, but seems like it gets redefined > as DB::User somewhere mysteriously. > > How can I track that down? > > > > Long version: > > Split database setup: DB is for the application data, Auth is for user > data. > > The userexam table links users to the exams they take. > *Schema/DB/Result/UserExam.pm > *contains: > > __PACKAGE__->belongs_to( user => 'Learn::Schema::Auth::Result::User' ); > __PACKAGE__->belongs_to( exam => 'Learn::Schema::DB::Result::Exam' ); > > *Schema/DB/ResultSet/UserExam.pm* contains: > > sub take { # take the exam > my $rs = shift; # Learn::Schema::DB::ResultSet::UserExam object > my $user= shift; # Learn::Model::Auth::User object > my $exam= shift; # Learn::Model::DB::Exam object > ... > my $user_exam = $rs->create({ > user => $user, > exam => $exam, > }); > } > > The error it throws at $rs->create() is: > > *DBIx::Class::ResultSource::_resolve_relationship_condition(): * > *Objects supplied as 'foreign_values' > (Learn::Model::Auth::User=HASH(0xe022b14)) * > *usually should inherit from the related ResultClass > ('Learn::Model::DB::User'), * > *perhaps you've made a mistake invoking the condition resolver? * > > In the schema file > , > ->user is defined as Auth::User. Somehow it gets redefined along the way > and Catalyst thin > k > s it should be DB::User instead?! > > Grepping for DB.*User (and variations) in schema files brings up > DB::UserExams and related info (DB::UserCourse, DB::UserRole, > DB::UserAnswer) but no DB::User at all. > > How could that get redefined? Or is this a symptom of something else? I > could use a big clue stick upside the head :/ > > Thanks! > > -- Will Trillich :: 812.454.6431 "Ask for nothing, and you will receive nothing." -- the folks at Global Degree “The cure to boredom is curiosity. There is no cure for curiosity.” Dorothy Parker Todo ___ 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] error "Objects supplied as 'foreign_values' usually should inherit from the related ResultClass"
This is a weird one. Short version: $userexam->user is defined as Auth::User, but seems like it gets redefined as DB::User somewhere mysteriously. How can I track that down? Long version: Split database setup: DB is for the application data, Auth is for user data. The userexam table links users to the exams they take. *Schema/DB/Result/UserExam.pm *contains: __PACKAGE__->belongs_to( user => 'Learn::Schema::Auth::Result::User' ); __PACKAGE__->belongs_to( exam => 'Learn::Schema::DB::Result::Exam' ); *Schema/DB/ResultSet/UserExam.pm* contains: sub take { # take the exam my $rs = shift; # Learn::Schema::DB::ResultSet::UserExam object my $user= shift; # Learn::Model::Auth::User object my $exam= shift; # Learn::Model::DB::Exam object ... my $user_exam = $rs->create({ user => $user, exam => $exam, }); } The error it throws at $rs->create() is: *DBIx::Class::ResultSource::_resolve_relationship_condition(): * *Objects supplied as 'foreign_values' (Learn::Model::Auth::User=HASH(0xe022b14)) * *usually should inherit from the related ResultClass ('Learn::Model::DB::User'), * *perhaps you've made a mistake invoking the condition resolver? * In the schema file , ->user is defined as Auth::User. Somehow it gets redefined along the way and Catalyst thin k s it should be DB::User instead?! Grepping for DB.*User (and variations) in schema files brings up DB::UserExams and related info (DB::UserCourse, DB::UserRole, DB::UserAnswer) but no DB::User at all. How could that get redefined? Or is this a symptom of something else? I could use a big clue stick upside the head :/ Thanks! ___ 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] (no subject)
Short version: $userexam->user is defined as Auth::User, but seems like it gets redefined as DB::User somewhere mysteriously. How can I track that down? Long version: Split database setup: DB is for the application data, Auth is for user data. The userexam table links users to the exams they take. *Schema/DB/Result/UserExam.pm *contains: __PACKAGE__->belongs_to( user => 'Learn::Schema::Auth::Result::User' ); __PACKAGE__->belongs_to( exam => 'Learn::Schema::DB::Result::Exam' ); *Schema/DB/ResultSet/UserExam.pm* contains: sub take { # take the exam my $rs = shift; # Learn::Schema::DB::ResultSet::UserExam object my $user= shift; # Learn::Model::Auth::User object my $exam= shift; # Learn::Model::DB::Exam object ... my $user_exam = $rs->create({ user => $user, exam => $exam, }); } The error it throws at $rs->create() is: DBIx::Class::ResultSource::_resolve_relationship_condition(): Objects supplied as 'foreign_values' (Learn::Model::Auth::User=HASH(0xe022b14)) usually should inherit from the related ResultClass ('Learn::Model::DB::User'), perhaps you've made a mistake invoking the condition resolver? In the schema file ->user is defined as Auth::User. Somehow it gets redefined along the way and Catalyst things it should be DB::User instead?! Grepping for DB.*User (and variations) in schema files brings up DB::UserExams and related info (DB::UserCourse, DB::UserRole, DB::UserAnswer) but no DB::User at all. How could that get redefined? Or is this a symptom of something else? I could use a big clue stick upside the head :/ Thanks! -- "Ask for nothing, and you will receive nothing." -- the folks at Global Degree “The cure to boredom is curiosity. There is no cure for curiosity.” Dorothy Parker Todo ___ 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] Using and inter-linking multiple databases: Can't find source
In our app we have two databases: Auth and DB. The generalized user/team credentials and related info are in Auth, and the actual business info for this app is in DB. Here's an object from the DB database: package Learn::Schema::DB::Result::TeamEmail; #... __PACKAGE__-belongs_to( team = 'Learn::Schema::Auth::Result::Team' ); And now the related object from the Auth database: package Learn::Schema::Auth::Result::Team; #... __PACKAGE__-has_many( emails = 'Learn::Schema::DB::Result::TeamEmail', 'team' ); At this point we expect *$team-emails_rs* to work but instead we get Can't find source for Learn::Schema::DB::Result::TeamEmail because TeamEmail isn't in $self-source_registrations (full names) or $self-class_mappings (brief names) in the DBIx::Class::Schema::source() method. Pointers? Clue stick? ___ 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: Simple session snag probably -- Couldn't find a model named Learn::Session
Ah thanks for the clue-stick :) Hailin -- We had messed up on the CREATE phase in getting the Schema set up, and it was the two-schema approach that tripped us cuz we weren't paying attention: script/learn_create.pl model DB DBIC::Schema Learn::Schema::DB create=static dbi:mysql:learn user pw script/learn_create.pl model DB DBIC::Schema Learn::Schema::Auth create=static dbi:mysql:auth user pw Those are the two commands we had issued to create the model. Whoops! The first was okay but the second used the exact same second-argument and shouldn't have. That is, the second command overwrote the first instance under Learn::Model::DB. The following fixed it: script/learn_create.pl model DB DBIC::Schema Learn::Schema::DB create=static dbi:mysql:learn user pw script/learn_create.pl model Auth DBIC::Schema Learn::Schema::Auth create=static dbi:mysql:auth user pw Changing DB to Auth in the second arg, and now all is well. Thanks! On Sunday, August 11, 2013, Hailin Hu wrote: How is your model like? I suppose you map your schema and model as below: Learn::Schema::Auth - Learn::Model::Auth Then Auth::Session should work. Use the name of model instead of schema in context of catalyst. Hope it helps. On Sun, Aug 11, 2013 at 6:10 AM, will trillich will.trill...@serensoft.com wrote: Starting a new app, and winding up with the Couldn't load class (Learn) because: Couldn't find a model named Learn::Session error... We have two schema: - Learn::Schema::Auth (users, roles, sessions, etc) Auth.pm extends 'DBIx::Class::Schema', as expected - Learn::Schema::DB (real app data here) Learn.pm extends 'DBIx::Class::Schema', as expected We are intending to store session info in Learn::Schema::Auth::Result::Session. learn.conf includes: session dbic_class = Learn::Session /session We've done other Catalyst apps with this pattern and they work just fine. (Blah::Session never really exists on its own, Blah::Model::Blah::Session doesn't either, but Blah::Schema::DB::Result::Session does and there seems to be a bit of magic in converting Blah::Session into Blah::Schema::DB::Result::Session.) Without sessiondbic_class/ in learn.conf, the error message changes to Couldn't find a model named DBIC::Session as expected. What's missing here? Something obvious no doubt... Or, how do we specify Learn::Schema::DB::Result::Session for our session data, using dbic_class in the conf file? ___ 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/
[Catalyst] Simple session snag probably -- Couldn't find a model named Learn::Session
Starting a new app, and winding up with the Couldn't load class (Learn) because: Couldn't find a model named Learn::Session error... We have two schema: - Learn::Schema::Auth (users, roles, sessions, etc) Auth.pm extends 'DBIx::Class::Schema', as expected - Learn::Schema::DB (real app data here) Learn.pm extends 'DBIx::Class::Schema', as expected We are intending to store session info in Learn::Schema::Auth::Result::Session. learn.conf includes: session dbic_class = Learn::Session /session We've done other Catalyst apps with this pattern and they work just fine. (Blah::Session never really exists on its own, Blah::Model::Blah::Session doesn't either, but Blah::Schema::DB::Result::Session does and there seems to be a bit of magic in converting Blah::Session into Blah::Schema::DB::Result::Session.) Without sessiondbic_class/ in learn.conf, the error message changes to Couldn't find a model named DBIC::Session as expected. What's missing here? Something obvious no doubt... Or, how do we specify Learn::Schema::DB::Result::Session for our session data, using dbic_class in the conf file? ___ 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] Argh! Trying to upgrade Catalyst -- getting Can't use string as a HASH ref...
Ah yes, crikey! wrong Makefile.PL! Running Makefile.PL for Catalyst::Runtime griped only that * Test::WWW::Mechanize::Catalyst* was out of date. We updated that via cpanm so now Makefile.PL has no complaints... Still can't use string as a HASH ref tho :( when we try to use the Cache plugin. On Sun, Mar 31, 2013 at 11:55 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 31 Mar 2013, at 19:58, will trillich will.trill...@serensoft.com wrote: Hmm. I don't see anything out of line here...? $ perl Makefile.PL include /home/will/projects/perl-mvc/Waste/inc/Module/Install.pm include inc/Module/Install/Metadata.pm include inc/Module/Install/Base.pm include inc/Module/Install/Makefile.pm Cannot determine perl version info from lib/Waste/Web.pm include inc/Module/Install/Catalyst.pm include inc/Module/Install/Include.pm include inc/File/Copy/Recursive.pm *** Module::Install::Catalyst Please run make catalyst_par to create the PAR package! *** Module::Install::Catalyst finished. include inc/Module/Install/Scripts.pm include inc/Module/Install/AutoInstall.pm include inc/Module/AutoInstall.pm *** Module::AutoInstall version 1.04 *** Checking for Perl dependencies... [Core Features] - Test::More ...loaded. (0.98 = 0.88) - Catalyst::Runtime ...loaded. (5.90020 = 5.80032) - Catalyst::Plugin::ConfigLoader ...loaded. (0.32) - Catalyst::Plugin::Static::Simple ...loaded. (0.29) - Catalyst::Action::RenderView ...loaded. (0.14) - Moose ...loaded. (2.0801) - namespace::autoclean ...loaded. (0.13) - Config::General...loaded. (2.49) - Catalyst::Plugin::Session ...loaded. (0.29) - Catalyst::Plugin::Session::Store::DBIC ...loaded. (0.11) - Catalyst::Plugin::Session::State::Cookie ...loaded. (0.17) - Catalyst::Plugin::Authentication ...loaded. (0.10016) - Catalyst::Plugin::Authentication::Credential::Password ...loaded. (0) - Catalyst::Plugin::Authorization::Roles ...loaded. (0.08) - Catalyst::Plugin::Cache...loaded. (0.09) - DBIx::Class::Cursor::Cached...loaded. (1.01) *** Module::AutoInstall configuration finished. include inc/Module/Install/WriteAll.pm include inc/Module/Install/Win32.pm include inc/Module/Install/Can.pm include inc/Module/Install/Fetch.pm Writing Makefile for Waste::Web Writing MYMETA.yml and MYMETA.json Writing META.yml That's your app's Makefile.PL I asked for the Makefile.PL for Catalyst::Runtime (as that includes the 'you must upgrade this plugin for this version of Catalyst' warnings. And our app class is same as I posted in the original message of this thread -- very standard: package Waste::Web; use Moose; use namespace::autoclean; use Catalyst::Runtime 5.80; use Catalyst qw/ ConfigLoader Static::Simple Session Session::Store::DBIC Session::State::Cookie Authentication Authentication::Credential::Password Authorization::Roles Cache /; use Waste::Lib::CSV; extends 'Catalyst'; our $VERSION = '1.10'; __PACKAGE__-config( name = 'Waste::Web', # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback = 1, ); # Start the application __PACKAGE__-setup(); Yeah, I'd strongly guess it's one of the plugins :) Which cpanm module needs an upgrade? And is there a way for me to figure that out for next time so I don't have to bother the list with it? :) Hopefully the one running the -Runtime Makefile.PL will tell you :) 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/ -- Will Trillich :: 812.454.6431 “Grading takes away all the fun from failing. And a huge part of education is about failure.” -- Shimon Schocken ___ 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] Argh! Trying to upgrade Catalyst -- getting Can't use string as a HASH ref...
' 'opt_string' = 'host|h=s' 'required' = undef 4 HASH(0x9441898) 'doc' = 'Fork the server to be able to serve multiple requests at once' 'init_arg' = 'fork' 'name' = 'fork' 'opt_string' = 'fork|f!' 'required' = undef 5 HASH(0x9440e98) 'doc' = 'Specify a different listening port (to the default port 3000)' 'init_arg' = 'port' 'name' = 'port' 'opt_string' = 'port|p=i' 'required' = undef 6 HASH(0x9059388) 'doc' = 'Specify a pidfile' 'init_arg' = 'pidfile' 'name' = 'pidfile' 'opt_string' = 'pidfile|pid=s' 'required' = undef 7 HASH(0x9441798) 'doc' = 'Support keepalive' 'init_arg' = 'keepalive' 'name' = 'keepalive' 'opt_string' = 'keepalive|k!' 'required' = undef 8 HASH(0x9441178) 'doc' = 'Run in the background' 'init_arg' = 'background' 'name' = 'background' 'opt_string' = 'background|bg!' 'required' = undef 9 HASH(0x94411a8) 'doc' = 'use Catalyst::Restarter to detect code changes and restart the application' 'init_arg' = 'restart' 'name' = 'restart' 'opt_string' = 'restart|r!' 'required' = undef 10 HASH(0x9441128) 'doc' = 'Restarter directory to watch' 'init_arg' = 'restart_directory' 'name' = 'restart_directory' 'opt_string' = 'restart_directory|rdir|restartdirectory=s@' 'required' = undef 11 HASH(0x94411b8) 'doc' = 'Set a restart delay' 'init_arg' = 'restart_delay' 'name' = 'restart_delay' 'opt_string' = 'restart_delay|rd=i' 'required' = undef 12 HASH(0x9441028) 'doc' = 'Restart regex' 'init_arg' = 'restart_regex' 'name' = 'restart_regex' 'opt_string' = 'restart_regex|rr=s' 'required' = undef 13 HASH(0x943dc10) 'doc' = 'Follow symbolic links' 'init_arg' = 'follow_symlinks' 'name' = 'follow_symlinks' 'opt_string' = 'follow_symlinks|sym!' 'required' = undef 14 HASH(0x943d880) 'init_arg' = 'restarter_class' 'name' = 'restarter_class' 'opt_string' = 'restarter_class=s' 'required' = undef 'params' = HASH(0x942e5d0) 'application_name' = 'Waste::Web' Looks like a red herring to me... Still quite a puzzle! Disabling the cache is allowing the app to launch, so there's that. :( Further pointers welcome! On Sat, Mar 30, 2013 at 6:55 PM, Tomas Doran bobtf...@bobtfish.net wrote: What's the backtrace look like if you load Devel::SimpleTrace or Carp::Always? Cheers t0m On 30 Mar 2013, at 12:04, will trillich will.trill...@serensoft.com wrote: We have a Catalyst app Waste::Web that has been running fine and we are trying to upgrade to a more modern set of libraries via cpanm. (One library was upgraded that caused conflicts, now we're running a sweep to get everything updated...) We have an old app called Spills that still runs fine. The problem is with a different old app called Waste::Web... It won't start, throwing the can't use string as HASH ref error, neither as standalone server for testing nor via apache. Suggestions? At first we thought maybe the script formats had changed. So we ran a quick sample catalyst.pl Catalyst::Upgrade to come up with the latest structure for comparison. This I'll call new script below. Then we looked at the script/*pl files, the lib/* files. None of the structures seem to have changed from what we can tell. That is, the old script/*server.pl script has the same standard structure as the brand new script: #!/usr/bin/env perl BEGIN { $ENV{CATALYST_SCRIPT_GEN} = 40; } use Catalyst::ScriptRunner; Catalyst::ScriptRunner-run('Waste::Web', 'Server'); 1; Comparing lib/Waste/Web.pm (old script) to lib/Catalyst/Upgrade.pm (new script) also looks similar -- commented code redacted for space: package Waste::Web; use Moose; use namespace::autoclean; use Catalyst::Runtime 5.80; use Catalyst qw/ ConfigLoader Static::Simple Session Session::Store::DBIC Session::State::Cookie Authentication Authentication::Credential::Password Authorization::Roles Cache /; use Waste::Lib::CSV; extends 'Catalyst'; our $VERSION = '1.10'; __PACKAGE__-config( name = 'Waste::Web', # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback = 1, ); # Start the application __PACKAGE__-setup(); In the new script there *is* a new option to the __PACKAGE__-config call but it's just to instantiate the X-Catalyst http header. All serious structures look the same. But Catalyst::Upgrade runs just fine, and an old app Spill runs
Re: [Catalyst] Argh! Trying to upgrade Catalyst -- getting Can't use string as a HASH ref...
Hmm. I don't see anything out of line here...? $ perl Makefile.PL include /home/will/projects/perl-mvc/Waste/inc/Module/Install.pm include inc/Module/Install/Metadata.pm include inc/Module/Install/Base.pm include inc/Module/Install/Makefile.pm Cannot determine perl version info from lib/Waste/Web.pm include inc/Module/Install/Catalyst.pm include inc/Module/Install/Include.pm include inc/File/Copy/Recursive.pm *** Module::Install::Catalyst Please run make catalyst_par to create the PAR package! *** Module::Install::Catalyst finished. include inc/Module/Install/Scripts.pm include inc/Module/Install/AutoInstall.pm include inc/Module/AutoInstall.pm *** Module::AutoInstall version 1.04 *** Checking for Perl dependencies... [Core Features] - Test::More ...loaded. (0.98 = 0.88) - Catalyst::Runtime ...loaded. (5.90020 = 5.80032) - Catalyst::Plugin::ConfigLoader ...loaded. (0.32) - Catalyst::Plugin::Static::Simple ...loaded. (0.29) - Catalyst::Action::RenderView ...loaded. (0.14) - Moose ...loaded. (2.0801) - namespace::autoclean ...loaded. (0.13) - Config::General...loaded. (2.49) - Catalyst::Plugin::Session ...loaded. (0.29) - Catalyst::Plugin::Session::Store::DBIC ...loaded. (0.11) - Catalyst::Plugin::Session::State::Cookie ...loaded. (0.17) - Catalyst::Plugin::Authentication ...loaded. (0.10016) - Catalyst::Plugin::Authentication::Credential::Password ...loaded. (0) - Catalyst::Plugin::Authorization::Roles ...loaded. (0.08) - Catalyst::Plugin::Cache...loaded. (0.09) - DBIx::Class::Cursor::Cached...loaded. (1.01) *** Module::AutoInstall configuration finished. include inc/Module/Install/WriteAll.pm include inc/Module/Install/Win32.pm include inc/Module/Install/Can.pm include inc/Module/Install/Fetch.pm Writing Makefile for Waste::Web Writing MYMETA.yml and MYMETA.json Writing META.yml And our app class is same as I posted in the original message of this thread -- very standard: package Waste::Web; use Moose; use namespace::autoclean; use Catalyst::Runtime 5.80; use Catalyst qw/ ConfigLoader Static::Simple Session Session::Store::DBIC Session::State::Cookie Authentication Authentication::Credential::Password Authorization::Roles Cache /; use Waste::Lib::CSV; extends 'Catalyst'; our $VERSION = '1.10'; __PACKAGE__-config( name = 'Waste::Web', # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback = 1, ); # Start the application __PACKAGE__-setup(); Which cpanm module needs an upgrade? And is there a way for me to figure that out for next time so I don't have to bother the list with it? :) On Sun, Mar 31, 2013 at 10:00 AM, Tomas Doran bobtf...@bobtfish.net wrote: Hmm. Class::Accessor::Fast should not be being used - I'd guess that you might have an outdated plugin? What does your application class look like, and does running the Makefile.PL of Catalyst-Runtime tell you to upgrade any plugins? Cheers t0m On 31 Mar 2013, at 02:21, will trillich will.trill...@serensoft.com wrote: $ perl -wMDevel::SimpleTrace script/waste_web_server.pl Duplicate specification host|h=s for option h at Catalyst::ScriptRole::_getopt_spec_warnings(unknown source) at MooseX::Getopt::Basic::_parse_argv(/usr/local/share/perl/5.10.1/MooseX/Getopt/Basic.pm:138) at MooseX::Getopt::Basic::process_argv(/usr/local/share/perl/5.10.1/MooseX/Getopt/Basic.pm:79) at MooseX::Getopt::Basic::new_with_options(/usr/local/share/perl/5.10.1/MooseX/Getopt/Basic.pm:105) at Catalyst::ScriptRunner::run(/usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm:50) at main::(script/waste_web_server.pl:8) Can't use string (Waste::Web) as a HASH ref while strict refs in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10. Compilation failed in require at Carp::croak(/usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm:50) at Class::Load::_croak(/usr/local/share/perl/5.10.1/Class/Load.pm:200) at Class::Load::load_class(/usr/local/share/perl/5.10.1/Class/Load.pm:41) at Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:90) at Catalyst::Script::Server::run(/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm:240) at Catalyst::ScriptRunner::run(/usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm:50) at main::(script/waste_web_server.pl:8) So maybe there's something pertinent going on at Catalyst::ScriptRole
[Catalyst] Argh! Trying to upgrade Catalyst -- getting Can't use string as a HASH ref...
We have a Catalyst app Waste::Web that has been running fine and we are trying to upgrade to a more modern set of libraries via cpanm. (One library was upgraded that caused conflicts, now we're running a sweep to get everything updated...) We have an old app called Spills that still runs fine. The problem is with a different old app called Waste::Web... It won't start, throwing the can't use string as HASH ref error, neither as standalone server for testing nor via apache. Suggestions? At first we thought maybe the script formats had changed. So we ran a quick sample catalyst.pl Catalyst::Upgrade to come up with the latest structure for comparison. This I'll call new script below. Then we looked at the script/*pl files, the lib/* files. None of the structures seem to have changed from what we can tell. That is, the old script/*server.pl script has the same standard structure as the brand new script: #!/usr/bin/env perl BEGIN { $ENV{CATALYST_SCRIPT_GEN} = 40; } use Catalyst::ScriptRunner; Catalyst::ScriptRunner-run('Waste::Web', 'Server'); 1; Comparing lib/Waste/Web.pm (old script) to lib/Catalyst/Upgrade.pm (new script) also looks similar -- commented code redacted for space: package Waste::Web; use Moose; use namespace::autoclean; use Catalyst::Runtime 5.80; use Catalyst qw/ ConfigLoader Static::Simple Session Session::Store::DBIC Session::State::Cookie Authentication Authentication::Credential::Password Authorization::Roles Cache /; use Waste::Lib::CSV; extends 'Catalyst'; our $VERSION = '1.10'; __PACKAGE__-config( name = 'Waste::Web', # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback = 1, ); # Start the application __PACKAGE__-setup(); In the new script there *is* a new option to the __PACKAGE__-config call but it's just to instantiate the X-Catalyst http header. All serious structures look the same. But Catalyst::Upgrade runs just fine, and an old app Spill runs just fine, where Waste::Web throws the error: Waste$ *perl script/waste_web_server.pl * Can't use string (Waste::Web) as a HASH ref while strict refs in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10. Compilation failed in require at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50. Waste$ *cd ../Catalyst-Upgrade/* Catalyst-Upgrade$ perl script/catalyst_upgrade_server.pl HTTP::Server::PSGI: Accepting connections at http://0:3000/ Any ideas why we'd be getting this error? Here's the single-step debug log: Catalyst::Script::Server::run(/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm:240): DB1 *v* 237 $self-pidfile-write 238:if $self-_has_pidfile; 239 240== $self-_run_application; 241 } 242 243 244 } 245 246 sub _plack_loader_args { DB1 *s* Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:88): 88: my $self = shift; DB1 *n* Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:89): 89: my $app = $self-application_name; DB1 *n* Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:90): 90: Class::MOP::load_class($app); DB1 *p $app* Waste::Web DB2 *n* Can't use string (Waste::Web) as a HASH ref while strict refs in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10. Compilation failed in require at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50. at /usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm line 90. Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0xa5e1660)') called at /usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm line 240 Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0xa5e1660)') called at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50 Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'Waste::Web', 'Server') called at script/waste_web_server.pl line 8 Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. ___ 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: Argh! Trying to upgrade Catalyst -- getting Can't use string as a HASH ref...
Looks like it bombs out at $c-session_store_model because $c is just Waste::Web and strict refs is in use. But why wouldn't it bomb out for Catalyst::Upgrade or Spill? Catalyst::Plugin::Session::Store::DBIC::setup_finished(/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm:76): DB23 *v 70* 69 sub setup_finished { 70: my $c = shift; 71 72: return $c-next::method unless @_; 73 74 # Try to determine id_field if it isn't set 75: unless ($c-_session_plugin_config-{id_field}) { 76== my $model = $c-session_store_model; DB24 *p $c-session_store_model* Can't use string (Waste::Web) as a HASH ref while strict refs in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10. On Sat, Mar 30, 2013 at 11:04 AM, will trillich will.trill...@serensoft.com wrote: We have a Catalyst app Waste::Web that has been running fine and we are trying to upgrade to a more modern set of libraries via cpanm. (One library was upgraded that caused conflicts, now we're running a sweep to get everything updated...) We have an old app called Spills that still runs fine. The problem is with a different old app called Waste::Web... It won't start, throwing the can't use string as HASH ref error, neither as standalone server for testing nor via apache. Suggestions? At first we thought maybe the script formats had changed. So we ran a quick sample catalyst.pl Catalyst::Upgrade to come up with the latest structure for comparison. This I'll call new script below. Then we looked at the script/*pl files, the lib/* files. None of the structures seem to have changed from what we can tell. That is, the old script/*server.pl script has the same standard structure as the brand new script: #!/usr/bin/env perl BEGIN { $ENV{CATALYST_SCRIPT_GEN} = 40; } use Catalyst::ScriptRunner; Catalyst::ScriptRunner-run('Waste::Web', 'Server'); 1; Comparing lib/Waste/Web.pm (old script) to lib/Catalyst/Upgrade.pm (new script) also looks similar -- commented code redacted for space: package Waste::Web; use Moose; use namespace::autoclean; use Catalyst::Runtime 5.80; use Catalyst qw/ ConfigLoader Static::Simple Session Session::Store::DBIC Session::State::Cookie Authentication Authentication::Credential::Password Authorization::Roles Cache /; use Waste::Lib::CSV; extends 'Catalyst'; our $VERSION = '1.10'; __PACKAGE__-config( name = 'Waste::Web', # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback = 1, ); # Start the application __PACKAGE__-setup(); In the new script there *is* a new option to the __PACKAGE__-config call but it's just to instantiate the X-Catalyst http header. All serious structures look the same. But Catalyst::Upgrade runs just fine, and an old app Spill runs just fine, where Waste::Web throws the error: Waste$ *perl script/waste_web_server.pl * Can't use string (Waste::Web) as a HASH ref while strict refs in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10. Compilation failed in require at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50. Waste$ *cd ../Catalyst-Upgrade/* Catalyst-Upgrade$ perl script/catalyst_upgrade_server.pl HTTP::Server::PSGI: Accepting connections at http://0:3000/ Any ideas why we'd be getting this error? Here's the single-step debug log: Catalyst::Script::Server::run(/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm:240): DB1 *v* 237 $self-pidfile-write 238:if $self-_has_pidfile; 239 240== $self-_run_application; 241 } 242 243 244 } 245 246 sub _plack_loader_args { DB1 *s* Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:88): 88: my $self = shift; DB1 *n* Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:89): 89: my $app = $self-application_name; DB1 *n* Catalyst::ScriptRole::_run_application(/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm:90): 90: Class::MOP::load_class($app); DB1 *p $app* Waste::Web DB2 *n* Can't use string (Waste::Web) as a HASH ref while strict refs in use at /usr/share/perl5/Class/Accessor/Fast.pm line 10. Compilation failed in require at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50. at /usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm line 90. Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0xa5e1660)') called at /usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm line 240 Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0xa5e1660)') called at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 50 Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'Waste::Web', 'Server') called at script/waste_web_server.pl line 8 Debugged program terminated
[Catalyst] Re: Argh! Trying to upgrade Catalyst -- getting Can't use string as a HASH ref...
Still digging deeper -- here's the Trace for right before it tries to hit the anonymous closure sub inside make_accessor: Comparing this against Spill which seems to have no problems at all... package Class::Accessor::Fast; use base 'Class::Accessor'; use strict; $Class::Accessor::Fast::VERSION = '0.34'; sub make_accessor { my($class, $field) = @_; return sub { return $_[0]-{$field} if scalar(@_) == 1; *# == $_[0] is string Waste::Web so boom!* return $_[0]-{$field} = scalar(@_) == 2 ? $_[1] : [@_[1..$#_]]; }; } $ = Catalyst::Plugin::Cache::_default_curried_cache('Waste::Web') called from file `/usr/share/perl5/Catalyst/Plugin/Cache.pm' line 159 $ = Catalyst::Plugin::Cache::cache('Waste::Web') called from file `/usr/share/perl5/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm' line 88 . = Class::MOP::Class:::before(ref(Moose::Meta::Class::__ANON__::SERIAL::28), 'Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 49 $ = Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm:51](ref(Moose::Meta::Class::__ANON__::SERIAL::28), 'Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 91 $ = Moose::Meta::Class::__ANON__::SERIAL::28::ACCEPT_CONTEXT(ref(Moose::Meta::Class::__ANON__::SERIAL::28), 'Waste::Web') called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 629 $ = Catalyst::_filter_component('Waste::Web', ref(Moose::Meta::Class::__ANON__::SERIAL::28)) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 700 $ = Catalyst::model('Waste::Web', 'Waste') called from file `/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm' line 549 $ = Catalyst::Model::DBIC::Schema::__ANON__[/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm:550]('Waste::Web::Model::Waste::Session', 'Waste::Web', undef) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 629 $ = Catalyst::_filter_component('Waste::Web', 'Waste::Web::Model::Waste::Session', undef) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 700 $ = Catalyst::model('Waste::Web', 'Waste::Session', undef) called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 145 $ = Catalyst::Plugin::Session::Store::DBIC::session_store_model('Waste::Web') called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 78 . = Catalyst::Plugin::Session::Store::DBIC::setup_finished('Waste::Web', 1) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1233 . = Catalyst::setup_finalize('Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 50 . = Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm:51]('Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 91 . = Waste::Web::setup_finalize('Waste::Web') called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1207 . = Catalyst::setup('Waste::Web') called from file `/home/will/projects/perl-mvc/Waste/script/../lib/Waste/Web.pm' line 54 $ = require 'Waste/Web.pm' called from file `/usr/local/share/perl/5.10.1/Module/Runtime.pm' line 317 . = Module::Runtime::require_module('Waste::Web') called from file `/usr/local/share/perl/5.10.1/Class/Load.pm' line 177 @ = Class::Load::__ANON__[/usr/local/share/perl/5.10.1/Class/Load.pm:180]() called from file `/usr/local/share/perl/5.10.1/Try/Tiny.pm' line 72 $ = eval {...} called from file `/usr/local/share/perl/5.10.1/Try/Tiny.pm' line 67 @ = Try::Tiny::try(ref(CODE), ref(Try::Tiny::Catch)) called from file `/usr/local/share/perl/5.10.1/Class/Load.pm' line 183 @ = Class::Load::try_load_class('Waste::Web', undef) called from file `/usr/local/share/perl/5.10.1/Class/Load.pm' line 38 . = Class::Load::load_class('Waste::Web') called from file `/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm' line 90 . = Catalyst::ScriptRole::_run_application(ref(Catalyst::Script::Server)) called from file `/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm' line 240 . = Catalyst::Script::Server::run(ref(Catalyst::Script::Server)) called from file `/usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm' line 50 On Sat, Mar 30, 2013 at 11:53 AM, will trillich will.trill...@serensoft.com wrote: Looks like it bombs out at $c-session_store_model because $c is just Waste::Web and strict refs is in use. But why wouldn't it bomb out for Catalyst::Upgrade or Spill? Catalyst::Plugin::Session::Store::DBIC::setup_finished(/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm:76): DB23 *v 70* 69 sub setup_finished { 70: my $c = shift; 71 72: return $c-next::method unless @_; 73 74 # Try to determine id_field if it isn't set 75: unless ($c-_session_plugin_config-{id_field}) { 76== my $model = $c-session_store_model; DB24 *p $c-session_store_model* Can't use string (Waste::Web) as a HASH ref while strict refs
Re: [Catalyst] Re: Argh! Trying to upgrade Catalyst -- getting Can't use string as a HASH ref...
No output from moose-outdated. For now it looks like totally disabling the Cache is at least letting the site/app launch... :) On Sat, Mar 30, 2013 at 12:53 PM, Dimitar Petrov mita...@gmail.com wrote: Just curiosity, does moose-outdated shows any outdated packages or there is no output? On Sat, Mar 30, 2013 at 6:50 PM, will trillich will.trill...@serensoft.com wrote: Still digging deeper -- here's the Trace for right before it tries to hit the anonymous closure sub inside make_accessor: Comparing this against Spill which seems to have no problems at all... package Class::Accessor::Fast; use base 'Class::Accessor'; use strict; $Class::Accessor::Fast::VERSION = '0.34'; sub make_accessor { my($class, $field) = @_; return sub { return $_[0]-{$field} if scalar(@_) == 1; *# == $_[0] is string Waste::Web so boom!* return $_[0]-{$field} = scalar(@_) == 2 ? $_[1] : [@_[1..$#_]]; }; } $ = Catalyst::Plugin::Cache::_default_curried_cache('Waste::Web') called from file `/usr/share/perl5/Catalyst/Plugin/Cache.pm' line 159 $ = Catalyst::Plugin::Cache::cache('Waste::Web') called from file `/usr/share/perl5/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm' line 88 . = Class::MOP::Class:::before(ref(Moose::Meta::Class::__ANON__::SERIAL::28), 'Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 49 $ = Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm:51](ref(Moose::Meta::Class::__ANON__::SERIAL::28), 'Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 91 $ = Moose::Meta::Class::__ANON__::SERIAL::28::ACCEPT_CONTEXT(ref(Moose::Meta::Class::__ANON__::SERIAL::28), 'Waste::Web') called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 629 $ = Catalyst::_filter_component('Waste::Web', ref(Moose::Meta::Class::__ANON__::SERIAL::28)) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 700 $ = Catalyst::model('Waste::Web', 'Waste') called from file `/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm' line 549 $ = Catalyst::Model::DBIC::Schema::__ANON__[/usr/share/perl5/Catalyst/Model/DBIC/Schema.pm:550]('Waste::Web::Model::Waste::Session', 'Waste::Web', undef) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 629 $ = Catalyst::_filter_component('Waste::Web', 'Waste::Web::Model::Waste::Session', undef) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 700 $ = Catalyst::model('Waste::Web', 'Waste::Session', undef) called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 145 $ = Catalyst::Plugin::Session::Store::DBIC::session_store_model('Waste::Web') called from file `/usr/share/perl5/Catalyst/Plugin/Session/Store/DBIC.pm' line 78 . = Catalyst::Plugin::Session::Store::DBIC::setup_finished('Waste::Web', 1) called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1233 . = Catalyst::setup_finalize('Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 50 . = Class::MOP::Method::Wrapped::__ANON__[/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm:51]('Waste::Web') called from file `/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm' line 91 . = Waste::Web::setup_finalize('Waste::Web') called from file `/usr/local/share/perl/5.10.1/Catalyst.pm' line 1207 . = Catalyst::setup('Waste::Web') called from file `/home/will/projects/perl-mvc/Waste/script/../lib/Waste/Web.pm' line 54 $ = require 'Waste/Web.pm' called from file `/usr/local/share/perl/5.10.1/Module/Runtime.pm' line 317 . = Module::Runtime::require_module('Waste::Web') called from file `/usr/local/share/perl/5.10.1/Class/Load.pm' line 177 @ = Class::Load::__ANON__[/usr/local/share/perl/5.10.1/Class/Load.pm:180]() called from file `/usr/local/share/perl/5.10.1/Try/Tiny.pm' line 72 $ = eval {...} called from file `/usr/local/share/perl/5.10.1/Try/Tiny.pm' line 67 @ = Try::Tiny::try(ref(CODE), ref(Try::Tiny::Catch)) called from file `/usr/local/share/perl/5.10.1/Class/Load.pm' line 183 @ = Class::Load::try_load_class('Waste::Web', undef) called from file `/usr/local/share/perl/5.10.1/Class/Load.pm' line 38 . = Class::Load::load_class('Waste::Web') called from file `/usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm' line 90 . = Catalyst::ScriptRole::_run_application(ref(Catalyst::Script::Server)) called from file `/usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm' line 240 . = Catalyst::Script::Server::run(ref(Catalyst::Script::Server)) called from file `/usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm' line 50 On Sat, Mar 30, 2013 at 11:53 AM, will trillich will.trill...@serensoft.com wrote: Looks like it bombs out at $c-session_store_model because $c is just Waste::Web and strict refs is in use. But why wouldn't it bomb out for Catalyst::Upgrade or Spill? Catalyst::Plugin::Session::Store::DBIC
[Catalyst] sub-modules for model
Spent a bit of time googlilng this and apparnelty I'm not searching very effectively today... Short version: What's best-practices to get model library sub-modules hooked in to the main model? Long version: *catalyst.pl Thingy* *cd Thingy* *script/thingy_create.pl model DB DBIC::Schema \* * Thingy::Schema::DB create=static dbi:mysql:thingy \ * * dbuser dbpasswd* So now we have lib/Thingy/Model/DB like so: *package Thingy::Model::DB;* * * *use strict;* *use base 'Catalyst::Model::DBIC::Schema';* * * *__PACKAGE__-config(* *schema_class = 'Thingy::Schema::DB',* * * *connect_info = {* *dsn = 'dbi:mysql:thingy',* *user = 'dbuser',* *password = 'dbpasswd',* *}* *);* This is a top-level module. Instead of a monolithic mess with all possible library routines in one package, we want to modularize sub-functions into, say *Thingy::Model::DB::Team* *Thingy::Model::DB::User* *Thingy::Model::DB::Incident* etc Do we have those sub-modules use the top-level Thingy::Model::DB? Do we have Thingy::Model::DB use the sub-modules? Do we have the sub-modules use base 'Catalyst::Model::DBIC::Schema'? Or can they just extends 'Catalyst::Model' and if so how do they hook in with $c? Is there an elegant way to have all the sub-module models use the same DB config as the top model? ...or... What's the best practice for getting separate modules to work as models in the MVC universe? -- Will Trillich :: 812.454.6431 “Grading takes away all the fun from failing. And a huge part of education is about failure.” -- Shimon Schocken ___ 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] Why is $c undefined?
On Mon, Oct 29, 2012 at 2:07 PM, Craig Chant cr...@homeloanpartnership.comwrote: sub begin :Private { my ( $self, $c ) = @_; # Authenticate $self-AuthenticateUser(); *Note, you don't pass $c to AuthenticateUser here!* return 1; } I then have... sub AuthenticateUser { my ( $self, $c ) = @_; $c-session; if(!$c-model('Members')-LogCheck($c)){ $c-uri_for_action('/login/login'); } } However, $c is undefined and errors, it only works if I pass it $c from 'begin'.. $self-AuthenticateUser($c); I was under the impression that $c was the context (Catalyst) default variable and was always passed to every method / subroutine. is this not the case? *Right, that's not the case. It only passes to the :Chained or :Args or :CaptureArgs methods. This leaves you free to create your own internal methods that don't get extra $c args interfering with your logic.* * * -- Will Trillich :: 812.454.6431 “Grading takes away all the fun from failing. And a huge part of education is about failure.” -- Shimon Schocken ___ 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] Best-practices question: caching a search
Roger that -- so: include the search params in the links, and recreate the recordset each time via ...-search({},{}). Sounds reasonable. Off to the salt mines... On Sun, Sep 16, 2012 at 10:07 AM, Bill Moseley mose...@hank.org wrote: On Sat, Sep 15, 2012 at 7:06 PM, will trillich will.trill...@serensoft.com wrote: Hi Francisco -- I'm not talking about paginating a resultset, I'm talking about returning to a previously-established resultset on some future HTTP request. Here's the scenario: You are asking just how to display multiple pages of search results? 12:01 Bob submits search form for Chicago between 1-Apr-2012 and 30-Apr-2012 Use a GET, not a POST. I'm Ignoring timezones, but you should not. http://example.com/event_list?city=Chicagoafter=2012-04-01before=2012-04-30rows=100page=1http://example.com/event_list?city=Chicagobetween=2012-04-01:2012-04-30rows=100page=1 12:02 Bob sees first page of results, records 1-100 12:03 Bob clicks to see second page of results, records 101-200 = how do we re-establish the recordset here, from the original search form at 12:01? http://example.com/event_list?city=Chicagoafter=2012-04-01before=2012-04-30rows=100page=http://example.com/event_list?city=Chicagobetween=2012-04-01:2012-04-30rows=100page=1 2 12:04 Bob clicks thru to see detail on record 135 12:05 Bob clicks breadcrumbs to return to search = how do we re-establish the recordset here, from the original search form at 12:01? http://example.com/event_list?city=Chicagoafter=2012-04-01before=2012-04-30rows=100page=1http://example.com/event_list?city=Chicagobetween=2012-04-01:2012-04-30rows=100page=1 All independent requests -- someone may bookmark page 2 and go back there directly. Then (later) think about caching. That depends on usage, your database load, your SLA, your traffic, load, etc. You could fetch the entire result list on the first request and cache, for example, or you could instead cache the entire page (with a separate page cache layer). Use a cache, not the session, for caching. There's nothing here related to the session unless you wan to display something like recent searches to show on all pages -- and even that might be better in the cache keyed by user's ID if users are required to log in. On Sat, Sep 15, 2012 at 2:55 PM, Francisco Obispo fobi...@isc.orgwrote: Some databases provide means to return a specific set of records, and even an offset, In DBIx::Class, when you search, you can actually specify the page as an option [1], if you're not querying against a database, you might want to use something like Memcached or the like to store your resultset and paginate accordingly. [1] http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#ATTRIBUTES On Sep 15, 2012, at 11:41 AM, will trillich will.trill...@serensoft.com wrote: User enters some search parameters (location, date-range, etc). Gets 500 results which we paginate. Once the user pages to the item of interest, he/she can then click thru to edit or see more detail. It'd be nice to have 'breadcrumbs' that take the user back to that page of that search. What's the recommended way of doing that? A) stash the whole recordset into the session (can you even serialize/deserialize a recordset object?) B) stash the search params and page-no and page-size and recreate the recordset each time C) ...something else? -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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/ Francisco Obispo email: fobi...@isc.org Phone: +1 650 423 1374 || INOC-DBA *3557* NOC PGP KeyID = B38DB1BE ___ 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/ -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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/ -- 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/ -- Will Trillich
[Catalyst] Best-practices question: caching a search
User enters some search parameters (location, date-range, etc). Gets 500 results which we paginate. Once the user pages to the item of interest, he/she can then click thru to edit or see more detail. It'd be nice to have 'breadcrumbs' that *take the user back to that page of that search*. What's the recommended way of doing that? A) stash the whole recordset into the session (can you even serialize/deserialize a recordset object?) B) stash the search params and page-no and page-size and recreate the recordset each time C) ...something else? -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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] Best-practices question: caching a search
Hi Francisco -- I'm not talking about paginating a resultset, I'm talking about returning to a previously-established resultset on some future HTTP request. Here's the scenario: 12:01 Bob submits search form for Chicago between 1-Apr-2012 and 30-Apr-2012 12:02 Bob sees first page of results, records 1-100 12:03 Bob clicks to see second page of results, records 101-200 = how do we re-establish the recordset here, from the original search form at 12:01? 12:04 Bob clicks thru to see detail on record 135 12:05 Bob clicks breadcrumbs to return to search = how do we re-establish the recordset here, from the original search form at 12:01? On Sat, Sep 15, 2012 at 2:55 PM, Francisco Obispo fobi...@isc.org wrote: Some databases provide means to return a specific set of records, and even an offset, In DBIx::Class, when you search, you can actually specify the page as an option [1], if you're not querying against a database, you might want to use something like Memcached or the like to store your resultset and paginate accordingly. [1] http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#ATTRIBUTES On Sep 15, 2012, at 11:41 AM, will trillich will.trill...@serensoft.com wrote: User enters some search parameters (location, date-range, etc). Gets 500 results which we paginate. Once the user pages to the item of interest, he/she can then click thru to edit or see more detail. It'd be nice to have 'breadcrumbs' that take the user back to that page of that search. What's the recommended way of doing that? A) stash the whole recordset into the session (can you even serialize/deserialize a recordset object?) B) stash the search params and page-no and page-size and recreate the recordset each time C) ...something else? -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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/ Francisco Obispo email: fobi...@isc.org Phone: +1 650 423 1374 || INOC-DBA *3557* NOC PGP KeyID = B38DB1BE ___ 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/ -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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] Best-practices question: caching a search
Steve -- Does that work when someone starts a search and then goes to lunch and comes back the next day to click next? Do you key it to the session ID somehow? On Sat, Sep 15, 2012 at 9:21 PM, Rippl, Steve rip...@woodlandschools.orgwrote: I've used temporary tables for large search results I've needed to get back to quickly and didn't want to rebuild from scratch... On Sat, Sep 15, 2012 at 7:06 PM, will trillich will.trill...@serensoft.com wrote: Hi Francisco -- I'm not talking about paginating a resultset, I'm talking about returning to a previously-established resultset on some future HTTP request. Here's the scenario: 12:01 Bob submits search form for Chicago between 1-Apr-2012 and 30-Apr-2012 12:02 Bob sees first page of results, records 1-100 12:03 Bob clicks to see second page of results, records 101-200 = how do we re-establish the recordset here, from the original search form at 12:01? 12:04 Bob clicks thru to see detail on record 135 12:05 Bob clicks breadcrumbs to return to search = how do we re-establish the recordset here, from the original search form at 12:01? On Sat, Sep 15, 2012 at 2:55 PM, Francisco Obispo fobi...@isc.orgwrote: Some databases provide means to return a specific set of records, and even an offset, In DBIx::Class, when you search, you can actually specify the page as an option [1], if you're not querying against a database, you might want to use something like Memcached or the like to store your resultset and paginate accordingly. [1] http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#ATTRIBUTES On Sep 15, 2012, at 11:41 AM, will trillich will.trill...@serensoft.com wrote: User enters some search parameters (location, date-range, etc). Gets 500 results which we paginate. Once the user pages to the item of interest, he/she can then click thru to edit or see more detail. It'd be nice to have 'breadcrumbs' that take the user back to that page of that search. What's the recommended way of doing that? A) stash the whole recordset into the session (can you even serialize/deserialize a recordset object?) B) stash the search params and page-no and page-size and recreate the recordset each time C) ...something else? -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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/ Francisco Obispo email: fobi...@isc.org Phone: +1 650 423 1374 || INOC-DBA *3557* NOC PGP KeyID = B38DB1BE ___ 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/ -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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/ -- Steve Rippl Technology Director Woodland Public Schools 360 841 2730 ___ 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/ -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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] Additional scripts accessing the Model and Config?
Example of pulling the standard catalyst config into a command-line-type-usage script (works nicely from the scripts/ directory): use FindBin qw($Bin); use Path::Class; use lib dir($Bin, '..', 'lib')-stringify; # cross-platform # Now that we have the local LIB directory in our @INC path, get the module: use MyApp::Schema::DB; use Config::General; use strict; # Get info from the config file my $conf = new Config::General( file( $Bin, '..', 'myapp.conf' ) ); my %conf = $conf-getall; my $dbi = $conf{'Model::MyApp'}{connect_info}; my @dbi = map{ $dbi-{$_} } qw/dsn user password/; # Connect to database my $schema = MyApp::Schema::DB-connect( @dbi ); #...etc On Fri, Jun 8, 2012 at 1:23 PM, Thomas Klausner d...@cpan.org wrote: Hi! On Fri, Jun 08, 2012 at 02:05:31PM -0400, Luis Muñoz wrote: But still, I would like to have access to the configuration data (for instance, how to setup the database/ldap/whatever Model, etc). Does that happen as well when using the class method? We pack our config (which basically is a big hash) in a class. To provide the config to Catalyst, we use the class in my_app.pl (which is like my_app.(yml|json|ini|...). If we need the config in some other scripts, we just use the class there. The non-Web code lives in classes (eg DBIC) that are used via Models in Catalyst, or directly (or some Model-like wrappers, if it needs to be) in other contexts. Greetings, domm -- #!/usr/bin/perl http://domm.plix.at for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/} ___ 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/ -- Will Trillich :: 812.454.6431 “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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] Changing Formhandler field-type/widget based on Catalyst user-role
Hmm. Still puzzled as to what solution might work with that approach. Maybe changing-field-type is philosophically questionable, but the mechanism still looks like it should work. :) But didn't. So we're off to try more FormHandler magic from a different angle (not catalyst-affected, so we're posting on the formhandler list for that). On Thu, May 24, 2012 at 3:46 AM, Denny 2...@denny.me wrote: On Wed, 2012-05-23 at 23:24 -0500, will trillich wrote: Short version: How can we toggle field X from being a Select (popup) for Admin users, to being a Hidden (nothing visible, but the value is maintained) for Manager users? Short answer; don't. If you're maintaining the value for users who aren't allowed to change it, then you don't want it in your form data. Form submissions can be spoofed, so you'd have to double-check the value (or drop it) in your Perl code anyway... so you might as well just do that, and remove it entirely from the HTML (which seems to be a simpler problem?) Regards, Denny ___ 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/ -- “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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] Changing Formhandler field-type/widget based on Catalyst user-role
Short version: How can we toggle field X from being a Select (popup) for Admin users, to being a Hidden (nothing visible, but the value is maintained) for Manager users? Long version: We have three levels of user-roles (*admins* can do everything, *managers*can do a lot, *readonly* can do very little). Admins get to specify user roles for all users (even other admins), but managers (level two) only get to edit readonly users and we don't want them to elevate any such users to being managers (or worse, admins). package MyApp::Controller::Admin::Person; #... $self-form( MyApp::Form::Admin::Person-new( ctx = $c ) ); package MyApp::Form::Admin::Person; # sub set_active { my $self = shift; $self-inactive(['role']) unless $self-ctx-user-is_admin; } Trying to use ctx so we could pass $c and later test it in the form's set_active method throws an exception because of ctx being undefined. package MyApp::Controller::Admin::Person; #... unless ( $c-user-is_admin ) { # $self-form-inactive(['role']); # $self-form-field('role')-widget('hidden'); # $self-form-field('role')-type('Hidden'); } So instead we've tried making the field inactive (no apparent effect at all), switching to a different widget (field completely disappears) or different type (field completely disappears). Pointers? -- “Waiting for perfect is never as smart as making progress.” -- Seth Godin ___ 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] No data showing
$c-model('ORANGES::AccountView')-search({},{order_by='account_code'})-all() I'd recommend that you look into iterating thru the recordset in the template, instead of rendering all rows of data before it's rendered: my $acct_rs = $c-model('ORANGE::AccountView')-*search_rshttp://search.cpan.org/~arodland/DBIx-Class-0.08196/lib/DBIx/Class/ResultSet.pm#search_rs *( {}, { order_by = 'account_code', page = $page_no, rows = $rows_per_page, }, ); $c-stash( accounts = $acct_rs ); then in your template [% WHILE ( acct = accounts.next ) %] See http://search.cpan.org/~danieltwc/DBIx-Class-0.07002/lib/DBIx/Class/Manual/Cookbook.pod#Searching On Fri, Apr 27, 2012 at 10:09 AM, Kenneth S Mclane ksmcl...@us.ibm.comwrote: I swear I tried that and it still didn't work. It does now, thank you. Can you tell me what I need to add to $c-stash(accounts = [ $c-model('ORANGES::AccountView')-all ]); to sort by the account_code in ascending order? It's obviously sort, but the actual syntax is what I'm looking for. Thanks again. From: Will Crawford billcrawford1...@gmail.com To: The elegant MVC web framework catalyst@lists.scsys.co.uk Date: 04/27/2012 09:55 AM Subject: Re: [Catalyst] No data showing -- On 27 April 2012 15:50, Kenneth S Mclane *ksmcl...@us.ibm.com*ksmcl...@us.ibm.com wrote: This was a test to make sure I was actually getting data. My intention is to return all rows in pager format. I haven't made it to that part yet. Here is my template code: table width=100% border=1 trthDepartment/ththAccount Code/ththAccount Name/ththPolicy/ththCompliant/ththServers/ththSubsystems/ththComplete/ththStatus/th/tr [% # Display each account in a table row %] [% FOREACH account IN accounts -%] ^^^ tr td1[% accounts.department_id %]/td You're simply referring to the list instead of the item here. ___ 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/ -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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: Delays in Explorer connections via Catalyst
Ooh, ngrep is wicked awesome! Thanks for that tidbit-- Now, back to the salt mines: Adding --fork or --keepalive to the command-line for the test server didn't make any improvement. Same problem seems to happen (off and on) when running under FastCGI in Apache as well. Using *ngrep* on the server, we can see the requests arrive at the server immediately, as suspected: T 2012/03/18 *13:56:27.290616* 192.168.0.119:58316 - 192.168.0.10:3000 [AP] GET /incident/2499/tab/info?_=1332096987014 HTTP/1.1..x-requested-with: XMLHttpRequest..Accept-Language: en-us..Referer: http://localhost:3000/incident/2499/..Accept: */*..UA-CPU: x86..Accept-Encoding: gzip, deflate..User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)..Host: localhost:3000..Connection: Keep-Alive..Cookie: incident_web_session=48e12cad549328590ac73b82396f01376129de24... . # T 2012/03/18 *13:57:45.686752* 192.168.0.10:3000 - 192.168.0.119:58316 [AP] HTTP/1.0 200 OK..Cache-Control: no-cache..Connection: close..Date: Sun, 18 Mar 2012 18:57:45 GMT..Content-Length: 9616..Content-Type: text/html; charset=utf-8..Set-Cookie: incident_web_session=48e12cad54932 8590ac73b82396f01376129de24; path=/; expires=Sun, 18-Mar-2012 20:57:45 GMT; HttpOnly..Status: 200..X-Catalyst: 5.80032 # Here you can see there's a MINUTE AND 18 SECONDS between request @13:56:27 and response @13:57:45! Argh! Once it does make its way back to the browser everything is golden. But making users wait for 75+ seconds just isn't feasible. We're testing IE7 since that's what our client's clients seem to use :( unfortunately. So there's frequent (but not 100% consistent) delay on the server-side when an Explorer request comes in to Catalyst, which doesn't affect FireFox or Chrome. Brainstorming welcome! Ideas? On Sun, Mar 18, 2012 at 1:01 PM, Adam Sjøgren a...@koldfront.dk wrote: On Sun, 18 Mar 2012 11:37:44 -0500, will wrote: When we run the server via *script/*server.pl -d* we sometimes don't even What happens if you add '--fork' to the command? Or perhaps '--keepalive' (I seem to remember IE liking that, at least at one point in time)? Could it be a Content-Length issue? (The browser waiting for the number of bytes in the header, the number being off (too high)?) I can, by the way, recommend ngrep¹ for debugging stuff like this, it's quite nice. Best regards, Adam ¹ http://packages.debian.org/sid/ngrep -- 500 mil i snön Adam Sjøgren Ett UFO över sjön a...@koldfront.dk och i en blixt dansar Lady Day vals med Astaire ___ 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/ -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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] Connect DBIx::Class model on startup?
On Sun, Mar 4, 2012 at 8:30 PM, Daniel J. Luke dl...@geeklair.net wrote: MyApp-model('DB')-schema-dbh-ping; # Check we have a DB connection that's working straight after forking but before starting to handle requests. Maybe I'm being thick, but where does that instance of MyApp come from? I don't see it being passed into FCGI::ProcManager What instance of MyApp? MyApp-method() is a direct reference to the original package, not to an instance. my $myapp = MyApp-instantiate() would be an instance, if you had such a method to call. use MyApp; MyApp-something(); MyApp has been included as a library, so now you can call it appropriately. There's *no instance* in this case... the one that I'm going to call -model() on in order to pre-connect to my DB? There is no instance? Then there's some magic that I'm missing? If I take your code literally, I'm going to get a 'cannot use a string as a hash ref' error. -- Daniel J. Luke ++ | * dl...@geeklair.net * | | *-- http://www.geeklair.net -* | ++ | Opinions expressed are mine and do not necessarily | | reflect the opinions of my employer. | ++ ___ 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/ -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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 generating emails -- how to buffer large attachments?
Thanks for the pointer, t0m! We switched to Mail::Sender -- it opens a connection to the SMTP server immediately, and pipes the output generating on -the-fly, instead of accumulating beaucoup megabytes in RAM to then ship off the whole thing at once. Wound up doing as you suggested: use base 'Catalyst::View::TT'; use Email::MIME; use Mail::Sender; # = woo hoo! use Moose; sub render { ... } And within render() we purloined chunks of the templating approach (generate_part) from Catalyst::View::Email::Template in order to still use the templates approach (one for HTML, one for text). Works a treat! On Wed, Dec 21, 2011 at 11:34 AM, Tomas Doran bobtf...@bobtfish.net wrote: On 20 Dec 2011, at 21:20, will trillich wrote: Is there a (straightforward, hopefully :) way to buffer large attachments when generating emails via a Catalyst View? Yes, in the view code :_) But you don't mean this, you mean 'in Catalyst::View::Email' If we could use a combination of Template-Toolkit and Email::Stuff which handles buffering nicely (hand it a $FH instead of content, swee-ee-eet) that would be grand. It doesn't look like Email::MIME (which Catalyst::View::Email builds upon) doesn't seem to expect anything other than $body_content. Time to not be using Catalyst::View::EMail then :) I'd recommend just sub-classing either your existing (or a new) TT view, and using around render = sub {... to do whatever you want with Email::Stuff, taking the document you've just rendered with TT, and the other attachments and doing the right thing. Cheers t0m __**_ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalysthttp://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/** catalyst@lists.scsys.co.uk/http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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 generating emails -- how to buffer large attachments?
Using Catalyst::View::Email::Template is great for separating presentation from data in generating emails, but we're running into Server issues when the email includes a large attachment (or several). The whole email gets built in server ram before the response comes back to the browser. Is there a (straightforward, hopefully :) way to buffer large attachments when generating emails via a Catalyst View? $att = $item-attachments_rs; if ( $att-count ) { my @parts; require Email::MIME; while ( my $fyl = $att-next ) { my $part = Email::MIME-create( attributes = { filename = $fyl-path, name = $fyl-path, content_type = $fyl-mimetype, disposition = 'attachment', encoding = 'base64', }, # body = read_entire_file( *$fyl-path_to_file* ), # ugh! *body = $fyl-path_to_file, # or $filehandle* ); push @parts, $part; } $email_args{parts} = [ @parts ]; } $c-stash( email = { %email_args } ); $c-forward( 'View::Email' ); If we could use a combination of Template-Toolkit and Email::Stuff which handles buffering nicely (hand it a $FH instead of content, swee-ee-eet) that would be grand. It doesn't look like Email::MIME (which Catalyst::View::Email builds upon) doesn't seem to expect anything other than $body_content. -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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] Overriding content-type for View::JSON
Short version: what's the protocol in a MyApp::View::Blah to override content-type in certain circumstances? Long version: We're trying to get the blueimp file-upload jQuery library working under IE (fine under firefox and chrome, of course): https://github.com/blueimp/jQuery-File-Upload/wiki/Setup The recommendation is that the server should set content-type to text/html or text/plain instead of application/json for IE. Here's the PHP example they post: ?php header('Vary: Accept'); if (isset($_SERVER['HTTP_ACCEPT']) (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) { header('Content-type: application/json'); } else { header('Content-type: text/plain'); } ? What's required in MyApp::View::JSON to handle this properly? -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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] Overriding content-type for View::JSON
Bueno. Many thanks! On Mon, Dec 19, 2011 at 10:14 AM, Tomas Doran bobtf...@bobtfish.net wrote: On 19 Dec 2011, at 15:40, will trillich wrote: What's required in MyApp::View::JSON to handle this properly? after process = sub { my ($self, $c) = @_; $c-res-header(); }; Cheers t0m __**_ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalysthttp://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/** catalyst@lists.scsys.co.uk/http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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] Reasonable way to get $c-config into Result class?
That does look promising. I'll take a look -- thanks! On Tue, Dec 13, 2011 at 7:49 AM, David Schmidt davew...@gmx.at wrote: http://wiki.catalystframework.org/wiki/wikicookbook/configpass2schema I hope that solves your problem. I am in a bit of a hurry and didn't read your mail very carefully david On 13 December 2011 01:49, will trillich w...@serensoft.com wrote: We have a Catalyst app where incidents can have attachments, and the attachments are stored in the filesystem (MySql backend is lethargic for in-DB binary blobs). Right now we're using a package global for storing the file-path-root, but obviously this should be handled via config somehow. Is there an elegant way to use MyApp.conf to set up a file-path that can get to $self-config consistently? If we use package MyApp::Schema::DB::Result::Incident; #... has 'config' = ( is = 'rw' ); #... then in the Controller we have to inject something into $incident-config manually at create-time like so: package MyApp::Web::Controller::Incident; #... my $incident = $c-model('MyApp::Incident')-find({ id = $id }); $incident-config( $c-config ); But that only works in the context of a controller. If instead, we're coming in from a related record, such as an attachment, then $attachment-incident-config won't have any info, and no way to get it. I can see where DBIx::Class::Schema::Config allows pre-configuring credentials to connect to a database, but that's not what we're looking for here. Right now we have the file-path config stored in a global (yecch!) in the Result class, but would much rather have it in myapp.conf somehow... Clue stick welcome. -- -- will trillich -- http://faq.serensoft.com/ The truth is that many people set rules to keep from making decisions. -- Mike Krzyzewski ___ 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/ -- We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein ___ 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] Reasonable way to get $c-config into Result class?
We have a Catalyst app where incidents can have attachments, and the attachments are stored in the filesystem (MySql backend is lethargic for in-DB binary blobs). Right now we're using a package global for storing the file-path-root, but obviously this should be handled via config somehow. Is there an elegant way to use MyApp.conf to set up a file-path that can get to $self-config consistently? If we use package MyApp::Schema::DB::Result::Incident; #... has 'config' = ( is = 'rw' ); #... then in the Controller we have to inject something into $incident-config manually at create-time like so: package MyApp::Web::Controller::Incident; #... my $incident = $c-model('MyApp::Incident')-find({ id = $id }); $incident-config( $c-config ); But that only works in the context of a controller. If instead, we're coming in from a related record, such as an attachment, then $attachment-incident-config won't have any info, and no way to get it. I can see where DBIx::Class::Schema::Config allows pre-configuring credentials to connect to a database, but that's not what we're looking for here. Right now we have the file-path config stored in a global (yecch!) in the Result class, but would much rather have it in myapp.conf somehow... Clue stick welcome. -- -- will trillich -- http://faq.serensoft.com/ The truth is that many people set rules to keep from making decisions. -- Mike Krzyzewski ___ 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 Advent Calendar
On Thu, Dec 1, 2011 at 7:10 PM, Devin Austin devin.aus...@gmail.com wrote: On Thu, Dec 1, 2011 at 10:00 AM, will trillich will.trill...@serensoft.com wrote: I do appreciate the neat articles that talk about Facebook API's and Google API's and other advanced stuff, but those often seem a bit esoteric and beyond the daily grind of what we're developing. So it's also good to keep the newbies in mind. I think if the advent series could showcase a couple of basic articles (maybe even repackaging email threads?) it'd be great! Concepts such as: - how an insulated, personal perl library, instead of system-wide cpan, is better for a Catalyst app, Hmm. Not sure I quite understand this one, internal dependencies never seem to be a better architectural decision over external, thoroughly tested ones. Could you please elaborate? In my head, the first item (above) and second item (below) are closely related. That is, if you maintain your own $local::lib of CPAN wizardry then you're better off in the long run when your app outlives your server, or you migrate due to vendor concerns (or politics). Also, isn't it more likely you'll run into problems using the system perl libraries instead of a home-grown one? I think I've seen topics like that here on-list... would be nice to see those concepts encapsulated as an advent article. - tricks and tips to keep in mind to make migrating a catalyst app from system Q to system X easy, This could be interesting. Do you have tips? I personally don't migrate much from system to system, but others might find it useful. I don't have any such tips, yet. I'm hoping I don't need them all at once in the future in crash-bang mode when migration becomes a necessity, hopefully a clear advent article beforehand can help newbies like me avoid some of the pitfalls... - strengths and weaknesses of and techniques for using revision-management such as mercurial or subversion or git to track source code changes... - using InstantCRUD or AutoCRUD in various contexts as a debugging tool or data-mining aid There have been one or two a year on this sort of thing, and while I think it's beneficial, it's almost something that's been overdone. If there is something groundbreaking in this area, sure, I'm all for it. I sure wouldn't mind seeing some more new ideas concerning this, but I think we need to look toward new things that haven't necessarily been covered yet, even if we're in dire need of articles. :) -- The more you try to avoid suffering the more you suffer because smaller and more insignificant things begin to torture you in proportion to your fear of being hurt. -- Thomas Merton ___ 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 Advent Calendar
Coming up with good articles isn't easy! Documentation is the toughest part of writing code. Myself, I've been mulling, since Nov 3, how to make * http://search.cpan.org/~mstrout/Catalyst-View-TT-0.37/lib/Catalyst/View/TT.pm#expose_methods * resonate better with newbies like me, and I haven't come up with anything better than what's already there. :( Argh! I do appreciate the neat articles that talk about Facebook API's and Google API's and other advanced stuff, but those often seem a bit esoteric and beyond the daily grind of what we're developing. So it's also good to keep the newbies in mind. I think if the advent series could showcase a couple of basic articles (maybe even repackaging email threads?) it'd be great! Concepts such as: - how an insulated, personal perl library, instead of system-wide cpan, is better for a Catalyst app, - tricks and tips to keep in mind to make migrating a catalyst app from system Q to system X easy, - strengths and weaknesses of and techniques for using revision-management such as mercurial or subversion or git to track source code changes... - using InstantCRUD or AutoCRUD in various contexts as a debugging tool or data-mining aid On Thu, Dec 1, 2011 at 4:52 PM, Devin Austin devin.aus...@gmail.com wrote: Hey all, It's that time of year again, and as per tradition, we're running a bit behind. If anyone can whip up a few articles to buffer us for the next few days with the Advent article, that would be great. We are also in great need of an opening article. Please contact myself (email, or irc: dhoss on irc.perl.org) or Dimitar (email: mita...@gmail.com, irc: dpetrov). Happy holidays! -- Devin Austin http://www.dhoss.net 9702906669 - Cell ___ 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/ -- The more you try to avoid suffering the more you suffer because smaller and more insignificant things begin to torture you in proportion to your fear of being hurt. -- Thomas Merton ___ 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] Dealing with timestamps from Postgres
On Thu, Nov 3, 2011 at 12:36 PM, Tomas Doran bobtf...@bobtfish.net wrote: Another option is to *add a 'format_date' method to your view*, and use the *expose_methods *config setting for View::TT.. In your TT code you'd then say [% WHILE (row = mydata_rs.next); format_date(row.my_date_field)**; END %] /lurkInteresting... Aha, that's what * http://search.cpan.org/~mstrout/Catalyst-View-TT-0.37/lib/Catalyst/View/TT.pm#expose_methods * is talking about. Hadn't noticed that before. Neat! -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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] Dealing with timestamps from Postgres
Catalyst sure is wide and deep. One can get a reasonably advanced app running in Catalyst without knowing broad stretches of what goes on, or *can* go on, under the hood. There's so much possible, and so many handy methods and plugins that you're gonna A) overlook things on the mad dash to the goal or B) not understand the value of things until much later (like abstracting code to a library, it often takes a few iterations before the utility becomes obvious). This case was a combination of both. I often struggle to find the answer to a has someone else solved this already question, and wind up rolling my own solution... only to run in to someone else's cleverer, cleaner approaches later (often by accident). In order to have 'perfect documentation' it must meet two criteria: A) explain the utility and usage (benefits and how-to) *in a way that I can grok* and B) show up on my radar *in my searches*. Both of these depend a helluva lot on my own activity and context, making compliance impossible. :) Sometimes scar tissue is the only (best?) way to really learn. On Thu, Nov 3, 2011 at 3:46 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 3 Nov 2011, at 15:38, will trillich wrote: Aha, that's what http://search.cpan.org/~**mstrout/Catalyst-View-TT-0.37/ **lib/Catalyst/View/TT.pm#**expose_methodshttp://search.cpan.org/~mstrout/Catalyst-View-TT-0.37/lib/Catalyst/View/TT.pm#expose_methodsis talking about. Hadn't noticed that before. Not noticed it before (fair enough), or not clear enough in the documentation? Cheers t0m __**_ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalysthttp://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/** catalyst@lists.scsys.co.uk/http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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] Dealing with timestamps from Postgres
Pushy, pushy. :) I'll see what I can come up with. On Thu, Nov 3, 2011 at 2:29 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 3 Nov 2011, at 19:03, will trillich wrote: In order to have 'perfect documentation' it must meet two criteria: A) explain the utility and usage (benefits and how-to) in a way that I can grok and B) show up on my radar in my searches. Both of these depend a helluva lot on my own activity and context, making compliance impossible. :) Sometimes scar tissue is the only (best?) way to really learn. Sure, I totally agree. I'm also entirely certain that the documentation as it stands fails at meeting (or at least is way before the standard it could be) in your criteria for (A), and therefore will fail to meet a good many other people's version of the same criteria. As someone who has 'just got it', you are absolutely the best placed person to modify the documentation to add to the benefits (and maybe provide an example) as to make it more clear to people, so that the documentation _will_ fulfill that criteria for a broader range of people who happen to read it in future. Cheers t0m __**_ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalysthttp://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/** catalyst@lists.scsys.co.uk/http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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] YA CRUD module
Looks pretty sweet! Nice work. On Mon, Oct 31, 2011 at 9:49 AM, David Schmidt davew...@gmx.at wrote: It's about time I publish my first CPAN module and it happens to be yet another CRUD module. Feedback greatly appreciated. https://github.com/davewood/CatalystX-TraitFor-Controller-Resource One thing I have yet to do is writing tests. :) david ps: there is http://search.cpan.org/~abraxxa/Catalyst-Controller-DBIC-API-2.004002/lib/Catalyst/Controller/DBIC/API.pm which does the same and more much better. ___ 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/ -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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] Paradigm question: how to use ResultSet level security based on $c-user?
Question: when a user logs in to our Catalyst app, he/she should only see the items he/she is allowed to see. But the only way we can figure how to do this is to pass $c-user either to the ResultSet methods or to the FormHandler methods, making the app more and more interdependent... Is there a better paradigm in the context of a Catalyst app? Right now we're working this via DBIC ResultSet like so: package Incident::Schema::DB::ResultSet::Incident; use base 'DBIx::Class::ResultSet'; sub *security* { my $rs = shift; my $user= shift; $user = $user-obj if ( $user-can('obj') ); if ( $user-is_admin ) { return $rs; # everything is visible to admins } my %visible_teams = map { $_ = 1 } $user-corp_team_ids; # method from Incident::User schema $rs = $rs-search( { 'me.team' = { -in = [ keys %visible_teams ] } }, { order_by = ['created'] } ); return $rs; } Then... package Incident::Web::Controller::Ticket; BEGIN { extends 'Catalyst::Controller'; } sub base : Chained('/auth') PathPart('ticket') CaptureArgs(0) { my ( $self, $c ) = @_; my $rs = $c-model('Incident::Ticket')-security( *$c-user* ); $c-stash( incident_rs = $rs ); } Is this Kosher? In this context it's a DBIC resultset depending on another DBIC object, so it may not be as big an issue as, say, when we have HTML::FormHandler popup menus that should only show the user options based on the user's role and/or organization. Is there a canonical way to approach this both in ResultSets and in FormHandler forms? -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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] Using URL for /search/parameters: bad idea?
Catalystos: I'm implementing a search screen and I'm wondering how impractical it would be to have the URL be 'storage' for the parameters. Looking in the Cookbook under DRY Controllers with Chained Actionshttp://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Cookbook.pod#DRY_Controllers_with_Chained_actions got me to thinking it may be feasible... For example: /incident/my/loc/37/closed/20110401-20110430 /incident/team/22/manager/138/product/417 /incident/manager/138/product/417 Advantages: easy for the browser to bookmark and return to, later Disadvantages: chaining? other? If using the URL is a bad way to 'store' the search parameters, what's a good way to cache them in the session info? -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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] Using URL for /search/parameters: bad idea?
When the search-screen has a dozen or more fields (client requirements), it's more likely that we use a POST instead of a GET. Bookmarking THAT ain't so easy. So instead of reiterating the original question, let me ask a related question: What's a good way to cache a search (so the user can page-up/page-down)? Can we just $c-session( search_rs = $rs-search({%params}) ) I imagine that would take up a lot of space in the session record, but maybe that's not much of a consideration... ...or is there a straightforward way to serialize the search parameters? What's the consensus on this? On Tue, Sep 27, 2011 at 12:47 AM, Andrew Rodland and...@cleverdomain.orgwrote: On Mon, Sep 26, 2011 at 5:29 PM, Marius Olsthoorn olst...@gmail.comwrote: Hi, Consider using the query part of the URI to represent the search. Browsers are very good at bookmarking these :) What in the world is that supposed to mean? Are browsers *bad* at saving bookmarks for other kinds of URLs? ___ 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/ -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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: Trying out FormHandler, running into maketext error
Discovered something about FormHandler's form_generator.pl... The auto-generated FormHandler code (via *form_generator.pl*) creates submit buttons like this: has_field 'submit' = ( *widget* = '*submit*' ); but that leads to the original error undef error - Unable to do maketext on: at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15 Apparently it should generate the following code instead? has_field 'submit' = ( *type *= '*Submit*' ); That fixes the I18N errors, and it actually works to produce a submit button. (Note that type is used instead of widget and Submit is capitalized instead of submit.) Is this a canonical goof in form_generator.pl? Or is there something missing in my environment that's interfering? Note to googlers -- *form_generator.pl* is really * HTML::FormHandler::Generator::DBIC* On Fri, Nov 26, 2010 at 4:48 PM, Alexander Hartmaier alexander.hartma...@t-systems.at wrote: Exactly, because the widget class is HTML::FormHandler::Widget::Field::Submit and not HTML::FormHandler::Widget::Field::submit. -- Best regards, Alex On Tue, 2010-11-23 at 19:02 +0100, will trillich wrote: Not sure what your case sensitive remark refers to -- and if it's looking for something to be defined XXX that's defined xxx instead, that particular error message is really out of left field. Do you mean something like has_field 'submit' = ( widget = 'submit' ) should instead be has_field 'submit' = ( widget = 'Submit' ) with a capital S? The following is definitely working for us now: has_field 'submit' = (type = 'Submit', label = 'Submit', value='Submit', required = 0, ) On Tue, Nov 23, 2010 at 11:47 AM, Alexander Hartmaier alexander.hartma...@t-systems.at wrote: Perl is case sensitive. Also you should not have any non Catalyst::Controller subclasses in the Controller namespace of your app. Move you forms to My::App::Form for example. -- Best regards, Alex On Mon, 2010-11-22 at 18:25 +0100, will trillich wrote: Ooh, very nice! Thanks so much, that's lots better now. Woo hoo! Yes indeed, the undef error - Unable to do maketext on: at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. error has gone away thanks to tweaks to the SUBMIT button on the FormHandler definition. Was there something in the Catalyst/FormHanlder intro that we missed? On Mon, Nov 22, 2010 at 5:16 PM, Hernan Lopes hernanlo...@gmail.com wrote: will trillich, that error happens when i use has_field 'submit' = ( widget = 'submit' ) can you test your form with this instead: has_field 'submit' = (type = 'Submit', label = 'Submit', value='Submit', required = 0, ) i bet your error will go away On Mon, Nov 22, 2010 at 12:19 PM, will trillich will.trill...@serensoft.com wrote: Our form-class includes has_field 'submit' = ( widget = 'submit' ) Do you mean type='submit' instead of widget='submit'? Interesting that you'd think of this as a suspect. What's the rationale? On Mon, Nov 22, 2010 at 9:16 AM, Hernan Lopes hernanlo...@gmail.com wrote: will trilich, are you using widget type submit ? try to replace with type = 'Submit' Hernan Lopes On Mon, Nov 22, 2010 at 1:38 AM, John Anderson geneh...@genehack.org wrote: On Nov 21, 2010, at 10:26 PM, will trillich wrote: Pooh. Still no luck. When we try a more more Moose-y approach, we do get updated database records (stuffing the URL with arguments to affect a form-submit) but still
Re: [Catalyst] Re: superuser switch-user session function?
Mwa ha ha! It was $c-SET_AUTHENTICATED all along! This is how you switch-user/become-user/super-user inside Catalyst. Try this on for size: sub su : Chained('/is_admin') PathPart('su') Args(1) { my ( $self, $c, $id ) = @_; my $user_was = $c-user; my $user_is = $c-find_user({ id = $id }); # Do some error trapping of course... $c-*set_authenticated*( $user_is ); $c-stash( message = join ' ', 'Switched from',$user_was-name,'to',$user_is-name ); } Voila! Now $c-user is $user_is and no longer $user_was. Neat! Any bad carma expected here? This is so admin-types can help non-admin-types diagnose issues... On Tue, Nov 30, 2010 at 3:18 PM, Hernan Lopes hernanlo...@gmail.com wrote: Indeed, i think it should login as a new user not changing the actual session. maybe something like: admin clicks login as joeuseropen a new browser window as adminverify its admin and re-login as a new user. register on session user is admin so he can log back in. Then add button terminate session, close window and logout and log back in with adminfoologin on parent.window --Hernan On Tue, Nov 30, 2010 at 1:01 PM, Peter Karman pe...@peknet.com wrote: will trillich wrote on 11/29/2010 05:37 PM: Aha! It looks like a sneaky, evil, wrong, mean, horrid way to switch-user in the middle of a session is to $c-session-{__user}{id} = $new_id_here; # since id = PK But that's undoubtedly bad form of the worst kind. What's the canonical non-sneaky above-board friendly golden way to do this? I don't know that there is a canonical way. This is Perl. As I mentioned in my reply to this thread in July[0], one way is to login as the new user and store the original username in the new user's session. That way the app knows that the new user is allowed to revert to the original user, but otherwise the app treats the current session just as it would if the new user had logged in normally. [0] http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg09968.html -- Peter Karman . http://peknet.com/ . pe...@peknet.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/ ___ 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/ -- The very nucleus of Character: to do what you know you should do, when you don't want to do it. Stephen Covey ___ 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] live demos of catalyst apps
We're pretty happy with FuzeMeeting so far. Nice alternative to webex and gotomeeting. On Thu, Apr 28, 2011 at 11:20 AM, Mesdaq, Ali ames...@websense.com wrote: goToMeeting is great for interactive two way demo's and it's easy to pass control back and forth between different presenters. goToWebinar is also available if you want more of a one to many type of demo. goToMeeting is especially good for situations where the live demo of a site is unavailable publicly you can just give the user control of your whole screen or just one application and let them use the demo themselves and take control back at anytime. Thanks, ALI MESDAQ Sr. Security Researcher WEBSENSE, INC. ph: +1.858.320.9466 fax: +1.858.784.4466 www.websense.com Websense TRITON(tm) For Essential Information Protection(tm) Web Security | Data Security | Email Security -Original Message- From: ian.doche...@nomura.com [mailto:ian.doche...@nomura.com] Sent: Thursday, April 28, 2011 8:47 AM To: catalyst@lists.scsys.co.uk Subject: RE: [Catalyst] live demos of catalyst apps I have used gotomypc in the past for a one-on-one demo, ISTR they have something called goToMeeting which might also allow several people to see the demo. (Can't verify ATM since the site is blocked by our firewall policy). -Original Message- From: Fernan Aguero [mailto:fernan.agu...@gmail.com] Sent: 28 April 2011 15:58 To: The elegant MVC web framework Subject: [Catalyst] live demos of catalyst apps Hi, I was just wondering about this the other day. How do people showcase their apps to other people? Powerpoint presentations with screenshots? Recorded screencasts? Live demo of an app over screen sharing (VNC, webmeeting, elluminated, etc)? The first two are kind of OK, but static. The third is ideal for a live session, with interaction, questions from the end user (how do I do X?), which is always nice. However, for the 3rd option, there is this obstacle of having to pre-arrange things (VNC), fight against firewalls, contracting a 3rd party (webmeeting), etc. And I just came across a thought ... is there any easier way of making a live demo of an app? For example, typing and clicking on my screen is mirrored in someone else's browser, while talking on the phone or over skype? Is there any javascript cross-browser framework that would allow for this? Maybe together with some server-side code in the app to manage invitations/acceptance? Or am I just dreaming? -- fernan PS: now that I think more of it, maybe this would be like turning a catalyst app into a sort of google wave clone of its own ___ 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/ This e-mail (including any attachments) is confidential, may contain proprietary or privileged information and is intended for the named recipient(s) only. Unintended recipients are prohibited from taking action on the basis of information in this e-mail and must delete all copies. Nomura will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in, this e-mail. If verification is sought please request a hard copy. Any reference to the terms of executed transactions should be treated as preliminary only and subject to formal written confirmation by Nomura. Nomura reserves the right to monitor e-mail communications through its networks (in accordance with applicable laws). No confidentiality or privilege is waived or lost by Nomura by any mistransmission of this e-mail. Any reference to Nomura is a reference to any entity in the Nomura Holdings, Inc. group. Please read our Electronic Communications Legal Notice which forms part of this e-mail: http://www.Nomura.com/email_disclaimer.htm ___ 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/ brTo report this as spam, please forward to s...@websense.com. Thank you. Protected by Websense Email Security Gateway - www.websense.com Protected by Websense Hosted Email Security -- www.websense.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/ -- 11 cheers for binary! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive:
Re: [Catalyst] Caching SQL results for speed...?
On Wed, Apr 13, 2011 at 1:19 AM, Darren Duncan dar...@darrenduncan.netwrote: will trillich wrote: 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.) So, several 5000s (millions / 200) of calls for a single screen? That sounds like a lot for one screen. Do you need that much? -- Darren Duncan My question is similar -- why five thousand or more calls for rendering one page? The code does simple things like my $form = $self-form; # parse_form_for_numerics(): # change any $1,234 to 1234, parse 12-apr-09 to a date 2009-04-12, etc # and stuff results into $c-req-params parse_form_for_numerics( $c, $form ); my $processed = $form-process( item = $item, params = $c-req-params, ); if ( $form-has_errors) { ... } return unless $processed; # since we're testing rendering a fresh page there's no processing, that's it So why would this simple code generate 5,000+ calls to SQL::Abstract methods or to DBIx::Class::Resultset methods? Even commenting-out #parse_form_for_numerics() it's about the same. Still looking into this. -- 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/
[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/
[Catalyst] HTML::FormHandler performance issue in Catalyst app -- 50 seconds?!
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.) The code for the processing is basically as follows: $stats-profile(begin='get FORM'); my $form = $self-form; $stats-profile(end='get FORM'); my $params = $c-req-params; $stats-profile(begin='process FORM'); my $processed = $form-process( item = $item, params = $params, ); $stats-profile(end='process FORM'); System load for this (Linode) server was 0.04 or below during all our tests. There are 31 fields in this form relating to one table in the database; two of these forms are *many_to_many* with linking tables. Ideas? -- 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/
Re: [Catalyst] AutoCrud suggestions
We've had good success using InstantCRUDhttp://search.cpan.org/~zby/Catalyst-Example-InstantCRUD-0.038/lib/Catalyst/Example/InstantCRUD.pmto get a nice scaffolding set up. It gives you create/read/update/delete capability for all the tables in your database by pre-building a whole app structure for you. Then you can get in elbow-deep and tweak the code for your own needs. On Fri, Apr 1, 2011 at 12:19 PM, Mesdaq, Ali ames...@websense.com wrote: I am looking for suggestions of packages that do autocrud'ing. I have a very basic schema with 1 main table that I want to edit more than add anything to it. Ideally I would like to be able to filter based on various values and sort by values as well. I saw a bunch of packages that seemed like they can do this but before I go through each one and figure out which one is the best thought I would ask the group. ALI MESDAQ Sr. Security Researcher WEBSENSE, INC. ph: +1.858.320.9466 fax: +1.858.784.4466 www.websense.com Websense TRITON™ For Essential Information Protection™ Web Security | Data Security | Email Security Protected by Websense Hosted Email Security -- www.websense.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/ -- 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/
Re: [Catalyst] Requesting example code for postfix and Email::Sender
You're probably overthinking this. :) Whether it's postfix or exim or any other daemon really shouldn't matter. Your code will connect to SMTP server localhost on port 25. If you can send an email from the command line (via 'mutt' or 'mail' etc) then you should be ready to go: First $ *script/myapp_create.pl view Email Email* Then #myapp.conf View::Email stash_key= *email* default content_type = text/plain charset = utf-8 /default /View::Email Then in a controller... $c-stash-{*email*} = { from = $c-config-{email_from}, 'reply-to' = $c-user-email_name, to = $c-user-email_name, cc = join(',', @cc), subject= $subj, body = $message, }; $c-forward( $c-view('Email') ); Note on the manpage (below) that it will default to LOCALHOST and SMTP unless you specify otherwise http://search.cpan.org/~dhoss/Catalyst-View-Email-0.31/lib/Catalyst/View/Email.pm On Mon, Mar 21, 2011 at 6:17 PM, Kutbuddin Doctor ksdoc...@sanfordburnham.org wrote: I am looking for an example of how to configure catalyst to use postfix on localhost to send email (mostly application notifications) via catalyst. And especially example code from someone who has done this successfully. I have seen several recommendations for using Email::Sender with catalyst but no examples of how to do this with postfix running locally. All of the Transport examples are either SMTP or sendmail. The rest of Email::Sender::Transport CPAN documentation is very sparse. Thanks for the help! cheers, Kutbuddin -- ___ 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! ___ 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] Where are my modules?
If you did a force-install at some point in the past, e.g. to get Catalyst::Plugin::ConfigLoader installed, then you may have skipped some dependencies. Wiser folks than me can probably tell you how to get CPAN to recover to a more stable state, but it sounds like you'll have to follow the dependency chain by hand until then. That is, each missing module will require you to do a cpan Mod::Here to get it up to snuff. You may be doing this already, but if you use lib::local instead of your system perl libraries as root (or via sudo) then A) you won't break your system perl, 2) you won't need root permissions to update your library and 3) if the muses smile at you just right you might be able to migrate your whole cpan library to a new system when the time comes, with a simple file-copy. http://perl.jonallen.info/writing/articles/install-perl-modules-without-root Something we're running into is when Cpan module dependencies don't work out right, after migrating a project to a new system. Instead of being up and running in a matter of minutes (or hours if lots of compiling is needed) it's turning into a matter of days, sometimes weeks, to get all the dependencies straightened out. :( On Thu, Mar 17, 2011 at 4:24 AM, Carl Franks fireart...@gmail.com wrote: On 17 March 2011 09:06, John M. Dlugosz wxju46g...@snkmail.com wrote: Figure this out: perl Makefile.PL tells me I have 6 modules that need to be installed. E.g. - Catalyst::Plugin::ConfigLoader ...missing. - Catalyst::Plugin::Static::Simple ...missing. - Catalyst::Action::RenderView ...missing. However, $ cpan -i Catalyst::Plugin::ConfigLoader gives: CPAN: Storable loaded ok (v2.25) Going to read '/home/john/.cpan/Metadata' Database was generated on Wed, 16 Mar 2011 22:27:22 GMT CPAN: Module::CoreList loaded ok (v2.45) Catalyst::Plugin::ConfigLoader is up to date (0.30). On the other hand, $ perl -MCatalyst::Plugin::ConfigLoader gives: Undefined subroutine Data::Visitor::has called at /usr/local/share/perl/5.10.1/Data/Visitor.pm line 21. Compilation failed in require at /usr/local/share/perl/5.10.1/Data/Visitor/Callback.pm line 6. BEGIN failed--compilation aborted at /usr/local/share/perl/5.10.1/Data/Visitor/Callback.pm line 6. Compilation failed in require at /usr/local/share/perl/5.10.1/Catalyst/Plugin/ConfigLoader.pm line 8. BEGIN failed--compilation aborted at /usr/local/share/perl/5.10.1/Catalyst/Plugin/ConfigLoader.pm line 8. Compilation failed in require. BEGIN failed--compilation aborted. 'has' method is undefined? It looks like cpan installed it, though its dependancies didn't install cleanly. Makefile.PL fails to require() it, so thinks its not installed. Try installing Data::Visitor - and check cpan's output for errors. If that still doesn't work, force install the listed modules: cpan i -f Catalyst::Plugin::ConfigLoader I know in the past cpan would continue to install modules, even if their prereqs failed - I can't remember if this was fixed by a cpan upgrade or a cpan config setting. Carl ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Basic help with deployment
On Wed, Mar 16, 2011 at 4:21 AM, Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 da...@cpan.org wrote: I found that I need to run cpan -i Module as root This is not a good idea. Instead configure the cpan options `make_install_make_command` and `mbuild_install_build_command` to employ sudo. http://p3rl.org/CPAN#Config_Variables Does that mean that this 'make' step needs to be done as root? No, normally only the `make install` step of each dist needs elevated privileges. If distributions try to create directories in system locations during other steps, then this is a bug. Probably you've already run this as root (or via sudo) and paths have been created with root ownership. Your normal user isn't allowed to frob those. Our process is: - hg fetch = get latest from repository - script/*server.pl -d = test localhost:3000 - perl Makefile.PL make manifest = build into blib - make make test = confirm - sudo make install = let 'er rip We too had done sudo in the wrong spots a few times but a sudo make distclean made it all sparkly again. You can sidestep the difficulties coming from the need to install to system locations by using local::lib. http://p3rl.org/local::lib For a possible bootstrapping approach to getting your own private CPAN library up and running: http://search.cpan.org/~apeiron/local-lib-1.008004/lib/local/lib.pm#The_bootstrapping_technique You may need to download an older version of the library if you run into dependency-build errors tho. -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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: How to get uri_for something with a fragment?
Ah yes, I can see that now. Signal::noise was a bit low on this thread... :) Merci. On Wed, Mar 9, 2011 at 4:55 AM, Adam Sjøgren a...@koldfront.dk wrote: On Wed, 9 Mar 2011 00:36:32 -0600, will wrote: What would be helpful is either There's no mechanism within the Catalyst toolkit to generate urls with anchors, stick to Perl string concatenation or You can use this handy feature XYZ of the Catalyst toolkit to generate url strings with anchors [...] A fine answer was provided by Andrew Rodland in the very first follow up to the question: * http://article.gmane.org/gmane.comp.web.catalyst.general/26244 Catalyst doesn't need to specifically handle fragments because URI objects do so, and Catalyst returns those. Or, you can just concatenate, as AR also wrote. The rest of the thread is just us quibbling about the accuracy of another response :-) Best regards, Adam -- I always liked songs with parentheses in the title.Adam Sjøgren a...@koldfront.dk ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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: How to get uri_for something with a fragment?
I can't see that the original question has been answered. I'm interested as well... The manpage for $c-uri_for() at http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80032/lib/Catalyst.pm) talks about ?query=values but not about #anchors. Is there any facility via e.g. $c-uri_for() to generate a url-with-anchor? Or is it just a matter of tacking on a #anchor using perl concatenation? On Tue, Mar 8, 2011 at 8:37 PM, John M. Dlugosz wxju46g...@snkmail.comwrote: On 3/8/2011 10:27 AM, Ashley Pond V apv-at-sedition.com |Catalyst/Allow to home| wrote: Well, the original message was: How do I call uri_for_action and pass it the '#id' part? It's not an arg and it's not part of the query string. This is called the fragment identifier in the final URL. uri_for_action makes it implicit that he was seeking a server side use of the fragment. -Ashley I just wanted the page that contained the item I knew was on it, without hard-coding the URL like the good people on this list taught me. I know the browser takes care of jumping to that spot on the page. --John ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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: How to get uri_for something with a fragment?
What would be helpful is either There's no mechanism within the Catalyst toolkit to generate urls with anchors, stick to Perl string concatenation or You can use this handy feature XYZ of the Catalyst toolkit to generate url strings with anchors not Browsers handle the anchors so don't try to generate anchors in your server code. On Wed, Mar 9, 2011 at 12:25 AM, Julien Sobrier jul...@sobrier.net wrote: The fragment is not sent to the server by the client: http://tools.ietf.org/html/rfc3986#section-3.5 http://en.wikipedia.org/wiki/URL_fragment The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the server. So any server-side property/method will not be able to show the fragment. This is not specific to Catalyst. Julien On Tue, Mar 8, 2011 at 10:11 PM, will trillich will.trill...@serensoft.com wrote: I can't see that the original question has been answered. I'm interested as well... The manpage for $c-uri_for() at http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80032/lib/Catalyst.pm ) talks about ?query=values but not about #anchors. Is there any facility via e.g. $c-uri_for() to generate a url-with-anchor? Or is it just a matter of tacking on a #anchor using perl concatenation? On Tue, Mar 8, 2011 at 8:37 PM, John M. Dlugosz wxju46g...@snkmail.com wrote: On 3/8/2011 10:27 AM, Ashley Pond V apv-at-sedition.com |Catalyst/Allow to home| wrote: Well, the original message was: How do I call uri_for_action and pass it the '#id' part? It's not an arg and it's not part of the query string. This is called the fragment identifier in the final URL. uri_for_action makes it implicit that he was seeking a server side use of the fragment. -Ashley I just wanted the page that contained the item I knew was on it, without hard-coding the URL like the good people on this list taught me. I know the browser takes care of jumping to that spot on the page. --John ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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?
/lurk I tried installing Padre on my OSX using the instructions here http://padre.perlide.org/trac/wiki/DownloadMacOSX and now my wxperl is broken: $ wxperl *wxPerl: posix_spawn: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/Wx/wxPerl.app/Contents/MacOS/wxPerl5.10.0: No such file or directory* I think the point where it went south was in cpan install Wx. Fortunately my unix-y perl (perl) is still fine. Is there an easy way to unravel this? On Wed, Mar 2, 2011 at 11:49 AM, Kieren Diment dim...@gmail.com wrote: On 02/03/2011, at 10:10 PM, John M. Dlugosz wrote: What's a good text editor to use for Catalyst/TT development? The editor I really like for C++ doesn't handle XML well. I've been using Notepad++ for windows, but the syntax highlighting doesn't understand mixing TT inside the base language, and it has tabs only instead of multiple visible windows. I would entertain both Windows and Linux solutions. Padre: http://padre.perlide.org/ is rated by some. Works everywhere Wx does. TIA, --John ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Cache of unchanging content
Here's our current dev-to-deploy approach -- we use mercurial and a three-step staging process: A) sandbox/dev server: dev-server$ vi lib/*/blah/yadda dev-server$ CATALYST_DEBUG=1 script/*_server.pl test dev-server:3000 plenty -- lots of iterating, and then prep for deploy-testing: dev-server$ hg addremove dev-server$ perl Makefile.PL dev-server$ make manifest dev-server$ hg ci -m log message here now, on deployment server: B) live environment, sandbox port 3000: deploy$ hg fetch deploy$ CATALYST_DEBUG=0 script/*_server.pl now we test deploy:3000 and if all is well... C) full live deployment: deploy$ perl Makefile.PL make deploy$ sudo make install sudo apache2ctl graceful Pretty sweet so far! On Wed, Mar 2, 2011 at 5:24 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 2 Mar 2011, at 05:43, John M. Dlugosz wrote: On 3/1/2011 9:58 AM, Bill Moseley moseley-at-hank.org |Catalyst/Allow to home| wrote: At build time I minimize and compress css and js (and images) and combine into single files grouped by page(s). They could be pre-processed by TT very easily. The final file names include an MD5 of their content forcing a re-fetch only if they ever change. So you added that to the makefile somehow? I take it the generated name must be supplied to the page's template once it is known. I'd like to learn more about your system. Yes, you can append things to the Makefile to So if you make a small change, you have to re-install the whole app? If the file name changes, I can't just use Unison to sync the directory on the production server. Yes! Installing to production servers via rsync / unison is insane, as there is exactly no way of knowing what version the production server is on, with what bugs... Which means that all bug reports become useless - as you never know if the user was using the site before or after you fixed (or, more often, you think you fixed, but didn't really fix a bug).. 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Cache of unchanging content
On Wed, Mar 2, 2011 at 5:35 PM, will trillich will.trill...@serensoft.comwrote: Here's our current dev-to-deploy approach -- we use mercurial and a three-step staging process: A) sandbox/dev server: dev-server$ vi lib/*/blah/yadda dev-server$ CATALYST_DEBUG=1 script/*_server.pl test dev-server:3000 plenty -- lots of iterating, and then prep for deploy-testing: dev-server$ hg addremove dev-server$ perl Makefile.PL dev-server$ make manifest dev-server$ hg ci -m log message here now, on deployment server: B) live environment, sandbox port 3000: deploy$ hg fetch deploy$ CATALYST_DEBUG=0 script/*_server.pl Quick edit, that last command above is actually deploy$ *CATALYST_DEBUG=0 sudo -u www-data perl script/*_server.pl* to make sure we're using the standard webserver user-permissions now we test deploy:3000 and if all is well... C) full live deployment: deploy$ perl Makefile.PL make deploy$ sudo make install sudo apache2ctl graceful Pretty sweet so far! On Wed, Mar 2, 2011 at 5:24 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 2 Mar 2011, at 05:43, John M. Dlugosz wrote: On 3/1/2011 9:58 AM, Bill Moseley moseley-at-hank.org |Catalyst/Allow to home| wrote: At build time I minimize and compress css and js (and images) and combine into single files grouped by page(s). They could be pre-processed by TT very easily. The final file names include an MD5 of their content forcing a re-fetch only if they ever change. So you added that to the makefile somehow? I take it the generated name must be supplied to the page's template once it is known. I'd like to learn more about your system. Yes, you can append things to the Makefile to So if you make a small change, you have to re-install the whole app? If the file name changes, I can't just use Unison to sync the directory on the production server. Yes! Installing to production servers via rsync / unison is insane, as there is exactly no way of knowing what version the production server is on, with what bugs... Which means that all bug reports become useless - as you never know if the user was using the site before or after you fixed (or, more often, you think you fixed, but didn't really fix a bug).. 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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?
Sure, forward away. I wish I'd taken better notes, or at least run tee to capture the results. :( Judging by the timestamps, this happened on 13 January 2011, so my recollection is going to be a bit fuzzy. Whatever version was current at that time, I was trying these instructionshttp://padre.perlide.org/trac/wiki/DownloadMacOSX : 1. $ wxPerl -MCPAN -eshell 2. [cpan] $ install Alien::wxWidgets [choose install from source, which is NOT the default] 3. Go do something else while it compiles wxWidgets. 4. [cpan] $ install Wx 5. [cpan] $ install Padre I'm pretty sure (80%ish) it crapped out at step 3. On Wed, Mar 2, 2011 at 7:25 PM, Charlie Gonzalez itchar...@gmail.comwrote: Will, I think this is a good bug to report to the Padre Developers. I follow the padre-...@perlide.org mailing list and I know that Padre lacks testing in a MacOS environment. Do you mind if I forward this email to the Padre Developers? If you give the ok can you tell me what version of Padre you were attempting to install and your version of Perl in your Mac. Thanks, Charlie G On 3/2/11, will trillich will.trill...@serensoft.com wrote: /lurk I tried installing Padre on my OSX using the instructions here http://padre.perlide.org/trac/wiki/DownloadMacOSX and now my wxperl is broken: $ wxperl *wxPerl: posix_spawn: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/Wx/wxPerl.app/Contents/MacOS/wxPerl5.10.0: No such file or directory* I think the point where it went south was in cpan install Wx. Fortunately my unix-y perl (perl) is still fine. Is there an easy way to unravel this? On Wed, Mar 2, 2011 at 11:49 AM, Kieren Diment dim...@gmail.com wrote: On 02/03/2011, at 10:10 PM, John M. Dlugosz wrote: What's a good text editor to use for Catalyst/TT development? The editor I really like for C++ doesn't handle XML well. I've been using Notepad++ for windows, but the syntax highlighting doesn't understand mixing TT inside the base language, and it has tabs only instead of multiple visible windows. I would entertain both Windows and Linux solutions. Padre: http://padre.perlide.org/ is rated by some. Works everywhere Wx does. TIA, --John ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Cache of unchanging content
Also see http://wiki.catalystframework.org/wiki/adventcalendararticles/2007/11-Making_your_Catalyst_App_Cache-friendly for a neat approach to setting browser-cache expiry info. On Tue, Mar 1, 2011 at 5:49 AM, John M. Dlugosz wxju46g...@snkmail.comwrote: That's only part of it. It should also answer status 304, and set headers to tell the client not to even bother asking again any time soon. On 3/1/2011 4:45 AM, Jorge Gonzalez jorge.gonzalez-at-daikon.es|Catalyst/Allow to home| wrote: So what you need then is a templating system which caches the generated content from the templates and then when asked for it again later, it checks if the template has been changed, and if it hasn't (so the content generated will be the same if executed), answer the browser with a Content not changed instead of sending the content. Looks like you might need Template::Plugin::Cache: http://search.cpan.org/~perrin/Template-Plugin-Cache-0.13/Cache.pm http://search.cpan.org/%7Eperrin/Template-Plugin-Cache-0.13/Cache.pm http://search.cpan.org/%7Eperrin/Template-Plugin-Cache-0.13/Cache.pm Specially interesting the Any gotchas... section of the docs :-) Regards J. */Jorge González Villalonga/* Director Técnico */DAIKON Integración y Desarrollo S.L./* Telf: (+34) 91 188 08 28 Fax: (+34) 91 632 65 42 *www.daikon.es* El 01/03/11 10:23, John M. Dlugosz escribió: Say I want to use TT in the .css, so (for example) I can name my colors and other repeated content easily. I'm assuming that I can define a Path of some kind on a rule to serve those. Any recipes to share? More critically, I want the browser to know that it doesn't have to keep re-fetching it on every view of every page. How would I manage that? ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Details of config options
Doesn't it depend on which __PACKAGE__ you're in? On Mon, Feb 28, 2011 at 7:33 AM, Charlie Garrison garri...@zeta.org.auwrote: Good morning, On 28/02/11 at 7:10 AM -0600, John M. Dlugosz wxju46g...@snkmail.com wrote: A module documented to put Plugin::SmartURI disposition hostless /Plugin::SmartURI in the myapp.conf file. But, what is the equivalent __PACKAGE__-config( syntax for the MyApp.pm file? I can't find documentation on how the names are mapped, and I've even seen different syntax in different guides. What's the correct rule? I think you're looking for this: __PACKAGE__-config( 'Plugin::SmartURI' = { disposition = 'hostless' }, ); Charlie -- Ꮚ Charlie Garrison ♊ garri...@zeta.org.au O ascii ribbon campaign - stop html mail - www.asciiribbon.org 〠 http://www.ietf.org/rfc/rfc1855.txt ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Root page for site (my first attempt!)
In your main lib/MyApp.pm file you'll probably notice you've got a line of code like use Catalyst qw/ ... Static::Simple .../; That pulls in Catalyst::Plugin::Static::Simple which does the part you're asking about. See http://search.cpan.org/~mstrout/Catalyst-Plugin-Static-Simple-0.29/lib/Catalyst/Plugin/Static/Simple.pm for tricks on configuring it to do your bidding. Also, when running under a webserver such as Apache, you'd likely do some configuring there to have the webserver send the static files directly instead of calling on Catalyst to parse through them. E.g. http://search.cpan.org/dist/Catalyst-Runtime/lib/Catalyst/Engine/FastCGI.pm#Static_mode On Wed, Feb 23, 2011 at 7:21 PM, John M. Dlugosz wxju46g...@snkmail.comwrote: On 2/23/2011 6:26 AM, Octavian Rasnita orasnita-at-gmail.com|Catalyst/Allow to home| wrote: But you can create one or more directory with static files, for example /images, /js, /css. These directories must be created under the root directory. And of course, it is recommended to configure the web server to not send the requests to those directories to the Catalyst app. That's exactly what I want. How do I tell Catalyst that /images should be static files under /root/images, rather than a controller named Images? And as Carl recommended, it is good to not hard-code the URLS in the templates because they won't work if you'll want to make some changes and want to put the whole application to listen to a different base than /, for example /old-site. So use $c-uri_for('/path/to/static/file'); or $c-uri_for_action('/path/to/action'); #for the dynamic pages I see, so do that for static files too, not just actions? ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Making secure session cookies (or, how do we make Explorer stop complaining about nonsecure content on a secure page?)
Nope it's not the javascript. Searching view-source for http://; shows only DOCTYPE, xmlns, !-- comments -- and links to other/external websites. The session cookie does show as non-secure, so that's why we're thinking it's the main culprit. Otherwise, is there a tool out there that helps discover what Explorer is griping about when it says this page contains both secure and nonsecure items...? On Mon, Feb 21, 2011 at 12:08 AM, Jason Galea li...@eightdegrees.com.auwrote: you're not using a non-ssl cdn for your javascript libraries? (had me searching once..) On Mon, Feb 21, 2011 at 1:32 PM, will trillich will.trill...@serensoft.com wrote: Catalyst::Plugin::Session::State::Cookie shows how to make a secure cookie, which is great when you're rolling cookies by hand in your code. But how do you set a secure cookie in the context of a myapp.conf setup? session flash_to_stash = 1 dbic_class = MyApp::Session expires= 3600 cookie_secure = 1 # just kidding /session That's not doing the trick. Which doc reveals the right mojo? === This is in pursuit of stopping the Explorer error This page contains both secure and nonsecure items... Other than the doctype and the html xmlns= attribute, we can't find any http:// references, even looking in css @import and url() ... so the next culprit seems to be the nonsecure cookie. Other guidance is more than welcome! -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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/ -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Making secure session cookies (or, how do we make Explorer stop complaining about nonsecure content on a secure page?)
Thanks for the cookie back-story, Carl. We're looking into a firefoxy diagnosis. On Mon, Feb 21, 2011 at 9:15 AM, Carl Franks fireart...@gmail.com wrote: On 21 February 2011 14:09, will trillich will.trill...@serensoft.com wrote: Nope it's not the javascript. Searching view-source for http://; shows only DOCTYPE, xmlns, !-- comments -- and links to other/external websites. The session cookie does show as non-secure, so that's why we're thinking it's the main culprit. Otherwise, is there a tool out there that helps discover what Explorer is griping about when it says this page contains both secure and nonsecure items...? Hi, It shouldn't matter that it's not a secure cookie - that's just a flag that tells the browser it shouldn't send the cookie back to the same domain on any non-SSL requests. Cookies are sent as part of a request/response for a URL - so it's a URL that's the problem, not a cookie. I recommend you try viewing the page in a browser that will let you see all network requests - e.g. firefox with the firebug plugin running. Carl ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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: Making secure session cookies (or, how do we make Explorer stop complaining about nonsecure content on a secure page?)
Okay -- we'd tried this approach using Chrome already, and it is not showing *any* http:// requests from the https:// page. Life HTTP Headers (FireFox) shows either https://server.name/path requests or server-relative /path requests. Period. Same url, yet internet explorer complains... I've got a knack for finding weird stuff like this. Anybody else seen this? On Mon, Feb 21, 2011 at 3:38 PM, Adam Sjøgren a...@koldfront.dk wrote: On Mon, 21 Feb 2011 15:15:17 +, Carl wrote: I recommend you try viewing the page in a browser that will let you see all network requests - e.g. firefox with the firebug plugin running. Another nice tool is included in Chrom{e,ium} under Tools → Developer Tools, where - if you load an https-page, you get a little warning-sign and a number in the bottom-right corner, which, when clicked, pops up a list showing exactly what Chrome{e,ium} fetched that was insecure. Example screenshot: * http://koldfront.dk/misc/browsers/chromium-insecure-content.png Best regards, Adam -- Examination and mastering of a new highly Adam Sjøgren intellectual equipment was a hard labour. a...@koldfront.dk ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Making secure session cookies (or, how do we make Explorer stop complaining about nonsecure content on a secure page?)
Catalyst::Plugin::Session::State::Cookie shows how to make a secure cookie, which is great when you're rolling cookies by hand in your code. But how do you set a secure cookie in the context of a myapp.conf setup? session flash_to_stash = 1 dbic_class = MyApp::Session expires= 3600 cookie_secure = 1 # just kidding /session That's not doing the trick. Which doc reveals the right mojo? === This is in pursuit of stopping the Explorer error This page contains both secure and nonsecure items... Other than the doctype and the html xmlns= attribute, we can't find any http:// references, even looking in css @import and url() ... so the next culprit seems to be the nonsecure cookie. Other guidance is more than welcome! -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Sanity Check -- requesting feedback on chaining approach
Okay, so there's a link in a web page that the browser sees that tells it when following *this* link, ask for a CSV file, as opposed to that normal HTML hooey you usually ask for. How do we do that, if not thru a URL? Or maybe I'm missing something really obvious... On Thu, Feb 17, 2011 at 9:36 AM, Dave Rolsky auta...@urth.org wrote: On Wed, 16 Feb 2011, will trillich wrote: Hmm. Curious about the inline comment there -- how do you do CSV based on accept-header? You look for an Accept header that specifies text/csv (or whatever the content type is) vs text/html. Or, if you're using a regular browser, you use a hack where you put something like content-type=text/csv in the query string. Catalyst::Action::REST provides basically everything you need to make this all work. -dave /* http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) */ ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Sanity Check -- requesting feedback on chaining approach
On Tue, Feb 15, 2011 at 10:28 PM, Eden Cardim edencar...@gmail.com wrote: will == will trillich will.trill...@serensoft.com writes: will package MyApp::Controller::Xyzzy; will sub base : Chained PathPart('xyzzy') CaptureArgs(0) { } will sub list : Chained('base') PathPart('') CaptureArgs(0) { } will sub page : Chained('list') PathPart('') Args(0) { } will sub csv : Chained('list') PathPart('csv') Args(0) { } will sub item : Chained('base') PathPart('') CaptureArgs(1) { } will sub view : Chained('item') PathPart('') Args(0) { } Yes, this will work: # in list() $c-stash-{rs} = $c-model('Foo')-search({%params}); # in page() $c-stash-{paged_rs} = $c-stash-{rs}-search({}, {page = $p, rows = $r}); ...if that's what you're asking. Other interesting things you can do: sub add_item :Chained('list') PathPart('add') Args(0) { my($self, $c) = @_; $c-stash-{rs}-create({ %more_params }) } sub related_items :Chained('list') PathPart('related') CaptureArgs(0) { my($self, $c) = @_; $c-stash-{rs} = $c-stash-{rs}-related_resultset(''); } sub related_page :Chained('related_items') PathPart('page') Args(0) { my($self, $c) = @_; $c-forward('page'); } sub related_csv :Chained('related_items') PathPart('csv') Args(0) { my($self, $c) = @_; $c-forward('csv'); } Assuming %params in list() was a simple key/value map, add_items() is going to use those, in addition to whatever's in %more_params, which is cool because if you change the criteria in list(), it propagates everywhere else as well. Plus, you reuse the page/csv implementation easily. The combination of chained DBIC resultsets and catalyst chains is very similar to curried functions (I believe that's what the initial design goal was). Excellent.* Catalyst chaining is awesome. Especially *related_items*, very sweet. The next question is, what's an elegant way to separate pager-params from search-params? Page-params are always query_params, and search-params are *usually* body_params ...but not always. What we're trying now is having page-params be one letter: r=rows, p=page, o=order. A database field should be far more descriptive than a single character, so that's our line in the sand. Or should we just *$param = delete( $c-req-params-{$key} )* to prevent double-handling? Are there best-practices out there for this? == *...except our search-form is different from our entry-form. For example, we let the user choose a range of dates which asks for two values (closed_begin to closed_end) to search for a value in a single field (closed). -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Sanity Check -- requesting feedback on chaining approach
On Wed, Feb 16, 2011 at 11:08 AM, Dave Rolsky auta...@urth.org wrote: On Tue, 15 Feb 2011, will trillich wrote: package MyApp::Controller::Xyzzy; sub _set_xyzzy : Chained PathPart('xyzzy') CaptureArgs(0) { } sub list : Chained('_set_xyzzy') PathPart('') Args(0){ } # CSV dispatch based on Accept header, not URI! sub _set_item : Chained('_set_xyzzy') PathPart('') CaptureArgs(1) { } sub item : Chained('item') PathPart('') Args(0){ } Hmm. Curious about the inline comment there -- how do you do CSV based on accept-header? -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Sanity Check -- requesting feedback on chaining approach
Catalystas -- this chaining stuff is wicked awesome. We've been following the below paradigm for the most part, and now we want to expand a bit: package MyApp::Controller::Xyzzy; sub base : Chained PathPart('xyzzy') CaptureArgs(0) { } sub list : Chained('base') PathPart('') Args(0) { } sub item : Chained('base') PathPart('') CaptureArgs(1) { } sub view : Chained('item') PathPart('') Args(0) { } The two new nodes we want to insert are for csv-download (delivering all records) and paging (delivering a subset). Here's what we're thinking: package MyApp::Controller::Xyzzy; sub base : Chained PathPart('xyzzy') CaptureArgs(0) { } sub list : Chained('base') PathPart('') *Capture*Args(0) { } *sub page : Chained('list') PathPart('') Args(0) { } sub csv : Chained('list') PathPart('csv') Args(0) { } * sub item : Chained('base') PathPart('') CaptureArgs(1) { } sub view : Chained('item') PathPart('') Args(0) { } Here the index view would come from *page*() instead of directly from *list*(). *csv*() would download resultset-search-({%params})-all whereas *page*() would resultset-search({%params},{page=$p,rows=$r}). So any search parameters would be handled inside list() and then paging parameters would be handled separately inside page(). Right? Is there an elegant way to separate the two sets of parameters? Does this seem like a best practice? Comments welcome. -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Question about workflow to handle multiple 'submit' buttons on one form
Catalystry: We have a ticketing system where the managers can add new data and update the form. This uses a normal submit button. But now and then they want to close an incident, so we have a save-and-close submit button as well. One form, two ways to submit. So there's a second page where they fill out some finalization options (with the original data in hidden fields) and there they have a final submit button for the purpose. And they should be able to use their browser's back button to get back to the edit form. What's the elegant way to handle this in Catalyst? The problem we're wrestling with is that the edit action should have a URL distinct from the close action so that the user can hit the back button if need be. /item/# = view item /item/#/edit = edit form /item/#/close = confirm-close form We're using HTML::FormHandler and DBIC. And the solution shouldn't rely on javascript. All pointers welcome! -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Question about workflow to handle multiple 'submit' buttons on one form
Dang, this is really quite spiffy. Thanks for the idea! On Mon, Feb 7, 2011 at 1:42 PM, Francisco Obispo fobi...@isc.org wrote: Well, what I would do, is keep the underlying 'save' and 'close' methods as private: sub save : Private { my ($self,$c)=@_; # your save code goes here } sub close : Private { my ($self,$c)=@_; # your close code goes here } That way you could have: sub action : Local { my ($self,$c)=@_; $c-forward('save'); $c-forward('close') if $c-request-param(close); # or something } Francisco On Feb 7, 2011, at 11:29 AM, Len Jaffe wrote: On Mon, Feb 7, 2011 at 11:41 AM, will trillich will.trill...@serensoft.com wrote: Catalystry: So there's a second page where they fill out some finalization options (with the original data in hidden fields) and there they have a final submit button for the purpose. And they should be able to use their browser's back button to get back to the edit form. The problem we're wrestling with is that the edit action should have a URL distinct from the close action so that the user can hit the back button if need be. /item/# = view item /item/#/edit = edit form /item/#/close = confirm-close form Nah. I wouldn't have two URLs. I'd have one URL, and determine whether to save or save+close based on the value of the submit button. Furthernore, after a successful submit (assuming http POST) I'd redirect the user to a new display page via GET so that they can hit the refresh button all the like without attempting to repost the submission. Len. -- lenja...@jaffesystems.com 614-404-4214 Asst. Scoutmaster Troop 156 - www.bsatroop156.org - webmas...@bsatroop156.org Proprietor: http://www.theycomewithcheese.com/ - An Homage to Fromage ___ 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/ Francisco Obispo Hosted@ Programme Manager email: fobi...@isc.org Phone: +1 650 423 1374 || INOC-DBA *3557* NOC Key fingerprint = 532F 84EB 06B4 3806 D5FA 09C6 463E 614E B38D B1BE ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Suddenly Failing with Moose and MOP Errors
Don't know about this specific problem, but we just ran into something similar -- no upgrades, no changes, but Catalyst suddenly stopped loading (DBIx::Class::Schema::connection(): No arguments to load_classes). Wound up having to cpanm a bunch of upgrades by hand before it started working again. So apparently our system either is configured for occasional cron-based upgrades and we managed to wind up in an unstable state as a result (still looking into this)... or black hats were involved. You might be in a similar situation. :( On Mon, Jan 31, 2011 at 6:34 AM, Eric Berg eb...@bergbrains.com wrote: I have reverted to previously-known working versions and am having the same problem. Any help that anyone can provide would most certainly be appreciated. This sucks. It's kind of ridiculous too. Thanks. Eric On 1/30/2011 8:34 PM, Eric Berg wrote: All of a sudden my application stopped working and started spewing these errors. This same code has been running for many days, then kblam! Suddenly died. I've been looking and I can't seem to figure out what's going on. I suspect that it was an underlying Perl module that somehow blew up, but I'm not sure. Can anyone see anything in here that indicates what the problem is? Thanks. Eric Couldn't load class (GLR) because: Couldn't instantiate component GLR::Model::DB, Couldn't load class (GLR::Schema) because: Can't call method isa on an undefined value at /usr/local/share/perl/5.10.0/MooseX/NonMoose/Meta/Role/Class.pm line 40. Compilation failed in require at /usr/local/lib/perl/5.10.0/Class/MOP.pm line 114. at /usr/local/lib/perl/5.10.0/Class/MOP.pm line 120 Class::MOP::__ANON__('Can\'t call method isa on an undefined value at /usr/local/...') called at /usr/local/share/perl/5.10.0/Try/Tiny.pm line 100 Try::Tiny::try('CODE(0xba03570)', 'Try::Tiny::Catch=REF(0xb9f52b8)') called at /usr/local/lib/perl/5.10.0/Class/MOP.pm line 125 Class::MOP::load_first_existing_class('GLR::Schema') called at /usr/local/lib/perl/5.10.0/Class/MOP.pm line 137 Class::MOP::load_class('GLR::Schema') called at /usr/local/share/perl/5.10.0/Catalyst/Model/DBIC/Schema/Types.pm line 21 Catalyst::Model::DBIC::Schema::Types::__ANON__('GLR::Schema') called at /usr/local/lib/perl/5.10.0/Moose/Meta/TypeCoercion.pm line 63 Moose::Meta::TypeCoercion::__ANON__('GLR::Schema') called at /usr/local/lib/perl/5.10.0/Moose/Meta/TypeCoercion.pm line 97 Moose::Meta::TypeCoercion::coerce('Moose::Meta::TypeCoercion=HASH(0xae9a500)', 'GLR::Schema') called at /usr/local/lib/perl/5.10.0/Moose/Meta/TypeConstraint.pm line 90 Moose::Meta::TypeConstraint::coerce('Moose::Meta::TypeConstraint=HASH(0xae8fb38)', 'GLR::Schema') called at /usr/local/share/perl/5.10.0/MooseX/Types/TypeDecorator.pm line 206 eval {...} called at /usr/local/share/perl/5.10.0/MooseX/Types/TypeDecorator.pm line 205 MooseX::Types::TypeDecorator::AUTOLOAD('MooseX::Types::TypeDecorator=HASH(0xaea7520)', 'GLR::Schema') called at /usr/local/lib/perl/5.10.0/Moose/Meta/Attribute.pm line 880 Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0xaecb070)', 'GLR::Schema', 'GLR::Model::DB=HASH(0xb9b20a0)') called at /usr/local/lib/perl/5.10.0/Moose/Meta/Attribute.pm line 483 Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0xaecb070)', 'Moose::Meta::Instance=HASH(0xba1d3d0)', 'GLR::Model::DB=HASH(0xb9b20a0)', 'HASH(0xb9a4a90)') called at /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm line 603 Class::MOP::Class::_construct_instance('Moose::Meta::Class=HASH(0xadfb790)', 'HASH(0xb9a4a90)') called at /usr/local/lib/perl/5.10.0/Class/MOP/Class.pm line 576 Class::MOP::Class::new_object('Moose::Meta::Class=HASH(0xadfb790)', 'HASH(0xb9a4a90)') called at /usr/local/lib/perl/5.10.0/Moose/Meta/Class.pm line 256 Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0xadfb790)', 'HASH(0xb9a4a90)') called at /usr/local/lib/perl/5.10.0/Moose/Object.pm line 26 Moose::Object::new('GLR::Model::DB', 'GLR', 'HASH(0xaebe148)') called at generated method (unknown origin) line 3 Catalyst::Model::DBIC::Schema::new('GLR::Model::DB', 'GLR', 'HASH(0xaebe148)') called at /usr/local/share/perl/5.10.0/MooseX/Traits/Pluggable.pm line 139 MooseX::Traits::Pluggable::_build_instance_with_traits('GLR::Model::DB', 'GLR::Model::DB', 'GLR') called at /usr/local/share/perl/5.10.0/MooseX/Traits/Pluggable.pm line 97 MooseX::Traits::Pluggable::new_with_traits('GLR::Model::DB', 'GLR', 'HASH(0xb9a4b60)') called at /usr/local/share/perl/5.10.0/CatalystX/Component/Traits.pm line 145 CatalystX::Component::Traits::COMPONENT('GLR::Model::DB', 'GLR', 'HASH(0xb9a4900)') called at /usr/local/lib/perl/5.10.0/Class/MOP/Method/Wrapped.pm line 48 Class::MOP::Method::Wrapped::__ANON__('GLR::Model::DB', 'GLR', 'HASH(0xb9a4900)') called at /usr/local/lib/perl/5.10.0/Class/MOP/Method/Wrapped.pm line 89
Re: [Catalyst] Suddenly Failing with Moose and MOP Errors
$ uname -a Linux gonzo 2.6.32.12 #1 SMP Wed Apr 28 19:25:11 UTC 2010 i686 GNU/Linux $ cat /etc/debian_version 5.0.8 We wound up using cpanm to manually install/upgrade Moose, MooseX::Role::WithOverloading, DBIx::Class, Catalyst::Plugin::ConfigLoader, Catalyst. $ perl -MCatalyst -e 'print $Catalyst::VERSION,\n' 5.80030 On Mon, Jan 31, 2011 at 1:37 PM, Peter Edwards pe...@dragonstaff.co.ukwrote: On 31 January 2011 13:22, will trillich will.trill...@serensoft.comwrote: Don't know about this specific problem, but we just ran into something similar -- no upgrades, no changes, but Catalyst suddenly stopped loading (DBIx::Class::Schema::connection(): No arguments to load_classes). Wound up having to cpanm a bunch of upgrades by hand before it started working again. So apparently our system either is configured for occasional cron-based upgrades and we managed to wind up in an unstable state as a result (still looking into this)... or black hats were involved. Which operating system and version are you running? Regards, Peter -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Saving redirect URL in flash not sticking through login process
The flash is moved to the stash after the redirect, and then it's gone after that, right? What we do is stuff the intended destination into the session and then pull it from there: sub login : Chained('/') PathPart('login') Args(0) { my ( $self, $c ) = @_; my $form = Spill::Form::Login-new( action = $c-uri_for('/login') ); $c-stash( template = 'login.tt2', form = $form, ); if ( $c-action ne 'login' ) { # Stuff destination into session for later redirect if user authenticates *$c-session-{redirect} = $c-req-uri-as_string;* } ...then, later, after authenticating... my $go = *delete( $c-session-{redirect} )* || $c-req-headers-referer; $go = '/' if $go =~ /\blog(in|out)\b/; $c-res-redirect( $go ); $c-detach; On Sun, Jan 23, 2011 at 8:27 PM, Eric Berg eb...@bergbrains.com wrote: If a user submits a certain form without being logged in, I flash the current URL, save the params in the session, and redirect them to the login. In my Login controller, I look for $c-flash-{redirect_url} and redirect them back to that URL. The problem is that that flash entry is gone after the user submits the login form. I logged out the redirect URL at the beginning of my login routine and it comes through the first time, but even if I don't access it via the log statement, that redirect_url key is not there in the flash when the user submits the login form with their credentials. I've tried resetting $c-flash-{redirect_url} in the login routine and also tried $c-keep_flash( qw( redirect_url )) in the login routine, but no go. Any thoughts on what I might be doing wrong? Eric ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Saving redirect URL in flash not sticking through login process
I think stash is the ephemeral one-shot hashref, whereas flash is the next-request's preloaded stash. That is, you can load up your flash with whatever you need, and then do a full $c-res-redirect() somewhere -- which fires off a browser redirect and a new request -- and your then-stash will have all the goodies you plopped in there. And, being the stash, it's all wiped out when the request is done. So a follow-up request (or redirect) would either have an empty stash, or it'd require the second request-handling routines to stuff things into flash (again). So it's not that flash is permanent, it's not. It's just a pre-load for the next-request's short-lived stash. On Sun, Jan 23, 2011 at 10:58 PM, Eric Berg eb...@bergbrains.com wrote: Thanks, Will. That I figured that would work, but I thought that the flash was the right way to do it -- especially with the automatic cleanup, so I was holding off on trying that. Why doesn't flash work across these multiple requests? I thought that was the whole idea of flash vs. stash. Eric On 1/23/11 11:52 PM, will trillich wrote: The flash is moved to the stash after the redirect, and then it's gone after that, right? What we do is stuff the intended destination into the session and then pull it from there: sub login : Chained('/') PathPart('login') Args(0) { my ( $self, $c ) = @_; my $form = Spill::Form::Login-new( action = $c-uri_for('/login') ); $c-stash( template = 'login.tt2', form = $form, ); if ( $c-action ne 'login' ) { # Stuff destination into session for later redirect if user authenticates *$c-session-{redirect} = $c-req-uri-as_string;* } ...then, later, after authenticating... my $go = *delete( $c-session-{redirect} )* || $c-req-headers-referer; $go = '/' if $go =~ /\blog(in|out)\b/; $c-res-redirect( $go ); $c-detach; On Sun, Jan 23, 2011 at 8:27 PM, Eric Berg eb...@bergbrains.com wrote: If a user submits a certain form without being logged in, I flash the current URL, save the params in the session, and redirect them to the login. In my Login controller, I look for $c-flash-{redirect_url} and redirect them back to that URL. The problem is that that flash entry is gone after the user submits the login form. I logged out the redirect URL at the beginning of my login routine and it comes through the first time, but even if I don't access it via the log statement, that redirect_url key is not there in the flash when the user submits the login form with their credentials. I've tried resetting $c-flash-{redirect_url} in the login routine and also tried $c-keep_flash( qw( redirect_url )) in the login routine, but no go. Any thoughts on what I might be doing wrong? Eric ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Saving redirect URL in flash not sticking through login process
Altho the implications here http://search.cpan.org/~bobtfish/Catalyst-Plugin-Session-0.31/lib/Catalyst/Plugin/Session.pm#METHODS are that you can do multiple redirects with one $c-flash -- to wit: The flash data will be cleaned up only on requests on which actually use $c-flash (thus allowing multiple redirections), and the policy is to delete all the keys which haven't changed since the flash data was loaded at the end of every request. We just treat it as a preloaded stash, and that seems to work fine for us. If we want a more permanent chunk of data, we inject it into $c-session. On Sun, Jan 23, 2011 at 11:36 PM, will trillich will.trill...@serensoft.com wrote: I think stash is the ephemeral one-shot hashref, whereas flash is the next-request's preloaded stash. That is, you can load up your flash with whatever you need, and then do a full $c-res-redirect() somewhere -- which fires off a browser redirect and a new request -- and your then-stash will have all the goodies you plopped in there. And, being the stash, it's all wiped out when the request is done. So a follow-up request (or redirect) would either have an empty stash, or it'd require the second request-handling routines to stuff things into flash (again). So it's not that flash is permanent, it's not. It's just a pre-load for the next-request's short-lived stash. On Sun, Jan 23, 2011 at 10:58 PM, Eric Berg eb...@bergbrains.com wrote: Thanks, Will. That I figured that would work, but I thought that the flash was the right way to do it -- especially with the automatic cleanup, so I was holding off on trying that. Why doesn't flash work across these multiple requests? I thought that was the whole idea of flash vs. stash. Eric On 1/23/11 11:52 PM, will trillich wrote: The flash is moved to the stash after the redirect, and then it's gone after that, right? What we do is stuff the intended destination into the session and then pull it from there: sub login : Chained('/') PathPart('login') Args(0) { my ( $self, $c ) = @_; my $form = Spill::Form::Login-new( action = $c-uri_for('/login') ); $c-stash( template = 'login.tt2', form = $form, ); if ( $c-action ne 'login' ) { # Stuff destination into session for later redirect if user authenticates *$c-session-{redirect} = $c-req-uri-as_string;* } ...then, later, after authenticating... my $go = *delete( $c-session-{redirect} )* || $c-req-headers-referer; $go = '/' if $go =~ /\blog(in|out)\b/; $c-res-redirect( $go ); $c-detach; On Sun, Jan 23, 2011 at 8:27 PM, Eric Berg eb...@bergbrains.com wrote: If a user submits a certain form without being logged in, I flash the current URL, save the params in the session, and redirect them to the login. In my Login controller, I look for $c-flash-{redirect_url} and redirect them back to that URL. The problem is that that flash entry is gone after the user submits the login form. I logged out the redirect URL at the beginning of my login routine and it comes through the first time, but even if I don't access it via the log statement, that redirect_url key is not there in the flash when the user submits the login form with their credentials. I've tried resetting $c-flash-{redirect_url} in the login routine and also tried $c-keep_flash( qw( redirect_url )) in the login routine, but no go. Any thoughts on what I might be doing wrong? Eric ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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/ -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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
[Catalyst] In HTML::FormHandler search form (no DB schema) -- how to populate a SELECT field via DBIx::Class?
*Short version*: If you have a HTML::FormHandler search form without a has_field '+item_class' (there's no data-base row corresponding to its contents) how to you reach your DBIx::Class schemas to populate a drop-down menu? *Long version*: This is in the context of a Catalyst app -- however, I do know this is either FormHandler question or a DBIC question, and not intrinsically a Catalyst question, but... hoping the wise folks here can nudge me in the right direction... We have several DBIC resultsets including Incident and Country. The Incident record has this relationship: __PACKAGE__-belongs_to( 'country' = 'Incident::Schema::DB::Result::Country' ); (And the country schema has_many incidents, of course) For the CRUD form related to the actual incident table, we have a matching HTML::FormHandler package with its has '+item_class' as expected. This makes it easy to create a sub options_country { my $self = shift; return unless $self-schema; my $rs = $self-schema-resultset('Country'); #... } subroutine for the form, for populating a country drop-down menu in the HTML. But! For the SEARCH form, we are not interested in CRUD, plus we have extra fields (for example, we want the user to be able to bracket dates with a start-field and an end-field) so there's no one-to-one correlation with the database table -- meaning there's no item_class for the search form. And hence no schema to rely on. What we're looking for now -- unless there's a better more obvious paradigm -- is a way to get from an instance of the schema-object, back to the resultset, for searching. sub options_country { my $self = shift; # note $c is not available here :( # $self-schema will be UNDEF here my $obj = Spill::Schema::DB::Result::Country-new; # Hard-wired, yes, is there a better way? my $rs = $obj-??? # ? } I've looked at - $obj-result_source (Can't call method resolve on an undefined valued in DBIx/Class/Row) - $obj-result_source_instance-resultset (Can't call method default_resultset_attributes on an undef value in DBIx/Class/ResultSource) - $obj-result_source_instance-resultset_class-search({},{}) (Can't use string as a HASH ref in DBIx/Class/ResultSet) and a couple other dead ends. It's likely to be something obvious I've overlooked. :( Suggestions? -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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] Form Filosophy - pardon the pun:)
Here's a similar thread from a while back, tho it focused on HTML::FormHandler -- http://www.gossamer-threads.com/lists/catalyst/users/27948 Another one with some cool tips: http://www.gossamer-threads.com/lists/catalyst/users/27557 On Wed, Jan 5, 2011 at 8:03 AM, Steve st...@matsch.com wrote: Hello all, I'm interested to hear from those producing real live applications, (that they plan to support for years) what combination of form rendering tool sets are being used and why. My somewhat limited experience has taught me that most tools do as much TO you as they do FOR you. That being said, what tools are the Catalyst folks using for rendering DB-based forms? Another way to put it is which tools are complementary to Catalyst? For extra credit, an explanation as to WHY you're using a particular tool would be great! Thanks much, Steve ___ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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] Roles and Permissions -- Controller vs View
In our web app we have lots of features that are predicated upon the user's role. For example, a show link is available to everyone, but an edit link is only available to managers. Is there a best-practices approach for dealing with this? There are two places where user-role is significant -- controller and view. In the controller we use chaining to bounce a user out of an edit method if they don't have the right role. And in the view we use lots of [% IF c.user.is_mgr %] logic to determine whether or not to display the links. (Using user-friendly urls like /thingy/27/edit makes the URL easy to guess, so checking inside the controller is a good idea.) So right now we're checking for the same thing in the view that we're checking for in the controller. The more features that get added that require role-checking, the more hairy this gets. Is there a way to get all this rolled up into one place? Or at least make the view a bit more elegant? -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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] receiving form-elements in sequence...?
Quick question: how do we determine the sequence of submitted form elements? Background: we've got several data-rows that we're going to let the user reorder via Javascript drag-and-drop. Looking in $c-req-params, being a hash, gives us all elements, but no clue as to which item is first, which is next, which is last. So in case the opening line above isn't quite the right question, how do we submit a new sequence of rows via $c-req? This is probably a simple one, but we haven't found the $c-req-[sequenced-form-items] method yet (gotta be available via Catalyst::Request, I hope). Pointers gladly welcomed. Thanks! -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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] Retrieve all users belong to a category and all its sub categories
/lurk Ooh, I didn't know about either of those. Very, very sweet! And one for nested-sets and another for parent-links/adjacency lists. This is what's so great about open source mailing lists -- the serendipity. Here on a Catalyst web-framework list you learn cool, tangential things about DBIC that you didn't know you were missing, and then you can just go nab new tools that make life easy! Awesome. On Thu, Dec 16, 2010 at 11:36 PM, Charlie Garrison garri...@zeta.org.auwrote: Good morning, On 16/12/10 at 11:15 AM -0500, Hauck, William B. william.ha...@ibx.com wrote: Not sure how to do it in a DBIC-like fashion, but these few links show you how to do it in SQL for PostgreSQL and MySQL. Oracle and DB2 have hierarchical functionality built-in. http://www.postgresql.org/docs/8.4/static/queries-with.html http://dev.mysql.com/tech-resources/articles/hierarchical-data.html http://onlamp.com/lpt/a/5007 I haven't been following this thread closely, but I think one of the DBIC::Tree modules is what OP is looking for: http://search.cpan.org/perldoc?DBIx::Class::Tree::AdjacencyList http://search.cpan.org/perldoc?DBIx::Class::Tree::NestedSet Charlie -- Ꮚ Charlie Garrison ♊ garri...@zeta.org.au O ascii ribbon campaign - stop html mail - www.asciiribbon.org 〠 http://www.ietf.org/rfc/rfc1855.txt ___ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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] FormHandler -- pro or con?
Anybody else *dissing* FormHandler? We've started developing based on FormHandler lately and haven't had troubles... yet? On Tue, Nov 30, 2010 at 5:26 AM, Shlomi Fish shlo...@iglu.org.il wrote: I can recommend *against* HTML-FormHandler. For my day job's Perl and Catalyst project, we initially decided to go with HTML-FormHandler, only to discover it was buggy, quirky and had severe memory leaks. We ended up doing many workarounds and recently made a transition from it to HTML-FormFu, which while by no means perfect, is much saner. My co-worker nothingmuch who has done many of the workarounds can provide further comments on it. Recently I had to over-ride a role in the login form (for which we need to use HTML-FormHandler due to CatalystX::SimpleLogin) that will accept an empty string as the 'action=' attribute because it only placed true values of the attribute there, which ruled out empty strings. But I recall many other fun hours debugging HTML-FormHandler. Stay away if you can. Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ What does Zionism mean? - http://shlom.in/def-zionism rindolf She's a hot chick. But she smokes. go|dfish She can smoke as long as she's smokin'. Please reply to list if it's a mailing list post - http://shlom.in/reply . ___ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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: superuser switch-user session function?
Aha! It looks like a sneaky, evil, wrong, mean, horrid way to switch-user in the middle of a session is to $c-session-{__user}{id} = $new_id_here; # since id = PK But that's undoubtedly bad form of the worst kind. What's the canonical non-sneaky above-board friendly golden way to do this? On Thu, Jul 8, 2010 at 12:27 PM, w...@serensoft.com w...@serensoft.comwrote: Hmm: Become-user? Is there a clean way to provide a means for sys-admins to become user to track down issues? It's much easier to diagnose when seeing what the user's seeing directly, when we look at it through our own eyes -- as opposed to relying on vague user-style descriptions (unrecognized date format vs doesn't work). use Catalyst qw/ ConfigLoader Static::Simple Session Session::Store::DBIC Session::State::Cookie Authentication Authentication::Credential::Password Authorization::Roles Authorization::ACL /; -- will trillich I think it would be worse to expect nothing than to be disappointed. -- Anne (with an 'e') Shirley -- -- will trillich -- http://faq.serensoft.com/ The truth is that many people set rules to keep from making decisions. -- Mike Krzyzewski ___ 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 and Moose with has many_to_many
Roger that, will comply. Thanks! On Fri, Nov 26, 2010 at 1:03 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 25 Nov 2010, at 21:57, will trillich wrote: Right. :) These are 'inlined' within the controller that's the only place where they're used. E.g. package Spill::Controller::Spill; use Moose; #... { package Spill::Controller::Incident::IncidentForm; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; #... } Took that idea from the code generated by InstantCRUD, seems kinda nice! If these forms were useful in more than one place then we'd certainly pull them into their own files in their own tree-branches. I don't care where the code physically lives - just how it's namespaced.. Please please fix the namespace, as calling it MyApp::Controller::XXX _WILL GET IT LOADED AS A CONTROLLER BY CATALYST_ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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 and Moose with has many_to_many
On Thu, Nov 25, 2010 at 1:54 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 25 Nov 2010, at 03:43, will trillich wrote: Greetings Catalystery: Got a new question, trying to implement a many_to_many relationship via Moose... The DBIC portion of the puzzle is straightforward, we've got that working just fine. Here's part I understand -- we have a controller that's referring to a form: has 'form' = ( isa = 'MyApp::Controller::Incident::IncidentForm', Ewww! Catalyst will try to load all components under MyApp::Controller as controllers. This module clearly isn't - please move it to another namespace, e.g. MyApp::Form::Incident Right. :) These are 'inlined' within the controller that's the only place where they're used. E.g. package Spill::Controller::Spill; use Moose; #... { package Spill::Controller::Incident::IncidentForm; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; #... } Took that idea from the code generated by InstantCRUD, seems kinda nice! If these forms were useful in more than one place then we'd certainly pull them into their own files in their own tree-branches. But how would you represent and then refer to a many_to_many relationship such as has 'actor_role' = ( isa = 'MyApp::Controller::DB::Result::ActorRole', You haven't called your DBIC schema yApp::Controller::DB have you? This is really really bad - as Catalyst will be trying to load every DB row and ResultSet class as a controller! Turns out this is blitheringly simple thanks for FormHandler and DBIC -- simply: package Spill::Schema::DB::Result::Incident; #... __PACKAGE__-has_many( map_incident_agency = 'Spill::Schema::DB::Result::IncidentAgency' = 'incident' ); __PACKAGE__-many_to_many( agencies = 'map_incident_agency', 'agency' ); package Spill::Form::IncidentForm; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; #... has_field 'agencies' = ( type = 'Multiple' ); has_field 'contractors' = ( type = 'Multiple' ); ) And then once we get the has straightened out, how do we use it? %roles = $self-actor_role( @get_roles ); # ?? @success = $self-actor_role( %set_new_roles ); # ?? Does that help? 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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 and Moose with has many_to_many SOLVED
many-to-many interface SOLVED: Here's how we do the many-to-many interface, made brain-dead simple thanks to Moose, DBIC and FormHandler. All the heavy lifting is handled backstage, we don't need to lift a finger. We thought we'd have to do lots of mechanical drudgery, but it's all handled for me! Here's the relationship-definition between the main record (incident) and two of its linking tables (one for agencies, one for contractors): package *Spill::Schema::DB::Result::Incident*; #... __PACKAGE__-has_many( map_incident_agency = 'Spill::Schema::DB::Result::IncidentAgency' = 'incident' ); __PACKAGE__-many_to_many( *agencies* = 'map_incident_agency', 'agency' ); __PACKAGE__-has_many( map_incident_contractor = 'Spill::Schema::DB::Result::IncidentContractor' = 'incident' ); __PACKAGE__-many_to_many( *contractors* = 'map_incident_contractor', 'contractor' ); meanwhile in the form... package *Spill::Form::IncidentForm*; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; has '+item_class' = ( default = 'Incident' ); # ties it to DBIC #... has_field '*agencies*'= ( type = 'Multiple' ); has_field '*contractors*' = ( type = 'Multiple' ); then in the controller... package Spill::Controller::Spill; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller'; } #... has '*form*' = ( isa = 'Spill::Form::IncidentForm', is = 'rw', lazy= 1, default = sub { Spill::Form::IncidentForm-new }, ); #... sub my_action : Action { #.. my $form = $c-*form*; my $obj = $c-model('blah')-find_or_new({id=$id}); return unless process( # *MAGIC!* item = $obj, # take this database object params = $c-req-params, # and update it if everything validates ); #.. } With those definitions in place, your [% form.render %] (or [% form.render_field('agencies') %] if you're hand-rolling your form) will do the right thing, no problem! If you need to filter the items that populate the multi-select list, no problem. There's another link between incident and, this time, person -- only we want to limit the person-list to just those related to the org in the incident itself: # back in package *Spill::Form::IncidentForm* sub options_persons { my $self = shift; return unless $self-schema; my $persons = $self-schema-resultset('Person'); my $org = $self-field('org')-init_value; $persons = $persons-search( { $org ? (org = $org) : () }, {order_by = ['lname','fname']}, ); my @persons; while ( my $person = $persons-next ) { push @persons, { value = $person-id, label = $person-name, #active = $person-active, }; } return \...@persons; } The active label seems to be ignored when we do this, unfortunately. And really we should pull org from $c-user instead of the form. But whether you roll your own list or let FormHandler/DBIC pull them all -- in your browser you get a multi-select list of all the items in each many-to-many relationship, and users can click to turn them on or off. Click submit, and the linking-table gets updated accordingly. Very, very nice! Catalyst, DBIx::Class, HTML::FormHandler, Moose -- woo hoo! Kudos, big fat thumbs up! -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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 and Moose with has many_to_many
Greetings Catalystery: Got a new question, trying to implement a many_to_many relationship via Moose... The DBIC portion of the puzzle is straightforward, we've got that working just fine. Here's part I understand -- we have a controller that's referring to a form: has 'form' = ( isa = 'MyApp::Controller::Incident::IncidentForm', is = 'rw', lazy= 1, default = sub { MyApp::Controller::Incident::IncidentForm-new }, ) then $c-stash-{form} = $self-form; # etc Piece of cake! But how would you represent and then refer to a *many_to_many* relationship such as has 'actor_role' = ( isa = 'MyApp::Controller::DB::Result::ActorRole', is = 'rw', lazy= 1, # default = sub { MyApp::Controller::DB::Result::ActorRole-new }, # not! # default = sub { ...-add_to_roles(??) } ) And then once we get the has straightened out, how do we use it? %roles = $self-actor_role( @get_roles ); # ?? @success = $self-actor_role( %set_new_roles ); # ?? I've looked through http://search.cpan.org/~frew/DBIx-Class-0.08124/lib/DBIx/Class/Relationship.pm#many_to_many until my eyes cross on their own :( Or am I barking up the wrong tree? -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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: Trying out FormHandler, running into maketext error
Not sure what your case sensitive remark refers to -- and if it's looking for something to be defined XXX that's defined xxx instead, that particular error message is really out of left field. Do you mean something like has_field 'submit' = ( widget = 'submit' ) should instead be has_field 'submit' = ( widget = 'Submit' ) with a capital S? The following is definitely working for us now: has_field 'submit' = (type = 'Submit', label = 'Submit', value='Submit', required = 0, ) On Tue, Nov 23, 2010 at 11:47 AM, Alexander Hartmaier alexander.hartma...@t-systems.at wrote: Perl is case sensitive. Also you should not have any non Catalyst::Controller subclasses in the Controller namespace of your app. Move you forms to My::App::Form for example. -- Best regards, Alex On Mon, 2010-11-22 at 18:25 +0100, will trillich wrote: Ooh, very nice! Thanks so much, that's lots better now. Woo hoo! Yes indeed, the undef error - Unable to do maketext on: at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. error has gone away thanks to tweaks to the SUBMIT button on the FormHandler definition. Was there something in the Catalyst/FormHanlder intro that we missed? On Mon, Nov 22, 2010 at 5:16 PM, Hernan Lopes hernanlo...@gmail.com wrote: will trillich, that error happens when i use has_field 'submit' = ( widget = 'submit' ) can you test your form with this instead: has_field 'submit' = (type = 'Submit', label = 'Submit', value='Submit', required = 0, ) i bet your error will go away On Mon, Nov 22, 2010 at 12:19 PM, will trillich will.trill...@serensoft.com wrote: Our form-class includes has_field 'submit' = ( widget = 'submit' ) Do you mean type='submit' instead of widget='submit'? Interesting that you'd think of this as a suspect. What's the rationale? On Mon, Nov 22, 2010 at 9:16 AM, Hernan Lopes hernanlo...@gmail.com wrote: will trilich, are you using widget type submit ? try to replace with type = 'Submit' Hernan Lopes On Mon, Nov 22, 2010 at 1:38 AM, John Anderson geneh...@genehack.org wrote: On Nov 21, 2010, at 10:26 PM, will trillich wrote: Pooh. Still no luck. When we try a more more Moose-y approach, we do get updated database records (stuffing the URL with arguments to affect a form-submit) but still can't render, with the same error as before: Have you looked at the docs for HTML::FormHandler::TraitFor::I18N? Based on that, you may want to see if you have something in $ENV{LANGUAGE_HANDLE} or try passing in a language handle to your form constructor -- or may try push_errors instead of add_errors, as that documentation suggests. 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/ ___ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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
Re: [Catalyst] Re: Trying out FormHandler, running into maketext error
From %ENV there are only two LANG* keys: 'LANG' = 'en_US' 'LANGUAGE' = 'en_US:en_GB:en' Looking at the docs for HTML::FormHandler::TraitFor::I18N it sure looks flexible for moving toward a multi-language webapp, but when we just want a quick proof-of-concept, we'd hope that there are some nice convenient defaults that just work. :( Do we have to spend hours reading a whole set of manpages on internationalization just to get our first elemental form to render? Surely there's an elegant get-off-the-ground approach... This seems like a huge detour that won't be productive, except for getting past this speed bump. It's not that we're avoiding work, we're avoiding time-sinks, and this looks like a time-sink. E.g. we don't have a module MyApp::I18N with a new() method and hope to not need to learn how to build one... It'd be great (not to mention necessary/useful) if we were looking to internationalize our app, but we're not. So, is a study of I18N the One True Path to getting a form to render? Or is there something simple we missed? On Mon, Nov 22, 2010 at 3:38 AM, John Anderson geneh...@genehack.orgwrote: On Nov 21, 2010, at 10:26 PM, will trillich wrote: Pooh. Still no luck. When we try a more more Moose-y approach, we do get updated database records (stuffing the URL with arguments to affect a form-submit) but still can't render, with the same error as before: Have you looked at the docs for HTML::FormHandler::TraitFor::I18N? Based on that, you may want to see if you have something in $ENV{LANGUAGE_HANDLE} or try passing in a language handle to your form constructor -- or may try push_errors instead of add_errors, as that documentation suggests. 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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: Trying out FormHandler, running into maketext error
Our form-class includes has_field 'submit' = ( widget = 'submit' ) Do you mean type='submit' instead of widget='submit'? Interesting that you'd think of this as a suspect. What's the rationale? On Mon, Nov 22, 2010 at 9:16 AM, Hernan Lopes hernanlo...@gmail.com wrote: will trilich, are you using widget type submit ? try to replace with type = 'Submit' Hernan Lopes On Mon, Nov 22, 2010 at 1:38 AM, John Anderson geneh...@genehack.orgwrote: On Nov 21, 2010, at 10:26 PM, will trillich wrote: Pooh. Still no luck. When we try a more more Moose-y approach, we do get updated database records (stuffing the URL with arguments to affect a form-submit) but still can't render, with the same error as before: Have you looked at the docs for HTML::FormHandler::TraitFor::I18N? Based on that, you may want to see if you have something in $ENV{LANGUAGE_HANDLE} or try passing in a language handle to your form constructor -- or may try push_errors instead of add_errors, as that documentation suggests. 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/ ___ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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: Trying out FormHandler, running into maketext error
Ooh, very nice! Thanks so much, that's lots better now. Woo hoo! Yes indeed, the undef error - Unable to do maketext on: at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. error has gone away thanks to tweaks to the SUBMIT button on the FormHandler definition. Was there something in the Catalyst/FormHanlder intro that we missed? On Mon, Nov 22, 2010 at 5:16 PM, Hernan Lopes hernanlo...@gmail.com wrote: will trillich, that error happens when i use has_field 'submit' = ( widget = 'submit' ) can you test your form with this instead: has_field 'submit' = (type = 'Submit', label = 'Submit', value='Submit', required = 0, ) i bet your error will go away On Mon, Nov 22, 2010 at 12:19 PM, will trillich will.trill...@serensoft.com wrote: Our form-class includes has_field 'submit' = ( widget = 'submit' ) Do you mean type='submit' instead of widget='submit'? Interesting that you'd think of this as a suspect. What's the rationale? On Mon, Nov 22, 2010 at 9:16 AM, Hernan Lopes hernanlo...@gmail.comwrote: will trilich, are you using widget type submit ? try to replace with type = 'Submit' Hernan Lopes On Mon, Nov 22, 2010 at 1:38 AM, John Anderson geneh...@genehack.orgwrote: On Nov 21, 2010, at 10:26 PM, will trillich wrote: Pooh. Still no luck. When we try a more more Moose-y approach, we do get updated database records (stuffing the URL with arguments to affect a form-submit) but still can't render, with the same error as before: Have you looked at the docs for HTML::FormHandler::TraitFor::I18N? Based on that, you may want to see if you have something in $ENV{LANGUAGE_HANDLE} or try passing in a language handle to your form constructor -- or may try push_errors instead of add_errors, as that documentation suggests. 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/ ___ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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/ -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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: Trying out FormHandler, running into maketext error
Pooh. Still no luck. When we try a more more Moose-y approach, we do get updated database records (stuffing the URL with arguments to affect a form-submit) but still can't render, with the same error as before: undef error - Unable to do maketext on: at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. That is, we're using this approach, and still having trouble with [% form.render %]: package MyApp::Controller::Admin; use Moose; use namespace::autoclean; BEGIN {extends 'Catalyst::Controller'; } { package MyApp::Controller::Org::OrgForm; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; with 'HTML::FormHandler::Render::Simple'; has '+item_class' = ( default = 'Org' ); #...fields here } has 'form' = ( isa = 'MyApp::Controller::Org::OrgForm', is = 'rw', lazy= 1, default = sub { MyApp::Controller::Org::OrgForm-new }, ); sub org :Local :Args(0) { my ( $self, $c ) = @_; my %params = %{ $c-req-params }; my $org = $c-model('MyApp::Org')-find_or_new( {id = $params{id} || 1} ); my $form = $self-form; # takes quite a while to initialize this $c-stash-{form} = $form; return unless $form-process( item = $org, params = \%params, ); $c-stash-{message} = Org record . ( $params{id} ? updated : created ); } Any suggestions or clue-sticks welcome. Thanks! On Sun, Nov 21, 2010 at 6:43 AM, will trillich will.trill...@serensoft.comwrote: Hi Catalystas -- We're trying a new project, this time using FormHandler, and there's something we obviously don't have right. In the controller we define the OrgForm class (which we borrowed from the truly awesome InstantCRUD.pl output), { package *MyApp::Controller::Org::OrgForm*; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; with 'HTML::FormHandler::Render::Table'; has '+item_class' = ( default = 'Org' ); ... } Then we refer to it thus: sub org :Local :Args(0) { my ( $self, $c ) = @_; my %params = %{ $c-req-params }; my $org = $c-model('MyApp::Org')-find_or_new( {id = $params{id} || 1} ); # default to org #1 for now my $form = *MyApp::Controller::Org::OrgForm*-new( item = $org, params = \%params, ); $c-stash-{form} = $form; } WIth *[% form.render %]* in the template, we see this message in the browser: undef error - Unable to do maketext on: at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. When single-stepping via the Perl debugger, * $form-field('name')-result-value* returns the proper name of org#1 just as expected, so pulling a database record and stuffing it into the form is working just fine. But it won't render the HTML. (We also tried converting NULL values in the database fields to empty strings, no difference.) What did we miss? = Catalyst v5.8.0029 HTML::FormHandler v0.32001 Moose v1.2 Here's the initial debug-listing output form the command line: Use of uninitialized value $message[0] in concatenation (.) or string at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15 HTML::FormHandler::I18N::__ANON__[/usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm:16]('No handle/phrase at /usr/share/perl/5.10/Locale/Maketext.pm l...') called at /u sr/local/share/perl/5.10.0/Try/Tiny.pm line 100 Try::Tiny::try('CODE(0xcc64058)', 'Try::Tiny::Catch=REF(0xcc63f78)') called at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 16 HTML::FormHandler::I18N::maketext('HTML::FormHandler::I18N::en_us=HASH(0xcc6fb38)', undef) called at /usr/local/share/perl/5.10.0/HTML/FormHandler/TraitFor/I18N.pm line 57 HTML::FormHandler::TraitFor::I18N::_localize('MooseX::Traits::__ANON__::SERIAL::12=HASH(0xcb69690)', undef) called at /usr/local/share/perl/5.10.0/HTML/FormHandler/Render/S imple.pm line 393 HTML::FormHandler::Render::Simple::render_submit('MyApp::Controller::Org::OrgForm=HASH(0xc733818)', 'MooseX::Traits::__ANON__::SERIAL::12=HASH(0xcb69690)') called at /usr/l ocal/share/perl/5.10.0/HTML/FormHandler/Render/Simple.pm line 185 HTML::FormHandler::Render::Simple::render_field('MyApp::Controller::Org::OrgForm=HASH(0xc733818)', 'MooseX::Traits::__ANON__::SERIAL::12=HASH(0xcb69690)') called at /usr/lo cal/share/perl/5.10.0/HTML/FormHandler/Render/Table.pm line 31 HTML::FormHandler::Render::Table::render('MyApp::Controller::Org::OrgForm=HASH(0xc733818)') called at /home/will/projects/perl-mvc/MyApp/root/src/admin/org.tt2 line 6 [etc] -- Failure is not important. How you overcome it, is. -- Nick Vujicic -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http
[Catalyst] Trying out FormHandler, running into maketext error
Hi Catalystas -- We're trying a new project, this time using FormHandler, and there's something we obviously don't have right. In the controller we define the OrgForm class (which we borrowed from the truly awesome InstantCRUD.pl output), { package *MyApp::Controller::Org::OrgForm*; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; with 'HTML::FormHandler::Render::Table'; has '+item_class' = ( default = 'Org' ); ... } Then we refer to it thus: sub org :Local :Args(0) { my ( $self, $c ) = @_; my %params = %{ $c-req-params }; my $org = $c-model('MyApp::Org')-find_or_new( {id = $params{id} || 1} ); # default to org #1 for now my $form = *MyApp::Controller::Org::OrgForm*-new( item = $org, params = \%params, ); $c-stash-{form} = $form; } WIth *[% form.render %]* in the template, we see this message in the browser: undef error - Unable to do maketext on: at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. When single-stepping via the Perl debugger, * $form-field('name')-result-value* returns the proper name of org#1 just as expected, so pulling a database record and stuffing it into the form is working just fine. But it won't render the HTML. (We also tried converting NULL values in the database fields to empty strings, no difference.) What did we miss? = Catalyst v5.8.0029 HTML::FormHandler v0.32001 Moose v1.2 Here's the initial debug-listing output form the command line: Use of uninitialized value $message[0] in concatenation (.) or string at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15. at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 15 HTML::FormHandler::I18N::__ANON__[/usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm:16]('No handle/phrase at /usr/share/perl/5.10/Locale/Maketext.pm l...') called at /u sr/local/share/perl/5.10.0/Try/Tiny.pm line 100 Try::Tiny::try('CODE(0xcc64058)', 'Try::Tiny::Catch=REF(0xcc63f78)') called at /usr/local/share/perl/5.10.0/HTML/FormHandler/I18N.pm line 16 HTML::FormHandler::I18N::maketext('HTML::FormHandler::I18N::en_us=HASH(0xcc6fb38)', undef) called at /usr/local/share/perl/5.10.0/HTML/FormHandler/TraitFor/I18N.pm line 57 HTML::FormHandler::TraitFor::I18N::_localize('MooseX::Traits::__ANON__::SERIAL::12=HASH(0xcb69690)', undef) called at /usr/local/share/perl/5.10.0/HTML/FormHandler/Render/S imple.pm line 393 HTML::FormHandler::Render::Simple::render_submit('MyApp::Controller::Org::OrgForm=HASH(0xc733818)', 'MooseX::Traits::__ANON__::SERIAL::12=HASH(0xcb69690)') called at /usr/l ocal/share/perl/5.10.0/HTML/FormHandler/Render/Simple.pm line 185 HTML::FormHandler::Render::Simple::render_field('MyApp::Controller::Org::OrgForm=HASH(0xc733818)', 'MooseX::Traits::__ANON__::SERIAL::12=HASH(0xcb69690)') called at /usr/lo cal/share/perl/5.10.0/HTML/FormHandler/Render/Table.pm line 31 HTML::FormHandler::Render::Table::render('MyApp::Controller::Org::OrgForm=HASH(0xc733818)') called at /home/will/projects/perl-mvc/MyApp/root/src/admin/org.tt2 line 6 [etc] -- Failure is not important. How you overcome it, is. -- Nick Vujicic ___ 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 and FormBuilder vs. IExplorer 8
Well this is just odd. When Firefox, Chrome and IE6 submit files-to-upload, the structure returned by $c-req-uploads is DIFFERENT for explorer -- it's an ARRAYREF instead of a HASHREF: DB2 x $c-req-uploads *0 HASH(0x9d04d20)* '*newatt[1]*' = Catalyst::Request::Upload=HASH(0xb81a098) 'filename' = 'japh.pl' 'headers' = HTTP::Headers=HASH(0xb448c28) 'content-disposition' = 'form-data; name=newatt[1]; filename= japh.pl' 'content-type' = 'text/x-perl-script' 'size' = 104 'tempname' = '/tmp/6V0Vlas5td' 'type' = 'text/x-perl-script' '*newatt[2]*' = Catalyst::Request::Upload=HASH(0xb448c88) 'filename' = 'TODO' 'headers' = HTTP::Headers=HASH(0xb650140) 'content-disposition' = 'form-data; name=newatt[3]; filename=TODO' 'content-type' = 'application/octet-stream' 'size' = 29 'tempname' = '/tmp/2RTgotIgut' 'type' = 'application/octet-stream' The same attempted upload for Explorer 8 looks like this instead: *0 ARRAY(0xab06360)* * 0* Catalyst::Request::Upload=HASH(0xb448c88) 'filename' = 'japh.pl' 'headers' = HTTP::Headers=HASH(0xb81a098) 'content-disposition' = 'form-data; name=newatt[1]; filename= japh.pl' 'content-type' = 'text/x-perl-script' 'size' = 104 'tempname' = '/tmp/3Tg94Iq85j' 'type' = 'text/x-perl-script' *1* Catalyst::Request::Upload=HASH(0xb448c28) 'filename' = 'TODO' 'headers' = HTTP::Headers=HASH(0xb448c88) 'content-disposition' = 'form-data; name=newatt[3]; filename=TODO' 'content-type' = 'application/octet-stream' 'size' = 29 'tempname' = '/tmp/T2r9F7Ex11' 'type' = 'application/octet-stream' The structure of each node is the same, but as a whole the upload-list switches internally from a HASHREF to an ARRAYREF. IE6, FireFox, Chrome all bring in the Hashref, but IE8 brings in an Arrayref. On top of that, if there's just one upload, it's not even an array, it's just the node itself. What the heck? Sure seems odd to offer a different storage structure based on browser-platform... On Wed, Oct 6, 2010 at 8:27 AM, will trillich will.trill...@serensoft.comwrote: The FormBuilder/Catalyst -generated HTML works just fine in Chrome and in Firefox, so debugging there isn't useful. It also works fine in older Internet Explorers. :( I was hoping someone has already run into this FormBuilder-snag-with-IE8 and found an elegant fix... And the return validate_incident(this) code is generated via FormBuilder, that's why I was asking the list, hoping someone else here has run into this and found a workaround. We do have other DHTML javascript on the page (e.g. click to dynamically add another upload-field) so Javascript and JQuery are working. IE8 has apparently been tweaked enough that it doesn't recognize the object in that context...? Any ideas? On Wed, Oct 6, 2010 at 1:13 AM, Toby Corkindale toby.corkind...@strategicdata.com.au wrote: On 06/10/10 14:00, will trillich wrote: Short version: Catalyst/Formbuilder uploads work fine in firefox and chrome, works fine in IE 6... but not IE 8, where it throws an object expected error. Ugh, I hit this a little while ago, but have forgotten the details already. I think you are looking in the right direction with the this though; try validating it in your function to ensure it contains what you're expecting perhaps? Also, can you verify that jquery is actually getting loaded OK? ie. In your document, put something like: $(function() { alert(jquery has loaded!); }); and check to see that you get an alert box when you load the page. If not, fire up Chrome's developer tools, or Firefox's Firebug, and see they mention any warnings or errors. -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] Catalyst and FormBuilder vs. IExplorer 8
The FormBuilder/Catalyst -generated HTML works just fine in Chrome and in Firefox, so debugging there isn't useful. It also works fine in older Internet Explorers. :( I was hoping someone has already run into this FormBuilder-snag-with-IE8 and found an elegant fix... And the return validate_incident(this) code is generated via FormBuilder, that's why I was asking the list, hoping someone else here has run into this and found a workaround. We do have other DHTML javascript on the page (e.g. click to dynamically add another upload-field) so Javascript and JQuery are working. IE8 has apparently been tweaked enough that it doesn't recognize the object in that context...? Any ideas? On Wed, Oct 6, 2010 at 1:13 AM, Toby Corkindale toby.corkind...@strategicdata.com.au wrote: On 06/10/10 14:00, will trillich wrote: Short version: Catalyst/Formbuilder uploads work fine in firefox and chrome, works fine in IE 6... but not IE 8, where it throws an object expected error. Ugh, I hit this a little while ago, but have forgotten the details already. I think you are looking in the right direction with the this though; try validating it in your function to ensure it contains what you're expecting perhaps? Also, can you verify that jquery is actually getting loaded OK? ie. In your document, put something like: $(function() { alert(jquery has loaded!); }); and check to see that you get an alert box when you load the page. If not, fire up Chrome's developer tools, or Firefox's Firebug, and see they mention any warnings or errors. -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/
[Catalyst] Catalyst and FormBuilder vs. IExplorer 8
Short version: Catalyst/Formbuilder uploads work fine in firefox and chrome, works fine in IE 6... but not IE 8, where it throws an object expected error. Long version: We've got a weird situation -- Catalyst and FormBuilder work together to generate HTML for a form including file uploads -- which work fine for older Internet Explorers, but when attempting the POST using Explorer 8, instead of an upload we get the error Object Expected line 215 char 1. If we opt not to upload anything, the rest of the fields in the form get posted just fine. Line 215 is: form action=/incident/2129 enctype=multipart/form-data id=incident method=post name=incident onsubmit=return validate_incident(this); input id=_submitted_incident name=_submitted_incident type=hidden value=1 / The only thing there that looks like a suspect would be onsubmit=return validate_incident(this), right? If you've run across this and know how to straighten it out, that information would be very much appreciated. In particular... Is there a way to fix this with a configuration arg to Catalyst (v5.80027) or to FormBuilder (v3.0501)? ___ 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] Design/architecture question -- search-results with a modify-search-field
Here's a high-level situation we're wrestling with: /item/list = show all, with paging /item/search = display search form, or use list.tt2 template for result display, with paging Of course, that approach right there may be causing some of our headache... :) But that part is all working fine and dandy. The question is, what's an elegant way to put one quick search field on the list.tt2 template to tweak the cached/existing search (or to tweak the list-all)? In this case it's a category of /item, and that category field is also on the dozen-field form as well. Kind of like when doing a google search and switching between images and news and videos and maps. What's best? Have the list.tt2 category-form action point to an /item/category method and then forward to /list? Have the list.tt2 category-form action point to /item/search and fill out a subset of parameters? Nothing we've tried feels clean, certainly not DRY. Suggestions welcome. Thanks! ___ 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] How to get from
Short version: we're wondering how a method from inside the SCHEMA can return other objects besides the one that got passed in. That is, we have $obj (with its own ID number) but we want to FIND a different object -- same type, but with a different ID number. What's the mechanism for that, inside the schema package? Long version: We've got a schema defined for hierarchical groups: MyApp::Schema::DB::Result::Group __PACKAGE__-add_columns( id, { data_type = INT, default_value = undef, is_nullable = 0, size = 11 }, name, { data_type = VARCHAR, default_value = undef, is_nullable = 0, size = 90, }, parent, { data_type = INT, default_value = undef, is_nullable = 1, size = 11 }, ); __PACKAGE__-set_primary_key(id); __PACKAGE__-belongs_to( parent = 'MyApp::Schema::DB::Result::Group' = 'parent' ); __PACKAGE__-has_many( subgroups = 'MyApp::Schema::DB::Result::Group', { 'foreign.parent' = 'self.id' }, { order_by = 'name' }, ); So when there's an ID number in parent the current group object has a parent group object. When there's no ID (or it's zero) then that's the top-level group in its hierarchy. Creating a method for the top-level group is simple: sub top { my $self = shift; my $top = $self; while ( $self = $self-parent ) { $top = $self; } return $top; } If we're looking for a certain PARENT with a given ID, that's simple too: sub specific_parent { my $self = shift; my $id = shift; while( $self-id != $id ) { return unless $self = $self-parent; } return $self; } But how do we go about creating a method to look for a specific group by ID that may not be in the parent-chain? sub specific_group { my $self = shift; my $id = shift; return unless $self-some_manner_of_valid_id_check( $id ); return $self-BLACK_MAGIC_HERE-find( {id=$id} ); } So the real question is, how do we get from $self to -find() ? ___ 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] How to get from
Thanks, Tom -- But this apparently isn't a result-class, or I'm just missing something obvious: DB5 p __PACKAGE__ MyApp::Schema::DB::Result::Group DB7 p $self MyApp::Model::MyApp::Group DB8 p $self-resultset Can't locate object method resultset via package MyApp::Model::MyApp::Group === Working from the context of a Catalyst app, I'm not sure I'd be able to properly abstract the right question for the DBIC list (or be able to apply the answer back to my concrete catalyst app). :) Folks on this list have been delightfully helpful despite us newbie-questions, especially you... Plus, being rather new to Catalyst, it's difficult to see where the edges are between Catalyst, DBIC and Moose. On Sat, Sep 18, 2010 at 3:38 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 18 Sep 2010, at 17:00, will trillich wrote: So the real question is, how do we get from $self to -find() ? From a result class, $self-resultset-find is probably what you want. You should also probably be asking questions about DBIx::Class on the DBIx::Class list, not the Catalyst list. 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/ ___ 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] How to get from
Ah -- yes indeed, that did the trick. That chain was a bit longer than I could put together on my own. Thanks! On Sat, Sep 18, 2010 at 7:05 PM, Steve Nolte st...@redanvil.net wrote: Agreed that this is a DBIx::Class question, but I think you want something like: $self-result_source-schema-resultset('NAME_OF_RESULTSET_YOU_WANT')-find($id) ___ 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/