[Catalyst] logout and go back to previous session?

2007-03-13 Thread hubert depesz lubaczewski
hi, i have a slight problem designing software for one of business requirements. this website will allow anonymous access. i.e. - when you go to website, it will automatically create anonymous user so you will be able to store all kind of information per this user without ever logging in. session

[Catalyst] putting an object in the stash

2007-03-13 Thread Octavian Rasnita
Hi, I have a DBIC record object like my $obj = $c-model(Database::Table)-find($id); The table has very many fields and I would like to put their values in a TT template without inserting them one by one in the stash. So I would like to create a hash ref from $obj where the name of the field

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Will Hawes
On 13/03/07, Octavian Rasnita [EMAIL PROTECTED] wrote: Hi, I have a DBIC record object like my $obj = $c-model(Database::Table)-find($id); The table has very many fields and I would like to put their values in a TT template without inserting them one by one in the stash. So I would like to

Re: [Catalyst] New catalyst site - gardenate.com

2007-03-13 Thread Chris
It also served as an interesting exercise in getting a Cat site to run under fastcgi on a host who don't really know how to support fastcgi, using mod_rewrite to invoke the fastcgi server script. Wife says That's very useful which is praise indeed. Can you write up a short deployment

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Simon Wilcox
On Tue, 13 Mar 2007, Octavian Rasnita wrote: I have a DBIC record object like my $obj = $c-model(Database::Table)-find($id); The table has very many fields and I would like to put their values in a TT template without inserting them one by one in the stash. So I would like to create a hash

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Octavian Rasnita
From: Simon Wilcox [EMAIL PROTECTED] I just put the object in the stash. TT abstracts the method/hash key accessor issue for you so that [% obj.name1 %] will work whether obj is an object with a name1 accessor or a hash with a name1 key. Ok, then I will use that way. I hoped that the first

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Simon Wilcox
On Tue, 13 Mar 2007, Daniel McBrearty wrote: basically : an object IS a (blessed) hash. Not necessarily, you can also bless scalars and arrays. A blessed array, in particular can be a very effective way of improving performance for certain types of data structures. You kind of need to

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Kiki
Simon Wilcox wrote: Not necessarily, you can also bless scalars and arrays. A blessed array, in particular can be a very effective way of improving performance for certain types of data structures. Strictly speaking you can bless any reference, although the most useful are hashes and

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Simon Wilcox
On Tue, 13 Mar 2007, Octavian Rasnita wrote: From: Simon Wilcox [EMAIL PROTECTED] I just put the object in the stash. TT abstracts the method/hash key accessor issue for you so that [% obj.name1 %] will work whether obj is an object with a name1 accessor or a hash with a name1 key.

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Octavian Rasnita
I know that an object is a blessed hash, but the DBIC objects are very complex, and I cannot use $c-stash($obj); If I do that, the values from $obj hash reference are not put in the template like when $obj is a reference to a common hash. That's why I want to find how to put the key/values

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Daniel McBrearty
On 3/13/07, Kiki [EMAIL PROTECTED] wrote: Simon Wilcox wrote: Not necessarily, you can also bless scalars and arrays. A blessed array, in particular can be a very effective way of improving performance for certain types of data structures. Strictly speaking you can bless any reference,

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Daniel McBrearty
If I do that, the values from $obj hash reference are not put in the template like when $obj is a reference to a common hash. Impossible to know what you mean here without an example of the template, but I commonly put DBIC objects on the stash, and call methods on them with the dot operator

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Simon Wilcox
On Tue, 13 Mar 2007, Octavian Rasnita wrote: That's why I want to find how to put the key/values from $obj into a common hash. It sounds like this might be a bad design decision. Why would you not want to group your template variables ? As your app grows you'd be much more likely to see one

Re: [Catalyst] logout and go back to previous session?

2007-03-13 Thread Carl Johnstone
now. somebody else can use the same computer/browser to connect to his account - named, with full login/password things. so we create him a session (short term, only till the closing of browser). but. after this named user will logout, or close the browser and reopen - we should be able to go

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Octavian Rasnita
From: Simon Wilcox [EMAIL PROTECTED] You will have to iterate over the accessors individually to put them into the stash (I think) but you should be able to use DBIC to do most of the thinking. Something like (untested): my $model = $c-model(Database::Table); foreach my $column

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Dave Howorth
Daniel McBrearty wrote: basically : an object IS a (blessed) hash. http://perldoc.perl.org/perlboot.html You kind of need to understand this, if you don't already. It's worth having a read through the tutorials. As others have pointed out, objects can also be created by blessing other

Re: [Catalyst] logout and go back to previous session?

