[Catalyst] Two ways to create record

2008-01-13 Thread Alex Povolotsky

Hello!

In Tutorial (BTW, "CRUD" section of tutorial lacks U completely), I've 
seen  this way of filling in the record:


   my $book = $c->model('GalleryDB::Gallery')->new({});
   $book->populate_from_widget($result);

In InstantCRUD data is filled in with

my $item = $result->save_to_db();

Can anyone experienced tell me about drawbacks of both ways to do create?

Alex.
 


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


Re: [Catalyst] Re-enable digest mode?

2008-01-13 Thread Matt S Trout
On Fri, Jan 11, 2008 at 03:43:25PM -0500, Lampert, Hugh wrote:
> Well, I respectfully submit that the purpose of a digest is so people can 
> archive the mailing list themselves in their e-mail systems, one digest per 
> day.  An RSS feed does not easily allow this, and for a busy list like this 
> one, a subscriber might receive many messages per day, the number of which 
> could rapidly increase into the thousands in the inbox.  Filtering these many 
> messages into a folder, as you suggest, will more than likely mean that for 
> me they will never get looked at at all, as I receive many, many emails that 
> require my attention every day.
> 
> I use Outlook for my corporate mail system and I know your opinion of the way 
> it works Matt.  I like to keep up with Catalyst as much as possible but not 
> enough to have to monitor an RSS feed or thousands of individual e-mails in 
> my business mailbox. I have an alternate suggestion.  Re-enable digests for 
> those who subscribe to the traditional function of a "mailing list" and don't 
> want to be flooded by individual e-mails, and revoke and block the 
> subscriptions of those who subscribe but don't know how to respond properly 
> and spam the list by responding improperly to the digest.

I'd note that you mailed the list instead of the list admin address
which was the wrong place to do so, and just replied top-posting with the
entire message quoted below to no aim, which is exactly the problem that we
have with digests.

Should I disable your subscription too?

> I have already unsubscribed from the Catalyst list for my personal mail box, 
> which collects on a somewhat limited portable micro drive.  If I can't get a 
> digest I guess I will have to unsubscribe from the list from my corporate 
> mail box as well, as I don't want to awkwardly manage thousands of individual 
> e-mails.  While I can make some time to scan the subjects of the digest when 
> it comes into my mailbox during my work day, I'm afraid I will not have time 
> to monitor yet another RSS feed, so it will be so long Catalyst info.  Too 
> bad for me, I guess.

You can put together an outlook mail rule trivially to move the mails into
a subfolder, and skim the subjects in there. I used to do that for lists back
when I was at a job that mandated outlook. Plus that way you can actually use
threading, which makes the skimming even quicker :)

If you really want digests back on, find me a way to detect replies to digests
and reject them at the border; we're using exim and standard mailman
integration so if you're sufficiently motivated to have a go it should be
easy enough to get an equivalent setup to test.

> Interestingly, I will continue to subscribe to the DBIx-Class list, as the 
> digest for that has NOT been turned off as of yet.  Are the subscribers to 
> that list just more intelligent?

My experience is that a lot of people seem to ignore the available evidence
and assume that Catalyst is an all-in-one project with DBIC and TT - the number
of DBIC or TT related questions on here rather than the relevant lists would
certainly fit with this.

In any case, digest replies haven't become a problem there and I have no
desire to disable them unless they do.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

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


Re: [Catalyst] Two ways to create record

2008-01-13 Thread Matt S Trout
On Sun, Jan 13, 2008 at 04:47:38PM +0300, Alex Povolotsky wrote:
> Hello!
> 
> In Tutorial (BTW, "CRUD" section of tutorial lacks U completely), I've 
> seen  this way of filling in the record:
> 
>my $book = $c->model('GalleryDB::Gallery')->new({});
>$book->populate_from_widget($result);

which sets a bunch of data and then calls $book->insert_or_update;

> In InstantCRUD data is filled in with
> 
> my $item = $result->save_to_db();

I have no idea how this works.

> Can anyone experienced tell me about drawbacks of both ways to do create?

Neither of these are standard DBIx::Class methods; the standard approach
is to do

my $obj = $rs->new(\%data);

column_name($value) to set more data>

$obj->insert;

DBIx::Class::ResultSet provides a $rs->create(\%data) shortcut that calls
$obj->insert for you before returning it, but that really is just a
shortcut - the end effect is identical.

For more info, have a look at the DBIx::Class documentation on CPAN and
note that DBIC-specific questions can be asked on the dedicated dbix-class
list.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

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


Re: [Catalyst] Two ways to create record

