Tuesday, November 10, 2009

[Catalyst] Catalyst & E-Commerce

Hello,

After looking around I've found Handel and built on top of it Mango.
Is there any other e-commerce modules/solutions/etc based on Catalyst?
Who uses Mango&Handel in their own project - can comment anything?
Both projects seems to be non actively developed. Is it means dead-end
or perfect solution? =) Well, anything on e-commerce and catalyst is
very appreciated!


Regards,
Pavel

_______________________________________________
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] Trouble inserting data after migrate database from SQLite to My SQL

>
>
>
> This is a DBIC question, as such the answer is clearly found in the
> DBIC manual:
> http://search.cpan.org/~ribasushi/DBIx-Class-0.08112/lib/DBIx/Class/ResultSet.pm#find_or_new
>
> To summarize, ->new or ->find_or_new will not create a record in the
> database (and as such, no id is available). If you want to create a
> record, triggering the auto_increment, then you must use create or a
> subsequent ->insert after a ->new call.
>
>
> Also of note, DBIx::Class has its own mailing list that you should
> consider subscribing to.
>
> Thanks,
> -Jay
> _______________________________________________
> 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/

First of all, my apologies I've changed the subject of my previous
message and due to that, now it's not placed where it have to be.

With your permission (I wish), I copy & paste my answer to Steve:

"> Is your 'id' set to auto-increment???
Yes, it is.

> What data type is it? I usually
> set the 'id' to auto-increment, and set it as an integer.
I also do it.

> I would also
> recommend using DBIC_TRACE=1 from the command line if possible to get
a
> better description of the actual problem.

> Steve
>

Thank you, very much. DBIC_TRACE=1 have provided me the following error:
"No _dbh_last_insert_id() method found in DBIx::Class::Storage::DBI.
Since the method of obtaining the autoincrement id of the last insert
operation varies greatly between different databases, this method must
be individually implemented for every storage class."

I've made a quick search, and I've found:
http://rt.cpan.org/Public/Bug/Display.html?id=40265#txn-566706

I've upgraded my version of DBIx::Class and it's all working again.

Cheers

Jordi"

You're right Jay, it was a DBIx::Class issue. Thank you, for answering.

Jordi

_______________________________________________
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] Trouble inserting data after migrate database from SQLite to My SQL



On Tue, Nov 10, 2009 at 5:53 AM, Jordi AmorĂ³s <jamoros@etsetb.upc.edu> wrote:
Hi all,

I'm developing a little web application (a remote lab that works with
Catalyst+LabView). Until now I was using SQLite, but due to new
requirements I've had to migrate the database.

I've created a new model:
perl script/ilabrs_create.pl model DB DBIC::Schema ilabrs::Schema
create=static components=TimeStamp,EncodedColumn dbi:mysql:ilabrs

and then, after restarting the server all seemed to work. Actually,
list, edit and erase from the database is working fine. But when I want
to add data, it doesn't work.

The problem appears when an id it's not provided. If I'm not wrong,
"my $exp = $c->model('DB::Activitats')-> find_or_new({id=> $id});"
should solve that. But: "$c->log->debug("Experiment ID:".$exp->id);",
prints nothing.
 
I'm absolutely clueless. I've tried to split de edit function in two:
-one to actually edit (my $exp = $c->model('DB::Activitats')->
find({id=> $id});) which still works properly.

-and a second one to add (my $exp = $c->model('DB::Activitats')->
new({});) which doesn't because $exp->id is empty and
$exp->update_or_insert;
cause an exception:

DBI Exception: DBD::mysql::st execute failed: Column 'id' cannot be
null...

Any suggestion, idea, clue... will be welcome.

Thanks,


This is a DBIC question, as such the answer is clearly found in the DBIC manual:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08112/lib/DBIx/Class/ResultSet.pm#find_or_new

To summarize, ->new or ->find_or_new will not create a record in the database (and as such, no id is available).  If you want to create a record, triggering the auto_increment, then you must use create or a subsequent ->insert after a ->new call.

Also of note, DBIx::Class has its own mailing list that you should consider subscribing to.

Thanks,
-Jay

Re: [Catalyst] Trouble inserting data after migrate database from SQLite to MySQL

