Re: [Catalyst] command in Catalyst tute part 4 for generating schema files (static creation) using DBIx::Class::TimeStamp needs tobeupdated

2009-03-21 Thread hkclark
On Sat, Mar 21, 2009 at 6:16 PM, Octavian Râsnita  wrote:
> From: 
> On Sat, Mar 21, 2009 at 11:08 AM, Octavian Râsnita 
> wrote:
>>
>> Kennedy
>>
>> Yes it works that way, but it doesn't create the Result directory and it
>> doesn't store the result classes in it. It just updates the old classes.
>> But if I delete the old classes, or at least the old schema class, it
>> creates the "Result" directory and put them in it, and it also creates the
>> new schema class which uses load_namespaces().
>> But in this second case, it doesn't remember what was after "do not modify
>> this or anything above" in the result classes, and the update should be
>> done
>> manually.
>>
>> And I don't know if this is the expected behaviour or there is a bug or I
>> am
>> doing something wrong.
>>
>> Octavian
>>
>
> Are you using v0.23 of Catalyst::Model::DBIC::Schema:
>
> perl -MCatalyst::Model::DBIC::Schema -e \
>       'print "$Catalyst::Model::DBIC::Schema::VERSION\n"'
>
> If so, it should create the Result directory and use load_namespaces
> instead of load_classes.
>
> If you are seeing something different, please let us know, but my
> understanding is that v0.23 should do load_namespaces by default.
>
> Thanks,
> Kennedy
>
> Yes, I use that version:
>
> C:\Documents and Settings\Octavian>perl -MCatalyst::Model::DBIC::Schema -e
> "print $Catalyst::Model::DBIC::Schema::VERSION"
> Subroutine initialize redefined at E:/perl510/site/lib/Class/C3.pm line 70.
> Subroutine uninitialize redefined at E:/perl510/site/lib/Class/C3.pm line
> 88.
> Subroutine reinitialize redefined at E:/perl510/site/lib/Class/C3.pm line
> 101.
> 0.23
>
> (With this occasion I've installed the latest version of Class::C3 and now
> those warnings don't appear anymore.)
>
> But I've tried again to re-create the result classes, however the schema
> class still uses load_classes() and the "Result" directory is not created.
>
> I've created another table in the database and I ran again the Catalyst
> helper, but the class for the new table is created in the same directory
> with the other classes, and still there is no Result directory created and
> the schema class still uses load_classes().
>
> If I delete at least the schema class file, the helper works fine and the
> new schema file uses load_namespaces() and the result classes are stored in
> the "Result" directory, but in that case what's after "do not modify this or
> anything above" is not remembered.
>
> I use:
> Windows XP Pro
> perl, v5.10.0 built for MSWin32-x86-multi-thread
> Catalyst::Helper::Model::DBIC::Schema version 0.23.
> DBIx::Class version 0.08008.
>
> (I've upgraded to DBIx::Class 0.08010 and tried again to create the class
> files, but with the same results.)
>
> I can't upgrade to the version 0.08012 because when I try to install
> DBIx::Class, it crashes the perl interpreter, and there is no ppm package
> for this version yet, but... is it important this upgrade?
>
> Octavian
>

Hi Octavian,

Thanks for the update.  If I'm reading your note correctly, it sounds
like it's working like it's supposed to.  As long as you have the
right version of C::M::DBIC::Schema, it will generate the Results
directory by default -- but "default" here assumes that there is not
an existing lib/MyApp/Schema.pm that uses load_classes -- if it finds
that it goes into "compatibility" mode and preserves what's there.
That's why the tutorial has you do an "rm lib/MyApp/Schema.pm" before
you run the "script/myapp_create.pl model ..." command.

Also, it won't carry over the stuff below the "do not modify" line
from the old files in "lib/MyApp/Schema" to the new files in
"lib/MyApp/Schema/Result".  See the note at the bottom of the "Create
Static DBIC Schema Files" section in MoreCatalystBasics.pod where it
explains that you have to migrate it manually or using something like
the "perl -MIO::All -e ..." script it provides.

Let me know if I'm missing you point or not making sense -- I
certainly want to know if something is wrong with the tut that I need
to fix.  But I *think* you are saying that it's working like it's
supposed to.

Regards,
Kennedy

___
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] command in Catalyst tute part 4 for generatingschema files (static creation) using DBIx::Class::TimeStamp needstobeupdated

