Re: [Catalyst] Catalyst Framework website redirected to theyaomingfoundation.org

2022-07-28 Thread David Precious
On Thu, 28 Jul 2022 12:46:46 +0800
Turritopsis Dohrnii Teo En Ming  wrote:

> I notice that the Catalyst Framework website redirects to 
> theyaomingfoundation.org. 

http://catalyst.perl.org/ works fine.

catalystframework.org on the other hand, as you say, redirects to
theyaomingfoundation.org.

It doesn't look like the domain has expired.

https://dnshistory.org/dns-records/catalystframework.org shows the
history.

Looks like back in 2021-11-25, SOA changed from dns1.scsys.net
(Shadowcat's DNS) to ns01.domaincontrol.com (GoDaddy), then on
2022-02-24 to ns1.siteground.net.

https://dnshistory.org/historical-dns-records/a/catalystframework.org
shows the IP it resolved to was 217.168.150.38 from 2010 into late
2021, then changed to 34.98.99.30.

Hopefully someone with access to the domain (mst?) can have a look and
see what's happened here?


> Has the project been retired?

Not as far as I'm aware, and I hope not :)



___
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] Access-Control-Allow-Origin

2018-06-15 Thread David Dorward

cOn 15 Jun 2018, at 13:54, Theo Bot wrote:

Can anybody tell me to to add an "Access-Control-Allow-Origin" in the
header:

I've tried "$c->response->header('Access-Control-Allow-Origin' => 
'*');


That's how you do it.


But I don't see it in the response


Is that line of code actually running for the response?

Have you put it on the wrong route by mistake?

Are you putting it on the response for a POST or GET request when the 
browser is making a preflight OPTIONS request which isn't being handled 
by that?


___
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] Simple question about "use Catalyst"

2015-10-19 Thread David Schmidt
My guess, it makes sure you run at least v5.80 possibly because older
versions are not supported anymore. I am sure someone will correct me
if I am wrong.

http://perldoc.perl.org/functions/use.html

"If the VERSION argument is present between Module and LIST, then the
use will call the VERSION method in class Module with the given
version as an argument. The default VERSION method, inherited from the
UNIVERSAL class, croaks if the given version is larger than the value
of the variable $Module::VERSION"

On 19 October 2015 at 15:21, Andrew  wrote:
>
> I ran catalyst.pl to create a new app (at least I think that's how I did it
> - it was a couple of days back now),
> and when I opened the main pm file, near the top was:
>
> use Catalyst::Runtime 5.80;
>
> I'd just installed Catalyst 5.90101 via cpanm, so wasn't sure why 5.80 was
> written there (for compatibility reasons?),
> so as I modify the script to suit my purposes, I've changed it to:
>
> use Catalyst::Runtime 5.90101;
>
> ...does it do anything, or make any difference?
> What was the significance of 5.80 being written there?
> Should I have left it as it was?
>
>
>
> ___
> 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] Catalyst authentication w/ CAS

2015-09-09 Thread David Schmidt
Have you looked at the test application of the CAS module?

https://metacpan.org/source/KKANE/Catalyst-Authentication-Credential-CAS-0.05/t/lib/MyApp/lib/MyApp.pm

On 9 September 2015 at 05:40, Baron Fujimoto
 wrote:
> Hello,
>
> ObWarning: Total Catalyst noob here. I'm fairly familiar with Perl, but
> am just getting started with Catalyst. I'm more used to back-end, or
> command line type perl applications and utilities, but now I'm trying to
> develop a fairly simple web application and my survey of options turned
> up Catalyst. So far I've run through the tutorials up through
> Authorization at ,
> though I won't pretend I've grokked most of it yet.
>
> One of the reasons I've decided to try Catalyst, is that I would like to
> authenticate the app's users with JASIG's CAS, and I noted that there's a
> Catalyst::Authentication::Credential::CAS module.
>
> Is there a more fleshed out example of using this than in the metacpan
> documentation?
>
> I'm starting with trying to add CAS authentication to what is basically
> the Tutorial's Hello World app at the end of
> 
>
> Per the Authentication tutorial and the documentation for
> Catalyst::Authentication::Credential::CAS, I have the following in
> lib/MyApp.pm:
>
>
> use Catalyst qw/
> -Debug
> ConfigLoader
> Static::Simple
>
> StackTrace
>
> Authentication
>
> Session
> Session::Store::File
> Session::State::Cookie
> /;
>
> ...
> # modified to match the style in the AuthN tutorial
> __PACKAGE__->config(
> 'Plugin::Authentication' => {
> default_realm => 'default',
> default => {
> credential => {
> class  => 'CAS',
> uri=> 'https://cas.example.com/cas',
> #username_field => 'username', # optional
> #version=> '2.0',  # optional
> },
> },
> #store => {
> #  ...
> #},
> },
> );
>
> And in lib/MyApp/Controller/Root.pm:
>
> When the development server reloads, I get the following output:
>
> [debug] Debug messages enabled
> [debug] Statistics enabled
> [debug] Loaded Config ".../MyApp/myapp.conf"
> [debug] Setting up auth realm default
> [debug] No Store specified for realm "default", using the Null store.
> Global symbol "$c" requires explicit package name at
> +.../MyApp/script/../lib/MyApp/Controller/Root.pm line 74.
> Global symbol "$c" requires explicit package name at
> +.../MyApp/script/../lib/MyApp/Controller/Root.pm line 74.
> Global symbol "$c" requires explicit package name at
> +.../MyApp/script/../lib/MyApp/Controller/Root.pm line 75.
> Global symbol "$c" requires explicit package name at
> +.../MyApp/script/../lib/MyApp/Controller/Root.pm line 76.
> BEGIN not safe after errors--compilation aborted at
> +.../MyApp/script/../lib/MyApp/Controller/Root.pm line 79.
>
> I had commented out 'store' in the Plugin::Authentication config hash
> since I wasn't sure what to use there yet, and at least it seems nominally
> ok with a "Null" store for now.
>
> I'm not sure why the global symbol errors though, since since $c is used
> in the other methods.
>
> I apologize for what are probably very basic questions, but I would
> appreciate any guidance here.
>
> Aloha,
> -baron
>
> ___
> 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] Where best to store database connection information?

2015-02-16 Thread David Schmidt
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 awit...@sgul.ac.uk 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/


Re: [Catalyst] How to get default()-like behavior outside of the Root controller

2015-02-09 Thread David Schmidt
On 9 February 2015 at 10:59, Dmitry L. dim0...@gmail.com wrote:
 I'd rather split one application into several (admin app, survey app,
 etc) and join its via middleware.

I wrote a blog article a few months ago:
http://blogs.perl.org/users/davewood/2014/08/splitting-a-catalyst-app-and-recombining-it-with-plackbuilder.html

___
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 5.90080 on CPAN!

2015-01-19 Thread David Schmidt
you could install new versions of CPAN modules into a local::lib
directory and run your testsuite afterwards to see if the upgrade
works for you. if it doesnt work simply delete the local::lib
directory and you all updates are undone.

https://metacpan.org/pod/local::lib

another option that I like to use is to make a git repository out of
my perl5 folder, if something breaks I roll back.

On 19 January 2015 at 11:22, Craig Chant cr...@homeloanpartnership.com wrote:
 Hi,

 Should I always update my Catalyst and if so, can someone please point me to 
 the upgrade step by step documentation.

 I remember the last time I re-installed Catalyst due to getting a new PC and 
 when firing up my dev machine it refused to run the app because it had been 
 developed on a different version of Catalyst.

 I've been reluctant to change / upgrade anything ever since and would 
 appreciate some guidance as I don't' think just replacing / upgrading the 
 Catalyst Runtime will work?

 I'm currently running ...

 Devel : Version 1.37
 Runtime: Version 5.90062

 Note: I use Perl Package Manager on Windows IIS, so anything with CLI *nix is 
 not helpful.

 Many thanks,

 Craig (SSPL)

 -Original Message-
 From: John Napiorkowski [mailto:jjn1...@yahoo.com]
 Sent: 09 January 2015 17:18
 To: The Elegant MVC Web Framework
 Subject: [Catalyst] Catalyst 5.90080 on CPAN!

 Hey All!

 We just cut 5.90080 release to stable.

 Get it = https://metacpan.org/release/JJNAPIORK/Catalyst-Runtime-5.90080

 Info and overview =
 http://jjnapiorkowski.typepad.com/modern-perl/2015/01/perl-catalyst-590080-released-to-cpan.html

 Enjoy and shout out if you see trouble!

 jnap

 ___
 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/
 This Email and any attachments contain confidential information and is 
 intended solely for the individual to whom it is addressed. If this Email has 
 been misdirected, please notify the author as soon as possible. If you are 
 not the intended recipient you must not disclose, distribute, copy, print or 
 rely on any of the information contained, and all copies must be deleted 
 immediately. Whilst we take reasonable steps to try to identify any software 
 viruses, any attachments to this e-mail may nevertheless contain viruses, 
 which our anti-virus software has failed to identify. You should therefore 
 carry out your own anti-virus checks before opening any documents. HomeLoan 
 Partnership will not accept any liability for damage caused by computer 
 viruses emanating from any attachment or other document supplied with this 
 e-mail. HomeLoan Partnership reserves the right to monitor and archive all 
 e-mail communications through its network. No representative or employee of 
 HomeLoan Partnership h
 as the authority to enter into any contract on behalf of HomeLoan Partnership 
by email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: Pharos House, 67 High Street, Worthing, West Sussex, BN11 1DN. H L 
Partnership Limited is authorised and regulated by the Financial Conduct 
Authority.

 ___
 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] Help on Catalyst::Plugin::RunAfterRequest

2014-10-06 Thread David Schmidt
If you run a long-running process inside of your webserver process the
process will not be available to handle new web requests anymore. you
probably want a job-queue of some sort.

http://stackoverflow.com/questions/25277158/run-asynchronous-methods-in-catalyst-perl

http://blogs.perl.org/users/davewood/2014/07/asynchronuous-task-distribution-with-anyevent-and-zeromq.html

cheers
david

On 6 October 2014 15:53, Antonio Soro antonio.s...@koinesistemi.it wrote:
 Hello,
 I plan to run server code in asynchronous mode after a response back to the
 client made from an action code in a Catalyst controller.

 I'm using Catalyst::Plugin::RunAfterRequest plugin in a Catalyst 5.80
 environment started in 'FastCGI' mode, called by Apache2 httpd server, with
 FastCgiExternalServer directive of mod_fastcgi.c module (v2.4.6), in a Linux
 UBUNTU box with Perl 5.12.4.

 It seems, in that environment, response for client request occurs after long
 time processing, differently that I run Catalyst Runtime in 'Server' mode
 where response back to the client occurs immediately and long time processing
 occurs delayed.

 Can somebody tell me this behavior is correct or there is something wrong?
 Are there better methods to call long-time-running code across
 Apache/FastCGI/Catalyst ?

 Thanks for feedback.
 Antonio Soro.

 ---
 Questa comunicazione e ogni eventuale file allegato sono confidenziali
 e destinati all'uso esclusivo del destinatario. Se avete ricevuto
 questo messaggio per errore Vi preghiamo di comunicarlo al mittente e
 distruggere quanto ricevuto.


 ___
 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] Inconsistency when retrieving objects from stash

2014-04-25 Thread David Trudgian
Hi,

I'm observing a frustrating problem where the following happens:

A Catalyst controller retrieves a 'search' object and the related parent 
'submission' object from a DBIC schema instance. It puts them into the stash:

  $c-model('CPFP')-schema-resultset('Searches')-find($sch_id);
  $c-stash-{search} = $search;
  $c-stash-{submission} = $search-submission;

Now, the relationships here mean it's always the case that 
$search-submission-sub_id = $submission-sub_id

However, when forwarded to the view (TT2 HTML or Excel Template Plus based), 
occasionally the search and submission pulled back out of the stash in the 
template are inconsistent. The following trap in the template will throw an 
error:

[% IF search.submission.sub_id != submission.sub_id %]
  [% THROW mismatch Fatal Error SCH-SUB-ID != SUB-ID %]
[% END %]

I don't understand how this is possible, given the way the stash values are set 
in the controller. It occurs infrequently, and I can't find a situation that 
reproducibly causes it. The app is running under fastcgi on Apache.

Any thoughts on what to look at would be much appreciated. I was considering 
session crossover as a cause, so ensured there was entropy on the server, set 
no-cache headers for proxies etc. However, I have now seen this occur on a 
development machine with only me connected to the app. I don't understand well 
enough how the stash works in order to know what might affect the consistency 
like this.

Any help greatly appreciated!

Dave Trudgian





UT Southwestern Medical Center
The future of medicine, today.


___
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] Inconsistency when retrieving objects from stash

2014-04-25 Thread David Trudgian
Hi Rob,

Thanks for the input. Yeah, I need to dedicate a bunch of time to looking at 
this and paring it down to find where the problem occurs. The major headache 
there is that I use this system heavily every day, and I might see the issue a 
couple of times a month. I just haven't been able to reproduce it, despite 
trying to replicate the usage when I have observed it.

If the stash is just a request specific hashref then I must have 
reassignment/modification of one of the objects somewhere.

Thanks,

DT 



-Original Message-
From: Robert Brown [mailto:r...@intelcompute.com] 
Sent: Friday, April 25, 2014 2:18 PM
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Inconsistency when retrieving objects from stash

Hi Dave,

 From what I understand, there is nothing magical about the stash, it's 
basically a hash reference, used once per request, that is all.

So, I would suggest you look at debugging more the objects you're storing in 
the stash, and how they may change during the request cycle.

You would need to supply more code samples/examples.

If you can, start stripping away what's not necessary and still be able to 
re-produce the problem, it will most probably highlight the issue by itself.

Otherwise, reply back with a full working example.

Ideally use something like http://paste.scsys.co.uk to paste your code 
snippets, post as much as you can, it's usually the subtle bits you don't think 
are important where the actual issue lies.


Rob


On 04/25/2014 08:08 PM, David Trudgian wrote:
 Hi,

 I'm observing a frustrating problem where the following happens:

 A Catalyst controller retrieves a 'search' object and the related parent 
 'submission' object from a DBIC schema instance. It puts them into the stash:

$c-model('CPFP')-schema-resultset('Searches')-find($sch_id);
$c-stash-{search} = $search;
$c-stash-{submission} = $search-submission;

 Now, the relationships here mean it's always the case that 
 $search-submission-sub_id = $submission-sub_id

 However, when forwarded to the view (TT2 HTML or Excel Template Plus based), 
 occasionally the search and submission pulled back out of the stash in the 
 template are inconsistent. The following trap in the template will throw an 
 error:

 [% IF search.submission.sub_id != submission.sub_id %]
[% THROW mismatch Fatal Error SCH-SUB-ID != SUB-ID %] [% END %]

 I don't understand how this is possible, given the way the stash values are 
 set in the controller. It occurs infrequently, and I can't find a situation 
 that reproducibly causes it. The app is running under fastcgi on Apache.

 Any thoughts on what to look at would be much appreciated. I was considering 
 session crossover as a cause, so ensured there was entropy on the server, set 
 no-cache headers for proxies etc. However, I have now seen this occur on a 
 development machine with only me connected to the app. I don't understand 
 well enough how the stash works in order to know what might affect the 
 consistency like this.

 Any help greatly appreciated!

 Dave Trudgian



 

 UT Southwestern Medical Center
 The future of medicine, today.


 ___
 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] Catalyst Unicode

2014-01-31 Thread David Schmidt
https://metacpan.org/pod/release/JJNAPIORK/Catalyst-Runtime-5.90053/lib/Catalyst/Upgrading.pod#Catalyst::Plugin::Unicode::Encoding-is-now-core


and in your test script, im pretty sure if you are using unicode chars
in your perl code you have to use utf8 in it.

also, use warnings instead of perl -w

#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode;
my $encoding = Encode::find_encoding(UTF-8);
warn Encoding: $encoding\n;
my $t = Ümläuts;
warn Is utf8: , Encode::is_utf8($t),  , utf8::is_utf8($t), \n;
$encoding-decode($t);
# utf8::decode($t);
warn Is utf8: , Encode::is_utf8($t),  , utf8::is_utf8($t), \n;
binmode STDOUT, ':utf8';
print T=$t\n;


david@nio:~$ perl foo.pl
Encoding: Encode::utf8=HASH(0x1f22390)
Is utf8: 1 1
Is utf8:
T=Ümläuts

On 31 January 2014 12:29, Christian Lackas christ...@lackas.net wrote:
 Hi Everybody,

 I noticed that paramters in my Catalyst application are not
 automatically decoded to UTF-8, although I use

 use Catalyst qw/
 ...
 Unicode::Encoding
 ...
 /;
 __PACKAGE__-config(
 ...
 encoding = 'UTF-8',
 ...
 );

 I tracked this down to Catalyst::Plugin::Unicode::Encoding::\
 _handle_param_unicode_decoding() where I find the line

 $enc-decode($value, $CHECK)

 that does not seem to have the (my) expected outcome.

 Here is a small test script:

 #!perl -w
 use strict;
 use Encode;
 my $encoding = Encode::find_encoding(UTF-8);
 warn Encoding: $encoding\n;
 my $t = Ümläuts;
 warn Is utf8: , Encode::is_utf8($t),  , utf8::is_utf8($t), \n;
 $encoding-decode($t);
 # utf8::decode($t);
 warn Is utf8: , Encode::is_utf8($t),  , utf8::is_utf8($t), \n;
 binmode STDOUT, ':utf8';
 print T=$t\n;
 --
 $ perl enc.pl
 Encoding: Encode::utf8=HASH(0x1994cb8)
 Is utf8:
 Is utf8:
 T=Ümläuts

 When I replace above '$encoding-decode($t)' with 'utf8::decode($t)'
 then it works as expected:

 $ perl enc.pl
 Encoding: Encode::utf8=HASH(0x1e02cb8)
 Is utf8:
 Is utf8: 1 1
 T=Ümläuts

 What am I doing wrong here? Or do I misunderstand what this code should
 do? Any hints are highly appreciated. Thanks.

 Christian

 --
 Dr. Christian Lackas, Managing Partner
 inviCRO, LLC -- In Imaging Yours
 P: +1 617 963 0263, F: +49 2203 9034722, E: lac...@invicro.com
 http://www.invicro.com/  http://www.spect-ct.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] Can't detach from root / create action object

2013-11-27 Thread David Schmidt
You should tell us what you want to achieve.

I want to pass an action to detach() is not a proper problem description.


The documentation is pretty clear on what is expected.
https://metacpan.org/pod/Catalyst#c-detach-action-arguments

$c-detach( $action [, \@arguments ] )
$c-detach( $class, $method, [, \@arguments ] )
$c-detach()

Have you checked the Catalyst Tutorial. It should provide examples for detach()
There is also the test suite which you can grep for detach.





