Re: [Catalyst] Static::Simple plugin does not load

2017-04-26 Thread Alex Povolotsky

Yes.

On 23.04.2017 7:22, mallah wrote:

is it resolved now ?

regd s
mallah



Sent from my Samsung Galaxy smartphone.

 Original message 
From: Alex Povolotsky 
Date: 4/21/17 16:33 (GMT+05:30)
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Static::Simple plugin does not load

Well, it did not serve anything, silently.

After lots of research, I've found in root directory kdbe.yaml and
kdbe.conf, the later is nginx config. Catalyst read it as well as .yaml
and somehow it made Static::Simple disappointed so much that it did not
serve anything...

On 16.04.2017 9:03, Rajesh Kumar Mallah wrote:

Hello

I've installed a new Catalyst environment from scratch, and
Static::Simple does not show up in list of loaded plugins and does not
work.


Hi

Could you elaborate on "does not work" ,
you may post the logs that indicate the processing
of a request for static object (gif,css,js etc).


regds
mallah.








Catalyst-Action-RenderView-0.16_1
Catalyst-Devel-1.39
Catalyst-Plugin-ConfigLoader-0.34_1
Catalyst-Plugin-Static-Simple-0.33
Catalyst-Runtime-5.90114

I'll try to debug it out, but maybe someone has run into that problem
already?

Alex

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







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



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


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



___
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] Static::Simple plugin does not load

2017-04-21 Thread Alex Povolotsky

Well, it did not serve anything, silently.

After lots of research, I've found in root directory kdbe.yaml and 
kdbe.conf, the later is nginx config. Catalyst read it as well as .yaml 
and somehow it made Static::Simple disappointed so much that it did not 
serve anything...


On 16.04.2017 9:03, Rajesh Kumar Mallah wrote:

Hello

I've installed a new Catalyst environment from scratch, and
Static::Simple does not show up in list of loaded plugins and does not
work.


Hi

Could you elaborate on "does not work" ,
you may post the logs that indicate the processing
of a request for static object (gif,css,js etc).


regds
mallah.








Catalyst-Action-RenderView-0.16_1
Catalyst-Devel-1.39
Catalyst-Plugin-ConfigLoader-0.34_1
Catalyst-Plugin-Static-Simple-0.33
Catalyst-Runtime-5.90114

I'll try to debug it out, but maybe someone has run into that problem
already?

Alex

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







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



___
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] Static::Simple plugin does not load

2017-04-15 Thread Alex Povolotsky

Hello

I've installed a new Catalyst environment from scratch, and 
Static::Simple does not show up in list of loaded plugins and does not work.


Catalyst-Action-RenderView-0.16_1
Catalyst-Devel-1.39
Catalyst-Plugin-ConfigLoader-0.34_1
Catalyst-Plugin-Static-Simple-0.33
Catalyst-Runtime-5.90114

I'll try to debug it out, but maybe someone has run into that problem 
already?


Alex

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


Re: [Catalyst] Catalyst and unicode: broken or I'm dumb?

2014-02-24 Thread Alex Povolotsky

On 02/24/14 20:29, Alex Povolotsky wrote:

You dumbass missed use utf-8; in EVERY of your modules.

EVERY means EVERY, not just Kukso.


Hello

I cannot get VERY simple code with UTF-8 to work.

Let's see

=== cut Kukso.pm ===
use utf-8;
use Catalyst
qw/
+CatalystX::SimpleLogin
Authentication
Session
Session::State::Cookie
Session::Store::FastMmap
ConfigLoader
Static::Simple
Unicode::Encoding
/;
=== cut ===

=== cut HTML.pm ===
package Kukso::View::HTML;

use strict;
use base 'Catalyst::View::TT';

__PACKAGE__->config({
INCLUDE_PATH => [
Kukso->path_to( 'root', 'src' ),
Kukso->path_to( 'root', 'lib' )
],
PRE_PROCESS => 'config/main',
WRAPPER => 'site/wrapper',
ERROR => 'error.tt2',
TIMER => 0,
render_die => 1,
TEMPLATE_EXTENSION => '.tt2',
ENCODING => 'utf-8',
});

=== cut ===

=== cut Root.pm ===
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
$c->log->info("Что за нафиг?");
$c->stash->{title} = "Список аккаунтов";
}
=== cut ===

I'm getting proper UTF-8 output in $c->log, but...

HTTP/1.0 200 OK
Date: Mon, 24 Feb 2014 16:19:20 GMT
Server: HTTP::Server::PSGI
Content-Length: 631
Content-Type: text/html; charset=utf-8
X-Catalyst: 5.90053

http://www.w3.org/1999/xhtml";>

http://0:3000/static/css/main.css"; 
type="text/css" />

Список аккаунтов



Список аккаунтов



garbled unicode in HTML output.

I've checked everything - but either something has changed and is not 
reflected in manuals yet or I've overlooked some simple thing.


Alex

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

Dev site: http://dev.catalyst.perl.org/



___
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] Catalyst and unicode: broken or I'm dumb?

2014-02-24 Thread Alex Povolotsky

Hello

I cannot get VERY simple code with UTF-8 to work.

Let's see

=== cut Kukso.pm ===
use utf-8;
use Catalyst
qw/
+CatalystX::SimpleLogin
Authentication
Session
Session::State::Cookie
Session::Store::FastMmap
ConfigLoader
Static::Simple
Unicode::Encoding
/;
=== cut ===

=== cut HTML.pm ===
package Kukso::View::HTML;

use strict;
use base 'Catalyst::View::TT';

__PACKAGE__->config({
INCLUDE_PATH => [
Kukso->path_to( 'root', 'src' ),
Kukso->path_to( 'root', 'lib' )
],
PRE_PROCESS => 'config/main',
WRAPPER => 'site/wrapper',
ERROR => 'error.tt2',
TIMER => 0,
render_die => 1,
TEMPLATE_EXTENSION => '.tt2',
ENCODING => 'utf-8',
});

=== cut ===

=== cut Root.pm ===
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
$c->log->info("Что за нафиг?");
$c->stash->{title} = "Список аккаунтов";
}
=== cut ===

I'm getting proper UTF-8 output in $c->log, but...

HTTP/1.0 200 OK
Date: Mon, 24 Feb 2014 16:19:20 GMT
Server: HTTP::Server::PSGI
Content-Length: 631
Content-Type: text/html; charset=utf-8
X-Catalyst: 5.90053

http://www.w3.org/1999/xhtml";>

http://0:3000/static/css/main.css"; 
type="text/css" />

Список аккаунтов



Список аккаунтов



garbled unicode in HTML output.

I've checked everything - but either something has changed and is not 
reflected in manuals yet or I've overlooked some simple thing.


Alex

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


[Catalyst] DBIx::Class::Core does not define $DBIx::Class::Core::VERSION--version check failed at /usr/local/lib/perl5/site_perl/5.16/Module/Runtime.pm line 386.

2014-02-17 Thread Alex Povolotsky

Hello

I've started an application with Catalyst, added some fairly simple and 
tested code, and got an error


Couldn't instantiate component "Monitor::Model::DB", "{UNKNOWN}: 
DBIx::Class::Core does not define $DBIx::Class::Core::VERSION--version 
check failed at /usr/local/lib/perl5/site_perl/5.16/Module/Runtime.pm 
line 386.
Compilation failed in require at 
/usr/local/lib/perl5/site_perl/5.16/Class/C3/Componentised.pm line 150. 
at /usr/local/lib/perl5/site_perl/5.16/Class/C3/Componentised.pm line 155
Compilation failed in require at 
/usr/local/lib/perl5/site_perl/5.16/Catalyst/Restarter/Forking.pm line 20.



here is a list of my Catalyst-related modules

p5-Catalyst-Action-REST-1.14   Automated REST Method Dispatching for 
Catalyst

p5-Catalyst-Action-RenderView-0.16 Sensible default end action for Catalyst
p5-Catalyst-ActionRole-ACL-0.07 User role-based authorization action class
p5-Catalyst-Authentication-Store-DBIx-Class-0.1505 A storage class for 
Catalyst Authentication using DBIx::Class
p5-Catalyst-Component-InstancePerContext-0.001001 Return a new instance 
a component on each request

p5-Catalyst-Controller-ActionRole-0.15 Apply roles to action instances
p5-Catalyst-Controller-FormBuilder-0.06 Catalyst FormBuilder Base Controller
p5-Catalyst-Devel-1.38 Catalyst Development Tools
p5-Catalyst-DispatchType-Regex-5.90.032 Regex DispatchType
p5-Catalyst-Model-DBIC-Schema-0.62_1 DBIx::Class::Schema Model Class
p5-Catalyst-Plugin-Authentication-0.10023_1,3 Infrastructure plugin for 
the Catalyst authentication framework

p5-Catalyst-Plugin-ConfigLoader-0.32 Load config files of various types
p5-Catalyst-Plugin-FormBuilder-1.07_1 FormBuilder for Catalyst
p5-Catalyst-Plugin-Session-0.39 Generic Catalyst Session plugin
p5-Catalyst-Plugin-Session-State-Cookie-0.17 Stores a Catalyst Session 
in a Cookie
p5-Catalyst-Plugin-Session-Store-FastMmap-0.16 FastMmap session storage 
backend
p5-Catalyst-Plugin-Session-Store-File-0.18 File storage backend for 
session data

p5-Catalyst-Plugin-Static-Simple-0.31 Make serving static pages painless
p5-Catalyst-Plugin-Unicode-0.93 Unicode aware Catalyst
p5-Catalyst-Runtime-5.90053The Elegant MVC Web Application Framework 
(Runtime)

p5-Catalyst-View-TT-0.41   Template Toolkit view class for Catalyst
p5-CatalystX-Component-Traits-0.16 Automatic Trait Loading and 
Resolution for Catalyst Components
p5-CatalystX-InjectComponent-0.025 Inject components into your Catalyst 
application
p5-CatalystX-SimpleLogin-0.18  Provide a simple Login controller which 
can be reused

p5-Test-WWW-Mechanize-Catalyst-0.58 Test::WWW::Mechanize for Catalyst

DBIx::Class::Core indeed does not define $VERSION, it is defined in 
DBIx::Class, autogenerated Schema::Result modules uses 
DBIx::Class::Core, but did not attempt to check VERSION


Is any of my modules totally outdated?

Alex

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


[Catalyst] Stupid error with C::Authentication

2013-08-26 Thread Alex Povolotsky

Hello

In a quite simple application

__PACKAGE__->config('Plugin::Authentication' =>
{
 default_realm => 'members',
 realms => {
members => {
credential => {
   class => 
'+Admin::Util::OldPassword',

password_field => 'password',
password_type => 'self_check',
  },
store => {
  class => 
'DBIx::Class',
  user_model => 
'DB::InfEmployeeTab',

 }
   }
   }
});

Later, in Controller::Root

$c->authenticate( { login => 'login', password => 'password' } );

(I'm just checking if everything is wired properly)

I get

[error] Caught exception in Admin::Controller::Root->index "Can't use 
string ("Catalyst::Authentication::Store:"...) as a HASH ref while 
"strict refs" in use at accessor 
Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at 
/usr/local/lib/perl5/site_perl/5.14/Catalyst/Authentication/Store/DBIx/Class/User.pm 
line 12) line 5,  line 1003."


My password class has nothing to get wrong, and replacing it with 
default C::A::Credential::Password does not change anything


running under perl -d , script works just fine. Running without debug 
mode, it does not even reach my module.


I have no idea where to look next.

Here is debug output

Caught exception in Admin::Controller::Root->index "Can't use string 
("Catalyst::Authentication::Store:"...) as a HASH ref while "strict 
refs" in use at accessor 
Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at 
/usr/local/lib/perl5/site_perl/5.14/Catalyst/Authentication/Store/DBIx/Class/User.pm 
line 12) line 5,  line 1003."


Request

