Re: [Catalyst] Subsessions?

2007-09-27 Thread Zbigniew Lukasiak
On 9/27/07, Rainer Clasen [EMAIL PROTECTED] wrote:
 Hello,

 there are currently two Problems I could easily solve with subsessions.

 After saving some data I want to redirect the user back to where he came.
 So I'd like to keep track where the user came from. As I expect the User
 to use several Browser windows, neither Cookie based Sessions (incl.
 stash) work in all scenarios. Right now I'm using the HTTP Referer, which
 I'm also considering a bit clumsy.

 Furtermore there are users who have access to other users' data. I'd like
 them to select them *once* which user's data they want to work on and keep
 this for the current browser window. Again I expect the user to use
 multiple browser windows (say for working with multiple users' data at the
 same time).

 So I'm searching for something functional similar to:
 http://paneris.net/cgi-bin/cvsweb.cgi/SubSession/SubSessions.html?rev=1.3


Interesting.  I usually use GET parameters for that - but I can
imagine where it would become not enough.

-- 
Zbigniew Lukasiak
http://perlalchemy.blogspot.com/

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


Re: [Catalyst] (en) error screen translations

2007-09-03 Thread Zbigniew Lukasiak
(pl) Proszę spróbować później

Fixed (added non ascii characters).

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] CMS

2007-08-24 Thread Zbigniew Lukasiak
I don't know if that is feasible - but perhaps we could try to define
some way of building components cross cutting the MVC pattern.  Like a
threaded discussions component that you could attach to any page and
that would contain the model part to store the posts the controller to
manage them and the view templates.

--
Zbyszek
http://brudnopis.blogspot.com/

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


Re: [Catalyst] TT macro to avoid excessive $c-uri_for calls

2007-08-07 Thread Zbigniew Lukasiak
On 8/7/07, Matt S Trout [EMAIL PROTECTED] wrote:
 That's why we optimised the living crap out of uri_for.

 It's more than 10x faster than it used to be.

Great to hear that.  Does it also apply to uri_with?

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Making Controllers thin and Models thick

2007-07-18 Thread Zbigniew Lukasiak
, %options, -errors =
[EMAIL PROTECTED]);
}
--

The validate routine in Super::ResultSet does some generic work, and
then this.


--
 if (@errors  ($options{-throw})) {
$errors[0]-rethrow() if (@errors == 1);
throw Error::Multiple(-args = [EMAIL PROTECTED]);
 }
 return @errors;
--

Just to take things all the way back to the view, here's the code
that handles flagging form fields that correspond to errors.  Note
that I'm using Embperl::Object for the View. (I have a complete
rewrite of the plugin which has far tighter integration than the one
on CPAN.  I hope to release that in a few weeks.)  The following code
assumes the Prototype javascript library has been loaded.
Technically this should be called onload, but I haven't gotten
around to it yet, and it will (usually) work if added after the form
in question has been completely displayed.

--
script lang=javascript
 [$ if ($errors) $]
[$ foreach my $err (@$errors) $]
[$ foreach my $f (@{ $err-{-fields} }) $]
$([+ $f +]).addClassName('error-field');
[$ endforeach $]
[$ endforeach $]
 [$ endif $]
/script
--

Comments?  Thoughts?

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




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Uniform treatment of all parameters (including file uploads)

2007-07-04 Thread Zbigniew Lukasiak

On 7/3/07, Matt S Trout [EMAIL PROTECTED] wrote:

No, because this would break the ability to pass the request object to
something expecting the CGI.pm API, and break compat for existing app code.


I think you meant Apache::Request because the current implementation
is not compatible with CGI.pm.

-param( 'file_field' ):
- in CGI returns the filename that is also a filehandle
- in Catalyst it is just filename

-upload( 'uploaded_file_name' )
- in CGI returns a filehandle
- in Catalyst returns Catalyst::Request::Upload



Maybe have a think about what you'd like to see from a completely new
unified API and propose that?


So my wishlist would be: -upload to return the filehandle (for
compatibility with CGI), -param to return Catalyst::Request::Upload,
and make Catalyst::Request::Upload stringify to the filename.  If we
could also make Catalyst::Request::Upload work as a filehandle in
angle brackets it would be entirely compatible with CGI.pm (but not
with Apache::Request).

--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


[Catalyst] Uniform treatment of all parameters (including file uploads)

2007-07-03 Thread Zbigniew Lukasiak

I constantly bump into the mismatch in the treatment of 'normal'
params and the file uploads.

Wouldn't life be simpler if

$c-request-param( 'file_field' )

would return a Catalyst::Request::Upload object (or an array of them)?

You can get the name of the uploaded file from a
Catalyst::Request::Upload object.

--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] :Template() Attribute

2007-06-18 Thread Zbigniew Lukasiak

When we are at this View refactoring.  When changing the template you
need to put the whole path on stash ( $c-stash( template =
template_path/template.tt) ).  What I would propose is that the view
automatically used the $c-action-namespace as the template_path - so
that you would not need to specify the full path - only the template
name.

This would mean less typing in most common case but also should be
useful when inheriting from a base controller - since it would
automatically adjust the template paths - and that is what you need in
most cases as well.  The ideal would be if it would search the
template directories of respective controller classes in the
inheritance tree - but I have no idea how to accomplish that.

--
Zbyszek

On 6/17/07, Jonathan Rockway [EMAIL PROTECTED] wrote:

On Sunday 17 June 2007 01:02:52 pm Christopher H. Laco wrote:

 Well, if we're throwing things in the ring...

 C::View::Templated

 -template()

 And some forms of:

 -template_paths(\@)


I like this.  Should we put this in a separate package, or right in C-Runtime?

Incidentally, you could do $c-view-template('...')* instead of
$c-stash-{template}, which looks pretty nice.

* or $c-view('View::TT')-template('...') if you don't like default_view.

--
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;

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




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] :Template() Attribute

2007-06-18 Thread Zbigniew Lukasiak

On 6/18/07, John Napiorkowski [EMAIL PROTECTED] wrote:
...

For example I
have cases where for all templates in a given
directory I want to set a particular WRAPPER for my
Template toolkit, etc.

I don't quite understand what you mean here - but I thought it should
cover this case in the same way that method inheritance covers it when
you work with objects.

You put WRAPPER = wrapper.tt in the view config and then you create
the base controller - put a wrapper.tt into it's template directory.
When you inherit from that controller you can use that inherited
template.  Or you can override the template by putting some new code
into a file called 'wrapper.tt' into the new controllers template
directory.  This is the same thing you do with methods - you can
inherit them or override them.

Ideally this should take into account the use of 'use base' in the
controller packages - but splitting $c-action-namespace - as Matt
proposes can be acceptable.

--
Zbyszek
http://brudnopis.blogspot.com/

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


Re: [Catalyst] :Template() Attribute

2007-06-18 Thread Zbigniew Lukasiak

On 6/18/07, Bill Moseley [EMAIL PROTECTED] wrote:
...

Do you mean instead of $c-action-reverse like C::V::TT does now?
That is, so you always have to specify the template name?


What I see in my copy of C::V::TT is:

sub process {
   my ( $self, $c ) = @_;

   my $template = $c-stash-{template}
 ||  $c-action . $self-config-{TEMPLATE_EXTENSION};

What I would propose is something like:

   my $template =  $c-action-namespace . '/';
   $template .=  $c-stash-{template}  ||  $c-action-name;
   $template .= self-config-{TEMPLATE_EXTENSION};

But the template inheritance that I describe in the other letter in
this thread might be even better.

--
Zbyszek

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


Re: [Catalyst] :Template() Attribute

2007-06-18 Thread Zbigniew Lukasiak

On 6/18/07, Matt S Trout [EMAIL PROTECTED] wrote:

 What I would propose is something like:

my $template =  $c-action-namespace . '/';
$template .=  $c-stash-{template}  ||  $c-action-name;
$template .= self-config-{TEMPLATE_EXTENSION};

 But the template inheritance that I describe in the other letter in
 this thread might be even better.

You can do this via additional_template_paths.

What you just proposed is woefully incompatible with every single deployed
application so not remotely an option.


True - here is the corrected version:

   $c-stash( additional_template_paths = $c-action-namespace );
   my $template = $c-stash-{template}  ||  $c-action-name .
$self-config-{TEMPLATE_EXTENSION};


--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Creating Good Adaptor or Bridge Models (WAS: Creating a thin Model)

2007-06-10 Thread Zbigniew Lukasiak

On 6/9/07, Matt S Trout [EMAIL PROTECTED] wrote:


 I would change it to:

 setup_components:
 ModelName:
   type: model
   class: Catalyst::Model::DBIC::Schema
   instantiate:
 schema_class: My::Schema
 connect_info: 

 to get rid of the Model = model mapping.

But then you'd need special case syntax to declare two types of cntroller
of the same name somewhere. Ick.


OK - I don't like having semantics in the names, but there are
exceptions (for example the mapping of controller names to urls).  So
I don't care too much about that point.

How is the test case?  Did I miss something in it? (beside a test for
the COMPONENT call which, as I understand should be quite similar to
the one for the 'new' call).

--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Creating Good Adaptor or Bridge Models (WAS: Creating a thin Model)

2007-06-09 Thread Zbigniew Lukasiak

On 5/23/07, Matt S Trout [EMAIL PROTECTED] wrote:


Maybe something more like

setup_components:
  Model::ModelName:
class: Catalyst::Model::DBIC::Schema
instantiate:
  schema_class: My::Schema
  connect_info: 

?


I would change it to:

setup_components:
ModelName:
  type: model
  class: Catalyst::Model::DBIC::Schema
  instantiate:
schema_class: My::Schema
connect_info: 

to get rid of the Model = model mapping.

I not sure how this would work with the old style of config without
the setup_components subdir (using the Model::ModelName directly in
the config hash):

MyApp-config(
  name = 'MyApp',
  root = MyApp-path_to('root');,
  'Model::DBIC::Schema' = {

but I understand that the setup_components way is now the recommended one.

I attach my attempt at a test (for now only the 'new' method call is tested).

--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/


loadtest.t
Description: Troff document
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Project Opportunity

2007-06-07 Thread Zbigniew Lukasiak

Just out of curiosity - are you going to use MojoMojo as base for the wiki part?

--
Zbyszek

On 6/6/07, Jmax [EMAIL PROTECTED] wrote:

Greetings Catalyst Developers,

I have been working with a friend of mine on a website of his, which has
quite a bit of traffic, and a large community.  We are in need of a
second developer, and are hoping that one of you would be interested.

The better part of, if not all of, the application will be open source
(same terms as perl - artistic/gpl), and will consist primarily of a
forums and wiki, with a few slight twists.  There will be some
compensation for the chosen developer to work with me on this project,
however, it won't be much as it will be evenly split between us two.
The entire terms will be discussed between us at a later point.

Advanced Perl skills and some Catalyst experience is required.  A good
grasp of design patterns, efficiency concerns and aforethought, and
debugging patience is also required.  Web scripting and markup
experience is also required;  Design skills are not.  Knowledge of TT2,
DBIx::Class, Postgresql, YAML, and experience in any other programming
language is preffered, but not required.  They're fairly easy to pick
up.  This is a good position for a great programmer who may not
necessarily have a lot of experience, or a programmer who is  interested
in brushing up their Catalyst and/or web skills; or perhaps a programmer
who is looking for a fun side project.

If you're still interested (and I hope you are) please email me, and
we'll discuss your abilities and compensation.


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




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Creating Good Adaptor or Bridge Models (WAS: Creating a thin Model)

2007-05-23 Thread Zbigniew Lukasiak

Some time ago I had this idea that the declarations we put into
MySite::Model::DBIC are entirely superfluous and that it would be much
simpler if we just needed to declare in the config file that the model
uses the MySite::Schema and have it generated automatically.  Matt
agreed and asked me to write tests for that feature - but I did not
know what should go into these tests.

So the idea is to be able to declare in the config file:

Model::ModelName :
  instantiate : MySite::Schema

and then use $c-model(ModelName) without actually creating the
MySite::Model::ModelName package anywhere.

So what are the tests that would go here?  I can think only about two:

- that $c-model(ModelName) is a Catalyst::Model
- that the config values are correctly used

Is there anything more?  This would automate what you put in the
first, simpler method of model building.

--
Zbyszek




On 5/22/07, John Napiorkowski [EMAIL PROTECTED] wrote:

--- Jamie Neil [EMAIL PROTECTED] wrote:

 Matt S Trout wrote:
  If you get stuck, could you start a fresh thread,
 please? I think this one
  has officially got confused now :)

 Ok. Just for the record though, this seems to be
 working fine so far:


 package MySite::Model::Widget;

 use strict;
 use warnings;
 use base qw/Catalyst::Model/;
 use MySite::Widget;

 __PACKAGE__-config(
  connect_info = [
  'dbi:Pg:mysite', 'username',
  'password', { AutoCommit = 1 },
  ],
 );

 sub new {
  my ( $class, $c, $args ) = @_;
  return MySite::Widget-new(
  Catalyst::Utils::merge_hashes( $args,
 $class-config ) );
 }

 1;

[CUT]

Hey,

Maybe we could summarize the best practice lessons
from this thread?  If so I'll be happy to put them on
the wiki someplace suitable.

So we are saying it's better to override new instead
of COMPONENT and that it's okay to return your class
directly in new and not have to create an accessor and
then use AUTOLOAD to dispatch method calls?

So when you just want to make the object available via
$c-model(...)-method you can do (in the catalist
model):

sub new {
  my ($class, $c, $args) = @_;

  return ExternalModule-new(
Catalyst::Utils::merge_hashes( $args,
$class-config )
  );
}

But if you are adapting and/or altering the method
calls it would be better to:

__PACKAGE__-mk_accessors(qw/some_object/);

sub new {
  my ($class, $c, $args) = @_;
  my $self = $class-NEXT::new($c, $args);

  $self-some_object(Someobject-new(
Catalyst::Utils::merge_hashes( $args,
$class-config )

  return $self;
}

sub adapted_method
{
  my $result = shift-some_object-internal_method;
  ## Do something to $result
  return $result;
}

The reason I ask is because there have been several
ways of doing this very basic type of thing floating
around CPAN and I'm sure I'm not the only one
confused.

Maybe we could try to generate a concise list of cases
and then try to work out a best practices example for
each?  I'm sure that would be a good thing for a wiki
entry or even as part of the POD docs.

--john

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


[Catalyst] A gentle introduction to Chained - Catalyst::Controller::PathArgs

2007-04-28 Thread Zbigniew Lukasiak

For those too lazy to learn Chained in one step I've prepared
Catalyst::Controller::PathArgs  (on the way to CPAN) - it's some
syntactic sugar over Chained, useful for the most common cases.

My blog entry on it:
http://perlalchemy.blogspot.com/2007/04/catalystcontrollerpathargs.html

See the POD copied below for details.
--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

==

NAME
  Catalyst::Controller::PathArgs - syntactic sugar for
Catalyst::DispatchType::Chained.

SYNOPSIS
package MyApp::Controller::Root;
use base 'Catalyst::Controller::PathArgs';
__PACKAGE__-config-{namespace} = '';

sub pathargsroot : PathArgs(1) {}

use Catalyst::Controller::PathArgs;
package TestApp::Controller::Pathargsroot;

use base 'Catalyst::Controller::PathArgs';

sub pathargsend : PathArgs(1) EndPoint { }

DESCRIPTION
  This Catalyst Controller base adds two new action attributes:
PathArgs (taking one numerical argument)
  and EndPoint.  This is entirely syntactic sugar over the
Catalyst::DispatchType::Chained full machinery
  for paths like '/book/$book_id/edition/$edition_id/view' - with
PathArgs you can chain the 'book', 'edi-
  tion' and 'view' methods and declare how many parameters they
take.  EndPoint is needed to declare an
  ation as the end of the chain (in theory this should be
computable - but for now I don't see any easy
  way to do that).

  This package uses Class::C3 this means that you cannot use NEXT
in classes based on it - but C3 looks
  like a good replacement for NEXT.

  To declare that the book subroutine is the root chained action
with one argument you need to declare it
  in the Root controller with:

sub book : PathArgs(1) {

  If we had a non chained path with /book/edition - the edition
sub would be declared in the 'Book' controller
  - and this is the same case here - you just add PathArgs(1) to
indicate that it is indeed
  chained and that it takes one parameter. So in the Book
controller you add:

sub edition : PathArgs(1) {

  For the last action in the chain you need to add EndPoint.  So
in the Book::Edition controller you would
  need:

sub view : PathArgs(0) EndPoint {

  You can also mix PathArgs with PathPart (new in Catalyst
5.7007).  For example if you wanted to have an
  action responding for the address /book/$book_id/edition you
would need a subroutine called 'edition'
  in the Book controller, but there is already one routine called
'edition' in that controller.  What you
  can do in that case is make a sub with a different name and
declare that from the outside it's name
  should be really 'edition':

sub edition_mascarade: PathPart('edition') PathArgs(0) EndPoint {

  yeah - you need to add EndPoint there as well.

  An example is included in the example directory of this distribution.

  Internally PathArgs and EndPoint are converted to 'Chained(.)'
and appriopriate CaptureArgs or Args
  attributes.  For more sophisticated chaining you might need to
use Catalyst::DispatchType::Chained
  directly.

  create_action

  This is the overriden method from Catalyst::Controller used
here to compute the new attributes.

LIMITATIONS
  Using this module forces you to have a directory structure of
the modules similar to the external paths
  that you want to serve.  For example to serve the external path
of '/book/$book_id/edition/$edi-
  tion_id/view' you need to have a module 'Book/Edition.pm'. If
you want to build your modules directory
  structure completely independently from the path served you
need the full power of Catalyst::Dis-
  patchType::Chained.  To convert a script using PathArgs to the
original Chained just change every
  PathArgs($number) to 'Chained('.')  CaptureArgs($number)' or
'Chained('.') Args($number)' if it is an
  'EndPoint'.

BUGS
SUPPORT
AUTHOR
  Zbigniew Lukasiak
  CPAN ID: ZBY
  http://perlalchemy.blogspot.com/

COPYRIGHT
  This program is free software; you can redistribute it and/or
modify it under the same terms as Perl
  itself.

  The full text of the license can be found in the LICENSE file
included with this module.

SEE ALSO
  Catalyst::DispatchType::Chained

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


Re: [Catalyst] best way to create a flexible, multiple key, CRUD application?

2007-02-19 Thread Zbigniew Lukasiak

Hi,

Just one explanation - the DBSchema.pm you mention in your email is
generated by InstantCRUD.  The generation part is quite complicated
since Jonas Alves added support for the many-to-many relations, but if
you just edit the generated files and add the additional primary keys
it should work.

Anyway I stopped development of Instant untill I have a more clear
picture of what underlaying libraries to use and untill I have some
additional functionality in them.

--
Zbyszek

On 2/18/07, Francesc Romà i Frigolé [EMAIL PROTECTED] wrote:

Hello,

I want to create a web application which is basically CRUD, and I was
wondering if there is a scaffolding script that can do it for catalyst. It
has to support tables with composite primary keys.

I thought InstantCRUD would be a good solution but i quickly discovered that
it doesn't handle composite primary keys ( it actually says it on the
documentation ). I naively thought that it wouldn't take much time to add
such functionality, and I started preparing a patch for it. I actually
managed it to work for Edit/Update and Delete (I think so), but I got stuck
with the Create part. The problem is, at least, that InstantCRUD depends on
DBSchema.pm which has the same limitation.

Now I got the feeling I'm wasting my time because somebody must already have
a solution for this problem, right?

BTW: I've seen a lot of talk about Reaction on the list recently but I
haven't quite got what is it about, and apparently is undocumented. Does it
have any relation with CRUD?

thanks in advance,
Francesc


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





--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst vs Rails vs Django Cook off

2007-01-15 Thread Zbigniew Lukasiak

I remember the discussion here - but it seems that nobody tried to
independently verify the results.  I did compare Rails and Catalyst
and on my pretty standard Debian box Catalyst was about 50% faster
than Rails.

--
Zbyszek

On 1/14/07, Octavian Rasnita [EMAIL PROTECTED] wrote:

Hi,

Here is ablog I just found. Is it true that Catalyst is so slow comparing
with other frameworks?
http://letsgetdugg.com/category/rails

Octavian


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




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Catalyst vs Rails vs Django Cook off

2007-01-15 Thread Zbigniew Lukasiak

I did try my tests once again and they do indeed use WEBrick.  I'll
try to fix that.   By the way - is it possible to deploy Catalyst over
lighttpd?

--
Zbyszek

On 1/15/07, Victor Igumnov [EMAIL PROTECTED] wrote:

The main devs confirmed my results. Concerning your benchmark, I am
pretty sure you screwed up some where, ie: running web brick in
development mode.

Regardless, the benchmark was fairly simplistic to begin with which
only stressed the dispatcher.

-Victor

On Jan 15, 2007, at 12:12 AM, Zbigniew Lukasiak wrote:

 I remember the discussion here - but it seems that nobody tried to
 independently verify the results.  I did compare Rails and Catalyst
 and on my pretty standard Debian box Catalyst was about 50% faster
 than Rails.

 --
 Zbyszek

 On 1/14/07, Octavian Rasnita [EMAIL PROTECTED] wrote:
 Hi,

 Here is ablog I just found. Is it true that Catalyst is so slow
 comparing
 with other frameworks?
 http://letsgetdugg.com/category/rails

 Octavian


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



 --
 Zbigniew Lukasiak
 http://brudnopis.blogspot.com/

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


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




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] RE: DBIx::Class/TT Pager Question

2007-01-02 Thread Zbigniew Lukasiak

You could also try Catalyst::Example::InstantCRUD - it does paging (on
simple tables not on joins - but this should not be difficult to fix).

--
Zbyszek

On 12/31/06, Dennis Daupert [EMAIL PROTECTED] wrote:

Leandro wrote:
Maybe you should try this...
my $page = $c-req-params('page') || '';
$c-stash-{photos} =
[$c-model('CatapultDB::Photos')-search(
{
  'gallery.id' = $selected_gallery
},
{
  join = [qw/ gallery /],
  prefetch = [qw/ gallery /],
  rows = 2,
  page = $page,
}
)-all];

Leandro, that does work. Woo hoo!
I will go ahead and use that method, for now,
but it means I'll have to keep track of the pages
manually. I will keep working at trying to
make contact with the pager method, since that
will get to the goodies like the pager.previous_page
and pager.next_page. Even so, it's a relief to
get this part working. I thank you very much!

/dennis


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






--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] uri_for (or lack thereof) in static pages

2006-11-17 Thread Zbigniew Lukasiak

Just an idea - modify the test server to serve under localhost:3000/myapp.

--
Zbyszek

On 11/16/06, Cédric Bouvier [EMAIL PROTECTED] wrote:

I have a ѕimple yet thorny problem, which I expect most of you also have
or had. It has several possible solutions, but I'm chiefly interested in
knowing how *you* would solve it and why.

We're developing a Catalyst application. It serves HTML, CSS,
JavaScript, and images. HTML is the output of TT2, but CSS, images and
JavaScript are static. We have them served by C::P::Static::Simple on
the built-in server, and we use a Location the have them directly
served by Apache/mod_perl, one the production server. Under mod_perl,
the application's root is not the server's root, i.e., it is
http://server/myapp, whereas it is http://localhost:3000 on the built-in
test server.

This would not be a problem if the CSS were not linking to images. And
because CSS pages are static, they cannot make use of uri_for(), and
therefore get the links to the pictures wrong.

Several solutions come to mind, and I cannot choose which one I like
best (or I dislike the least):
- have CSS served through TT2. I'm wondering about the extra load it
  would put on the Catalyst engine. Maybe it's completely negligeable,
  maybe not... Is it worth the effort to cache them? If so, what are the
  recommended best practices?
- make all links in CSS relative. This makes it harder to spread the
  stylesheets in a deep directory structure, unless one is willing to
  tediously count the ../../.. (or was it ../..?) and count them again
  when a stylesheet moves.
- insist that MyApp be installed at the server's root, bribing the
  sysadmin if need be (or threatening, or loudly shouting at, or blackmailing, 
or
  sacking, torturing...)
- use some black magic involving mod_rewrite or even HTTP::Proxy to
  modify the broken links on the fly... Hmmm, blackmailing the sysadmin
  should be easier than having him tweak mod_rewrite...
- Pre-process the CSS at install time, with some sort of ttree, and then
  serve them as static content.

Any war stories worth telling, Gentlemen, Ladies?

--
C é d r i c   B o u v i e r


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFFXNyPV+dbgD38PGgRAm5zAJ9/pza47+h+EsqnOI5jyp69wBkgZQCdGIEF
GlllH30KkWhmcg6G/zLfFnQ=
=YG65
-END PGP SIGNATURE-


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






--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Re: [Perl Plat_Form] Geneva team confirmed for the plat_form contest

2006-11-16 Thread Zbigniew Lukasiak

Hi all,

This might be a shameless plugin - but I wander if you consider using
Catalyst::Example::InstantCRUD for fast bootstrapping a bare bones
app.  I imagine that in the  limited time it should be usefull.

--
Zbyszek

On 11/16/06, Dami Laurent (PJ) [EMAIL PROTECTED] wrote:




Hi all,

This is to confirm that I have the agreement of my organization for
submitting a Geneva team for the plat_form contest
(http://www.plat-forms.org/).

The deadline for submission is in 2 weeks, so other teams, please wake up,
so that we can show to the world that Perl is alive!

Our proposal will be based on :

IDE :  Emacs / Vim
Source control : Subversion
Web framework : Catalyst on Apache/mod_perl
ORM : DBIx::DataModel
Templating : Template Toolkit
Validation : Data::Domain
Javascript : prototype+scriptaculous+openrico+Jemplate

Best regards,

Laurent Dami
 Conseiller en systèmes d'information
 Palais de Justice - Etat de Genève
 Case postale 3966
Place du Bourg-de-Four 3, 1211 Genève 3
 +41 (22) 327 20 64 (direct), +41 (22) 327 20 37 (service)
 http://cui.unige.ch/~dami



___
Perl-platform mailing list
[EMAIL PROTECTED]
https://lists.odem.org/mailman/listinfo/perl-platform






--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] automatic form generation based on data models

2006-11-08 Thread Zbigniew Lukasiak

Answering the question about autogenerating simple CRUD apps - there
is of course Catalyst::Example::InstantCRUD.

To the arguments that autogenerated CRUD becomes quickly crap I answer
that it is much easier to modify a working example than to code from
scratch.  You have more control of where you are heading - while with
working from scratch you are taking a long course without any
checkpoints before you reach the destination.  The long course might
look temptingly simple - but my whole experience convinces me that
usually it looks so simple only because we don't forsee too many
details.

--
Zbyszek



Big steps in software development is always

On 11/8/06, marcus baker [EMAIL PROTECTED] wrote:

In a primarily Perl shop I've joined, Django has become all the rage.
Everyone into it is amazed at the templating capabilities and the
database abstraction layer (...they obviously hadn't really done much
with the Template Toolkit, or even heard of Class::DBI or
DBIx::Class).  Django's all fine and lovely, but personally I still
prefer Catalyst due to the vastness of the CPAN library I can use
behind it.

The one thing about Django that keeps them from looking anywhere else
is it's ability to create data-editing forms on the fly based on the
data model.  In an attempt to get them to consider Catalyst a little
more, I was wondering if Catalyst has this kind of capability
anywhere... Is this something I should take to the CDBI/DBIxC lists
specifically?

Thanks
-Marcus

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




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?

2006-11-01 Thread Zbigniew Lukasiak
 site: http://dev.catalyst.perl.org/




--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?

2006-11-01 Thread Zbigniew Lukasiak

Don't assume - check.  There might be multiple conversions on the way
and the display might work - but still the underlying data might be
wrong.

--
Zbyszek

On 11/2/06, Mao DengFeng-e13751 [EMAIL PROTECTED] wrote:


I am sure the data  returned by db handle is UTF8. Because  the data can
be displayed correctly in textarea of form element.

Thanks
Mao Dengfeng


-Original Message-
From: Zbigniew Lukasiak [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 01, 2006 6:56 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?

You might check if the utf8 flag is set on the data returned by the db
handle.  I know that in PostgreSQL you need to use pg_enable_utf8 to
have that.

To check it just use the is_utf8 function from Encode.

--
Zbyszek

On 11/1/06, Mao DengFeng-e13751 [EMAIL PROTECTED] wrote:
 I have try below solution. This issue is not solved.






 -Original Message-
 From: Mao DengFeng-e13751
 Sent: Wednesday, November 01, 2006 5:59 PM
 To: The elegant MVC web framework
 Subject: RE: [Catalyst] Catalyst-plugin-prototype supports UTF8?

 Ok, I will try your solution.

 Thanks
 Mao Dengfeng


 
 POPI:
 Motorola General Business Information  [ ]
 Motorola Internal Use Only   [X]
 Motorola Confidential Proprietary   [ ]



 -Original Message-
 From: apv [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 01, 2006 5:08 PM
 To: The elegant MVC web framework
 Subject: Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?

 Yes, I do think this is the same problem I was having. The form field
 is fine. The other utf-8 on the page which is displayed correctly when

 there is not a form loaded with utf8 becomes mangled.

 Try Catalyst::View::TT::ForceUTF8 if you are using TT2. It fixed my
 problems completely (except that it doesn't acknowledge non-standard
 tags have been defined, and I normally prefer not to use [% %]).
 Still, small price to pay.

 On Wednesday, Nov 1, 2006, at 00:38 US/Pacific, Mao DengFeng-e13751
 wrote:

  Thanks for your quikly reply.
  For the form in the page, The utf8 characters can be displayed
  correctly .
  For example, chinese characters can be displayed correctly in
  textara/textarea
 
  Mao DengFeng
 
 
 
  -Original Message-
  From: apv [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 01, 2006 4:29 PM
  To: The elegant MVC web framework
  Subject: Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?
 
  I was getting the same thing in my apps. They display utf8 fine as
  long as there is no utf8 in a form in the same page.
 
  Catalyst::Plugin::Unicode combined with
  Catalyst::View::TT::ForceUTF8 fixes this for me. I don't speak
  Chinese but it is what I usually use to test the unicode and it
  appears to work fine for both FCGI and the test server. I am not
  doing any AJAX right now so I'm not sure if there are any issues in
that layer (JS-Perl).
 
  -Ashley
 
 
  On Tuesday, Oct 31, 2006, at 23:47 US/Pacific, Mao DengFeng-e13751
  wrote:
 
  Hi, all
 
  I am studying MiniMojo example in catalyst.
  I try to use mysql as the database.
  The sample can work well but  I got wild charater when I input
  chinese
 
  charater.
  Please review below steps
  1. I use UTF8 charset both webpage and mysql database.
  2. When I input chinese charaters and submit, The text area and
  mysql

  database can display chinese charaters correctly. But I got wild
  charaters in   div id=view/div
  3. I have checked mysql database which is updated by the example.
  The

  chinese characters can be displayed correctly.
 
  Because the view area is updated by Catalyst-plugin-prototype
  according the input of text area. I think the issue is caused by
  Catalyst-plugin-prototype.
 
  Please give me some advice to fix this issue
 
  Thanks
 
  Mao Deng feng
 
  ___
  List: Catalyst@lists.rawmode.org
  Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.rawmode.org/
  Dev site: http://dev.catalyst.perl.org/
 
 
 
 
 
  -Ashley
  --
  http://sedition.com * http://sedition.com/ddx http://querylog.com *
  http://ashleypond.com/v
 
 
  ___
  List: Catalyst@lists.rawmode.org
  Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.rawmode.org/
  Dev site: http://dev.catalyst.perl.org/
 
  ___
  List: Catalyst@lists.rawmode.org
  Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.rawmode.org/
  Dev site: http://dev.catalyst.perl.org/
 
 
 


 -Ashley
 --
 http://sedition.com * http://sedition.com/ddx http://querylog.com *
 http://ashleypond.com/v

Re: [Catalyst] Auth with Chained dispatch

2006-10-21 Thread Zbigniew Lukasiak
Hi,

I don't know if that is the right solution for you, but you can always
put the whole checking into the auto subroutine, just retrieve the
action, the item ID and check it there.

--
Zbyszek

On 10/20/06, Jesse Sheidlower [EMAIL PROTECTED] wrote:

 I'm finally considering writing something with the Chained
 dispatch type, and before I start I want to clarify how I'll
 do the auth stuff.

 I'm trying to refactor to simplify repeated code. What I want
 to do is have something like /item/edit/23 and /user/edit/87
 (repeated over many different actions and perhaps even tables,
 like /catalog/user/edit/23 vs. /phonelist/user/edit/23), so
 that instead of totally separate but almost identical methods
 (like I have now), I'll have one thing that goes to item
 or user (and/or catalog or phonelist) and fills the
 stash with any relevant things, so that I can have one edit
 that does the work, but with whatever sort of table info is
 appropriate.

 However, I still need to have separate access levels:
 /item/edit and /item/view have different needs, as do
 /item/edit and /user/edit (and certainly /catalog/anything
 vs. /phonelist/anything). But if I make edit general,
 what's the good way to restrict people based on the entire
 chain?

 Right now I have a Root auto method making sure people are
 in the system and logged in, auto methods at each controller
 to make sure people are allowed to do that general thing
 (e.g., deal with items or users), and then further checks
 in each method as necessary (e.g. OK, he's logged in and he
 can deal with items, but can he edit them? Or, does he
 own item 23 so he can edit this one item?). When my methods
 become generic, how do I keep doing this?

 Thanks.

 Jesse Sheidlower

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



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Rails-like form helpers

2006-10-16 Thread Zbigniew Lukasiak
I was thinking a bit about this:
 in HTML::Widget you decide how you want your form
 controls to look in the model class, and in Rails you do it in the
 template
The standard answer to that is that the looks should be defined in the
CSS, but actually I don't buy that argument. It is good for the start
but then there are too many things that you need eventually to tweak
about the HTML.  So eventually you start replacing more and more of
the generated HTML with the templates and in the end you would use
only the validation part of HTML::Widget.

This is very similar to the scaffolding idea and I think HTML::Widget
should support this process. Now we can generate the whole form by
HTML::Widget or use only the validation part, with the iteration over
the elements we can generate the elements but not the whole form and
at the last step we can have the whole HTML in the templates and use
only the validation part of HTML::Widget.  We can add yet another
intermediate step by delaying the declaration of a input type to the
call in the templates. Something like:

In controller:  my $el = $w-element('age'); $el-constraint( 
In template: [% w.render_element('age, 'Textfield') %]

--
Zbyszek

 - but than this would leave only the validation part in the HTML::Widget


On 10/13/06, Jon Warbrick [EMAIL PROTECTED] wrote:
 Sorry, I've been a bit slow replying to your questions :-)

 On Thu, 21 Sep 2006, Zbigniew Lukasiak wrote:

  I don't know if I grap the idea of the helpers in full - could you explain
  their functions here in short?  For me it looks like they just create form
  elements just like the $w-element('...', '...') does.

 Yes, that's about it. They are just shortcuts for use in templates to
 create form elements, except that

   1) They deal with the stickiness/defaulting for you; and

   2) They know how to name the elements to make updating the underlying
  model objects easier. So a text box for editing the 'name' field of a
  person record might be called 'person.name' (see below).

   2) They know about the error flags that appear in the model objects
  following validation failure and so can adapt their behaviour
  accordingly (display with error flags, add error messages, etc).

  There is something
  also about using them for the updates - could you a bit elaborate on that?

 On form submission, these parameters are parsed into data structures in
 the equivalent of $req-parameters (so the edited name value from above
 might be in $req-parameters-{person}-{name}). The huge value of this is
 that the model objects can directly accept these structures for creation
 or update, e.g.

   $c-model('Person')-update($req-parameters-{person});

  HTML::Widget also works on the update side - at least can check the
  constraints, but it does not set values of an object - do the RoR helpers?

 A lot of this functionality exists in HTML::Widget. The main difference
 seems to be that in HTML::Widget you decide how you want your form
 controls to look in the model class, and in Rails you do it in the
 template.

 Jon.

 --
 Jon Warbrick
 Web/News Development, Computing Service, University of Cambridge

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



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Scaffolding

2006-10-06 Thread Zbigniew Lukasiak
Hi,

You can try Catalyst::Example::InstantCRUD - I've tried to make it a
kind of scaffolding for Catalyst.  I am waiting for ideas how to
improve it.

The Catalyst::Helper::Controller::Scaffold code is a bit obsolete I believe.

--
Zbyszek

On 10/6/06, Kevin Wong [EMAIL PROTECTED] wrote:
 Hi,
  I want to use Scaffoding for my catalyst project, but reading through the
 docs of Catalyst::Helper::Controller::Scaffold and the
 Cookbook, I think Scaffold uses CDBI and the new version of Catalyst works
 with DBIC class.
  What should I do to use scaffold feature? Is it just simply install the
 CDBI class?
  If aomeone has already use Scaffold, please give me some advice, or better,
 give me the command line to use it. In the mean time, I will search through
 the docs and  the archive, hoping to find the answer.

  Thank you,

  Kevin


  
 Stay in the know. Pulse on the new Yahoo.com. Check it out.


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





-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


Re: [Catalyst] Scaffolding

2006-10-06 Thread Zbigniew Lukasiak
Looks like you need to install DBIx::Class::DigestColumns.

Z.

On 10/6/06, Will Smith [EMAIL PROTECTED] wrote:
 Hi,
  I tried the Module, and this is some error that Ive got. I don't know if I
 missed something in the installation:

  script/my_myapp_server.pl
  Couldn't instantiate component
 My::myapp::Model::DBICSchemamodel, Cannot load schema
 class 'DBSchema': DBIx::Class::Schema::load_classes():
 DBIx::Class::Componentised::load_components(): Can't locate
 DBIx/Class/DigestColumns.pm in @INC (@INC contains:
 /home/danh/My-myapp/script//../lib
 /usr/lib/perl5/5.8.5/i386-linux-thread-multi
 /usr/lib/perl5/5.8.5
 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4
 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2
 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0
 /usr/lib/perl5/site_perl
 /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.5
 /usr/lib/perl5/vendor_perl/5.8.4
 /usr/lib/perl5/vendor_perl/5.8.3
 /usr/lib/perl5/vendor_perl/5.8.2
 /usr/lib/perl5/vendor_perl/5.8.1
 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl
 .) at (eval 171) line 3.
  Compilation failed in require at (eval 168) line 3.
  ...propagated at /usr/lib/perl5/5.8.5/base.pm line 85.
  BEGIN failed--compilation aborted at
 /home/danh/My-myapp/script//../lib/DBSchema/Books.pm line
 5.
  Compilation failed in require at (eval 167) line 3.
  Compilation failed in require at
 /usr/lib/perl5/site_perl/5.8.5/Catalyst/Model/DBIC/Schema.pm
 line 272.
   at script/my_myapp_server.pl line 53 at script/my_myapp_server.pl line 53
  Compilation failed in require at script/my_myapp_server.pl line 53.

 Zbigniew Lukasiak [EMAIL PROTECTED] wrote:
  Hi,

 You can try Catalyst::Example::InstantCRUD - I've tried to make it a
 kind of scaffolding for Catalyst. I am waiting for ideas how to
 improve it.

 The Catalyst::Helper::Controller::Scaffold code is a bit
 obsolete I believe.

 --
 Zbyszek

 On 10/6/06, Kevin Wong wrote:
  Hi,
  I want to use Scaffoding for my catalyst project, but reading through the
  docs of Catalyst::Helper::Controller::Scaffold and the
  Cookbook, I think Scaffold uses CDBI and the new version of Catalyst works
  with DBIC class.
  What should I do to use scaffold feature? Is it just simply install the
  CDBI class?
  If aomeone has already use Scaffold, please give me some advice, or
 better,
  give me the command line to use it. In the mean time, I will search
 through
  the docs and the archive, hoping to find the answer.
 
  Thank you,
 
  Kevin
 
 
  
  Stay in the know. Pulse on the new Yahoo.com. Check it out.
 
 
  ___
  List: Catalyst@lists.rawmode.org
  Listinfo:
  http://lists.rawmode.org/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.rawmode.org/
  Dev site: http://dev.catalyst.perl.org/
 
 
 


 --
 Zbigniew Lukasiak
 http://brudnopis.blogspot.com/

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



  
 Get your email and more, right on the new Yahoo.com


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





-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

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


[Catalyst] Rails-like form helpers - RFC for a new module

2006-09-24 Thread Zbigniew Lukasiak
Dear all,In the new InstantCRUD I decided to take out the code for html forms generation and make a separate module for it. After reading 'Rails-like form helpers' thread I think that this module might find a more general use.
I would like to ask you what intefrace would you propose for it.It can build the HTML::Widgets based on some config and data from the database and then can also save the data from the widget to the database. The config part is more complicated than it could be because the info about many-to-many relations is not available from the schema so you need to specify it in the config. Since it is already there I've added also the stringification to it - as it is a bit cleaner to have it here in the interface part than overload stringification in the database schema definition.
The current interface is composed of just two functions:Catalyst::Example::InstantCRUD::Widget-make_widget($interface_config, $class, $schema, $item);$interface_config is a hash containing info about all db classes and how to wigetify them, $class is the db class, $schema is DBIC schema and $item is the db row to populate values in the form - its optional.
Catalyst::Example::InstantCRUD::Widget-populate_db($result, $item);$result is HTML::Widget::Result and $item is the db row to be updatedSo my question is do you think it deserves to be taken out from InstantCRUD and then what name would you propose for it? How would you design the API?
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] TracHacks

2006-09-14 Thread Zbigniew Lukasiak
Recently on this list I've seen someone anounced starting a Social Bookmarking project - while I have been coding such an application for a year already. I did not publish it on CPAN because it's not a finished project yet - but I put a lot of work into it and I would share it with anyone who would like to use it.
And as kind of coincidence just today I've seen this: http://www.trac-hacks.org/ It is a site hosting svn archives of all kinds of plugins, macros and patches for Trac - even unfinished ones. Wouldn't a Catalyst hacks site be beneficial for us?
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] User Generated Content (project collaboration)

2006-09-12 Thread Zbigniew Lukasiak
Hi,

I have written my own social bookmarking app in Catalyst - it's nearly
working. You can try it at http://zby.aster.net.pl/LinkM/. 

I am mostly proud of the UI ideas - integration of tagging, searching
and sorting making the process of search recursive. You can click
on the tags, nicks, host addresses and you get the resultst filtered by
them, then you can add new filters, sort by columns etc. I have
lots of thoughts about the cognitive process of finding a web page from
which you remember only some random pieces and I tried to create an
ideal search interface. 

I have not published the code yet as it is not entirely working but I
can provide it to anyone that would like to build something based on
it. I would love to discuss the interface ideas as well.

--
ZbyszekOn 9/10/06, Kieren Diment [EMAIL PROTECTED] wrote:
On 10/09/06, Kaare Rasmussen 
[EMAIL PROTECTED] wrote:
 So, what do you all think?I saw several willing people.I don't have a lot of free time right now, but Id be willing to be a clearinghouse for interested people.The thread got divided a bit in discussions regarding the social network
framework and the necessary widgets. The latter represented by InstantCRUDand Matt's yet unpublished widget set.I gather your interest lies in the social network framework per se. My opinionis to focus on the design of the framework and get help from either of the
solutions above. In other words, choose the solution that suits the frameworkbest and help out there. No need to invent yet another approach if these fitthe bill.
I'm
in the process of porting a GPLed social bookmarking thing which is
currently mod_perl/cdbi over to Catalyst/DBIC. I intend to keep
the catalyst portion of the code Artistic Licence, The
current code is idiosyncratic enough that I think I will be
implementing everything except the database schema from scratch. I'm hoping to pop a proof of concept over to the original
authors/ holders, and this group within the next month or
two. I have an existing web api with which I need to retain
compatibility. Mainly at the moment I need to work out how their
existing (gnarly) database works and get catalyst to display the
content and implement portions of the API properly.
I won't name the original codebase I'm working on in a
googleable place until I've let the original authors/ holders know
what I've done (i.e. when proof of concept is ready) but you're
welcome to contact me privately in the mean time.


___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/-- 
Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] InstantCRUD and Windows

2006-09-01 Thread Zbigniew Lukasiak
Hi,

Thanks for the report. Unfortunately I don't normally use Windows
so I also cannnot program for it. Currently the test suite for
Instant is also not really meant for Windows. I need someone with
Windows experience to join our team.

--
Zbyszek
On 9/1/06, Nilson Santos Figueiredo Junior [EMAIL PROTECTED] wrote:
I'm currently starting a new simple Catalyst application and decidedto give InstantCRUD a shot. However, it couldn't even be installedunder Windows since Cache::FastMmap isn't installable under Win32.I don't really know if the authors are aware of this issue, that's why
I'm posting this here. Maybe the session store could be changed tosomething more cross-platform friendly like Session::Store::File oreven Session::Store::DBIC.-Nilson Santos F. Jr.___
List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] While the Catalyst CPAN install discussion is still going on....

2006-08-23 Thread Zbigniew Lukasiak
Just yesterday I tried installing modules on my Windows box (cygwin) - and I had a memory problem so frequently that I gave up. It was something like cannot allocate heap. But this was Windows of course.--Zbyszek
On 8/22/06, Dennis Daupert [EMAIL PROTECTED] wrote:
I've used CPAN.pm a lot, have installed Catalyst on various unix boxen  (linux, solaris), have always been able to coerce mods to install. Until now. My ISP runs BSD, perl 5.8.0 (oh my god!! and yes, I've asked them to  upgrade, and was told someday, we just don't know what day). I loaded  cat-in-a-box just fine, but I need MORE.
When I try to fire up CPAN, I get an out-of-memory error while CPAN is  downloading one of his database files -- I forget which one, authors or  modules. I am allocated 5 GIGs, and am using nowhere near that. Has  anyone run into this one?
/dennis  
___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/-- 
Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ways to do stuff and why

2006-08-22 Thread Zbigniew Lukasiak
There is one practical argument for having the business logic in the model - it is the necessity of using it from command line/cron job tools. I have not yet heard a similar argument from the other side - that is for having the logic in the controller.
--ZbyszekOn 8/21/06, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:
Mark Blythe [EMAIL PROTECTED]
08/21/2006 :
  Matt Trout Wrote:
  I think the main bone of contention
here is that Len is referring to his
  persistence layer as the model,
whereas I consider it to just be a persistence
  layer - stuff like Model::DBIC::Schema
is really only there for simple apps
  where what you're modeling
*is* the database. If you're modeling a domain,
  then your Model::* stuff should
be the model of the domain, and whether or not
  said model happens to use
DBIC stuff as its persistence store should be merely
  an implementation detail that
the Controller never sees.
 
 If the controller truly never sees
DBIC stuff, does that mean that
 your model logic never returns
DBIC objects? For instance, let's say
 you have a logic method called
findBestFit() that's supposed to return
 shoes that fit a given person and
activity the best. Would it return
 a DBIC ResultSet made up of Shoe
row objects, or would findBestFit()
 deal with those objects only internally
and construct something
 non-DBIC for the return?


In my reality, I want findBestFit()
to return a set of Shoes. The Shoe can be a 
DBIC mydb::Shoe row object, from
which I'm likely to call vanilla accessors,
or they will be MyDomain::Shoe objects,
each one decorating a mydb::Shoe object,
and containing more shoe logic.

findBestFit() should return objects
that conform to your abstract notion of a shoe.
Then you're insulated from your data
source.

Your business logic should deal with
Shoes. If using a DBIC Shoe row works for you, 
that's totally cool. But your business
logic should contain one thin layer to insulate 
findBestFit() from the gory details
of your data store. 

Again, I'll make the comparison to DBI/DBD
which emulated ODBC in that you program 
to a general API, and the vendor specific
stuff is under the hood. So now, your ORM
returns objects instead of hashrefs.
But the specific method of setting up a query
differs from ORM to ORM. So you
either choose to code to your ORM's API, or write 
a ORM independent access layer.

In my MVC world, the Model is only the
raw data, the Controller is the business logic, 
and the view is the display. The model
simply gets the data from wherever it is stored,
and puts it back when it's done. The
view shows the data in the model, to the
logs, to the HTML page, etc. The
controller applies the business logic to the model.
Sometimes the controller changes the
view, other times it does its job silently.
The controller wants to deal in abstractions:
Shoes, Stockroom, ShoppingCart, Discount.
It wants to execute Stockroom.findBestFit(myBigFeet.measurments())
and get back a set
of Shoes to manipulate.

In Catalyst, the model tends to map
one-to-one to my idea of a model. It interacts with
my data store. The view maps well
also. Here's my stash, work your magic. Now the trick
with the catalyst controller, is not
to put vast amounts of business logic in them. Use 
them for handling web parameters, but
then allocate business objects and manipulate them.
It's better to instantiate a big wrapper
object, ShoeStore and execute 
ShoeStore.gotAnyAirJordansInMySize(MyFeet),
returning Shoes, which then get plugged into
stash for the view to use, than to write
the whole search in the catalyst action. Better,
because then you can call you business
objects from any perl program regardless of the
user interface.


Len.
My fingers hurt.



This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law.  If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED.  Although this transmission and
any attachments are believed to be free of any virus or other
defect that might affect any computer system into which it is
received and opened, it is the responsibility of the recipient to
ensure that it is virus free and no responsibility is accepted by
JPMorgan Chase  Co., its subsidiaries and affiliates, as
applicable, for any loss or damage arising in any way from its use.
If you received this transmission in error, please immediately
contact the sender and destroy the material in its entirety,
whether in electronic or hard copy format. Thank you.


___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/-- 
Zbigniew Lukasiakhttp://brudnopis.blogspot.com/

Re: [Catalyst] ways to do stuff and why

2006-08-22 Thread Zbigniew Lukasiak
If I reformulate my statement as follow:There is one practical argument not to have the business logic in the controller - it is ...Can we agree?The result I would like to get from this conversation is that I don't see some point of time controllers with business logic in them at CPAN.
--ZbyszekOn 8/22/06, Kaare Rasmussen [EMAIL PROTECTED] wrote:
 There is one practical argument for having the business logic in the model - it is the necessity of using it from command line/cron job tools.I haveBut it's easily overcome if you put your logic in separate modules. I don't
think that practical problems like this should dictate your designphilosophy.More than that, it seems to me that it's a major shortcoming of the MVC modelthat there's no real good place to put the real beef, the logic. i'd like to
keep the model as a persistence layer. The logic I'd put there should only beconcerned with keeping data consistent.The controller should only be interested in moving things around and theviewer is completely out of the question :-)
So in my view, business logic, rules, computations (other than simple datatwisting) and other stuff that has to be flexible doesn't really fit in. Ofcourse you can have it in the model, but then the model really has two
layers, a persistence and a processing layer.Each developer has to solve that independently at least until Catalyst willshine as the first MLVC (Model-Logic-View-Controller) system ;-)--Med venlig hilsen
Kaare Rasmussen, JasonicJasonic Telefon: +45 3816 2582Nordre Fasanvej 122000 FrederiksbergEmail: [EMAIL PROTECTED]___
List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Why scaffolding? Validation and Learning

2006-08-20 Thread Zbigniew Lukasiak
Hi Peter,I've reread the email you linked to. You write there about your own inventions on the subject of visual building of application. This is very interesting to me. Very ambitious also. If you need some help from the InstantCRUD side (common data structure, API whatever) - then email me.
Nice to hear about people building something around Instant.--ZbyszekOn 8/17/06, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
Dear Zby,First off thank you for writing InstandCRUD, it made it much easier for meto understand the Catalyst way of doing things.I posted some comments about frameworks here:
http://lists.rawmode.org/pipermail/catalyst-dev/2006-July/000194.htmlThe problem with generated frameworks is shown in Visual C++ where yougenerate a screen then are stuck with manual changes after because if you
go back to the meta-model and regenerate you lose code. So in that respectI agree with what Matt is saying.However, the problem facing most IT managers is that they have a majorityof average programmers who cannot handle more abstract design but can
handle point and click interface building based on a data source.This competes somewhat with Catalyst's ideals to be lean, mean and nottied to a particular One True Way. The way I see it is that you need the
core Catalyst, which is a pretty cool set of code, and a sample OTWapproach to get people started but which they can go beyond.We're using Catalyst in a project I'm managing and I hope very much thatone of the outcomes from that will be to make it easier for other people
to use Catalyst. That is because I have tried (and failed) to pitchCatalyst to IT customers because it's too complicated as it is now fortheir staff.Best wishes,Peter Edwards
http://www.dragonstaff.com - Business IT Consultancy___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: 
http://dev.catalyst.perl.org/-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Why scaffolding? Validation and Learning

2006-08-19 Thread Zbigniew Lukasiak
The subclassing of templates sounds really interesting, but actually I don't have many strong convitions on this front - I think we need some more experimentation. Or perhaps I have one idea about the templates. I found it really simpler to code some more complicated parts as perl functions, put them on the stash and then use them as kind of macros in the templates, than coding it in the templating language.
--ZbyszekOn 8/18/06, Matt S Trout [EMAIL PROTECTED] wrote:
Zbigniew Lukasiak wrote: Some more technical details. The main idea of how the scaffolding should work is that we generate only a skeleton of directories, nearly empty controllers and some config
 stuff.The generated controllersonly contain their package declaration and a 'use base Catalyst::Example::Controller::InstantCRUD' line. So there is not that much of generated code here.After the
 controllers are generated users are expected to copy the methods that they want to modify from the Catalyst::Example::Controller::InstantCRUD superclass - doing that they are taking responsibility for the copied
 code.This way the main Instant controller, which is just a standard library and can be updated with standard means, is also an integral part of the example.The copying perhaps is not such a trivial step - but in
 fact should be pretty natural for people working with Object Oriented code - it's just overwriting of SUPER class methods. I am also planning to make it more intuitive by the way of documentation.
 This is the theory - in practice the config stuff required to have a working application is a bit big, but we are working on it. A separate thing are the templates for the views, in the current CPAN
 version they are treated in a similar way that the controllers - the users are expected to just copy the generic templates from the InstantCRUD directory and modify them to their liking.There were
 people on this list complaining about this and in the svn version now we create the basic templates in the generated application.This means problems with the templates when upgrading the library, but perhaps we
 need to treat the templates separately from the code and expect them to be really quickly rewritten by the programmers.We have an approach that allows standard templates to effectively besubclassed; once it goes to public announce I'd love to have your opinion on
them since templates are the hardest issue for scaffolding and it's clearyou've done a fair bit of thinking about it.None of what I'm saying denigrates InstantCRUD - it's a very well-implementedScaffold and I recommend it to people regularly. I just think it's possible to
achieve the same things a better way.--Matt S Trout Offering custom development, consultancy and support Technical Directorcontracts for Catalyst, DBIx::Class and BAST. ContactShadowcat Systems Ltd.mst (at) 
shadowcatsystems.co.uk for more information+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/
 +___List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ways to do stuff and why

2006-08-19 Thread Zbigniew Lukasiak
I am glad to see that the 'business logic in the model' side seem now to prevail in the Catalyst world. It was not so in the past - as this thread documents: 
http://lists.rawmode.org/pipermail/catalyst/2005-August/thread.html#1148 There is also a wiki page on this subjecthttp://dev.catalyst.perl.org/wiki/NecessaryBackgroundKnowledge
--ZbyszekOn 8/18/06, Brian Kirkbride [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
 Brian Kirkbride [EMAIL PROTECTED] @ 08/18/2006 01:57 PM: At this point, if I want code reuse I have two reasonable choices:
 A) Create business logic modules, ie. MyApp::Logic::CreateTrial, etc B) Write my own business logic methods in MyApp::Schema::Trial-create(...) Either is valid and from what I gather Java developers like the Logic
 route.I chose (B) because I already have the classes and the logic is *usually* just operating on that class's data model. [Insert snarky Java comment here]
 B couples my business logic too tightly with the ORM. ORMs fall out of fancy. The whole point of MVC is loose coupling. Method A does not have that tight coupling. This is a bit of good advice I've picked up along the way:
Loose coupling of objects.Code to the abstract class (API) not the implementation. Sometimes it helps to forget about ORM's for a minute.The hash or array of data returned
 by DBI is still your Model.It you want objects, you have to roll your own, around the DBI data. Roll your own around the DBIC data, use object composition, rather than inheritance.The coupling
 is looser, and that makes your code less brittle.I'm leaning toward this as well, you might have convinced me with thecomposition argument.I had been thinking of it in terms of inheriting from the
model.I've moved from a home-grown ORM to Class::DBI to DBIx::Class in this project'shistory.The business logic methods in the model classes had to change eachmigration.Not a big deal, because it usually changing -find to -retrieve or
something that simple.But not having to ever change a controller, script or CRON job by way of a setof Logic:: proxy classes would be nice.Generally these bits don't have to knowmuch of anything about the model implementation so it hasn't been much to
change.But when iterating over result sets it's hard to avoid the modelimplementation specifics.Maybe I'll spend the weekend whipping up some proxy classes to sit between mymodel and the rest.I that the business logic methods in the model would be
moved into these classes as well.Thanks!- Brian___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: 
http://dev.catalyst.perl.org/-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Why scaffolding? Validation and Learning

2006-08-18 Thread Zbigniew Lukasiak
Some more technical details.The main idea of how the scaffolding should work is that we generate only a skeleton of directories, nearly empty controllers and some config stuff. The generated controllers only contain their package declaration and a 'use base Catalyst::Example::Controller::InstantCRUD' line. So there is not that much of generated code here. After the controllers are generated users are expected to copy the methods that they want to modify from the Catalyst::Example::Controller::InstantCRUD superclass - doing that they are taking responsibility for the copied code. This way the main Instant controller, which is just a standard library and can be updated with standard means, is also an integral part of the example. The copying perhaps is not such a trivial step - but in fact should be pretty natural for people working with Object Oriented code - it's just overwriting of SUPER class methods. I am also planning to make it more intuitive by the way of documentation.
This is the theory - in practice the config stuff required to have a working application is a bit big, but we are working on it. A separate thing are the templates for the views, in the current CPAN version they are treated in a similar way that the controllers - the users are expected to just copy the generic templates from the InstantCRUD directory and modify them to their liking. There were people on this list complaining about this and in the svn version now we create the basic templates in the generated application. This means problems with the templates when upgrading the library, but perhaps we need to treat the templates separately from the code and expect them to be really quickly rewritten by the programmers.
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Why scaffolding? Validation and Learning

2006-08-17 Thread Zbigniew Lukasiak
Dear all,First I hope Matt shall excuse me for restarting the discussion here - but I'd like to reach more Catalyst users then the limited number of IRC dwellers.I would like you to imagine you in the position of a developer that has some idea for a web project, thinking about trying a new web programming framework. There are many to choose from, or he can also go the simple way and use 
CGI.pm or develop something for his own - how would you decide? Every framework is lots of code, lots of documentation so it's not an easy task. After reading those mountains of manuals you can discover that some limitations make the framework not really fitting to your project (some related thoughts in 
http://www.artima.com/weblogs/viewpost.jsp?thread=8826). This is that risk that scaffolding mitigates - you generate your application with minimal effort and you have a working example tailored to your database schema. You don't need to think if a example from the manual can be adopted to your data structures - you have it adopted automatically. This is the first advantage of scaffolding - easy evaluation.
The other important advantage is that it helps in the learning process. You get a non trivial working example. And again this example is based on your database schema - from the starting point you at once know much about the program. You don't need to internalize some the business rules of some unfamiliar application - the business rules are yours - so at once you can start and play with it. And a good scaffolding will give you much space for simple but meaningful modifications to tweak and play with.
Of course there are also disadvantages to code generation. It is impossible to come with a good schema to update the generated code when you release a new version of the generator and we don't want the programmers who use the scaffolding to be stuck forever to the version that they used the first time. One solution can be to limit the code generator to really most trivial part and move all other logic into traditional libraries that just happen to cooperate with the generated code - and this is what I try to do with InstantCRUD.
-- Zbigniew Lukasiak

http://brudnopis.blogspot.com/



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


Re: [Catalyst] User Generated Content (project collaboration)

2006-08-15 Thread Zbigniew Lukasiak
Hi Matt,I would be gratefull if you expressed your concerns about InstantCRUD - so that I could address them in the new versions of it and at least avoid the most grievest blunders.-- Zbyszek
On 8/14/06, Matt S Trout [EMAIL PROTECTED] wrote:
Kaare Rasmussen wrote: We have a sane set of widget classes which integrate effectiely with normal Catalyst usage already on the build, combined with a way of handling controller layout that makes *-in-a-box bolt-ons much easier; expect a
 public release in a week or three. What impact, if any, will it have on the CRUD generators like InstantCRUD?I hate the entire concept, so ... don't know, don't care.It has auto-CRUD but that's done via metamodel reflection, like such things
*should* be done IMO :)___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: 
http://dev.catalyst.perl.org/-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] User Generated Content (project collaboration)

2006-08-14 Thread Zbigniew Lukasiak
Hi,Our new, still unreleased, version of InstantCRUD shall have authentication included. I am thinking about it as a kind of framework going in the direction that you are talking about. I admit it moves with a bit slow pace and is still a bit experimental, but I hope you can find it useful.
--ZbyszekOn 8/14/06, Jason Crummack [EMAIL PROTECTED] wrote:
Thomas Hartman wrote:I'm just in the prototyping stage of writing something very similar andwould be more than willing to contribute.Jason something like this would be really helpful to me.
 2006/8/14, John Napiorkowski [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: BTW, to respond directly to your thoughts on creating a
 registration system, I have a good start on this as well, with a system that sends an email for verification and all, however it's quite messy and am thinking of fixing it up.
 One other peice that is often needed is management of your friends circle.So you need invite a friend to join functionality as well as a way to see if your friends are online and quick links to
 their personal in system homepage.--john - Original Message  From: John Napiorkowski [EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] To: The elegant MVC web framework catalyst@lists.rawmode.org mailto:
catalyst@lists.rawmode.org Sent: Monday, August 14, 2006 10:28:42 AM Subject: Re: [Catalyst] User Generated Content (project collaboration) I'm working on something right now for a client with this.He is
 okay with me returning code to the community that is not part of his core business, so stuff like wiki's, forums, moderation (voting and karma), tagging, lightweight CMS, etc he is cool
 with.However I've already been working on this for a bit and may not be taking the direction you might vision. What I am doing is building a portal type framework and a group of
 custom controllers for each of the basic content types.I've already done a lot of html/css _javascript_ for this and am using the dojo library. Let me know what you think.You are in canada, right?I'm in
 Beijing now but will be in the USA NYC time zone next week.If We have a few interested participants maybe we can setup a brainstorming session on IRC or something like that.
 --john - Original Message  From: Roman [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] To: 
catalyst@lists.rawmode.org mailto:catalyst@lists.rawmode.org Sent: Monday, August 14, 2006 1:01:25 AM
 Subject: [Catalyst] User Generated Content (project collaboration) I have an idea for a great Catalyst based project that can really show the power of Catalyst and spawn some extra projects from this and
 give Catalyst some coverage. The idea is to build a framework for User Generated Content type of websites. All of those website usually have many features in common.
 Usually the only difference is the type of content users generate (pictures, texts, links, etc...). The flow usually goes somewhat like this:1. Register
2. Login3. Participate in content generation4. Modify profile5. User interaction6. Content votes, comments But there are also a few background tasks such as:
 * Content administration * Moderation * User management * Website administration The framework would have most of the features ready to go
 out-of-the-box, and abstract the content part that can be expanded and adopted to specific projects. Anyone interested? ___
 List: Catalyst@lists.rawmode.org mailto:Catalyst@lists.rawmode.org Listinfo: 
http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
 Dev site: http://dev.catalyst.perl.org/ ___ List: 
Catalyst@lists.rawmode.org mailto:Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
 Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: 
http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.rawmode.org mailto:
Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst 
http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/ http://dev.catalyst.perl.org/
  ___ List: 
Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/___
List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___

Re: [Catalyst] InstantCRUD issues

2006-07-02 Thread Zbigniew Lukasiak
Hi Kaare,

You should not call the HTML::Widget generator faulty - it generates
HTML code compliant with the specification. It is rather unfriendly for
people who need to read the generated code and the CSS designers, but
thats another thing (and I am not a CSS expert so I cannot say that for
sure). 

I am thinking about switching from HTML::Widget to something else for
InstantCRUD because of that - generating the widgets with TT or
something should be easier than adding yet another XSLT layer, but for
now I have no time for that.
Jonas Alves is working on a new version of InstantCRUD with much better
support for between tables relations (including the 1:many case that
now is not supported at all).

--
Zbyszek
On 7/2/06, Kaare Rasmussen [EMAIL PROTECTED] wrote:
 It's not impossible to style, but it is a problem.People have suggested XSLT to convert the generated html into something sane.Why not fix the source of the problem, the faulty generator? You need to tell the model classes how to stringify, eg:
Thanks, it works great :-)--Med venlig hilsenKaare Rasmussen, JasonicJasonic Telefon: +45 3816 2582Nordre Fasanvej 122000 FrederiksbergEmail: 
[EMAIL PROTECTED]___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: 
http://dev.catalyst.perl.org/-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Program the logic

2006-06-29 Thread Zbigniew Lukasiak
I dont' agree with the statement that all the application logic should go into the Controller. In my opinion in the Controller you should have only the code that is directly web related - all the rest should go into the Model. This way you can call your business logic from a cron script without the overhead of all the web stuff.
--ZbyszekOn 6/28/06, Nilson Santos Figueiredo Junior [EMAIL PROTECTED] wrote:
On 6/28/06, Eduardo Oliveros [EMAIL PROTECTED] wrote: I'm planning to program the logic of the application (the Model in MVC) previously to start with web page and the presentation.
Actually, the Controller is what is supposed to drive the logic of theapplication. The model is really just that: the model. It's usuallymapped to some kind of storage engine such as a RDBMS. Many strong
advocates of MVC specifically try to leave business logic out of thedatabase. What I see is that what Catalyst calls Model is just the Objects that map with the tables in the DDBB. And the logic of the application are
 developed in the Actions (in fact linked to the web application).You'll see that it's a little more than that (at least when you'reusing DBIx::Class - Class::DBI can't even be compared feature-wise
nowadays). I know is difficult in practice to separate both worlds (logic from the presentation) but that is the false promise of the MVC pattern :).Not really. It's something somewhat straight-forward when using
something like Catalyst. All you've got to do is resist the temptationof polluting your controllers with things that really should be inyour views. But sometimes it's even worth it.-Nilson Santos F. Jr.
___List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/
-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Program the logic