On 27 November 2013 13:00, Craig Chant cr...@homeloanpartnership.com wrote:
 I seem to be going round in circles unable to understand how I create an
 action object so I can pass it to detach as the IRC has told me to pass in
 an action and not what I thought which was ‘controller_name, subroutine’.



 E.G.



 $c-detach(‘my_controller_name’,’index’);



 But it seems that this signature is  (‘class_name’, ‘subroutine’)



 I’m having a problem with Catalyst randomly deciding when it is OK to have a
 controller and a model called the same, as I have in the same root auto
 subroutine ,



 $c-detach(‘splashscreen’,’index’).



 Where I have both a controller called ‘SplashScreen’ and a model called
 ‘SplashScreen’, and the detach works fine.



 However, for another controller / model pair called ‘ComplianceUpdates’,



 This doesn’t work



 $c-detach(‘complianceupdates’,’index’).



 and errors with…

 Couldn't forward to ComplianceUpdates. Does not implement process

 Couldn't detach to command complianceupdates: Invalid action or component.

 So If I am to use



 $c-detach($action);



 How do I create a Catalyst::Action object.



 What attributes am I meant to be setting in the object before I pass it in,
 and where are the docs for this as I can’t find them.



 All help is appreciated.





 Craig Chant

 Information Technology Manager





   Direct Line: 01903 227 753   Main Line: 01903 602 664   Website:
 www.homeloanpartnership.com





 This Email and any attachments contain confidential information and is
 intended solely for the individual to whom it is addressed. If this Email
 has been misdirected, please notify the author as soon as possible. If you
 are not the intended recipient you must not disclose, distribute, copy,
 print or rely on any of the information contained, and all copies must be
 deleted immediately. Whilst we take reasonable steps to try to identify any
 software viruses, any attachments to this e-mail may nevertheless contain
 viruses, which our anti-virus software has failed to identify. You should
 therefore carry out your own anti-virus checks before opening any documents.
 HomeLoan Partnership will not accept any liability for damage caused by
 computer viruses emanating from any attachment or other document supplied
 with this e-mail. HomeLoan Partnership reserves the right to monitor and
 archive all e-mail communications through its network. No representative or
 employee of HomeLoan Partnership has the authority to enter into any
 contract on behalf of HomeLoan Partnership by email. HomeLoan Partnership is
 a trading name of H L Partnership Limited, registered in England and Wales
 with Registration Number 5011722. Registered office: Pharos House, 67 High
 Street, Worthing, West Sussex, BN11 1DN. H L Partnership Limited is
 authorised and regulated by the Financial Conduct Authority.

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

attachment: image002.jpgattachment: image004.jpg___
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 starter template

2013-09-03 Thread David Schmidt
Quite late but when I read your email again i had to think of this
other module which does a similiar thing and thought I'd mention it
here.

https://github.com/marcelgruenauer/CatalystX-Crudite

CatalystX-Crudite is a framework for writing Catalyst-based CMS web
applications. It includes out-of-the-box user and role management and
many starter templates. It builds upon CatalystX-Resource and
CatalystX-SimpleLogin.

In order for crudite_starter to work, you need to install this
distribution. The starter templates are stored as per-dist shared
files using File::ShareDir, so they can't be found from the
uninstalled repository. I hope to improve this in a later version.


On 17 August 2013 21:21, Ynon Perek ynonpe...@gmail.com wrote:
 Hi All,

 After working with catalyst for some time, I found catalyst.pl too
 minimalistic for my needs.

 So I created a small script called ctstarter.pl that adds some features to
 the base template you get for a new project. Currently it adds:

 1. A starter DB and migrations (using DBIx::Class::Migration)
 2. Code and DB tables for managing users and roles (using
 CatalystX::SimpleLogin)
 3. A Twitter Bootstrap web view with templates (using
 Catalyst::Helper::View::Bootstrap)
 4. Two helper scripts: one to upgrade the DB and the other to reset admin
 password.

 You can find the source and usage instructions here:
 https://github.com/ynonp/ctstarter.pl

 Any feedbacks is appreciated.

 Cheers,
   Ynon



 ___
 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] New design

2013-07-23 Thread David Dorward

On 23 Jul 2013, at 9:48, Mark Keating wrote:

The nice chaps at Evozon have recently been making design mocks for a 
bunch of Perl sites and they have come up with a fresh look for 
Catalyst. Take a look and let me know what you guys think.


It's very pretty, I *love* the look of many of the graphics, and there 
are some nice ideas in there.


However, it is a very wide design which is going to lead to horizontal 
scrolling (the red section could do with having 2 rows of 3 things 
instead of 1 of 5, the space between the text and the book graphic could 
be reduced, the two guides to getting a decent Perl environment could do 
with being shunted off to their own page with a choice of links instead 
of a choice of columns) with some very tiny fonts (really tiny, the font 
size could do with being a lot bigger).


I like the space theme, although as other people have commented it isn't 
Catalyst's traditional theme. I'd carry the dotted graphic theme through 
to the red section though (possibly with the telescope being done in 
that style).


The Dancing astronauts are cute but more suggestive of Dancer than 
Catalyst!


Then we come to Man With A Brick. Putting the first brick in place is a 
good image for getting started … but completely breaks from the space 
theme from elsewhere in the page. It's also the first section that uses 
translucent backgrounds and it really feels like part of a different 
site.


The list of clients is nice, very clear and good at highlighting some 
high profile users of Catalyst. It suffers from too-many-columns but 
that is easily fixed.


--
David Dorward
http://dorward.co.uk/

___
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] List of Applications using Catalyst

2013-06-11 Thread David Dorward

On 10 Jun 2013, at 15:50, John Napiorkowski wrote:
As for the former, there's not a lot of people actively maintaining 
the site.


I couldn't find anywhere on the site that invites people to join in with 
the maintenance. It could do with an obvious sign up page (even if it 
comes with a you must have your account approved by an admin proviso 
to combat spam).


--
David Dorward
http://dorward.co.uk/

___
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] Slash character in argument of request URL

2013-04-08 Thread David Dorward

On 8 Apr 2013, at 13:06, Kieren Diment dim...@gmail.com wrote:

 Slashes in urls that aren't path separators are a pain.  Avoid by adjusting 
 your implementation.

+1

I once had to write a CGI script to use as a 404 handler to deal with Apache 
not liking %2F.

(I believe at that stage we could have also solved the problem by not using an 
out of date Apache, but on high rejected that option).

-- 
David Dorward
http://dorward.co.uk

___
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] Adding CaptureArgs for the whole controller?

2013-04-02 Thread David Schmidt
By using one action that captures args and all other actions chain from.


something like this:
https://github.com/davewood/catalystx-resource/blob/master/lib/CatalystX/Resource/Controller/Resource.pm

On 2 April 2013 22:07, Alex Povolotsky tark...@over.ru wrote:
 Hello!

 I'm implementing some sort of simple CRM, and I'd like to handle a chain
 like

 /domain/*/service/*/edit with controller App::Controller::Domain::Service,
 not with App::Controller::Domain

 How can I set CaptureArgs for the whole App::Controller::Domain::Service?
 I'd like to handle captured arg somewhere in begin or auto

 Alex



 ___
 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] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-31 Thread David Schmidt
Tomas asked for the debug output of the failing response.
You pasted only the server startup debug output.

On 31 October 2012 10:46, Craig Chant cr...@homeloanpartnership.com wrote:
 Sorry IRC?

 I did post the debug and output , has this email not been received?

 -Original Message-
 From: Tomas Doran [mailto:bobtf...@bobtfish.net]
 Sent: 30 October 2012 22:26
 To: The elegant MVC web framework
 Subject: Re: [Catalyst] I'm loosing the plot here? - Controller behaviour 
 that makes no sense


 On 30 Oct 2012, at 20:08, Craig Chant wrote:

 The path/controller/action is resolving correctly now, but any 
 response-body change I make in the 'index :Path' action, isn't showing  
 when i refresh my browser?

 You're not showing us the debug output of the failing request, so it's very 
 hard to help debug that request.

 If you want this form of interactive help, you'd be much better off dropping 
 into irc for interactive help, rather than the mailing list, which by it's 
 nature is more asynchronous.

 Hope to see you in irc!

 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/
 This Email and any attachments contain confidential information and is 
 intended solely for the individual to whom it is addressed. If this Email has 
 been misdirected, please notify the author as soon as possible. If you are 
 not the intended recipient you must not disclose, distribute, copy, print or 
 rely on any of the information contained, and all copies must be deleted 
 immediately. Whilst we take reasonable steps to try to identify any software 
 viruses, any attachments to this e-mail may nevertheless contain viruses, 
 which our anti-virus software has failed to identify. You should therefore 
 carry out your own anti-virus checks before opening any documents. HomeLoan 
 Partnership will not accept any liability for damage caused by computer 
 viruses emanating from any attachment or other document supplied with this 
 e-mail. HomeLoan Partnership reserves the right to monitor and archive all 
 e-mail communications through its network. No representative or employee of 
 HomeLoan Partnership has the authority to enter into any contract on behalf 
 of HomeLoan Partnership by email. HomeLoan Partnership is a trading name of H 
 L Partnership Limited, registered in England and Wales with Registration 
 Number 5011722. Registered office: 26-34 Old Street, London, EC1V 9QQ. H L 
 Partnership Limited is authorised and regulated by the Financial Services 
 Authority.

 ___
 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] Global 'helper' methods

2012-10-30 Thread David Schmidt
Perhaps it is feasible for you to bypass object inflation.

1)
DBIx::Class is not built for speed, it's built for convenience and
ease of use, but sometimes you just need to get the data, and skip the
fancy objects.

http://search.cpan.org/~frew/DBIx-Class-0.08200/lib/DBIx/Class/Manual/Cookbook.pod#Skip_row_object_creation_for_faster_results

2)
If the HashRefInflator solution above is not fast enough for you, you
can use a DBIx::Class to return values exactly as they come out of the
database
http://search.cpan.org/~frew/DBIx-Class-0.08200/lib/DBIx/Class/Manual/Cookbook.pod#Get_raw_data_for_blindingly_fast_results

___
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] Can't get view / template to work ?

2012-10-30 Thread David Schmidt
On 31 October 2012 00:00, Tomas Doran bobtf...@bobtfish.net wrote:

 On 30 Oct 2012, at 16:52, Craig Chant wrote:

 I seem stuck with implementing my first view / template.

 I have a controller Login.pm

 I ran the view helper script ‘create view HTML HTML::template’


 This can't possibly have worked? You mean create view HTML HTML::Template 
 right?

 As per the tutorial I’ve added the following to the config section of 
 MyApp.pm

 TEMPLATE_EXTENSION = '.tp',

 This needs to be inside the following block

 'View::HTML' = {
 #Set the location for templates files
 INCLUDE_PATH = [
 __PACKAGE__-path_to( 'root', 'src' ),
 ],
 },

C::M::Tutorial says otherwise

http://search.cpan.org/~zarquon/Catalyst-Manual-5.9004/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod#Create_a_Catalyst_View



 I have created a template in ‘root/src/login’  of login.tp

 In my controller I have …

 sub login :Path :Args(0) {
 my ( $self, $c) = @_;

 $c-stash(template = 'login.tp');

 }

 But all I get is…


 No idea.


 What am I doing wrong?


 Not showing us the full debug output of starting the server and making the 
 request.

 Sorry to be harsh - but it's impossible to divine what code your app is 
 running without that output…

 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/

___
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] Canot get application working on IIS7 via FastCGI

2012-10-18 Thread David Schmidt
 Though while we are on the subject of  Catalyst plug-ins, I do get this 
 message in the devel server output when it's started.

 [warn] Deprecated 'static' config key used, please use the key 
 'Plugin::Static::Simple' instead

 I've looked at the main application MyApp.pm in the lib folder and the 
 plug-ins loaded are :-

 use Catalyst qw/
 -Debug
 ConfigLoader
 Static::Simple
 StackTrace
 Session
 Session::Store::FastMmap
 Session::State::Cookie
 /;

 I've tried putting Plugin::Static::Simple insted but that falls over because 
 it can't locate the plug-in module, I've checked PPM and I have 
 'Plugin::Static::Simple' Catalyst CPAN module installed so am little stumped 
 especially with the limited beginners knowledge I have of your framework so 
 perhaps you could advise.



Doesnt really matter in this case. It just warns you to use

MyApp-config(
'Plugin::Static::Simple' = {
...
}
);

instead of

MyApp-config(
static = {
...
}
);

___
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] Canot get application working on IIS7 via FastCGI

2012-10-18 Thread David Schmidt
 As for the Data::Dumper information you requested, you will need to give me 
 more guidance because I can't get it to output anything?

 Firstly I cannot find the context variable '$c' , there is a '$ctx' , I 
 assume this is what was meant?

 I added

 dump($env);
 dump($ctx-request-uri);
 dump($ctx-request-base);

I am just guessing here but what I think you ought to do is

1)
enable debug output of your application by adding the -Debug flag to
your use Catalyst statement

2)
use Data::Dumper;
$ctx-log-debug(Dumper($ctx-request-uri))
...

___
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 update data of already logged-in user?

2012-07-11 Thread David Schmidt
The object returned by $c-user is not what you are looking for.

I assume you are using DBIC.

Get the real user object with $c-user-get_object()

http://search.cpan.org/~bobtfish/Catalyst-Plugin-Authentication-0.10021/lib/Catalyst/Authentication/User.pm#get_object(_)

cheers
david



On 11 July 2012 17:37, Sergey Dmitriev sergey.program...@gmail.com wrote:
 Hello,

 My question is simple. I have object of already authenticated user in $u by
 using

 my $u = $c-user()

 So, getter $u-email reflects actual email. How then can I update already
 loaded user object? E.g. i need something like:

 print $u-email; # old@email

 $u-email = 'new@email';

 print $u-email; # new@email

 How to achieve this simple way? Do I need to update user rec in DB then
 re-load user from DB? Then, which is the simplest way to re-trieve user
 again?

 Thank you.
 Sergey



 ___
 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] Can't get value from model

2012-06-13 Thread David Schmidt
Hi Kenneth,

that's a DBIC question


anyways, what is the output of ...

if ( $dept ) {
   warn REF:  . ref $dept .  DEPT_ID:  . $dept-department_id;
} else {
   warn No dept found;
}

... after your query?

On 13 June 2012 22:54, Kenneth S Mclane ksmcl...@us.ibm.com wrote:
 I am trying to get the value from a model call into a variable so I can use
 it for creating a DB record. I have tried multiple ways and cannot get the
 value to return. Here is my current attempt:

 my $dept = $c-model('ORANGES::Departments')-search_rs({'department_code'
 = $departmentcode}, {
                 columns = ['department_id'] });

 This returns 1.

 I tried this:

 my $dept = $c-model('ORANGES::Departments')-search_rs({'department_code'
 = $departmentcode}, {
                 columns = ['department_id'] })-single;

 and got a hash reference. I know I am missing something very simple. If I
 was putting this into the stash I know I could access the value, but I am at
 a loss as to how to get to it inside my code.


 ___
 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] Can't get value from model

2012-06-13 Thread David Schmidt
On 13 June 2012 23:34, Kenneth S Mclane ksmcl...@us.ibm.com wrote:
 David Schmidt davew...@gmx.at wrote on 06/13/2012 04:15:57 PM:

 From:

 David Schmidt davew...@gmx.at

 To:

 The elegant MVC web framework catalyst@lists.scsys.co.uk

 Date:

 06/13/2012 04:16 PM

 Subject:

 Re: [Catalyst] Can't get value from model

 Hi Kenneth,

 that's a DBIC question


 anyways, what is the output of ...

 if ( $dept ) {
    warn REF:  . ref $dept .  DEPT_ID:  . $dept-department_id;
 } else {
    warn No dept found;
 }

 ... after your query?

 On 13 June 2012 22:54, Kenneth S Mclane ksmcl...@us.ibm.com wrote:
  I am trying to get the value from a model call into a variable so I can
  use
  it for creating a DB record. I have tried multiple ways and cannot get
  the
  value to return. Here is my current attempt:
 
  my $dept =
  $c-model('ORANGES::Departments')-search_rs({'department_code'
  = $departmentcode}, {
                  columns = ['department_id'] });
 
  This returns 1.
 
  I tried this:
 
  my $dept =
  $c-model('ORANGES::Departments')-search_rs({'department_code'
  = $departmentcode}, {
                  columns = ['department_id'] })-single;
 
  and got a hash reference. I know I am missing something very simple. If
  I
  was putting this into the stash I know I could access the value, but I
  am at
  a loss as to how to get to it inside my code.
 
 
 [error] Caught exception in dbms::Controller::Account-add Can't locate
 object method department_id via package DBIx::Class::ResultSet at
 /home/ksmclane/catalyst/dbms/script/../lib/dbms/Controller/Account.pm line
 49.


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


your $dept is a resultset not a row item
use the following code to get $dept

my $dept =
$c-model('ORANGES::Departments')-search_rs(
   { 'department_code' = $departmentcode},
   { columns = ['department_id'] }
)-single;

warn ...; # what I wrote earlier

assuming the rest of your code is corrent this should return a row
object with a department_id accessor ($dept-department_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/


Re: [Catalyst] DBIx::Class::ResultSet::all(): DBI Exception: DBD::DB2::db prepare_cached failed: [IBM][CLI Driver][DB2/AIX64] SQL0204N DBUSERNAME.ACCOUNT_VIEW is an undefined name.

2012-04-26 Thread David Schmidt
$rs-all returns an array so you should call it in list context like this.

$c-stash(
   accounts = [ $c-model('ORANGES::AccountView')-all ]
);

no idea if that changesyour error msg but it is a start.

david

On 26 April 2012 21:05, Kenneth S Mclane ksmcl...@us.ibm.com wrote:
 I do not understand this error at all. It is tacking the DB user name onto
 the model name. Any hints why this is happening?

 This is my list sub:

 sub list :Local {
         my ($self, $c) = @_;
         $c-stash(accounts = $c-model('ORANGES::AccountView')-all);
         $c-stash(template = 'accountview/list.tt2');
 }

 The model exists, if I remove the -all I get a different error but at
 least the stash gets populated with a bunch of info ABOUT the model, not the
 actual data. With it left in I never get anything but the error.

 Any help appreciated.
 ___
 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] Remove Catalyst and start over?

2012-03-23 Thread David Schmidt
run moose-outdated.

moose-outdated is a tool that ships with Moose to help you spot
dependency problems

