[Catalyst] password strength

2017-04-05 Thread Adam Witney
Hi,

I am trying to build in rules to check password strength when users reset their 
password.s 

Do people generally roll their own, or is there something already written? I 
can find things like Data::Password and Password::Policy, but not sure which is 
better to use

Thanks

Adam


___
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 best to store database connection information?

2015-02-23 Thread Adam Witney

Thanks guys for all the helpful ideas!


From: abhishek jain [mailto:abhishek.netj...@gmail.com]
Sent: 18. februára 2015 6:27
To: 'The elegant MVC web framework'
Subject: Re: [Catalyst] Where best to store database connection information?

Hi,

>>But this seems a bit of a security
>>problem having the main password in a text file like this,
>>especially if it goes into git.


What i do is i will modify the password on production manually and successive 
update / pull will not modify the password,  and i will also not commit the 
change in git / svn. Barring this config change it is a bad habbit to modify 
anything on production, Let me know if someone disagrees.

Also  in case you need a solution where the config file is password protected 
not a part of main repository then you will need external svn repo i guess (in 
case of svn ) , might be a better svn / repo config question.
Thanks
Abhishek


___
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 best to store database connection information?

2015-02-16 Thread Adam Witney

Hi,

Thanks for your replies.

I guess my question was more about any security issue of having the database 
username/password stored in a text file.  And what do people consider best 
practice for this from a security point of view?

Thanks

Adam


> -Original Message-
> From: Octavian Rasnita [mailto:orasn...@gmail.com]
> Sent: 16. februára 2015 17:10
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] Where best to store database connection
> information?
> 
> Catalyst uses Config::General to read .conf files. If Config::General is
> configured with the option -UseApacheInclude, then you can use an apache
> "include file.conf" in the .conf file to include another file from another
> directory which is not saved by git.
> 
> Or the option -IncludeDirectories can be also useful so all the files from the
> given directory will be included.
> 
> --Octavian
> 
> - Original Message -
> From: "David Schmidt" 
> To: "The elegant MVC web framework" 
> Sent: Monday, February 16, 2015 6:22 PM
> Subject: Re: [Catalyst] Where best to store database connection
> information?
> 
> 
> > the catalyst configloader can load more then just one file.
> >
> > by default it loads "myapp.conf"
> >
> > if a file named "myapp_local.conf" exists it is loaded aswell.
> >
> > docs:
> > https://metacpan.org/pod/distribution/Catalyst-Plugin-
> ConfigLoader/lib/Catalyst/Plugin/ConfigLoader/Manual.pod#Using-a-local-
> configuration-file
> >
> > On 16 February 2015 at 15:42, Adam Witney  wrote:
> >> Hi,
> >>
> >> I have a Catalyst / DBIx::Class application and I have been storing the
> >> database connection parameters in a config file which is sourced using
> >> MYAPP_CONFIG_LOCAL_SUFFIX. But this seems a bit of a security
> problem
> >> having the main password in a text file like this, especially if it goes
> >> into git.
> >>
> >> Is there a recommended or best practice place to store database
> >> connection information?
> >>
> >> Thanks for any help
> >>
> >> Adam
> >>
> >> ___
> >> 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/


[Catalyst] Where best to store database connection information?

2015-02-16 Thread Adam Witney
Hi,

I have a Catalyst / DBIx::Class application and I have been storing the 
database connection parameters in a config file which is sourced using 
MYAPP_CONFIG_LOCAL_SUFFIX. But this seems a bit of a security problem having 
the main password in a text file like this, especially if it goes into git.

Is there a recommended or best practice place to store database connection 
information?

Thanks for any help

Adam

___
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] Log4Perl and Catalyst startup routing table

2014-11-17 Thread Adam Witney


> -Original Message-
> From: Aristotle Pagaltzis [mailto:pagalt...@gmx.de]
> Sent: 13. novembra 2014 20:22
> To: catalyst@lists.scsys.co.uk
> Subject: Re: [Catalyst] Log4Perl and Catalyst startup routing table
> 
> Hi Adam,
> 
> * Adam Witney  [2014-11-13 12:45]:
> > I saw this post, but I 'm not sure I can use it to get the Catalyst
> > normal startup output in my logs. Is this possible?
> 
> I guess you could make half a work-around with this module, by writing a
> plugin that uses the module to log this data manually during startup.
> How satisfactory that is I cannot say, since that depends on whether you also
> want the normal debug output to not to go to screen and whether you need
> debug mode in general.
> 
> The problem with redirecting this stuff is that Catalyst produces the debug
> output very early during its startup, before it has loaded any extensions or
> plugins, so the logging facilities are the built-in stuff.
> (Hm, maybe it is possible to load the logging-related modules yourself and
> then hack them in with BEGIN or some such.) The code to produce this
> output is part of the startup code and not well accessible separately (which 
> is
> the whole reason for CatalystX::Info after all).
> 
> I.e. Catalyst basically doesn’t support what you want, and any solution done
> without built-in support will be ugly in some way or other.
> 
> However maybe it can be modularised to support this. The tricky part of that
> is that you do want to output this info early, so that it will be useful for
> debugging e.g. when components break during loading – but OTOH it should
> optionally be subject to the user’s configured logging system. How do you
> resolve that contradiction? The rest of a new design should fall out of the
> answer to that question automatically.
> 