2008-01-13 Thread Alex Povolotsky

Matt S Trout wrote:

On Sun, Jan 13, 2008 at 04:47:38PM +0300, Alex Povolotsky wrote:
  

Hello!

In Tutorial (BTW, "CRUD" section of tutorial lacks U completely), I've 
seen  this way of filling in the record:


   my $book = $c->model('GalleryDB::Gallery')->new({});
   $book->populate_from_widget($result);



which sets a bunch of data and then calls $book->insert_or_update;

  

In InstantCRUD data is filled in with

my $item = $result->save_to_db();



I have no idea how this works.
  

It seems to obtain $result with

my $result = $w->action( $c->uri_for('do_add') )->process( $c->request );

And $result is a HTML::Widget::Result::DBIC instance, so save_to_db is

"HTML::Widget::DBIC::Result method to save the data from widget to
the database"


Neither of these are standard DBIx::Class methods; the standard approach
is to do

my $obj = $rs->new(\%data);

column_name($value) to set more data>

$obj->insert;

DBIx::Class::ResultSet provides a $rs->create(\%data) shortcut that calls
$obj->insert for you before returning it, but that really is just a
shortcut - the end effect is identical.

For more info, have a look at the DBIx::Class documentation on CPAN and
note that DBIC-specific questions can be asked on the dedicated dbix-class
list.

  

Thanks a lot. I'll go read it. There is such a lot of useful Perl modues...

Alex.


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


[Catalyst] component's new() call browser dependent

2008-01-13 Thread Juan Camacho
I found something quite strange. When I use Firefox the model's new
method is called for each request, but if I use IE it doesn't.  This
is under mod_perl. Is this behavior by design?  Have I missed some
documentation on this?

Thanks, Juan

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


Re: [Catalyst] component's new() call browser dependent

2008-01-13 Thread Jonathan Rockway

On Sun, 2008-01-13 at 19:11 -0500, Juan Camacho wrote:
> I found something quite strange. When I use Firefox the model's new
> method is called for each request, but if I use IE it doesn't.  This
> is under mod_perl. Is this behavior by design?  Have I missed some
> documentation on this?

Can you provide a test case (just some code I can run to try to
reproduce this)?  It would be best if this works against the dev server
instead of mod_perl.

Regards,
Jonathan Rockway



signature.asc
Description: This is a digitally signed message part
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] component's new() call browser dependent

2008-01-13 Thread Juan Camacho
On Jan 13, 2008 7:17 PM, Jonathan Rockway <[EMAIL PROTECTED]> wrote:
>
>
> On Sun, 2008-01-13 at 19:11 -0500, Juan Camacho wrote:
> > I found something quite strange. When I use Firefox the model's new
> > method is called for each request, but if I use IE it doesn't.  This
> > is under mod_perl. Is this behavior by design?  Have I missed some
> > documentation on this?
>
> Can you provide a test case (just some code I can run to try to
> reproduce this)?  It would be best if this works against the dev server
> instead of mod_perl.
>

I've been simply printing to STDERR in my model new method, e.g.

use strict;
use warnings;
use base qw|Catalyst::Component::ACCEPT_CONTEXT Catalyst::Model
Class::Accessor::Fast|;
use NEXT;

package MyApp::Model::Foo;

sub new {
my $self = shift->NEXT::new(@_);
print STDERR __PACKAGE__ . "::new called";
return $self;
}

sub something_else { print STDERR "something_else called\n" }

Do you still need some code? Should new be called for every request or
is there some intentional session caching going on?

Juan

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


Re: [Catalyst] process a restored request

2008-01-13 Thread Matt S Trout
On Fri, Jan 11, 2008 at 07:06:17PM +, Jonas Alves wrote:
> On Jan 11, 2008 6:27 PM, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > Don't try and serialize $c->req, just dump any POST data back out into
> > hidden fields in the login form, don't change the URL, and have the login
> > form processed in a forward() from auto or similar rather than doing a
> > detach. This is how I handle "user needs to log in to continue" across the
> > board and it makes life much simpler.
> >
> > i.e. something like
> >
> > sub auto :Private {
> >   my ($self, $c) = @_;
> >   unless ($c->user_exists) {
> > unless ($c->forward('try_login')) {
> >   $c->detach('show_login_form');
> >   return 0;
> > }
> >   }
> >   return 1;
> > }
> >
> > sub try_login :Private {
> >   my ($self, $c) = @_;
> >   my $b = $c->req->body_parameters;
> >   return 0 unless $b->{__username};
> >   return $c->authenticate({
> >username => $b->{__username}
> >password => $b->{__password}
> >  });
> > }
> >
> 
> And how do you handle file uploads? Do you save them in the session?

