Re: [Catalyst] Web hosting?

2007-12-17 Thread Shane McEwan
G'day!

Jumpline are offering 12 months free VDS hosting at the moment using
this coupon: https://ssl.jumpline.com/order/?c=3UFWOTHC

I'm just about to have a go setting up my first hosted Catalyst app on
there to see if it works. I figure if I can't get it going in their
environment at least I'm not out of pocket.

On Sun, 2007-12-16 at 12:07 +0800, Martin Ellison wrote:
> Can anyone recommend a web hosting provider for Catalyst applications?
> 
> Or for that matter, warn us off any providers that you have had bad
> experiences with?

--
Shane McEwan
Don't anthropomorphise computers, they don't like it!



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


[Catalyst] Another newbie question -- make install and my script directory

2007-12-17 Thread Martin Ellison
Sorry, another newbie question. I have checked all the documentation I can,
but I cannot find anything...

When I do cd path/to/myapp ; perl Makefile.pl; make ; sudo make install it
puts my application in various places, but it does not appear to put my
script directory anywhere. I thought it would put in /var/www/cgi-bin but it
is not there. Can anyone help?

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.org
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Another newbie question -- make install and my script directory

2007-12-17 Thread Bogdan Lucaciu
On Monday 17 December 2007 11:51:20 Martin Ellison wrote:
> Sorry, another newbie question. I have checked all the documentation I can,
> but I cannot find anything...
>
> When I do cd path/to/myapp ; perl Makefile.pl; make ; sudo make install it
> puts my application in various places, but it does not appear to put my
> script directory anywhere. I thought it would put in /var/www/cgi-bin but
> it is not there. Can anyone help?

those go in /usr/local/bin 

-- 
Bogdan Lucaciu
http://www.wiz.ro

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


Re: [Catalyst] Web hosting?

2007-12-17 Thread Michele Beltrame
Hi!

> Can anyone recommend a web hosting provider for Catalyst applications?

There's this small guide available:

http://dev.catalystframework.org/wiki/Hosting

Contributions are very welcome. ;-)

Michele.

-- 
Michele Beltrame
http://www.cattlegrid.info/
ICQ 76660101 - MSN [EMAIL PROTECTED]
Privacy: http://www.italpro.net/em.html

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


Re: [Catalyst] Another newbie question -- make install and my script directory

2007-12-17 Thread Matthias Zeichmann
On Dec 17, 2007 11:33 AM, Bogdan Lucaciu <[EMAIL PROTECTED]> wrote:
> On Monday 17 December 2007 11:51:20 Martin Ellison wrote:
> > Sorry, another newbie question. I have checked all the documentation I can,
> > but I cannot find anything...
> >
> > When I do cd path/to/myapp ; perl Makefile.pl; make ; sudo make install it
> > puts my application in various places, but it does not appear to put my
> > script directory anywhere. I thought it would put in /var/www/cgi-bin but
> > it is not there. Can anyone help?
>
> those go in /usr/local/bin

or whatever your perl PREFIX is; might be ~/perl as well

cheers matt
-- 
siggen.pl: Segmentation Fault

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


[Catalyst] [OT] UML design and MVC frameworks

2007-12-17 Thread Daniel McBrearty
Hi

As I look at adding more complex functions to my app, it becomes more
necessary to document the design from early on. I've come across UML
stuff academically, professionally I've tended to find it a bit
unwieldy. I thought about it for my Catalyst app, but could never
quite see how to make it work in a practical efficient way. In
practice, I tend to make a lot of scratchy diagrams in a notebook,
finally work out a schema and some MVC abstractions, and then start
coding. A lot happens in my head, which is perhaps why it hurts so
much sometimes ...

http://www.regdeveloper.co.uk/2007/12/14/robustness_analysis_book_extract_3/

I read this article, and thought that his three classes of objects
look a bit like MVC stuff, in a web app

 - his boundary objects might pretty much be template files
 - entity objects are likely to be db tables or other models
 - his controller objects ... either controllers (of course), or subs
that live in the model layer

I know these types of discussions have been done before, but I'm
curious as to how others on this list document the design process,
practically speaking. Also for opinions on the article

Daniel

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


Re: [Catalyst] Another newbie question -- make install and my script directory

2007-12-17 Thread Martin Ellison
ok, thanks, I've managed to get FCGI working now. Copied into
/var/www/cgi-bin, renamed to .fcgi, updated Apache configs.

On 17/12/2007, Matthias Zeichmann <[EMAIL PROTECTED]> wrote:
>
> On Dec 17, 2007 11:33 AM, Bogdan Lucaciu <[EMAIL PROTECTED]> wrote:
> > On Monday 17 December 2007 11:51:20 Martin Ellison wrote:
> > > Sorry, another newbie question. I have checked all the documentation I
> can,
> > > but I cannot find anything...
> > >
> > > When I do cd path/to/myapp ; perl Makefile.pl; make ; sudo make
> install it
> > > puts my application in various places, but it does not appear to put
> my
> > > script directory anywhere. I thought it would put in /var/www/cgi-bin
> but
> > > it is not there. Can anyone help?
> >
> > those go in /usr/local/bin
>
> or whatever your perl PREFIX is; might be ~/perl as well
>
> cheers matt
> --
> siggen.pl: Segmentation Fault
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
>



-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.org
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] sending email with attachment

2007-12-17 Thread Michael Higgins
How are others out there doing this? My application serves a .pdf file
directly, but I'd like to send as an email attachment to the account as
well.

Looking at
Catalyst/View/Email/Template.pm
in the 'TO DO' section, "There needs to be a method to support
attachments"...

So, are there any recommendations for how to proceed? Generally I'd use
MIME::Lite for this outside of Catalyst, but I'd like to stay in the
Plugin:: space, and word is MIME::Lite isn't the best way currently.

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

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