On 23 March 2012 18:06, Robyn Jonahs learn.catal...@gmail.com wrote:
 Hi,

 I am new to perl and Catalyst. I am working with an Os X 10.6 system with
 perl perl 5, version 12, subversion 3 (v5.12.3). I used CPAN

 cpan i
 CPAN
 Bundle    Bundle::CPAN   (ANDK/Bundle-CPAN-1.861.tar.gz)
 Module  = CPAN   (ANDK/CPAN-1.9800.tar.gz)
 2 items found

 to install Catalyst::Devel in the system perl archive a few days ago.

 I can't seem to start a new catalyst application and old ones that I tried
 to make years ago when I first decided to try to learn Cat won't start
 either. I think that I want to remove Catalyst from the system perl and
 install perl locally and then cat locally.



 My question is how do I remove this recent install of catalyst::devel?



 Thanks so much in advance!!!
 QC



 Alternately I don't know what to do to make the one I just installed work

 FYI

 1. When I try to start a new catalyst app it says that it can't find
 catalyst.pl
   This is the same as root (via sudo) or in my user login

 2. When I try to run an old cat app I seem to get Moose errors
 LolCatalyst-Lite$ cd script/
 script$ ./lolcatalyst_lite_server.pl
 load_first_existing_class is not exported by the Class::Load module
 Can't continue after import errors at
 /usr/local/ActivePerl-5.12/site/lib/Moose/Util.pm line 12
 BEGIN failed--compilation aborted at
 /usr/local/ActivePerl-5.12/site/lib/Moose/Util.pm line 12.
 Compilation failed in require at
 /usr/local/ActivePerl-5.12/site/lib/Moose/Meta/Class.pm line 28.
 BEGIN failed--compilation aborted at
 /usr/local/ActivePerl-5.12/site/lib/Moose/Meta/Class.pm line 28.
 Compilation failed in require at
 /usr/local/ActivePerl-5.12/site/lib/Moose.pm line 28.
 BEGIN failed--compilation aborted at
 /usr/local/ActivePerl-5.12/site/lib/Moose.pm line 28.
 Compilation failed in require at
 /usr/local/ActivePerl-5.12/site/lib/Catalyst/Engine.pm line 3.
 BEGIN failed--compilation aborted at
 /usr/local/ActivePerl-5.12/site/lib/Catalyst/Engine.pm line 3.
 Compilation failed in require at (eval 2) line 2.
     ...propagated at /usr/local/ActivePerl-5.12/lib/base.pm line 94.
 BEGIN failed--compilation aborted at
 /usr/local/ActivePerl-5.12/site/lib/Catalyst/Engine/HTTP.pm line 6.
 Compilation failed in require at ./lolcatalyst_lite_server.pl line 6.
 BEGIN failed--compilation aborted at ./lolcatalyst_lite_server.pl line 7.


 ___
 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] $C - uri_for containing current path in catalyst 5.90010

2012-03-08 Thread David Schmidt
I tested your code

sub exampleRedirect :Path(/oldPath) Args(0) {
my ( $self, $c ) = @_;
my %data = %{ $c-req-params };
my $url =  $c-uri_for( $self-action_for('newSub'), \%data );
$c-response-redirect( $url , 301 );
$c-log-debug(': ' . $url);
}

sub newSub :Path(/this/someOtherPath) Args(0) {}


[debug] Redirecting to http://myapp.at:3000/this/someOtherPath?cheese=nice;



On 8 March 2012 20:05,  ste...@majestic12.co.uk wrote:
 Hi.



 We were trying to use catalyst 5.90010 to run a webapp, and almost
 everything is totally lovely, apart from a few redirects.



 In version 5.90006 it all seems to be working well.



 The rewrite is along the lines of:



 sub exampleRedirect :Path( /oldPath ) Args(0)

 {

     my ( $self, $c ) = @_;

     my %data = %{ $c - req - params };

     # … actions on %data removed

     my $url =  $c - uri_for( $c - controller('This') -
 action_for('newSub'), \%data );

     $c - response - redirect( $url , 301 ) ;

 }



 sub newSub :Path(“/this/someOtherPath”) Args(0)

 {

     …

 }



 When the server is called, on 5.90006, for
 http://somedomain/oldPath?cheese=nice, $url becomes
 http://somedomain/this/someOtherPath?cheese=nice



 On 5.9.0010, the same url becomes
 http://somedomain/oldPath/this/someOtherPath?cheese=nice



 Obviously checked http headers and output $url above.



 Can anyone shed some light on this? It’s probably something stupid I’ve
 done, as I cannot find much in google.



 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/


___
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] $C - uri_for containing current path in catalyst 5.90010

2012-03-08 Thread David Schmidt
forgot to include my catalyst version

[info] Foo powered by Catalyst 5.90010

On 8 March 2012 20:49, David Schmidt davew...@gmx.at wrote:
 I tested your code

 sub exampleRedirect :Path(/oldPath) Args(0) {
    my ( $self, $c ) = @_;
    my %data = %{ $c-req-params };
    my $url =  $c-uri_for( $self-action_for('newSub'), \%data );
    $c-response-redirect( $url , 301 );
    $c-log-debug(': ' . $url);
 }

 sub newSub :Path(/this/someOtherPath) Args(0) {}


 [debug] Redirecting to http://myapp.at:3000/this/someOtherPath?cheese=nice;



 On 8 March 2012 20:05,  ste...@majestic12.co.uk wrote:
 Hi.



 We were trying to use catalyst 5.90010 to run a webapp, and almost
 everything is totally lovely, apart from a few redirects.



 In version 5.90006 it all seems to be working well.



 The rewrite is along the lines of:



 sub exampleRedirect :Path( /oldPath ) Args(0)

 {

     my ( $self, $c ) = @_;

     my %data = %{ $c - req - params };

     # … actions on %data removed

     my $url =  $c - uri_for( $c - controller('This') -
 action_for('newSub'), \%data );

     $c - response - redirect( $url , 301 ) ;

 }



 sub newSub :Path(“/this/someOtherPath”) Args(0)

 {

     …

 }



 When the server is called, on 5.90006, for
 http://somedomain/oldPath?cheese=nice, $url becomes
 http://somedomain/this/someOtherPath?cheese=nice



 On 5.9.0010, the same url becomes
 http://somedomain/oldPath/this/someOtherPath?cheese=nice



 Obviously checked http headers and output $url above.



 Can anyone shed some light on this? It’s probably something stupid I’ve
 done, as I cannot find much in google.



 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/


___
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] RESTful response codes.

2012-02-23 Thread David Stevenson
I suspect he's used to XML-RPC, where it's conventional to return, on error, a 
valid XML document and an HTTP status of 200. It's the content of the document 
that determines the status.

You should, IMO, try to steer them to your way of thinking, which seems rather 
more conventional for a RESTful API.

Regards
David

On 23 Feb 2012, at 23:25, Bill Moseley wrote:

 Here's a discussion I'm having with a consumer of an API.
 
 For a RESTful service they would like the API to ALWAYS include a response 
 body that includes a { status_block = { status = 'success } }.I, of 
 course, point out that HTTP already provides a complete list of http status 
 codes.  But, they suggest that there might be a time when additional status 
 is needed.   I cannot think of case where that would happen.  PUT a resource 
 and it's either successful or not -- there's no gray area.
 
 The HTTP spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html seems 
 pretty clear.
 
 Can anyone think of a reason to always return a status?  Or better, any 
 references that would be more helpful or convincing than the spec listed 
 above?
[sig snip]

___
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] Setting flash for tests

2012-02-18 Thread David Schmidt
Do you know about CatalystX::SimpleLogin it does exactly what you
described and probably is thoroughly tested.

as far as the testing is concerned i'd simply test the entire
procedure as it would take place in a real workflow.

1) GET /site_that_needs_login
2) check result is a redirect to loginform
3) POST /login with credentials
4) check result is redirect to /site_that_needs_login

You can also use
http://search.cpan.org/~mstrout/Catalyst-Runtime-5.90010/lib/Catalyst/Test.pm#%28$res,_$c%29_=_ctx_request%28_..._%29;
in order to access the context object and check $c-flash-{next}

On 17 February 2012 16:23, Robert Rothenberg rob...@gmail.com wrote:
 The Login controller, on a successful login, will redirect to the location
 in $c-{flash}-{next}, if it is set. (Basically, if the user visits a page
 that requires a login, he is redirected to the login page, and then is
 redirected back to the original page.)

 As far as I can tell, it works alright.

 I am unsure how to test this using Catalyst::Test, though.

 How can I set the next variable so as to test redirection?

 Thanks,
 Rob

 ___
 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] Listing all actions in app

2012-02-16 Thread David Schmidt
If you start your app in debug mode you get a list of all actions.

or ...

# catalyst.pl Foo
# cd Foo
# vim list_actions.pl
  1 #!/usr/bin/env perl
  2 use strict;
  3 use warnings;
  4 use v5.10.1;
  5 use FindBin qw/$Bin/;
  6 use lib $Bin/lib;
  7 use Data::Dumper;
  8 use Foo;
  9
 10 my $app = Foo-new();
 11
 12 my @controllers = map { $app-controller($_) } $app-controllers;
 13 for my $controller (@controllers) {
 14 my @actions = $controller-get_action_methods;
 15 say $_-name . ': ' . join(',', @{$_-attributes}) for @actions;
 16 }


david@kvm6:~/Foo$ perl list_actions.pl
_DISPATCH: Private
_BEGIN: Private
_AUTO: Private
_ACTION: Private
_END: Private
index: Path,Args(0)
default: Path
end: ActionClass('RenderView')



On 16 February 2012 18:34, Paolo Gianrossi paolino.gianro...@gmail.com wrote:
 Hi List!

 I have an app and I would like to be able to list (in a select, but
 whatever), all public actions in all controllers of my app.

 Is there an easy way to do this?

 Thanks a lot!

 cheers
 paolino

 --
 Paolo Gianrossi

 (An unmatched left parenthesis
  creates an unresolved tension
  that will stay with you all day
                                    -- xkcd


 ___
 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] Catalyst::TraitFor::Controller::Sendfile

2012-01-09 Thread David Schmidt
Time to continue ...

I want to support X-Sendfile and X-Accel-Redirect

Currently I have a Catalyst::TraitFor::Controller. but that doesn't
feel right. Should it be a plugin?

c-sendfile(...) seems more appropriate then c-controller(...)-sendfile

or rather a Catalyst::TraitFor::Request like
http://cpansearch.perl.org/src/MAROS/CatalystX-I18N-1.09/lib/CatalystX/I18N/TraitFor/Response.pm

But will that cause overhead for each request instance creation?

On 11 December 2011 13:57, Tomas Doran bobtf...@bobtfish.net wrote:

 On 11 Dec 2011, at 12:27, David Schmidt wrote:


 https://github.com/davewood/catalyst-traitfor-controller-sendfile/blob/master/lib/Catalyst/TraitFor/Controller/Sendfile.pm

 I want to continue working on it and have a few questions.

 - Is it still needed?


 Yes.


 - What should be changed?


 https://github.com/davewood/catalyst-traitfor-controller-sendfile/blob/master/lib/Catalyst/TraitFor/Controller/Sendfile.pm#L92

 https://github.com/davewood/catalyst-traitfor-controller-sendfile/blob/master/lib/Catalyst/TraitFor/Controller/Sendfile.pm#L99

 This totally won't work any more (in 5.9) I'm afraid.


 - any input regarding missing tests?


 Erm, IIRC your code is relying on / assuming that you're doing a sendfile on
 something that actually exists on the local (i.e. the web server's) local
 disk.

 This often isn't the case. (For example nginx's X-Accel-Redirect redirects
 to another path served by the web server, rather than a file on local disk).

 I think this is possible currently, but it's not documented / tested that
 the file could be entirely synthetic (and not correspond to a real file on
 the file system).

 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/

___
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] YA CRUD module

2011-12-22 Thread David Schmidt
I came across another issue.

CatalystX::Resource injects a controller into the app. the controller
extends Catalyst::Controller.

If I want to use Catalyst::ActionRole::ACL to deal with Authorization
on my resources the controller needs to extend C::C::ActionRole.

Should I extend from C::C::ActionRole or is there a smarter way to
change the base class only when the extra functionality is required?

david

___
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] YA CRUD module

2011-12-22 Thread David Schmidt
(02:28:32 PM) phenny: davewood: 21 Dec 16:54Z t0m tell davewood
there isn't really a smarter way yet, I'd just always extend that base
class

I am going to use ActionRole::MatchRequestMethod so C::C::ActionRole
is a requirement anyways now.

thanks.

On 22 December 2011 14:21, David Schmidt davew...@gmx.at wrote:
 I came across another issue.

 CatalystX::Resource injects a controller into the app. the controller
 extends Catalyst::Controller.

 If I want to use Catalyst::ActionRole::ACL to deal with Authorization
 on my resources the controller needs to extend C::C::ActionRole.

 Should I extend from C::C::ActionRole or is there a smarter way to
 change the base class only when the extra functionality is required?

 david

___
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] Reasonable way to get $c-config into Result class?

2011-12-12 Thread David Schmidt
http://wiki.catalystframework.org/wiki/wikicookbook/configpass2schema

I hope that solves your problem. I am in a bit of a hurry and didn't
read your mail very carefully

david

On 13 December 2011 01:49, will trillich w...@serensoft.com wrote:
 We have a Catalyst app where incidents can have attachments, and the
 attachments are stored in the filesystem (MySql backend is lethargic for
 in-DB binary blobs).

 Right now we're using a package global for storing the file-path-root, but
 obviously this should be handled via config somehow. Is there an elegant way
 to use MyApp.conf to set up a file-path that can get to $self-config
 consistently?

 If we use
     package MyApp::Schema::DB::Result::Incident;
     #...
     has 'config' = ( is = 'rw' );
     #...
 then in the Controller we have to inject something into $incident-config
 manually at create-time like so:

     package MyApp::Web::Controller::Incident;
     #...
     my $incident = $c-model('MyApp::Incident')-find({ id = $id });
     $incident-config( $c-config );

 But that only works in the context of a controller. If instead, we're coming
 in from a related record, such as an attachment, then
 $attachment-incident-config won't have any info, and no way to get it.

 I can see where DBIx::Class::Schema::Config allows pre-configuring
 credentials to connect to a database, but that's not what we're looking for
 here.

 Right now we have the file-path config stored in a global (yecch!) in the
 Result class, but would much rather have it in myapp.conf somehow...

 Clue stick welcome.


 --
 --
 will trillich -- http://faq.serensoft.com/
 The truth is that many people set rules to keep
 from making decisions. -- Mike Krzyzewski

 ___
 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] Catalyst::TraitFor::Controller::Sendfile

2011-12-11 Thread David Schmidt
https://github.com/davewood/catalyst-traitfor-controller-sendfile/blob/master/lib/Catalyst/TraitFor/Controller/Sendfile.pm

I want to continue working on it and have a few questions.

- Is it still needed?
- What should be changed?
- any input regarding missing tests?

___
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] YA CRUD module

2011-12-10 Thread David Schmidt
prove -l t
t/01_basic.t .. ok
t/02_crud.t ... ok
t/03_redirect_mode_list.t . ok
t/04_redirect_mode_show.t . ok
t/05_redirect_mode_show_parent.t .. ok
t/06_sortable.t ... ok
All tests successful.
Files=6, Tests=232, 18 wallclock secs ( 0.02 usr  0.21 sys + 10.34
cusr  6.65 csys = 17.22 CPU)
Result: PASS


time for a devel release :)

https://github.com/davewood/CatalystX-TraitFor-Controller-Resource

documentation needs some cleaning up though

On 6 December 2011 22:41, David Schmidt davew...@gmx.at wrote:
 I added quite some tests and generally see good progress.

 However ... I just tried the LoadableClass thingy.

 the error message before i installed MooseX::Types::LoadableClass was

 #   Failed test 'use TestApp;'
 #   at t/01_basic.t line 9.
 #     Tried to use 'TestApp'.
 #     Error:  Couldn't instantiate component
 TestApp::Controller::Resource::Artist, Could not find a class for
 trait: Form at /usr/local/share/perl/5.10.1/CatalystX/Component/Traits.pm
 line 145Compilation failed in require at (eval 8) line 2.
 # BEGIN failed--compilation aborted at (eval 8) line 2.


 didnt really make sense to me
 after installing MooseX::Types::LoadableClass
 the error changed to

 #   Failed test 'use TestApp;'
 #   at t/01_basic.t line 9.
 #     Tried to use 'TestApp'.
 #     Error:  Couldn't instantiate component
 TestApp::Controller::Resource::Artist, Attribute (form_class) does
 not pass the type constraint because: Validation failed for
 'MooseX::Types::LoadableClass::LoadableClass' with value undef at
 /usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm line 1131
 #       
 Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0xb5b9960)',
 'Form::Resource::Artist',
 'Moose::Meta::Class::__ANON__::SERIAL::11=HASH(0xb592450)') called at
 /usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm line 491
 #       
 Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0xb5b9960)',
 'Moose::Meta::Instance=HASH(0xb57c9c0)',
 'Moose::Meta::Class::__ANON__::SERIAL::11=HASH(0xb592450)',
 'HASH(0xb54e818)') called at
 /usr/local/lib/perl/5.10.1/Class/MOP/Class.pm line 524
 #       
 Class::MOP::Class::_construct_instance('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xb59ba50)',
 'HASH(0xb54e818)') called at
 /usr/local/lib/perl/5.10.1/Class/MOP/Class.pm line 497
 #       
 Class::MOP::Class::new_object('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xb59ba50)',
 'HASH(0xb54e818)') called at
 /usr/local/lib/perl/5.10.1/Moose/Meta/Class.pm line 269
 #       
 Moose::Meta::Class::new_object('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xb59ba50)',
 'HASH(0xb54e818)') called at
 /usr/local/lib/perl/5.10.1/Moose/Object.pm line 28
 #       Moose::Object::new('Moose::Meta::Class::__ANON__::SERIAL::11',
 'TestApp', 'HASH(0xb11d888)') called at constructor
 CatalystX::Resource::Controller::Resource::new (defined at
 /home/david/CatalystX-TraitFor-Controller-Resource/lib/CatalystX/Resource/Controller/Resource.pm
 line 343) line 4
 #       
 CatalystX::Resource::Controller::Resource::new('Moose::Meta::Class::__ANON__::SERIAL::11',
 'TestApp', 'HASH(0xb11d888)') called at
 /usr/local/share/perl/5.10.1/MooseX/Traits/Pluggable.pm line 139
 #       
 MooseX::Traits::Pluggable::_build_instance_with_traits('TestApp::Controller::Resource::Artist',
 'TestApp::Controller::Resource::Artist', 'TestApp') called at
 /usr/local/share/perl/5.10.1/MooseX/Traits/Pluggable.pm line 97
 #       
 MooseX::Traits::Pluggable::new_with_traits('TestApp::Controller::Resource::Artist',
 'TestApp', 'HASH(0xb53c890)') called at
 /usr/local/share/perl/5.10.1/CatalystX/Component/Traits.pm line 145
 #       
 CatalystX::Component::Traits::COMPONENT('TestApp::Controller::Resource::Artist',
 'TestApp', 'HASH(0xacb6948)') called at
 /usr/local/share/perl/5.10.1/Catalyst.pm line 2525
 #       eval {...} called at /usr/local/share/perl/5.10.1/Catalyst.pm line 
 2525
 #       Catalyst::setup_component('TestApp',
 'TestApp::Controller::Resource::Artist') called at
 /usr/local/share/perl/5.10.1/CatalystX/InjectComponent.pm line 152
 #       
 CatalystX::InjectComponent::_setup_component('CatalystX::InjectComponent',
 'TestApp', 'TestApp::Controller::Resource::Artist') called at
 /usr/local/share/perl/5.10.1/CatalystX/InjectComponent.pm line 142
 #       CatalystX::InjectComponent::inject('CatalystX::InjectComponent',
 'into', 'TestApp', 'component',
 'CatalystX::Resource::Controller::Resource', 'as',
 'Controller::Resource::Artist') called at
 /home/david/CatalystX-TraitFor-Controller-Resource/lib/CatalystX/Resource.pm
 line 12
 #       Class::MOP::Class:::after('TestApp') called at
 /usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 63
 #       Class::MOP::Method::Wrapped::__ANON__('TestApp') called at
 /usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 91
 #       TestApp::setup_components('TestApp') called at
 /usr/local/share/perl