Just keep the file in a temp dir on disk that gets cleaned out regularly
and drop an identifier into the form. Most session stores are not a good
place to store arbitrary sized files.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

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


Re: [Catalyst] Serving html pages

2008-01-13 Thread Matt S Trout
On Sat, Jan 12, 2008 at 11:18:21AM +0800, Martin Ellison wrote:
> I have a similar problem, but I am on shared hosting and I do not have
> access to httpd.conf, only to the local .htaccess files. I have the static
> plugin set up so we are delivering HTML, image files and other static pages
> via Catalyst, but similarly to Alejandro I would like to serve up the pages
> directly from Apache.
> 
> I have tried using mod_rewrite but it seems to be an invention of the
> Adversary designed to lead us into despair. Has anyone managed to serve
> static files directly using just .htaccess?

Get your own copy of apache and whack the rewrite debug level to 9; then you
can figure it all out locally.

mod_rewrite is baroque but it's not that hard to work out once you've got
the debug info.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

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


Re: [Catalyst] component's new() call browser dependent

2008-01-13 Thread Jonathan Rockway

On Sun, 2008-01-13 at 19:41 -0500, Juan Camacho wrote:
> Do you still need some code? Should new be called for every request or
> is there some intentional session caching going on?

new is usually called at COMPONENT time, not ACCEPT_CONTEXT time.  I'd
like to see how you're using this code, though.  What does the $c->model
call look like?  Are you sure the exact same code is being run with IE
vs. Firefox?  I don't see how the user agent would make any difference
as to whether new would run.

I asked for a minimal test case because your problem may be something
unrelated.  Making a small test case isolates the real bug.  Mostly, I'd
like to see the code working outside of mod_perl, since the mod_perl
environment could be causing problems. 

Regards,
Jonathan Rockway



signature.asc
Description: This is a digitally signed message part
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Gentoo Catalyst overlay: repository moved!

2008-01-13 Thread Toby Corkindale
On Wed, Jan 09, 2008 at 06:06:05PM +0100, Michele Beltrame wrote:
> Hello!
> 
> The Catalyst-related ebuilds (along with some others) are now part of the
> perl-exprimental Gentoo overlay.
> 
> Old repository and overlay will not be maintained any more.

Hi Michele,
Are you still maintaining the relevant bits of the overlay?
I attach a couple of ebuilds for the overlay for your (or anyone else's)
consideration.

Cheers,
Toby
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit perl-module

S=${WORKDIR}/WWW-Facebook-API-v0.4.10

DESCRIPTION="Perl interface to Facebook Platform API"
HOMEPAGE="http://search.cpan.org/search?query=WWW-Facebook-API&mode=dist";
SRC_URI="mirror://cpan/authors/id/U/UN/UNOBE/WWW-Facebook-API-v0.4.10.tar.gz"


IUSE=""

SLOT="0"
LICENSE="|| ( Artistic GPL-2 )"
KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc 
sparc-fbsd x86 x86-fbsd"

DEPEND="dev-perl/libwww-perl
dev-perl/Crypt-SSLeay
dev-perl/JSON-Any
dev-lang/perl"
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit perl-module

S=${WORKDIR}/Catalyst-Plugin-Facebook-0.1

DESCRIPTION="Catalyst plugin for Facebook Platform API integration"
HOMEPAGE="http://search.cpan.org/search?query=Catalyst-Plugin-Facebook&mode=dist";
SRC_URI="mirror://cpan/authors/id/S/SO/SOCK/Catalyst-Plugin-Facebook-0.1.tar.gz"


IUSE=""

SLOT="0"
LICENSE="|| ( Artistic GPL-2 )"
KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc 
sparc-fbsd x86 x86-fbsd"

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


[Catalyst] [ANNOUNCE] New plugin: Catalyst::Plugin::Assets

2008-01-13 Thread Robert Krimen
Catalyst::Plugin::Assets
http://search.cpan.org/~rkrimen/Catalyst-Plugin-Assets-0.012/

Managing .css and .js inclusions has been a recurring problem of mine;
I usually hack something together with Template Toolkit and call it
day. Copying and pasting was becoming
bothersome, though, so I decided to write up a utility to help.

C::P::Assets also makes switching between "minified" and development
versions of .css and .js files really quick and easy (with support for
YUI compressor, JavaScript::Minifier, CSS::Minifier)

---
Rob
[EMAIL PROTECTED]

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