Re: [Catalyst] [OT] ASP.NET MVC

2007-12-17 Thread John Napiorkowski

--- Matt S Trout <[EMAIL PROTECTED]> wrote:

> On Tue, Dec 11, 2007 at 07:59:48AM -0800, John
> Napiorkowski wrote:
> > And with chaining you could create all the chained
> > actions in a single class, or use the Chain(.)
> feature
> > to spread this over a couple of controllers. 
> That's
> > what I usually do, but then you sometimes end up
> with
> > a mess of nearly empty controller classes.
> 
> I find they're usually only nearly empty at the
> beginning of development - by
> the time the app's gone through a couple of
> iterations they aren't anymore
> and you're glad you split things out.
>  
> > Then we also have :Local, which is also considered
> > somewhat deprecated in favor of :Path
> 
> Wrong.
> 
> Although to be honest I don't really use anything
> except :Chained these days :)
> 
> > :Default which
> > is recommended only for things like capturing bad
> URLs
> > and directing to a not found page (or if you are
> > clever, so sort of soundex or spelling correction
> to
> > see if that would match a known url)
> 
> 'default' and 'index' -are- deprecated.
> 
> You want
> 
> sub works_like_default :Path {
> 
> and
> 
> sub works_like_index :Path :Args(0) {
>  
> > Another potential disadvantage of this, besides
> the
> > confusion, is that you end up which a Controller
> > namespace generally having to map to your URI
> > namespace, and if you need to change the URI
> namespace
> > you end up renaming and moving controllers,
> around.
> 
> No. Really. Don't ever do this.
> 
> Chained doesn't pay attention to the controller
> name.
> 
> __PACKAGE__->config(prefix => 'foo')
> 
> changes the path prefix of the controller (for Path,
> Local,
> LocalRegex) without affecting the controller name,
> action
> namespace etc.
> 
> > What do the rest of you think?  What could be
> better
> > or more clear in terms of best practices?  Because
> I
> > think this is a place where a lot of newbies get
> lost,
> > and compared to the 'there's only a single way to
> do
> > it' method of using router classes, we can lose
> out. 
> 
> We could probably do with a 'guide to using
> Chained', and
> I've been pondering a cleaner syntax for it but
> don't really
> have anything I'm happy with yet.
> 
> Note also that as I keep telling people, setting
> action attributes
> via config makes it trivial to do a central routing
> table; just
> nobody seems to like the feature enough to write a
> guide to how to
> do it :)
> 
> > Also if we could work up an example that showed
> the
> > benefit of the Catalyst way that would also help
> us. 
> 
> The base class related examples I've posted a couple
> times demonstrate this.
> 
> If I work up an advent entry on them would you be
> willing to expand them for
> the main manual?

Matt, 

Yeah, the main configuration is definitely the right
place to be maintain centralized routing and to more
cleanly separate the URI namespace.  Just that as you
say, it's not clear to people when they first start
probably because there isn't a lot of people saying
that and the documentation and quick start guides
don't seem to promote that idea.

If you give me a template to start with, either as an
advent article or other I will definitely try to
expand it out, as long as you don't me giving it the
once or twice over.  

--john



> 
> -- 
>   Matt S Trout   Need help with your
> Catalyst or DBIx::Class project?
>Technical Director   
> http://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/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
> 



  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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


Re: [Catalyst] sending email with attachment

2007-12-17 Thread Ash Berlin


On 17 Dec 2007, at 15:25, Michael Higgins wrote:


How are others out there doing this? My application serves a .pdf file
directly, but I'd like to send as an email attachment to the account  
as

well.

Looking at
Catalyst/View/Email/Template.pm
in the 'TO DO' section, "There needs to be a method to support
attachments"...

So, are there any recommendations for how to proceed? Generally I'd  
use

MIME::Lite for this outside of Catalyst, but I'd like to stay in the
Plugin:: space, and word is MIME::Lite isn't the best way currently.

Cheers,


I just use MIME::Lite in my cat app.

And I've never understood the desire to use plugins for everything  
under the sun... but thats just me.


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


Re: [Catalyst] [OT] ASP.NET MVC

2007-12-17 Thread Daniel McBrearty
The chained thing is probably the single most useful thing in cat IMO
(if it's possible to even make such a dumb call ;)

The way I have come to see it (it took a while, reading discussions
here helped me grasp this) is that the way you design your URI space
is very very fundamental to design of a web app. Chained helps you to
remember this and try to get it right at the start. It also makes the
decision about what actions go in what controllers separate from
decisions about URI namespace. (I haven't really figured out if that
is entirely a good thing or not, but it seems helpful.)

The syntax *is* a bit hard to get used to at first - I find that the
important thing is to remember that Args() defines an endpoint (hope I
am remembering that right), other than that take a good look at what
the debug server tells you when it starts up. (Without that info it'd
be a royal PITA)

Centralised routing stuff might be nice to have, but the way Chained
flies now is pretty darn neat, once you get used to it. For me, I
think I might prefer to be able to see the routing info right there in
the action definition - where you need it. There isn't much cause to
use anything other than Chained, as far as I can see (except the odd
private helper method).

BTW I talked about this a bit at the (first) Brussels Perl Mongers
group a month or two back, and I have someone coming round for a beer
later this evening - they have been wanting to port their Mason app to
Catalyst, and I'm gonna see if I can help them get started.

cheers

Daniel

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


[Catalyst] Create and store new cookie

2007-12-17 Thread Emmanuel Quevillon

Hi list,

I would like to be able to create and store new cookie(s) 
for user display options for my application.
I am currently using C::P::Session::Store::Cooke to store 
the user session but I would like to add a new cookie.
I am trying by setting in one of my Controller sub a cookie 
like that:


$c->res->cookies->{my_options} = { foo => 1, bar => 2 };
$c->res->redirect($c->uri_for('some_url'));

If I dump $c->res I can see the cookie freshly created.
However if I come back to the options page later, I don't 
have this cookie anymore. I check with this :

unless($c->req->cookie($c->config->{my_cookie_name})){
$c->log()->info("New cookie to create...");
}

Then I can see this message each time I go the options page.

Also, I can see that my session cookie 'myapp_session' is 
well stored but as a CGI::Simple::Cookie object, not a hash 
reference as mentioned in the response 'cookie' doc 
(http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7011/lib/Catalyst/Response.pm#$res-%3Ecookies)


Does anyone has a clue about this?
Does the redirect causes the reset of the cookies?

Thanks a lot

Regards

Emmanuel
--
-
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-

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


RE: [Catalyst] sending email with attachment

2007-12-17 Thread Hartmaier Alexander
It's a view, not a plugin!

View::Email can send attachments, for View::Email::Template you need to create 
the MIME part with MIME::Creator yourself atm.

Patches are welcome ;-)

-Alex

-Original Message-
From: Ash Berlin [mailto:[EMAIL PROTECTED]
Sent: Monday, December 17, 2007 4:48 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] sending email with attachment


On 17 Dec 2007, at 15:25, Michael Higgins wrote:

> How are others out there doing this? My application serves a .pdf file
> directly, but I'd like to send as an email attachment to the account
> as
> well.
>
> Looking at
> Catalyst/View/Email/Template.pm
> in the 'TO DO' section, "There needs to be a method to support
> attachments"...
>
> So, are there any recommendations for how to proceed? Generally I'd
> use
> MIME::Lite for this outside of Catalyst, but I'd like to stay in the
> Plugin:: space, and word is MIME::Lite isn't the best way currently.
>
> Cheers,

I just use MIME::Lite in my cat app.

And I've never understood the desire to use plugins for everything
under the sun... but thats just me.

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



smime.p7s
Description: S/MIME cryptographic signature
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] sending email with attachment

2007-12-17 Thread J. Shirley
On Dec 17, 2007 8:44 AM, Hartmaier Alexander <
[EMAIL PROTECTED]> wrote:

> It's a view, not a plugin!
>
> View::Email can send attachments, for View::Email::Template you need to
> create
> the MIME part with MIME::Creator yourself atm.
>
> Patches are welcome ;-)
>
> -Alex
>
> -Original Message-
> From: Ash Berlin [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 17, 2007 4:48 PM
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] sending email with attachment
>
>
> On 17 Dec 2007, at 15:25, Michael Higgins wrote:
>
> > How are others out there doing this? My application serves a .pdf file
> > directly, but I'd like to send as an email attachment to the account
> > as
> > well.
> >
> > Looking at
> > Catalyst/View/Email/Template.pm
> > in the 'TO DO' section, "There needs to be a method to support
> > attachments"...
> >
> > So, are there any recommendations for how to proceed? Generally I'd
> > use
> > MIME::Lite for this outside of Catalyst, but I'd like to stay in the
> > Plugin:: space, and word is MIME::Lite isn't the best way currently.
> >
> > Cheers,
>
> I just use MIME::Lite in my cat app.
>
> And I've never understood the desire to use plugins for everything
> under the sun... but thats just me.
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
>
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
>
>