do {
  require Symbol;
  my $a = bless({
_log => bless({
  _body => "[info] *** Request 1 (0.333/s) 
[19146] [Mon Aug 26 19:44:43 2013] ***\n[debug] Path is \"/\"\n[debug] 
\"GET\" request for \"/\" from \"195.170.223.197\"\n[error] Caught 
exception in Admin::Controller::Root->index \"Can't use string 
(\"Catalyst::Authentication::Store:\"...) as a HASH ref while \"strict 
refs\" in use at accessor 
Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at 
/usr/local/lib/perl5/site_perl/5.14/Catalyst/Authentication/Store/DBIx/Class/User.pm 
line 12) line 5,  line 1003.\"\n",

  _psgi_errors => *main::STDERR,
  level => 31,
}, "Catalyst::Log"),
_path=> "",
_read_length => 0,
_read_position   => 0,
action   => "/",
address  => "195.170.223.197",
arguments=> [],
base => bless(do{\(my $o = 
"http://corp.infotel.ru:3000/";)}, "URI::http"),

body_parameters  => {},
captures => [],
cookies  => {
  admin_session => bless({
name  => "admin_session",
path  => "/",
value => 
["ecf2b994cddc2aa02145005778961e5a06774b3b"],

  }, "CGI::Simple::Cookie"),
  e37551640d343da16a59042e6370102e => bless({
name  => "e37551640d343da16a59042e6370102e",
path  => "/",
value => ["jac13b5c06jqd96vn57dbjpgh6"],
  }, "CGI::Simple::Cookie"),
  PHPSESSID => bless({
name  => "PHPSESSID",
path  => "/",
value => ["meutdakp8mgf9to12iaq01dkh3"],
  }, "CGI::Simple::Cookie"),
},
env  => {
  "HTTP_ACCEPT"  => 
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",

  "HTTP_ACCEPT_ENCODING" => "gzip,deflate,sdch",
  "HTTP_ACCEPT_LANGUAGE" => 
"en-US,en;q=0.8,ru;q=0.6",

  "HTTP_CACHE_CONTROL"   => "max-age=0",
  "HTTP_CONNECTION"  => "keep-alive",
  "HTTP_COOKIE"  => 
"e37551640d343da16a59042e6370102e=jac13b5c06jqd96vn57dbjpgh6; 
PHPSESSID=meutdakp8mgf9to12iaq01dkh3; 
admin_session=ecf2b994cddc2aa02145005778961e5a06774b3b",

  "HTTP_HOST"=> "corp.infotel.ru:3000",
  "HTTP_PRAGMA"  => "no-cache",
  "HTTP_USER_AGENT"  => "Mozilla/5.0 (X11; 
FreeBSD amd64) AppleWebKit/537.36 (KHTML,

[Catalyst] Adding CaptureArgs for the whole controller?

2013-04-02 Thread Alex Povolotsky

Hello!

I'm implementing some sort of simple CRM, and I'd like to handle a chain 
like


/domain/*/service/*/edit with controller 
App::Controller::Domain::Service, not with App::Controller::Domain


How can I set CaptureArgs for the whole 
App::Controller::Domain::Service? I'd like to handle captured arg 
somewhere in begin or auto


Alex



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


Re: [Catalyst] X-Forwarded-Port works no more?

2012-07-23 Thread Alex Povolotsky

On 07/23/12 21:52, Tomas Doran wrote:

On 23 Jul 2012, at 08:48, Alex Povolotsky wrote:


Hello,

I'm setting up MojoMojo, https-protected.

However, it keeps making http: urls.

Setting X-Forwarded-Port did not help a bit, and trying to grep 
X-Forwarded-Port to 443 did not help as well.

I've set fastcgi_param HTTPS 1, and it helps, but why X-Forwarded-Port is 
mentioned but does not work?


Your post implies that your running the app as an FCGI, however you're caring 
about X-Forwarded headers, which are only relevant if you're running the app 
behind a proxy.

Which (or both) of these are you specifying?

Can you show us your web server config, and app config?



Yes, FCGI

=== nginx.conf ===
server {
   listen   443;
   server_name  wiki.example.com;

   ssl  on;
   ssl_certificate  dev.crt;
   ssl_certificate_key  dev.key;

   ssl_session_timeout  5m;

   ssl_protocols  SSLv2 SSLv3 TLSv1;
   ssl_ciphers  HIGH:!aNULL:!MD5;
   ssl_prefer_server_ciphers   on;

location /static {
 root /usr/local/share/mojomojo/root;
}
location / {
 proxy_set_header X-Forwarded-Port 443;
 include fastcgi_params;
 client_max_body_size 128m;
 proxy_read_timeout 600;
 proxy_connect_timeout 600;
 fastcgi_param HTTPS 1; # Only this line helps
 fastcgi_pass  unix:/tmp/.mojomojo.socket;

}
#error_page  404  /404.html;

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   /usr/local/www/nginx-dist;
}
}

=== mojomojo.conf ===
name  MojoMojo
using_frontend_proxy 1
# other settings are 100% irrelevant to FCGI

=== run script ===
#!/bin/sh
exec setuidgid www envdir ./env /usr/local/bin/mojomojo_fastcgi.pl -l 
/tmp/.mojomojo.socket -n 4 -e --proc_title MojoMojo



___
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] X-Forwarded-Port works no more?

2012-07-23 Thread Alex Povolotsky

Hello,

I'm setting up MojoMojo, https-protected.

However, it keeps making http: urls.

Setting X-Forwarded-Port did not help a bit, and trying to grep 
X-Forwarded-Port to 443 did not help as well.


I've set fastcgi_param HTTPS 1, and it helps, but why X-Forwarded-Port 
is mentioned but does not work?


Alex

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


Re: [Catalyst] Paging problem

2012-04-27 Thread Alex Povolotsky
On 04/28/12 00:05, Kenneth S Mclane wrote:
>
>
> ok, I tried this:
>
> my ($self, $c, $page) = @_;
>
> and my template code is issueing uri's like this:
>
> http://localhost:3000/accountview/list?page=4
> 
>
> Do I need to remove this line:
>
>  my $page = 1;
It depends on what do you need. If you want paging to work, you'd better
don't hardcode 1st page.

Alex
P.S. Never try to copypaste a working program/config file. Always
understand what are you doing. Each time I've tried to copypaste more or
less complex thing, I've spent much more time than required for reading
manuals.
___
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] Double encoded UTF in config and string constants

2011-11-05 Thread Alex Povolotsky

On 11/05/11 16:43, Peter Flanigan wrote:

On 05/11/11 10:41, Alexey Illarionov wrote:

On 05.11.2011 13:36, Alex Povolotsky wrote:


How do I make Confg::Any understand that my .conf file is in UTF-8 and
how do I correctly put UTF-8 string constants into code?

__PACKAGE__->config( 'Plugin::ConfigLoader' =>  {
driver =>  {
   'General' =>  { -UTF8 =>  1 }
}
 });

Add use utf8; to any Perl source code files that contain UTF-8 string
constants


Thanks, it works.

Alex


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


[Catalyst] Double encoded UTF in config and string constants

2011-11-05 Thread Alex Povolotsky

Hello!

With Catalyst::Plugin::Unicode::Encoding, data from databases works fine.

Templates in UTF-8 are also OK.

However, data from .conf or UTF-8 constants in code still gets 
double-encoded. Data/constants are UTF-8, but perl for some reason does 
not set UTF-8 flag on them.


What's more strange for me, manually upgrading string to UTF-8 with 
utf8::upgrade does not help.


How do I make Confg::Any understand that my .conf file is in UTF-8 and 
how do I correctly put UTF-8 string constants into code?


Alex.


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


[Catalyst] View for graphs

2011-10-07 Thread Alex Povolotsky

Hello,

what C::V  would you recommend for graph drawing? It should not be 
abandoned by author a year ago at version 0.02 and be more or less 
working and stable.


Alex

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


[Catalyst] I18N and TT question

2011-07-25 Thread Alex Povolotsky

Hello!

How do I define a macro for localization GLOBALLY? I don't like to add 
MACRO to every template, nor I don't want to write c.localize() instead 
of l()


Alex

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


[Catalyst] Catalyst::TraitFor::Model::DBIC::Schema::Caching and default behavior

2011-07-03 Thread Alex Povolotsky

Hello!

How can I set some cache_for to be default for all searches? Without 
explicit cache_for, TraitFor Caching does not seem to do anything but 
load itself.


Alex


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


Re: [Catalyst] Complete example for autocomplete with HTML::FormFu, please

2011-07-02 Thread Alex Povolotsky

On 07/02/11 11:23, Oroszi, Ro'bert wrote:


In my opinion you should use jQueryUI because it's official (very 
efficient team working on it), unlike the simple jQuery plugins.




Sounds reasonable; however, plugin works, jQueryUI not, and I'll try to 
make it work if time permits. Thanks.


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


Re: [Catalyst] Complete example for autocomplete with HTML::FormFu, please

2011-07-01 Thread Alex Povolotsky

On 07/01/11 21:18, Alan Humphrey wrote:

Firebug shows the following as the JSON content returned in their demo:


I've found http://www.devbridge.com/projects/autocomplete/jquery/ - 
works like a charm and well-documented.



Alex

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


Re: [Catalyst] Complete example for autocomplete with HTML::FormFu, please

2011-07-01 Thread Alex Povolotsky

On 06/19/11 13:44, Charlie Garrison wrote:

Good evening,

On 19/06/11 at 12:18 AM +0400, Alex Povolotsky  wrote:

I'm trying to make a form with autocomplete text edit field; I do 
understand general workflow but I still miss some simple-but-complete 
example.


Can anyone please provide me with one? JQuery would be the best.


Ripped and simplified from code I'm using. So can't say it's a 
complete example, but should have all the elements you need to make it 
work.


Well... Nearly works, BUT.

# In template
$(document).ready(function(){
$("#addblack").autocomplete('[% 
c.uri_for('/userinfo','complete_user', 'blacklist') %]');

  });

# In controller
sub complete_user  : Local : Args(1) {
my ($self, $c, $mode) = @_;
my $name = $c->req->param('term');
if ($name gt '') {
my $names;
if ($mode eq 'blacklist') {
$c->log->info('Autocompleting blacklist '.$name);
$names = $c->model('Db::Account')->search({ login => { 
ILIKE => $name.'%' } },
 { columns => 
[qw/login/], limit => 10, order_by => [qw/login/]});

$c->log->info($names->count().' found');
$c->stash->{entity} = [ map { { label => $_->login } } 
$names->all() ];

} else {
die "Wrong mode $mode";
}
$c->stash->{term} = $name;
}
$c->forward('View::JSON');
}

It requests data; it receives data. Autocompletion does not work.


In http://jqueryui.com/demos/autocomplete/, there is NOTHING at all (I 
really do hate them) about suggestions format expected by jQueryUI 
autocomplete.


I've tried every combitation I've managed to invent, but no success.



<http://jqueryui.com/demos/autocomplete/>


package MyApp::Controller::REST;
use Moose;
use namespace::autoclean;

extends qw'Catalyst::Controller::REST';

sub usernames :Chained('') :PathPart('usernames') :ActionClass('REST') 
{ }

sub usernames_GET : Local {
my ( $self, $c ) = @_;
my $query  ||= $c->req->params->{query}  || '';
my $limit  ||= $c->req->params->{limit}  || 250;

my $usernames = $c->model('DBIC::User')->search(
  { username => {'-like', "\%$query\%"}  },
  { order_by => 'username',rows=>$limit  }
);
my @usernames_list = map { {value => $_->id, label => 
$_->username} } $usernames->all;


$self->status_ok(
$c,
entity => \@usernames_list,
);
}

__PACKAGE__->meta->make_immutable;
1;


## edit.yml

  - type: Hidden
name: user_id
constraints:
  - SingleValue
  - Integer
  - type: Block
nested_name: user
elements:
- type: Text
  name: username
  label: User
  model_config:
read_only: 1

## edit.tt2

$(document).ready(function(){
$("#form_user\\.username").autocomplete({
minLength: 2,
source: function( request, response ) {
$.getJSON( "[% c.uri_for_action('/rest/usernames') %]", {
query: request.term
}, response );
},
select: function( event, ui ) {
$( "#form_user\\.username" ).val( ui.item.label );
$( "#form_user_id" ).val( ui.item.value );
return false;
},
});
});



Charlie




___
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] Complete example for autocomplete with HTML::FormFu, please

2011-06-19 Thread Alex Povolotsky

On 06/19/11 13:44, Charlie Garrison wrote:

Good evening,

On 19/06/11 at 12:18 AM +0400, Alex Povolotsky  wrote:

I'm trying to make a form with autocomplete text edit field; I do 
understand general workflow but I still miss some simple-but-complete 
example.


Can anyone please provide me with one? JQuery would be the best.


Ripped and simplified from code I'm using. So can't say it's a 
complete example, but should have all the elements you need to make it 
work.


Thanks, I'll look. For some weird reason copypasted example with JQuery 
did not work at all, while Prototype works OK.


Alex.

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


[Catalyst] Complete example for autocomplete with HTML::FormFu, please

2011-06-18 Thread Alex Povolotsky

Hello!

I'm trying to make a form with autocomplete text edit field; I do 
understand general workflow but I still miss some simple-but-complete 
example.


Can anyone please provide me with one? JQuery would be the best.

Alex

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


[Catalyst] Which JS framework to use?

2011-03-13 Thread Alex Povolotsky

Hello!

I'm QUITE new to JS, and tried my best to evade it, but now I have to 
face that thing.


First of all, I'd need autocompletion and form extension ("Add one more 
field" button, to clone selectbox+text fields)


I understand that it can be done using ANY nowadays framework, but I'd 
also like to easily integrate cloning into HTML::FormFu or maybe 
HTML::FormHandler.


What would you recommend?

Alex.


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


[Catalyst] Something wrong in Catalyst::Model::DBIC::Schema?

2011-02-24 Thread Alex Povolotsky

Hello!

Freshly created application with out-of-the-box 
Catalyst::Model::DBIC::Schema-based model (nothing except creation with 
helper)fails to run, all modules are fresh.


Application just does not run. Have I missed something?

> ./script/ptest_server.pl
Couldn't load class (PTest) because: Couldn't instantiate component 
"PTest::Model::Db", "Couldn't load class (PTest::Schema) because: Can't 
call method "isa" on an undefined value at 
/usr/local/lib/perl5/site_perl/5.12.3/MooseX/NonMoose/Meta/Role/Class.pm 
line 40.
Compilation failed in require at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP.pm line 114.

 at /usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP.pm line 120
Class::MOP::__ANON__('Can\'t call method "isa" on an undefined 
value at /usr/local/...') called at 
/usr/local/lib/perl5/site_perl/5.12.3/Try/Tiny.pm line 100
Try::Tiny::try('CODE(0x804965738)', 
'Try::Tiny::Catch=REF(0x804ecf960)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP.pm line 125
Class::MOP::load_first_existing_class('PTest::Schema') called 
at /usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP.pm line 137
Class::MOP::load_class('PTest::Schema') called at 
/usr/local/lib/perl5/site_perl/5.12.3/Catalyst/Model/DBIC/Schema/Types.pm line 
21
Catalyst::Model::DBIC::Schema::Types::__ANON__('PTest::Schema') 
called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Moose/Meta/TypeCoercion.pm 
line 63
Moose::Meta::TypeCoercion::__ANON__('PTest::Schema') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Moose/Meta/TypeCoercion.pm 
line 97

Moose::Meta::TypeCoercion::coerce('Moose::Meta::TypeCoercion=HASH(0x8049d6300)', 
'PTest::Schema') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Moose/Meta/TypeConstraint.pm 
line 90

Moose::Meta::TypeConstraint::coerce('Moose::Meta::TypeConstraint=HASH(0x804e70b28)', 
'PTest::Schema') called at 
/usr/local/lib/perl5/site_perl/5.12.3/MooseX/Types/TypeDecorator.pm line 206
eval {...} called at 
/usr/local/lib/perl5/site_perl/5.12.3/MooseX/Types/TypeDecorator.pm line 205

MooseX::Types::TypeDecorator::AUTOLOAD('MooseX::Types::TypeDecorator=HASH(0x804e8b0a8)', 
'PTest::Schema') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Moose/Meta/Attribute.pm line 880

Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0x804e66a80)', 
'PTest::Schema', 'PTest::Model::Db=HASH(0x804e72af8)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Moose/Meta/Attribute.pm line 483

Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0x804e66a80)', 
'Moose::Meta::Instance=HASH(0x8049656c0)', 
'PTest::Model::Db=HASH(0x804e72af8)', 'HASH(0x804e71ac8)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP/Class.pm line 603