Thanks for the suggestions.

It turns out that if you use

log4perl.logger.MyApp = DEBUG, Screen

then you lose all the standard Catalyst output, but if you use

log4perl.rootLogger = DEBUG, Screen

then you get it back again.

Thanks

Adam


___
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] Log4Perl and Catalyst startup routing table

2014-11-13 Thread Adam Witney

> * Adam Witney  [2014-11-12 13:55]:
> > I have Log4Perl controlling the logging in my Catalyst app, but I
> > can't seem to get the debug information from the normal Catalyst
> > startup (routing table, Loaded plugins etc) included into the Log4Perl
> > output.
> >
> > Is it possible to log this output through Log4Perl?
> 
> Synchronicity:
> 
> http://techblog.babyl.ca/entry/catalystx-info


Hi,

Thanks for your email, I saw this post, but I 'm not sure I can use it to get 
the Catalyst normal startup output in my logs. Is this possible?

Thanks

Adam

___
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] Log4Perl and Catalyst startup routing table

2014-11-12 Thread Adam Witney
Hi,

I have Log4Perl controlling the logging in my Catalyst app, but I can't seem to 
get the debug information from the normal Catalyst startup (routing table, 
Loaded plugins etc) included into the Log4Perl output.

Is it possible to log this output through Log4Perl?

Thanks

Adam

___
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] Opening existing PDF with Catalyst::View::PDF::API2

2014-10-12 Thread Adam Witney
>> I am trying to use Catalyst::View::PDF::API2 to open an existing PDF, modify 
>> it and then send it to the user.

>Why did not use Catalyst::View::PDF::Reuse instead?

Only really because it was last updated in 2010, and C::V::PDF::API2 had a 
recent update. Is that easier to use?


___
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] Opening existing PDF with Catalyst::View::PDF::API2

2014-10-12 Thread Adam Witney
Hi, thanks for your reply

> I haven't used it, but looking at the last paragraph of the docs for 
> ``process`` https://metacpan.org/pod/Catalyst::View::PDF::API2#process I 
> notice they say to use $c->stash->{pdf_filename} = 'myfile.pdf'; to set the 
> PDF 
> filename. They also mention what filename is assumed by default.

I think this "filename" defines the filename of the downloaded file rather than 
an input file

> ->open is a class method of PDF::API2, and I think you only get object 
> methods with the object provided by Catalyst::View::PDF::API2

I think that this is the problem, I can in fact get it to work if I change 
PDF::API2.pm from

