Re: [Catalyst] FormFu edit form problem

2009-05-19 Thread Greg Coates

I'm using HTML::FormFu::Model::DBIC version 0.04002, and this problem is
still there.  Do we know when a patch might be available?

Greg


Moritz Onken wrote:


Am 13.05.2009 um 18:57 schrieb Steve Rippl:

Thanks for the pointer.  I had defined the foreign key relationships 
within MySQL and relied on wsdsis_create.pl model DB DBIC::Schema etc 
etc to build the model and define these relations, but it seems that 
can't be quite be trusted!  Anyway, I'm taking them out of the db and 
manually putting them into the respective models and it's working now.


Thanks again!
Steve


There is a bug in the current version of HTML::FormFu::Model::DBIC which 
might have caused that error message. You might want to try to install 
version 0.04002 or wait until the patched version is avaiable.


moritz

___
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] More natural access to model?

2009-05-19 Thread Darren Duncan

Paweł Tęcza wrote:

Yes, I'm trying to think about my data as about the objects with
attributes and create simple and flexible database without data
redundancy. For example, I have tables for users and their roles,
studies, units, registrations. I also have tables for multilanguage
attributes of studies and units. Finally, I have tables for
relationships beetwen users and their roles, units and their attributes,
studies and their attributes, etc.

I'm very curious what database schema is the best for me in your
opinion. Of course, I don't ask you for desing of the whole database.
But could you please show me what tables I should create to store
information about studies? :)

Please remember that a study has a lot multilingual attributes (name,
description, duration, fee, etc) and non-multilingual attributes
(student limits, dean's office, its address, phone number, fax and web
site, study manager, his name, e-mail, and phone number, etc).


Though I haven't actually gotten around to implementing a multilingual app yet, 
I have thought these issues since long ago, so I'll summarize some principles here.


In the general case where the solution details are specific to each problem, the 
answer is to simply take the proper design of a unilingual schema, where each 
piece of information has its own table column, and add a new language-specifier 
column, and include this column in the table's key(s) so what used to be a 
single record is now allowed to be a multiplicity varying on the language.


And normalize appropriately to avoid redundant data.  Either by splitting each 
table with multilingual elements into 2 tables, with multilingual separated from 
unilingual (the multi gets the lang-spec column).  Or by turning each 
multilingual element or inter-dependent set of such into a collection-typed 
attribute of the single table.  Some SQL DBMSs support the latter, and all 
support the former; I'll demonstrate both.


For example, with 2 tables:

  CREATE TABLE studies (
study_id StudyID PRIMARY KEY,
unit_id UnitID,
status Status,
limit_soft Integer,
limit_hard Integer,
deans_office Text,
address Text,
phone Text,
fax Text,
web_addr Text,
...
  )

  CREATE TABLE studies_multilang_attrs (
study_id StudyID FOREIGN KEY REFERENCES studies (study_id),
lang Lang NOT NULL,
name Text,
description Text,
duration Text,
fee Text,
...,
PRIMARY KEY (study_id, lang)
  )

For example, with 1 table:

  CREATE TABLE studies (
study_id StudyID PRIMARY KEY,
unit_id UnitID,
status Status,
limit_soft Integer,
limit_hard Integer,
deans_office Text,
address Text,
phone Text,
fax Text,
web_addr Text,
...,
multilang_attrs TABLE (
  lang Lang PRIMARY KEY,
  name Text NOT NULL,
  description Text,
  duration Text,
  fee Text,
  ...,
)
  )

Hopefully those should be self-explanatory.

Now in a common special case of multi-lingual apps, where your user interface is 
data defined so for example the text strings you display to users such as 
greetings or prompt messages or form field names etc are stored in data, you 
could either take the same approach as above, or alternately you could invert 
the design and just have a single large strings table and then all other tables 
have foreign keys into it using message ids that each is in common for all 
language variants of the message.


For example:

  CREATE TABLE app_user_texts (
text_id Text NOT NULL,
lang Lang NOT NULL,
text Text NOT NULL,
PRIMARY KEY (text_id, lang)
  )

  CREATE TABLE app_form_fields (
field_name Text PRIMARY KEY,
field_label Text FOREIGN KEY REFERENCES app_user_texts (text_id),
input_constr_pattern Text,
constr_fail_msg Text FOREIGN KEY REFERENCES app_user_texts (text_id),
...
  )