2007-03-13 Thread hubert depesz lubaczewski
On 3/13/07, Carl Johnstone [EMAIL PROTECTED] wrote: This doesn't make sense to me, before the named user logs in they'll be accessing the same anonymous session. Therefore you can't tell the difference between the two different users. anonymous is not 100% anonymous. each anonymous session

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Carl Johnstone
Is it possible to do that without specifying all the keys by name? Or at least is there a way to get all the keys from $obj, then loop and create a hash, something like: my $hash; foreach(@keys) { $hash-{$_} = $obj-$_; } You're asking for trouble with something like that. Create a DB column

Re: [Catalyst] logout and go back to previous session?

2007-03-13 Thread Carl Johnstone
anonymous is not 100% anonymous. each anonymous session will have it's own user-id (without username and possibility to login as this user) - this is to make sure one doesn't have to register in order to use basic functionality of the system (which needs to create some records in database). It

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Octavian Rasnita
From: Simon Wilcox [EMAIL PROTECTED] You will have to iterate over the accessors individually to put them into the stash (I think) but you should be able to use DBIC to do most of the thinking. Something like (untested): my $model = $c-model(Database::Table); foreach my $column

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Octavian Rasnita
From: Daniel McBrearty [EMAIL PROTECTED] Impossible to know what you mean here without an example of the template, but I commonly put DBIC objects on the stash, and call methods on them with the dot operator in TT. TT is smart enough to work out what needs to be done and do it so whether the

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Daniel McBrearty
Hi, The problem appears when I want to use only [% element %] and not [% obj.element %] in templates. And I want to use the first way because there are very many variables and it is more simple. As others have said, I think this is going to bite you in the arse later. K-I-S-S. It seems we

RE: [Catalyst] logout and go back to previous session?

2007-03-13 Thread Andrew Strader
hubert depesz lubaczewski wrote: but. after this named user will logout, or close the browser and reopen - we should be able to go back to the previous anonymous user. When the registered user logs out, why must the application change back to the previous anonymous session? Why can't it

Re: [Catalyst] logout and go back to previous session?

2007-03-13 Thread hubert depesz lubaczewski
On 3/13/07, Andrew Strader [EMAIL PROTECTED] wrote: When the registered user logs out, why must the application change back to the previous anonymous session? Why can't it generate a new anonymous session? A user of a shared computer that doesn't register on your site wouldn't expect their

Re: [Catalyst] logout and go back to previous session?

2007-03-13 Thread hubert depesz lubaczewski
On 3/13/07, Carl Johnstone [EMAIL PROTECTED] wrote: If you have 20 people all use the same computer, and none of them login - how many anonymous users do you have. How do you tell the difference between them and switch between them? no. if 20 people use the same computer - it's the same

[Catalyst] Anybody using Chained('.') ?