Patches very welcome.

I'll probably get this functionality in place in the next 6 weeks though, so
if you want to collab just holler at me directly.

-J

-- 
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird...
http://www.toeat.com
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Permission Denied??

2007-12-17 Thread Emily Heureux
Hi, I have an instance of an object in my Catalyst application called
$MP_Model.  I have been using it successfully to call its methods until
today, when I received a 'permission denied' message:

Caught exception in Play::Controller::Maths->m_summarypg "Cannot open
file:Permission denied"

and from Stack Trace:

Play::Controller::Maths 
65: # Get ProteinName data structure through Protein Summary Data from
Model.pm in MP.
66: my $summarydata = $MP_Model->ProteinSummaryData({ProteinName =>
[$param]});
67: my $structuredata = $MP_Model->GetAllStructureData({ProteinName =>
[$param]});

I added line 67, and that is when I get the error.  Line 66 works fine, and
the GetAllStructureData method works fine in the application that it is part
of, but that is what is causing the 'permission denied' error.

Why 'permission denied'??  What file could it be saying cannot be opened?

Emily



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


[Catalyst] RE: Permission Denied??

2007-12-17 Thread Emily Heureux
Never mind, it doesn't have to do with Catalyst.

-Original Message-
From: Emily Heureux [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 17, 2007 10:24 AM
To: 'The elegant MVC web framework'
Subject: Permission Denied??

Hi, I have an instance of an object in my Catalyst application called
$MP_Model.  I have been using it successfully to call its methods until
today, when I received a 'permission denied' message:

Caught exception in Play::Controller::Maths->m_summarypg "Cannot open
file:Permission denied"

and from Stack Trace:

Play::Controller::Maths 
65: # Get ProteinName data structure through Protein Summary Data from
Model.pm in MP.
66: my $summarydata = $MP_Model->ProteinSummaryData({ProteinName =>
[$param]});
67: my $structuredata = $MP_Model->GetAllStructureData({ProteinName =>
[$param]});

I added line 67, and that is when I get the error.  Line 66 works fine, and
the GetAllStructureData method works fine in the application that it is part
of, but that is what is causing the 'permission denied' error.

Why 'permission denied'??  What file could it be saying cannot be opened?

Emily



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


Re: [Catalyst] "no role configuration found" -- authorization: dbic and DBI::Schema::Loader

2007-12-17 Thread Ashley Pond V
I backed up to a simple test script, got easier to find errors, and  
found the trouble with what I was doing.


__PACKAGE__->many_to_many(roles => 'user_roles', 'name');
  needed to be
__PACKAGE__->many_to_many(roles => 'user_roles', 'role');
  and a corresponding many_to_many in Role.pm
__PACKAGE__->many_to_many(users => 'user_roles', 'user');

So, I'm all good now but still a bit mystified about the silent  
failure(?).


Thanks again,
-Ashley

On Dec 16, 2007, at 10:49 PM, Ashley Pond V wrote:

Thanks for still looking at this, Jay. This is the top of the  
method with some "die" decoration:


Take 1:
my ( $self, $c ) = @_;
die "This will die";
$c->assert_user_roles("no such role");

Take 2:
my ( $self, $c ) = @_;
$c->assert_user_roles("no such role");
die "This will not fire";

I can put the assert in an eval block but $@ is not set so it  
doesn't help to see what's happening. There is no information in  
the logs at the point the code fails.


I guess I'll ask our admin to pull  
Catalyst::Plugin::Authentication::Store::DBIx::Class, yeah?  
Authentication is working fine, by the by. It's just Authorization  
that's wonky right now.


Pasting my setup stuff below.

-Ashley
--

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

...User.pm

__PACKAGE__->has_many(
  "user_roles",
  "MyApp::Schema::UserRole",
  { "foreign.user" => "self.id" },
);


# Created by DBIx::Class::Schema::Loader v0.04004 @ 2007-12-16  
13:36:55

# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qroNdEXQL4pOH80kVPQquw

__PACKAGE__->many_to_many(roles => 'user_roles', 'name');
---
yml
authentication:
  default_realm: users
  realms:
users:
  credential:
class: Password
password_type: hashed
password_hash_type: SHA-1
  store:
class: DBIx::Class
user_class: User
role_relation: roles
role_field: name

# doesn't matter whether or not the authorization stuff is there  
but this is what i've played with (and *many* permutations of the  
arguments)