Re: [Catalyst] YA CRUD module

2011-12-06 Thread David Schmidt
I added quite some tests and generally see good progress.

However ... I just tried the LoadableClass thingy.

the error message before i installed MooseX::Types::LoadableClass was

#   Failed test 'use TestApp;'
#   at t/01_basic.t line 9.
# Tried to use 'TestApp'.
# Error:  Couldn't instantiate component
TestApp::Controller::Resource::Artist, Could not find a class for
trait: Form at /usr/local/share/perl/5.10.1/CatalystX/Component/Traits.pm
line 145Compilation failed in require at (eval 8) line 2.
# BEGIN failed--compilation aborted at (eval 8) line 2.


didnt really make sense to me
after installing MooseX::Types::LoadableClass
the error changed to

#   Failed test 'use TestApp;'
#   at t/01_basic.t line 9.
# Tried to use 'TestApp'.
# Error:  Couldn't instantiate component
TestApp::Controller::Resource::Artist, Attribute (form_class) does
not pass the type constraint because: Validation failed for
'MooseX::Types::LoadableClass::LoadableClass' with value undef at
/usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm line 1131
#   
Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0xb5b9960)',
'Form::Resource::Artist',
'Moose::Meta::Class::__ANON__::SERIAL::11=HASH(0xb592450)') called at
/usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm line 491
#   
Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0xb5b9960)',
'Moose::Meta::Instance=HASH(0xb57c9c0)',
'Moose::Meta::Class::__ANON__::SERIAL::11=HASH(0xb592450)',
'HASH(0xb54e818)') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Class.pm line 524
#   
Class::MOP::Class::_construct_instance('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xb59ba50)',
'HASH(0xb54e818)') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Class.pm line 497
#   
Class::MOP::Class::new_object('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xb59ba50)',
'HASH(0xb54e818)') called at
/usr/local/lib/perl/5.10.1/Moose/Meta/Class.pm line 269
#   
Moose::Meta::Class::new_object('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xb59ba50)',
'HASH(0xb54e818)') called at
/usr/local/lib/perl/5.10.1/Moose/Object.pm line 28
#   Moose::Object::new('Moose::Meta::Class::__ANON__::SERIAL::11',
'TestApp', 'HASH(0xb11d888)') called at constructor
CatalystX::Resource::Controller::Resource::new (defined at
/home/david/CatalystX-TraitFor-Controller-Resource/lib/CatalystX/Resource/Controller/Resource.pm
line 343) line 4
#   
CatalystX::Resource::Controller::Resource::new('Moose::Meta::Class::__ANON__::SERIAL::11',
'TestApp', 'HASH(0xb11d888)') called at
/usr/local/share/perl/5.10.1/MooseX/Traits/Pluggable.pm line 139
#   
MooseX::Traits::Pluggable::_build_instance_with_traits('TestApp::Controller::Resource::Artist',
'TestApp::Controller::Resource::Artist', 'TestApp') called at
/usr/local/share/perl/5.10.1/MooseX/Traits/Pluggable.pm line 97
#   
MooseX::Traits::Pluggable::new_with_traits('TestApp::Controller::Resource::Artist',
'TestApp', 'HASH(0xb53c890)') called at
/usr/local/share/perl/5.10.1/CatalystX/Component/Traits.pm line 145
#   
CatalystX::Component::Traits::COMPONENT('TestApp::Controller::Resource::Artist',
'TestApp', 'HASH(0xacb6948)') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 2525
#   eval {...} called at /usr/local/share/perl/5.10.1/Catalyst.pm line 2525
#   Catalyst::setup_component('TestApp',
'TestApp::Controller::Resource::Artist') called at
/usr/local/share/perl/5.10.1/CatalystX/InjectComponent.pm line 152
#   
CatalystX::InjectComponent::_setup_component('CatalystX::InjectComponent',
'TestApp', 'TestApp::Controller::Resource::Artist') called at
/usr/local/share/perl/5.10.1/CatalystX/InjectComponent.pm line 142
#   CatalystX::InjectComponent::inject('CatalystX::InjectComponent',
'into', 'TestApp', 'component',
'CatalystX::Resource::Controller::Resource', 'as',
'Controller::Resource::Artist') called at
/home/david/CatalystX-TraitFor-Controller-Resource/lib/CatalystX/Resource.pm
line 12
#   Class::MOP::Class:::after('TestApp') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 63
#   Class::MOP::Method::Wrapped::__ANON__('TestApp') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 91
#   TestApp::setup_components('TestApp') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 1179
#   Catalyst::setup('TestApp') called at
/home/david/CatalystX-TraitFor-Controller-Resource/t/lib/TestApp.pm
line 65
#   require TestApp.pm called at (eval 8) line 2
#   main::BEGIN() called at
/home/david/CatalystX-TraitFor-Controller-Resource/t/lib/TestApp.pm
line 0
#   eval {...} called at
/home/david/CatalystX-TraitFor-Controller-Resource/t/lib/TestApp.pm
line 0
#   eval 'package main;
# use TestApp @{$args[0]};
# 1;
#
# ;' called at /usr/local/share/perl/5.10.1/Test/More.pm line 885
#   Test::More::_eval('package main;\x{a}use TestApp
@{$args[0]};\x{a}1;\x{a}', 'ARRAY(0xa01a5a0)') called at
/usr/local/share

Re: [Catalyst] YA CRUD module

2011-12-05 Thread David Schmidt
Here is a simple testcase of what I did. Once i noticed that i
required a method defined in the same role it made sense.

#!/usr/bin/env perl

use strict;
use warnings;
use Test::More;

{
package MyRole;
use Moose::Role;

requires 'a';
has a = (is = 'rw');
}

{
package MyClass;
use Moose;
with 'MyRole';
}

my $foo = MyClass-new({ a = 'foo' });
can_ok ($foo, 'a');

done_testing;


'MyRole' requires the method 'a' to be implemented by 'MyClass' at
/usr/local/lib/perl/5.10.1/Moose/Meta/Role/Application.pm line 53

Moose::Meta::Role::Application::apply('Moose::Meta::Role::Application::ToClass=HASH(0x9dc5a78)',
'Moose::Meta::Role=HASH(0x9dc55e8)',
'Moose::Meta::Class=HASH(0x9ce8170)') called at
/usr/local/lib/perl/5.10.1/Moose/Meta/Role/Application/ToClass.pm line
33

Moose::Meta::Role::Application::ToClass::apply('Moose::Meta::Role::Application::ToClass=HASH(0x9dc5a78)',
'Moose::Meta::Role=HASH(0x9dc55e8)',
'Moose::Meta::Class=HASH(0x9ce8170)', 'HASH(0x9c817c8)') called at
/usr/local/lib/perl/5.10.1/Moose/Meta/Role.pm line 482
Moose::Meta::Role::apply('Moose::Meta::Role=HASH(0x9dc55e8)',
'Moose::Meta::Class=HASH(0x9ce8170)') called at
/usr/local/lib/perl/5.10.1/Moose/Util.pm line 154
Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x9ce8170)',
undef, 'MyRole') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm
line 93
Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x9ce8170)',
'MyRole') called at /usr/local/lib/perl/5.10.1/Moose.pm line 65
Moose::with('Moose::Meta::Class=HASH(0x9ce8170)', 'MyRole')
called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 356
Moose::with('MyRole') called at ./test.pl line 18



On 5 December 2011 11:58, Tomas Doran bobtf...@bobtfish.net wrote:

 On 4 Dec 2011, at 23:46, David Schmidt wrote:

 just thought i'll keep you up to day so you dont waste time trying to
 help with a problem i already solved.

 Turns out the error cause was in one of the roles. It required a
 method declared in the same role.


 This has to be a Moose bug in some way.

 Moose should be able to complain that you are requiring a method you've
 already provided, and/or it shouldn't fail.

 Any chance of a small(ish) test case for this one?


 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/

___
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] YA CRUD module

2011-12-05 Thread David Schmidt
I updated my code so it does pretty much what CatalystX::SimpleLogin does.
Namely to inject a Controller then applying or removing traits.
Unlike SimpleLogin I want to be able to inject many Controllers.

here is what I came up with:

  1 use Catalyst qw/+CatalystX::Resource/;
  2
  3 __PACKAGE__-config(
  4 CatalystX::Resource = {
  5 controllers = {
  6 Artist = {
  7 resultset_key = 'artists_rs',
  8 resources_key = 'artists',
  9 resource_key = 'artist',
 10 model = 'DB:Artists',
 11 traits = ['-Delete'],
 12 },
 13 Song = {
 14 parent_key = 'artist',
 15 parents_accessor = 'songs',
 16 resources_key = 'songs',
 17 resource_key = 'song',
 18 model = 'DB::Songs',
 19 },
 20 },
 21 },
 22 );
 23
 24 after 'setup_components' = sub {
 25 my $class = shift;
 26 my $controllers
 27 = $class-config-{'CatalystX::Resource'}{'controllers'};
 28 while (my ($controller, $config) = each(%$controllers)) {
 29 CatalystX::InjectComponent-inject(
 30 into = $class,
 31 component = 'CatalystX::Resource::Controller::Resource',
 32 as = 'Controller::Resource::' . $controller,
 33 );
 34 }
 35 };

I wonder if it works. will test it when i have the time.

On 5 December 2011 12:51, David Schmidt davew...@gmx.at wrote:
 Here is a simple testcase of what I did. Once i noticed that i
 required a method defined in the same role it made sense.

 #!/usr/bin/env perl

 use strict;
 use warnings;
 use Test::More;

 {
    package MyRole;
    use Moose::Role;

    requires 'a';
    has a = (is = 'rw');
 }

 {
    package MyClass;
    use Moose;
    with 'MyRole';
 }

 my $foo = MyClass-new({ a = 'foo' });
 can_ok ($foo, 'a');

 done_testing;


 'MyRole' requires the method 'a' to be implemented by 'MyClass' at
 /usr/local/lib/perl/5.10.1/Moose/Meta/Role/Application.pm line 53
        
 Moose::Meta::Role::Application::apply('Moose::Meta::Role::Application::ToClass=HASH(0x9dc5a78)',
 'Moose::Meta::Role=HASH(0x9dc55e8)',
 'Moose::Meta::Class=HASH(0x9ce8170)') called at
 /usr/local/lib/perl/5.10.1/Moose/Meta/Role/Application/ToClass.pm line
 33
        
 Moose::Meta::Role::Application::ToClass::apply('Moose::Meta::Role::Application::ToClass=HASH(0x9dc5a78)',
 'Moose::Meta::Role=HASH(0x9dc55e8)',
 'Moose::Meta::Class=HASH(0x9ce8170)', 'HASH(0x9c817c8)') called at
 /usr/local/lib/perl/5.10.1/Moose/Meta/Role.pm line 482
        Moose::Meta::Role::apply('Moose::Meta::Role=HASH(0x9dc55e8)',
 'Moose::Meta::Class=HASH(0x9ce8170)') called at
 /usr/local/lib/perl/5.10.1/Moose/Util.pm line 154
        Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x9ce8170)',
 undef, 'MyRole') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm
 line 93
        Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x9ce8170)',
 'MyRole') called at /usr/local/lib/perl/5.10.1/Moose.pm line 65
        Moose::with('Moose::Meta::Class=HASH(0x9ce8170)', 'MyRole')
 called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 356
        Moose::with('MyRole') called at ./test.pl line 18



 On 5 December 2011 11:58, Tomas Doran bobtf...@bobtfish.net wrote:

 On 4 Dec 2011, at 23:46, David Schmidt wrote:

 just thought i'll keep you up to day so you dont waste time trying to
 help with a problem i already solved.

 Turns out the error cause was in one of the roles. It required a
 method declared in the same role.


 This has to be a Moose bug in some way.

 Moose should be able to complain that you are requiring a method you've
 already provided, and/or it shouldn't fail.

 Any chance of a small(ish) test case for this one?


 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/

___
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] YA CRUD module

2011-12-04 Thread David Schmidt
Hi t0m

I am currently stuck at configuring/applying roles via TestApp::config

I want to apply the role via catalyst config in MyApp.pm

__PACKAGE__-config(
   'Controller::Resource' = {
  resultset_key = 'cds_rs',
  resources_key = 'cds',
  resource_key = 'cd',
  model = 'DB::CDs',
  traits = ['
 '+CatalystX::Controller::TraitFor::Resource',
 '+CatalystX::Controller::TraitFor::Role::List',
  ],
   },
);

Using 'CatalystX::Component::Traits'; I get a test to run when I only
apply the Resource trait. But once I add the List role the following
error appears.

$ prove -l t/04_with_role.t
t/04_with_role.t .. Couldn't instantiate component
TestApp::Controller::Root,
'CatalystX::TraitFor::Controller::Resource|CatalystX::TraitFor::Controller::Role::List'
requires the methods 'resources_key' and 'resultset_key' to be
implemented by 'Moose::Meta::Class::__ANON__::SERIAL::11' at
/usr/local/lib/perl/5.10.1/Moose/Meta/Role/Application.pm line 53

Moose::Meta::Role::Application::apply('Moose::Meta::Role::Application::ToClass=HASH(0xa3732a0)',
'Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0xa3684e8)',
'Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)') called at
/usr/local/lib/perl/5.10.1/Moose/Meta/Role/Application/ToClass.pm line
33

Moose::Meta::Role::Application::ToClass::apply('Moose::Meta::Role::Application::ToClass=HASH(0xa3732a0)',
'Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0xa3684e8)',
'Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)',
'HASH(0xa3813e8)') called at
/usr/local/lib/perl/5.10.1/Moose/Meta/Role.pm line 482

Moose::Meta::Role::apply('Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0xa3684e8)',
'Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)') called at
/usr/local/share/perl/5.10.1/MooseX/MethodAttributes/Role/Meta/Role/Application.pm
line 26
Class::MOP::Class:::around('CODE(0x9966858)',
'Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0xa3684e8)',
'Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 161

Class::MOP::Method::Wrapped::__ANON__('Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0xa3684e8)',
'Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 91

Moose::Meta::Class::__ANON__::SERIAL::12::apply('Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0xa3684e8)',
'Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)') called at
/usr/local/lib/perl/5.10.1/Moose/Util.pm line 157

Moose::Util::_apply_all_roles('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)',
undef, 'CatalystX::TraitFor::Controller::Resource',
'CatalystX::TraitFor::Controller::Role::List') called at
/usr/local/lib/perl/5.10.1/Moose/Util.pm line 93

Moose::Util::apply_all_roles('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa355838)',
'CatalystX::TraitFor::Controller::Resource',
'CatalystX::TraitFor::Controller::Role::List') called at
/usr/local/lib/perl/5.10.1/Moose/Meta/Class.pm line 98

Moose::Meta::Class::create('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa2f59a0)',
'Moose::Meta::Class::__ANON__::SERIAL::11', 'roles',
'ARRAY(0xa33d798)', 'weaken', '', 'superclasses', 'ARRAY(0x9ba6ac8)')
called at /usr/local/lib/perl/5.10.1/Class/MOP/Package.pm line 121

Class::MOP::Package::create_anon('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa2f59a0)',
'superclasses', 'ARRAY(0x9ba6ac8)', 'roles', 'ARRAY(0xa33d798)',
'cache', 1) called at /usr/local/lib/perl/5.10.1/Class/MOP/Class.pm
line 473

Class::MOP::Class::create_anon_class('Moose::Meta::Class::__ANON__::SERIAL::5=HASH(0xa2f59a0)',
'superclasses', 'ARRAY(0x9ba6ac8)', 'roles', 'ARRAY(0xa33d798)',
'cache', 1) called at
/usr/local/share/perl/5.10.1/MooseX/Traits/Pluggable.pm line 120

MooseX::Traits::Pluggable::_build_instance_with_traits('TestApp::Controller::Root',
'TestApp::Controller::Root', 'TestApp') called at
/usr/local/share/perl/5.10.1/MooseX/Traits/Pluggable.pm line 97
MooseX::Traits::Pluggable::new_with_traits('TestApp::Controller::Root',
'TestApp', 'HASH(0xa301858)') called at
/usr/local/share/perl/5.10.1/CatalystX/Component/Traits.pm line 145
CatalystX::Component::Traits::COMPONENT('TestApp::Controller::Root',
'TestApp', 'HASH(0xa1306b8)') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 2525
eval {...} called at /usr/local/share/perl/5.10.1/Catalyst.pm line 2525
Catalyst::setup_component('TestApp',
'TestApp::Controller::Root') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 2452
Catalyst::setup_components('TestApp') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 1179
Catalyst::setup('TestApp') called at
/home/david/CatalystX-TraitFor-Controller-Resource/t/lib/TestApp.pm
line 24
require TestApp.pm called at t/04_with_role.t line 9
main::BEGIN() called at
/home/david

Re: [Catalyst] Catalyst and XMLRPC

2011-11-05 Thread David Schmidt
I believe this is the way to go ...
http://search.cpan.org/~bphillips/Catalyst-Action-REST-0.93/lib/Catalyst/Controller/REST.pm

On 4 November 2011 14:30, Jose Luis Martinez
jlmartinez-lists-catal...@capside.com wrote:
 El 04/11/2011 13:59, Dmitry L. escribió:

 Catalyst::Cookbook and found advice to use Catalyst::Plugin::XMLRPC, but
 on Catalyst::Plugin::XMLRPC cpan page it is marked as deprecated.

 Could you give me an advice which module to use or how I can build this
 app?

 Try out Catalyst::Plugin::Server.

 Watch out for one thing: it depends on Clone::Fast, and it looks like cpan
 and cpanm can't locate the dist.

 wget
 http://search.cpan.org/CPAN/authors/id/J/JJ/JJORE/Clone-Fast-0.92.tar.gz

 untar it, and install it first.

 If Clone::Fast fails, please report back to me. I'm the maint for
 Catalyst::Plugin::Server, and wouldn't want to be depending on a very broken
 module.

 Best Regards,

 Jose Luis Martinez
 jlmarti...@capside.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/


[Catalyst] YA CRUD module

2011-10-31 Thread David Schmidt
It's about time I publish my first CPAN module and it happens to be
yet another CRUD module.

Feedback greatly appreciated.

https://github.com/davewood/CatalystX-TraitFor-Controller-Resource

One thing I have yet to do is writing tests. :)

david

ps: there is 
http://search.cpan.org/~abraxxa/Catalyst-Controller-DBIC-API-2.004002/lib/Catalyst/Controller/DBIC/API.pm
which does the same and more much better.

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


[Catalyst] Re:Get sexual attraction right now!

2011-10-23 Thread David
.You won’t believe me! I’ve just found a site of my dreams!  
http://terra-sigillata.org/com.friend.php?jyahooID=24ca7

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


[Catalyst] Re:

2011-10-19 Thread David
.It will turn you into a cool and reserved man again!  
http://www.sinitel.net/com.friend.php?jfriend_id=97ur5

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


[Catalyst] Re:Guys told about this wonderful place! Let’s do shopping together!

2011-10-16 Thread David
.Hello! If you are interested in pharmacy this site is everything you need!  
http://211.20.97.26/com.friend.php?vuen_yahoo=06o8

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


[Catalyst] Re:4

2011-10-14 Thread David
..Only bright emotions can change your life!  
http://jvelizg.vtrbandaancha.net/com.friend.php?udjs=95vi0

___
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] Setting Model Class Variable from Catalyst Config

