Re: [Catalyst] Squatting::On::Catalyst

2008-08-01 Thread Jonathan Rockway
* On Tue, Jul 29 2008, John Beppu wrote:
 Now that composition and embedding of web apps is becoming a reality, we have
 to start anticipating needs like this.  For example, the documentation for an
 app that's built to be embedded could state that:

Expectations suck.  Use Ernst, tag your attributes and classes with the
necessary metadescription, and introspect.  The user should tell the
computer what to do, not the other way around.

   * It expects a user object to be in its session's u key.

The Session should be a class of course, and the class should have an
attribute with a metadescription that does
Squatting::Description::User, or whatever.

   * The app will expect to be able to call the -name method on this user
 object.  (Some apps may want more...  others less...  this is just a
 hypothetical example.)

The User class should have a class metadescription that describes what
methods return what data.

   * If that key is undef, the app will assume the current session is not in a
 logged in state.

Why not force the class to implement a role that provides a
user_is_logged_in method?  Then there is no need to guess.  Just call
the method and see.  (Actually, it would be better to be able to
meta-describe methods... but I haven't implemented this yet.)

-

Someone else mentioned in another post how this sort of thing is
impossible with forms, but it's actually not.  Ernst and Reaction have
solved this problem.  We generate the DBIC files from the row class's
metadescription, and we generate the form handling code from the same
metadescription.  Unfortunately all of my examples are locked up in
internal code right now (very experimental), and I think mst's code is
mostly in the same state :)

Anyway, here is an old Ernst demo:

http://git.jrock.us/?p=Ernst.git;a=tree;f=prototype/catalyst/TestApp;hb=HEAD

The important part:

http://git.jrock.us/?p=Ernst.git;a=blob;f=prototype/catalyst/TestApp/lib/TestApp/Backend/Record.pm;hb=HEAD

Anyway, it turns out that this is a simple problem, but just needs some
tweaking for maximum enjoyment and ease of use.  (We've gotten rid of TT
in the production version, for example, because the fragments are too
hard for designers to work with.  Instead, we are using
Template::Refine.)

Regards,
Jonathan Rockway

--
print just = another = perl = hacker = if $,=$

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Configuring a Controller from the config file

2008-08-01 Thread Moritz Onken


Which contains the class-level defaults.

Not application defaults.

You should never, ever EVER access $self-config in a model, view or
controller object.

Your config value will be in $self-{key}.

It's considered normal to do

package My::Controller::Foo;

use strict;
use warnings;
use parent qw(Catalyst::Controller);

__PACKAGE__-mk_accessors(qw(foo bar));

__PACKAGE__-config(
 foo = 'default_for_foo',
 bae = { default = 'for_bar' },
);


Thanks a lot!
works great :-)

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Debug with FCGI

2008-08-01 Thread Angel Kolev

Hi all.
I run my cat app as standalone FCGI server+apache2:
script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5

How can i run it in debug mode same as catalyst development server?

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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: [solved] App testing with Test::WWW::Mechanize::Catalyst

2008-08-01 Thread Marius Kjeldahl
Just a final followup; removing some hardcoded use lib ... paths in 
the test framework made everything behave identical on all installed 
systems. The problem was that one of the systems actually had some older 
stuff in one of the hardcoded paths that got picked up that made it bomb 
out on that system.


Thanks,

Marius K.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Debug with FCGI

2008-08-01 Thread Moritz Onken


Am 01.08.2008 um 12:45 schrieb Angel Kolev:


Hi all.
I run my cat app as standalone FCGI server+apache2:
script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5

How can i run it in debug mode same as catalyst development server?

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



Try CATALYST_DEBUG=1 script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Debug with FCGI

2008-08-01 Thread Chris Dolan

On Aug 1, 2008, at 6:28 AM, Moritz Onken wrote:


Try CATALYST_DEBUG=1 script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5



Prefixing env CATALYST_DEBUG=1 will work in more shells than just  
CATALYST_DEBUG=1.