184 sub open_scalar {
185 my ($class, $content, %options) = @_;
186
187 my $self = {};
188 bless $self, $class;

To

184 sub open_scalar {
185 my ($class, $content, %options) = @_;
186
187 my $self = {};
188 if ( ref($class) ) {
189 $self = $class;
190 } else {
191 bless $self, $class;
192 }

This is obviously not an ideal fix but I don't understand how C::V::PDF::API2 
interacts with PDF::API2, ie where does the TT pdf object come from?
 
Thanks again for your help

Adam


On Sun, 2014-10-12 at 11:56 +, Adam Witney wrote:
> Hi,
> 
> I am trying to use Catalyst::View::PDF::API2 to open an existing PDF, 
> modify it and then send it to the user. Looking at the documentation, 
> it says that you can reuse existing PDF's but it doesn't show how to 
> do it. I have tried this in the template
> 
> [% page = pdf.open('my.pdf') %]
> 
> But this gives the error:
> 
> undef error - Attempt to bless into a reference at 
> /opt/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/PDF/API2.pm line 188.
> 
> Has anyone managed to get this to work? Or does anyone know what this error 
> means?
> 
> Thanks for any help
> 
> Adam
> 
> ___
> 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] Opening existing PDF with Catalyst::View::PDF::API2

2014-10-12 Thread Adam Witney
Hi,

I am trying to use Catalyst::View::PDF::API2 to open an existing PDF, modify it 
and then send it to the user. Looking at the documentation, it says that you 
can reuse existing PDF's but it doesn't show how to do it. I have tried this in 
the template

[% page = pdf.open('my.pdf') %]

But this gives the error:

undef error - Attempt to bless into a reference at 
/opt/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/PDF/API2.pm line 188.

Has anyone managed to get this to work? Or does anyone know what this error 
means?

Thanks for any help

Adam

___
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 format of date field

2014-01-08 Thread Adam Witney



On 8. 1. 2014 17:31, Hartmaier Alexander wrote:

On 2014-01-08 18:19, Adam Witney wrote:



On 7. 1. 2014 9:55, neil.lunn wrote:


3. You *Are* going to get back a string in the raw params. So what you
need to do is parse that format into a DateTime object again when
submitting back to model or wherever else you want to use it as an
object.


Thanks guys for the various suggestions, I think I will follow this
approach above and leave the format to the view as suggested!

Thanks again

Adam

I have various format_ methods in my view class that are exposed to TT
using View::TT's expose_methods config option including format_date,
format_datetime and format_datetime_ajax.


Thanks Alexander, could you possibly send me an example of the 
format_datetime? I am trying to figure exactly where and how to put it in.


Thanks

Adam

___
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 format of date field

2014-01-08 Thread Adam Witney



On 7. 1. 2014 9:55, neil.lunn wrote:


3. You *Are* going to get back a string in the raw params. So what you
need to do is parse that format into a DateTime object again when
submitting back to model or wherever else you want to use it as an object.


Thanks guys for the various suggestions, I think I will follow this 
approach above and leave the format to the view as suggested!


Thanks again

Adam

___
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 format of date field

2014-01-07 Thread Adam Witney



On 6. 1. 2014 21:41, Bill Moseley wrote:


On Mon, Jan 6, 2014 at 7:18 AM, Adam Witney mailto:awit...@sgul.ac.uk>> wrote:

Hi,

I have a date field in a DBIx::Class Result class using
InflateColumn::DateTime. When I pass this through a Catalyst/TT
application, the date is presented in -MM-DD format.

I can modify this to DD/MM/ in my TT template with
object.dmy('/'), but I would prefer to change the default DateTime
stringification, however I am not quite sure where or how to do this?

Any ideas greatly appreciated.


Seem like formatting in the template is the right place -- may want to
have different formats in different places in your app.   Then you might
also think about how best to localize.

One idea is to localize a set of names for a set of formats:

[% dt_fmt = c.localize( '_DT_DATE_ONLY' );
foo.some_dt_object.strftime(  dt_fmt ) | html %]


I have also used a function that does the above, but also clones and
sets the time zone and locale based on the user's preferences:

[% user_time( foo.event_start, '_DT_TIMESTAMP_WITH_ZONE' ) | html %]


Hi Bill,

Thanks for your email. I agree that the template seems like a good place 
for this, but to give a little extra detail.


I have a form that is used for both object create and editing. When I 
edit an object I have this in my controller:


$c->stash(formdata => $object);

and in the template:




But when creating a new object, if the form validation fails I pass the 
form data back to the form like so:


$c->stash( formdata => $c->request->params );

But now the datefield is a text string and formdata.datefield.dmy('/') 
prints blank.


I was thinking that if I could define my DateTime stringification to my 
required format centrally then I could just use this in the template




and both scenarios would be happy.

Is the only way to do this to put more code in the template?

Thanks again for your help

Adam

___
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 format of date field

2014-01-07 Thread Adam Witney


Thanks for your reply Ian,

So you mean copy DBIx::Class::InflateColumn::DateTime under my lib/ 
directory and build into the DateTime formatter option?


On 6. 1. 2014 15:42, Ian Docherty wrote:

DateTime has an option to change the default stringification with a
'formatter' option.

Also DBIx::Class::InflateColumn::DateTime is a convenience method, you
could choose to use the DBIx::Class::InflateColumn yourself and combine
this with the DateTime formatter option to give you the result you are
looking for.

icydee


On 6 January 2014 15:18, Adam Witney mailto:awit...@sgul.ac.uk>> wrote:

Hi,

I have a date field in a DBIx::Class Result class using
InflateColumn::DateTime. When I pass this through a Catalyst/TT
application, the date is presented in -MM-DD format.

I can modify this to DD/MM/ in my TT template with
object.dmy('/'), but I would prefer to change the default DateTime
stringification, however I am not quite sure where or how to do this?

Any ideas greatly appreciated.

Thanks

Adam

_
List: Catalyst@lists.scsys.co.uk <mailto:Catalyst@lists.scsys.co.uk>
Listinfo:
http://lists.scsys.co.uk/cgi-__bin/mailman/listinfo/catalyst
<http://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/




___
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] Changing format of date field

2014-01-06 Thread Adam Witney

Hi,

I have a date field in a DBIx::Class Result class using 
InflateColumn::DateTime. When I pass this through a Catalyst/TT 
application, the date is presented in -MM-DD format.


I can modify this to DD/MM/ in my TT template with object.dmy('/'), 
but I would prefer to change the default DateTime stringification, 
however I am not quite sure where or how to do this?


Any ideas greatly appreciated.

Thanks

Adam

___
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 Apress book on Safari Books Online

2009-07-22 Thread Adam Witney


I placed the order last week and yesterday Amazon (UK) gave me an  
Estimated arrival date of August 04 2009 - August 13 2009



On 22 Jul 2009, at 11:58, Gavin Henry wrote:


Amazon uk keep delaying my order. It's definitely out right?

Thanks.

On 21/07/2009, Kieren Diment  wrote:


On 22/07/2009, at 7:49 AM, Meeko wrote:


Does anyone know if/whether the new Apress book "The Definitive
Guide to
Catalyst" will appear on O'Reilly Safari Books Online?  I have a
Safari
subscription, and prefer reading my tech books there.  I would
really like
to read the new book, and I keep checking every few days to see if
it has
appeared but so far it hasn't.
I was just wondering if anyone knows how long it usually takes books
to
appear there, and if or when the new Catalyst book will appear.  I
see lots
of Apress books on Safari, so I know their books do appear, so I'm
hoping
the new Catalyst books makes it soon.




I asked the boss, and will get back to you when he replies!




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



--
Sent from my mobile device

http://www.suretecsystems.com/services/openldap/
http://www.suretectelecom.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/


Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data gridsandCatalyst

2009-05-01 Thread Adam Witney