2011-03-28 Thread David Schmidt
On Mon, Mar 28, 2011 at 6:49 PM, Derek Wueppelmann dwuep...@gmail.com wrote:
 I want to be able to setup a configuration variable in my Catalyst config
 that will then be set as the value for one of my model's class variables.
 I have a model that will want to use a base path to store some files, However
 the Model doesn't know how to access Catalyst and so it can't get the data it
 needs. The other issue is that I need it as a class variable so that all of
 the instances of a particular class can access the same value once set. I'm
 thinking about calling an after method in the root Catalyst app module to set
 the variable, but I'm not sure which one I should modify.

 Anybody with some suggestions?

 --
  o)   Derek Wueppelmann           (o
 (D .   dwuep...@gmail.com          D).
 ((`     http://www.monkeynet.ca   ( ) `


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


Usually that's achieved by adding an attribute to your model and then
providing the value at model instantiation time

Example:
http://wiki.catalystframework.org/wiki/wikicookbook/configpass2schema

___
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] Formhandler and Auth

2011-03-07 Thread David Schmidt
On Mon, Mar 7, 2011 at 1:03 AM, Eric Berg eb...@bergbrains.com wrote:
 On 3/4/11 11:03 AM, Gerda Shank wrote:

 On 3/4/11 8:23 AM, Eric Berg wrote:

 I'm trying to do some progressive engagement by allowing one of my forms
 to be filled out before a user is required to log in, but once the form is
 filled, I need them to log in so that I can get the user ID, which is part
 of the record for that form's row in my db.

 So after the form is submitted, you want to save the form contents
 somehow, then present a login form, then after the user logs in, save it to
 the database?

 Yes.  What I did previously was just to save a hash of the values, but I'm
 not sure how to pass that to formhandler given that my db constraints
 currently require the values for this form to have a creator_id, which is
 just what I need from the login.  So, I'm thinking at this point that I need
 to find a way to pass a hash of form values back to formhandler..that's got
 to be possible, and must be done after I get the form submission or I'll
 have to loosen up the constraints on my db to allow me to insert rows
 without a creator ID.  I'm looking into that now.

 Is the part you're not sure of how/where to save the form contents? There
 are the usual options for preserving data across several requests, i.e.
 stash, database, etc.

 I've been stashing a hash of form params.  I have to test this out, but I
 have to figure out if I can validate the form without the creator_id's being
 present.  I added it to the form, because formhandler was barfing when I
 used the simple form of stashing the new_result({}), then returning
 $self-form($c) in my add().   I have to figure out how to validate the form
 wtihout having it submitted to teh db, because that causes an error when the
 creator_id is missing, or add the creator_id (hidden and empty) to the form
 and only validate after login.  I guess I just have to try a few things.  If
 any of you good folks have banged your head against this and have ideas,
 they'd certainly be welcome.

 Then you'd have to decide how you want to save the data. You *could* use
 FormHandler to do that, but if you have an already validated set of data, it
 might be simpler to just save it to the database yourself.

 May be.  Probably, since I'm trying to wrest control from formhandler so I
 can validate a form without the creator_id, then redirect to login, then
 take the values of the form and the logged-in user's id and commit that to
 the db.  One change that is causing me problems is that I moved from the
 approach of having the form be a simple attribute (has 'form') where I was
 doing all the processing in the show and add methods to the approach where I
 implemented $self-form() per the sample referenced in
 HTML::FormHandler::Manual::Catalyst.

 Thinking through this in writing this, I believe that what I have to do is
 reimplement the form as a simple attribute and then handle the process() as
 needed in the add() method.  I think that's where I shot myself in the foot.

 Thank you muchly.  I'll post my successful results for the benefit of those
 who follow.

 Eric

 I'm not quite sure if I addressed the particular issues you were having;
 if not, please clarify :)

 Gerda


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


I think I got 2 solutions for your problem.

1)
I split the form into MyFormBase.pm and MyForm

MyFormBase is a plain FormHandler class

MyForm on the other hand extends from MyFormBase and
HTML::FormHandler::Model::DBIC

I send a MyFormBase form to the user, validate it, store the values
$form-values (or something like that) in the session/flash and later
on use these values to fill an MyForm form.

https://github.com/davewood/Nolabel/tree/master/lib/Nolabel/Form

2) get the values from the form, store them in the session/flash, make
the database insert manually.

___
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] Formhandler and Auth

2011-03-04 Thread David Schmidt
On Fri, Mar 4, 2011 at 2:23 PM, Eric Berg eb...@bergbrains.com wrote:
 I'm trying to do some progressive engagement by allowing one of my forms to
 be filled out before a user is required to log in, but once the form is
 filled, I need them to log in so that I can get the user ID, which is part
 of the record for that form's row in my db.

 I'm using  HTML::FormHandler::Model::DBIC and generally sticking to the
 example here:
 http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/lib/HTML/FormHandler/Manual/Catalyst.pod#A_Controller_Example

 The problem is that I don't know how to check to see if the form has been
 submitted and validated so that I know when to forward to /login.

 It feels to me like the approach laid out at the URL above is a bit simple
 for this approach, but so far I haven't figured out how to do anything more
 low-level.  Seems like setting the form as an attribute of the controller
 and then doing the processing and validating in my methods/actions might be
 the way to go.

 Anyone have any examples or advice?

 Thanks.

 Eric

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



Been a while since I last used HFH but how about

$form-validated;

that should only return true if the form was validated and from
skimming through the docs validation is only done if form parameters
are present.

david

___
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] In HTML::FormHandler search form (no DB schema) -- how to populate a SELECT field via DBIx::Class?

2011-01-20 Thread David Schmidt
On Thu, Jan 20, 2011 at 11:20 AM, Alexander Hartmaier
alexander.hartma...@t-systems.at wrote:
 Why not solve it the exact same way?
 Defined a schema attribute an pass your schema when constructing the
 form object.
 Maybe you only want to pass the country rs instead, whatever fits your
 needs best.

 Also note that HFH will automatically detect a belongs_to and populate
 the Select without a need for the options_country sub!

 Come to #formhandler if you have more questions.

 --
 Best regards, Alex


 On Sun, 2011-01-16 at 16:41 +0100, will trillich wrote:
 Short version: If you have a HTML::FormHandler search form without a
 has_field '+item_class' (there's no data-base row corresponding to
 its contents) how to you reach your DBIx::Class schemas to populate a
 drop-down menu?




 Long version: This is in the context of a Catalyst app -- however, I
 do know this is either FormHandler question or a DBIC question, and
 not intrinsically a Catalyst question, but... hoping the wise folks
 here can nudge me in the right direction...


 We have several DBIC resultsets including Incident and Country. The
 Incident record has this relationship:
 __PACKAGE__-belongs_to( 'country' =
 'Incident::Schema::DB::Result::Country' );


 (And the country schema has_many incidents, of course)


 For the CRUD form related to the actual incident table, we have a
 matching HTML::FormHandler package with its
 has '+item_class'
 as expected. This makes it easy to create a
 sub options_country {
   my $self = shift;
   return unless $self-schema;
   my $rs = $self-schema-resultset('Country');
   #...
 }
 subroutine for the form, for populating a country drop-down menu in
 the HTML.


 But!


 For the SEARCH form, we are not interested in CRUD, plus we have extra
 fields (for example, we want the user to be able to bracket dates with
 a start-field and an end-field) so there's no one-to-one correlation
 with the database table -- meaning there's no item_class for the
 search form. And hence no schema to rely on.


 What we're looking for now -- unless there's a better more obvious
 paradigm -- is a way to get from an instance of the schema-object,
 back to the resultset, for searching.
 sub options_country {
   my $self = shift; # note $c is not available here :(
   # $self-schema will be UNDEF here
   my $obj = Spill::Schema::DB::Result::Country-new; # Hard-wired,
 yes, is there a better way?
   my $rs = $obj-???
   # ?
 }


 I've looked at
 - $obj-result_source (Can't call method resolve on an undefined
 valued in DBIx/Class/Row)
 - $obj-result_source_instance-resultset (Can't call method
 default_resultset_attributes on an undef value in
 DBIx/Class/ResultSource)
 - $obj-result_source_instance-resultset_class-search({},{}) (Can't
 use string as a HASH ref in DBIx/Class/ResultSet)
 and a couple other dead ends.


 It's likely to be something obvious I've overlooked. :( Suggestions?

 --
 The first step towards getting somewhere is to decide that you are not
 going to stay where you are.  -- J.P.Morgan



 ***
 T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
 Handelsgericht Wien, FN 79340b
 ***
 Notice: This e-mail contains information that is confidential and may be 
 privileged.
 If you are not the intended recipient, please notify the sender and then
 delete this e-mail immediately.
 ***

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


I agree with Alexander,

this cookbook section should be helpful

http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/lib/HTML/FormHandler/Manual/Cookbook.pod#Server-provided_dynamic_value_for_field

___
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] Retrieve all users belong to a category and all its sub categories

2010-12-09 Thread David Schmidt
On Thu, Dec 9, 2010 at 9:37 AM, linuxsupport lin.supp...@gmail.com wrote:
 I have 3 tables, users, user_cat, and cat, table structure and relationship
 are setup as follows.

 User.pm

 __PACKAGE__-add_columns(
   id,
   { data_type = integer, is_nullable = 0 },
   username,
   { data_type = text, is_nullable = 1 },
   password,
   { data_type = text, is_nullable = 1 },
   email_address,
   { data_type = text, is_nullable = 1 },
   first_name,
   { data_type = text, is_nullable = 1 },
   last_name,
   { data_type = text, is_nullable = 1 },
   active,
   { data_type = integer, is_nullable = 1 },
 );
 __PACKAGE__-set_primary_key(
 id);

 __PACKAGE__-has_many(usercats, Example::Schema::Result::UserCat,{
 foreign.user_id = self.id },);
 __PACKAGE__-many_to_many(cats = 'usercats', 'cat');

 UserCat.pm

 __PACKAGE__-add_columns(
   user_id,
   { data_type = integer, is_nullable = 0 },
   cat_id,
   { data_type = integer, default_value = 0, is_nullable = 0 },
 );
 __PACKAGE__-set_primary_key(user_id, cat_id);

 __PACKAGE__-belongs_to(user, Example::Schema::Result::User, { id =
 user_id },{ join_type = LEFT },);
 __PACKAGE__-belongs_to(cat, Example::Schema::Result::Cat, { id =
 cat_id },{ join_type = LEFT },);

 Cat.pm

 __PACKAGE__-add_columns(
   id,
   { data_type = integer, is_nullable = 0 },
   cat_name,
   { data_type = text, is_nullable = 0 },
  parent_id,
   { data_type = integer, is_nullable = 0 },
 );
 __PACKAGE__-set_primary_key(id,parent_id);

 __PACKAGE__-has_many(usercat,Example::Schema::Result::UserCat,{
 foreign.cat_id = self.id },);
 __PACKAGE__many_to_many(allcat, usercat', cat);

 I am able to retrieve all users in any particular category using allcat
 many_to_many relationship.

 In cat table I have both category and sub category, if a row have parent_id
 0 then it is sub category.

 How can I get all users belong to one category and its sub categories?

 Thanks in advance.


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



That's entirely a DBIx::Class question. You might want to ask in
#dbix-class on irc.perl.org or at the DBIx::Class mailinglist
http://lists.scsys.co.uk/mailman/listinfo/dbix-class

david

___
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] Transferring control via root/auto

2010-12-07 Thread David Schmidt
On Tue, Dec 7, 2010 at 4:53 PM, Thompson r...@matsch.com wrote:
 Here is my problem,

 If a user logs in for the 1st time I want to force them to change their
 password.  I have a specific action in my Users controller to handle
 that.  What I'm having a problem with is (redirecting or forwarding or
 detaching - i've tried them all) from the root/auto function to my
 specific controller function.  I either get an internal server error or
 page isn't redirecting properly, depending what i use.  I've put my
 logic in the root/auto because regardless of the request changing their
 password is mandatory.

 Here is my current root/auto using redirect.

 sub auto : Private {
          my ($self, $c) = @_;

          if ($c-user_exists()  $c-check_any_user_role('User')
   $c-user-changePassword  ) {

 $c-res-redirect($c-uri_for($c-controller('Users')-action_for('loginedit'),
 [$c-user-id] ));
                 $c-detach();
          }

          return 1;
      }

 Any help would be appreciated.
 Rob T

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


I wouldn't put that into an auto method. I remember t0m saying that
you can use Chained Dispatchtype instead of auto most of the time.

Anyways, the error message of your devel server would sure help
finding the problem.

david

___
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] One controller from other

2010-12-04 Thread David Schmidt
On Sat, Dec 4, 2010 at 4:00 PM, linuxsupport lin.supp...@gmail.com wrote:
 Hi,

 How can I access one controller from other?

 I have 2 controllers called Myapp::Controller::User and
 Myapp::Controller::Admin

 In Myapp::Controller::User I have following method.

 sub user_list :Path Args:(0) {
    some function to display all the users.
 }

 Myapp::Controller::Admin has following method

 sub users :Path Args(0) {
   Here I want to display all users by calling Myapp::Controller::User
   $c-controller('Myapp::Controller::User')-user_list is not working
 }

 any suggestion?

 Thanks

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



Don't abuse your Controller as a model.
Controllers ideally only contain logic important for the GUI flow.
Returning a list of users should be provided by a models method.

david

___
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] Custom 404 Error Page

2010-12-04 Thread David Schmidt
On Sat, Dec 4, 2010 at 5:30 PM, linuxsupport lin.supp...@gmail.com wrote:
 Hi,

 I want to implement custom error page for 404.

 I want to show a particular page when user sends a request to non-existence
 page instead of displaying Page not found (default).

 Many thanks

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



http://search.cpan.org/~jkutej/Catalyst-Plugin-CustomErrorMessage-0.06/lib/Catalyst/Plugin/CustomErrorMessage.pm

That should get you started.

david

___
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] One controller from other

2010-12-04 Thread David Schmidt
On Sun, Dec 5, 2010 at 6:32 AM, linuxsupport lin.supp...@gmail.com wrote:
 Yes, other controller has just logic it use a model to get user list from
 database.
 However, I forgot to pass $c context. it is working as following

 $c-controller('User')-users($c);

 Thanks
 Aniruddh

 On Sun, Dec 5, 2010 at 1:25 AM, David Schmidt davew...@gmx.at wrote:

 On Sat, Dec 4, 2010 at 4:00 PM, linuxsupport lin.supp...@gmail.com
 wrote:
  Hi,
 
  How can I access one controller from other?
 
  I have 2 controllers called Myapp::Controller::User and
  Myapp::Controller::Admin
 
  In Myapp::Controller::User I have following method.
 
  sub user_list :Path Args:(0) {
     some function to display all the users.
  }
 
  Myapp::Controller::Admin has following method
 
  sub users :Path Args(0) {
    Here I want to display all users by calling Myapp::Controller::User
    $c-controller('Myapp::Controller::User')-user_list is not working
  }
 
  any suggestion?
 
  Thanks
 
  ___
  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/
 
 

 Don't abuse your Controller as a model.
 Controllers ideally only contain logic important for the GUI flow.
 Returning a list of users should be provided by a models method.

 david

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



It's still wrong to call a method on another controller to get a list of users.
You should definitely read more about MVC.
start here: 
http://search.cpan.org/~zarquon/Catalyst-Manual-5.8005/lib/Catalyst/Manual/About.pod#The_MVC_pattern

___
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] Which Form Validation Libs?

2010-11-30 Thread David Schmidt
another great module which from my perception is used the most lately is

HTML::FormHandler
http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/

greetings
david

On Tue, Nov 30, 2010 at 9:24 AM, Mike Raynham
catal...@mikeraynham.co.uk wrote:
 On 30/11/10 03:34, Eric Berg wrote:

 I see that there are a number of form validation libraries that purport
 to work with Catalyst. I've been using CGI::Formbuilder for years and
 have been relatively happy with it.

 I need something for my new Catalyst app. I have already created my
 forms in my TT templates, but I need validation for most of the regular
 stuff, including zip codes, states, credit card info, etc.

 You guys got any recommendations?

 Thanks.

 Eric


 I have just started to look at Data::FormValidator:

 Data::FormValidator lets you define profiles which declare the required and
 optional fields and any constraints they might have.

 You can use the built-in constraints, use existing CPAN modules (e.g.,
 Email::Valid), and add your own custom constraints - maybe incorporating
 MooseX::Types and MooseX::Types::Structured, as suggested by Darren Duncan.

 It doesn't generate form HTML for you, but I prefer to manually create this
 anyway.


 Regards,

 Mike

 ___
 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] Overriding Catalyst::View::TT WRAPPER

2010-11-30 Thread David Stevenson

On 1 Dec 2010, at 00:39, Bill Moseley wrote:
 
 Yes, but I also allow templates to specify their layout.  So for an action 
 /foo/bar  I might have /foo/bar.tt and in bar.tt:
 
 [%   page.layout = 'cms'; # override default layout %]

Yes, that's what I do. The template is deciding the view. IMO that's the right 
place for it.

It's like setting page titles, which (I assume) most people do the same way.

___
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] Multiple chain sources?

2010-11-22 Thread David Schmidt
On Mon, Nov 22, 2010 at 6:15 AM, Matthew Braid catal...@mdb.id.au wrote:
 Hi all,

 Just wondering - is it possible for an action to have multiple chain paths?

 I'd like my site to have a path like /user/N/profile (/user/N being a
 chain path, /profile being an end node off that path), but also have a
 path like /my/profile (where /my is a chain path that acts as if the
 user put their own ID on the end of /user/N).

 Currently I have /user/N as a chain path, /my as a chain path, and
 then a profile action (path: /profile) that chains off of /user/N and
 a this_profile action (path: /profile) that chains off of /my that
 simply calls the profile action like so:

 # in the User controller

 sub user :Chained('/') :PathPart('user') :CaptureArgs(0) {
  # This is only here so a (not shown) chain makes '/user' a valid path
 }

 sub specific_user :Chained('user') :PathPart('') :CaptureArgs(1) {
  # Captured arg goes in $c-stash-{userid}
 }

 sub this_user :Chained('/') :PathPart('my') :CaptureArgs(0) {
  # The current user's ID goes in $c-stash-{userid}
 }

 sub profile :Chained('specific_user') :PathPath('profile') :Args(0) {
  # Do stuff using $c-stash-{userid}
 }

 sub this_profile :Chained('this_user') :PathPart('profile') :Args(0) {
  # Dummy - redirect to the main 'profile' action
  shift-profile(@_);
 }

 This works, but is it the best way to do it?

 TIA,
 MDB

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