2009-03-21 Thread Octavian Râsnita

From: "Matthew Topper" 
While we're on this subject, can someone tell me if I'm doing this 
correctly?


Evereytime I change my database structure, I run the following command:

script/myapp_create.pl model DB DBIC::Schema MyApp::DB create=static 
dbi:mysql::localhost "" ''


Substituting 'myapp' with my application name, of course.  This seems to 
work correctly, but I'm curious if this is the 'right' way to do this.


Thanks!



Yes, it is correct.

Octavian


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] command in Catalyst tute part 4 for generating schema files (static creation) using DBIx::Class::TimeStamp needs tobeupdated

2009-03-21 Thread Matthew Topper
While we're on this subject, can someone tell me if I'm doing this correctly?

Evereytime I change my database structure, I run the following command:

script/myapp_create.pl model DB DBIC::Schema MyApp::DB create=static 
dbi:mysql::localhost "" ''

Substituting 'myapp' with my application name, of course.  This seems to work 
correctly, but I'm curious if this is the 'right' way to do this.

Thanks!

-- 
Matthew Topper 

___
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: how to authenticate using database users

2009-03-21 Thread Aristotle Pagaltzis
* Jonathan Rockway  [2009-03-20 13:05]:
> There is no reason to throw away good software engineering
> principles simply because someone mentioned the word
> "database".

I appreciate the humour. :-)

Regards,
-- 
Aristotle Pagaltzis // 

___
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] command in Catalyst tute part 4 for generating schema files (static creation) using DBIx::Class::TimeStamp needs tobeupdated

2009-03-21 Thread Octavian Râsnita

From: 
On Sat, Mar 21, 2009 at 11:08 AM, Octavian Râsnita  
wrote:

Kennedy

Yes it works that way, but it doesn't create the Result directory and it
doesn't store the result classes in it. It just updates the old classes.
But if I delete the old classes, or at least the old schema class, it
creates the "Result" directory and put them in it, and it also creates the
new schema class which uses load_namespaces().
But in this second case, it doesn't remember what was after "do not modify
this or anything above" in the result classes, and the update should be 
done

manually.

And I don't know if this is the expected behaviour or there is a bug or I 
am

doing something wrong.

Octavian



Are you using v0.23 of Catalyst::Model::DBIC::Schema:

perl -MCatalyst::Model::DBIC::Schema -e \
   'print "$Catalyst::Model::DBIC::Schema::VERSION\n"'

If so, it should create the Result directory and use load_namespaces
instead of load_classes.

If you are seeing something different, please let us know, but my
understanding is that v0.23 should do load_namespaces by default.

Thanks,
Kennedy

Yes, I use that version:

C:\Documents and Settings\Octavian>perl -MCatalyst::Model::DBIC::Schema -e 
"print $Catalyst::Model::DBIC::Schema::VERSION"

Subroutine initialize redefined at E:/perl510/site/lib/Class/C3.pm line 70.
Subroutine uninitialize redefined at E:/perl510/site/lib/Class/C3.pm line 
88.
Subroutine reinitialize redefined at E:/perl510/site/lib/Class/C3.pm line 
101.

0.23