sub people_data : Local {
  my ( $self, $c ) = @_;

  my $rs = $c->model( 'AdventAjaxGrid2DB::People' );
  my @people = ();
  while ( my $person = $rs->next ) {
  push( @people, {
  id  => $person->id,
  name=> $person->name,
  affiliation_id => $person->affiliation_id,


I would guess that this line is returning an Affiliation object rather  
than the affiliation_id then? You could test it by adding this line  
after the push


$c->log->debug('Whats this - '.$person->affiliation_id."\n");

if so then you would have to look at your Model.

Maybe someone with more experience could tell you the likely reason  
for this?


HTH

adam

___
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] Jason Kohles' tutorial on ExtJs editable data gridsandCatalyst

2009-04-30 Thread Adam Witney

The error I get is :
"[error] Caught exception in AdventAjaxGrid2::View::JSON->process  
"encountered object  
'AdventAjaxGrid2 
::Model::AdventAjaxGrid2DB::Affiliation=HASH(0x91b8270)', but  
neither allow_blessed nor convert_blessed settings are enabled at / 
usr/local/share/perl/5.8.8/JSON/Any.pm line 426."


I couldn't figure out how to enable those settings from the JSON-Any  
write up on CPAN. How is that to be done?


from my limited experience, this seems to come up when you are not  
sending proper JSON to the JSON view. Check the code before the line:


$c->detach( $c->view( 'JSON' ) );

to see what you are sending it (The error suggests you are pushing an  
object to it, in the calendar example he sends a reference to an array  
of hashes).


HTH

adam

___
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] Upgrading Catalyst and issues with Class::MOP

2009-04-29 Thread Adam Witney


On 29 Apr 2009, at 17:11, Florian Ragwitz wrote:


On Wed, Apr 29, 2009 at 05:08:38PM +0100, Adam Witney wrote:

I upgraded Catalyst to 5.80002 the other day, and my applications
started beginning with a warning:

The compute_all_applicable_attributes method has been deprecated. Use
get_all_attributes instead.
at /usr/local/lib/perl5/site_perl/5.8.9/darwin-thread-multi-2level/
Class/MOP/Class.pm line 946


Please upgrade to the latest version of Data::Visitor. We'll bump the
required version in Action::RenderView. Thanks for letting us know  
about

this.


ah yes, upgrading to Data-Visitor-0.24 fixed this.

Thanks

adam

___
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] Upgrading Catalyst and issues with Class::MOP

2009-04-29 Thread Adam Witney

Hi,

I upgraded Catalyst to 5.80002 the other day, and my applications  
started beginning with a warning:


The compute_all_applicable_attributes method has been deprecated. Use  
get_all_attributes instead.
 at /usr/local/lib/perl5/site_perl/5.8.9/darwin-thread-multi-2level/ 
Class/MOP/Class.pm line 946
	 
Class 
::MOP 
::Class 
::compute_all_applicable_attributes 
('Class::MOP::Class::Immutable::Moose::Meta::Class=HASH(0xcf3124)')  
called at /usr/local/lib/perl5/site_perl/5.8.9/Data/Visitor/ 
Callback.pm line 42
	Data::Visitor::Callback::BUILDARGS('Data::Visitor::Callback',  
'plain_value', 'CODE(0xd6c084)') called at generated method (unknown  
origin) line 4
	Data::Visitor::Callback::new('Data::Visitor::Callback',  
'plain_value', 'CODE(0xd6c084)') called at /usr/local/lib/perl5/ 
site_perl/5.8.9/Catalyst/Plugin/ConfigLoader.pm line 260
	Catalyst::Plugin::ConfigLoader::finalize_config('BugasBase') called  
at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Plugin/ 
ConfigLoader.pm line 98
	Catalyst::Plugin::ConfigLoader::setup('BugasBase') called at /usr/ 
local/lib/perl5/site_perl/5.8.9/Catalyst.pm line 1062
	Catalyst::setup('BugasBase') called at /Library/WebServer/Documents/ 
Catalyst/BugasBase/script/../lib/BugasBase.pm line 82

require BugasBase.pm called at script/bugasbase_server.pl line 55

as far as i can tell everything still works though. My versions are:

OSX - 10.5.6
Perl - 5.8.9
Moose - 0.76
Class::MOP - 0.83
Catalyst::Runtime - 5.80002

Is this likely to cause me a problem? do i likely have a wrong version  
of some module somewhere?


thanks

adam

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

2009-03-23 Thread Adam Witney


On 20 Mar 2009, at 07:42, Jonathan Rockway wrote:


* On Thu, Mar 19 2009, Adam Witney wrote:

Hi Bill,

This is using PostgreSQL. The other apps are fat clients that can  
pull

data from external sources, it was therefore necessary to have the
security levels built into the database.


Actually, there is really no reason to rely on the database for this.
You can always put some sort of app in front of the database that does
this.  In the case of a fat client and a Catalyst app, the design  
would
be something like this.  You write a library that handles users,  
access
levels, and so on.  Then, you write a thin RPC server that sits  
between
the database and fat client that uses this library to control access  
to

the database.  You speak SQL between the RPC server and the database,
and something else between the fat client and the RPC server.  (This  
is

preferable to talking directly to the database for a number of reasons
-- you can change the structure of the database, add transparent
caching, and so on without the fat client ever knowing.)  For the Cat
app, you do the same thing -- when talking to the database, use the
library that the RPC server uses, or just use the RPC server.  (Both
approaches have advantages.)

There is a little bit more code to write, but you increase the
flexibility of the system.  All your rules are now written in
easily-testable Perl instead of some variant of SQL.  You can change
the backend, and the frontend won't care.  You can add caching, you  
can

add your own master/slave replication, whatever -- everything is
abstracted.  Loose coupling is good!  Tight coupling is bad!

Anyway, there is no reason to throw away good software engineering
principles simply because someone mentioned the word "database".   
Using

the database for anything other than storing and querying data is a
waste of effort.  It's like writing all your software in CPU  
microcode,

simply because it's the lowest level possible.  You *can* do this, but
why not use something higher-level?  Everything is easier that way.


thanks for the suggestion. It is probably not feasible to do that with  
our database at this stage. But i will bear it in mind for future  
projects


For general information, with a *lot* of help from mst on IRC,  i have  
something working using a custom Catalyst::Authentication::Store::*. I  
will get it packaged up and submit it when i have written some docs  
for it


thanks again

adam


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

2009-03-19 Thread Adam Witney


On 19 Mar 2009, at 01:34, bill hauck wrote:



--- On Wed, 3/18/09, Adam Witney  wrote:


From: Adam Witney 
Subject: Re: [Catalyst] how to authenticate using database users
To: "The elegant MVC web framework" 
Date: Wednesday, March 18, 2009, 4:33 PM
On 18 Mar 2009, at 16:24, Michael Reddick wrote:




On Wed, Mar 18, 2009 at 10:51 AM, Adam Witney

 wrote:


Hi,

Our database uses actual database users rather than a

table containing usernames and password.



Why are you doing that?



The database has a row level security model implemented
such that row access is controlled by the database login.
This is because several applications can be used to interact
with it.

thanks

adam


Adam, can you tell us what database you're using?  Also, what other  
types of apps (web, fat client, etc.)?  I don't have any solution,  
but I'm facing a somewhat similar issue ...


I'm looking to replace a custom application written in FileMaker,  
which allows you to create permission levels down to the field  
level.  I'll need to replicate this in whatever replaces the  
original application.


Anyone have any hints on how to track what users (or roles) are able  
to edit what fields?  I'm thinking of implementing it similar to the  
way MySQL's permission tables are setup.  A permission table for  
each data table with a column for each column in the data table and  
a column for the user / role.  The values would be similar to Unix's  
permissions (1,2,4) to indicate if they could read, write, modify.


Anyone want to tell me it's crap and offer a better way?  Please ...


Hi Bill,

This is using PostgreSQL. The other apps are fat clients that can pull  
data from external sources, it was therefore necessary to have the  
security levels built into the database.


Our database uses PostgreSQL's array type to store the read/write  
permissions for each row... it works well, but it probably depends on  
your scale, our tables only have around 40k rows at this point.


cheers

adam






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

2009-03-18 Thread Adam Witney


On 18 Mar 2009, at 16:24, Michael Reddick wrote:




On Wed, Mar 18, 2009 at 10:51 AM, Adam Witney   
wrote:


Hi,

Our database uses actual database users rather than a table  
containing usernames and password.



Why are you doing that?



The database has a row level security model implemented such that row  
access is controlled by the database login. This is because several  
applications can be used to interact with it.


thanks

adam

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

2009-03-18 Thread Adam Witney


Hi,

Our database uses actual database users rather than a table containing  
usernames and password. How would I authenticate against the database  
itself? The examples I have come across in the Tutorial and various  
Catalyst::Authentication::* modules all seem to require the presence  
of a table containing username and password fields.


I guess I could write my own authenticate method that performed a  
manual dbh connection somehow... but I was wondering if there was a  
more standard/recommended way to do this?


thanks for any help

adam

___
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 ExtJS

2009-03-16 Thread Adam Witney


No, don't do that!

Use $row->get_columns which returns a hash of the column data!   
Accessing internal methods is bad, accessing internal hash keys is  
doubleplusungood.  If you find yourself doing that, go read some  
documentation.  If you haven't figured it out without doing that,  
submit a patch for a proper method!


Here's the pod:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08012/lib/DBIx/Class/Row.pm#get_columns

Also, you can use the HashRefInflator which works -fantastic- for  
JSON views:


The code is very simple:

my $rs = $c->model('DB::Books');
$rs->resultclass('DBIx::Class::HashRefInflator');
$c->stash->{books} = [ $rs->all ];

You can read about that here:
http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/ResultClass/HashRefInflator.pm


excellent, thanks guys, with minor modifications both those approaches  
work:


$c->stash->{books} = [map { $_->get_columns } $c- 
>model('DB::Books')->all];


OR:

my $rs = $c->model('DB::Books');
$rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
$c->stash->{books} = [ $rs->all ];

thanks again for your help

adam



___
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 ExtJS

2009-03-16 Thread Adam Witney



Hi Scott,

thanks for the info, do you use any particular module or have you
built it yourself? I have found so far:

HTML::FormFu::ExtJS
Catalyst-Controller-HTML-FormFu-ExtJS

any you'd recommend taking a look at?

thanks again

adam



I built it myself using Catalyst::View::JSON and TT. It's actually
pretty easy when you get the hang out it.



Hi Scott,

thank for your reply, in having a go at using Catalyst::View::JSON i  
keep running into the


"... encountered object 'MyApp::Model::DB::Experiment=HASH(0xe8ac4c)',  
but neither allow_blessed nor convert_blessed settings ... "


error. I'm getting data from DBIC but can't figure out how to get that  
into Catalyst::View::JSON. The "hello world" example works fine, but  
when trying to adapt this i run into trouble


sub hello : Local {
  my($self, $c) = @_;
#  $c->stash->{message} = 'Hello World!';

  $c->stash->{books} = [$c->model('DB::Books')->all];  ### this  
doesn't work


  $c->forward('MyApp::View::JSON');
}

any pointers into the right syntax/approach here would be greatly  
appreciated. I presume i have to write some kind of JSON encoder for  
the data coming out of $c->model('DB::Books')->all?


thanks again for your help

adam

___
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 ExtJS

2009-03-16 Thread Adam Witney


On 14 Mar 2009, at 20:26, Moritz Onken wrote:





Hi Scott,

thanks for the info, do you use any particular module or have you  
built it yourself? I have found so far:


HTML::FormFu::ExtJS
Catalyst-Controller-HTML-FormFu-ExtJS

any you'd recommend taking a look at?

thanks again

adam



Hi Adam,

I'm the author of the above mentioned modules.  
C::C::HTML::FormFu::ExtJS was just a proof of concept. You can use  
it though. It's simply a subclass of C::C::HTML::FormFu and replaces  
new HTML::FormFu with new HTML::FormFu::ExtJS.


HTML::FormFu::ExtJS is actively developed. The version on CPAN is  
not very recent because I'm waiting for the maintainer of  
HTML::FormFu to release a new version. The most recent version is at http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-ExtJS/ 
 (requires the svn version of HTML::FromFu).


Try it, look at the tests, see me at IRC #formfu or email me. I'd be  
glad if someone is using this module so we can find bugs and add  
features to it.


Thanks for the link Moritz,

I'm working my way through your examples from

http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-ExtJS/lib/HTML/FormFu/ExtJS.pm

Should javascript.tt2 contain this:


Ext.onReady(function(){
 var submitForm = function() {
   form.getForm().submit({ success: function(rst, req) {
  // submission was successful and valid } })
}
   });
 };

var form = [% form.render %];
 form.render(document.body);
});


I needed to make these changes to get it to display.

thanks again for your help?

adam


___
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 to be updated

2009-03-16 Thread Adam Witney



kakim...@moomba-water-fest:~/projects/myApp/script$ ./myApp_create.pl
model myAppDB DBIC::Schema myApp::Schema create=static
components=TimeStamp
dbi:Pg:dbname=myApp:Username=test_user:Password=password11
 exists "/home/kakimoto/projects/myApp/script/../lib/myApp/Model"
 exists "/home/kakimoto/projects/myApp/script/../t"
 DBIx::Class::Schema::Loader::make_schema_at(): DBI Connection  
failed:
Can't connect to data source 'components=TimeStamp' because I can't  
work

out what driver to use (it doesn't seem to contain a 'dbi:driver:'
prefix and the DBI_DRIVER env var is not set) at
/usr/local/share/perl/5.8.8/DBIx/Class/Storage/DBI.pm line 839


If the above error is still causing problems, I had issues getting the  
format of the connection string right also, but in the end i found  
that this format worked:


script/myapp_create.pl model DB DBIC::Schema MyApp::Schema  
create=static components=TimeStamp 'dbi:Pg:dbname=myApp' user password


HTH

adam

___
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 ExtJS

2009-03-14 Thread Adam Witney


On 14 Mar 2009, at 15:19, Scott Pham (scpham) wrote:


-Original Message-
From: Adam Witney [mailto:awit...@sgul.ac.uk]
Sent: Saturday, March 14, 2009 10:36 AM
To: The elegant MVC web framework
Subject: [Catalyst] Catalyst and ExtJS


Hi,

I was thinking about using Catalyst and ExtJS, does anyone have any
experience or know if they will play nicely together? Doing some
googling implies that this is not a popular combination due to the
limited information

thanks for any help

adam



Yes I currently have a couple of apps that use ExtJS + Catalyst, works
great for me!


Hi Scott,

thanks for the info, do you use any particular module or have you  
built it yourself? I have found so far:


HTML::FormFu::ExtJS
Catalyst-Controller-HTML-FormFu-ExtJS

any you'd recommend taking a look at?

thanks again

adam

___
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 ExtJS

2009-03-14 Thread Adam Witney


Hi,

I was thinking about using Catalyst and ExtJS, does anyone have any  
experience or know if they will play nicely together? Doing some  
googling implies that this is not a popular combination due to the  
limited information


thanks for any help

adam

___
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 static model in Tutorial::MoreCatalystBasics

2009-03-11 Thread Adam Witney


On 11 Mar 2009, at 13:59, J. Shirley wrote:



The line in the tutorial to create the static files is this:
$ script/myapp_create.pl model DB DBIC::Schema MyApp::Schema  
create=static dbi:SQLite:myapp.db


I don't see where you got 'Result' as part of the class name.


yes thats the command I used.

In fact I have just noticed, it is mentioned in the next tutorial  
(BasicCRUD.pod). It is now recommended to use load_namespaces to load  
the classes from lib/MyApp/Schema.pm; this looks in lib/MyApp/Schema/ 
Result for the Result Class files.


However, this was the default behaviour when I installed DBIC and  
Catalyst, so i guess the question is, is this section ("Convert to  
DBIC "load_namespaces" in BasicCRUD.pod) still needed in the Tutorial?


thanks again

adam

___
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 static model in Tutorial::MoreCatalystBasics

2009-03-11 Thread Adam Witney


On 11 Mar 2009, at 13:10, Tomas Doran wrote:


Adam Witney wrote:
ok, so i posted too soon and have figured out the problem. I need  
to add "Result" into the relationships. Does the Tutorial need to  
be updated to reflect this? If so i have included below a quick  
patch against


http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.70/trunk/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod
Can you re-submit as a unified diff against the base of the Catalyst- 
Manual distribution? (this makes it much easier for someone to  
read / apply).


is this what you mean?

--- Catalyst-Manual-5.7018/lib/Catalyst/Manual/Tutorial/ 
MoreCatalystBasics.pod	2009-03-08 23:56:26.0 +

+++ MoreCatalystBasics.pod  2009-03-11 13:23:00.0 +
@@ -1105,7 +1105,7 @@
 C.  This file contains a reference to
 C, so that file is loaded next.  Finally, the
 call to C in C will load each of the "result
-class" files from the C subdirectory.  The end
+class" files from the C subdirectory.  The end
 result is that Catalyst will dynamically create three table-specific
 Catalyst models every time the application starts (you can see these
 three model files listed in the debug output generated when you launch
@@ -1126,7 +1126,7 @@
 Result Class files. (Note: if you are using a database other than
 SQLite, such as PostgreSQL, then the relationship could have been
 automatically placed in the Result Class files.  If so, you can skip
-this step.)  First edit C and add the
+this step.)  First edit C and add the
 following text below the C<# You can replace this text...> comment:

 #
@@ -1138,7 +1138,7 @@
 # 1) Name of relationship, DBIC will create accessor with  
this name

 # 2) Name of the model class referenced by this relationship
 # 3) Column name in *foreign* table (aka, foreign key in  
peer table)
-__PACKAGE__->has_many(book_authors =>  
'MyApp::Schema::BookAuthors', 'book_id');
+__PACKAGE__->has_many(book_authors =>  
'MyApp::Schema::Result::BookAuthors', 'book_id');


 # many_to_many():
 #   args:
@@ -1178,7 +1178,7 @@
 Note that you cannot define a C relationship without
 also having the C relationship in place.

-Then edit C and add relationship
+Then edit C and add relationship
 information as follows (again, be careful to put in above the C<1;>  
but

 below the C<# DO NOT MODIFY THIS OR ANYTHING ABOVE!> comment):

@@ -1191,7 +1191,7 @@
 # 1) Name of relationship, DBIC will create accessor with  
this name

 # 2) Name of the model class referenced by this relationship
 # 3) Column name in *foreign* table (aka, foreign key in  
peer table)
-__PACKAGE__->has_many(book_author =>  
'MyApp::Schema::BookAuthors', 'author_id');
+__PACKAGE__->has_many(book_author =>  
'MyApp::Schema::Result::BookAuthors', 'author_id');


 # many_to_many():
 #   args:
@@ -1202,7 +1202,7 @@
 __PACKAGE__->many_to_many(books => 'book_author', 'book');

 Finally, do the same for the "join table,"
-C:
+C:

 #
 # Set relationships:
@@ -1213,14 +1213,14 @@
 # 1) Name of relationship, DBIC will create accessor with  
this name

 # 2) Name of the model class referenced by this relationship
 # 3) Column name in *this* table
-__PACKAGE__->belongs_to(book => 'MyApp::Schema::Books', 'book_id');
+__PACKAGE__->belongs_to(book => 'MyApp::Schema::Result::Books',  
'book_id');


 # belongs_to():
 #   args:
 # 1) Name of relationship, DBIC will create accessor with  