Chris

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Debug with FCGI

2008-08-01 Thread Angel Kolev

Chris Dolan wrote:

On Aug 1, 2008, at 6:28 AM, Moritz Onken wrote:


Try CATALYST_DEBUG=1 script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5



Prefixing env CATALYST_DEBUG=1 will work in more shells than just 
CATALYST_DEBUG=1.

Chris

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

Dev site: http://dev.catalyst.perl.org/

Doesn`t work too. All debug output goes to apache log. I tryed with -e 
option - same result.


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] I am a Tech. Lead in need of two Senior LAM(Perl) guys in China

2008-08-01 Thread Christopher Davaz
Sorry if it looks like spam, I am not a recruiter. MST said I could post
this. ;-)

I am a Tech Lead for a LAMP Team at an offshoring company in Shenzen, China.
We need two Senior LAMP guys to join our team. It seems hard to find anyone
with decent Perl experience in China. Keep in mind this salary is also a
typical Chinese salary for a Senior Software Engineer in the Shenzhen area.
If you are interested, let me know.

Best Regards,
-Chris
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Debug with FCGI

2008-08-01 Thread Peter Karman


On 08/01/2008 07:55 AM, Angel Kolev wrote:

 Doesn`t work too. All debug output goes to apache log. I tryed with -e
 option - same result.

Look at Catalyst::Log::Log4perl if you want to send debugging output somewhere 
different
than stderr.

I have this in MyApp.pm just before my setup() call:

unless ( $ENV{LOG4PERL}  $ENV{LOG4PERL} eq 'local' ) {
require Catalyst::Log::Log4perl;
__PACKAGE__-log(
Catalyst::Log::Log4perl-new(
__PACKAGE__-path_to('log4perl.conf') . ''
)
);
}

and then my log4perl.conf file:

log4perl.rootLogger=DEBUG, LOGFILE
log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename=/path/to/myapp.debug_log
log4perl.appender.LOGFILE.mode=append
log4perl.appender.LOGFILE.layout=PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %F %L %c - %m%n


and finally, I start up my test server like:

 LOG4PERL=local perl script/myapp_server.pl

so that the normal Catalyst log() feature is used.

-- 
Peter Karman  .  [EMAIL PROTECTED]  .  http://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/


Re: [Catalyst] Debug with FCGI

2008-08-01 Thread Dermot
2008/8/1 Peter Karman [EMAIL PROTECTED]:


 On 08/01/2008 07:55 AM, Angel Kolev wrote:

 Doesn`t work too. All debug output goes to apache log. I tryed with -e
 option - same result.

Isn't debug configurable?

__PACKAGE__-setup(qw/
-Debug
 ...
);

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Debug with FCGI

2008-08-01 Thread Jonathan Rockway
* On Fri, Aug 01 2008, Angel Kolev wrote:
 Doesn`t work too. All debug output goes to apache log. I tryed with -e
 option - same result.

Use the keep error option, -e.

Regards,
Jonathan Rockway

--
print just = another = perl = hacker = if $,=$

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Debug with FCGI