authorization:
  dbic:
role_class: Role
role_field: name
user_class: User
user_field: user
user_role_user_field: user
user_role_role_field: role
role_rel: user_roles
user_role_class: UserRole



On Dec 16, 2007, at 9:20 PM, Jay K wrote:


Hi Ashley,

The log message you see is a result of the recent move away from  
the Catalyst::Plugin::Authentication namespace for stores /  
credentials.


It falls back to the old naming and warns if it can't find the new  
module.. It should, however, have no effect on the functionality  
of the code.


It's not a bad idea to update the DBIx::Class store - but be sure  
to remove the Catalyst::Plugin::Authentication::Store::DBIx::Class  
module first - just to avoid conflicts.  Nothing has changed  
related to roles in the update, so it shouldn't make any difference.


I don't know why the assert is failing, it should not - what do  
you get if you use $c->check_user_roles() - valid results?


Jay


On Dec 16, 2007, at 4:27 PM, Ashley Pond V wrote:

Continuing saga. So I set up the many_to_many and lo! It worked.  
But it worked with *any* role, even fake ones, so obviously  
something was bad. Turned out that it was silently failing  
instead of throwing an access exception (but there was a template  
set by the namespace so the page rendered as expected).


 # failed silently (as far as Cat was concerned)
 $c->assert_user_roles("there is no role called this");

So, dug into the log:

[Sun Dec 16 16:13:20 2007] [error] [client 67.170.68.172] [warn]  
Store class "Catalyst::Authentication::Store::DBIx::Class" not  
found, trying deprecated ::Plugin:: style naming. , referer: [...]