this name

 # 2) Name of the model class referenced by this relationship
 # 3) Column name in *this* table
-__PACKAGE__->belongs_to(author => 'MyApp::Schema::Authors',  
'author_id');
+__PACKAGE__->belongs_to(author =>  
'MyApp::Schema::Result::Authors', 'author_id');



 =head2 Run The Application
@@ -1249,7 +1249,7 @@

 Let's add a new column to our book list page that takes advantage of
 the relationship information we manually added to our schema files in
-the previous section.  Edit C add add the
+the previous section.  Edit C and add the
 following code below the existing table cell that contains
 C (IOW, add a new table cell below the existing two
 CtdE> tags but above the closing C/trE> and


___
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 static model in Tutorial::MoreCatalystBasics

2009-03-11 Thread Adam Witney


On 11 Mar 2009, at 11:23, Adam Witney wrote:


Hi,

I am new to Catalyst and so working my way through the tutorial.  
Everything has been working fine until i reached the "A STATIC  
DATABASE MODEL WITH DBIx::Class" section of the MoreCatalystBasics  
tutorial.


After generating the static schema files and adding the  
relationships as directed, running the test server causes this error:


mrc1-181:MyApp adam$ script/myapp_server.pl
Couldn't instantiate component "MyApp::Model::DB", "Cannot load  
schema class 'MyApp::Schema':  
DBIx::Class::Schema::throw_exception():  
DBIx::Class::Row::throw_exception(): Can't locate MyApp/Schema/ 
Authors.pm in @INC (@INC contains: /Library/WebServer/Documents/ 
Catalyst/MyApp/script/../lib /Library/Frameworks/R.framework/ 
Resources/library/RSPerl/perl/darwin-thread-multi-2level /usr/local/ 
install/Ensembl/ensembl/modules/ /usr/local/install/Ensembl/ensembl- 
compara/modules/ /usr/local/lib/perl5/5.8.9/darwin-thread- 
multi-2level /usr/local/lib/perl5/5.8.9 /usr/local/lib/perl5/ 
site_perl/5.8.9/darwin-thread-multi-2level /usr/local/lib/perl5/ 
site_perl/5.8.9 .) at /usr/local/lib/perl5/site_perl/5.8.9/Class/C3/ 
Componentised.pm line 126.
Compilation failed in require at /usr/local/lib/perl5/site_perl/ 
5.8.9/Class/C3/Componentised.pm line 126.
Compilation failed in require at /usr/local/lib/perl5/site_perl/ 
5.8.9/Catalyst/Model/DBIC/Schema.pm line 333.

at script/myapp_server.pl line 55" at script/myapp_server.pl line 55
Compilation failed in require at script/myapp_server.pl line 55.

I think the problem is that my Authors.pm, Books.pm and  
BookAuthors.pm were all created in MyApp/Schema/Result/ rather than  
MyApp/Schema/ which is what the Tutorial seems to expect (as shown  
by the line "edit lib/MyApp/Schema/Books.pm")


I'm not sure if this is a DBIx::Class issue or a Catalyst issue.  
Does anyone know how to rectify this problem?


DBIx::Class = 0.08012
Catalyst = 5.71000


ok, so i posted too soon and have figured out the problem. I need to  
add "Result" into the relationships. Does the Tutorial need to be  
updated to reflect this? If so i have included below a quick patch  
against


http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.70/trunk/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod

HTH

adam


--

1108c1108
< class" files from the C subdirectory.  The end
---
> class" files from the C subdirectory.  The  
end

1129c1129
< this step.)  First edit C and add the
---
> this step.)  First edit C and add  
the