(With this occasion I've installed the latest version of Class::C3 and now 
those warnings don't appear anymore.)


But I've tried again to re-create the result classes, however the schema 
class still uses load_classes() and the "Result" directory is not created.


I've created another table in the database and I ran again the Catalyst 
helper, but the class for the new table is created in the same directory 
with the other classes, and still there is no Result directory created and 
the schema class still uses load_classes().


If I delete at least the schema class file, the helper works fine and the 
new schema file uses load_namespaces() and the result classes are stored in 
the "Result" directory, but in that case what's after "do not modify this or 
anything above" is not remembered.


I use:
Windows XP Pro
perl, v5.10.0 built for MSWin32-x86-multi-thread
Catalyst::Helper::Model::DBIC::Schema version 0.23.
DBIx::Class version 0.08008.

(I've upgraded to DBIx::Class 0.08010 and tried again to create the class 
files, but with the same results.)


I can't upgrade to the version 0.08012 because when I try to install 
DBIx::Class, it crashes the perl interpreter, and there is no ppm package 
for this version yet, but... is it important this upgrade?


Octavian


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Browser still waiting after completed transfer

2009-03-21 Thread Christian Lackas
* Andrew Rodland  [090321 22:29]:

Hi Andrew,

> Are you running mod_deflate as well? 

not that I was aware of. However since disabling this line 

# AddOutputFilterByType DEFLATE text/html text/plain text/xml

fixed the problem, you were apparently 100% right. Thanks a lot.

Christian


___
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] Browser still waiting after completed transfer

2009-03-21 Thread Andrew Rodland
On Saturday 21 March 2009 04:12:48 pm Christian Lackas wrote:
> Hi Everybody,
>
> currently have a strange problem with a Catalyst app, which I developed
> on Gentoo Linux and now try to deploy on Debian/Lenny. On Debian, the
> browser (Firefox) waits a couple of seconds (~10s) after it has already
> received all content (as shown by Firebug), apparently still waiting for
> something (but Firebug does not show anything else).
> Is it possible that I get a wrong Content-Length header and thus the
> browser waits for the web page to be completely transferred too long?
> Don't see this on Gentoo.
>
> Apache/2.2.9 (Debian) mod_fastcgi/2.4.6 PHP/5.2.6-1+lenny2 with
> Suhosin-Patch This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
> Module  = Catalyst::Runtime (MRAMBERG/Catalyst-Runtime-5.71000.tar.gz)

Are you running mod_deflate as well? There's a known bug in mod_fastcgi that 
causes exactly this kind of problem if mod_deflate is in front of it. It can 
be solved by disabling mod_deflate or ensuring that it won't process any 
content that mod_fastcgi serves, or by building and installing mod_fastcgi-
SNAP-0811090952.tar.gz

Andrew


___
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] Too many records returned

2009-03-21 Thread Moritz Onken


I think you need to retrieve that object after ->update() again:




Character.pm
---
sub character : Local FormConfig('character/character.yml') {
 my ($self, $c, $id) = @_;

 my $book;

 if (defined($id)) {

 $book = $c->model('DB::Character')->find($id);

 unless ($book) {
 $c->stash->{error_msg} = "Invalid Character record --  
Cannot edit";

 $c->response->redirect($c->uri_for('list_character'));
 $c->detach;
 }
 } else {

 $book = $c->model('DB::Character')->new_result({});
 }

 my $form = $c->stash->{form};

 if ($form->submitted_and_valid) {
 $form->model->update($book);


  $book = $c->model('DB::Character')->find($book->id);


 $c->stash->{status_msg} = 'Record ammended';
 $c->response->redirect($c->uri_for('list_character'));
 $c->detach;
 } else {
 $form->model->default_values($book);
 }

 $c->stash->{given_title} = 'Edit Character';
 $c->stash->{template} = 'character/character.tt2';
}




___
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] Browser still waiting after completed transfer

2009-03-21 Thread Christian Lackas
Hi Everybody,

