[Catalyst] forward not working correctly ?

2015-01-29 Thread Luca Ferrari
Hi all,
I'm surely missing something in my action:


sub edit : Local Form {
my ( $self, $c, $id ) = @_;
my $form = $self-formbuilder();

   ...
if ( $is_form_ok ){
...
$c-forward( 'list' );
   } else {
 ...
   }
}


The result is that the same page (the form for the edit action) is
always rendered, even if all the business logic works fine.
detach is not working as I'm expecting too, and  only visit appears to
render the list action, but without changing the url.

The development server console provides me the call chain:
/workers/edit
 - /workers/list
 /end
- Smickets::View::HTML-process

I'm using TTSite as my view.
What am I missing?

Thanks,
Luca

___
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] problem with DBIx, Catalyst and PostgreSQL

2015-01-29 Thread Luca Ferrari
Oh what a shame!
Apologize for the noise, the model was 'Smickets::Worker' and not
'Smickets::Workes'.
I found out dumping the $c-model( 'Smickets' ) hash

Sorry for the noise.

Luca

On Thu, Jan 29, 2015 at 11:20 AM, Luca Ferrari fluca1...@infinito.it wrote:
 Hi all,
 I'm working on an application and I've a problem I cannot resolve.
 I've a postgresql database with a workers table, loggin of queries is on.
 I've created the schema with:

 % perl script/smickets_create.pl model SmicketsDB DBIC::Schema
 Smickets::Schema create=static dbi:Pg:dbname=smicketsdb username
 password

 and I've got the Result for the table Workers in
 lib/Smickers/Schema/Result/Workers.pm.
 So everything seems fine to me, but when in my controller I try to do:


 my $workers = $c-model( 'SmicketsDB::Workers' )-all();

 I got the following error:

 Caught exception in Smickets::Controller::Workers-list Can't call
 method all on an undefined value at
 /mnt/ada1a/sviluppo/Perl/Smickets/script/../lib/Smickets/Controller/Workers.pm
 line 35.

 I've checked that the database connection info is ok, and that the
 table contains some data. Moreover, I cannot see any query running
 against the database.
 What am I missing?

 Thanks,
 Luca

___
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] problem with DBIx, Catalyst and PostgreSQL

2015-01-29 Thread Luca Ferrari
Hi all,
I'm working on an application and I've a problem I cannot resolve.
I've a postgresql database with a workers table, loggin of queries is on.
I've created the schema with:

% perl script/smickets_create.pl model SmicketsDB DBIC::Schema
Smickets::Schema create=static dbi:Pg:dbname=smicketsdb username
password

and I've got the Result for the table Workers in
lib/Smickers/Schema/Result/Workers.pm.
So everything seems fine to me, but when in my controller I try to do:


my $workers = $c-model( 'SmicketsDB::Workers' )-all();

I got the following error:

Caught exception in Smickets::Controller::Workers-list Can't call
method all on an undefined value at
/mnt/ada1a/sviluppo/Perl/Smickets/script/../lib/Smickets/Controller/Workers.pm
line 35.

I've checked that the database connection info is ok, and that the
table contains some data. Moreover, I cannot see any query running
against the database.
What am I missing?

Thanks,
Luca

___
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] forward not working correctly ?

2015-02-01 Thread Luca Ferrari
CIao,

On Thu, Jan 29, 2015 at 6:28 PM, QE :: Felix Ostmann ostm...@qe.de wrote:
 Hi,

 i guess you are confused by all the different type of redirects, forwards,
 visits ...

 After your explanation i think you want a HTTP-Redirect
 (http://www.catalystframework.org/calendar/2007/13) / redirect_to_action

 Please read about visit, go, forward and detach in the documentation:
 (
 http://search.cpan.org/~jjnapiork/Catalyst-Runtime-5.90082/lib/Catalyst.pm
 )


Thanks, I was misleaded by a wrong example.

Luca

___
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] question about authorization and roles

2015-02-10 Thread Luca Ferrari
Ciao,
this is what I did in order to get more info:

# in the controller

if ( ! $c-check_any_user_role( qw/Admin Manutentore/ ) ) {
$c-stash-{ message } = User exists  . $c-user_exists() .
 - with username  . $c-user-username .  and roles \
 . $c-user-roles_to_string .  and the check is  .
$c-check_any_user_role(  qw/Admin Manutentore/ );
my @roles = $c-user-users_roles-all();
@roles = map { $_-role-pk .  =  . $_-role-description }
@roles;
$c-stash-{ message } .= Roles [@roles];
 }


and what is printed is:

User exists 1 - with username fluca1978 and roles [Manutentore] and
the check is 0Roles [12 = Manutentore]

so:
1) the user exists
2) the username is correct
3) the user has one role, the description of the role is matched
4) the check_any_user_role reports false (0)
5) the lookup of all the roles reports the right primary key and description.