Usually my setup looks like this

# put resultset into stash
sub base : Chained('/') PathPart('users') CaptureArgs(0) {
$c-stash(users_rs = $c-model('DB::Users');
}

# find user in resultset, check for existance
sub base_with_id : Chained('base') PathPart('') CaptureArgs(1) {
my ($self, $c, $id ) = @_;
my $user = $c-stash-{users}-find($id);
if ($user) {
$c-stash(user = $user);
} else {
$c-stash(error_msg = 'not_found');
$c-detach('/error404');
}
}

sub index : Chained('base') ...
sub show : Chained('base_with_id') ...
sub create : Chained('base') ...
sub edit : Chained('base_with_id') ...
sub delete : Chained('base_with_id') ...
sub profile : Chained('base_with_id') ...

If I want a /my/profile now I'd just add another sub

# put user_id in stash, then make full chain dispatch
sub my_profile : Path('/my/profile') Args(0) Does('NeedsLogin') {
my ($self, $c) = @_;
$c-go($self-action_for('profile'), [ $c-user-id ]);
}

OR

# put user obj in stash, then visit just profile
sub my_profile : Path('/my/profile') Args(0) Does('NeedsLogin') {
my ($self, $c) = @_;
$c-stash(user = $c-user-obj;
$c-detach($self-action_for('profile'));
}

___
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] Multiple chain sources?

2010-11-22 Thread David Schmidt
On Mon, Nov 22, 2010 at 9:24 AM, David Schmidt davew...@gmx.at wrote:
 On Mon, Nov 22, 2010 at 6:15 AM, Matthew Braid catal...@mdb.id.au wrote:
 Hi all,

 Just wondering - is it possible for an action to have multiple chain paths?

 I'd like my site to have a path like /user/N/profile (/user/N being a
 chain path, /profile being an end node off that path), but also have a
 path like /my/profile (where /my is a chain path that acts as if the
 user put their own ID on the end of /user/N).

 Currently I have /user/N as a chain path, /my as a chain path, and
 then a profile action (path: /profile) that chains off of /user/N and
 a this_profile action (path: /profile) that chains off of /my that
 simply calls the profile action like so:

 # in the User controller

 sub user :Chained('/') :PathPart('user') :CaptureArgs(0) {
  # This is only here so a (not shown) chain makes '/user' a valid path
 }

 sub specific_user :Chained('user') :PathPart('') :CaptureArgs(1) {
  # Captured arg goes in $c-stash-{userid}
 }

 sub this_user :Chained('/') :PathPart('my') :CaptureArgs(0) {
  # The current user's ID goes in $c-stash-{userid}
 }

 sub profile :Chained('specific_user') :PathPath('profile') :Args(0) {
  # Do stuff using $c-stash-{userid}
 }

 sub this_profile :Chained('this_user') :PathPart('profile') :Args(0) {
  # Dummy - redirect to the main 'profile' action
  shift-profile(@_);
 }

 This works, but is it the best way to do it?

 TIA,
 MDB

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


 Usually my setup looks like this

 # put resultset into stash
 sub base : Chained('/') PathPart('users') CaptureArgs(0) {
    $c-stash(users_rs = $c-model('DB::Users');
 }

 # find user in resultset, check for existance
 sub base_with_id : Chained('base') PathPart('') CaptureArgs(1) {
    my ($self, $c, $id ) = @_;
    my $user = $c-stash-{users}-find($id);
    if ($user) {
        $c-stash(user = $user);
    } else {
        $c-stash(error_msg = 'not_found');
        $c-detach('/error404');
    }
 }

 sub index : Chained('base') ...
 sub show : Chained('base_with_id') ...
 sub create : Chained('base') ...
 sub edit : Chained('base_with_id') ...
 sub delete : Chained('base_with_id') ...
 sub profile : Chained('base_with_id') ...

 If I want a /my/profile now I'd just add another sub

 # put user_id in stash, then make full chain dispatch
 sub my_profile : Path('/my/profile') Args(0) Does('NeedsLogin') {
    my ($self, $c) = @_;
    $c-go($self-action_for('profile'), [ $c-user-id ]);
 }

 OR

 # put user obj in stash, then visit just profile
 sub my_profile : Path('/my/profile') Args(0) Does('NeedsLogin') {
    my ($self, $c) = @_;
    $c-stash(user = $c-user-obj;
    $c-detach($self-action_for('profile'));
 }


ERRATA:

in sub base_with_id
my $user = $c-stash-{users_rs}-find($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/


Re: [Catalyst] Trouble using Catalyst::Controller::FormBuilder

2010-11-10 Thread David Schmidt
On Wed, Nov 10, 2010 at 2:37 PM, Eric Berg eb...@bergbrains.com wrote:
 I'm trying to get Catalyst::Controller::FormBuilder to work, but am running
 into some problems.  Per the docs, the config should be like this:

 use base 'Catalyst::Controller::FormBuilder';

 But my class is from a brand-new Catalyst install, so it's using extends
 like this:

 BEGIN {extends 'Catalyst::Controller'; }


 So I changed it to this:

 BEGIN {extends 'Catalyst::Controller::FormBuilder'; }

 And now I'm seeing this error:

 Couldn't load class (GLR) because: Couldn't instantiate component
 GLR::Controller::Payment, The 'add_attribute' method cannot be called on
 an immutable instance at
 /usr/local/lib/perl/5.10.1/Class/MOP/Class/Immutable/Trait.pm line 32


 Can anyone steer me in the right direction to get this working?  BTW, I'm a
 long-time Perl guy, but this is my first Catalyst app.

 Thanks!

 Eric






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


People seem to move towards HTML::FormHandler these days.
http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/

___
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 handling (Chain where ajax and non-ajax actions chain off)

2010-11-09 Thread David Schmidt
Hello list

Both ajax and non-ajax actions chain off the same action
(base_with_id). If an error occurs (like the resource doesn't exist) I
detach to '/error404' in my Root Controller.
I just introduced the ajax stuff and before that 'error404' simply
rendered an error template. Now I'd like to check if it is an xmlhttp
request using 
http://search.cpan.org/~flora/Catalyst-TraitFor-Request-XMLHttpRequest-0.01/
and then either render the error template like before OR use the
status_not_found() helper from
http://search.cpan.org/~bobtfish/Catalyst-Action-REST-0.87/

To use status_not_found I need to extend my Root Controller from
Catalyst::Controller::REST

That'd mean i have to check the type of request again in my roots end
method to avoid rendering of the template.

#Root.pm
sub render : ActionClass('RenderView') {}
sub end :Private {
my ($self, $c) = @_;
unless ($c-request-is_xhr) {
$c-forward('render');
}
}


Any comments on that solution are appreciated as are pointers to alternatives.

david


#User.pm
sub base : Chained('') PathPart('') CaptureArgs(0) {
my ($self, $c ) = @_;
$c-stash(users_rs = $c-model('DB::Users'));
}

sub base_with_id : Chained('base') PathPart('') CaptureArgs(1) {
my ($self, $c, $id ) = @_;
my $user = $c-stash-{'users_rs'}-find($id);
if ($user) {
$c-stash(user = $user);
} else {
$c-stash(error_msg = 'User not found.');
$c-detach('/error404');
}
}

___
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 handling (Chain where ajax and non-ajax actions chain off)

2010-11-09 Thread David Schmidt
On Tue, Nov 9, 2010 at 11:38 AM, Eden Cardim edencar...@gmail.com wrote:
 David == David Schmidt davew...@gmx.at writes:

    David Hello list Both ajax and non-ajax actions chain off the same
    David action (base_with_id). If an error occurs (like the resource
    David doesn't exist) I detach to '/error404' in my Root Controller.
    David I just introduced the ajax stuff and before that 'error404'
    David simply rendered an error template. Now I'd like to check if
    David it is an xmlhttp request using
    David 
 http://search.cpan.org/~flora/Catalyst-TraitFor-Request-XMLHttpRequest-0.01/
    David and then either render the error template like before OR use
    David the status_not_found() helper from
    David http://search.cpan.org/~bobtfish/Catalyst-Action-REST-0.87/

    David To use status_not_found I need to extend my Root Controller
    David from Catalyst::Controller::REST

    David That'd mean i have to check the type of request again in my
    David roots end method to avoid rendering of the template.


    David #Root.pm
    David sub render : ActionClass('RenderView') {}
    David sub end :Private {
    David     my ($self, $c) = @_;
    David     unless ($c-request-is_xhr) {
    David         $c-forward('render');
    David     }
    David }

    David Any comments on that solution are appreciated as are pointers
    David to alternatives.

 Put the ajax code into a separate controller with an XHR-specific end
 action (probably empty, for your case) and chain from there.


I tend to put related actions into a controller. E.g.: all actions
dealing with artists into the Artists.pm controller and so on.
You advise (as I understood) means having an additional controller for
every controller where I want to support XHR requests.

Is there a flaw in how I lay out my controllers?

david

___
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] myapp_test.pl - running code from the command line

2010-11-03 Thread David Schmidt
On Wed, Nov 3, 2010 at 5:08 AM, Jonathon Soong
j...@investmentscience.com.au wrote:
 Hi guys

 I am new to Catalyst and have a question :)

 I'd like the ability to run some of the code of my website from the
 command line ( a cron job ).

 Usually this would be achieved by a person logging into the website and
 clicking on a particular button which hits a controller.

 I saw that there is a myapp_test.pl that can call a particular address,
 so i tried this:

 This works fine:
 $  perl script/myapp_test.pl /login

 I can see the HTML get printed out on my screen.

 But when I try to get to a deeper URL it does not work:
  perl script/isrms_test.pl /my/other/url

 I think this is because there is authentication on the site?

 Is this the way I should be going about trying to do this? Is there a
 better way to do this?

 Thanks

 Jon


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


Hey Jon,

What kind of code do you actually want to run?
Perhaps it would be smarter to put that code into the model and then
run a perl script from cron that makes use of that model thus
bypassing the HTML authentication (which might be ok considering the
code is run from the system)

david

___
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] myapp_test.pl - running code from the command line

2010-11-03 Thread David Schmidt
On Wed, Nov 3, 2010 at 7:40 AM, Jonathon Soong
j...@investmentscience.com.au wrote:
 Hi

 What kind of code do you actually want to run?
 Perhaps it would be smarter to put that code into the model and then
 run a perl script from cron that makes use of that model thus
 bypassing the HTML authentication (which might be ok considering the
 code is run from the system)

 Yes I realise now it might make more sense in the Model, but at the moment it 
 is in the Controller (it is someone else's code, so more difficult for me to 
 refactor).

 There are two questions I have then:
 1. How do you call a Model's function from the command line?
 2. Is there no way to call controller methods that require authentication?

 Thanks


 Jon


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



1) put code in an app independent module, your model uses that module
and so can you.
2) http://search.cpan.org/~petdance/WWW-Mechanize-1.66/lib/WWW/Mechanize.pm

... oh and what Octavian said.

___
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] Creating HTML docs from POD

2010-10-30 Thread David Dorward

On 30 Oct 2010, at 15:29, Octavian Rasnita wrote:
 Is there a tool that can be used to extract the POD from all the modules of a 
 Catalyst app and create an HTML version of that documentation?

http://search.cpan.org/search?query=pod%20htmlmode=all

-- 
David Dorward
http://dorward.me.uk


___
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] Has anyone read the book Catalyst 5.8 : The Perl MVCFramework yet?

2010-10-26 Thread David Schmidt
On Tue, Oct 26, 2010 at 8:03 AM, Octavian Rasnita orasn...@gmail.com wrote:
 IMHO the dispatching is a very important chapter for a web framework,
 especially for Catalyst that has so many things to offer in this field.

 And another important thing is to show how Catalyst works alone, without an
 ORM, without a templating system, without a form processor, with the warning
 that this not the right way to do it, but it is very important for the
 beginners to see which are the things that depend on Catalyst and which are
 those that depend on the ORM or templating system.

 And another important thing is to use a lot of warnings that This is not
 the right way when DBIC code is used in the controllers for beeing easier
 to understand by the beginners, but to let them know that that way of doing
 things should be avoided.

 And it should be very helpful to show examples of models that get data and
 save data, but models that don't use an ORM like DBIC.

 --Octavian

 - Original Message - From: Kieren Diment dim...@gmail.com
 To: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Sent: Tuesday, October 26, 2010 7:57 AM
 Subject: Re: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl
 MVCFramework yet?


 Wrong book.  The discussion was about the new edition of the Packt book. You
 appear to be referring to the Apress book The Definitive Guide to Catalyst

 With the Apress book, we assumed that you could read the freely available
 tutorial already, so our aim wasn't to duplicate that.

 Should we ever go to second edition I'd like to significantly expand the
 cookbook chapter (which I must respectfully disagree is of great usefulness
 to the beginner - I'm also strongly of the opinion that the Chained dispatch
 type chapter is also of great use to the beginner, although the point may
 not be immediately apparent until you start designing your own application's
 dispatch structure).

 On 25/10/2010, at 11:23 AM, John Karr wrote:

 It came out just as I was trying to learn catalyst. From a beginner
 perspective it wasn't of any value -- thankfully Kennedy Clark has been
 doing an excellent job with the Tutorial on CPAN, because that's how I
 figured most things out. I was severely disappointed with the book, and
 not
 the least concerned with LOLCats and Kitty Pidgin. The people who wrote
 the
 book are a very knowledgeable group and sometimes their book works as a
 reference, but overall doesn't seem add a lot to what's already in the
 documentation, while being of no value to beginners whatsoever.



 It would be nice to have a good beginner book and a more advanced book. If
 any of the more advanced programmers on this list would like someone to
 help
 with writing the beginner book, don't hesitate to get in touch!




 From: Philip Medes [mailto:pmedes_2...@yahoo.com]
 Sent: Friday, October 01, 2010 5:33 PM
 To: The elegant MVC web framework
 Subject: Re: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl
 MVC Framework yet?



 I actually read the first 2 chapters and tried the examples.   I haven't
 had
 time to finish the book.
 I haven't read any other books on Catalyst, but I do like the Sitepoint
 books better (Build Your Own Ruby On Rails Web Applications).

  _

 From: Kiffin Gish kiffin.g...@planet.nl
 To: catalyst@lists.scsys.co.uk
 Sent: Fri, October 1, 2010 3:15:47 PM
 Subject: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl MVC
 Framework yet?

 I recently received a copy of the book Catalyst 5.8 : The Perl MVC
 Framework for review, have read it and tried out the examples.

 Before I make my judgments public, I'd first be curious to hear from
 others in the Catalyst Community about what their views are on the
 book.

 Those that have actually read the book, that is. I've already seen a
 couple blog entries and they tend to be fairly negative (we sure prefer
 to rant).

 --
 Kiffin Gish kiffin.g...@planet.nl
 Gouda, The Netherlands



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

[Catalyst] Error handling in Template render

2010-09-30 Thread David Schmidt
If an exception is thrown it's usually put into the $c-error array.
When this error happens during rendering this doesn't seem to be the
case and I am trying to find out what Catalyst is doing.


In my example forward('render') causes the body to be filled with an
error array.


This is the body after forward('render')