currently have a strange problem with a Catalyst app, which I developed
on Gentoo Linux and now try to deploy on Debian/Lenny. On Debian, the
browser (Firefox) waits a couple of seconds (~10s) after it has already
received all content (as shown by Firebug), apparently still waiting for
something (but Firebug does not show anything else).
Is it possible that I get a wrong Content-Length header and thus the
browser waits for the web page to be completely transferred too long?
Don't see this on Gentoo.

Apache/2.2.9 (Debian) mod_fastcgi/2.4.6 PHP/5.2.6-1+lenny2 with 
Suhosin-Patch
This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
Module  = Catalyst::Runtime (MRAMBERG/Catalyst-Runtime-5.71000.tar.gz)

My main problem right now is, that JavaScript is not started before the
DOMContentLoaded event.

Christian


___
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] command in Catalyst tute part 4 for generating schema files (static creation) using DBIx::Class::TimeStamp needs tobeupdated

2009-03-21 Thread hkclark
On Sat, Mar 21, 2009 at 11:08 AM, Octavian Râsnita  wrote:
> Kennedy
>
> Yes it works that way, but it doesn't create the Result directory and it
> doesn't store the result classes in it. It just updates the old classes.
> But if I delete the old classes, or at least the old schema class, it
> creates the "Result" directory and put them in it, and it also creates the
> new schema class which uses load_namespaces().
> But in this second case, it doesn't remember what was after "do not modify
> this or anything above" in the result classes, and the update should be done
> manually.
>
> And I don't know if this is the expected behaviour or there is a bug or I am
> doing something wrong.
>
> Octavian
>

Are you using v0.23 of Catalyst::Model::DBIC::Schema:

perl -MCatalyst::Model::DBIC::Schema -e \
'print "$Catalyst::Model::DBIC::Schema::VERSION\n"'

If so, it should create the Result directory and use load_namespaces
instead of load_classes.

If you are seeing something different, please let us know, but my
understanding is that v0.23 should do load_namespaces by default.

Thanks,
Kennedy

___
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] command in Catalyst tute part 4 for generating schema files (static creation) using DBIx::Class::TimeStamp needs tobeupdated

2009-03-21 Thread Octavian Râsnita

From: 
On Sun, Mar 15, 2009 at 1:06 PM, Octavian Râsnita  
wrote:

From: 
Please let me know if anyone has problems with this in the current
version of the tutorial (v5.7020):

http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial

The default behavior of Catalyst::Model::DBIC::Schema changed
recently. To avoid incompatibilities, the tutorial now has you
manually upgrade to at least v0.23 in "A Static Database Model With
DBIx::Class" of MoreCatalystBasics.pod and go straight to
load_namespaces (vs. first doing load_classes and migrating over). I
believe everything should be working as long as people make sure they
have the right version of Catalyst::Model::DBIC::Schema, but let me
know if people run into issues.

Thanks!
Kennedy

I've seen that if I remove the old Schema.pm and Schema directory and I 
use

the helper to re-create them, it works fine, or at least it creates the
files, because I haven't tested them yet.

But if I let them in their place and I use the helper to re-generate them,
no new file is created. Is this the way it should be?

Octavian



Hi Octavian,

Thanks for your note.  When you say "no new file is created" if you
don't delete them, what if you make a change to the database (as is
done in "EXPLORING THE POWER OF DBIC" of BasicCRUD.pod) and rerun it?
It should then reflect the DB changes to the stuff above the "DO NOT
MODIFY" line, but preserve everything below that line.

Let me know if you are seeing a different behavior.

Thanks!
Kennedy

Yes it works that way, but it doesn't create the Result directory and it 
doesn't store the result classes in it. It just updates the old classes.
But if I delete the old classes, or at least the old schema class, it 
creates the "Result" directory and put them in it, and it also creates the 
new schema class which uses load_namespaces().
But in this second case, it doesn't remember what was after "do not modify 
this or anything above" in the result classes, and the update should be done 
manually.


And I don't know if this is the expected behaviour or there is a bug or I am 
doing something wrong.


Octavian


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/