Re: [Catalyst] Trouble inserting data after migrate database from SQLite to My SQL

Jordi Amorós wrote:
> Hi all,
>
> I'm developing a little web application (a remote lab that works with
> Catalyst+LabView). Until now I was using SQLite, but due to new
> requirements I've had to migrate the database.
>
> I've created a new model:
> perl script/ilabrs_create.pl model DB DBIC::Schema ilabrs::Schema
> create=static components=TimeStamp,EncodedColumn dbi:mysql:ilabrs
>
> and then, after restarting the server all seemed to work. Actually,
> list, edit and erase from the database is working fine. But when I want
> to add data, it doesn't work.
>
> The problem appears when an id it's not provided. If I'm not wrong,
> "my $exp = $c->model('DB::Activitats')-> find_or_new({id=> $id});"
> should solve that. But: "$c->log->debug("Experiment ID:".$exp->id);",
> prints nothing.
>
> I'm absolutely clueless. I've tried to split de edit function in two:
> -one to actually edit (my $exp = $c->model('DB::Activitats')->
> find({id=> $id});) which still works properly.
>
> -and a second one to add (my $exp = $c->model('DB::Activitats')->
> new({});) which doesn't because $exp->id is empty and
> $exp->update_or_insert;
> cause an exception:
>
> DBI Exception: DBD::mysql::st execute failed: Column 'id' cannot be
> null...
>
> Any suggestion, idea, clue... will be welcome.
>
> Thanks,
>
> Jordi
>
>
>
>
>
>
>
>
> _______________________________________________
> 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/
>
>
>
Is your 'id' set to auto-increment??? What data type is it? I usually
set the 'id' to auto-increment, and set it as an integer. I would also
recommend using DBIC_TRACE=1 from the command line if possible to get a
better description of the actual problem.

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/

[Catalyst] Trouble inserting data after migrate database from SQLite to My SQL

Hi all,

I'm developing a little web application (a remote lab that works with
Catalyst+LabView). Until now I was using SQLite, but due to new
requirements I've had to migrate the database.

I've created a new model:
perl script/ilabrs_create.pl model DB DBIC::Schema ilabrs::Schema
create=static components=TimeStamp,EncodedColumn dbi:mysql:ilabrs

and then, after restarting the server all seemed to work. Actually,
list, edit and erase from the database is working fine. But when I want
to add data, it doesn't work.

The problem appears when an id it's not provided. If I'm not wrong,
"my $exp = $c->model('DB::Activitats')-> find_or_new({id=> $id});"
should solve that. But: "$c->log->debug("Experiment ID:".$exp->id);",
prints nothing.

I'm absolutely clueless. I've tried to split de edit function in two:
-one to actually edit (my $exp = $c->model('DB::Activitats')->
find({id=> $id});) which still works properly.

-and a second one to add (my $exp = $c->model('DB::Activitats')->
new({});) which doesn't because $exp->id is empty and
$exp->update_or_insert;
cause an exception:

DBI Exception: DBD::mysql::st execute failed: Column 'id' cannot be
null...

Any suggestion, idea, clue... will be welcome.

Thanks,

Jordi


_______________________________________________
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/

Monday, November 9, 2009

Re: [Catalyst] Can't redirect using $c->res->redirect()

Tomas Doran wrote:
> Emmanuel Quevillon wrote:
>> [Fri Nov 6 15:36:13 2009] [error] Caught exception in engine "Can't
>> call method "as_string" on an undefined value at
>> /usr/local/share/perl/5.10.0/Catalyst/Engine.pm line 95."
>
> Can you start your server with perl -MDevel::SimpleTrace
> script/myapp_server.pl -d
>
> and attach the full app startup, and the request which breaks (which
> should now include a full stack trace in its error).
>
> Thanks.
> t0m
>

Hi Tomas,

Here is the log generated :