2007-03-13 Thread Jason Kohles
I'm trying to use Chained('.') to create a controller base class that binds to the namespace of whatever controller class inherits it, but despite the documentation specifically mentioning this use, I can't seem to get it to work. I minimized the problem down to this simplest of

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Bogdan Lucaciu
On Tuesday 13 March 2007 15:06, Octavian Rasnita wrote: my $model = $c-model(Database::Table); foreach my $column (@{$model-columns}) {    $column =~ s{me\.}{}; # strip the prefix DBIC adds    $c-stash-{$column} = $obj-$column; } I have tried that, but it gave the following error:

Re: [Catalyst] Anybody using Chained('.') ?

2007-03-13 Thread Robert 'phaylon' Sedlacek
Jason Kohles wrote: I'm trying to use Chained('.') to create a controller base class that binds to the namespace of whatever controller class inherits it, but despite the documentation specifically mentioning this use, I can't seem to get it to work. Where does the documentation say that? In

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Dave Rolsky
On Tue, 13 Mar 2007, Dave Howorth wrote: In the context of the original question, it's also worth remembering that an object is not the same as a hash as far as TT is concerned. It unifies the syntax to call accessors and to access the members of a hash. But it does *not* let you access

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Matt Lawrence
Bogdan Lucaciu wrote: On Tuesday 13 March 2007 15:06, Octavian Rasnita wrote: my $model = $c-model(Database::Table); foreach my $column (@{$model-columns}) { $column =~ s{me\.}{}; # strip the prefix DBIC adds $c-stash-{$column} = $obj-$column; } I have tried that, but it gave

Re: [Catalyst] Anybody using Chained('.') ?

2007-03-13 Thread Jason Kohles
On Mar 13, 2007, at 10:41 AM, Robert 'phaylon' Sedlacek wrote: Jason Kohles wrote: I'm trying to use Chained('.') to create a controller base class that binds to the namespace of whatever controller class inherits it, but despite the documentation specifically mentioning this use, I can't

Re: [Catalyst] Mason configuration in YAML

2007-03-13 Thread Carl Vincent
Following up from a mail way-back-when: -Original Message- From: Kevin Old [mailto:kevinold at gmail.com] Sent: Thursday, December 07, 2006 8:37 PM To: The elegant MVC web framework Subject: Re: [Catalyst] Mason configuration in YAML I'm pretty sure you need to do it like this:

PathPrefix (was: [Catalyst] Anybody using Chained('.') ?)

2007-03-13 Thread Robert 'phaylon' Sedlacek
Jason Kohles wrote: Apparently I misunderstood the relationship between Chained and PathPart, and therefore misunderstood what the documentation was saying here. So now the way I understand it is that Chained('.') means to setup a chain segment that has as it's parent the chain segment that

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Octavian Rasnita
From: Matt Lawrence [EMAIL PROTECTED] Alternatively, get_columns will return a hash (not a reference!) of the current row. $c-stash-{obj }= { $row-get_columns }; Oh thanks. Finally I've used $c-stash-{obj} = $obj; and I've modified the template, because it seems that it is a better design.

[Catalyst] Re: PathPrefix

2007-03-13 Thread Brian Cassidy
Robert 'phaylon' Sedlacek wrote: You can chain your action only to other actions or to the root, not to namespaces. The PathPart attribute controls how the path is built visibly. There is a :PathPrefix implementation that does what you want somewhere in Catalyst's SVN, but I don't know when it

Re: [Catalyst] putting an object in the stash

2007-03-13 Thread Eden Cardim
On 3/13/07, Octavian Rasnita [EMAIL PROTECTED] wrote: Please tell me what it means column inflation. Check the docs for DBIx::Class::InflateColumn -- Eden Cardim Instituto Baiano de Biotecnologia Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas Laboratório de

Re: PathPrefix (was: [Catalyst] Anybody using Chained('.') ?)

2007-03-13 Thread John Napiorkowski
There's a way you can mimic PathPrefix for now. This worked for me: http://use.perl.org/~LTjake/journal/31738 Looking forward to the swarm of tweaks and fixes that are part of the next Catalyst release :) --John - Original Message From: Robert 'phaylon' Sedlacek [EMAIL PROTECTED]

[Catalyst] Template Engine

2007-03-13 Thread Mesdaq, Ali
I just wanted to get everyone's feedback on what they prefer as their templating engine. I know there are a bunch of choices but wanted to see what people think of certain ones. I am looking for something that supports and promotes good practices and cutting edge techniques.

Re: [Catalyst] Template Engine

2007-03-13 Thread John Napiorkowski
- Original Message From: Mesdaq, Ali [EMAIL PROTECTED] To: The elegant MVC web framework catalyst@lists.rawmode.org Sent: Tuesday, March 13, 2007 3:00:14 PM Subject: [Catalyst] Template Engine I just wanted to get everyone's feedback on what they prefer as their templating engine. I know

Re: [Catalyst] Template Engine

2007-03-13 Thread Michael Reece
you will find that most here use Template Toolkit, but i prefer HTML::Mason, because i can do really interesting things with an OO- based templating system. but embedding perl into HTML may not be what you mean by promotes good practices .. mason is pretty agnostic in that regard, but you

Re: [Catalyst] Template Engine

2007-03-13 Thread Michele Beltrame
Hello I chose TT for some reasons, including: * The syntax is simple enough to have templates edited by web designers. * It doesn't allow (unless you force it to) you to put Perl directly into the template, thus making me (and my developers, especially ;-)) always prefer to put the logic

RE: [BULK] - Re: [Catalyst] Template Engine

2007-03-13 Thread Mesdaq, Ali
I like the idea of OO based modules and systems. Is that the main difference between TT and Mason? That is that Mason is OO based and TT is not? That in itself could be a good enough reason to go with one over the other. But support, documentation, and ease out weigh if its OO based or not.

[Catalyst] Good Resources for cutting edge/best practices

2007-03-13 Thread Mesdaq, Ali
Does anyone know of a site(s) or book(s) that is a good resource for perl web development? I have already done searches and have books but some feedback from you guys would be great as well. Its been sometime since I developed on the web and things have changed A LOT! So I would like to get up to

[Catalyst] Re: logout and go back to previous session?

2007-03-13 Thread A. Pagaltzis
Hi Hubert, * hubert depesz lubaczewski [EMAIL PROTECTED] [2007-03-13 10:10]: but. after this named user will logout, or close the browser and reopen - we should be able to go back to the previous anonymous user. just to add a different voice: this approach seems perfectly sensible to me. In

Re: [Catalyst] Good Resources for cutting edge/best practices

2007-03-13 Thread Jonathan Rockway
On Tuesday 13 March 2007 18:27, Mesdaq, Ali wrote: Some of the areas I would specifically like to learn about are: - table-less pages - perl templating (already started a thread on that) - Website security - Ajax (basics, advanced, security) - Advanced javascript - Best practices (string

Re: [Catalyst] Re: logout and go back to previous session?

2007-03-13 Thread hubert depesz lubaczewski
On 3/14/07, A. Pagaltzis [EMAIL PROTECTED] wrote: The only problem I see is that you may get a lot of spurious sessions from registered users hitting the site before they head to the login form. You should probably avoid creating sessions until the user actually changes his settings or otherwise