Or alternately:

  CREATE TABLE app_form_fields (
field_name Text PRIMARY KEY,
field_label TABLE (
  lang Lang PRIMARY KEY,
  text Text NOT NULL
),
input_constr_pattern Text,
constr_fail_msg TABLE (
  lang Lang PRIMARY KEY,
  text Text NOT NULL
),
...
  )

Also self-explanatory I hope.  Regarding this design method, see also how Mac OS 
X works, how it does multi-lingual strings support in apps, but that I think it 
uses XML files instead of a SQL db but the principle is the same.  Similarly, 
this latter sort of design could just use app resource files in general to hold 
the strings, organized that way, rather than a SQL db.  Where a SQL db is useful 
is if your app is of the CMS variety where users are defining what app elements 
exist at runtime, and usually this info is stored in a database.


I hope that answers your question.  Mainly the first/general answer I think is 
more applicable in your case?


-- Darren Duncan

P.S.  My use of data types like StudyId and Lang etc aren't mistakes or just 
illustrations.  Besides the fact that the original examples d

Re: [Catalyst] Problem with column in DBI

2009-05-19 Thread Naylor Garcia
Thank you Very much,,,

Its working now!

2009/5/19 Павел Долженко 

>  my $change_color = [$c->model('database::dominio')->search(
> { id_domain => 21240, name => { like => 'naylor garcia' } },
>{columns => ['color']}
> )->first->color];
>
> HI,
>
> I need to make a select in database of the a specific column, but the
> result is a array. How I do to get a specific column?
>
> my $change_color = [$c->model('database::dominio')->search(
> { id_domain => 21240, name => { like => 'naylor garcia' } }
> )];
>
> Thank you ;)
>
> Naylor Garcia
>
> --
>
> ___
> 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] Problem with column in DBI

2009-05-19 Thread Michael Reddick
On Tue, May 19, 2009 at 2:40 PM, Naylor Garcia wrote:

> HI,
>
> I need to make a select in database of the a specific column, but the
> result is a array. How I do to get a specific column?
>
>
>
Check out the DBIx::Class manual here:

http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual.pod
___
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] Problem with column in DBI

2009-05-19 Thread Naylor Garcia
I found the manual, so I asked!


2009/5/19 Michael Reddick 

>
>
> On Tue, May 19, 2009 at 2:40 PM, Naylor Garcia wrote:
>
>> HI,
>>
>> I need to make a select in database of the a specific column, but the
>> result is a array. How I do to get a specific column?
>>
>>
>>
> Check out the DBIx::Class manual here:
>
> http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual.pod
>
> ___
> 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] Problem with column in DBI

2009-05-19 Thread Павел Долженко