Class::MOP::Class::_construct_instance('Moose::Meta::Class=HASH(0x804e841f8)', 
'HASH(0x804e71ac8)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP/Class.pm line 576

Class::MOP::Class::new_object('Moose::Meta::Class=HASH(0x804e841f8)', 
'HASH(0x804e71ac8)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Moose/Meta/Class.pm line 256

Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0x804e841f8)', 
'HASH(0x804e71ac8)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Moose/Object.pm line 26
Moose::Object::new('PTest::Model::Db', 'PTest', 
'HASH(0x804eb1d68)') called at generated method (unknown origin) line 3
Catalyst::Model::DBIC::Schema::new('PTest::Model::Db', 'PTest', 
'HASH(0x804eb1d68)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/MooseX/Traits/Pluggable.pm line 139

MooseX::Traits::Pluggable::_build_instance_with_traits('PTest::Model::Db', 
'PTest::Model::Db', 'PTest') called at 
/usr/local/lib/perl5/site_perl/5.12.3/MooseX/Traits/Pluggable.pm line 97
MooseX::Traits::Pluggable::new_with_traits('PTest::Model::Db', 
'PTest', 'HASH(0x8048a54f8)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/CatalystX/Component/Traits.pm line 145
CatalystX::Component::Traits::COMPONENT('PTest::Model::Db', 
'PTest', 'HASH(0x80489d780)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP/Method/Wrapped.pm 
line 48
Class::MOP::Method::Wrapped::__ANON__('PTest::Model::Db', 
'PTest', 'HASH(0x80489d780)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/mach/Class/MOP/Method/Wrapped.pm 
line 89
Catalyst::Model::DBIC::Schema::COMPONENT('PTest::Model::Db', 
'PTest', 'HASH(0x80489d780)') called at 
/usr/local/lib/perl5/site_perl/5.12.3/Catalyst.pm line 2523
eval {...} called at 
/usr/local/lib/perl5/site_perl/5.12.3/Catalyst.pm line 2523
Catalyst::setup_component('PTest', 'PTest::Model::Db') called 
at /usr/local/lib/perl5/site_perl/5.12.3/Catalyst.pm line 2450
Catalyst::setup_components('PTest') called at 
/usr/local/lib/perl5/site_perl/5.12.3/Catalyst.pm line 1179
 

[Catalyst] Forcing scalar context in TT?

2010-12-23 Thread Alex Povolotsky

Hello!

I'm writing an application that needs to count some related objects

[% row.objects.count %] results in "select * from objects"
[% row.objects.scalar.count %] yields an error
[% row.search_related_rs('objects').count %] is UGLY

Do I have any better solution?

Alex.


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


[Catalyst] Catalyst handling big files?

2010-08-13 Thread Alex Povolotsky

Hello!

I'm working on processing relatively big (10+Mb) XML files, and it seems 
to me that Catalyst is taking an awful lot of time on some internal 
processing before call to handler, using surprisingly 200 MBs of RAM 
(about 40 MBs before request)


Can I somehow improve Catalyst's performance?

Alex.


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


[Catalyst] Catalyst::Plugin::Prototype: current state?

2010-03-20 Thread Alex Povolotsky

Hello!

Catalyst::Plugin::Prototype is supplied with Prototype 1.4.0; however, 
http://prototype.conio.net/ does not work at present and 
http://script.aculo.us/ states that current Prototype version is 1.6.1


Can anyont point me at

- interoperability with C::P::P and current Prototype
- maybe other Catalyst JS plugins?

I'm mostly interested in COMPLEX autocompletion right now.

BTW, maybe someone can clue me with my current task

I have a large (1+) database of people, and many-to-many 
relationship people-request, so I should write some form to add people 
to request.


Loading all database into selectbox is not suitable for obvious reason. 
I'd like to write an Ajax-based autocompletion with "add to list" button 
enabled only when selection is fully done.


I'd appreciate any help with solution. I know Perl fairly well but quite 
weak with JS


Alex.

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


Re: [Catalyst] uri_for and unicode

2010-03-09 Thread Alex Povolotsky

On 03/09/10 16:55, Tomas Doran wrote:

Alex Povolotsky wrote:

Catalyst is 5.80020


5.80021 2010-03-03 23:02:01

  Bug fixed:
   - $c->uri_for will now escape unsafe characterss in captures
 ($c->request->captures) and correctly encode utf8 charracters.

Can you try upgrading?

And I'm _very_ interested in test cases / fixing this if this doesn't 
help you..

YEEAH!!! IT WORKS!!! IT WORKS JUST NICE!!!

Alex.


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


Re: [Catalyst] uri_for and unicode

2010-03-09 Thread Alex Povolotsky

On 03/09/10 17:05, Bernhard Graf wrote:


Then you are probably doing it wrong!

I suspect that you want to use cyrillic characters. The problem is, that
most software components (also Perl) default to latin1 or similar.

A good start is always to use utf-8 encoding everywhere: your source
code, your web pages encoding and your database charset.

Always

   use utf8;

in your Perl file!
(unless you are absolutely sure, you are not using any non-ASCII chars)
   

yes

Explicitly set your databases encoding to utf-8 on connect (see the
appropriate DBD::*/DBIC manpages how to do that) and don't use
DBIx::Class::UTF8Columns.

   

yes, yes

Tip for MySQL: To check that your data isn't accidently double-encoded,
you might want to use length(). This function returns the number of
bytes, so e.g. if a field contains the string 'süß', length(field)
returns 5 (because ü and ß are encoded in 2 bytes in utf-8). If it is
not 5, your data encoding is borked.
   


All data is shown correctly, sorted correctly, appears in database 
correctly. Problems arises in uri_for and (so far) only in uri_for


Alex.


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


Re: [Catalyst] uri_for and unicode

2010-03-09 Thread Alex Povolotsky

On 03/09/10 13:47, Bernhard Graf wrote:

Am 09.03.2010 11:26, schrieb Alex Povolotsky:

   

uri_for seems to have some troubles with unicode.
 
   

Use of uninitialized value within %URI::Escape::escapes in substitution
iterator at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst.pm line 1268.
 

I remember, that there was quite a few progress in Cat's Unicode area
recently. Are you using the most recent releases of Catalyst and
Catalyst::Plugin::Unicode::Encoding?
   
After adding Catalyst::Plugin::Unicode::Encoding, it became MUCH worse. 
What was readable, became unreadable. What was unreadable, remained so. 
Replacing C::P::Unicode by C::P::Unicode::Encoding did not yield any 
difference.


Catalyst is 5.80020

Alex.

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


[Catalyst] uri_for and unicode

2010-03-09 Thread Alex Povolotsky

Hello!

uri_for seems to have some troubles with unicode.

The following template part

[% item.name %]

edit


result in warning

Use of uninitialized value within %URI::Escape::escapes in substitution 
iterator at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst.pm line 1268.


and, while displaying correct text in first column, drops every 
non-ascii character in uri_for output.


Alex.



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


[Catalyst] Users, roles, HTML::FormFu::DBIx::Class::Model - complete example?

2010-01-27 Thread Alex Povolotsky

Hello!

Maybe someone can provide the community with complete example of 
users/roles editor with HTML::FormFu::DBIx::Class::Model?


Manual drops to foo:bar explaination too often (


Alex.


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


[Catalyst] How to change base class for autogenerated Schema/* files?

2010-01-18 Thread Alex Povolotsky

Hello!

I'm using Catalyst::Model::DBIC::Schema::Loader and autogenerate 
Schema/*.pm files.


I'd like to add some common functionality to some of them, and I'd 
greatly prefer adding it in one place to copypasting code.


How to I change base class for them? Of course that class should inherit 
from DBIx::Class. I understand.


Alex.


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


[Catalyst] Elegant way to check action presence?

2010-01-09 Thread Alex Povolotsky

Hello!

I'm working on a (more or less) flexible system with plugins should be 
installed just like controllers; some basic information about them 
(particulary, numerical id) must be kept in database.


Plugins should be handle some queries in /admin/service/$servicename

I'd like to put 'smart links' in plugin information table - i.e. if 
something handles /admin/service/$servicename/control, link exists; if 
no - instead of link text in different style is presented, telling that 
plugin has not been installed.


construction like

[% SET path=stype.path %]
[% IF c.can('/admin/service/$path/control') %]

[% ELSE %]
message here
[% END %]

is ugly; maybe someone points me to some nicer idea? I was thinking of 
some function in Schema/Result/Servicetype.pm returning link or warning, 
but how do I access the Catalyst object from it? Or I just have to pass 
it as argument?


Alex.

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


[Catalyst] CATALYST_DEBUG is broken?

2010-01-07 Thread Alex Povolotsky

Hello!

Catalyst::Runtime 5.80016, freshly generated script, nearly empty 
application.


Running with CATALYST_DEBUG=1, on every incoming request

[error] Caught exception in engine "Attribute (_static_debug_message) 
does not pass the type constraint because: Validation failed for 'Str' 
failed with value ARRAY(0x9a75488) at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Plugin/Static/Simple.pm 
line 245

Catalyst::Plugin::Static::Simple::_debug_msg('Hosting=HASH(0x9a72050)') 
called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Plugin/Static/Simple.pm 
line 82
Class::MOP::Class:::before('Hosting=HASH(0x9a72050)') called at 
/usr/local/lib/perl5/site_perl/5.10.1/mach/Class/MOP/Method/Wrapped.pm 
line 47
Class::MOP::Method::Wrapped::__ANON__('Hosting=HASH(0x9a72050)') 
called at 
/usr/local/lib/perl5/site_perl/5.10.1/mach/Class/MOP/Method/Wrapped.pm 
line 89
Hosting::finalize('Hosting=HASH(0x9a72050)') called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst.pm line 1871
eval {...} called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst.pm line 1861
Catalyst::handle_request('Hosting', 'env', 'HASH(0x9a720dc)') 
called at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Engine/HTTP.pm 
line 394

Catalyst::Engine::HTTP::_handler('Catalyst::Engine::HTTP=HASH(0x90e3e24)', 
'Hosting', 3000, 'GET', '/', 'HTTP/1.0') called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Engine/HTTP.pm line 291

Catalyst::Engine::HTTP::run('Catalyst::Engine::HTTP=HASH(0x90e3e24)', 
'Hosting', 3000, undef, 'HASH(0x8fef474)') called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst.pm line 2163
Catalyst::run('Hosting', 3000, undef, 'HASH(0x8fef474)') called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/ScriptRole.pm line 62

Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x860b3c0)') 
called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Script/Server.pm line 144
Catalyst::Script::Server::__ANON__() called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Restarter/Forking.pm line 20

Catalyst::Restarter::Forking::_fork_and_start('Catalyst::Restarter::Forking=HASH(0x8fef410)') 
called at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Restarter.pm 
line 80

Catalyst::Restarter::run_and_watch('Catalyst::Restarter::Forking=HASH(0x8fef410)') 
called at 
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Script/Server.pm line 178

Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x860b3c0)') called 
at 
/usr/local/lib/perl5/site_perl/5.10.1/mach/Class/MOP/Method/Wrapped.pm 
line 48

Class::MOP::Method::Wrapped::__ANON__('Catalyst::Script::Server=HASH(0x860b3c0)') 
called at 
/usr/local/lib/perl5/site_perl/5.10.1/mach/Class/MOP/Method/Wrapped.pm 
line 89

Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x860b3c0)') called 
at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/ScriptRunner.pm line 20
Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'Hosting', 
'Server') called at ./script/hosting_server.pl line 8"


Seems to be a bug in runtime? Or some change with DEBUG I've missed?

Alex.


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


Re: [Catalyst] Help with weird client: POST without Content-Type

2009-12-18 Thread Alex Povolotsky

Andrew Rodland wrote:

On Friday 18 December 2009 05:11:56 am Alex Povolotsky wrote:
  

Hello!

I'm (still) working with weird client-weird server-weird DB system, and
I need some more help from community.

Weird self-written client sends POST request without setting
Content-Type at all.

Client will be fixed, but until then I have to force Catalyst to parse
that request as if it's type was application/x-www-form-urlencoded.

How do I do that?


Here's a suggestion -- not sure if it's the best one, but it should work. In 
your app class (MyApp.pm or whatever) do:


before 'prepare_body' => sub {
my $c = shift;
if ($c->req->method eq 'POST' && !defined $c->req->content_type) {
$c->req->content_type('application/x-www-form-urlencoded');
}
};

The actual decision on how to parse the body is done by HTTP::Body, not by 
Catalyst, so it can't easily be overridden, but using this trick we hook into 
Catalyst after the headers are parsed but before HTTP::Body is invoked, and 
fool it into thinking that the Content-Type actually is what you want it to 
be.
  

Sounds reasonable; however, does not compile.

With Catalyst::Runtime 5.80, script-generated app class, fails with

String found where operator expected at 
/usr/home/tarkhil/work/GIMS/script/../lib/GIMS.pm line 37, near "before 
'prepare_body'"

   (Do you need to predeclare before?)


Alex.


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


[Catalyst] Help with weird client: POST without Content-Type

2009-12-18 Thread Alex Povolotsky

Hello!

I'm (still) working with weird client-weird server-weird DB system, and 
I need some more help from community.


Weird self-written client sends POST request without setting 
Content-Type at all.


Client will be fixed, but until then I have to force Catalyst to parse 
that request as if it's type was application/x-www-form-urlencoded.


How do I do that?

Thanks in advance.

Alex.


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


Re: [Catalyst] go to chained action

2009-12-17 Thread Alex Povolotsky

Tomas Doran wrote:


On 16 Dec 2009, at 13:18, Alex Povolotsky wrote:


Hello!

Having, for example, /controller/*/action handled by /controller/base 
(1) => /controller/action, how do I write correct go to 
/controller/argument/action ?


just $c->go('/controller/argument/action') does not work. 
$c->go('/controller/action', [qw(argument)]) does not work as well, 
while $c->detach('/controller/action', [qw(argument)]) seems to be 
working.


Actually, I'm looking for some kind of internal redirect.


Try $c->go($c->controller('MyController')->action_for('action_name'), 
[], [qw/ argument /]);


The go method is documented as:

$c->go( $action [, \...@captures, \...@arguments ] )
$c->go( $class, $method, [, \...@captures, \...@arguments ] )


Sorry, this does not work QUITE as expected.

I'm forwarding() right now, and 
$c->forward($c->controller('MyController')->action_for('action_name'),[],[qw/argument/]) 
does not pass ALL chain. What's strange, I do see mention of chain base 
in log, but chain base never get called.


I could first forward to chain base manually, but that's not the thing 
I'm looking to.


Alex.


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


Re: [Catalyst] go to chained action

2009-12-17 Thread Alex Povolotsky

Tomas Doran wrote:


On 16 Dec 2009, at 13:18, Alex Povolotsky wrote:


Hello!

Having, for example, /controller/*/action handled by /controller/base 
(1) => /controller/action, how do I write correct go to 
/controller/argument/action ?


just $c->go('/controller/argument/action') does not work. 
$c->go('/controller/action', [qw(argument)]) does not work as well, 
while $c->detach('/controller/action', [qw(argument)]) seems to be 
working.


Actually, I'm looking for some kind of internal redirect.


Try $c->go($c->controller('MyController')->action_for('action_name'), 
[], [qw/ argument /]);


The go method is documented as:

$c->go( $action [, \...@captures, \...@arguments ] )
$c->go( $class, $method, [, \...@captures, \...@arguments ] )

So what you're trying is documented as not working :)

You _may_ get away with
Try $c->go($c->controller('MyController')->action_for('action_name'),  
[qw/ argument /]);


(i.e. omitting the captures if you only want args), but I'm unsure 
about that.



Okay, thanks, it works!

Alex.


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


[Catalyst] go to chained action

2009-12-16 Thread Alex Povolotsky

Hello!

Having, for example, /controller/*/action handled by /controller/base 
(1) => /controller/action, how do I write correct go to 
/controller/argument/action ?


just $c->go('/controller/argument/action') does not work. 
$c->go('/controller/action', [qw(argument)]) does not work as well, 
while $c->detach('/controller/action', [qw(argument)]) seems to be working.


Actually, I'm looking for some kind of internal redirect.

Alex.

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


[Catalyst] Forcing model to reconnect with different connect_info

2009-12-10 Thread Alex Povolotsky

Hello!

It's a bit of crazed setup, but I do have it; I have about 100 
identicaly-structured based with different conent.


I think it's more reasonable to have one model and set dbname for each 
connect. However, I haven't found any way to force model to reconnect 
with different connect_info. Maybe someone knows the right handle?


Alex.


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


[Catalyst] Catalyst::Model::Factory::PerRequest: missing something?

2009-02-24 Thread Alex Povolotsky

Hello!

I'm trying to glue Mail::IMAPTalk to Catalyst::Model with 
C::M::Factory::PerRequest and I'm sorely missing something important.


What should I write to glue module to make it a simple thing - on first 
request to $c->model('IMAP') read server name from config and just 
connect to it?


I need to call 
Mail::IMAPTalk->new(Server=>$c->config()->{'Webmail::Model::IMAP'}->{server}), 
that's all.


Alex.


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


[Catalyst] Current state of Catalyst::Model::IMAP

2009-02-12 Thread Alex Povolotsky

Hello!

Can anyone tell me about current status of Catalyst::Model::IMAP?

Alex.


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


Re: [Catalyst] Plugin::Authentication vs Authentiaction

2008-11-10 Thread Alex Povolotsky

John Romkey wrote:

On Nov 10, 2008, at 8:46 AM, Alex Povolotsky wrote:



That's not enough. Apparently, Plugin::Authentication is different 
from Authentication, and slightly not compartible.


Alex,

The Authentication modules underwent a significant overhaul a while 
back. In the old scheme, there were many authentication plugins. In 
the new scheme, the only plugin is Catalyst::Plugin::Authentication


There are a few Catalyst::Plugin::Authentication modules that provide 
some backwards compatibility but I believe that at this point, 
Catalyst::Plugin::Authentication::* is deprecated, and the older 
Plugins likely won't work with the new scheme. So if you have the 
choice between Catalyst::Authentication::something and 
Catalyst::Plugin::Authentication::something, use the former and not 
the later.


In the new scheme, the storage and credential modules are brought in 
through the configuration of Catalyst::Plugin::Authentication - take a 
look at its documentation to see how this is done. They don't appear 
in the plugin list at all, only Catalyst::Plugin::Authentication does
Thanks a lot, things become much less clear. Now, after some cleaning up 
of configs, everything gets loaded fine; however,


[debug] Unable to locate user matching user info provided

while realm has store of Null, and find_user has no ability to fail.

I'm trying to understand this.

Alex.


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


Re: [Catalyst] Plugin::Authentication vs Authentiaction

2008-11-10 Thread Alex Povolotsky

John Romkey wrote:

On Nov 10, 2008, at 8:46 AM, Alex Povolotsky wrote:



That's not enough. Apparently, Plugin::Authentication is different 
from Authentication, and slightly not compartible.


Alex,

The Authentication modules underwent a significant overhaul a while 
back. In the old scheme, there were many authentication plugins. In 
the new scheme, the only plugin is Catalyst::Plugin::Authentication
Thanks everyone. It was, of course, my fault. I've used login instead of 
username in attempt to authenticate.


Alex.


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


Re: [Catalyst] Plugin::Authentication vs Authentiaction

2008-11-10 Thread Alex Povolotsky

Joel Bernstein wrote:

2008/11/10 Alex Povolotsky <[EMAIL PROTECTED]>:
  

Joel Bernstein wrote:


The fine manual states:
If your plugin starts with a name other than Catalyst::Plugin::, you
can fully qualify the name by using a unary plus.

So you'd do:

use Catalyst qw/
 Foo # loads C::Plugin::Foo
 +Catalyst::Authentication::Credential::Authen::Simple # loads the
module you wanted
/;

  

That's not enough. Apparently, Plugin::Authentication is different from
Authentication, and slightly not compartible.



Er... what? That's nothing to do with what you asked. Why are you
loading Plugin::Authentication if you don't want to use it? I answered
your question of "how do I load C::Authentication::Blah via use
Catalyst qw();".

If you'd like a different answer, ask a different question.
  

Reasking. I did not want just load plugin for fun.

I wanted to use two authentication realms, one with Credential::Password 
and Store::DBIx::Class, the other with Credential::Authen::Simple and 
Store::Null


However, since I have (don't know why exactly) both 
Catalyst::Authentication and Catalyst::Plugin::Authentication, I seems 
to have problems setting all of those to work together.


Alex.


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


Re: [Catalyst] Plugin::Authentication vs Authentiaction

2008-11-10 Thread Alex Povolotsky

Joel Bernstein wrote:

2008/11/10 Alex Povolotsky <[EMAIL PROTECTED]>:
  

Hello!

Trying to use Catalyst::Authentication::Credential::Authen::Simple
(::RADIUS, but it does not matter), I've found that I've got two
Authentication directories, one is under Plugin. What's worse, Catalyst does
not load Catalyst::Authentication::Credential::Authen::Simple automatically,
and fails when I put it into

use Catalyst qw/  /

because it searches only Catalust/Plugin

What am I doing wrong? I don't want just put a bunch of symlinks.



The fine manual states:
If your plugin starts with a name other than Catalyst::Plugin::, you
can fully qualify the name by using a unary plus.

So you'd do:

use Catalyst qw/
  Foo # loads C::Plugin::Foo
  +Catalyst::Authentication::Credential::Authen::Simple # loads the
module you wanted
/;
  
That's not enough. Apparently, Plugin::Authentication is different from 
Authentication, and slightly not compartible.


Alex.


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


[Catalyst] Plugin::Authentication vs Authentiaction

2008-11-10 Thread Alex Povolotsky

Hello!

Trying to use Catalyst::Authentication::Credential::Authen::Simple 
(::RADIUS, but it does not matter), I've found that I've got two 
Authentication directories, one is under Plugin. What's worse, Catalyst 
does not load Catalyst::Authentication::Credential::Authen::Simple 
automatically, and fails when I put it into


use Catalyst qw/  /

because it searches only Catalust/Plugin

What am I doing wrong? I don't want just put a bunch of symlinks.

Catalyst runtime 5.7015

Alex.


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


[Catalyst] many_to_many filling

2008-04-01 Thread Alex Povolotsky

defaults_from_model does only default settings.

To fill select/checkbox group/whatever else, one must add to .yml file:

db:
 model: (name-of-your-Catalyst-model)
 resultset: (name-of-proper-resultset)
 label_column: (column to put into label)

It is not documented anywhere but can be extracted from 
HTML/FormFu/Element/_Group.pm.


I'm still researching case of incorrect SQL statement for many_to_many 
model.


Alex.


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


[Catalyst] Nested calls to model does not work?

2008-04-01 Thread Alex Povolotsky
Sorry for resending, looks like everyone able to answer overlooked this 
message. I'm researching the problem without much success.


Hello!

I've experienced strange problem displaying data. Minimal test case is
fairly big, I can attach it here, but will try to extract most important
information.

Creating database (Pg)

create table parent (pid serial primary key, name varchar(64));
create table child (cid serial primary key, pid int not null references
parent(pid), name varchar(64));
create table record (rid serial primary key, cid int not null references
child(cid), message varchar(64));
insert into parent (name) values('parent');
insert into child (pid, name) values (1, 'child');
insert into record (cid, message) values (1, 'message one');
insert into record (cid, message) values (1, 'message two');

creating model and view

script/testcase_create.pl model Main DBIC::Schema Testcase::Schema
create=static dbi:Pg:dbname=testcase testcase
script/testcase_create.pl view Main TTSite

in Root controller, writing trivial

sub index : Local {
   my ( $self, $c ) = @_;
   $c->stash->{parent} = $c->model('Main::Parent')->search();
}

in index template, everything is trivial as well

[% META title = 'index' %]

[% WHILE (p = parent.next) %]
parent [% p.name %] has [% p.children.count %] children,
  
  [% WHILE (child = p.children.next) %]
   [% child.name %] has [% child.records.count %] records,
 
 [% WHILE (record = child.records.next) %]
[% record.message %]
 [% END %]
 
  [% END %]
  
[% END %]


Output is disappointing

index

  parent parent has children,

  © 2008 Your Name Here

while we get

SELECT me.pid, me.name FROM parent me:
SELECT me.cid, me.pid, me.name FROM child me WHERE ( me.pid = ? ): '1'
SELECT me.cid, me.pid, me.name FROM child me WHERE ( me.pid = ? ): '1'

with DBIC_TRACE.

Attempt to dump (using Plugin::Dumper) p.children yields reasonable result.

What am I doing wrong?

Alex.



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


___
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] mod_perl2 vs. Catalyst server: utf problem

2008-03-31 Thread Alex Povolotsky

Jon wrote:
On Sat, Mar 22, 2008 at 7:34 PM, Alex Povolotsky <[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>> wrote:


Hello!


Hi
 



I've debugged my app under Catalyst::HTTP server, it worked just fine
with UTF-8.

After deploying it under mod_perl, I've found garbled content, UTF-8
strings are just different.


 
Is all your data in the db utf8 if you're using a db that is?


Yes. Sure.


Are all your templates utf8?


On moment of writing, they were plain ASCII

Does your apache claim utf8 in the headers?
Content-Type: text/html; charset=utf-8


Yes

Does your templates contain meta tag for the browser?



Will test.

Alex.


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


[Catalyst] Nested calls to model does not work?

2008-03-31 Thread Alex Povolotsky

Hello!

I've experienced strange problem displaying data. Minimal test case is 
fairly big, I can attach it here, but will try to extract most important 
information.


Creating database (Pg)

create table parent (pid serial primary key, name varchar(64));
create table child (cid serial primary key, pid int not null references 
parent(pid), name varchar(64));
create table record (rid serial primary key, cid int not null references 
child(cid), message varchar(64));

insert into parent (name) values('parent');
insert into child (pid, name) values (1, 'child');
insert into record (cid, message) values (1, 'message one');
insert into record (cid, message) values (1, 'message two');

creating model and view

script/testcase_create.pl model Main DBIC::Schema Testcase::Schema 
create=static dbi:Pg:dbname=testcase testcase

script/testcase_create.pl view Main TTSite

in Root controller, writing trivial

sub index : Local {
   my ( $self, $c ) = @_;
   $c->stash->{parent} = $c->model('Main::Parent')->search();
}

in index template, everything is trivial as well

[% META title = 'index' %]

[% WHILE (p = parent.next) %]
parent [% p.name %] has [% p.children.count %] children,
  
  [% WHILE (child = p.children.next) %]
   [% child.name %] has [% child.records.count %] records,
 
 [% WHILE (record = child.records.next) %]
[% record.message %]
 [% END %]
 
  [% END %]
  
[% END %]


Output is disappointing

index

  parent parent has children,

  © 2008 Your Name Here

while we get

SELECT me.pid, me.name FROM parent me:
SELECT me.cid, me.pid, me.name FROM child me WHERE ( me.pid = ? ): '1'
SELECT me.cid, me.pid, me.name FROM child me WHERE ( me.pid = ? ): '1'

with DBIC_TRACE.

Attempt to dump (using Plugin::Dumper) p.children yields reasonable result.

What am I doing wrong?

Alex.



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


Re: [Catalyst] Plugin::I18N and UTF-8

2008-03-24 Thread Alex Povolotsky

Knut-Olav Hoven wrote:

On Monday 24 March 2008 14:33:47 Alex Povolotsky wrote:
  

Knut-Olav Hoven wrote:


On Monday 24 March 2008 08:08:06 Alex Povolotsky wrote:
  

Hello!

Having completed UTF-8 quest successfully, I've tried to do I18N and
found the same double-UTF-encoding trouble.

I've put UTF-8 strings into I18N/ru.po file,and configured Plugin:I18N

Plugin::I18N:
maketext_options:
Decode: 0
Encoding: utf-8



Remove the "Encoding: utf-8" line

According to the manual of Locale::Maketext::Simple, the Encoding parameter 
implies Decode => 1


  


Well, after some switching on and off, it settled down to work :)

BTW: Locale::Maketext::Extract mentions some [%|l%] TT filter; but I've 
found no clue in Template::Toolkit manual on writing my own filter...


Alex.


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


Re: [Catalyst] Plugin::I18N and UTF-8

2008-03-24 Thread Alex Povolotsky

Knut-Olav Hoven wrote:

On Monday 24 March 2008 14:33:47 Alex Povolotsky wrote:
  

Knut-Olav Hoven wrote:


On Monday 24 March 2008 08:08:06 Alex Povolotsky wrote:
  

Hello!

Having completed UTF-8 quest successfully, I've tried to do I18N and
found the same double-UTF-encoding trouble.

I've put UTF-8 strings into I18N/ru.po file,and configured Plugin:I18N

Plugin::I18N:
maketext_options:
Decode: 0
Encoding: utf-8



Remove the "Encoding: utf-8" line

According to the manual of Locale::Maketext::Simple, the Encoding parameter 
implies Decode => 1
  


No difference. BTW, it seems to ALWAYS try to localize strings.

  MACRO l(text, args) BLOCK;
 Catalyst.localize(text, args);
  END;

is defined in root/src/main

Alex.


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


Re: [Catalyst] Plugin::I18N and UTF-8

2008-03-24 Thread Alex Povolotsky

Andrew Rodland wrote:

On Monday 24 March 2008 02:08:06 am Alex Povolotsky wrote:
  

Hello!

Having completed UTF-8 quest successfully, I've tried to do I18N and
found the same double-UTF-encoding trouble.

I've put UTF-8 strings into I18N/ru.po file,and configured Plugin:I18N

Plugin::I18N:
maketext_options:
Decode: 0
Encoding: utf-8

(Decode: 1 did not make a difference), and I've got double-encoded
localize.

What and where should I fix?

Alex.



Does your pofile have the correct encoding declared? It should say something 
like


msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8"

(actually it's likely that there are lots of other "headers", but the point is 
that Content-Type should be one of them and it should declare a charset. 
Locale::Maketext::Gettext twigs on this to figure out how to decode.)
  


Added; no visible effect at all, still double-encoded UTF8

Alex.


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


Re: [Catalyst] Plugin::I18N and UTF-8

2008-03-24 Thread Alex Povolotsky

Knut-Olav Hoven wrote:

On Monday 24 March 2008 08:08:06 Alex Povolotsky wrote:
  

Hello!

Having completed UTF-8 quest successfully, I've tried to do I18N and
found the same double-UTF-encoding trouble.

I've put UTF-8 strings into I18N/ru.po file,and configured Plugin:I18N

Plugin::I18N:
maketext_options:
Decode: 0
Encoding: utf-8

(Decode: 1 did not make a difference), and I've got double-encoded
localize.

What and where should I fix?



What other plugins are you using?

  

use Catalyst qw/
-Debug
ConfigLoader Static::Simple
Session Session::State::Cookie Session::Store::FastMmap
Authentication
   Authentication::Credential::Password
   Authorization::ACL
I18N
Upload::Image::Magick
Unicode
/;

Alex.


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


[Catalyst] fix config right before database connect?

2008-03-24 Thread Alex Povolotsky

Hello!

I'm running several instances of Catalyst app (for every developer and 
production) on the same box; I'm thinking of automatically patch 
database name loaded from config file to allow separate copies of 
databases to coexist transparently.


What should I override to fix config AFTER file has been read, but 
BEFORE database is connected?


Alex.


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


[Catalyst] Plugin::I18N and UTF-8

2008-03-24 Thread Alex Povolotsky

Hello!

Having completed UTF-8 quest successfully, I've tried to do I18N and 
found the same double-UTF-encoding trouble.


I've put UTF-8 strings into I18N/ru.po file,and configured Plugin:I18N

Plugin::I18N:
   maketext_options:
   Decode: 0
   Encoding: utf-8

(Decode: 1 did not make a difference), and I've got double-encoded localize.

What and where should I fix?

Alex.


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


[Catalyst] mod_perl2 vs. Catalyst server: utf problem

2008-03-22 Thread Alex Povolotsky

Hello!

I've debugged my app under Catalyst::HTTP server, it worked just fine 
with UTF-8.


After deploying it under mod_perl, I've found garbled content, UTF-8 
strings are just different.


I'm using perl 5.8.8, apache 2.2.8, mod_perl2 2.0.3_3.

Searching interned yielded no result at all.

Alex.

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


[Catalyst] Handy shotcuts

2008-03-20 Thread Alex Povolotsky

Hello!

I've implemented

$c->uri_redirect($path) as a shortcut to 
$c->res->redirect($c->uri_for($path))


and

$c->uri_redirect_d($path) as $c->uri_redirect($path); $c->detach()

I guess these shortcuts are really useful. Patch is attached.

Alex.

--- Catalyst.pm.orig	2008-03-20 13:11:59.0 +0300
+++ Catalyst.pm	2008-03-20 13:15:10.0 +0300
@@ -2220,6 +2220,28 @@
 
 sub use_stats { 0 }
 
+=head2 $c->uri_recirect( $path )
+
+Is a shortcut to $c->response->redirect($c->uri_for($path))
+
+=cut
+
+sub uri_redirect {
+my ($c, $path) = @_;
+return $c->response->redirect($c->uri_for($path));
+}
+
+=head2 $c->uri_redirect_d( $path )
+
+Is a shortcut to $c->uri_redirect($path); $c->detach();
+
+=cut 
+
+sub uri_redirect_d {
+my ($c, $path) = @_;
+$c->uri_redirect($path);
+$c->detach();
+}
 
 =head2 $c->write( $data )
 
___
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] Behaviour of Catalyst::Plugin::Authentication

2008-03-19 Thread Alex Povolotsky

Jochen Luig wrote:

Hi,

I stumbled upon a feature of the Authentication Plugin today
(Yes I was the guy who used Ash's cardboard cutout programmer service 
earlier today on #catalyst, so thanks again, Ash ;-)


My configuration was something like this:

authentication:
 default_realm: users
 realms:
  users:
   credential:
class: Password
user_field: login
password_field: password
password_type: clear
   store:
class: DBIx::Class
user_class: MyAppDB::Users
role_class: MyAppDB::Roles
role_field: title
role_relation: user_roles
user_role_user_field: user_id

but the $userinfo hash I passed to the authenticate() method looked 
like this


my $userinfo = { username => $login, password => $password}

Thus, Catalyst logged in the first user in the MyAppDB::Users table if I
provided the correct password regardless of what I supplied as a login 
(ok, the latter is obvious).
Does the plugin try to DWIM by using the first user it happens to 
stumble upon and using his primary key as the login field? This is what

I suspect because the (test-)user in question happened to have "1" as
his primary key as well as in the 'login'-column.

Maybe this is because of my limited idea of what $userinfo can be, but
wouldn't a warning be suitable in such a case?
  


It is A Feature. You've messed with parameters, username in userinfo, 
login in credential. my $userinfo = { login => $login, password => 
$password} will cure.


Alex.


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


Re: [Catalyst] Catalyst and Shibboleth authentication

2008-03-17 Thread Alex Povolotsky

Jay K wrote:


My point is simply that I built the Auth module to allow the most
flexibility for customization without the need to 'rewrite Catalyst
from scratch'  as you put it.  Any of the hook points I mentioned can
be appropriate, and indeed for an SSO such as OpenID, which is much
more complex than validating a hash in a cookie - overriding at $realm-
>authenticate() may be the best option.


In a week or two, I'll try to implement C::A::Credential::OpenID, we'll see.

Alex.


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


Re: [Catalyst] Catalyst and Shibboleth authentication

2008-03-17 Thread Alex Povolotsky

Jay K wrote:

That page is slightly incorrect.
In C::A::Store::Null -based class, apparently $storeclass-
>can('find_user') returns 0 (called from
C::A::Authentication::Realm.pm line 85) so Realm tries to construct
find_user by itself, without success.



Yes.  Null does not implement find_user - you have to.  Which is why
the wiki page says subclass and add find_user.

Hmm... I guess you should read Null.pm, especially lines 29-32.



I wonder why wiki suggests to override storage; overriding
credentials should be much more reasonable.



Either is fine, actually.   The execution path for authentication is
by default:

$c->authenticate() --> $realm->authenticate() --> $credential-
>authenticate() --> $store->find_user()

For SSO - you can hook at any of those points.  The store is the
easiest, really - because Credential::Password has a 'passthrough'
mode by telling it password_type='none' - effectively delegating the
entire auth process cleanly to the store's find_user method.   Since
you will probably need to provide some type of user information -
overriding the store gives you the ideal spot to handle both at the
same time.

Well, I still think that SSO is for CREDENTIAL VALIDATION, so we need to 
override Credential.


Actually, I've done an extremly simple SSO (but it works good enough!) 
and store authenticated users in DBIx::Class, and happy with it :)


Surely one could override Realm, or Catalyst itself, or rewrite Catalyst 
from scratch, but I've explained my position.


Alex.

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


Re: [Catalyst] Automatically uri_unescape parameters

2008-03-17 Thread Alex Povolotsky

Ashley wrote:

On Mar 17, 2008, at 1:53 PM, Alex Povolotsky wrote:
So far I can tell only that SOMETIMES it does not escape it properly. 
I'm heavily pressed by missing deadline, but I'll make a test case 
and send it to you.


This sounds like you are double encoding URIs in some situations 
without realizing it.


Hmm... I do not. Maybe implicitly, with Chain? No, Chain works well.

I promise to do a test case.

Alex.


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


Re: [Catalyst] Automatically uri_unescape parameters

2008-03-17 Thread Alex Povolotsky

Jonathan Rockway wrote:

* On Mon, Mar 17 2008, Stef T wrote:
  

Hello Alex,
   I would assume that if Catalyst-Plugin-HTML-Scrubber-0.01 doesn't
do what you want, it will probably point you in the right direction ;)

   You could probably also do this using the DBIx inflate_column I
dare say.



I don't think this is what he is talking about.  If it is, the module he
is looking for is URI::Escape.

If he's talking about unescaping the querystring, that should be handled
by Catalyst and if something is going wrong, a failing test case would
be appreciated.
  
So far I can tell only that SOMETIMES it does not escape it properly. 
I'm heavily pressed by missing deadline, but I'll make a test case and 
send it to you.


Alex.


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


[Catalyst] Automatically uri_unescape parameters

2008-03-17 Thread Alex Povolotsky

Hello!

Do we have some way to automatically uri_unescape parameters passed to 
handlers?


Alex.


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


Re: [Catalyst] Catalyst and Shibboleth authentication

2008-03-15 Thread Alex Povolotsky

Mike Whitaker wrote:


On 14 Mar 2008, at 19:00, Kirby Krueger wrote:


Greetings,

I'm writing a new web application, and have decided to jump into 
Catalyst (because I am smart.)


One thing that Catalyst seems to do well is have a good mechanism for 
plugging in standard approaches to things.  Here at the University of 
Washington, we use a project called 'Shibboleth' for authentication: 
http://shibboleth.internet2.edu/


I dunno exactly what Shibboleth does, but if the notes on dealing with 
external single sign on 
(http://catwiki.toeat.com/gettingstarted/tutorialsandhowtos/sso_authentication) 
are any help, steal away :) (JayK did sanity check them for me, and He 
Should Know :) )


I've made it, I've made it twice different ways.

I wonder why wiki suggests to override storage; overriding credentials 
should be much more reasonable.


Alex.


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


Re: [Catalyst] Catalyst and Shibboleth authentication

2008-03-15 Thread Alex Povolotsky

Ashley wrote:


Well, The Whole Thing seems reasonable; however, maybe you'll provide 
me with some idea on more complex setup?


I want to AUTHENTICATE users via some external SSO, but KEEP users 
once they've been authenticated into database.


I have (still) no good idea on interaction of Realm, Password and 
Store...



This might be a way to approach it: 
http://openid.net/specs/openid-simple-registration-extension-1_1-01.html


Use OpenID to authenticate and the simple registration protocol to 
save their info in your own DB (in this case there would be no local 
password saved, the realm would always be the OpenID path and I'm not 
sure how you'd connect that with your local store. OpenID accounts are 
free at several sites so it's not a high barrier to entry. There is a 
family of CPAN modules by Brad Fitzpatrick and I think one or two 
OpenID plugins for Cat. The protocol is pretty simple but hacking on 
it can be very confusing and can make certain setups tricky (I chased 
a bug for 10 hours doing the stuff b/c I stupidly had the id server 
address set to / when the real resource was /index.pl).


OpenID for authentication with role-based authorization seems to be a 
reasonable thing, isn't it? For now, I've made an EXTREMLY simple SSO, 
just to prove the concept. Once I'll get Catalyst modules to work (with 
SSO-based authentication and role-based authorization) I'll look at OpenID.


Alex

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


Re: [Catalyst] Catalyst and Shibboleth authentication

2008-03-15 Thread Alex Povolotsky

Mike Whitaker wrote:


I dunno exactly what Shibboleth does, but if the notes on dealing with 
external single sign on 
(http://catwiki.toeat.com/gettingstarted/tutorialsandhowtos/sso_authentication) 
are any help, steal away :) (JayK did sanity check them for me, and He 
Should Know :) )


That page is slightly incorrect.

In C::A::Store::Null -based class, apparently 
$storeclass->can('find_user') returns 0 (called from 
C::A::Authentication::Realm.pm line 85) so Realm tries to construct 
find_user by itself, without success.


I'm still trying to figure the whole things out.

Alex.


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


Re: [Catalyst] Catalyst and Shibboleth authentication

2008-03-15 Thread Alex Povolotsky

Mike Whitaker wrote:


On 14 Mar 2008, at 19:00, Kirby Krueger wrote:


Greetings,

I'm writing a new web application, and have decided to jump into 
Catalyst (because I am smart.)


One thing that Catalyst seems to do well is have a good mechanism for 
plugging in standard approaches to things.  Here at the University of 
Washington, we use a project called 'Shibboleth' for authentication: 
http://shibboleth.internet2.edu/


I dunno exactly what Shibboleth does, but if the notes on dealing with 
external single sign on 
(http://catwiki.toeat.com/gettingstarted/tutorialsandhowtos/sso_authentication) 
are any help, steal away :) (JayK did sanity check them for me, and He 
Should Know :) )


