Re: [Catalyst] Using Komodo to edit/debug Catalyst
While I don't do my debugging inside the IDE, I'm happy with what IntelliJ IDEA's Perl plugin does. Before that, I was using Komodo same as you. 2016-12-11 5:17 GMT+02:00 Kieren Diment: > I just use perl -d from the console. > > perl -d script/myapp.pl (or more modernly perl -d `which plackup` > myapp.psgi) and set breakpoints in the code with $DB::single=1 as > required. See also LWP::Protocol::PSGI for serverless psgi deployment > mainly for use in test scripts. > > On Sun, Dec 11, 2016 at 7:45 AM, Ken Beal wrote: > >> Hi, >> >> Years ago I used the ActiveState IDE Komodo to work with Catalyst. I'd >> like to do this again, but am no longer at that employer so can't check the >> settings. >> >> I asked at the ActiveState Komodo forums but haven't gotten a good answer >> (last was "compare the env vars" which I did but didn't see any real >> differences, other than x86/x64, as Komodo appears to be an x86 app). >> http://community.komodoide.com/t/how-to-edit-catalyst-sourc >> e-files-with-proper-syntax-checking/3204/7 >> >> I figure asking here might provide a better answer since people here are >> "debugging Catalyst apps" so should be able to provide pointers to how to >> do so. (Versus Komodo being used to debug a whole bunch of other stuff, >> i.e., I might have better luck with the domain knowledge here.) >> >> Thanks, >> Ken >> -- >> "Look at what's happened to me; >> I can't believe it myself!" >> >> ___ >> List: Catalyst@lists.scsys.co.uk >> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst >> Searchable archive: http://www.mail-archive.com/ca >> tal...@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/ > > -- Nothing is ever easy ___ 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 Komodo to edit/debug Catalyst
I just use perl -d from the console. perl -d script/myapp.pl (or more modernly perl -d `which plackup` myapp.psgi) and set breakpoints in the code with $DB::single=1 as required. See also LWP::Protocol::PSGI for serverless psgi deployment mainly for use in test scripts. On Sun, Dec 11, 2016 at 7:45 AM, Ken Bealwrote: > Hi, > > Years ago I used the ActiveState IDE Komodo to work with Catalyst. I'd > like to do this again, but am no longer at that employer so can't check the > settings. > > I asked at the ActiveState Komodo forums but haven't gotten a good answer > (last was "compare the env vars" which I did but didn't see any real > differences, other than x86/x64, as Komodo appears to be an x86 app). > http://community.komodoide.com/t/how-to-edit-catalyst- > source-files-with-proper-syntax-checking/3204/7 > > I figure asking here might provide a better answer since people here are > "debugging Catalyst apps" so should be able to provide pointers to how to > do so. (Versus Komodo being used to debug a whole bunch of other stuff, > i.e., I might have better luck with the domain knowledge here.) > > Thanks, > Ken > -- > "Look at what's happened to me; > I can't believe it myself!" > > ___ > 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] Using Komodo to edit/debug Catalyst
Hi, Years ago I used the ActiveState IDE Komodo to work with Catalyst. I'd like to do this again, but am no longer at that employer so can't check the settings. I asked at the ActiveState Komodo forums but haven't gotten a good answer (last was "compare the env vars" which I did but didn't see any real differences, other than x86/x64, as Komodo appears to be an x86 app). http://community.komodoide.com/t/how-to-edit-catalyst-source-files-with-proper-syntax-checking/3204/7 I figure asking here might provide a better answer since people here are "debugging Catalyst apps" so should be able to provide pointers to how to do so. (Versus Komodo being used to debug a whole bunch of other stuff, i.e., I might have better luck with the domain knowledge here.) Thanks, Ken -- "Look at what's happened to me; I can't believe it myself!" ___ 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 database defaults with FormHandler and DBIC
My email coding has some syntax errors, apologies. On Sat, Dec 10, 2016 at 4:50 PM, LNATION .wrote: > and then make a role role > > has default_column_spec => ( ...) > > before render => sub { > while (my ($field, $default) = each %{ $_[0]->default_column_spec}{ > unless ($_[0]->field($filed)->value) { # mayb editing > $_[0]->field('$field)->value($default); >} > } > } > > > On Sat, Dec 10, 2016 at 4:41 PM, LNATION . > wrote: > >> maybe something like .. >> >> my $columns = $result->result_source->columns_info; >> my %default_form_spec; >> for my $name (keys %{$columns}){ >> if (my $default = $columns->{$name}->{default_value}) { >> $default_form_spec{ $name } = $default; >> } >> } >> >> >> > ___ 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 database defaults with FormHandler and DBIC
and then make a role role has default_column_spec => ( ...) before render => sub { while (my ($field, $default) = each %{ $_[0]->default_column_spec}{ unless ($_[0]->field($filed)->value) { # mayb editing $_[0]->field('$field)->value($default); } } } On Sat, Dec 10, 2016 at 4:41 PM, LNATION .wrote: > maybe something like .. > > my $columns = $result->result_source->columns_info; > my %default_form_spec; > for my $name (keys %{$columns}){ > if (my $default = $columns->{$name}->{default_value}) { > $default_form_spec{ $name } = $default; > } > } > > > ___ 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 database defaults with FormHandler and DBIC
maybe something like .. my $columns = $result->result_source->columns_info; my %default_form_spec; for my $name (keys %{$columns}){ if (my $default = $columns->{$name}->{default_value}) { $default_form_spec{ $name } = $default; } } ___ 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 database defaults with FormHandler and DBIC
Also form definition looks like this: has 'formDetail' => (isa => 'reha::Form::LessonDetail', is => 'rw', lazy => 1, default => sub {reha::Form::LessonDetail->new }); Is that right in case I would like to have database defaults used after process()? Regards -- M. On 2016.12.10 15:36:10 +0100, Martin Řehák wrote: > Hi Gerda, > > sorry for late reply. Didn't have time to look into this. > > Now I have: > > my $init_row = $c->model('DB::Lesson')->new_result({}); > $validated = $self->formDetail->process(item => $init_row); > > And I still don't see the database defaults in the rendered form. Any clue > where to look now? > > Thank you > -- > Martin > > On 2016.11.01 12:22:15 -0400, Gerda Shank wrote: > > A database row is used for defaults only if it is provided in the ‘item’ > > attribute. If you provide only the item_id and item_class they are used to > > update the row but not for defaults. > > > > Gerda > > > > > > On Mon, Oct 31, 2016 at 12:00 PM, Martin Rehakwrote: > > > > > Hi, > > > > > > thanks much for comments. > > > > > > I know there are number of ways how/where to set/define defaults from app > > > code > > > and there is large text written about it in Catalyst documentation. > > > > > > What I would expect to work at least is that database default is going to > > > be > > > propagated into the form from the schema definition. I don't need to have > > > the > > > second place with explicit default definition when there is and implicit > > > definition coming from db. > > > > > > In other words: > > > $ script/reha_create.pl model DB DBIC::Schema reha::Schema create=static > > > 'dbi:Pg:dbname=;host=' reha > > > > > > generates > > > > > > =head2 capacity > > > > > > data_type: 'integer' > > > default_value: 1 > > > is_nullable: 1 > > > > > > and there is the default definition successfully fetched from db. How to > > > get it > > > used without any override (and duplication) in the app code? > > > > > > Thank you very much in advance. > > > > > > Regards > > > -- > > > Martin > > > > > > On 2016.10.31 09:23:26 +, LNATION . wrote: > > > > Probs incorrect approach but it'll work > > > > > > > > before render => sub { > > > > unless ($_[0]->field('capacity')->value) { # mayb editing > > > > $_[0]->field('capacity')->value(1); > > > > } > > > > } > > > > > > > > On Mon, Oct 31, 2016 at 8:28 AM, Marc0 > > > wrote: > > > > > > > > > Am 31.10.2016 um 09:15 schrieb Marc0: > > > > > > Am 31.10.2016 um 08:57 schrieb Martin Rehak: > > > > > >> has_field 'capacity' => (type => 'PosInteger', > > > > > >> #default => '1', > > > > > >> label => 'Kapacita'); > > > > > > > > > > > > maybe add a "lazy => 1" to your commented "default => '1'"? > > > > > > > > > > > > has_field q(capacity) => ( > > > > > > type=> q(PosInteger), > > > > > > lazy=> 1, > > > > > > default => q(1), > > > > > > label => q(Kapacita), > > > > > > ); > > > > > > > > > > maybe "capacity" is explicitely set to undef, you could try an > > > > > "around" > > > > > method modifier to check for a defined value: > > > > > > > > > > has_field q(capacity) => ( > > > > > is => q(ro), # just guessing > > > > > type=> q(PosInteger), > > > > > lazy=> 1, > > > > > default => q(1), > > > > > label => q(Kapacita), > > > > > writer => q(_set_default_capacity), > > > > > ); > > > > > > > > > > # untested, but according to Moose::Manual::MethodModifiers > > > > > around q(has_field) => sub { > > > > > my $orig = shift; > > > > > my $self = shift; > > > > > > > > > > # check for definedness and set to default value if > > > > > # not defined (NULL) > > > > > $self->_set_default_capacity(1) > > > > > unless defined $self->$orig(); > > > > > > > > > > return $self->$orig(); > > > > > }; > > > > > > > > > > Regards > > > > > -- > > > > > Marc0 > > > > > > > > > > ___ > > > > > List: Catalyst@lists.scsys.co.uk > > > > > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > > > > > Searchable archive: http://www.mail-archive.com/ > > > > > catalyst@lists.scsys.co.uk/ > > > > > Dev site: http://dev.catalyst.perl.org/ > > > > > > > > > > > > ___ > > > > List: Catalyst@lists.scsys.co.uk > > > > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > > > > Searchable archive: http://www.mail-archive.com/ > > > catalyst@lists.scsys.co.uk/ > > > > Dev site: http://dev.catalyst.perl.org/ > > > > > > > > > ___ > > > List: Catalyst@lists.scsys.co.uk > > > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > > > Searchable archive: http://www.mail-archive.com/ > > > catalyst@lists.scsys.co.uk/ > > > Dev site: http://dev.catalyst.perl.org/ > > > > > >
Re: [Catalyst] No database defaults with FormHandler and DBIC
Hi Gerda, sorry for late reply. Didn't have time to look into this. Now I have: my $init_row = $c->model('DB::Lesson')->new_result({}); $validated = $self->formDetail->process(item => $init_row); And I still don't see the database defaults in the rendered form. Any clue where to look now? Thank you -- Martin On 2016.11.01 12:22:15 -0400, Gerda Shank wrote: > A database row is used for defaults only if it is provided in the ‘item’ > attribute. If you provide only the item_id and item_class they are used to > update the row but not for defaults. > > Gerda > > > On Mon, Oct 31, 2016 at 12:00 PM, Martin Rehakwrote: > > > Hi, > > > > thanks much for comments. > > > > I know there are number of ways how/where to set/define defaults from app > > code > > and there is large text written about it in Catalyst documentation. > > > > What I would expect to work at least is that database default is going to > > be > > propagated into the form from the schema definition. I don't need to have > > the > > second place with explicit default definition when there is and implicit > > definition coming from db. > > > > In other words: > > $ script/reha_create.pl model DB DBIC::Schema reha::Schema create=static > > 'dbi:Pg:dbname=;host=' reha > > > > generates > > > > =head2 capacity > > > > data_type: 'integer' > > default_value: 1 > > is_nullable: 1 > > > > and there is the default definition successfully fetched from db. How to > > get it > > used without any override (and duplication) in the app code? > > > > Thank you very much in advance. > > > > Regards > > -- > > Martin > > > > On 2016.10.31 09:23:26 +, LNATION . wrote: > > > Probs incorrect approach but it'll work > > > > > > before render => sub { > > > unless ($_[0]->field('capacity')->value) { # mayb editing > > > $_[0]->field('capacity')->value(1); > > > } > > > } > > > > > > On Mon, Oct 31, 2016 at 8:28 AM, Marc0 > > wrote: > > > > > > > Am 31.10.2016 um 09:15 schrieb Marc0: > > > > > Am 31.10.2016 um 08:57 schrieb Martin Rehak: > > > > >> has_field 'capacity' => (type => 'PosInteger', > > > > >> #default => '1', > > > > >> label => 'Kapacita'); > > > > > > > > > > maybe add a "lazy => 1" to your commented "default => '1'"? > > > > > > > > > > has_field q(capacity) => ( > > > > > type=> q(PosInteger), > > > > > lazy=> 1, > > > > > default => q(1), > > > > > label => q(Kapacita), > > > > > ); > > > > > > > > maybe "capacity" is explicitely set to undef, you could try an "around" > > > > method modifier to check for a defined value: > > > > > > > > has_field q(capacity) => ( > > > > is => q(ro), # just guessing > > > > type=> q(PosInteger), > > > > lazy=> 1, > > > > default => q(1), > > > > label => q(Kapacita), > > > > writer => q(_set_default_capacity), > > > > ); > > > > > > > > # untested, but according to Moose::Manual::MethodModifiers > > > > around q(has_field) => sub { > > > > my $orig = shift; > > > > my $self = shift; > > > > > > > > # check for definedness and set to default value if > > > > # not defined (NULL) > > > > $self->_set_default_capacity(1) > > > > unless defined $self->$orig(); > > > > > > > > return $self->$orig(); > > > > }; > > > > > > > > Regards > > > > -- > > > > Marc0 > > > > > > > > ___ > > > > 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/ > > > ___ > 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/