2006-06-29 Thread Zbigniew Lukasiak
Hi,

Regarding the generic controller stuff you might look at the
Catalyst::Example::Controller::InstantCRUD - you can use it as a base
class for your controllers to get the basic CRUD + paging and sort
stuff for free. It's still rather experimental though.

--
ZbyszekOn 6/29/06, Brandon Black [EMAIL PROTECTED] wrote:
On 6/29/06, Nilson Santos Figueiredo Junior [EMAIL PROTECTED] wrote: On 6/29/06, Brandon Black [EMAIL PROTECTED] wrote:
  If you find yourself putting code in your View templates that isn't  directly related to rendering this specific flavour of output, it  probably needs to be moved to the Controller.Good code in views:
  iterating an arrayref to generate a ul list, walking a data  structure to generate a table, or walking a data structure to  generate a graph image. I've found myself building somewhat fat views lately. Mostly, I've
 done it when trying to build generic widget thingies that might appear in different pages. By fat I mean resultset-manipulating views, but usually the manipulations are restricted only to the
 view-related aspect of them, though. This means stuff like ordering the resultset by some column (using order_by). I'm usually in doubt if this is indeed a good practice or if it should be done another way,
 but it sure makes things easier.I think its fine to have the controller generate a resultset, and havethe view directly apply ordering and/or paging to the resultset beforegenerating HTML from it.But then again, I also find that approach a
bit difficult and limiting.The approach I'm attempting lately (and I haven't gotten it allworking right yet...) is to make Controller base-classes thatimplement generic concepts for things like paging and sorting tables
of data (complete with handling form args like ?page=3count=50 or?sortby=foo:desc silently for the controller), which makes iteffortless for the controller to apply those sorts of things to theresultset before its sent to the view.These bits of controller
functionality are of course View-agnostic.They (the base controllers implementing these features) basically boildown to: Check for some standardized GET form parameters, provide somedata to the controller in the form of a paging object or some DBIC
sorting hashref stuff, and also directly set stash variables for theviews to see, regarding paging and sorting.There are templateincludes that go along with these meta controller actions (displayingthe   1 2 3   paging clickies and whatnot, based on those stash
vars...).Ultimately if I can ever get these concepts sufficiently genericizedand bulletproof (or if anyone else does before me), it'd be a goodidea to throw some out on CPAN as Catalyst::Controller::PageSort or
something of the sort.-- Brandon___List: Catalyst@lists.rawmode.orgListinfo: 
http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: 
http://dev.catalyst.perl.org/-- Zbigniew Lukasiakhttp://brudnopis.blogspot.com/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/