Well, The Whole Thing seems reasonable; however, maybe you'll provide me 
with some idea on more complex setup?


I want to AUTHENTICATE users via some external SSO, but KEEP users once 
they've been authenticated into database.


I have (still) no good idea on interaction of Realm, Password and Store...

Alex.


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


Re: [Catalyst] model update

2008-03-08 Thread Alex Povolotsky

Jennifer Ahn wrote:

hello!

i'm writing my first controller method to update the database using 
the catalyst model, but  i seem to have the syntax for that all wrong.


   my $obj = $c->model ('MyAppDB::Student')->update (
   { name => $name },
   { id => $id}
   );

I'm updating the name field where the id field is given for the model 
called Student.  i'm not sure why, but the code above updates ALL row 
name fields, not just rows with the particular id.   is the syntax 
wrong? my understanding was that the first hash is to specify the set 
values and the second hash specifies the "where" clause of a query..


First of all, $c->model('Model::Class') returns DBIx::ResultSet, NOT 
YourApp::Schema::Class. It is quite unclear for me, and seems to be 
illogical, but it is.


Second, update() syntax in your example is incorrect.

Alex.


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


Re: [Catalyst] CGI.pm and Catalyst?

2008-03-07 Thread Alex Povolotsky

Martin Ellison wrote:
Is there anything attached to Catalyst similar to the CGI.pm module? 
That is, creating the HTML by a series of procedure calls rather than 
by instantiating a template?