2008-08-01 Thread Jonathan Rockway
* On Fri, Aug 01 2008, Jonathan Rockway wrote:
 * On Fri, Aug 01 2008, Angel Kolev wrote:
 Doesn`t work too. All debug output goes to apache log. I tryed with -e
 option - same result.

 Use the keep error option, -e.

Hmm, I should read the whole post before I reply.  Anyway, it should work.

--
print just = another = perl = hacker = if $,=$

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Weak references - perl error

2008-08-01 Thread Dermot
Getting sick of the sight of the DBIx::Class::StartupCheck error with
my version of perl, I updated my version to:

Name   : perl
Arch   : i386
Epoch  : 4
Version: 5.8.8
Release: 10.el5_2.3

Now I am getting the following error:

Weak references are not implemented in the version of perl at
/usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 24

line 24:
use Scalar::Util qw/weaken blessed/;

Scalar::Util is up-to-date

Can anyone give me some advice here?
Thanx,
Dp.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Squatting::On::Catalyst

2008-08-01 Thread John Napiorkowski



--- On Fri, 8/1/08, Jonathan Rockway [EMAIL PROTECTED] wrote:

 From: Jonathan Rockway [EMAIL PROTECTED]
 Subject: Re: [Catalyst] Squatting::On::Catalyst
 To: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Date: Friday, August 1, 2008, 2:57 AM
 * On Tue, Jul 29 2008, John Beppu wrote:
  Now that composition and embedding of web apps is
 becoming a reality, we have
  to start anticipating needs like this.  For example,
 the documentation for an
  app that's built to be embedded could state that:
 
 Expectations suck.  Use Ernst, tag your attributes and
 classes with the
 necessary metadescription, and introspect.  The user should
 tell the
 computer what to do, not the other way around.
 
* It expects a user object to be in its
 session's u key.
 
 The Session should be a class of course, and the class
 should have an
 attribute with a metadescription that does
 Squatting::Description::User, or whatever.
 
* The app will expect to be able to call the
 -name method on this user
  object.  (Some apps may want more...  others
 less...  this is just a
  hypothetical example.)
 
 The User class should have a class metadescription that
 describes what
 methods return what data.
 
* If that key is undef, the app will assume the
 current session is not in a
  logged in state.
 
 Why not force the class to implement a role that provides a
 user_is_logged_in method?  Then there is no
 need to guess.  Just call
 the method and see.  (Actually, it would be better to be
 able to
 meta-describe methods... but I haven't implemented this
 yet.)
 
 -
 
 Someone else mentioned in another post how this sort of
 thing is
 impossible with forms, but it's actually not.  Ernst
 and Reaction have
 solved this problem.  We generate the DBIC files from the
 row class's
 metadescription, and we generate the form handling code
 from the same
 metadescription.  Unfortunately all of my examples are
 locked up in
 internal code right now (very experimental), and I think
 mst's code is
 mostly in the same state :)
 
 Anyway, here is an old Ernst demo:
 
 http://git.jrock.us/?p=Ernst.git;a=tree;f=prototype/catalyst/TestApp;hb=HEAD
 
 The important part:
 
 http://git.jrock.us/?p=Ernst.git;a=blob;f=prototype/catalyst/TestApp/lib/TestApp/Backend/Record.pm;hb=HEAD
 
 Anyway, it turns out that this is a simple problem, but
 just needs some
 tweaking for maximum enjoyment and ease of use.  (We've
 gotten rid of TT
 in the production version, for example, because
 the fragments are too
 hard for designers to work with.  Instead, we are using
 Template::Refine.)
 
 Regards,
 Jonathan Rockway
 
 --
 print just = another = perl = hacker = if
 $,=$

So, you're suggesting that the shared interfaces, such as User, ect., be 
defined via MetaDescription Roles and then having some sort of interpreter?  I 
think I can see how this buys flexibility.  If you could help me understand I 
bit I'd be grateful.  I was thinking at first we could do this like (Entities 
and fields purely for example)

## Common Interface

CatalystX::Common::Role::User;
use Moose:Role;
requires qw(name dob ...);

## Application implementation

MyApp::Role::User;
use Moose::Role;
with 'CatalystX::Common::Role::User';
requires qw(my domain specific stuff);

MyApp::Storage::Schema::Result::User;
use Moose;
with 'MyApp::Role::User';
extends 'DBIx::Class';

all the rest of your storage implementation

But if this was MetaDescription the implementation would be more like?

MyApp::Role::User;
use Moose::Role;
requires qw(my domain specific stuff);
__PACKAGE__-meta-metadescription-apply_role(
  'CatalystX::Description::Trait::User',
);

I guess then you'd need something to interpret the MetaDescription at the 
Storage level.  To be honest, I can see how this is very useful for declaring 
UI behaviors, but not completely seeing how it can play the role of a business 
logic interface.  Am I on a totally wrong track here?

--jjnapiorkowski



  

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Weak references - perl error

2008-08-01 Thread Tomas Doran


On 1 Aug 2008, at 17:16, Dermot wrote:


Getting sick of the sight of the DBIx::Class::StartupCheck error with
my version of perl, I updated my version to:

Name   : perl
Arch   : i386
Epoch  : 4
Version: 5.8.8
Release: 10.el5_2.3

Now I am getting the following error:

Weak references are not implemented in the version of perl at
/usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 24


Your perl is broken.

5.8.8 does normally implement weak references, so your perl must be  
specifically broken to not do so..


You're going to leak memory like a sieve until you get a perl which  
works, this isn't really Catalyst's problem.


Cheers
Tom


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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: Weak references - perl error

2008-08-01 Thread Aristotle Pagaltzis
* Dermot [EMAIL PROTECTED] [2008-08-01 18:25]:
 Scalar::Util is up-to-date

Yes, but only half installed. You need the XS component but you
only have the pure-Perl version. Force-install it again.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.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] Re: Weak references - perl error

2008-08-01 Thread Dermot
2008/8/1 Aristotle Pagaltzis [EMAIL PROTECTED]:
 * Dermot [EMAIL PROTECTED] [2008-08-01 18:25]:
 Scalar::Util is up-to-date

 Yes, but only half installed. You need the XS component but you
 only have the pure-Perl version. Force-install it again.

 Regards,
 --
 Aristotle Pagaltzis // http://plasmasturm.org/


Hi Aristotle,

Does your advise conflict with Tomas's? Do you think I can fix this
without having to revert to installing perl from source? I would
rather not have have to go down that route. I am much happier using my
package manager for this sort of think than trying to install from
source. It would be murder if I wanted to install this on more than
one server.
Dp.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Re: Weak references - perl error

2008-08-01 Thread Dwalu Z. Khasu
On Sat, 2 Aug 2008, Dermot wrote:

=2008/8/1 Aristotle Pagaltzis [EMAIL PROTECTED]:
= * Dermot [EMAIL PROTECTED] [2008-08-01 18:25]:
= Scalar::Util is up-to-date
=
= Yes, but only half installed. You need the XS component but you
= only have the pure-Perl version. Force-install it again.
=
= Regards,
= --
= Aristotle Pagaltzis // http://plasmasturm.org/
=
=
=Hi Aristotle,
=
=Does your advise conflict with Tomas's? Do you think I can fix this
=without having to revert to installing perl from source? I would
=rather not have have to go down that route. I am much happier using my
=package manager for this sort of think than trying to install from
=source. It would be murder if I wanted to install this on more than
=one server.
=Dp.
=
=
Not perl.  Just Scalar::Util :)

% perl -MCPAN -e 'force install Scalar::Util'
-- 
- Dwalu
.peace
--
I am an important person in this world -
Now is the most important time in my life -
My mistakes are my best teachers -
So I will be fearless.
- Student Creed

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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: Weak references - perl error

2008-08-01 Thread Aristotle Pagaltzis
* Dermot [EMAIL PROTECTED] [2008-08-02 01:40]:
 Does your advise conflict with Tomas's?

I didn’t seem Tomas giving you any specific advice, so I don’t
understand how to answer your question.

 Do you think I can fix this without having to revert to
 installing perl from source? I would rather not have have to go
 down that route.

You only need to force-install Scalar::Util, which is available
from the CPAN separately from perl. You don’t need to reinstall
your entire perl.

 I am much happier using my package manager for this sort of
 think than trying to install from source. It would be murder if
 I wanted to install this on more than one server.

Complain to your packager/distributor that they shipped a broken
perl. Anyone who packages a perl of newer vintage than mid-2002,
without Scalar::Util’s XS part, is doing it wrong.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.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/