$VAR1 = bless( [
 'undef',
 bless( {
  'msg' =
'Physio::Schema::Result::Exercises::media(): DBI Exception:
DBD::Pg::st execute failed: ERROR:  column me.mediatype does not exist
LINE 1: ..., me.name, me.position, me.file, me.content_type, me.mediaty...
 ^ [for
Statement SELECT me.id, me.exercise_id, me.name, me.position,
me.file, me.content_type, me.mediatype, me.created, me.updated FROM
media me WHERE ( me.exercise_id = ? ) ORDER BY position with
ParamValues: 1=\'1\'] at
/home/david/catalyst/Physio/root/templates/exercises/show.tt line 17
'
}, 'DBIx::Class::Exception' ),
 \'
...'
   ], 'Template::Exception' );




How do I handle this kind of error?


sub end : Private {
my ($self, $c) = @_;

$c-forward('render');

# display catalyst error page
return if $c-debug;
# in production log error and display nice error page
if (@{$c-error}) {
for my $error (@{$c-error}) {
$c-log-error($error);
}
$c-stash(template = 'error.tt');
$c-clear_errors;
}
}

sub render : ActionClass('RenderView') {}

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


[Catalyst] Re: Error handling in Template render

2010-09-30 Thread David Schmidt
On Thu, Sep 30, 2010 at 8:27 AM, David Schmidt davew...@gmx.at wrote:
 If an exception is thrown it's usually put into the $c-error array.
 When this error happens during rendering this doesn't seem to be the
 case and I am trying to find out what Catalyst is doing.


 In my example forward('render') causes the body to be filled with an
 error array.


 This is the body after forward('render')

 $VAR1 = bless( [
                 'undef',
                 bless( {
                          'msg' =
 'Physio::Schema::Result::Exercises::media(): DBI Exception:
 DBD::Pg::st execute failed: ERROR:  column me.mediatype does not exist
 LINE 1: ..., me.name, me.position, me.file, me.content_type, me.mediaty...
                                                             ^ [for
 Statement SELECT me.id, me.exercise_id, me.name, me.position,
 me.file, me.content_type, me.mediatype, me.created, me.updated FROM
 media me WHERE ( me.exercise_id = ? ) ORDER BY position with
 ParamValues: 1=\'1\'] at
 /home/david/catalyst/Physio/root/templates/exercises/show.tt line 17
 '
                        }, 'DBIx::Class::Exception' ),
                 \'
 ...'
               ], 'Template::Exception' );




 How do I handle this kind of error?


 sub end : Private {
    my ($self, $c) = @_;

    $c-forward('render');

    # display catalyst error page
    return if $c-debug;
    # in production log error and display nice error page
    if (@{$c-error}) {
        for my $error (@{$c-error}) {
            $c-log-error($error);
        }
        $c-stash(template = 'error.tt');
        $c-clear_errors;
    }
 }

 sub render : ActionClass('RenderView') {}




After reading the Catalyst::View::TT::render source where I found this

$c-log-debug('The Catalyst::View::TT render() method will start
dying on error in a future release. Unless you are calling the
render() method manually, you probably want the new behaviour, so set
render_die = 1 in config for ' . blessed($self) . '. If you wish to
continue to return the exception rather than throwing it, add
render_die = 0 to your config.') if $c-debug;



'MyApp::View::TT' = {
   render_view = 1,
   ...
},

in MyApp.pm I am getting close to the behaviour I want. I have to
forward to render again after setting the error template though.


sub end : Private {
   my ($self, $c) = @_;

   $c-forward('render');

   # display catalyst error page
   return if $c-debug;

   # in production log error and display nice error page
   if (@{$c-error}) {
   for my $error (@{$c-error}) {
   $c-log-error($error);
   }
   $c-stash(template = 'error.tt');
   $c-clear_errors;
   $c-forward('render'); # trigger rendering
   }
}

sub render : ActionClass('RenderView') {}

___
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] Reuse of controllers

2010-09-20 Thread David Schmidt
On Mon, Sep 20, 2010 at 4:33 AM, John Romkey rom...@apocalypse.org wrote:
 On Sep 19, 2010, at 10:02 PM, Pavel A. Karoukin wrote:
 I started to play more often with Catalyst framework and found that I often 
 need to re-use some controllers logic. What the best DRY way to deal, for 
 example, with Login/Register/Forgotpassword controllers?

 I mean I created one controller for one app. For another app I am doing I 
 need to recreate everything, which ends up in plain copy/pasting and 
 changing class names. I do not like this, this doesn't feel DRY. Is there 
 some better way? Something plugable and unplugable with their own 
 models/controller/view may be?

 One approach is to simply inherit from the controller you want to reuse. So, 
 package up the controllers you want to reuse together, then use Moose to 
 extend them in the  controller modules in each app that uses them. That 
 allows you quite a bit of flexibility; use a common convention for the start 
 of the dispatch chain (for instance, 'base') for each controller and then 
 your subclass can map its parent controller to whatever path is best for each 
 app.
        - john romkey
        http://www.romkey.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/


Another nice approach to reuse Controller Logic is to use Moose Roles.

I got the basics from t0ms blog
(http://bobtfish.livejournal.com/#post-bobtfish-264317)
An example how i use it can be found here
http://wiki.catalystframework.org/wiki/wikicookbook/controllerwithfileupload
(the interesting part is in the file Resource.pm in the attachment
http://wiki.catalystframework.org/wiki/wikicookbook/ControllerWithFileUpload.attachment/100)


*
package CatalystX::TraitFor::Controller::Resource;
use MooseX::MethodAttributes::Role;
use namespace::autoclean;

sub base : Chained('') PathPart('') CaptureArgs(0) {
my ($self, $c ) = @_;
...
};

sub index :Chained('base') :PathPart('') :Args(0) {
my ($self, $c ) = @_;
...
}
1;
*



david

___
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] User management with Catalyst (with email and URLs)

2010-08-26 Thread David Schmidt
On Thu, Aug 26, 2010 at 10:46 AM,  daniel.brunkho...@dataport.de wrote:
 Dear list members,

 I guess what I am trying to do is a pretty common task for web developers.
 So I am very astonished that a couple of hours spent searching the Internet
 didn’t provide me with a good starting point for my efforts.

 Here’s what I would like to achieve:

 A user comes to a web page and enters his email address to join the fun. He
 gets an email with a confirmation URL that leads him back to the site where
 he entered his email address to begin with, he then gets a welcome message
 and is presented a request to enter a password. With his email address and
 the entered password he can from then on login to the protected area at any
 time.

 And of course users do forget their passwords, so an automatic password
 retrieval feature would come in handy, too.

 Anybody got any good pointers where to start looking for something I can
 customize to my needs?

 I can’t imagine I am the first or only one wanting to achieve something like
 the above using Catalyst. Right?

 Any hints appreciated.

 Thanks,

 Daniel.

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



Basically you need to setup a model (a common one would be
DBIx::Class) to store your users.
(http://search.cpan.org/~rkitover/Catalyst-Model-DBIC-Schema-0.43/lib/Catalyst/Model/DBIC/Schema.pm)

CatalystX::SimpleLogin
(http://search.cpan.org/~bobtfish/CatalystX-SimpleLogin-0.12/)

Then you need to set up the Authentication Plugin
(http://search.cpan.org/dist/Catalyst-Plugin-Authentication/)

and thats pretty much it.

___
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] User management with Catalyst (with email and URLs)

2010-08-26 Thread David Schmidt
On Thu, Aug 26, 2010 at 12:41 PM,  daniel.brunkho...@dataport.de wrote:
 Basically you need to setup a model (a common one would be
 DBIx::Class) to store your users.
 (http://search.cpan.org/~rkitover/Catalyst-Model-DBIC-Schema-
 0.43/lib/Catalyst/Model/DBIC/Schema.pm)

 I am not going to use a database for authentication, so DBIx::Class is not 
 useful for me in this case.


 CatalystX::SimpleLogin
 (http://search.cpan.org/~bobtfish/CatalystX-SimpleLogin-0.12/)

 Then you need to set up the Authentication Plugin
 (http://search.cpan.org/dist/Catalyst-Plugin-Authentication/)

 I was more interested in the email/URL-confirmation process and the above two 
 modules you pointed me at cannot help me with that.


 Will look at the MojoMojo code to see if I can find an interesting starting 
 point there. Thanks for your answers so far.

 Anyone got any more useful pointers for the email/URL-confirmation process?

 Cheers,
 Daniel.


 -Ursprüngliche Nachricht-
 Von: David Schmidt [mailto:davew...@gmx.at]
 Gesendet: Donnerstag, 26. August 2010 11:13
 An: The elegant MVC web framework
 Betreff: Re: [Catalyst] User management with Catalyst (with email and URLs)

 On Thu, Aug 26, 2010 at 10:46 AM,  daniel.brunkho...@dataport.de wrote:
 Dear list members,

 I guess what I am trying to do is a pretty common task for web developers.
 So I am very astonished that a couple of hours spent searching the Internet
 didn’t provide me with a good starting point for my efforts.

 Here’s what I would like to achieve:

 A user comes to a web page and enters his email address to join the fun. He
 gets an email with a confirmation URL that leads him back to the site where
 he entered his email address to begin with, he then gets a welcome message
 and is presented a request to enter a password. With his email address and
 the entered password he can from then on login to the protected area at any
 time.

 And of course users do forget their passwords, so an automatic password
 retrieval feature would come in handy, too.

 Anybody got any good pointers where to start looking for something I can
 customize to my needs?

 I can’t imagine I am the first or only one wanting to achieve something like
 the above using Catalyst. Right?

 Any hints appreciated.

 Thanks,

 Daniel.

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



 Basically you need to setup a model (a common one would be
 DBIx::Class) to store your users.
 (http://search.cpan.org/~rkitover/Catalyst-Model-DBIC-Schema-0.43/lib/Catalyst/Model/DBIC/Schema.pm)

 CatalystX::SimpleLogin
 (http://search.cpan.org/~bobtfish/CatalystX-SimpleLogin-0.12/)

 Then you need to set up the Authentication Plugin
 (http://search.cpan.org/dist/Catalyst-Plugin-Authentication/)

 and thats pretty much it.

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



For that approach you need to store

email address
digest used in your URL
password

somewhere, that's what the model is for.

Anyways, what you want can be done with Catalyst.

1) user enters mailaddress and hits submit
2) you generate a digest
3) store digest + mailaddress in model
4) send digest in URL to mailaddress
5) user klicks the link
6) validate digest and request password
7) store pw in db

catalyst makes all this very easy.

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


Re: [Catalyst] User management with Catalyst (with email and URLs)

2010-08-26 Thread David Schmidt
On Thu, Aug 26, 2010 at 4:34 PM, Bill Moseley mose...@hank.org wrote:


 On Thu, Aug 26, 2010 at 4:10 AM, David Schmidt davew...@gmx.at wrote:

 1) user enters mailaddress and hits submit
 2) you generate a digest
 3) store digest + mailaddress in model

 I currently collect info and store and then also save the digest.  After
 seeing how much cruft get collected, I'd be tempted now to first send out
 the invitation to their email which brings them back to a sign-up form.
  The invite URL can contain their email, a timeout, and a digest so nothing
 needs to be saved server side.

 --
 Bill Moseley
 mose...@hank.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/



The invite URL could contain a digest of the mailaddress, in the
signup form the mailaddress is checked against the digest and could be
verified that way.
if the digest is generated with a private key it'll  be difficult to forge it.

___
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-Plugin-Params-Nested rt 59604

2010-07-28 Thread David Schmidt
On Wed, Jul 28, 2010 at 1:40 AM, Evan Carroll m...@evancarroll.com wrote:
 Is C:P:P:N still maintained? I filed a bug on CPAN, next day I heard a
 request for a patch. I provided a patch, and I haven't heard anything
 back. If any one is maintaining it? Can I get co-maint to apply my
 patch.

 Find more information about the issue and the patch set here:
 https://rt.cpan.org/Public/Bug/Display.html?id=59604

 --
 Evan Carroll - m...@evancarroll.com
 System Lord of the Internets
 web: http://www.evancarroll.com
 ph: 281.901.0011

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


Tomas Doran (the maintainer according to
http://search.cpan.org/dist/Catalyst-Plugin-Params-Nested/lib/Catalyst/Plugin/Params/Nested.pm)
is very active and im convinced he will apply the patch at due time if
it is sane.

He reads the mailinglist aswell. Just give it some more time.

david

___
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] Handling expired sessions gracefully

2010-07-09 Thread David Schmidt
On Fri, Jul 9, 2010 at 4:55 AM, Toby Corkindale
toby.corkind...@strategicdata.com.au wrote:
 On 09/07/10 00:53, Steve wrote:

 I've looked in the archives and tutorials but can't seem to find
 examples of handling expired sessions gracefully. I'm admittedly weak in
 the area of error checking, but I'm working on it :) Here are my
 questions:
 In what controller (Root.pm or MyApp.pm) and action should I check for
 an expired session? Should I check $c-user_exists or
 $c-session_expired (not sure if I have the correct accessor)? Once
 detected, do I forward, redirect, etc.?

 How about something like this?

 sub auto :Private { # or the head of your chain
  my ($self, $c) = @_;
  if (not $c-user_exists) {
    $c-stash-{destination} = $c-request-path;
    $c-detach('/login');
  }
 }

 Then in your login method, redirect them back to {destination} if they
 successfully authenticate; make sure to validate the path though, to avoid
 exploits. (eg. Another site crafting a redirect link like
 http://yoursite.com/login?destination=/confirm_payment/to/evil/hacker)

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


Checkout SimpleLogin. It does redirect after login and much more.
http://search.cpan.org/~bobtfish/CatalystX-SimpleLogin-0.12/lib/CatalystX/SimpleLogin.pm

___
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] Dealing with file uploads

2010-07-01 Thread David Schmidt
Hello list,

I updated my wiki cookbook entry today and think the outcome is pretty
neat. While it still can be improved here and there I think it's
partially advanced stuff for a newbie like me. It contains what I
learned about catalyst in the past weeks and I hope it's okay to get a
bit more publicity via the mailing list.

In the article I explain how to make your website deal with file
uploads and delivery in a proper way. I packed most code in reusable
roles that you simply apply to your controller.

But see for yourself...
http://wiki.catalystframework.org/wiki/wikicookbook/controllerwithfileupload

Feedback is very welcome.

david

___
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] Repeatedly creating sessions

2010-06-24 Thread David Schmidt
On Thu, Jun 24, 2010 at 10:14 PM, Nicholas Wehr
catal...@bionikchickens.com wrote:
 I see - sounds really cool and I fell into using firebug before I really got
 a chance to use it to it's fullest. firebug also allows for javascript
 debugging which was pretty critical for me, since I'm kind of a debugger
 junkie ;)

 On Thu, Jun 24, 2010 at 12:56 PM, James Spath jsp...@pangeamedia.com
 wrote:

 On Thu, Jun 24, 2010 at 3:51 PM, Matthias Dietrich mdietr...@cpan.org
 wrote:
  Nicholas,
 
  Am 24.06.2010 um 18:54 schrieb Nicholas Wehr:
 
  I used charles proxy as well until I discovered how awesome the mozilla
  addon firebug is. unbeatable json (xhdr) and network activity analyzer.
  handles ssl too check it out!
 
  jim, is there a charles feature that stands out above firebug? I only
  used for one project until I re-discovered firebug...
 
  I haven't bought Charles yet but used it for a longer time.  A big plus
  is that you can display the content depending on its type (eg. JSON and AMF
  as collapsable tree, but doesn't has a display mode for every type, I
  guess).  And it's browser independent so you can test with Safari and other
  clients (like native apps!), too.  You can record transferred data, stop
  recording, open new sessions while the old ones are still present.  If FF
  crashes or you navigate to a different page, Charles is still there and
  showing the recorded and opened sessions.
 
  Firebug is nice for single request tracking (yes, you can let the
  requests be sticky, but that's not the same and a bit ugly, even 
  sometimes
  it doesn't show the content if there's some), CSS, Javascript and HTML, but
  if you need to debug more intensive and longer I would prefer something 
  like
  Charles.

 What Matthias said :)

 The biggest features for me are a full history beyond the current page
 load ... and also the ability to redirect requests to different
 servers or even to a local file on your machine.

 Don't get me wrong, I use Firebug all the time, but Charles definitely
 has its uses.

 - Jim

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



With http://getfirebug.com/firebuglite you can debug on other browsers aswell.

david


-- 
David Schmidt   |   http://www.fm5.at

___
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] Log::Log4perl::Catalyst or Catalyst::Log::Log4perl ?

2010-06-13 Thread David Schmidt
On Sun, Jun 13, 2010 at 11:14 AM, Christiaan Kras c.k...@pcc-online.net wrote:
 Hi list,

 I'm currently looking at the available modules for implementing
 Log::Log4perl with my Catalyst app and would like to have some advice on it.

 I've found and tried Catalyst::Plugin::Log4perl::Simple but when using the
 module Catalyst warns about it using NEXT. So I'm wondering if it's smart to
 use it in its current state.

 When looking on I also found Log::Log4perl::Catalyst and
 Catalyst::Log::Log4perl. Where the former is part of the Log::Log4perl
 distribution. The latter still has some old issues open on which the author
 hasn't responded yet. So to me it seems abandoned. Other than that I don't
 really see much difference between both modules. I must note though that the
 former is very new and is only available since 2010/02/24

 From this I'd say using Log::Log4perl::Catalyst is the way to go: it's part
 of the Log::Log4perl distribution and has no open bugs (at least not on the
 Catalyst module).

 Thanks.

 --

 Christiaan Kras

 http://blog.htbaa.com
 http://www.brandweeruren.nl


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


Check whichever Plugin for log4perl Jay Shirley is recommending in
this talk and go with it.

http://www.presentingperl.org/opw2010/zen-maintenance/

greetings
david


-- 
David Schmidt   |   http://www.fm5.at

___
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] unrecognized characters

2010-06-13 Thread David Schmidt
On Sat, Jun 12, 2010 at 3:56 PM, Xiao Yafeng xyf.x...@gmail.com wrote:
 Hi gurus,
             I'm new to Catalyst. I've found a strange situation when I wrote
 a website in utf-8. The page will change into unrecognized characters when I
 use DBD::Oracle plus WRAPPER directive.
 but if I use single module like DBD::Oracle or WRAPPER, it will retrieve
 correct words.
 Please help! any replies are welcome! I could post the source code if
 needed.
 Besides. I use Catalyst::Plugin::Unicode for encoding, it works fine when I
 just use DBD::Oracle module only.
 ___
 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/



Read the pod, the author suggests not to use it anymore

http://search.cpan.org/dist/Catalyst-Plugin-Unicode/lib/Catalyst/Plugin/Unicode.pm


-- 
David Schmidt   |   http://www.fm5.at

___
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] A point of confusion/frustration on chained actions

2010-05-20 Thread David Schmidt
Could it be that this module provides what you are looking for?

http://search.cpan.org/~MASAKI/Catalyst-Controller-Resources-0.08/lib/Catalyst/Controller/Resources.pm#NESTED_RESOURCES

david

On Thu, May 20, 2010 at 4:42 AM, J. Shirley jshir...@gmail.com wrote:
 On May 19, 2010, at 4:32 PM, Steve Kleiman wrote:

 I second that. I'm another Catalyst newbie who would like to submit doc 
 patches for review, but I don't know the process


 On May 19, 2010, at 4:24 PM, Jeff Albert wrote:

 As an unabashed Catalyst n00b, I spent a couple of hours earlier this week 
 bashing through this same design conundrum on my own application, and 
 although I did ultimately come up with the solution that Ash describes 
 under my own steam, the Catalyst::DispatchType::Chained documentation 
 didn't do much to help me with the process at all - nor did the Catalyst 
 tutorial.

 I've never contributed, so I don't know the process, but it would be nice 
 to see this information in the documentation. If somebody who knows what's 
 necessary mails me off-list with the information on how to get started, I 
 would be willing hack up Ash's reply into a fairly minimal doc patch in 
 whichever location is appropriate.

 Cheers,
 Jeff




 There is a wiki node on it: http://wiki.catalystframework.org/wiki/contrib

 If you just connect to irc.perl.org, join #catalyst and then say, I want to 
 contribute a doc patch to [something] you shouldn't have a problem finding 
 an eager mentor to also help guide you through the process.

 You can also easily contribute to the Catalyst wiki 
 (http://wiki.catalystframework.org/wiki/), which has a very low barrier to 
 entry and you can ask for people to proofread what you have written by simply 
 posting to the mailing list here.

 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/




-- 
David Schmidt   |   http://www.fm5.at

___
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] REST Controller + ajax(jquery) with file upload

2010-05-18 Thread David Schmidt
Hello everybody,

I am experimenting with Catalyst::Controller::REST and jquery. The
goal is to create a Controller that handles media resources (= upload
a file + text input).

Catalyst::Controller::Resources pretty much does what I want.

Problem: Since I cannot seem to upload a file with a XMLHttpRequest my
Controller needs to handle two kinds of requests
1) typical AJAX requests where only a part of the site is changed.
thus no full document is sent htmlbody.../body/html but only
html fragments or JSON encoded data.
2) entire documents to respond to multipart/form-data POST/PUT requests



Here is a list of actions/paths I want to work with:

GET /media
get a list of all resources (respond with json data)

GET /media/$id
get a resource (respond with json data)

DELETE /media/$id
delete a resource (respond with a status msg, e.g. http status code)

GET /media/new
send form for creating a new resource (form.../form)

POST /media
submit a form, unlike the other requests so far this one expects a
complete document in return. the entire page is reloaded.

GET /media/$id/edit
send form for editing a resource (form.../form)

PUT /media/$id
submit the edit form, unlike. this one expects a complete document in
return like the POST request before



So how do I handle the two kinds of output?
One time I want to respond with html documents generated by my
C::V::TT View (POST, PUT requests) and for ajax requests I'd like to
use the serialization mechanism of C::C::REST.
I accomplished this by setting

MyApp/Controller/Media.pm:
__PACKAGE__-config(
map = {
'text/html' = [ 'View', 'MyView' ], # lib/MyApp/View/MyView.pm
}
);

Otherwise catalyst returns a 415 Content-Type text/html is not supported msg.
Now form POST/PUT requests are answered with completely new html pages
while ajax requests with jquery dataType json will get the
application/json response provided by C::C::REST


I am asking myself if my approach is practicable.
Any input welcome.

david

ps: I want my websites to be able to work with and without js. How can
I achieve this without increasing the complexity of my code too much.
(I vaguely remember this was really easy in RoR)

___
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] Check is session is expired

2010-04-16 Thread David
Hi Ben,

thanks! But I have tested it and, in fact, is $c-session_expires. 
$c-session-session_expires does not work at all.


 David





De: Ben Hitz h...@genome.stanford.edu
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: jue,15 abril, 2010 18:59
Asunto: Re: [Catalyst] Check is session is expired

$c-session-session_expires) returns 0 when the session is expired (and 
deletes the session).