[Mon Nov 9 10:08:03 2009] [info] [tuco,localhost,x,x] Logging out
[Mon Nov 9 10:08:03 2009] [debug] Deleting session(User logging out)
[Mon Nov 9 10:08:03 2009] [debug] Redirecting to
"http://localhost:3000/login"
[Mon Nov 9 10:08:03 2009] [error] Caught exception in engine "Can't
call method "as_string" on an undefined value
at
Catalyst::Engine::finalize_cookies(/usr/local/share/perl/5.10.0/Catalyst/Engine.pm:95)
at
Catalyst::finalize_cookies(/usr/local/share/perl/5.10.0/Catalyst.pm:1700)
at
Catalyst::finalize_headers(/usr/local/share/perl/5.10.0/Catalyst.pm:1763)
at
Catalyst::Plugin::Session::finalize_headers(/usr/local/share/perl/5.10.0/Catalyst/Plugin/Session.pm:99)
at
Catalyst::finalize(/usr/local/share/perl/5.10.0/Catalyst.pm:1666)
at
Catalyst::Plugin::FillInForm::finalize(/usr/local/share/perl/5.10.0/Catalyst/Plugin/FillInForm.pm:67)
at
Catalyst::Plugin::Static::Simple::finalize(/usr/local/share/perl/5.10.0/Catalyst/Plugin/Static/Simple.pm:80)
at <eval>(/usr/local/share/perl/5.10.0/Catalyst.pm:1829)
at
Catalyst::handle_request(/usr/local/share/perl/5.10.0/Catalyst.pm:1819)
at
Catalyst::Engine::HTTP::_handler(/usr/local/share/perl/5.10.0/Catalyst/Engine/HTTP.pm:394)
at
Catalyst::Engine::HTTP::run(/usr/local/share/perl/5.10.0/Catalyst/Engine/HTTP.pm:291)
at Catalyst::run(/usr/local/share/perl/5.10.0/Catalyst.pm:2121)
at main::__ANON__(script/bibliolist_server.pl:68)
at
Catalyst::Restarter::Forking::_fork_and_start(/usr/local/share/perl/5.10.0/Catalyst/Restarter/Forking.pm:20)
at
Catalyst::Restarter::run_and_watch(/usr/local/share/perl/5.10.0/Catalyst/Restarter.pm:68)
at main::(script/bibliolist_server.pl:104)"

Just to add a little more info, when on the blank page after
clicking 'Logout' button, if I do a 'reload' in my browser, I am
redirected to the login page as expected and this is the following
log generated :

[Mon Nov 9 10:08:31 2009] [info] *** Request 7 (0.135/s) [5954]
[Mon Nov 9 10:08:31 2009] ***
[Mon Nov 9 10:08:31 2009] [debug] "GET" request for "logout" from
"127.0.0.1"
[Mon Nov 9 10:08:31 2009] [debug] Path is "logout"
[Mon Nov 9 10:08:31 2009] [debug] Found sessionid
"fcd469f228156f819cf7d7ab3b8742ceaf444388" in cookie
[Mon Nov 9 10:08:31 2009] [debug] Deleting session(session expired)
[Mon Nov 9 10:08:31 2009] [debug] Redirecting to
"http://localhost:3000/login"
[Mon Nov 9 10:08:31 2009] [info] Request took 0.028152s (35.521/s)
.------------------------------------------------------------+-----------.
| Action | Time
|
+------------------------------------------------------------+-----------+
| /auto |
0.006261s |
| /end |
0.000699s |
'------------------------------------------------------------+-----------'


[Mon Nov 9 10:08:31 2009] [info] *** Request 8 (0.154/s) [5954]
[Mon Nov 9 10:08:31 2009] ***
[Mon Nov 9 10:08:31 2009] [debug] "GET" request for "login" from
"127.0.0.1"
[Mon Nov 9 10:08:31 2009] [debug] Path is "login"
[Mon Nov 9 10:08:31 2009] [debug] Rendering template "login.tt2"
[Mon Nov 9 10:08:31 2009] [debug] Created session
"d3461d4598946c79a5a95e095672819fa6c09bef"
[Mon Nov 9 10:08:32 2009] [info] Request took 0.058135s (17.201/s)
.------------------------------------------------------------+-----------.
| Action | Time
|
+------------------------------------------------------------+-----------+
| /auto |
0.001886s |
| /login/index |
0.000486s |
| /end |
0.032852s |
| -> BiblioList::View::TT->process |
0.030826s |
'------------------------------------------------------------+-----------'


Thanks for your time

Regards

Emmanuel

--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------

_______________________________________________
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/