Would love to have more, rather than fewer exceptions thrown. I  
think the missing class was the cause of a couple of red herrings  
I followed down the rabbit hole trying to get this running  
yesterday [I'm entitled to mix metaphors, I pay an annual fee].  
After I get an admin to install the missing package in the  
morning I'll regale you with my next series of missteps and  
annoying language.


Live free or die early, die often,
-Ashley

On Dec 15, 2007, at 9:52 PM, Jay K wrote:


Hi There Ashley,

The DBIx::Class module expects to use the relation provided in  
the role_relation config element to retrieve one or more rows,  
which must contain a field called by whatever you provide in  
role_field.


My guess is that your user_roles table is a cross-ref table -  
userid and roleid essentially.  In order to solve this you need  
to use a many_to_many relationship mapping to the textual role  
names.


The DBIx::Class module expects you are going to route it to the  
information it needs using the role_relation.  So what you  
really need to do is create the schema class

Re: [Catalyst] [OT] ASP.NET MVC

2007-12-17 Thread Christopher H. Laco
I'm still holding hopes for:

Chained('../')

-=Chris



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [OT] ASP.NET MVC

2007-12-17 Thread Zbigniew Lukasiak
On Dec 17, 2007 4:03 PM, Daniel McBrearty <[EMAIL PROTECTED]> wrote:
> The chained thing is probably the single most useful thing in cat IMO
> (if it's possible to even make such a dumb call ;)
>
> The way I have come to see it (it took a while, reading discussions
> here helped me grasp this) is that the way you design your URI space
> is very very fundamental to design of a web app. Chained helps you to
> remember this and try to get it right at the start. It also makes the
> decision about what actions go in what controllers separate from
> decisions about URI namespace. (I haven't really figured out if that
> is entirely a good thing or not, but it seems helpful.)
>
> The syntax *is* a bit hard to get used to at first - I find that the
> important thing is to remember that Args() defines an endpoint (hope I
> am remembering that right), other than that take a good look at what

Yeah - some time ago I proposed to add an EndPoint attribute and get
rid of the CaptureArgs one that is not very intuitive (and use Args in
both cases).

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

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


Re: [Catalyst] [OT] ASP.NET MVC

2007-12-17 Thread Matt S Trout
On Mon, Dec 17, 2007 at 07:31:21AM -0800, John Napiorkowski wrote:
> Yeah, the main configuration is definitely the right
> place to be maintain centralized routing and to more
> cleanly separate the URI namespace.  Just that as you
> say, it's not clear to people when they first start
> probably because there isn't a lot of people saying
> that and the documentation and quick start guides
> don't seem to promote that idea.

No, it's absolutely and horribly the wrong place - that's why nobody uses
the feature even though it's supported. It basically turns your main mapping
into a god object; why does the mapping info for the admin interface need to
be related in any way shape or form to the mapping for the user interface,
for example?

Self-contained URI mapping info for controllers is essential to encapsulated
code re-use.

The one time I tend to use the main app config to supply such info is to
rename a particular part of a site for a specific deployment - for e.g.
if I have

MyApp::Controller::Blog::base :Chained('/') :PathPart('blog') :CaptureArgs(0)

I might do


  
PathPart news
  


to rename that URI segment to /news instead of /blog.

> If you give me a template to start with, either as an
> advent article or other I will definitely try to
> expand it out, as long as you don't me giving it the
> once or twice over.  

I was offering to provide an example of how to use base classes in ways
that are entirely impossible with a crappy central routing system - the
Reaction CRUD controller is a good example of this, it provides

$base/
$base/create
$base/id/*/view
$base/id/*/edit
$base/id/*/delete

actions, where $base is the chain part leading up to 'sub base'

So to bind that in you do

package MyApp::Controller::Admin::Foo

use base qw(Reaction::UI::Controller::CRUD);

__PACKAGE__->config(
  actions => { base => { Chained => '/admin/base', PathPart => 'foo' } },
  ... # model name etc. here
);

and assuming you have

MyApp::Controller::Admin::base :Chained('/') :PathPart('admin') :CaptureArgs(0)

/admin/foo/
/admin/foo/create
/admin/foo/id/*/view
/admin/foo/id/*/edit
/admin/foo/id/*/delete

actions all immediately appear ready to go.

This sort of thing simply isn't possible with a central routing system, which
is why in spite of people periodically claiming they're "easier" I've always
been against the concept.

-- 
  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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] retrieving multiple values from forms

2007-12-17 Thread Matt S Trout
On Sat, Dec 15, 2007 at 01:10:52PM -0600, Andrew Rodland wrote:
> On Saturday 15 December 2007 11:58:12 am jagdish eashwar wrote:
> > Hi,
> >
> > The Catalyst Tutorial shows how to retrieve single values from a form.
> >
> > Example:- my $title = $c->request->params->{title} || '';
> >
> > How can I retrieve multiple values from a selection list into an array?
> 
> 
> See the perldoc for Catalyst::Request -- the 'param' method comes in handy 
> here.
> 
> @values = $c->req->param('whatever');

No it doesn't.

That method is there for CGI.pm compatibility. Don't use it in new code.

-- 
  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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] RE: Permission Denied??

2007-12-17 Thread Matt S Trout
On Mon, Dec 17, 2007 at 10:32:55AM -0800, Emily Heureux wrote:
> Never mind, it doesn't have to do with Catalyst.

You also forgot to start a new threaad so nobody saw the original message
anyway.

-- 
  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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] retrieving multiple values from forms

2007-12-17 Thread Andrew Rodland
On Monday 17 December 2007 03:01:53 pm Matt S Trout wrote:
> On Sat, Dec 15, 2007 at 01:10:52PM -0600, Andrew Rodland wrote:
> > See the perldoc for Catalyst::Request -- the 'param' method comes in
> > handy here.
> >
> > @values = $c->req->param('whatever');
>
> No it doesn't.
>
> That method is there for CGI.pm compatibility. Don't use it in new code.

It's also the only one that has a sensible semantic. "Might be an unblessed 
scalar or an arrayref" is silly for something that's naturally a _list_. If 
param wasn't there I would have to write a method that did the same thing, 
and use that.

Andrew

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


Re: [Catalyst] [OT] ASP.NET MVC

2007-12-17 Thread John Napiorkowski

--- Matt S Trout <[EMAIL PROTECTED]> wrote:

> On Mon, Dec 17, 2007 at 07:31:21AM -0800, John
> Napiorkowski wrote:
> > Yeah, the main configuration is definitely the
> right
> > place to be maintain centralized routing and to
> more
> > cleanly separate the URI namespace.  Just that as
> you
> > say, it's not clear to people when they first
> start
> > probably because there isn't a lot of people
> saying
> > that and the documentation and quick start guides
> > don't seem to promote that idea.
> 
> No, it's absolutely and horribly the wrong place -
> that's why nobody uses
> the feature even though it's supported. It basically
> turns your main mapping
> into a god object; why does the mapping info for the
> admin interface need to
> be related in any way shape or form to the mapping
> for the user interface,
> for example?
> 
> Self-contained URI mapping info for controllers is
> essential to encapsulated
> code re-use.
> 
> The one time I tend to use the main app config to
> supply such info is to
> rename a particular part of a site for a specific
> deployment - for e.g.
> if I have
> 
> MyApp::Controller::Blog::base :Chained('/')
> :PathPart('blog') :CaptureArgs(0)
> 
> I might do
> 
> 
>   
> PathPart news
>   
> 
> 
> to rename that URI segment to /news instead of
> /blog.
> 
> > If you give me a template to start with, either as
> an
> > advent article or other I will definitely try to
> > expand it out, as long as you don't me giving it
> the
> > once or twice over.  
> 
> I was offering to provide an example of how to use
> base classes in ways
> that are entirely impossible with a crappy central
> routing system - the
> Reaction CRUD controller is a good example of this,
> it provides
> 
> $base/
> $base/create
> $base/id/*/view
> $base/id/*/edit
> $base/id/*/delete
> 
> actions, where $base is the chain part leading up to
> 'sub base'
> 
> So to bind that in you do
> 
> package MyApp::Controller::Admin::Foo
> 
> use base qw(Reaction::UI::Controller::CRUD);
> 
> __PACKAGE__->config(
>   actions => { base => { Chained => '/admin/base',
> PathPart => 'foo' } },
>   ... # model name etc. here
> );
> 
> and assuming you have
> 
> MyApp::Controller::Admin::base :Chained('/')
> :PathPart('admin') :CaptureArgs(0)
> 
> /admin/foo/
> /admin/foo/create
> /admin/foo/id/*/view
> /admin/foo/id/*/edit
> /admin/foo/id/*/delete
> 
> actions all immediately appear ready to go.
> 
> This sort of thing simply isn't possible with a
> central routing system, which
> is why in spite of people periodically claiming
> they're "easier" I've always
> been against the concept.