Caveat: I am brand new - never installed the sw, but I was JUST reading this in 
the docs.

Ben

On Apr 15, 2010, at 8:33 AM, David wrote:

 Hi,
 
 Is there any method in order to check if user session has expired, so that 
 user is redirect to login page?
 Something like $c-session-is_expired which returns true or false?
 
 I've checked Catalyst Session Plugin, but I havem't found any method to check 
 if session has expired.
 
 David
 
 
 ___
 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/

--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO Consortium
Stanford University ** h...@genome.stanford.edu




___
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] Check is session is expired

2010-04-16 Thread David
Regarding session expiring, I am having a little problem.

I want to redirecto to login page whenever session is expired. It works 
allright, but when I do the redirect in a Controller index method ( sub index 
:Path :Args(0){} ), I always get next error message:

Caught exception in engine Can't call method as_string on an undefined value 
at /usr/local/share/perl/5.8.8/Catalyst/Engine.pm line 95.
Browser gets 404 HTTP Error, because instead of being redirect to login page, 
it is redirect to the same page, the page which is served int the index method.

I have made tests, and the redirect doesn't seem to be working right in this 
case. Code is executed after redirect, instead of stopping executing.

Redirect looks like: $c-response-redirect($c-uri_for('/'));


 David





De: Ben Hitz h...@genome.stanford.edu
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: jue,15 abril, 2010 18:59
Asunto: Re: [Catalyst] Check is session is expired

$c-session-session_expires) returns 0 when the session is expired (and 
deletes the session).

Caveat: I am brand new - never installed the sw, but I was JUST reading this in 
the docs.

Ben

On Apr 15, 2010, at 8:33 AM, David wrote:

 Hi,
 
 Is there any method in order to check if user session has expired, so that 
 user is redirect to login page?
 Something like $c-session-is_expired which returns true or false?
 
 I've checked Catalyst Session Plugin, but I havem't found any method to check 
 if session has expired.
 
 David
 
 
 ___
 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/

--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO Consortium
Stanford University ** h...@genome.stanford.edu




___
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] [DBIx::Class::ResultSet ] 'update' with 'where' clause

2010-03-23 Thread David
Hi,

I can't find how to set 'where' clause in an update. I only want to update rows 
depending on a condition. Is that possible? 
I haven't this option in ResultSet documentation.

I try like next, but it doesn't work. It updates all table rows.

$c-model('DB::Test')-update({'lang' = $lang-first-id},{where = {'id' = 
$c-user-get('id')}});

 

Thanks in advanced,

David



  ___
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] [DBIx::Class::ResultSet ] 'update' with 'where' clause

2010-03-23 Thread David
Thanks Ben and John.

 David





De: John Romkey rom...@apocalypse.org
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: mar,23 marzo, 2010 19:30
Asunto: Re: [Catalyst] [DBIx::Class::ResultSet ] 'update' with 'where' clause


On Mar 23, 2010, at 2:15 PM, David wrote:
Hi,

I can't find how to set 'where' clause in an update. I only want to update 
rows depending on a condition. Is that possible? 
I haven't this option in ResultSet documentation.

I try like next, but it doesn't work. It updates all table rows.

$c-model('DB::Test')-update({'lang' = $lang-first-id},{where = {'id' = 
$c-user-get('id')}});

This is really a DBIx::Class question and belongs on that list.

However.. you perform update on a resultset. $c-model() returns a resultset 
with no where clause. So get the resultset that you need with search and then 
call update() on that.

$c-model('DB::Test')-search({ 'id' = $c-user-get('id') })-update({'lang' 
= $lang-first-id});

- john romkey
http://www.romkey.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] Which PHP framework is the most similar to Catalyst?

2010-03-21 Thread David Silva
If you allready checked the Code Igniter, take another look to Kohana PHP
Framework, is based on Code Igniter, but is supported by the comunity istead
of a company.



2010/3/21 Peter Karman pe...@peknet.com

 Julien Sobrier wrote on 3/21/10 12:18 AM:
  Hello,
  I need to help a project that will be developed with PHP. I really
  love Catalyst, and I am looking for a similar framework in PHP.
  Symphony seems to be the closed to Catalyst. Do you have any
  suggestion?

 I found myself in a similar situation several months ago and have ended up
 using
 CodeIgniter http://codeigniter.com/ plus Doctrine
 http://www.doctrine-project.org/ as the ORM.


 --
 Peter Karman  .  http://peknet.com/  .  pe...@peknet.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/




-- 
David Silva - http://davidslv.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] Managing errors - cut execution flow.

2010-03-19 Thread David
Thanks Shirley, it's worked perfectly!

 David





De: J. Shirley jshir...@gmail.com
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: jue,18 marzo, 2010 19:11
Asunto: Re: [Catalyst] Managing errors - cut execution flow.

On Thu, Mar 18, 2010 at 10:03 AM, David oldskif...@yahoo.es wrote:
 Hi,


 I am not sure how to manage errors in my Catalyst application. When I detect
 an error, I forward the error to my Error View, but the execution doesn't
 stop.

 When my application was not in Catalyst, I used exit 1; once I had done
 forward to my Error View, but this doesn't work in my Catalyst application.

 Is there a politely way in Catalyst of cutting the execution process when I
 find an error and forward this error to my Error View?

 David




I believe you will be all set if you simply use $c-detach rather than
$c-forward.

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



  ___
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] Managing errors - cut execution flow.

2010-03-18 Thread David
Hi,


I am not sure how to manage errors in my Catalyst application. When I detect an 
error, I forward the error to my Error View, but the execution doesn't stop. 

When my application was not in Catalyst, I used exit 1; once I had done 
forward to my Error View, but this doesn't work in my Catalyst application.

Is there a politely way in Catalyst of cutting the execution process when I 
find an error and forward this error to my Error View?

 David



  ___
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] Socket error when launching Catalyst server

2010-03-16 Thread David
Thanks Jon,

that was exactly my problem and your solution has worked perfectly.
When I close the server, I always do 'Ctrl + C'. I don't know if it is the 
proper way to close it.


 David





De: Jon jonfda...@wetxt.com
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: lun,15 marzo, 2010 19:33
Asunto: Re: [Catalyst] Socket error when launching Catalyst server

 Couldn't create daemon: IO::Socket::INET: Address already in use at
 /usr/local/share/perl/5.8.8/Catalyst/Engine/HTTP.pm line 211.

It means you already have a server instance running.  If you don't
want it running (which it seems like you don't), and you don't know
where you started it from, you should just kill it, and then restart
your sever.

ps -ef | grep server | grep -v grep

will give you the process id that is running (should look like
myapp_server.pl).  kill -9 the process id, and then restart your
server.  Should take care of it.

- jon

___
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] Socket error when launching Catalyst server

2010-03-15 Thread David
Hello,

recently I am getting next error message once I have launched Catalyst server:

Couldn't create daemon: IO::Socket::INET: Address already in use at 
/usr/local/share/perl/5.8.8/Catalyst/Engine/HTTP.pm line 211.


I never got this error message before. I don't know how to fix it. It is like 
if there where other server instances running, because my website works even if 
I shut down the server. 
I can't neither see server activity, as it seems website is running in another 
server instance.


 David



  ___
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] [DBIx::Class::ResultSet ] not equal in where clause

2010-03-11 Thread David
Hi,

is not possible to set 'not equal' using ResultSet search method? I can't make 
it with 'search_literal' method because I need to use a join clause too.
I would like to do something like:

$c-model('DB::Test')-search({-and = [ 'me.name' = 'name', -not = { 
'users.id' = 'id'}]},
{ join = 'users' });


 David



  ___
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] Best practices: XML output from static XML

2010-03-06 Thread David
Exactly, as there is a little bit of application logic, so I need this process.
Thanks for the solution Jay. I'll go for it.

Just one last question. When you talk about using 'lib/MyApp/View/MyView.pm', 
you mean that is also correct to create a simple perl Module for your view. 
Then implement process method in the View.pm and forward the context from the 
Controller ( $c-forward( $c-view('MyView') ); )?

 
David






De: Mesdaq, Ali ames...@websense.com
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: vie,5 marzo, 2010 21:42
Asunto: RE: [Catalyst] Best practices: XML output from static XML

 Catalyst to serve a static file (which would only make sense if there *is* 
application logic) putting this in a View would be the Right Way.

Yes my point exactly. That’s why I was comparing it to serving static image 
files and how it's similar to this situation because there seems to be no 
application logic at all needed for this example so putting it in a view just 
to follow the design pattern does not make sense to me. That’s why I gave the 
previous example as an example of overkilling with the design pattern where it 
really serves no purpose. I completely agree that it makes much more sense to 
leverage the webserver for dealing with static files when necessary/possible. 

Thanks,
--
Ali Mesdaq (CISSP, GIAC-GREM)
Sr. Security Researcher
Websense Security Labs
http://www.WebsenseSecurityLabs.com
--


-Original Message-
From: J. Shirley [mailto:jshir...@gmail.com] 
Sent: Friday, March 05, 2010 12:20 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Best practices: XML output from static XML

On Fri, Mar 5, 2010 at 11:31 AM, Mesdaq, Ali ames...@websense.com wrote:
 To me this sounds like it’s the same issue as serving static images you
 wouldn’t create a view for that unless you need to wrap it around some
 application logic. Or at least that’s what it sounds like to me based on the
 information provided. We could take the MVC concept really far and say that
 static files need to have a filesystem Model with Controller logic for
 finding the files and each have their own View for each filetype.




I would say that putting it into a view allows a greater degree of
future-proof and foresight.  Putting it into the controller would work
fine, up until you need to serve another static file (or a different
file), or add an access control layer, or switch to use sendfile, or
switch to start serving from something like MogileFS.

If you put it all the above in one method, why put it in a controller
rather than a view?

In all of what you said you haven't actually said what is wrong with
using a view.

I would certainly recommend that serving static files would be done by
the webserver and render this moot.  However, if you want to use
Catalyst to serve a static file (which would only make sense if there
*is* application logic) putting this in a View would be the Right Way.

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


Protected by Websense Hosted Email Security -- www.websense.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/


[Catalyst] Best practices: XML output from static XML

2010-03-05 Thread David
Hi,

I need to generate an XML output (Content-type: application/xml), but this XML 
output is the XML content which is stored in an XML file. I don't need to 
dinamically generate this XML content. 
I have searched in google but I don't find any catalyst view module for 
managing this case. I don't know if exists any module for generating XML output 
from a static file as, for example, Catalyst::View::XSLT module 
(http://search.cpan.org/~janus/Catalyst-View-XSLT-0.08/lib/Catalyst/View/XSLT.pm)
 does. That is, generate an output from a static file, in this case, an XML 
output.

I am not finding much information about designing your own views in Catalyst, 
or at least, I don't see much flexibility. All examples I have found need to be 
generated, through the helper view, with TT template or any other templates.
Is it possible to create your own view, with no template, and for example, in 
my case, read the output from a static file and send this output to the client? 
(I don't know exactly how Views works in Catalyst, though I have already read 
Catalyst tutorial and cookbook)

Thanks in advanced,


David


  ___
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] Best practices: XML output from static XML

2010-03-05 Thread David
Thanks Jay.

I thought of that solution too when I had a look at 
Catalyst::Plugin::Static::Simple. But in this case, my doubt was, and is, how 
should I create the view through the helper?
Most of the examples for creating views are TT views, so they create it as 
'script/hello_create.pl view my_TT_view TT'.
 David





De: J. Shirley jshir...@gmail.com
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: vie,5 marzo, 2010 16:45
Asunto: Re: [Catalyst] Best practices: XML output from static XML

On Fri, Mar 5, 2010 at 5:10 AM, David oldskif...@yahoo.es wrote:
 Hi,

 I need to generate an XML output (Content-type: application/xml), but this
 XML output is the XML content which is stored in an XML file. I don't need
 to dinamically generate this XML content.
 I have searched in google but I don't find any catalyst view module for
 managing this case. I don't know if exists any module for generating XML
 output from a static file as, for example, Catalyst::View::XSLT module
 (http://search.cpan.org/~janus/Catalyst-View-XSLT-0.08/lib/Catalyst/View/XSLT.pm)
 does. That is, generate an output from a static file, in this case, an XML
 output.

 I am not finding much information about designing your own views in
 Catalyst, or at least, I don't see much flexibility. All examples I have
 found need to be generated, through the helper view, with TT template or any
 other templates.
 Is it possible to create your own view, with no template, and for example,
 in my case, read the output from a static file and send this output to the
 client? (I don't know exactly how Views works in Catalyst, though I have
 already read Catalyst tutorial and cookbook)

 Thanks in advanced,


 David



Well, you could do your own view or just rely on
Catalyst::Plugin::Static::Simple:

http://search.cpan.org/~mstrout/Catalyst-Plugin-Static-Simple-0.29/lib/Catalyst/Plugin/Static/Simple.pm#serve_static_file_$file_path

You could wrap this in a view:

package MyApp::View::StaticFile;

use parent 'Catalyst::View';

sub process {
my ( $self, $c ) = @_;
$c-serve_static_file( $c-stash-{static_file} );
}

1;



Then just do $c-forward( $c-view('StaticFile') ); after setting the stash key.

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



  ___
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] Best practices: XML output from static XML

2010-03-05 Thread David
Well, as Catalyst works under MVC model, I thought that a best practice would 
be to use a view module although in this case, obiously, the view task is 
insignificant.

 David





De: Mesdaq, Ali ames...@websense.com
Para: The elegant MVC web framework catalyst@lists.scsys.co.uk
Enviado: vie,5 marzo, 2010 19:04
Asunto: RE: [Catalyst] Best practices: XML output from static XML

 
Maybe I am missing
something but why is a view needed? If you are serving up a static file and its
xml why don’t you just serve that file statically based on path? Is the header
content-type not getting set properly for that file?
 
Thanks,
--
Ali
Mesdaq (CISSP, GIAC-GREM)
Sr.
Security Researcher
Websense
Security Labs
http://www.WebsenseSecurityLabs.com
--
 
From:David [mailto:oldskif...@yahoo.es] 
Sent: Friday, March 05, 2010 5:10 AM
To: catalyst@lists.scsys.co.uk
Subject: [Catalyst] Best practices: XML output from static XML
 
Hi,

I need to generate an XML output (Content-type: application/xml), but this XML
output is the XML content which is stored in an XML file. I don't need to
dinamically generate this XML content. 
I have searched in google but I don't find any catalyst view module for
managing this case. I don't know if exists any module for generating XML output
from a static file as, for example, Catalyst::View::XSLT module 
(http://search.cpan.org/~janus/Catalyst-View-XSLT-0.08/lib/Catalyst/View/XSLT.pm)
does. That is, generate an output from a static file, in this case, an XML
output.

I am not finding much information about designing your own views in Catalyst,
or at least, I don't see much flexibility. All examples I have found need to be
generated, through the helper view, with TT template or any other templates.
Is it possible to create your own view, with no template, and for example, in
my case, read the output from a static file and send this output to the client?
(I don't know exactly how Views works in Catalyst, though I have already read
Catalyst tutorial and cookbook)

Thanks in advanced,


David
 


Click here to report this email as spam.


Protected by Websense Hosted Email Security — www.websense.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] Could use some help from people with Windows boxen...

2010-02-22 Thread David Silva
Linux isn't that hard to learn, i'm still learning every day.

As they said, you might expect that some modules won't work in windows. If
you can, and have time forget perl in windows and work in linux, it's
better.

And i'm not a fanboy, i just think linux stuff should be in linux, and
windows stuff in windows.

2010/2/22 Mahmoud Mehyar mamod.meh...@gmail.com

 On Mon, Feb 22, 2010 at 2:43 AM, Rodrigo rodrigol...@gmail.com wrote:



 What I'd like to know from you is:

 1) How well does it work for you as Catalyst users on Windows?
 2) Any modules that should be removed or added?

 I don't use Catalyst myself yet, I'm just a packager.  Feedback will be
 very helpful.



 I'm using catalyst on windows for development purposes only, I'm happy with
 it and the performance is great so it can go live on windows with no issues,
 I think!

 The only problem I faced was installing the last version of catalyst and
 since I'm using last verion of Activestate Perl 5.10
 I had to do a lot of manual module installations, took some time, but at
 the end it all went just fine and now I have the latest version running
 smoothly :)


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




-- 
David Silva - http://davidslv.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] HTML editor plugin

2010-02-03 Thread David Schmidt
On Wed, Feb 3, 2010 at 2:32 PM, Denny 2...@denny.me wrote:
 On Wed, 2010-02-03 at 07:02 -0600, Paul Falbe wrote:
 I'm looking to create a little app to edit/create HTML strings to
 store in a mysql table.  These strings are going to be displayed on
 a web page for annoucements for a youth baseball league.  Before I
 went about creating one I thought I'd ask if there is a plugin/example
 out there I should use as a starting point.  Basically, I need a
 Catalyst html editor plugin if such a thing exists.

 Not Catalyst specific, but I've used ckeditor* in the past - it's a
 drop-in replacement for textarea with a load of configuration options.

 Bear in mind the obvious security risks of letting people input HTML and
 then injecting it directly into your site - at a bare minimum you want
 to strip out javascript stuff, including onclick etc.

I use TinyMCE and HTMLScrubber to define the allowed html tags.
http://search.cpan.org/~cfranks/HTML-FormFu-0.06001/lib/HTML/FormFu/Filter/HTMLScrubber.pm

- type: Textarea
  name: 'description'
  filters:
- type: HTMLScrubber
  allow: [ 'a', 'p', 'br', 'strong', 'em', 'h1', 'h2', 'h3',
'img', 'ul', 'ol', 'li' ]

___
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] Login as another user ...

2010-01-18 Thread David Schmidt
On Mon, Jan 18, 2010 at 11:34 AM, Kiffin Gish kiffin.g...@planet.nl wrote:
 As system administrator who has root access to everything, I want to be
 able to login as another user from my dashboard page.

 What's the best way to achieve this? I tried $c-authenticate without a
 password, but this doesn't seem to work.


The following thread might help you.

http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg08648.html

david

___
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] Enabling debug mode with fastcgi..

2010-01-18 Thread David Schmidt
I am pretty sure debug output went to apache's error log when I last checked.

On Mon, Jan 18, 2010 at 8:54 PM, Adam Mackler nab...@mackler.org wrote:
 Hi Toby:

 The output might be going to your web server log.  Try starting your
 fastcgi script with a -e option (with CATALYST_DEBUG set as well).

 Adam

 On Mon, Jan 18, 2010 at 05:03:23PM +1100, Toby Corkindale wrote:
 Hi guys,
 If you're running a Catalyst app with the fastcgi script (as found in
 scripts/myapp_name_fastcgi.pl), then is there a way to enable the debug
 mode. (eg. like running scripts/myapp_server.pl -d)

 I've tried setting CATALYST_DEBUG and MYAPP_DEBUG in the shell
 environment, but that doesn't seem to work. Either that or else fastcgi
 is discarding the output somewhere in our case. (I've messed with the
 -keeperr option too)

 Cheers,
 Toby

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




-- 
David Schmidt   |   http://www.fm5.at

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


  1   2   >