Or is there some way to link up the existing CGI module? 
$c->response->body(ul(li(q{hello}), li(q{world} ?


Or is it not a good idea?

I couldn't find anything from a search, so excuse me please if this 
has been covered before.


Creating HTML inside the code is the best way to make unreadable, 
unmaintainable program with mysterious errors.


Alex.

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


[Catalyst] On authentication again

2008-03-06 Thread Alex Povolotsky

Hello!

Maybe someone could provide the complete example of auth system with 
MODERN Catalyst::Plugin::Authentication?


I mean, with database, Model and proper config.

Right now, I've stopped by

You must provide a user_class at 
/usr/local/lib/perl5/site_perl/5.8.8/Catalyst.pm line 911


error, though I've provided user_class in config.

__PACKAGE__->config->{'Plugin::Authentication'} =
{
   default_realm => 'members',
   realms => {
   members => {
   credential => {
   class => 'Password',
   password_field => 'password',
   password_type => 'clear',
   },
   store => {
   class => 'DBIx::Class',
   user_class => 'Main::Pwuser',
   role_column => 'rid',
   }
   },
   }
};

Unfortunately, C::P::A documentation assumes that reader already knows 
C::P::A :(


I even don't understand what __PACKAGE__->config-> I should use - 
{'Plugin::Authentication'}, {authentication} or{authentication}{dbic}. 
Docs are unclear.


Alex.


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


Re: [Catalyst] How can it be - wrong model returned?

2008-03-06 Thread Alex Povolotsky

Ash Berlin wrote:


On 6 Mar 2008, at 11:12, Alex Povolotsky wrote:


Hello!

I've made a simple many-to-many relationship for user/roles 
authentication, and suddenly found that


  my $model = $c->model('Pwuser')->search()->all();
  my $roles = $c->model('Role')->search()->all();
  my $ur = $c->model('UserRole')->search()->all();

results in

SELECT me.uid, me.login, me.password FROM pwuser me:
SELECT me.uid, me.rid FROM user_role me:
SELECT me.uid, me.rid FROM user_role me:

nothing get selected from role table, and 
$c->model('Role')->search->all selects from wrong table.


How can it be and what can I do?...

Alex.


You are passing the wrong thing to $c->model and its falling back to 
the (hateful) regexp search.


Assuming your DBIC::Schema model is MyApp::Model::DBModel you want 
$c->model('DBModel::Role').


Thanks a lot!


Alex.


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


[Catalyst] How can it be - wrong model returned?

2008-03-06 Thread Alex Povolotsky

Hello!

I've made a simple many-to-many relationship for user/roles 
authentication, and suddenly found that


   my $model = $c->model('Pwuser')->search()->all();
   my $roles = $c->model('Role')->search()->all();
   my $ur = $c->model('UserRole')->search()->all();

results in

SELECT me.uid, me.login, me.password FROM pwuser me:
SELECT me.uid, me.rid FROM user_role me:
SELECT me.uid, me.rid FROM user_role me:

nothing get selected from role table, and $c->model('Role')->search->all 
selects from wrong table.


How can it be and what can I do?...

Alex.


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


Re: [Catalyst] On authentication

2008-03-05 Thread Alex Povolotsky

Felix Antonius Wilhelm Ostmann wrote:

i asked for that yesterday in the channel ... you must install

Catalyst::Authentication::Store::DBIx::Class (without Plugin)


Cool... maybe you'd explain me a bit configuration options? Role-related 
ones are just mentioned in docs, not explained at all


Alex.


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


[Catalyst] On HTML::FormFu rendering

2008-03-05 Thread Alex Povolotsky

Hello!

I'm trying to use Catalyst::Controller::HTML::FormFu

Code is quite simple for this time
=== from controller ===
sub add : Local FormConfig {
   my ($self, $c) = @_;
   my $form : Stashed;
}
=== cut ===

=== TT template ===
[% META title = 'Add user' %]
[% Form.render %]
=== cut ===

=== YML template ===
---
elements:
 - type: Text
   name: login
   label: 'Login:'
 - type: Password
   name: pass1
   label: 'Password:'
 - type: Password
   name: pass2
   label: 'Repeat password:'
 - type: Submit

=== cut ===

However, form does not get rendered. form.render works, but should 
Form.render be better?


And can I produce much nicer forms as FormBuilder do by default?

Alex.


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


[Catalyst] On authentication

2008-03-05 Thread Alex Povolotsky

Hello!

Comparing tutorial/book and perldoc Catalyst::Plugin::Authentication, 
I've found completely different ways to configure 
authentication/authorization. Looks like Catalyst::Plugin::Authentication
is much richer, but much worse documented and, say, there is no 
Catalyst::Plugin::Authentication::Store::DBIx::Class mentioned in 
C::P::A manual.


Is tutorial/book way obsoleted? If yes, where can I find better 
explanation of C::P::A?


Alex.


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


Re: [Catalyst] $c->model weirdness?

2008-03-01 Thread Alex Povolotsky

Alex Povolotsky wrote:

Hello!

I've created the DBIC model with helper script, all files are in place 
and seems to be OK.


However,

 my $model = $c->model('TrafficDB::Server');
 my $traffic = $c->model('TrafficDB::DailySummary');
.
 $c->log->info(ref $me);
 $c->log->info(ref $traffic);

yields

[info] Traffic2::M::TrafficDB::Server
[info] DBIx::Class::ResultSet

So sub's defined in DailySummary.pm are not loaded.

I have no idea on what can be wrong :( maybe someone will point me?


Well, I should look better. $model->find() returns 
Traffic2::M::TrafficDB::Server. Sorry.


Alex.


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


[Catalyst] $c->model weirdness?

2008-03-01 Thread Alex Povolotsky

Hello!

I've created the DBIC model with helper script, all files are in place 
and seems to be OK.


However,

 my $model = $c->model('TrafficDB::Server');
 my $traffic = $c->model('TrafficDB::DailySummary');
...
 $c->log->info(ref $me);
 $c->log->info(ref $traffic);

yields

[info] Traffic2::M::TrafficDB::Server
[info] DBIx::Class::ResultSet

So sub's defined in DailySummary.pm are not loaded.

I have no idea on what can be wrong :( maybe someone will point me?

Alex.


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


[Catalyst] Catalyst::Controller::FormBuilder and select - need help - again

2008-02-28 Thread Alex Povolotsky

Hello!

I'm trying to fill in select in Form-based action 
(Catalyst::Controller::FormBuilder).


Debug shows that select IS filled properly, attempt to 
$c->log->info($self->formbuilder->render); yields correctly filled 
select, but in template no inserted data appears. What could I have done 
wrong?


Alex.


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


Re: [Catalyst] Re: Needs some help with select and Controller::FormBuilder

2008-02-27 Thread Alex Povolotsky

Stephen Sykes wrote:

Alex Povolotsky wrote:

Hello!

I'm trying to make a form with select using Controller::FormBuilder.

Code is quite straightforward



Why not map directly from your model...

$self->formbuilder->field(
name => 'ipid',
options  =>
  [ map { [ $_->ipid, $_->ipaddr ] } $c->model('OurIP')->all ],
);


I've tried to find out if any data is retrieved at all. Yes, they does. 
Why select isn't filled properly?


Alex.


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


[Catalyst] Needs some help with select and Controller::FormBuilder

2008-02-26 Thread Alex Povolotsky

Hello!

I'm trying to make a form with select using Controller::FormBuilder.

Code is quite straightforward


=== edit.fb ===
name: server_edit
method: post
fields:
   name:
   label: Server Name
   required: 1
   type: text
   size: 60
   descr:
   label: Description
   type: textarea
   rows: 4
   cols: 60
   ipid:
   label: IP
   type: select
   required: 1
=== edit.fb ===

=== from Server.pm ===
sub edit : Local Form {
 my ($self, $c, $lid, $sid) = @_;
 if (!defined $lid) {
   $c->response->redirect($c->uri_for('/location/list'));
   $c->detach();
 }
 my $form = $self->formbuilder;
  my $iplist = $c->model('OurIP')->search(undef,
 {columns =>
  [qw /ipid ipaddr/],
 order_by => 'ipaddr'});
 $c->log->info(join(', ', map { $_->ipid.' '.$_->ipaddr } $iplist->all));
 $form->field(name=>'ipid',
type => 'select',
options =>
[ map { [ $_->ipid, $_->ipaddr] } $iplist->all ],
#other => 1,# create "Other:" 
box   
   );


# No processing yet
}
=== from Server.pm ===

Looks OK, doesn't it?

Debug shows

[CGI::FormBuilder::Field::select::tag] (debug2) ipid: generating select 
input type

[CGI::FormBuilder::Field::tag_value] (debug2) ipid: called $field->tag_value
[CGI::FormBuilder::Field::tag_value] (debug2) ipid: sticky && ! force
[CGI::FormBuilder::Field::cgi_value] (debug2) ipid: called $field->cgi_value
[CGI::FormBuilder::Field::tag_value] (debug2) no cgi found, returning 
def_value

[CGI::FormBuilder::Field::def_value] (debug2) ipid: called $field->def_value
[CGI::FormBuilder::Field::def_value] (debug2) ipid: def value = ()
[CGI::FormBuilder::Field::inflate_value] (debug2) ipid: called 
$field->inflate_value
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94cfd54)) 
= (,-select-,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b27fc)) 
= (1,88.212.221.66,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94335cc)) 
= (23,88.212.221.67,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2b68)) 
= (24,88.212.221.68,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2bb0)) 
= (26,88.212.221.69,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a3eec)) 
= (31,88.212.221.71,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a3f04)) 
= (28,88.212.221.72,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a3fc4)) 
= (27,88.212.221.73,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2010)) 
= (30,88.212.221.74,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2070)) 
= (2,88.212.221.75,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2088)) 
= (29,88.212.221.76,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2100)) 
= (3,88.212.221.77,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b213c)) 
= (4,88.212.221.78,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94334f4)) 
= (5,88.212.221.79,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2160)) 
= (17,88.212.221.81,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b21b4)) 
= (6,88.212.221.82,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b22b0)) 
= (10,88.212.221.83,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b22e0)) 
= (11,88.212.221.84,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b22f8)) 
= (12,88.212.221.85,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b231c)) 
= (13,88.212.221.86,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b279c)) 
= (7,88.212.221.88,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2ab4)) 
= (8,88.212.221.89,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a367c)) 
= (25,88.212.221.90,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b25a4)) 
= (21,88.212.221.92,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b25e0)) 
= (14,88.212.221.93,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2040)) 
= (16,88.212.221.94,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2358)) 
= (9,88.212.221.95,)
[CGI::FormBuilder::Field::select::tag] (debug2) ipid: generated tag = 


 -select-
 88.212.221.66
 88.212.221.67
 88.212.221.68
 88.212.221.69
 88.212.221.71
 88.212.221.72
 88.212.221.73
 88.212.221.74
 88.212.221.75
 88.212.221.76
 88.212.221.77
 88.212.221.78
 88.212.221.79
 88.212.221.81
 88.212.221.82
 88.212.221.83
 88.212.221.84
 88.212.221.85
 88.212.221.86
 88.212.221.88
 88.212.221.89
 88.212.221.

