Re: [Catalyst] logging in - redirecting

2006-12-26 Thread Octavian Rasnita

From: "Juan Miguel Paredes" <[EMAIL PROTECTED]>


Also, maybe you would like something as:

sub end : ActionClass('RenderView') {
 $c->forward( $c->view('TT') ) unless $c->response->body; #note the unless
}



Oh, and I have also seen that with the Catalyst testing server it happends 
the same as before if I do this.


If I run it with -k parameter it works fine (as before), but if I run it 
with no parameters, it gives the 404 Not Found error (just like Apache 
does).


Thanks.

Octavian


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


Re: [Catalyst] logging in - redirecting

2006-12-26 Thread Octavian Rasnita

From: "Juan Miguel Paredes" <[EMAIL PROTECTED]>


Hi, Octavian...


sub end : Private {
my ( $self, $c ) = @_;
$c->forward( $c->view('TT'));
}

sub end : ActionClass('RenderView') {}



Doesn't it sound like a deja-vu somewhere? :)

Also, maybe you would like something as:

sub end : ActionClass('RenderView') {
 $c->forward( $c->view('TT') ) unless $c->response->body; #note the unless
}


Hi,

I have tried deleting the old sub end : Private class, and use the 
following:


sub end : ActionClass('RenderView') {
my ($self, $c) = @_;
$c->stash->{template} = "login.tt";
$c->forward($c->view('TT')) unless $c->response->body;
}

But nothing happends. It still gives a 404 Not Found error when the username 
and the password are correct.


If I don't use the following line in this subroutine
$c->stash->{template} = "login.tt";
then Catalyst prints an error message telling that the template file was not 
found.
It doesn't specify which file was not found, so I think that 
$c->stash->{template} specified in other subroutines is not taken into 
consideration.


Thank you.

Octavian


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


Re: [Catalyst] Catalyst on Windows

2006-12-26 Thread Nilson Santos Figueiredo Junior

On 12/27/06, Octavian Rasnita <[EMAIL PROTECTED]> wrote:

Does Cache::FastMmap support Windows now?
I have tried installing it with ppm, but I couldn't find it, and using cpan,
but it gave errors.


I've tested a preliminary version and (incorrectly) assumed it was
already available at the CPAN.

If you read through this discussion thread:

 http://lists.rawmode.org/pipermail/catalyst/2006-October/010168.html

you'll find a link to an unreleased version which supports Win32.
Beware, if you're compiling using MSVC, you'll need to read the full
thread, since some fixes were necessary.

-Nilson Santos F. Jr.

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


[Catalyst] Can PL/pgSQL be called from DBIx::Class Interface?

2006-12-26 Thread Dennis Daupert
I'm asking here instead of DBIx::Class newsgroup cuz I seldom have db questions 
(and most of what goes on there is over my head anyway :)

I'm following an O'reilly article on writing PostgreSQL Functions with PL/pgSQL:

http://www.onlamp.com/lpt/a/6573

Most of my Catalyst/db acitivity is through DBIx::Class, but seems like some 
interactions could use the db's native programming features to great advantage. 
One of the functions to add tags would be called like this:

SELECT entry_coll_tag_add(24, '{223,12,52}');

Is there a 'conduit' in the ORM's interface to send such selects to?

/dennis


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


[Catalyst] Re: How do I pull out HTML::Widget result values?

2006-12-26 Thread Dennis Daupert
mark at itsolve sed:

> my $p = $c->req->params; 
> # We know that the params are valid now... 

Mark, thanks for the reply. That's the solution I had come to; the request 
object IS just sitting there, after all. I was hoping to be able to do it all 
from the widget object for the sake of consistency, and to avoid the extra 
overhead of copying the req parameters into the stash for display in the 
template. But I'll settle for what works! 

/dennis

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


[Catalyst] Advent Calendar

2006-12-26 Thread Jon
I'd like to throw in a vote of thanks and commendation to all who
invested their time and effort into putting together the 2006 advent
calendar.  This kind of "task-oriented" narrative is invaluable both as
learning material and for prompting the ol' brain into thinking how
these things could be applied.