Hi,

Thanks for clarifying your thoughts for me.  I went
and looked at the Reaction repo to get a better idea
of what you are talking about.  

I may not have properly explained what I was thinking
regarding mapping and configuration.  However I found
what you wrote to be very elucidating.  I guess what
you are saying is that it's not such a good idea to
put all the URI mapping information, (such as
controller namespace, action path or pathpart, etc) in
your global configuration, since as you say it
improperly couples things that are not related and it
also prevents you from using base controller classes
in the way you've describe.  However I am sure you can
understand that it's not obvious to many people to do
their development this way, particularly without any
examples (and with all the examples commonly tossed
around not doing this at all).

I still think a solid and well documented example will
help here.  We should choose something that would suck
if it wasn't developed in Catalyst.  I guess what I am
shooting for is a clear and understandable reason why
Catalyst's de-centralized routing can lead to more
flexible and more robust designs, since as you say
things more less tightly coupled, among other reasons.
 Having such an explanation would be very useful in
articulating what's great about Catalyst and also
offer guidance to beginners as to the best way to
structure their projects.  As I mentioned in an
earlier post, this is a big point of confusion for all
the new Catalyst developers I've run into.  I know of
at least two people that decided to just use :Default
everywhere and stop trying to understand what to do. 
This system is a major plus for Catalyst, especially
with the way it can play so well with Chaining (as the
Reaction example you gave showed).  To my eyes it
makes Catalyst development beautiful and I'd like to
make that more obvious to people when choosing a
development framework.

--John


> 
> -- 
>   Matt S Trout   Need help with your
> Catalyst or DBIx::Class project?
>Technical Director   
> http://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

Re: [Catalyst] [OT] ASP.NET MVC

2007-12-17 Thread Daniel McBrearty
I'd love to *get* reaction, but last time I tried (admittedly a long
time back) I had to scrape my brains off the ceiling ... (and I don't
really have enough to go round for that kind of thing) ...

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


[Catalyst] Re: retrieving multiple values from forms

2007-12-17 Thread A. Pagaltzis
* Andrew Rodland <[EMAIL PROTECTED]> [2007-12-17 22:40]:
> On Monday 17 December 2007 03:01:53 pm Matt S Trout wrote:
> > On Sat, Dec 15, 2007 at 01:10:52PM -0600, Andrew Rodland wrote:
> > > See the perldoc for Catalyst::Request -- the 'param' method
> > > comes in handy here.
> > >
> > > @values = $c->req->param('whatever');
> >
> > No it doesn't.
> >
> > That method is there for CGI.pm compatibility. Don't use it
> > in new code.
> 
> It's also the only one that has a sensible semantic. "Might be
> an unblessed scalar or an arrayref" is silly for something
> that's naturally a _list_. If param wasn't there I would have
> to write a method that did the same thing, and use that.

None of these interfaces is sane. The problem with CGI.pm’s
interface is this:

Foo->new(
bar => $q->param( 'bar' ),
baz => $q->param( 'baz' ),
);

Now if someone sends you this query string:

?bar=1;baz=2;baz=is_admin;baz=1

the call evaluates to


Foo->new(
bar => 1,
baz => 2, 'is_admin', 1,
);

Woops.

So CGI.pm forces you to pepper your code with `scalar`s to make
it safe:

Foo->new(
bar => scalar $q->param( 'bar' ),
baz => scalar $q->param( 'baz' ),
);

Catalyst’s interface avoids that. However, Catalyst’s way of
“either you get an arrayref or a scalar” isn’t sane either since
it forces you to pepper your code just as much if not more, if
you want it to react predictably regardless of how many arguments
were passed.

The *sane* thing is neither.

The sane thing is to have *TWO* methods, one that *always*
returns a scalar, and one that *always* returns a list. (Or
rather, an arrayref, because if it’s just a list, it is easy to
improperly treat it like a scalar, whereas if it’s an arrayref
it’s impossible to forget to unpack the array when you meant to
do that.)

Then you can say what you mean, you can say it *easily* either
way, and the result is always completely determined by what the
code says and not at all by what the data looks like. Sanity.

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // 

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


Re: [Catalyst] Re: retrieving multiple values from forms

2007-12-17 Thread Andrew Rodland
On Monday 17 December 2007 05:27:46 pm A. Pagaltzis wrote:
> The *sane* thing is neither.
>
> The sane thing is to have *TWO* methods, one that *always*
> returns a scalar, and one that *always* returns a list. (Or
> rather, an arrayref, because if it’s just a list, it is easy to
> improperly treat it like a scalar, whereas if it’s an arrayref
> it’s impossible to forget to unpack the array when you meant to
> do that.)
>
> Then you can say what you mean, you can say it *easily* either
> way, and the result is always completely determined by what the
> code says and not at all by what the data looks like. Sanity.