Re: [Catalyst] Dumb questionagain: nowCatalyst::Controller::FormBuilder

2008-02-25 Thread Alex Povolotsky

Peter Sørensen wrote:

what I meant was:

name: location_edit
method: post
title: Location
fields:
CHANHE HERE --->   locationname:  insteadof name
  name: Location name
  type: text
  size: 60
  required: 1

   descr:
  name: Location description
  type: textarea
  rows: 4
  cols: 60 
  


Well, CGI::FormBuilder::Source::File has weird Pytonish format. It 
should be also sensitive to LF/CRLF line endings and tabulations to be 
weird completely.


I can PATCH the form copypasted from Catalyst::Controller::FormBuilder - 
but I have lots of troubles creating my own ones.


I'll look to HTML::ScriptFu :(

Alex.




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


Re: [Catalyst] Book

2008-02-25 Thread Alex Povolotsky

Dermot wrote:

Hi,

I am considering getting the Catalyst book and had a question or 2. 
Should it be bought from the Packt publishing site as opposed to 
anywhere else? Does buying it there help the catalyst project in some 
way more than buying it at another site that perhaps I am already 
registered on? I have been working my way though the sample chapter 
(3). I found it easier to follow then the tutorial that comes with the 
documentation. However the reviews at Amazon.co.uk 
 are a little negative. What does the list think 