I would like to make one small suggestion - would it be possible to add
a table of contents?  (As in a list of titles rather than dates). It's a
great resource and a TOC would make it much easier to refer back to the
various articles at a later time.

Regards,

-- 

Jon




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


Re: [Catalyst] How do I pull out HTML::Widget result values?

2006-12-26 Thread Mark Zealey
I usually just do sth like:

if($result->have_errors) { display form; return }

# otherwise:
my $p = $c->req->params;
# We know that the params are valid now...

Mark

On Tuesday 26 December 2006 6:01 pm, Dennis Daupert wrote:
> This is throwing me down the stairs. I'm trying to pull out individual form
> element values to do things with. I have a working form with settings like:
>
> ==
> my $w = $c->widget('write_msg_form')->method('post');
> $w->element('Textfield', 'sndr_email'
> )->label('Email')->size(50)->value(''); 
> my $result = $w->process($c->req);
> 
> $c->stash->{widget_result} = $w->result;
> ==
>
> In my tt template this works fine:
>
> [% widget_result.container %]
>
> But nothing I've tried has successfully retrieved stuff like the value of
> the sndr_email field. (Trying to follow doc for HTML::Widget::Result, but
> I'm having a disconnect going from the generically presented lists of
> methods to actual correctly formatted perl.) How to do this?
>
> /dennis

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


Re: [Catalyst] logging in - redirecting

2006-12-26 Thread Juan Miguel Paredes

Hi, Octavian...


sub end : Private {
my ( $self, $c ) = @_;
$c->forward( $c->view('TT'));
}

sub end : ActionClass('RenderView') {}



Doesn't it sound like a deja-vu somewhere? :)

Also, maybe you would like something as:

sub end : ActionClass('RenderView') {
 $c->forward( $c->view('TT') ) unless $c->response->body; #note the unless
}

since you're specifying some $c->response->body for debug in some
cases, preventing this way from forwarding to template-toolkit view.

Greetings!

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


Re: [Catalyst] Catalyst on Windows

2006-12-26 Thread Octavian Rasnita

From: "Nilson Santos Figueiredo Junior" <[EMAIL PROTECTED]>


Of course, some things just can't be done (e.g.
Cache::FastMmap didn't support Windows until recently)


Does Cache::FastMmap support Windows now?
I have tried installing it with ppm, but I couldn't find it, and using cpan, 
but it gave errors.


If it doesn't work it is not a big issue, because I can use another module 
for testing under Windows, but it would be nice to be able to use the same 
modules.


Thanks.

Octavian




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


[Catalyst] logging in - redirecting

2006-12-26 Thread Octavian Rasnita

Hi,

I am trying to create a login system, but it gives a 404 Not Found error 
(only when the username and the password are correct).


The program starts by printing an empty login form, with no message. If the 
form is submitted empty, it is printed again and it also prints a message 
telling that the user/password should be typed.
If the user/password are typed but one of them are not correct, the program 
prints again the form, with an error message that tells this. All these work 
fine.


If the user/password are correct, the program gives a 404 Not Found error 
(for /login, the same url that also printed that login form), and I don't 
know why.
I have tried making a redirection, a forward, printing a simple text 
message, but with no success.


This happends with Apache2 and mod_perl. If I run it using Catalyst testing 
server with -k parameter, it works fine.
If I use it without -k, it gives the 404 Not Found error in more situations 
than when running it with Apache.


Please tell me what can I do to make it work.

Here is the content of the sub index : Private, the only subroutine from 
Controller/Login:


sub index : Private {
   my ( $self, $c ) = @_;

my $username = $c->request->params->{username} || "";
my $password = $c->request->params->{password} || "";

if ($username and $password) {
if ($c->login($username, $password)) {
$c->response->body("The login was correct.");
return;
#I have also tried $c->forward and $c->response->redirect with no success.
}
else {
$c->stash->{error_msg} = "The username or password are not correct. Please 
try again.";

$c->stash->{template} = "login.tt";
return;
}
}

$c->stash->{error_msg} = "Please type your username and password." if 
$c->request->params->{submit};


$c->stash->{template} = "login.tt";
}

And here is the content of Controller/Root.pm (only the subroutines):