my $change_color = [$c->model('database::dominio')->search(
    { id_domain => 21240, name => { like => 'naylor
garcia' } },
       {columns => ['color']}
)->first->color];
HI,
  
I need to make a select in database of the a specific column, but the
result is a array. How I do to get a specific column?
  
my $change_color = [$c->model('database::dominio')->search(
    { id_domain => 21240, name => { like => 'naylor
garcia' } }
)];
  
Thank you ;)
  
Naylor Garcia
  
  

___
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] Problem with column in DBI

2009-05-19 Thread Naylor Garcia
HI,

I need to make a select in database of the a specific column, but the result
is a array. How I do to get a specific column?

my $change_color = [$c->model('database::dominio')->search(
{ id_domain => 21240, name => { like => 'naylor garcia' } }
)];

Thank you ;)

Naylor Garcia
___
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 and where to run a method at Catalyst start up?

2009-05-19 Thread Emmanuel Quevillon

Tomas Doran wrote:


On 19 May 2009, at 13:01, Emmanuel Quevillon wrote:


I tried what you mentioned but it didn't change anything
unfortunately. Has someone in the list another idea what's is going
wrong?


No idea as we don't know where it's being called from, or why it's 
failing.


Try with perl -MDevel::SimpleTrace and post a stack trace.


Hi Tom,

Thanks to try helping me. Here is the Trace from Devel::SimpleTrace. 
Actually, the error is not even when I try

to call my method from my Catalyst::Model but when I start the dev server :

t...@gin bibliolist$ perl -MDevel::SimpleTrace script/bibliolist_server.pl
Couldn't instantiate component "BiblioList::Model::Mapping", "Can't call 
method "search" on an undefined value
   at 
BiblioList::Model::Mapping::_load_BiblioRemote_mapping(/home/tuco/src/perl/projects/Catalyst/BiblioList/dev/bibliolist-0.08/script/../lib/BiblioList/Model/Mapping.pm:37)
   at 
BiblioList::Model::Mapping::BUILD(/home/tuco/src/perl/projects/Catalyst/BiblioList/dev/bibliolist-0.08/script/../lib/BiblioList/Model/Mapping.pm:20)
   at 
Class::MOP::Method::execute(/usr/local/lib/perl/5.10.0/Class/MOP/Method.pm:120)
   at 
Moose::Object::BUILDALL(/usr/local/share/perl/5.10.0/Moose/Object.pm:55)

   at Moose::Object::new(/usr/local/share/perl/5.10.0/Moose/Object.pm:28)
   at Catalyst::Model::new(generated method (unknown origin):2)
   at 
Catalyst::Component::COMPONENT(/usr/local/share/perl/5.10.0/Catalyst/Component.pm:85)

   at (/usr/local/share/perl/5.10.0/Catalyst.pm:2202)
   at 
Catalyst::setup_component(/usr/local/share/perl/5.10.0/Catalyst.pm:2202)
   at 
Catalyst::setup_components(/usr/local/share/perl/5.10.0/Catalyst.pm:2156)

   at Catalyst::setup(/usr/local/share/perl/5.10.0/Catalyst.pm:1071)
   at 
(/home/tuco/src/perl/projects/Catalyst/BiblioList/dev/bibliolist-0.08/script/../lib/BiblioList.pm:75)
<== call to BiblioList->setup()

   at main::__ANON__(script/bibliolist_server.pl:66)
   at main::(script/bibliolist_server.pl:104)" at 
script/bibliolist_server.pl line 66

Compilation failed in require at script/bibliolist_server.pl line 66.



I'd also recommend you start a new TestApp, and try to make just the 
smallest subset of an application you can to demonstrate / prototype 
out the functionality you want.


a) This is gonna be easier to debug for you as there are less moving 
parts
b) It's then possible to post your app on github or upload a tarball 
somewhere, and an interested party could have a play and see if they 
can see your issue, without conjecture/guessing, and also without 
having to wade through the rest of your application.


Cheers
t0m


I'll do it and post it to the list (github).
Cheers
Emmanuel

___
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 and where to run a method at Catalyst start up?

2009-05-19 Thread Tomas Doran


On 19 May 2009, at 13:01, Emmanuel Quevillon wrote:


I tried what you mentioned but it didn't change anything
unfortunately. Has someone in the list another idea what's is going
wrong?


No idea as we don't know where it's being called from, or why it's  
failing.


Try with perl -MDevel::SimpleTrace and post a stack trace.

I'd also recommend you start a new TestApp, and try to make just the  
smallest subset of an application you can to demonstrate / prototype  
out the functionality you want.


a) This is gonna be easier to debug for you as there are less moving  
parts
b) It's then possible to post your app on github or upload a tarball  
somewhere, and an interested party could have a play and see if they  
can see your issue, without conjecture/guessing, and also without  
having to wade through the rest of your application.


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/


Re: [Catalyst] Catalyst::Controller::DBIC::Transaction Integration

2009-05-19 Thread Tomas Doran


On 16 Mar 2009, at 10:45, Carl Franks wrote:

I think now that Catalyst::Controller::HTML::FormFu isn't first in the
inheritance list, its create_action() isn't being called.


Yuk, as we get plain old perl method dispatch order, so you get:

Other::Thing => Catalyst::Controller;

I guess adding the incantation:
use MRO::Compat;
use mro 'c3';

to the controllers in question would also help, as the C3 dispatch  
order would be:


Other::Thing => Controller::FormFu => Catalyst::Controller.

I note that you say $self->SUPER in Controller::FormFu, which is a  
bad idea - this is certain to call the method in your direct parent  
(i.e. Catalyst::Controller), excluding any other multiply inherited  
base classes which would like a stab at create_action also :_(



If any Cat dev could point me to a Cat controller that does the action
registering correctly, so I can fix C-C-HTML-FormFu, I'd very much
appreciate it.


In 5.80, a better solution might be to use a controller role, and use  
an around modifier on get_action_methods'. I'm not sure if that would  
actually be more elegant or not, but using Moose roles puts you at  
less risk of getting hurt by multiple inheritance.


I appreciate that this would probably be a rather large change for  
Controller::FormFu however :)


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/


Re: [Catalyst] Authorisation