Yeah, I can agree with this. I realized the same thing myself... after posting 
my original message of course. Teach me to wait a bit longer before hitting 
send in the future. Anyway yeah, what I really want is "param_list" 
or "param_aref", without any of the actual "CGI compat" of param -- param 
just comes closer to my goal than params. Not sure what the ideal behavior 
for the "only one" version would be, but params is at least practical. If you 
see ARRAY(0xbadfad) where you expected useful data it's not that hard to 
trace back and see what you did wrong.

Andrew



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


Re: [Catalyst] [OT] ASP.NET MVC#

2007-12-17 Thread Matt S Trout
On Mon, Dec 17, 2007 at 08:39:29PM +, Zbigniew Lukasiak wrote:
> Yeah - some time ago I proposed to add an EndPoint attribute and get
> rid of the CaptureArgs one that is not very intuitive (and use Args in
> both cases).

I don't remember seeing the code - if you update your patch to work against
5.80 trunk we can have a look ...

-- 
  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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm

2007-12-17 Thread Michael Higgins
PANIC!!!

So, the gentoo overlay installation is altered like:

dev-perl/Catalyst-Authentication-Store-DBIx-Class
!dev-perl/Catalyst-Plugin-Authentication-Store-DBIx-Class
!dev-perl/Catalyst-Plugin-Authentication-Store-DBIC

Okay... no more 'Plugin' or 'DBIC' anymore, it seems.

Then I did find this:
http://cpan.uwinnipeg.ca/htdocs/Catalyst-Authentication-Store-DBIx-Class/Catalyst/Authentication/Store/DBIx/Class.html

And, I try to change a couple of items in the configs, like so:

authentication => {
default_realm => 'members',
realms => {
members => {
credential => {
class => 'Password',
password_field => 'password',
password_type => 'clear'
},
store => {
class => 'DBIx::Class',
user_class => 'MyAppDB::Users',
id_field => 'user_id',
role_relation => 'userroles',
role_field => 'role_name',
}

... to mimic what is in that doco.

Caught exception in BanTrace::Controller::Login->index "The user object
Catalyst::Authentication::Store::DBIx::Class::User=HASH(0x9469e70) does
not support any known password authentication mechanism.,,

...here:

   35: if ($username && $password) {
   36: 
   37: # Attempt to log the user in
   38: if ($c->login($username, $password)) {

WTF

My application is configured exactly like the tutorial... used to be
written?? No. It still looks like: Authentication::Store::DBIC

And that Plugin:: isn't part of the installation now... this _can't_ be
okay, no?

Alright, so this is the new 'login' method, 'authenticate'?

   37: # Attempt to log the user in
   38: # if ($c->login($username, $password)) {
   39: if ($c->authenticate($username, $password)) {


Caught exception in BanTrace::Controller::Login->index "authenticate
called with nonexistant realm: 'MYPASSWORD'?

Ouch! Oh, with a hashref, now:

# if ($c->login($username, $password)) {
if ($c->authenticate({username => $username, password =>
$password}))

So now I'm in... sort of. Other parts are broken...

if ($c->check_user_roles('admin')) {

... didn't seem to fly.

Now, I'm stuck. That method comes from, I think, ::DBIC ... what's the
new way? Fortunately, in this app, if you are not 'admin' you must be a
user... but I'd like to have my ROLE back!!!

Any help really, really appreciated. '-)

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

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


[Catalyst] [RFC] Loading Plugins from lib/MyApp/Plugins

2007-12-17 Thread Christopher Laco
I know I've been down this thread before. When writing a framework that
generates customized Catalyst apps, it would be a whole lot easier
(well, more proper) to add plugins in lib/MyApp/Plugins, just like we do
with controllers/models/view, than it is to molest the MyApp.pm 'use
Catalyst' line to include custom plugins.

I'm assuming that it's just a matter of tweaking the Module::Pluggable
search paths at the appropriate time when Cat is starting up.

Is this a planned feature for 5.8? Could it be?
Yes, I'll volunteer to put some tuits on it if need be.

-=Chris



signature.asc
Description: OpenPGP digital signature
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm

2007-12-17 Thread Jay K

Hi Michael,

Unfortunately the Tutorial is a bit out of date.

Please look at this:

http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm

and this:

http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm

and your issues should be cleared up.

Jay

On Dec 17, 2007, at 7:07 PM, Michael Higgins wrote:


PANIC!!!

So, the gentoo overlay installation is altered like:

dev-perl/Catalyst-Authentication-Store-DBIx-Class
!dev-perl/Catalyst-Plugin-Authentication-Store-DBIx-Class
!dev-perl/Catalyst-Plugin-Authentication-Store-DBIC

Okay... no more 'Plugin' or 'DBIC' anymore, it seems.

Then I did find this:
http://cpan.uwinnipeg.ca/htdocs/Catalyst-Authentication-Store-DBIx-Class/Catalyst/Authentication/Store/DBIx/Class.html

And, I try to change a couple of items in the configs, like so:

authentication => {
   default_realm => 'members',
   realms => {
   members => {
   credential => {
   class => 'Password',
   password_field => 'password',
   password_type => 'clear'
   },
   store => {
   class => 'DBIx::Class',
   user_class => 'MyAppDB::Users',
   id_field => 'user_id',
   role_relation => 'userroles',
   role_field => 'role_name',
   }

... to mimic what is in that doco.

Caught exception in BanTrace::Controller::Login->index "The user
object
Catalyst::Authentication::Store::DBIx::Class::User=HASH(0x9469e70)
does
not support any known password authentication mechanism.,,

...here:

  35: if ($username && $password) {
  36:
  37: # Attempt to log the user in
  38: if ($c->login($username, $password)) {

WTF

My application is configured exactly like the tutorial... used to be
written?? No. It still looks like: Authentication::Store::DBIC

And that Plugin:: isn't part of the installation now... this _can't_
be
okay, no?

Alright, so this is the new 'login' method, 'authenticate'?

  37: # Attempt to log the user in
  38: # if ($c->login($username, $password)) {
  39: if ($c->authenticate($username, $password)) {


Caught exception in BanTrace::Controller::Login->index "authenticate
called with nonexistant realm: 'MYPASSWORD'?

Ouch! Oh, with a hashref, now:

   # if ($c->login($username, $password)) {
   if ($c->authenticate({username => $username, password =>
$password}))

So now I'm in... sort of. Other parts are broken...

if ($c->check_user_roles('admin')) {

... didn't seem to fly.

Now, I'm stuck. That method comes from, I think, ::DBIC ... what's the
new way? Fortunately, in this app, if you are not 'admin' you must
be a
user... but I'd like to have my ROLE back!!!

Any help really, really appreciated. '-)

Cheers,

--
|\  /||   |  ~ ~
| \/ ||---|  `|` ?
||ichael  |   |iggins\^ /
michael.higgins[at]evolone[dot]org

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


---
"Those who can make you believe absurdities can make you commit
atrocities." --Voltaire



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


Re: [Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm

2007-12-17 Thread Michael Higgins
On Mon, 17 Dec 2007 20:47:20 -0700
Jay K <[EMAIL PROTECTED]> wrote:

> Hi Michael,
> 
> Unfortunately the Tutorial is a bit out of date.
> 
> Please look at this:
> 
> http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm
> 
> and this:
> 
> http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm
> 
> and your issues should be cleared up.
> 
> Jay

Thanks, Jay!

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

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


Re: [Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm

2007-12-17 Thread Michael Higgins
On Mon, 17 Dec 2007 20:09:23 -0800
Michael Higgins <[EMAIL PROTECTED]> wrote:

> On Mon, 17 Dec 2007 20:47:20 -0700
> Jay K <[EMAIL PROTECTED]> wrote:
> 
> > Hi Michael,
> > 
> > Unfortunately the Tutorial is a bit out of date.
> > 
> > Please look at this:
> > 
> > http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm
> > 
> > and this:
> > 
> > http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm
> > 
> > and your issues should be cleared up.
> > 
> > Jay
> 
> Thanks, Jay!
> 
> Cheers,
> 

So, the question I'd left off with was, basically, what's up with if ( 
$c->check_user_roles( 'editor' ) ) {
# do editor stuff
}

I have a feeling that, since my roles are in a separate table, like '1'
is user, '2' is admin -- again, from that out of date tutorial -- that
this isn't going to work as expected, somehow. 

from /Catalyst/Authentication/Store/DBIx/Class.pm

"If your role information is stored in the same table as the rest of
your user information"...

Mine is not. 

Then, it reads about role_field, "This is the name of the field in the
role table that contains the string identifying the role".

I think that string for me is, like '1', because that is the role_id.
But, it looks like this should retrieve the id then return the name of
the role for matching... right?

+-+---+
| role_id | role_name |
+-+---+
|   1 | user  | 
|   2 | admin | 
|   3 | guest | 
+-+---+


Maybe I need a different accessor, IDK. What I do know is it 'just
worked' and that's why I used Catalyst. Now, I'm wholly out of my depth.

I've continued now for another hour or so. It sure does seem like this
isn't going to work. Do I need to change my data tables in order to use
this now?

role_field => 'role_id',

... gives me:

SELECT me.user_id, me.username, me.password, me.email_address,
me.first_name, me.last_name, me.bill2 FROM users me WHERE ( user_id = ? ): '1'

Great, found the 'admin'.

SELECT me.role_id FROM user_roles me WHERE ( me.user_id = ? ): '1'
Caught exception in BanTrace::Controller::Shipments->list "Missing
roles: admin at   

 $c->log->debug($c->assert_user_roles('admin'));

[debug] Role granted: 2
[debug] 1
[debug] Role denied: admin

Whereas:

role_field => 'role_name',

Gives me nothing at all. Never tries to check if I've got a role.

ACL rules are in effect as well?? What do I need to do to back out of
the basic tutorial setup, and get this working again? I have to think
that this information would only be helpful to others, no? Or am I the
only one who based an application on the tutorial? '-)

Do I go about redefining my 'roles' as '1', '2', '3'?? Or do I have to
change my database configuration?

Or, am I barking up the wrong tree? 

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

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


Re: [Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm

2007-12-17 Thread Michael Higgins
On Mon, 17 Dec 2007 21:03:52 -0800
Michael Higgins <[EMAIL PROTECTED]> wrote:

> On Mon, 17 Dec 2007 20:09:23 -0800
> Michael Higgins <[EMAIL PROTECTED]> wrote:
> 
> > On Mon, 17 Dec 2007 20:47:20 -0700
> > Jay K <[EMAIL PROTECTED]> wrote:
> > 
> > > Hi Michael,
> > > 
> > > Unfortunately the Tutorial is a bit out of date.

[8<]

> Do I go about redefining my 'roles' as '1', '2', '3'?? Or do I have to
> change my database configuration?

. . . [reply to self again]

Okay, it appears as if the join table is no longer needed? (I don't
know why it was needed before, but it's part of the tutorial, IIRC.)

So, I have a table "users" and "user_roles". First table is user
information with a user_id. Second table is user_id and role_name. My
role_id column and 'roles' table are probably both superfluous now?

__PACKAGE__->belongs_to(user => 'MyAppDB::Users', 'user_id');

__PACKAGE__->has_many(map_user_roles => 'MyAppDB::UserRoles',
'user_id');

Is that _really_ all that's required?

Anyway, I -- perhaps prematurely asserted -- think I've figured this
out. 

Cheers,

-- 
 |\  /||   |  ~ ~  
 | \/ ||---|  `|` ?
 ||ichael  |   |iggins\^ /
 michael.higgins[at]evolone[dot]org

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