sub auto : Private {
my ($self, $c) = @_;

if ($c->controller eq $c->controller('Login')) {
return 1;
}

if (!$c->user_exists) {
$c->response->redirect($c->uri_for("/login"));
return 0;
}

$c->stash->{template} = "index.tt";
return 1;
}

sub default : Private {
my ( $self, $c ) = @_;
$c->stash->{template} = "index.tt";
$c->forward($c->view('TT'));
}

sub end : Private {
my ( $self, $c ) = @_;
$c->forward( $c->view('TT'));
}

sub end : ActionClass('RenderView') {}

Thank you very much for any idea.

Octavian


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


[Catalyst] How do I pull out HTML::Widget result values?

2006-12-26 Thread Dennis Daupert
This is throwing me down the stairs. I'm trying to pull out individual form 
element values to do things with. I have a working form with settings like:

==
my $w = $c->widget('write_msg_form')->method('post');
$w->element('Textfield', 'sndr_email' )->label('Email')->size(50)->value('');

my $result = $w->process($c->req);

$c->stash->{widget_result} = $w->result;
==

In my tt template this works fine:

[% widget_result.container %]

But nothing I've tried has successfully retrieved stuff like the value of the 
sndr_email field. (Trying to follow doc for HTML::Widget::Result, but I'm 
having a disconnect going from the generically presented lists of methods to 
actual correctly formatted perl.) How to do this?

/dennis


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


Re: [Catalyst] Catalyst on Windows

2006-12-26 Thread Nilson Santos Figueiredo Junior

On 12/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

A recent version of ActiveState Perl, the "mingw" package/environment, a
well configured CPAN and CPANPLUS and finally PPM (with such extra
repositories such as the one provided by Randy Kobes) makes installing
modules (and Catalyst) an almost painless effort. I'm not saying
*everything* works but until now I did not encounter a real show-stopper.


I share this feeling. I usually surprised about the amount of trouble
people seem to be getting into while trying to install / use Catalyst
under Windows. Of course, some things just can't be done (e.g.
Cache::FastMmap didn't support Windows until recently) and there's
nothing you can do about it. But these are exceptions.

I successfully develop Catalyst applications under Windows and deploy
them on Linux and I actually face far *less* problems than other
developers which prefer Linux (we can use our OS of choice here, as
long as we're productive).

Of course there is some ocasional breakage when updating some
previously working module due to the authors not being Windows users
(mainly on modules which are wrapper around C libraries). But these
are rare and the authors are usually more than glad to fix them when
they get to know about the issue.

-Nilson Santos F. Jr.

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


[Catalyst] Catalyst on Windows

2006-12-26 Thread Karl . Moens


Recently there have been a number of messages relating to the difficulties
of installing Catalyst on Windows.

Although installing Perl-modules on Windows-machines is always a bit
difficult, I find that Catalyst and its related modules are not more
difficult to install than the average other module.

A recent version of ActiveState Perl, the "mingw" package/environment, a
well configured CPAN and CPANPLUS and finally PPM (with such extra
repositories such as the one provided by Randy Kobes) makes installing
modules (and Catalyst) an almost painless effort. I'm not saying
*everything* works but until now I did not encounter a real show-stopper.

YMMV of course, but before blaming Catalyst, perhaps it can do no harm if
you first check your own set-up and see if you can install other modules
without trouble.

"Hats off" to the Catalyst developers who truly succeeded in bringing us
this wonderful framework!

Best regards,

Karl Moens
aka CountZero on Perlmonks.org






~~~
This message and any attachments are confidential. If you have received
this message in error please delete it from your system. If you require any
assistance please notify the sender. Thank You.
~~~


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


Re: [Catalyst] schema

2006-12-26 Thread Jonas Alves

  my $barneys = $c->model('DB::Person')->search({name => 'barney'});

instead of

  my $schema = $c->model('DB');
  my $barnes = $schema->resultset('Person')->search({name => 'barney'});

And I don't think Model::DBIC::Schema pays attention to the default_model
setting.



He can use the default_model setting and use
$c->model->resultset('Person') to get the Person resultset.

--
Jonas

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