about the books.


Well, it COULD be better. It COULD have smaller introduction (which 
gives nothing besides web-published intros), and sample code presented 
in archive on a site is awful - I cannot 'just unpack and play'. But it 
surely worth its money


Alex.

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


Re: [Catalyst] Dumb question again: nowCatalyst::Controller::FormBuilder

2008-02-25 Thread Alex Povolotsky

Peter Sørensen wrote:

Maybe FormBuilder don't like:


fields:
   name:
  name: Location name


You use "name" as both field and object name. Just a guess.
  

Oh no! Removing first name: yields the same error with method :(

Alex.


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


[Catalyst] Dumb question again: now Catalyst::Controller::FormBuilder

2008-02-23 Thread Alex Povolotsky

[info] *** Request 1 (1.000/s) [43248] [Sun Feb 24 02:05:17 2008] ***
[debug] "GET" request for "location/add" from "89.222.147.9"
[debug] Path is "location/add"
[debug] Form (location/edit): Looking for config file location/edit.fb
[debug] Form (location/edit): Found form config 
/usr/local/traffic/Traffic2/root/forms/location/edit.fb
[error] Caught exception in Traffic2::C::Location->add "Can't use string 
("location_edit") as a HASH ref while "strict refs" in use at 
/usr/local/lib/perl5/site_perl/5.8.8/CGI/FormBuilder/Source/File.pm line 
150."

[info] Request took 0.014863s (67.281/s)


CGI::FormBulder, running on that file, yields no error

File is simple

name: location_edit
method: post
title: Location
fields:
  name:
 name: Location name
 type: text
 size: 60
 required: 1

  descr:
 name: Location description
 type: textarea
 rows: 4
 cols: 60

What has I done wrong?...

Alex.


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


Re: [Catalyst] Feelnig dumb: $c->model returns controller?

2008-02-23 Thread Alex Povolotsky

Alex Povolotsky wrote:

Hello!

I'm still writing my first Catalyst app; I'm beginning to love DBIx, 
and the overall concept.


But.

 my $lmodel = $c->model('Location');
 use Data::Dumper;
 print STDERR Dumper($lmodel);
 my $locs = $lmodel->search(undef); # Sort by follows, if 
required 
Caught exception in Traffic2::C::Location->list "Can't locate object 
method "search" via package "Traffic2::C::Location" at 
/usr/local/traffic/Traffic2/script/../lib/Traffic2/C/Location.pm line 
36."


$VAR1 = bless( {
'_application' => 'Traffic2'
  }, 'Traffic2::C::Location' );


With DailySummary, everything works just fine. I've added Location 
model after DailySummary, but can it be the difference?...


Some side effect. I've removed several unused modules, regenerated 
everything, it's ok


Alex.



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


[Catalyst] Feelnig dumb: $c->model returns controller?

2008-02-23 Thread Alex Povolotsky

Hello!

I'm still writing my first Catalyst app; I'm beginning to love DBIx, and 
the overall concept.


But.

 my $lmodel = $c->model('Location');
 use Data::Dumper;
 print STDERR Dumper($lmodel);
 my $locs = $lmodel->search(undef); # Sort by follows, if 
required  

Caught exception in Traffic2::C::Location->list "Can't locate object 
method "search" via package "Traffic2::C::Location" at 
/usr/local/traffic/Traffic2/script/../lib/Traffic2/C/Location.pm line 36."


$VAR1 = bless( {
'_application' => 'Traffic2'
  }, 'Traffic2::C::Location' );


With DailySummary, everything works just fine. I've added Location model 
after DailySummary, but can it be the difference?...


Alex.


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


Re: [Catalyst] So, what do we want in the -next- book?

2008-02-23 Thread Alex Povolotsky

Matt S Trout wrote:

Since a fair few of you will now have John's book, I figured it was time
to ask what you'd want from a second book.

I guess the existing one provides a pretty good tutorial style, so we should
be looking at something more in-depth / intermediate to advanced.

What do you guys think?

  

1. Using bases with transactions and without auto-commit.
2. Just simple link to nginx as a solution for memory/load balance problems

I've just received The Book and haven't complete it ;)

Alex.

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


[Catalyst] Instant CRUD with DBIC::Schema

2008-02-20 Thread Alex Povolotsky

Hello!

Scaffold seems to be a good thing, but it is using CDBI. Maybe something 
like it with DBIC exists?


Alex.


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


Re: [Catalyst] Dumb (?) question on TTsite

2008-02-18 Thread Alex Povolotsky

Matt S Trout wrote:

On Sun, Feb 17, 2008 at 11:20:46PM +0300, Alex Povolotsky wrote:
  

Hello!

How can I access variables in

[% META %]

part of template?



META is compile-time.

There aren't any variables yet.

  

So do I have a way to modify title without rewriting TTsite wrapper?...

Alex.




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


Re: [Catalyst] Calendar for Catalyst application?...

2008-02-18 Thread Alex Povolotsky

Len Jaffe wrote:



On Feb 17, 2008 2:14 PM, Alex Povolotsky <[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>> wrote:


Hello!

I recall I've seen somewhere calendar plugin for catalyst
applications,
but I cannot find one. Maybe someone will point me to a missing
link?...


I don't know about a plugin, but when I needed  a calendar I 
"borrowed" the calendar code from the Advent calendar, replaced the 
model with my application's DBIC schema and wrote a little bit of glue 
login that lives in the controller.


It was reasonably easy.



Cool; where can I get code?...

Alex.


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


[Catalyst] Dumb (?) question on TTsite

2008-02-17 Thread Alex Povolotsky

Hello!

How can I access variables in

[% META %]

part of template? I've found no example in tutorial and no clues as well...

Alex.


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


[Catalyst] Calendar for Catalyst application?...

2008-02-17 Thread Alex Povolotsky

Hello!

I recall I've seen somewhere calendar plugin for catalyst applications, 
but I cannot find one. Maybe someone will point me to a missing link?...


Alex.


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


Re: [Catalyst] Dumb question of a beginner

2008-02-11 Thread Alex Povolotsky

Johan Lindström wrote:

At 11:21 2008-02-11, Alex Povolotsky wrote:

Looking at Catalyst::Enzyme::CRUD::Controller

.

$c->stash->{items} = [ $model->retrieve_all() ];

.

what should I change?


If you're a newbie, I think it's a mistake to go down the Class::DBI 
route instead of using DBIx::Class. Which means, don't use 
Catalyst::Enzyme (which is tied to CDBI). So the long/medium term 
answer to your question is: change to another Catalyst CRUD module. 
I'm sure the list can provide default recommendations.


But the short term answer to your question is here:
http://search.cpan.org/~tmtm/Class-DBI-v3.0.17/lib/Class/DBI.pm#search


Looks reasonable; I'm trying to untie Enzyme from CDBI.

Alex.


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


Re: [Catalyst] Dumb question of a beginner

2008-02-11 Thread Alex Povolotsky

Chisel Wright wrote:

On Mon, Feb 11, 2008 at 12:55:55PM +0300, Alex Povolotsky wrote:
  

Hello!

I haven't find the answer in FAQ and cookbook, so I'm asking here.

How do I add server-side sorting for list operation? I want to select * 
from table sort by field instead of default select * from table



I think you are looking for 'order_by' in perldoc DBIx::Class::ResultSet

  

Looking at Catalyst::Enzyme::CRUD::Controller


sub list : Local {
   my ( $self, $c ) = @_;
   my $model = $self->model_with_pager($c, 
$self->crud_config->{rows_per_page}, $c->req->param("page"))

;
   $c->stash->{items} = [ $model->retrieve_all() ];
   $c->stash->{template} = 'list.tt';
}

what should I change?

Alex.


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


[Catalyst] Dumb question of a beginner

2008-02-11 Thread Alex Povolotsky

Hello!

I haven't find the answer in FAQ and cookbook, so I'm asking here.

How do I add server-side sorting for list operation? I want to select * 
from table sort by field instead of default select * from table


Alex.


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


Re: [Catalyst] Documentation on DBIx Class

2008-01-18 Thread Alex Povolotsky

Jennifer Ahn wrote:

Where is a good place to learn DBIx::Class in a few hours?

I've always used the DBI module for my CGI scripts.

Few hours? Ask your documentation pills dealer... ;)

Alex.


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


Re: [Catalyst] Documentation on DBIx Class

2008-01-18 Thread Alex Povolotsky

Ian Tegebo wrote:



Unfortunately, Tutorial is weak. CRUD section lacks Update at all, and
it does not deal with any transaction, and it seems to use poor methods
to create records.


Could you provide an example of richer methods for record creation?

  
Not yet. I'm learning Catalyst for about two weeks. I like Catalyst and 
I don't like Catalyst's manuals. I'll try to write something as soon as 
I'll get my app working.


Alex.
P.S. Most problems in nowadays tutorial is that they tell "do this and 
this" instead "to achieve this, we must do this because of..."


Alex.

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


Re: [Catalyst] Development environments and performance

2008-01-16 Thread Alex Povolotsky

Ian Docherty wrote:
I would just like to canvas opinion on a good development environment 
and practices for Catalyst since we are starting to have some 
performance issues.


We are running on a managed server (Red Hat Enterprise), Apache2, 
MySql 5.1


We have several people developing on this machine (about 5), each with 
their own sandboxes.


I have set up apache so that each developer runs their Catalyst 
application under fast-cgi.


We are beginning to see some performance issues especially with 
several people testing at the same time on different fast-cgi processes.


The 'top' command shows 'server.pl' and 'perl' taking the bulk of the 
cpu time.
CPU time? Look at paging first of all. How much RAM do you have? How 
much swap is your server using? Look at top, especially at system time 
percentage.


Best case for a simple dynamic page in Catalyst to respond is about 5 
seconds. With several people testing at the same time it can take  30 
seconds or more to respond to a simple page. I would have hoped for 
only a second or so on such a lightly loaded server.



Try catalyst-server, it does some (extremly basic) profiling.


Alex.

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


  1   2   >