2009-05-19 Thread Tomas Doran


On 19 May 2009, at 18:19, Ivan Wills wrote:


Thanks I did have a 'Plugin::Authentication' => {...} line, fixing  
that got rid of the spurious DB::User error.


By 'fixing that' you mean moving all your config out of the  
'authentication' key, and into the 'Plugin::Authentication' key, not  
the other way round, right?


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/


Re: [Catalyst] Authorisation

2009-05-19 Thread Ivan Wills
2009/5/20 J. Shirley 

> On Tue, May 19, 2009 at 8:24 PM, Ivan Wills  wrote:
>
>> I tried that but still get the same error. It looks like the user_model is
>> not being picked up by Catalyst::Authentication::Store::DBIx::Class. I also
>> tried getting Catalyst::Runtime 5.80004 but that hasn't helped.
>>
>> Ivan
>>
>>
> I think there are a few problems... one, the documentation for
> Catalyst::Authentication::Store::DBIx::Class uses the deprecated
> 'authentication' configuration key.  If you have something else that uses
> the current 'Plugin::Authentication' key that will take precedence (and I'm
> not sure if they're merged).
>
> So, make sure that all your config for authentication uses the
> 'Plugin::Authentication' key (__PACKAGE__->config( 'Plugin::Authentication'
> => { ... } ) and then move to #2:
>
> Something else is setting user_model to DB::User -- as the original error
> message indicates that is the resultset being requested from configuration.
>
>
> Do a grep through your config for "user_model" and also run a request with
> ?dump_info=1 appended to get the forced Debug screen. While running the
> server under debug mode, just http://localhost:3000/?dump_info=1 should be
> sufficient.  The ?dump_info=1 technique will only work on actions that find
> their way to ActionClass('RenderView'), if you are using REST or a custom
> end action you may not get the debug screen.
>
> The ?dump_info will get your config the way Catalyst sees it, which is
> better than what you may guess it is ;)
>
> -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/
>
>
Thanks I did have a 'Plugin::Authentication' => {...} line, fixing that got
rid of the spurious DB::User error.

-- 
email/jabber:  ivan.wi...@gmail.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/


Re: [Catalyst] 15s latency with fastcgi+Apache2+catalyst 5.8

2009-05-19 Thread Tomas Doran

Paul Makepeace wrote:

I have Apache and libapache2-mod-fastcgi and the server running in
standalone. It's been working fine in the old Apache 1.3 + Catalyst
5.7012 environment for years.


Why are you changing _everything_ at once?

Why not upgrade from apache 1 => apache 2, and then upgrade Catalyst (or 
vice versa), as currently you've got no idea which of those upgrades is 
causing the issue.



NYTProf fails too,
$ nytprofhtml Generating report...
Reading nytprof.out
inflate failed, error -5 ((null)) at end of input file - is it
truncated? at /usr/lib/perl5/Devel/NYTProf/Data.pm line 78.


You're not exiting cleanly.

add:

sub exit : Local {
exit 0;
}

to your app, then hit that as the last hit.

You should now have profile data you can use..


PS not sure if this is related,
IDL::Web is using the deprecated Catalyst::Base, update your
application as this will be removed in the next major release at
/usr/share/perl5/Catalyst/Base.pm line 7.

Catalyst::Base doesn't appear in our app anywhere(?!)


Hmm, well, I think that it does..

The warning is issues whenever a class which @ISA Catalyst::Base is 
constructed.


Use Devel::SimpleTrace, and it should give you more hints..

Cheers
t0m


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


[Catalyst] 15s latency with fastcgi+Apache2+catalyst 5.8

2009-05-19 Thread Paul Makepeace
I'm in the process of upgrading our app to Catalyst 5.8 and Apache 2
on a stock Debian box. The webpages are taking pretty much exactly 15s
to load. I tried stripping out images and other media and even with it
down to the HTML & favicon.ico it's 15s - i.e. it's not blocking on a
particular item.

I have Apache and libapache2-mod-fastcgi and the server running in
standalone. It's been working fine in the old Apache 1.3 + Catalyst
5.7012 environment for years.

I've read various suggestions about DNS but presumably it isnt this
since it's using a fastcgi socket. Other sites served by Apache on
this machine aren't having latency issues.

Profiling ain't working,

pa...@rpix:~/idl/trunk$ . etc/env/dev.sh; PERL5OPT=-d:DProf
IDL-Web/script/idl_web_fastcgi.pl -l /tmp/idl_web_dev.socket -n 1 -p
/tmp/idl_web_dev.pid
panic: Devel::DProf inconsistent subroutine return at
/usr/share/perl5/Catalyst.pm line 1039.

NYTProf fails too,
$ nytprofhtml Generating report...
Reading nytprof.out
inflate failed, error -5 ((null)) at end of input file - is it
truncated? at /usr/lib/perl5/Devel/NYTProf/Data.pm line 78.

Any other hints?

Thanks,
Paul

PS not sure if this is related,
IDL::Web is using the deprecated Catalyst::Base, update your
application as this will be removed in the next major release at
/usr/share/perl5/Catalyst/Base.pm line 7.

Catalyst::Base doesn't appear in our app anywhere(?!)

___
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::Helper::Controller::DBIC::API::SOAP?

2009-05-19 Thread Ian Sillitoe
Hullo all,

Part of a project I've been working on for a while involves providing access
to a whole bunch of data lookup webservices. Part of the specification for
this project is that these services should be made available through SOAP
and have WS-I compliant WSDL documents.

It turns out that since most of the database lookups were essentially
returning sets of rows for a given column (or a single row for a given
primary key) so that's a lot of boilerplate perl and WSDL to manage. In an
attempt to keep myself sane during development/maintenance I resolved to
generate all the boilerplate code (WSDL, controller, live tests, etc)  from
as little configuration as possible. Given that some of the services are
simply primary key lookups, the minimal amount of information could be as
little as the database connection and the desired endpoint (
http://my.server.com/api/soap/dataservices).

To say that this is a little rough round the edges is an understatement, but
I've now got it to a point where it works for me and figured it might save
someone else some time too. I've copied and pasted the usage from this
project below as a first pass to get comments.

Caveats:

 - I've called this DBIC::API::SOAP because that seems to be where it fits
into the grand scheme of things, however it doesn't current use any of
DBIC::API at all (it probably should in the long term, but currently uses
it's own abstract interface - DBIx::Class::WebService)

 - This uses C::C::SOAP::DocumentLiteralWrapped (sorry ruoso!) because
DocLitWrapped happened to make it easier for me to generate and test WS-I
compliant WSDLs required for work. The intention would be to move this
across to a better schema when I've got time.

 - This currently generates a bunch of scaffolding rather than making much
attempt to refactor stuff into runtime (all the clever stuff is done by
C::C::SOAP). This is partly because I'm lazy and was running this on top of
C::C::SOAP where the WSDL is required as a flat file. However, this is also
partly because you wouldn't want to change your external WSDL at runtime
anyway so I didn't think this was too much of a bad thing.

Let me know your thoughts.

Cheers,

Ian


USAGE

The catalyst project "TestApp" in the test directory of this distribution
provides a good usage as it was created from scratch using the
Catalyst::Helper
provided in this distribution.

As always the Catalyst project starts with:

% catalyst.pl TestApp

At the absolute minimum, the user needs to have a database that contains
tables
with primary keys. If no other config is provided, the helper tool will
automatically define one operation per table corresponding to a simple
primary
key lookup.

First, we create a catalyst DBIC model that will help us interact with our
database:

% cd TestApp

% cp /path/to/my/sqlite/database/testws.db .

% script/testapp_create.pl model TestDB DBIC::Schema TestApp::Schema \
create=dynamic dbi:SQLite:testws.db

 exists "/path/to/TestApp/script/../lib/TestApp/Model"
 exists "/path/to/TestApp/script/../t"
 exists "/path/to/TestApp/script/../lib/TestApp"
created "/path/to/TestApp/script/../lib/TestApp/Schema.pm"
created "/path/to/TestApp/script/../lib/TestApp/Model/TestDB.pm"
created "/path/to/TestApp/script/../t/model_TestDB.t"

Now, we can feed this model name into the helper tool to generate SOAP-based
webservice from them:

% script/testapp_create.pl controller API::SOAP::DataServices \
DBIC::SOAP::DocumentLiteralWrapped TestDB

# starts up the Catalyst project to resolve the model name into DBIC
Schema

created "root/static/wsdl"
created "root/static/wsdl/testapp_controller_api_soap_dataservices.wsdl"
created "lib/TestApp/Controller/API/SOAP/DataServices.pm"
created "t/controller_API-SOAP-DataServices.t"

The Path actions that this provides:

/api/soap/dataservices/wsdl  # returns WSDL as text/xml

/api/soap/dataservices   # SOAP endpoint
/api/soap/dataservices/ArtistByArtistId  # SOAP action handler
/api/soap/dataservices/CdByCdId  # SOAP action handler

As a side note, you can also use your own configuration file rather than
relying on the default operations (see DBIx::Class::WebService for more
details)

# my-dataservices.json
{
"name":  "DataServices",
"operations": [
{
"name": "SearchArtistsByName",
"data_source_name": "Artist",
"input_columns":"name",
"search_attributes":{ "rows": "50" },
"documentation":"Returns a list of artists matching
a simple text search"
}
]
}


You should be able to run the test server and point your browser at:

% script/testapp_server.pl

http://localhost:3000/api/soap/dataservices/wsdl

To view the automatically generated WSDL

You can also run the generated tests a

Re: [Catalyst] New restarter code in Catalyst::Devel 1.14_01

2009-05-19 Thread Dave Rolsky

On Tue, 19 May 2009, Rodrigo wrote:


Since I needed to have the restarter working badly on that machine in
particular, I quickly patched the code with Proc::Background. Something like
this:

sub _fork_and_start() {
  my $proc = new Proc::Background("perl $0");  # I'm writing this from
memory; not this exactly, there were more args...
  my $pid = $proc->pid;
...}


Doing this pretty much defeats the point of the new restarter code, which 
was to avoid starting the app from scratch each time.



I think I put threads / async { } somewhere in there before using
Proc::Background but I got an error... and don't recall which. Killing the
thread requires it to die from the inside, sending it a signal of some sort.


Right, that's where I got stuck.


Couldn't the restarter be subclassed then changed in myapp_script.pl through
an %ENV variable?


Sure, but the trick is to come up with something that works reliably on 
Windows, and ideally, has the benefits of the new restarter code.



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


Re: [Catalyst] Authorisation

2009-05-19 Thread J. Shirley
On Tue, May 19, 2009 at 8:24 PM, Ivan Wills  wrote:

> I tried that but still get the same error. It looks like the user_model is
> not being picked up by Catalyst::Authentication::Store::DBIx::Class. I also
> tried getting Catalyst::Runtime 5.80004 but that hasn't helped.
>
> Ivan
>
>
I think there are a few problems... one, the documentation for
Catalyst::Authentication::Store::DBIx::Class uses the deprecated
'authentication' configuration key.  If you have something else that uses
the current 'Plugin::Authentication' key that will take precedence (and I'm
not sure if they're merged).

So, make sure that all your config for authentication uses the
'Plugin::Authentication' key (__PACKAGE__->config( 'Plugin::Authentication'
=> { ... } ) and then move to #2:

Something else is setting user_model to DB::User -- as the original error
message indicates that is the resultset being requested from configuration.


Do a grep through your config for "user_model" and also run a request with
?dump_info=1 appended to get the forced Debug screen. While running the
server under debug mode, just http://localhost:3000/?dump_info=1 should be
sufficient.  The ?dump_info=1 technique will only work on actions that find
their way to ActionClass('RenderView'), if you are using REST or a custom
end action you may not get the debug screen.

The ?dump_info will get your config the way Catalyst sees it, which is
better than what you may guess it is ;)

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


Re: [Catalyst] How and where to run a method at Catalyst start up?

2009-05-19 Thread Emmanuel Quevillon
Rodrigo wrote:
> 
> 
> The strange thing is that if I copy the body of BUILD to
> BiblioList.pm (just after __PACKAGE__->setup())
> The function works just fine and I don't get any error.
> 
> 
> Strange indeed.
> Just try, as a possible workaround, just get rid of the "GenoList" level
> in your Model. That would shorten the model call to something like
> MyApp->model('bovisR1db::Organism'). See if that works.
> 

Hi Rodrigo

I tried what you mentioned but it didn't change anything
unfortunately. Has someone in the list another idea what's is going
wrong?
Help will be much appreciated.

Regards

Emmanuel

> -rodrigo
> 
> 
> 
> 
> ___
> 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/


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


Re: [Catalyst] Authorisation

2009-05-19 Thread Ivan Wills
I tried that but still get the same error. It looks like the user_model is
not being picked up by Catalyst::Authentication::Store::DBIx::Class. I also
tried getting Catalyst::Runtime 5.80004 but that hasn't helped.

Ivan

2009/5/19 Ben Vinnerd 

> Ivan Wills wrote:
>
>>user_model => 'DietDB',
>>
>>  Change this to:
>
> user_model => 'DietDB::User'
>
>
> (replace User with whatever you User table is called).
>
> Ben
>
>
> ___
> 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/
>



-- 
email/jabber:  ivan.wi...@gmail.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/


Re: [Catalyst] Authorisation

2009-05-19 Thread Ben Vinnerd

Ivan Wills wrote:

user_model => 'DietDB',


Change this to:

user_model => 'DietDB::User'


(replace User with whatever you User table is called).

Ben


___
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] Authorisation

2009-05-19 Thread Ivan Wills
i,

I have been trying to set up the catalyst Authorization plugin I have my
Model in a module called DietDB and in my application module I have the
Authorization set up as:

 authentication => {
default_realm => 'people',
realms => {
people => {
credential => {
class => 'Person',
password_field => 'person_password',
password_type => 'clear'
},
store => {
class => 'DBIx::Class',
user_model => 'DietDB',
role_relation => 'role',
role_field => 'role_name',
}
}
}
},

When my login controller calls $c->authenticate({username => $username,
password => $password}) I get the error message:

Caught exception in Diet::Controller::Login->index
"$c->model('DB::Users') did not return a resultset. Did you set
user_model correctly? at
/usr/local/share/perl/5.10.0/Catalyst/Authentication/Store/DBIx/Class.pm
line 61"

Have I missed a configuration option? I am using Catalyst 5.80003 and other
code is successfully calling $c->model('DietDB').

Thanks,
Ivan

-- 
email/jabber:  ivan.wi...@gmail.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/


Re: [Catalyst] Error is not structured and friendly

2009-05-19 Thread J. Shirley
On Tue, May 19, 2009 at 4:54 PM, abhishek jain
wrote:

> Hi,
> I am using catalyst, during development, i can see that i view some errors
> in the code developed,
> The error is like:
>
> Caught exception in MyApp::Controller::US->view "
>
> no element found at line 1, column 0, byte -1 at 
> /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/XML/Parser.pm line 
> 187"
>
>
> Can there be a better error message which shows me a better o/p and what
> exactly the error is.
>

Submit a bug against XML::Parser, as that is where that error comes from.

This isn't anything Catalyst can change, since it has nothing to do with
Catalyst.
___
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 is not structured and friendly

2009-05-19 Thread abhishek jain
Hi,
I am using catalyst, during development, i can see that i view some errors
in the code developed,
The error is like:

Caught exception in MyApp::Controller::US->view "
no element found at line 1, column 0, byte -1 at
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/XML/Parser.pm
line 187"


Can there be a better error message which shows me a better o/p and what
exactly the error is.

-- 
Thanks and kind Regards,
Abhishek jain
___
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] New restarter code in Catalyst::Devel 1.14_01

2009-05-19 Thread Rodrigo
> I did test this on WinXP using Strawberry (5.8.8, IIRC), and it worked
> fine. Win32 Perl does support a fork emulation that uses thread under the
> hood.
>

Strange. I'll try it with a different/older version of Strawberry Perl and
see what happens.


>
> I don't think the fork implementation in Strawberry is any different than
> ActivePerl. ActiveState wrote the fork implementation (again, IIRC) and
> contributed it to the Perl core.
>

Their forks seem to behave slightly different (it's a feeling more than a
fact), even though I agree that the code is probably the same one Microsoft
helped develop originally. The compilers are different though, VisualStudio
vs MinGW.


>
> That said, I was thinking it might be good to also have a threads-based
> version available, and that could be the default to use on Win32.
>
> I took a stab at doing this at one point, but got stuck on trying to
> actually kill the "child" thread.
>

Since I needed to have the restarter working badly on that machine in
particular, I quickly patched the code with Proc::Background. Something like
this:

sub _fork_and_start() {
   my $proc = new Proc::Background("perl $0");  # I'm writing this from
memory; not this exactly, there were more args...
   my $pid = $proc->pid;
...}

It did the job since the background process was a non-restarter dev server.
And the restarter was able to kill it just fine when changes were detected
because $pid is a real os pid.

I think I put threads / async { } somewhere in there before using
Proc::Background but I got an error... and don't recall which. Killing the
thread requires it to die from the inside, sending it a signal of some sort.


Couldn't the restarter be subclassed then changed in myapp_script.pl through
an %ENV variable?

-rodrigo
___
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/