Any idea about what I'm missing?

Thanks,
Luca

On Mon, Feb 9, 2015 at 9:43 PM, Luca Ferrari fluca1...@infinito.it wrote:
 Ciao,

 On Mon, Feb 9, 2015 at 6:12 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:

 Perhaps it's a stupid question, but have you checked that the user exists?

 if ( $c-user_exists()  ...



 Apparently it exists because I print the username and its role list to
 check...and of course the role is there.

 Luca

___
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] question about authorization and roles

2015-02-11 Thread Luca Ferrari
On Tue, Feb 10, 2015 at 9:26 AM, Dmitry L. dim0...@gmail.com wrote:
 What do you get in debug console output?
 By code (Catalyst::Plugin::Authorization::Roles) you have to see
 something like this:
 Role denied: @roles


This is what appears in the debug console:

[debug] Path is tickets/list
[debug] Found sessionid 382d4de8c7ec3a66712bf2f6b3c09bea1b180235 in cookie
[debug] Restored session 382d4de8c7ec3a66712bf2f6b3c09bea1b180235
[debug] GET request for tickets/list from 192.168.200.1
[debug] running ACL rule CODE(0x2b93a488) defined at
/mnt/ada1a/sviluppo/Perl/Smickets/script/../lib/Smickets.pm line 85 on
tickets/list
[debug] Form (tickets/list): Looking for config file tickets/list.fb
[debug] Form (tickets/list): Found form config
/mnt/ada1a/sviluppo/Perl/Smickets/root/forms/tickets/list.fb
[debug] Rendering template tickets/list.tt2



please note that in my application config I've an ACL entry as follows:

_PACKAGE__-allow_access_if_any( '/tickets', [ qw/Admin Manutentore/ ] );

I don't know if this is interfering with the test I'm performing, but
the result is that even if the user has the manutentore role it is
not evaluated as such.

Any idea?

Thanks,
Luca

___
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] question about authorization and roles

2015-02-09 Thread Luca Ferrari
Ciao,

On Mon, Feb 9, 2015 at 6:12 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:

 Perhaps it's a stupid question, but have you checked that the user exists?

 if ( $c-user_exists()  ...



Apparently it exists because I print the username and its role list to
check...and of course the role is there.

Luca

___
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] question about authorization and roles

2015-02-09 Thread Luca Ferrari
Hi all,
I'm trying to setup the authorization in an application, and therefore
in my controller method I've something like the following:

if ( ! $c-check_any_user_role( qw/Admin Manutentore/ ) ){  }

and the above is always failing. At first I thought I was missing
something with the role configuration, but in my application I also
use ACLS that to the same path are configured as follows (and do
work):

if ( ! $c-check_any_user_role( qw/Admin Manutentore/ ) )

The configuration of the application is as follows:


__PACKAGE__-config('Plugin::
Authentication' = {
default_realm = 'members',
realms = {
members = {
credential = {
class = 'Password',
password_field = 'password',
password_type = 'clear'
},
store = {
class = 'DBIx::Class',
user_model = 'SmicketsDB::User',
role_relation = 'roles',
role_field = 'description',
}
}
}
});


Any idea about?

Thanks,
Luca

___
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] [OT] catalyst hosting

2015-02-24 Thread Luca Ferrari
Hi,
having a catalyst application, which hosting provider would you
suggest to use for it?
I mean, without starting a flame on advertising, is there anything
providing more support to Perl/Catalyst than others?

Thanks,
Luca

___
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] [OT] catalyst hosting

2015-02-24 Thread Luca Ferrari
On Tue, Feb 24, 2015 at 1:02 PM, Dimitar Petrov mita...@gmail.com wrote:
 Are you asking for shared hosting?

Yes

 I just love linode and will recommend
 those guys

I was not aware of this service, I will give a look.

Thanks,
Luca

___
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] Sending 3000 emails.

2015-12-11 Thread Luca Ferrari
On Thu, Nov 26, 2015 at 4:32 PM, Andrew  wrote:
> I just want to know why the whole FastCGI Plack loaded Catalyst app came
> down half way through,
> and how I can have a Perl script process sending 3000 emails without that
> happening every time, =S.
>

As pointed out already the main problem here is that you are trying to
do stuff (sending email) within the app thread, that is you are
breaking the app design and should use a batch/background thread to do
intensive work (even reading all the emails from database could be a
problem, depending on how you do the query and how optimized is the
database).
I would pick up at least an email alias, that can be easibly
auto-generated and updated each time a new user joins. This way you
are at least hiding the 3000+ receivers behind a single email, letting
the email software to do the stuff it has been built for.
The next step would be to use a mailing list, internal or external.
The only reason I could see for looping thru every email address could
be to store in the database the result of the sending process, which
is in my opinion worthless.

Luca

___
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/