1141c1141
< __PACKAGE__->has_many(book_authors =>  
'MyApp::Schema::BookAuthors', 'book_id');

---
> __PACKAGE__->has_many(book_authors =>  
'MyApp::Schema::Result::BookAuthors', 'book_id');

1181c1181
< Then edit C and add relationship
---
> Then edit C and add relationship
1194c1194
< __PACKAGE__->has_many(book_author =>  
'MyApp::Schema::BookAuthors', 'author_id');

---
> __PACKAGE__->has_many(book_author =>  
'MyApp::Schema::Result::BookAuthors', 'author_id');

1205c1205
< C:
---
> C:
1216c1216
< __PACKAGE__->belongs_to(book => 'MyApp::Schema::Books',  
'book_id');

---
> __PACKAGE__->belongs_to(book => 'MyApp::Schema::Result::Books',  
'book_id');

1223c1223
< __PACKAGE__->belongs_to(author => 'MyApp::Schema::Authors',  
'author_id');

---
> __PACKAGE__->belongs_to(author =>  
'MyApp::Schema::Result::Authors', 'author_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/


[Catalyst] Problem with static model in Tutorial::MoreCatalystBasics

2009-03-11 Thread Adam Witney

Hi,

I am new to Catalyst and so working my way through the tutorial.  
Everything has been working fine until i reached the "A STATIC  
DATABASE MODEL WITH DBIx::Class" section of the MoreCatalystBasics  
tutorial.


After generating the static schema files and adding the relationships  
as directed, running the test server causes this error:


mrc1-181:MyApp adam$ script/myapp_server.pl
Couldn't instantiate component "MyApp::Model::DB", "Cannot load schema  
class 'MyApp::Schema': DBIx::Class::Schema::throw_exception():  
DBIx::Class::Row::throw_exception(): Can't locate MyApp/Schema/ 
Authors.pm in @INC (@INC contains: /Library/WebServer/Documents/ 
Catalyst/MyApp/script/../lib /Library/Frameworks/R.framework/Resources/ 
library/RSPerl/perl/darwin-thread-multi-2level /usr/local/install/ 
Ensembl/ensembl/modules/ /usr/local/install/Ensembl/ensembl-compara/ 
modules/ /usr/local/lib/perl5/5.8.9/darwin-thread-multi-2level /usr/ 
local/lib/perl5/5.8.9 /usr/local/lib/perl5/site_perl/5.8.9/darwin- 
thread-multi-2level /usr/local/lib/perl5/site_perl/5.8.9 .) at /usr/ 
local/lib/perl5/site_perl/5.8.9/Class/C3/Componentised.pm line 126.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.8.9/ 
Class/C3/Componentised.pm line 126.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.8.9/ 
Catalyst/Model/DBIC/Schema.pm line 333.

 at script/myapp_server.pl line 55" at script/myapp_server.pl line 55
Compilation failed in require at script/myapp_server.pl line 55.

I think the problem is that my Authors.pm, Books.pm and BookAuthors.pm  
were all created in MyApp/Schema/Result/ rather than MyApp/Schema/  
which is what the Tutorial seems to expect (as shown by the line "edit  
lib/MyApp/Schema/Books.pm")


I'm not sure if this is a DBIx::Class issue or a Catalyst issue. Does  
anyone know how to rectify this problem?


DBIx::Class = 0.08012
Catalyst = 5.71000

thanks for any help

adam

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