Re: [Catalyst] Change of server

2017-03-02 Thread mallah


The real error message is somewhere try
systemctl status apache2
To find the error messages or tail the error Logs. 
RegdsMallah


Sent from my Samsung Galaxy smartphone.
 Original message From: Andrés Chandía  
Date: 3/3/17  10:32  (GMT+05:30) To: catalyst@lists.scsys.co.uk Subject: 
[Catalyst] Change of server 
 Hi there, I had a Catalyst application working on a debian 7 perl 5.14 apache 
2.4, but I
had to change it to a new server working with ubuntu 16.04 perl 5.22 apache 
2.4.18.

I did all the installation in the same way I did it for the old debian but the 
apache server
is not starting, and at the logs a get nothing but:

Mar 03 05:32:29 iac systemd[1]:
apache2.service: Control process exited, code=exited status=1
Mar 03 05:32:29 iac
systemd[1]: Failed to start LSB: Apache2 web server.
Mar 03 05:32:29 iac systemd[1]:
apache2.service: Unit entered failed state.
Mar 03 05:32:29 iac systemd[1]:
apache2.service: Failed with result 'exit-code'.

the apache config at the old
server, wich I change accordingly, was:


 
PerlSwitches -I /mnt/vmdata/iac/web/lib
PerlModule IAC

ServerAdmin and...@chandia.net
ServerName iac.upf.edu
   
ServerAlias iac.upf.edu
DocumentRoot /mnt/vmdata/iac/web/root


use lib qw( /mnt/vmdata/iac/web/lib );




SetHandler 
modperl
PerlResponseHandler IAC


SetHandler none
   

Alias /iac/stats_tasks/
"/mnt/vmdata/iac/iac_data/stats-tasks"

SetHandler none
   
Order allow,deny
Allow from all

   
Alias /iac/txt_output/ "/mnt/vmdata/iac/iac_data/txt_output"
   

SetHandler none
  
 Order allow,deny
Allow from all


   CustomLog /var/log/apache2/iac.access.log combined
ErrorLog
/var/log/apache2/iac.error.log


Any suggestion on what to
look for or utimately how to solve this?

thanks a lot.


___

andrés
chandía

NMT |
Dungupeyem | Corlexim

administrador de:
Parles.upf | Amind
terapia | Mapuche koyaktu | Nocando |
mail: ONG Mapuche koyaktu | Psicoaching |
P No imprima innecesariamente. ¡Cuide el medio ambiente!
___
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] Change of server

2017-03-03 Thread mallah
Have you tried starting apache2 binary  from cmdline by specifying the path of 
main configuration file.
Check apache2 -h 
Also check netstat -lnp output if there is something bound to the same port 
(possibly 80 )


Sent from my Samsung Galaxy smartphone.
 Original message From: Andrés Chandía  
Date: 3/3/17  12:05  (GMT+05:30) To: The elegant MVC web framework 
 Subject: Re: [Catalyst] Change of server 
Thanks for your concern, I have tried that also:

systemctl status apache2

 apache2.service - LSB: Apache2 web server
   Loaded: loaded
(/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In:
/lib/systemd/system/apache2.service.d
  
└─apache2-systemd.conf
   Active: failed (Result: exit-code) since
Fri 2017-03-03 07:31:59 CET; 4s ago
 Docs:
man:systemd-sysv-generator(8)
  Process: 1187 ExecStart=/etc/init.d/apache2 start
(code=exited, status=1/FAILURE)

Mar 03 07:27:02 iac apache2[1187]: |
/results/stats_query/...    |
/results/stats_query
|
Mar 03 07:27:02 iac apache2[1187]: |
/results/stats_results/...  |
/results/stats_results  
|
Mar 03 07:27:02 iac apache2[1187]:
'-+--'
Mar 03
07:27:02 iac apache2[1187]: [info] IAC powered by Catalyst 5.90103
Mar 03 07:31:59 iac
apache2[1187]:  *
Mar 03 07:31:59 iac apache2[1187]:  * The apache2 instance
did not start within 20 seconds. Please read the log file
Mar 03 07:31:59 iac systemd[1]:
apache2.service: Control process exited, code=exited status=1
Mar 03 07:31:59 iac
systemd[1]: Failed to start LSB: Apache2 web server.
Mar 03 07:31:59 iac systemd[1]:
apache2.service: Unit entered failed state.
Mar 03 07:31:59 iac systemd[1]:
apache2.service: Failed with result 'exit-code'.

tail -f /var/log/apache2/error.log
says nothing

tail -f /var/log/apache2/local.iac.error.log says nothing

tail -f /var/log/syslog 
Mar  3 07:33:43 iac apache2[1466]: |
/results/stats_query/...    |
/results/stats_query
|
Mar  3 07:33:43 iac apache2[1466]: |
/results/stats_results/...  |
/results/stats_results  
|
Mar  3 07:33:43 iac apache2[1466]:
'-+--'
Mar 
3 07:33:43 iac apache2[1466]: [info] IAC powered by Catalyst 5.90103
Mar  3 07:34:03
iac apache2[1466]:  *
Mar  3 07:34:03 iac apache2[1466]:  * The apache2
instance did not start within 20 seconds. Please read the log files to discover 
problems
Mar  3 07:34:03 iac systemd[1]: apache2.service: Control process exited, 
code=exited
status=1
Mar  3 07:34:03 iac systemd[1]: Failed to start LSB: Apache2 web server.
Mar  3 07:34:03 iac systemd[1]: apache2.service: Unit entered failed state.
Mar  3 07:34:03 iac systemd[1]: apache2.service: Failed with result 'exit-code'.



El Vie, 3 de Marzo de 2017, 6:33, mallah escribió:
 





The real error message is somewhere try


systemctl status apache2


To find the error messages or tail the error 
Logs. 


Regds
Mallah







Sent from my Samsung Galaxy smartphone.




 Original message 
From: Andrés Chandía  
Date: 3/3/17  10:32  (GMT+05:30) 
To: catalyst@lists.scsys.co.uk 
Subject: [Catalyst] Change of server 



Hi there, I had a Catalyst application working on a debian 7 perl 5.14 apache 
2.4, but I had
to change it to a new server working with ubuntu 16.04 perl 5.22 apache 2.4.18.

I
did all the installation in the same way I did it for the old debian but the 
apache server is
not starting, and at the logs a get nothing but:

Mar 03 05:32:29 iac systemd[1]:
apache2.service: Control process exited, code=exited status=1
Mar 03 05:32:29 iac
systemd[1]: Failed to start LSB: Apache2 web server.
Mar 03 05:32:29 iac systemd[1]:
apache2.service: Unit entered failed state.
Mar 03 05:32:29 iac systemd[1]:
apache2.service: Failed with result 'exit-code'.

the apache config at the old
server, wich I change accordingly, was:


 
PerlSwitches -I /mnt/vmdata/iac/web/lib
PerlModule IAC

ServerAdmin
and...@chandia.net
ServerName iac.upf.edu
ServerAlias iac.upf.edu
   
DocumentRoot /mnt/vmdata/iac/web/root



use lib qw( /mnt/vmdata/iac/web/lib );





SetHandler  modperl
 
  PerlResponseHandler IAC


SetHandler
none

Alias /iac/stats_tasks/
"/mnt/vmdata/iac/iac_data/stats-tasks"

SetHandler
none
Order allow,deny
Allow from all


   Alias /iac/txt_output/ "/mnt/vmdata/iac/iac_data/txt_output"

SetHandler none
Order allow,deny
   
Allow from all

CustomLog /var/log/apache2/iac.access.log combined

   ErrorLog /var/log/apache2/iac.error.log


Any suggestion on what to look
for or utimately how to solve this?

than

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

2017-04-22 Thread mallah
is it resolved now ?
regd smallah


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/


Re: [Catalyst] stash alternative for passing data

2017-05-13 Thread mallah
Yes that is elegant and viable. thanks.


Sent from my Samsung Galaxy smartphone.
 Original message From: Robert Brown  
Date: 5/12/17  03:11  (GMT+05:30) To: catalyst@lists.scsys.co.uk Subject: Re: 
[Catalyst] stash alternative for passing data 
You can configure Catalyst::View::JSON to NOT work on the entire stash.

See 'expose_stash' in the config: 
https://metacpan.org/pod/Catalyst::View::JSON



On 11/05/17 20:29, Rajesh Kumar Mallah wrote:
>
> Hi
>
> We need to pass value of variables from one stage of request
> processing to other. We can use stash , but the problem is
> some views like  Catalyst::View::JSON   tend to work on the
> entire stash and they convert the stash to JSON output and we
> do not want to expose all the intermediate values/variables.
>
>
> Hence my question is  is there any mechanism to share data
> in Catalyst App other than the stash.
>
> Or should i create a simple perl package and use a global
> hash variable in it ?
>
> regds
> mallah.
>
>
>
>
>
>
> ___
> 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] catalyst authorization , self_check

2017-11-13 Thread Rajesh Mallah
Hi , 

the roles of my users cannot be represented in a table column 
for a separate relation . It involves some logic that can be put 
in a subroutine/method of my DBIx::Class schema object 
representing the user. 


my Auth setup is as below: 


= 
__PACKAGE__->config->{'Plugin::Authentication'} = 
{ 
default => { 
class => 'SimpleDB', 
user_model => 'DB::MyProjectUser', 
password_type => 'self_check', 
} 
} ; 
= 

i have implemented the 'check_password' in MyProjectUser.pm 
and it works well. What i need is similar flexibility to specify the 
roles of an existing user . I cannot use role_field , role_relation 



Regds 

Rajesh Kumar Mallah. 
Redgrape Technologies ( https://www.redgrape.tech ) 
Mobile: 09811255597, Land: 011-49044122 
--
 
Opportunities are usually disguised as hard work, so most people don't
 recognize them 
--
 
___
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 authorization , self_check

2017-11-13 Thread Rajesh Mallah
Thanks it did work! 

and Thanks again for replying so soon! 

Kind Regards 
Rajesh Mallah. 

 

lib/MyProj/Schema/Result/MyProjUser.pm 

sub myrolecol { 

my ($self) = @_; 

my $log = Log::Log4perl->get_logger(); 
$log -> debug ("myrolecol has been called!"); 
return "thisrole|testrole"; 

} 

 

__PACKAGE__->config->{'Plugin::Authentication'} = 
{ 
default => { 
class => 'SimpleDB', 
user_model => 'DB::MyProjectUser', 
password_type => 'self_check', 
role_column => 'myrolecol' 
} 
} ; 

=== 

the reason i was not able to get it was , I was using 'role_field' 
instead of 'role_column' 

Regds 

Rajesh Kumar Mallah. 
Redgrape Technologies ( https://www.redgrape.tech ) 
Mobile: 09811255597, Land: 011-49044122 
--
 
Opportunities are usually disguised as hard work, so most people don't
 recognize them 
--
 

| From: "Will Crawford" 
| To: "Catalyst" 
| Sent: Monday, November 13, 2017 9:25:58 PM
| Subject: Re: [Catalyst] catalyst authorization , self_check

| On 13 November 2017 at 15:21, Rajesh Mallah  wrote:
|> Hi , 
|> 
|> the roles of my users cannot be represented in a table column 
|> for a separate relation . It involves some logic that can be put 
|> in a subroutine/method of my DBIx::Class schema object 
|> representing the user. 

| [...]
|> i have implemented the 'check_password' in MyProjectUser.pm 
|> and it works well. What i need is similar flexibility to specify the 
|> roles of an existing user . I cannot use role_field , role_relation 

| Just use role_column!

| Giving the name of your subroutine/method as role_column, and making
| sure it returns a suitable space- or comma-separated list of role
| names, should be sufficient (a quick check of the code in
| Catalyst::Authentication::Store::DBIx::Class::User shows it just calls
| the method if it exists, it doesn't actually need to be a column
| accessor).

| Waiting to be proven wrong if there's code anywhere else checking that
| it's actually a column ... :o)

| ___
| 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] Catalyst based Content Management/Blogging

2018-04-20 Thread Rajesh Mallah
Hi , 

Please have a look at WebGUI 
http://www.webgui.org/ 

I am not sure if it uses catalyst though 

Regds 

Rajesh Kumar Mallah. 
Redgrape Technologies ( https://www.redgrape.tech ) 
Mobile: 09811255597, Land: 011-49044122 
--
 
Opportunities are usually disguised as hard work, so most people don't
 recognize them 
--
 

| From: "Aaron Trevena" 
| To: "Catalyst" 
| Sent: Thursday, April 19, 2018 2:06:56 PM
| Subject: [Catalyst] Catalyst based Content Management/Blogging

| Hi All,

| What's the "state of the art" these days for CMS & Blogging with
| Catalyst (or just Perl and something else) - I'd prefer Catalyst as I
| find it easy to work with and I'm pretty familiar with it.

| Previously I've worked on a fork of denny's ShinyCMS project which is
| nice enough, and added support for running multiple instances in a
| single application, and now I have some nice code that allows
| multi-tenant databases which can work nicely with catalyst
| applications.

| Cheers,

| A.

| --
| Aaron J Trevena, BSc Hons
| http://www.aarontrevena.co.uk
| LAMP System Integration, Development and Consulting

| ___
| 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] Overwriting/restoring request data

2018-11-04 Thread Rajesh Mallah


Hi Carl , 

why not just use sessions which are available 
irrespective of user is logged in or not

$c->session i mean.

Regds

Rajesh Kumar Mallah.
Redgrape Technologies ( https://www.redgrape.tech )
Mobile: 09811255597, Land: 011-49044122 
--
Opportunities are usually disguised as hard work, so most people don't
 recognize them
--

- Original Message -
| From: "fireartist" 
| To: "Catalyst" 
| Sent: Monday, November 5, 2018 3:44:23 AM
| Subject: [Catalyst] Overwriting/restoring request data

| Hi,
| 
| If a user sends a request that requires a login, I'd like to persist
| their data until they've successfully logged-in, and continue without
| them having to re-enter the original data.
| 
| Currently, anywhere that requires a login has the following method:
| 
| sub auto : Private {
|  my ( $self, $c ) = @_;
| 
|  $self->require_login($c);
| 
|  $c->check_any_user_role(qw( editor admin ));
| }
| 
| The require_login method in my BaseController.pm returns true if
| logged-in, and does detach('/auth/login') if they're not.
| 
| The require_login method is an ideal place to grab the Request data,
| freeze it with Storable, encrypt_hex it with Crypt::CBC, and stick it in
| the stash.
| Then, the login action can put that frozen request into a hidden form
| field.
| I'd also need to store the $c->action->private_path() so I can detach to
| the correct place after login.
| 
| The part I'm unsure of is how much of the $c->request data to store, and
| how to restore it again after a successful login.
| 
| Initially I only need to deal with basic post key/value params, however
| I do anticipate needing to deal with file uploads in the future.
| 
| Has anyone dealt with this scenario already, or have any advice on how
| to restore a different Request?
| 
| Many thanks,
| Carl
| 
| 
| ___
| 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] Applying a global SQL filter on REST controller.

2017-02-05 Thread Rajesh Kumar Mallah
Dear Catalyst Experts/Users/Hackers,

Please guide for the below situation,
I have put reasonable effort by searching on online
resources.


We have an application backed by SQL tables that stores
data of multiple customers in same table . We have
many such tables and all of them bear a column customer_id
for separating the records of one customer to another.


The security isolation requirement is that one customer should
not get to see records of other customer. What i have in mind
is to append an SQL filter customer_id = << customer_id of logged in
customer >>
at a global level . The controller modules for each database table are
being (auto)generated by the helper
Catalyst::Helper::Controller::DBIC::API::REST The dataset is being exposed
via REST utilising
Catalyst::Controller::DBIC::API

Can anyone please guide where such a constraint can be put ?

Regds
Rajesh Kumar Mallah.






___
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] Applying a global SQL filter on REST controller.

2017-02-05 Thread Rajesh Kumar Mallah


Ok i do see some light! that I am exploring.
Sorry for the noise i shall post again if i find a
solution or otherwise even.


http://search.cpan.org/~abraxxa/Catalyst-Controller-DBIC-API-2.006002/lib/Catalyst/Controller/DBIC/API.pm

list_munge_parameters

list_munge_parameters is a noop by default. All arguments will be passed
through without any manipulation. In order to successfully manipulate the
parameters before the search is performed, simply access
$c->req->search_parameters|search_attributes (ArrayRef and HashRef
respectively), which correspond directly to ->search($parameters,
$attributes). Parameter keys will be in already-aliased form. To store the
munged parameters call $c->req->_set_search_parameters($newparams) and
$c->req->_set_search_attributes($newattrs).



> Dear Catalyst Experts/Users/Hackers,
>
> Please guide for the below situation,
> I have put reasonable effort by searching on online
> resources.
>
>
> We have an application backed by SQL tables that stores
> data of multiple customers in same table . We have
> many such tables and all of them bear a column customer_id
> for separating the records of one customer to another.
>
>
> The security isolation requirement is that one customer should
> not get to see records of other customer. What i have in mind
> is to append an SQL filter customer_id = << customer_id of logged in
> customer >>
> at a global level . The controller modules for each database table are
> being (auto)generated by the helper
> Catalyst::Helper::Controller::DBIC::API::REST The dataset is being exposed
> via REST utilising
> Catalyst::Controller::DBIC::API
>
> Can anyone please guide where such a constraint can be put ?
>
> Regds
> Rajesh Kumar Mallah.
>
>
>
>
>
>
> ___
> 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] Applying a global SQL filter on REST controller.

2017-02-05 Thread Rajesh Kumar Mallah


Ok it did work out and i am able achieve what i wanted.


I created the below subroutine in:

ControllerBase/REST.pm

sub list_munge_parameters {
my ( $self, $c ) = @_;
$c->log->debug(" * list_munge_parameters  callled!");
$c->req->_set_search_parameters( { society_id =>
$c->user->society_id() } );
}

But is it ok to use "PROTECTED METHODS" ?

Regds
Mallah



>
>
> Ok i do see some light! that I am exploring.
> Sorry for the noise i shall post again if i find a
> solution or otherwise even.
>
>
>
 
http://search.cpan.org/~abraxxa/Catalyst-Controller-DBIC-API-2.006002/lib/Catalyst/Controller/DBIC/API.pm
>
> list_munge_parameters
>
> list_munge_parameters is a noop by default. All arguments will be passed
> through without any manipulation. In order to successfully manipulate the
> parameters before the search is performed, simply access
> $c->req->search_parameters|search_attributes (ArrayRef and HashRef
> respectively), which correspond directly to ->search($parameters,
> $attributes). Parameter keys will be in already-aliased form. To store the
> munged parameters call $c->req->_set_search_parameters($newparams) and
> $c->req->_set_search_attributes($newattrs).
>
>
>
>> Dear Catalyst Experts/Users/Hackers,
>>
>> Please guide for the below situation,
>> I have put reasonable effort by searching on online
>> resources.
>>
>>
>> We have an application backed by SQL tables that stores
>> data of multiple customers in same table . We have
>> many such tables and all of them bear a column customer_id
>> for separating the records of one customer to another.
>>
>>
>> The security isolation requirement is that one customer should
>> not get to see records of other customer. What i have in mind
>> is to append an SQL filter customer_id = << customer_id of logged in
>> customer >>
>> at a global level . The controller modules for each database table are
>> being (auto)generated by the helper
>> Catalyst::Helper::Controller::DBIC::API::REST The dataset is being
>> exposed
>> via REST utilising
>> Catalyst::Controller::DBIC::API
>>
>> Can anyone please guide where such a constraint can be put ?
>>
>> Regds
>> Rajesh Kumar Mallah.
>>
>>
>>
>>
>>
>>
>> ___
>> 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] Applying a global SQL filter on REST controller.

2017-02-07 Thread Rajesh Kumar Mallah

Hey  ,

Thanks for the reply . I am new Catalyst stilling reading docs
on actions . Shall update if i am able to use the method you
suggest.


Kind Regards
Rajesh Mallah.

> Hi Mallah,
>
> typically with DBIx::Class you would have a Chained root action in your
> controller which puts an already filtered DBIx::Class resultset on the
> stash and have all other action chained off this one.
>
> DBIC::API provides generate_rs [1] to enable you to do this.
>
>
> On 2017-02-06 07:12, Rajesh Kumar Mallah wrote:
>>
>> Ok it did work out and i am able achieve what i wanted.
>>
>>
>> I created the below subroutine in:
>>
>> ControllerBase/REST.pm
>>
>> sub list_munge_parameters {
>>  my ( $self, $c ) = @_;
>>  $c->log->debug(" * list_munge_parameters  callled!");
>>  $c->req->_set_search_parameters( { society_id =>
>> $c->user->society_id() } );
>> }
>>
>> But is it ok to use "PROTECTED METHODS" ?
> They might be renamed, go away etc. on a refactor, which is why they
> aren't exposed and documented.
>
>>
>> Regds
>> Mallah
> Best regards, Alex
>
> [1] https://metacpan.org/pod/Catalyst::Controller::DBIC::API#generate_rs
>
>>
>>
>>
>>>
>>> Ok i do see some light! that I am exploring.
>>> Sorry for the noise i shall post again if i find a
>>> solution or otherwise even.
>>>
>>>
>>>
>>  
 
http://search.cpan.org/~abraxxa/Catalyst-Controller-DBIC-API-2.006002/lib/Catalyst/Controller/DBIC/API.pm
>>> list_munge_parameters
>>>
>>> list_munge_parameters is a noop by default. All arguments will be
>>> passed
>>> through without any manipulation. In order to successfully manipulate
>>> the
>>> parameters before the search is performed, simply access
>>> $c->req->search_parameters|search_attributes (ArrayRef and HashRef
>>> respectively), which correspond directly to ->search($parameters,
>>> $attributes). Parameter keys will be in already-aliased form. To store
>>> the
>>> munged parameters call $c->req->_set_search_parameters($newparams) and
>>> $c->req->_set_search_attributes($newattrs).
>>>
>>>
>>>
>>>> Dear Catalyst Experts/Users/Hackers,
>>>>
>>>> Please guide for the below situation,
>>>> I have put reasonable effort by searching on online
>>>> resources.
>>>>
>>>>
>>>> We have an application backed by SQL tables that stores
>>>> data of multiple customers in same table . We have
>>>> many such tables and all of them bear a column customer_id
>>>> for separating the records of one customer to another.
>>>>
>>>>
>>>> The security isolation requirement is that one customer should
>>>> not get to see records of other customer. What i have in mind
>>>> is to append an SQL filter customer_id = << customer_id of logged in
>>>> customer >>
>>>> at a global level . The controller modules for each database table are
>>>> being (auto)generated by the helper
>>>> Catalyst::Helper::Controller::DBIC::API::REST The dataset is being
>>>> exposed
>>>> via REST utilising
>>>> Catalyst::Controller::DBIC::API
>>>>
>>>> Can anyone please guide where such a constraint can be put ?
>>>>
>>>> Regds
>>>> Rajesh Kumar Mallah.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ___
>>>> 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
>> S

[Catalyst] post processing filter in Catalyst apps

2017-02-19 Thread Rajesh Kumar Mallah

Dear Catalyst Users ,


What would be a good place to post process the HTML output from
View (TT in my case).

I would want to replace all static urls with a url bearing version.
eg
/static/images/logo-1.png should become
/static/ver8922/images/logo-1.png


i cannot use uri_for in templates as our  frontend designers also
work on the same files and load them in a non-catalyst environment.
(using apache on windows).

Regds
mallah.







___
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] post processing filter in Catalyst apps

2017-02-19 Thread Rajesh Kumar Mallah


Hi ,

I was able to do so in Controller/Root.pm

sub end : Private {
my ($self, $c) = @_;
$c->forward('render') unless $c->res->output ;
$c->fillform($c->stash->{fillindata}) ;

 >>>>   my $body = $c->response->{body};
 >>>>   $body =~ s#/static/#/static/ver8291/#g ;
 >>>>   $c->response->output($body);
}


Thanks.

Regds
mallah.


>
> Dear Catalyst Users ,
>
>
> What would be a good place to post process the HTML output from
> View (TT in my case).
>
> I would want to replace all static urls with a url bearing version.
> eg
> /static/images/logo-1.png should become
> /static/ver8922/images/logo-1.png
>
>
> i cannot use uri_for in templates as our  frontend designers also
> work on the same files and load them in a non-catalyst environment.
> (using apache on windows).
>
> Regds
> mallah.
>
>
>
>





___
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] post processing filter in Catalyst apps

2017-02-20 Thread Rajesh Kumar Mallah

Dear Dimitar,


the verXXX change everytime there is git commit.
I was able to solve my problem completely for development environment.

For production i would serve static from from apache or lighttpd
with a rewrite rule that would strip off the version numbers.
Embedding version number in urls of css and js was just for
defeating browser cache.

I am posting the Root.pm below for reference:

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

   # in case of static files do not render view.

return if ($c->stash->{file_output}) ;


$c->forward('render') unless $c->res->output ;
$c->fillform($c->stash->{fillindata}) ;

my $body = \$c->res->body;

my $imgversion   = $c->config->{imgversion}  ;
my $cssversion   = $c->config->{cssversion}  ;
my $jsversion= $c->config->{jsversion}   ;
my $bowerversion = $c->config->{bowerversion};

# below code injects versions into urls.

$$body =~ s#/static/images/#/static/ver-$imgversion/images/#g;
$$body =~ s#/static/css/#/static/ver-$cssversion/css/#g;
$$body =~ s#/static/js/#/static/ver-$jsversion/js/#g;
$$body =~
s#/static/bower_components/#/static/ver-$bowerversion/bower_components/#g;

$c->res->body($$body);
}


# below uses deprecated Regex action ( shall be improved in future)

sub versioned_static_files : Regex('static/ver-.*?/(.*$)') {
  my ( $self, $c ) = @_;
  my $path =  $c->req->captures->[0];
  $c->serve_static_file($c->config->{appdir} . '/root/static/' .  $path);
  $c->stash->{file_output} = 1;

}


# somewhere in my App.pm


# code for getting the last commit hash
# for the application repositories
# code assumes that repository is being
# maintained in git.

my $appdir = __PACKAGE__->path_to( '.' ) ;
__PACKAGE__->config->{appdir}   = $appdir  ;

__PACKAGE__->log->debug("appdir is : $appdir");

my $oldcwd = cwd();
chdir $appdir ;

my $appversion= `/usr/bin/git log --format="%h" -n 1` 
   ;
my $feversion = `/usr/bin/git log --format="%h" -n 1 -- root` 
   ;
my $imgversion= `/usr/bin/git log --format="%h" -n 1 --
root/static/images`   ;
my $cssversion= `/usr/bin/git log --format="%h" -n 1 --
root/static/css`  ;
my $jsversion = `/usr/bin/git log --format="%h" -n 1 --
root/static/js`   ;
my $bowerversion  = `/usr/bin/git log --format="%h" -n 1 --
root/static/bower_components` ;

chomp
($appversion,$feversion,$imgversion,$cssversion,$jsversion,$bowerversion);

__PACKAGE__->config->{appversion}   = $appversion  ;
__PACKAGE__->config->{imgversion}   = $imgversion  ;
__PACKAGE__->config->{cssversion}   = $cssversion  ;
__PACKAGE__->config->{jsversion}= $jsversion   ;
__PACKAGE__->config->{bowerversion} = $bowerversion;

__PACKAGE__->config->{backend_version}= $appversion  ;
__PACKAGE__->config->{frontend_version}   = $feversion   ;

__PACKAGE__->log->debug("versions: appversion:$appversion
feversion:$feversion imgversion:$imgversion cssversion:$cssversion
jsversion:$jsversion bowerversion:$bowerversion");


chdir $oldcwd;




> Why don't you create a symlink verXXX to images at your server?
>
> Cheers
>
>> Hi , I was able to do so in Controller/Root.pm sub end : Private { my
>> ($self, $c) = @_; $c->forward('render') unless $c->res->output
>> ; $c->fillform($c->stash->{fillindata}) ;  my
>> $body = $c->response->{body};  $body =~
>> s#/static/#/static/ver8291/#g ; 
>> $c->response->output($body); } Thanks. Regds
>





___
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] post processing filter in Catalyst apps

2017-02-22 Thread Rajesh Kumar Mallah

Hi ,

Certain caching proxies can be configured to ignore query params,
that is why we feel altering the path to be more robust.

The templates do not have anything in them that modify the paths,
all is of course in the catalyst app (Controller) itself so I am
not really understanding the issue

( disclaimer: I am doing my first catalyst project and was
   into Mason before).


regds
mallah.


> Hi,
>
> if you want to do this for to use caching but still force the files to
> get downloaded on a new app version I'd suggest appending a query
> parameter, we use ?v=[% constants.version %] which is set in the view:
>
>
> __PACKAGE__->config(
>  CONSTANTS  => { version => $Our::App::VERSION },
>
> );
>
> This shouldn't break using the templates without a Catalyst app in the
> background and still does cache-busting.
>
> Best regards, Alex
>
> On 2017-02-19 09:40, Rajesh Kumar Mallah wrote:
>> Dear Catalyst Users ,
>>
>>
>> What would be a good place to post process the HTML output from
>> View (TT in my case).
>>
>> I would want to replace all static urls with a url bearing version.
>> eg
>> /static/images/logo-1.png should become
>> /static/ver8922/images/logo-1.png
>>
>>
>> i cannot use uri_for in templates as our  frontend designers also
>> work on the same files and load them in a non-catalyst environment.
>> (using apache on windows).
>>
>> Regds
>> mallah.
>>
>>
>>
>>
>>
>>
>>
>> ___
>> 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/
>
>
>
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
> Handelsgericht Wien, FN 79340b
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> Notice: This e-mail contains information that is confidential and may be
> privileged.
> If you are not the intended recipient, please notify the sender and then
> delete this e-mail immediately.
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
>
> ___
> 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] Asynch webservices with catalyst

2017-02-28 Thread Rajesh Kumar Mallah


Have you gone through ,

http://stackoverflow.com/questions/25277158/run-asynchronous-methods-in-catalyst-perl


could you elaborate a bit on the real problem?


Regds
Mallah.

> Hi all,
>
> I know that catalyst provides some basic support for sending asynch
> responses to clients but the examples & documentation are a bit thin
> on the ground.  I was wondering if anybody has had much success with
> async catalyst request/responses and in particular for webservices.
>
> Cheers,
>
> A
>
> --
> Aaron J Trevena, BSc Hons
> http://www.aarontrevena.co.uk
> LAMP System Integration, Development and Consulting
>
> ___
> 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] usage / example for Catalyst::Controller::DBIC::API::REST

2017-02-28 Thread Rajesh Kumar Mallah


I am trying to use  Catalyst::Controller::DBIC::API::REST
to feed jtable with JSON

Eg :

the request

http://10.100.102.38:3000/api/rest/general/members?limit=3&list_returns=holder1&list_returns=member_id

Leads to response:


{
  "Records": [
{
  "member_id": 366,
  "holder1": "Jinesh"
},
{
  "member_id": 367,
  "holder1": "Gita"
},
{
  "member_id": 368,
  "holder1": "Sheela"
}
  ],
  "Result": "OK"
}


The url contains the parameter 'limit' as i configured count_arg as 'limit'
I need a simple example on how to pass the search param

eg i want to recordset to be restricted to member_id=> 368


could anyone kindly help.
I have done my research before approaching this list.


regds
mallah.





___
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] usage / example for Catalyst::Controller::DBIC::API::REST

2017-02-28 Thread Rajesh Kumar Mallah

Firstly thanks for the quick reply,


http://10.100.102.38:3000/api/rest/general/members/368
does respond with single record.

{
  "data": {
"group_id": null,
"pan1": null,
"mobile2": null,
"pan2": null,
"pa_city": null,
"email": null,
"membership_no": null,
"holder1": "Sheela",
"pa_state": null,
"society_id": 30,
"dob1": null,
"nominee": null,
"password": null,
"phones": null,
"if_freehold": 0,
"if_member": 0,
"present_address": null,
"flat_no": "A104",
"mobile1": "912348",
"pa_country": null,
"holder2": "Jignesh",
"pan": null,
"dob2": null,
"member_id": 368,
"pa_zip": null
  },
  "Result": "OK",
  "Record": {
"present_address": null,
"if_member": 0,
"phones": null,
"if_freehold": 0,
"pa_zip": null,
"member_id": 368,
"pan": null,
"dob2": null,
"pa_country": null,
"holder2": "Jignesh",
"mobile1": "912348",
"flat_no": "A104",
"pan2": null,
"mobile2": null,
"pan1": null,
"group_id": null,
"nominee": null,
"society_id": 30,
"password": null,
"dob1": null,
"pa_state": null,
"holder1": "Sheela",
"membership_no": null,
"email": null,
"pa_city": null
  }
}


But

http://10.100.102.38:3000/api/rest/general/members?list_count=3&list_returns=holder1&list_returns=member_id&list_search.member_id=368

does not seems to be restricting and responding with:

{
  "Result": "OK",
  "Records": [
{
  "member_id": 366,
  "holder1": "Jinesh"
},
{
  "member_id": 367,
  "holder1": "Gita"
},
{
  "member_id": 368,
  "holder1": "Sheela"
}
  ]
}


pasted below is the exact package config:

I do have a ControllerBase interface.


package SmartCGHS::Controller::API::REST::Member;

use strict;
use warnings;
use JSON::XS;

use parent qw/SmartCGHS::ControllerBase::REST/;

__PACKAGE__->config(
# Define parent chain action and partpath
action  =>  { setup => { PathPart =>
'general/members', Chained => '/api/rest/rest_base' } },
# DBIC result class
class   =>  'DB::Member',

# Columns required to create
create_requires =>  [qw/flat_no society_id/],
# Additional non-required columns that create allows
create_allows   =>  [qw/dob1 dob2 email group_id holder1
holder2 if_freehold if_member membership_no mobile1 mobile2 nominee
pa_city pa_country pa_state pa_zip pan pan1 pan2 password phones
present_address/],
# Columns that update allows
update_allows   =>  [qw/flat_no society_id dob1 dob2 email
group_id holder1 holder2 if_freehold if_member membership_no mobile1
mobile2 nominee pa_city pa_country pa_state pa_zip pan pan1 pan2
password phones present_address/],
# Columns that list returns
select  =>  [qw/flat_no membership_no email pan
present_address pa_city pa_state pa_country pa_zip holder1 holder2
nominee dob1 dob2 pan1 pan2 mobile1 mobile2 phones if_member
if_freehold password society_id member_id group_id/],


# Every possible prefetch param allowed
prefetch_allows=>  [
[qw/member_ledgers/], {  'member_ledgers' => [qw//] },
[qw/member_meter_readings/], {  'member_meter_readings' => [qw//] },
[qw/payment_collections/], {  'payment_collections' =>
[qw/member_ledgers/] },
[qw/saved_bills/], {  'saved_bills' => [qw//] },

],

# Order of generated list
ordered_by => [qw/member_id/],
# columns that can be searched on via list
search_exposes => [
qw/flat_no membership_no email pan present_address pa_city
pa_state pa_country pa_zip holder1 holder2 nominee dob1 dob2 pan1
pan2 mobile1 mobile2 phones if_member if_freehold password
society_id member_id group_id/,
{ 'member_ledgers' => [qw/transaction_id head transaction_type
amount payment_id comments generated due_on society_id member_id/]
},
{ 'member_meter_readings' => [qw/uniq_id flat_no dated reading
reading_avg society_id member_id/] },
{ 'payment_collections' => [qw/payment_id payment_mode instrument_no
payment_status instrument_bank instrument_date payment_amount
payment_time book_no receipt_no society_id member_id/] },
{ 'saved_bills' => [qw/uniq_id month year bill_html society_id
member_id/] },

],);







___
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] usage / example for Catalyst::Controller::DBIC::API::REST

2017-02-28 Thread Rajesh Kumar Mallah


Now Looking into the test scripts that came with the distribution.
Hope to find the solution.


>
> Firstly thanks for the quick reply,
>
>
> http://10.100.102.38:3000/api/rest/general/members/368
> does respond with single record.
>
> {
>   "data": {
> "group_id": null,
> "pan1": null,
> "mobile2": null,
> "pan2": null,
> "pa_city": null,
> "email": null,
> "membership_no": null,
> "holder1": "Sheela",
> "pa_state": null,
> "society_id": 30,
> "dob1": null,
> "nominee": null,
> "password": null,
> "phones": null,
> "if_freehold": 0,
> "if_member": 0,
> "present_address": null,
> "flat_no": "A104",
> "mobile1": "912348",
> "pa_country": null,
> "holder2": "Jignesh",
> "pan": null,
> "dob2": null,
> "member_id": 368,
> "pa_zip": null
>   },
>   "Result": "OK",
>   "Record": {
> "present_address": null,
> "if_member": 0,
> "phones": null,
> "if_freehold": 0,
> "pa_zip": null,
> "member_id": 368,
> "pan": null,
> "dob2": null,
> "pa_country": null,
> "holder2": "Jignesh",
> "mobile1": "912348",
> "flat_no": "A104",
> "pan2": null,
> "mobile2": null,
> "pan1": null,
> "group_id": null,
> "nominee": null,
> "society_id": 30,
> "password": null,
> "dob1": null,
> "pa_state": null,
> "holder1": "Sheela",
> "membership_no": null,
> "email": null,
> "pa_city": null
>   }
> }
>
>
> But
>
>
 
http://10.100.102.38:3000/api/rest/general/members?list_count=3&list_returns=holder1&list_returns=member_id&list_search.member_id=368
>
> does not seems to be restricting and responding with:
>
> {
>   "Result": "OK",
>   "Records": [
> {
>   "member_id": 366,
>   "holder1": "Jinesh"
> },
> {
>   "member_id": 367,
>   "holder1": "Gita"
> },
> {
>   "member_id": 368,
>   "holder1": "Sheela"
> }
>   ]
> }
>
>
> pasted below is the exact package config:
>
> I do have a ControllerBase interface.
>
> 
> package SmartCGHS::Controller::API::REST::Member;
>
> use strict;
> use warnings;
> use JSON::XS;
>
> use parent qw/SmartCGHS::ControllerBase::REST/;
>
> __PACKAGE__->config(
> # Define parent chain action and partpath
> action  =>  { setup => { PathPart =>
> 'general/members', Chained => '/api/rest/rest_base' } },
> # DBIC result class
> class   =>  'DB::Member',
>
> # Columns required to create
> create_requires =>  [qw/flat_no society_id/],
> # Additional non-required columns that create allows
> create_allows   =>  [qw/dob1 dob2 email group_id holder1
> holder2 if_freehold if_member membership_no mobile1 mobile2 nominee
> pa_city pa_country pa_state pa_zip pan pan1 pan2 password phones
> present_address/],
> # Columns that update allows
> update_allows   =>  [qw/flat_no society_id dob1 dob2 email
> group_id holder1 holder2 if_freehold if_member membership_no mobile1
> mobile2 nominee pa_city pa_country pa_state pa_zip pan pan1 pan2
> password phones present_address/],
> # Columns that list returns
> select  =>  [qw/flat_no membership_no email pan
> present_address pa_city pa_state pa_country pa_zip holder1 holder2
> nominee dob1 dob2 pan1 pan2 mobile1 mobile2 phones if_member
> if_freehold password society_id member_id group_id/],
>
>
> # Every possible prefetch param allowed
> prefetch_allows=>  [
> [qw/member_ledgers/], {  'member_ledgers' => [qw//] },
> [qw/member_meter_readings/], {  'member_meter_readings' => [qw//] },
> [qw/payment_collections/], {  'payment_collections' =>
> [qw/member_ledgers/] },
> [qw/saved_bills/], {  'saved_bills' => [qw//] },
>
> ],
>
> # Order of generated list
> ordered_by => [qw/member_id/],
> # columns that can be searched on via list
> search_exposes => [
> qw/flat_no membership_no email pan present_address pa_city
> pa_state pa_country pa_zip holder1 holder2 nominee dob1 dob2 pan1
> pan2 mobile1 mobile2 phones if_member if_freehold password
> society_id member_id group_id/,
> { 'member_ledgers' => [qw/transaction_id head transaction_type
> amount payment_id comments generated due_on society_id member_id/]
> },
> { 'member_meter_readings' => [qw/uniq_id flat_no dated reading
> reading_avg society_id member_id/] },
> { 'payment_collections' => [qw/payment_id payment_mode instrument_no
> payment_status instrument_bank instrument_date payment_amount
> payment_time book_no receipt_no society_id member_id/] },
> { 'saved_bills' => [qw/uniq_id month year bill_html society_id
> member_id/] },
>
> ],);
>
>
>
>





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

Re: [Catalyst] usage / example for Catalyst::Controller::DBIC::API::REST

2017-02-28 Thread Rajesh Kumar Mallah


Dear Dimitar/List  ,

indeed the example 1 below was correct.

The confusion resulted form multiple mistakes in my
observations and actions.

Sorry for the noise. Now my primary concern is sorted out.


Regds
mallah.




> There are a couple of ways around that.
>
> 1. Search for that record id, for example:
>
 
http://10.100.102.38:3000/api/rest/general/members?limit=3&list_returns=holder1&list_returns=member_id&search.member_id=368
>
> 2. If it's a primary key or a unique key, you can easily fetch it:
> http://10.100.102.38:3000/api/rest/general/members/368
>
> Best regards,
>
> On Tue, Feb 28, 2017 at 3:48 PM, Rajesh Kumar Mallah
> 
> wrote:
>
>>
>>
>> I am trying to use  Catalyst::Controller::DBIC::API::REST
>> to feed jtable with JSON
>>
>> Eg :
>>
>> the request
>>
>> http://10.100.102.38:3000/api/rest/general/members?limit=3&;
>> list_returns=holder1&list_returns=member_id
>>
>> Leads to response:
>>
>>
>> {
>>   "Records": [
>> {
>>   "member_id": 366,
>>   "holder1": "Jinesh"
>> },
>> {
>>   "member_id": 367,
>>   "holder1": "Gita"
>> },
>> {
>>   "member_id": 368,
>>   "holder1": "Sheela"
>> }
>>   ],
>>   "Result": "OK"
>> }
>>
>>
>> The url contains the parameter 'limit' as i configured count_arg as
>> 'limit'
>> I need a simple example on how to pass the search param
>>
>> eg i want to recordset to be restricted to member_id=> 368
>>
>>
>> could anyone kindly help.
>> I have done my research before approaching this list.
>>
>>
>> regds
>> mallah.
>>
>>
>>
>>
>>
>> ___
>> 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] complex search using Catalyst::Controller::DBIC::API::REST

2017-02-28 Thread Rajesh Kumar Mallah

Hi ,

In continuation of previous query kindly guide how to do a
anchored or unanchored ilike search using 
Catalyst::Controller::DBIC::API::REST


I have used DBIC search with lots of search conditions in past
that uses SQL::Abstract, at this moment I need a guide(document)
on how to convert SQL::Abstract's conventions to Query parameter
format


Eg:
http://10.100.102.38:3000/api/rest/general/members?list_returns=holder1&list_count=10

Returns:

{
  "Result": "OK",
  "Records": [
{
  "holder1": "Sh. R. Krishna Kumar"
},
{
  "holder1": "Sh. Sharad Kumar Srivastava"
},
{
  "holder1": "Smt. Shubhra Jain ."
},
{
  "holder1": "Sh. Balam Singh Negi"
},
{
  "holder1": "Sh. Subodh Jain"
},
{
  "holder1": "Smt. Punita Batra"
},
{
  "holder1": "Sh.K C Sardana"
},
{
  "holder1": "Smt. Sunita Mishra"
},
{
  "holder1": "Sh. Vijay Kumar Khanna"
},
    {
      "holder1": "Smt. Daisy Tyagi"
}
  ]
}


I need a Query param that would return all holder1 matching
Mis. ie holder1 ilike '%Mis%'


As always Thanks in anticipation of your valuable time/attention.


Regds
Mallah.





___
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] complex search using Catalyst::Controller::DBIC::API::REST

2017-03-01 Thread Rajesh Kumar Mallah


Hi ,

CGI::Expand collapse_hash comes to rescue ,
below is a small snippet that converts the perl
hash reference to the TT's dotted format using
CGI::Expand.



#!/usr/bin/perl -w

use strict;

use CGI::Expand qw(expand_hash  collapse_hash);
use Data::Dumper;
use JSON::XS;
use URI::Escape;


# SQL::Abstract Syntax comes here.
my $where  = {
   search => {
  holder1 => { -ilike => '%mis%' },
  mobile1 => { -ilike => '%967%' },
  flat_no => 'A203'
}
} ;



my $flat_hash = collapse_hash( $where );

print  join '&' ,   map { my $k = $_; my $v = uri_escape(
$flat_hash->{$k})  ; "$k=$v"   } keys %{$flat_hash};

print "\n";
==

Output:


$VAR1 = {
  'search.mobile1.-ilike' => '%967%',
  'search.holder1.-ilike' => '%mis%',
  'search.flat_no' => 'A203'
};
search.mobile1.-ilike=%25967%25&search.holder1.-ilike=%25mis%25&search.flat_no=A203



Regds
Mallah.




>
> Hi ,
>
> In continuation of previous query kindly guide how to do a
> anchored or unanchored ilike search using
> Catalyst::Controller::DBIC::API::REST
>
>
> I have used DBIC search with lots of search conditions in past
> that uses SQL::Abstract, at this moment I need a guide(document)
> on how to convert SQL::Abstract's conventions to Query parameter
> format
>
>
> Eg:
>
 
http://10.100.102.38:3000/api/rest/general/members?list_returns=holder1&list_count=10
>
> Returns:
>
> {
>   "Result": "OK",
>   "Records": [
> {
>   "holder1": "Sh. R. Krishna Kumar"
> },
> {
>   "holder1": "Sh. Sharad Kumar Srivastava"
> },
> {
>   "holder1": "Smt. Shubhra Jain ."
> },
> {
>   "holder1": "Sh. Balam Singh Negi"
> },
> {
>   "holder1": "Sh. Subodh Jain"
> },
> {
>   "holder1": "Smt. Punita Batra"
> },
> {
>   "holder1": "Sh.K C Sardana"
> },
> {
>   "holder1": "Smt. Sunita Mishra"
> },
> {
>   "holder1": "Sh. Vijay Kumar Khanna"
> },
> {
>   "holder1": "Smt. Daisy Tyagi"
> }
>   ]
> }
>
>
> I need a Query param that would return all holder1 matching
> Mis. ie holder1 ilike '%Mis%'
>
>
> As always Thanks in anticipation of your valuable time/attention.
>
>
> Regds
> Mallah.
>
>
>
>
>
> ___
> 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] complex search using Catalyst::Controller::DBIC::API::REST

2017-03-01 Thread Rajesh Kumar Mallah


Dear Petrov,


Thanks i will try the JSON.stringify approach , the snippet was just
for spitting out what you typed , i am not sure if it would be
so easy to type out the parameters in case of complex conditions.

Warm Regards
Rajesh.

> Hello Rajesh,
>
> C::C::DBIC::API supports that under the hood, so not sure what are you
> going after.
>
> You can either use: search=JSON.stringify(object) or construct the search
> passing params like: search.holder.-ilike=%mis%. Both should work out of
> the box.
>
> Regards
>
> On Wed, Mar 1, 2017 at 10:24 AM, Rajesh Kumar Mallah
> 
> wrote:
>
>>
>>
>> Hi ,
>>
>> CGI::Expand collapse_hash comes to rescue ,
>> below is a small snippet that converts the perl
>> hash reference to the TT's dotted format using
>> CGI::Expand.
>>
>>
>> 
>> #!/usr/bin/perl -w
>>
>> use strict;
>>
>> use CGI::Expand qw(expand_hash  collapse_hash);
>> use Data::Dumper;
>> use JSON::XS;
>> use URI::Escape;
>>
>>
>> # SQL::Abstract Syntax comes here.
>> my $where  = {
>>search => {
>>   holder1 => { -ilike => '%mis%' },
>>   mobile1 => { -ilike => '%967%' },
>>   flat_no => 'A203'
>> }
>> } ;
>>
>>
>>
>> my $flat_hash = collapse_hash( $where );
>>
>> print  join '&' ,   map { my $k = $_; my $v = uri_escape(
>> $flat_hash->{$k})  ; "$k=$v"   } keys %{$flat_hash};
>>
>> print "\n";
>> ==
>>
>> Output:
>>
>>
>> $VAR1 = {
>>   'search.mobile1.-ilike' => '%967%',
>>   'search.holder1.-ilike' => '%mis%',
>>   'search.flat_no' => 'A203'
>> };
>> search.mobile1.-ilike=%25967%25&search.holder1.-ilike=%
>> 25mis%25&search.flat_no=A203
>>
>>
>>
>> Regds
>> Mallah.
>>
>>
>>
>>
>> >
>> > Hi ,
>> >
>> > In continuation of previous query kindly guide how to do a
>> > anchored or unanchored ilike search using
>> > Catalyst::Controller::DBIC::API::REST
>> >
>> >
>> > I have used DBIC search with lots of search conditions in past
>> > that uses SQL::Abstract, at this moment I need a guide(document)
>> > on how to convert SQL::Abstract's conventions to Query parameter
>> > format
>> >
>> >
>> > Eg:
>> >
>>  http://10.100.102.38:3000/api/rest/general/members?list_
>> returns=holder1&list_count=10
>> >
>> > Returns:
>> >
>> > {
>> >   "Result": "OK",
>> >   "Records": [
>> > {
>> >   "holder1": "Sh. R. Krishna Kumar"
>> > },
>> > {
>> >   "holder1": "Sh. Sharad Kumar Srivastava"
>> > },
>> > {
>> >   "holder1": "Smt. Shubhra Jain ."
>> > },
>> > {
>> >   "holder1": "Sh. Balam Singh Negi"
>> > },
>> > {
>> >   "holder1": "Sh. Subodh Jain"
>> > },
>> > {
>> >   "holder1": "Smt. Punita Batra"
>> > },
>> > {
>> >   "holder1": "Sh.K C Sardana"
>> > },
>> > {
>> >   "holder1": "Smt. Sunita Mishra"
>> > },
>> > {
>> >   "holder1": "Sh. Vijay Kumar Khanna"
>> > },
>> > {
>> >   "holder1": "Smt. Daisy Tyagi"
>> > }
>> >   ]
>> > }
>> >
>> >
>> > I need a Query param that would return all holder1 matching
>> > Mis. ie holder1 ilike '%Mis%'
>> >
>> >
>> > As always Thanks in anticipation of your valuable time/attention.
>> >
>> >
>> > Regds
>> > Mallah.
>> >
>> >
>> >
>> >
>> >
>> > ___
>> > 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] Asynch webservices with catalyst

2017-03-01 Thread Rajesh Kumar Mallah


More material ,

http://www.catalystframework.org/calendar/2013

Day 10: Nonblocking and Streaming - Part 1
Day 11: Nonblocking and Streaming - Part 2
Day 12: Nonblocking and Streaming - Part 3
Day 13: Nonblocking and Streaming - Part 4
Day 14: Streaming Nonblocking Files

Particularly pls read about usage of Twiggy in Day 12 (Part 3)


regds
mallah.




> Hi all,
>
> I know that catalyst provides some basic support for sending asynch
> responses to clients but the examples & documentation are a bit thin
> on the ground.  I was wondering if anybody has had much success with
> async catalyst request/responses and in particular for webservices.
>
> Cheers,
>
> A
>
> --
> Aaron J Trevena, BSc Hons
> http://www.aarontrevena.co.uk
> LAMP System Integration, Development and Consulting
>
> ___
> 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] transforming empty values in request to perl's undef

2017-03-02 Thread Rajesh Kumar Mallah

Hi ,

I want to transform request parameters in GET & POST requests
so that any thing which is empty (string) gets converted/replaced
my perl's undef (and DBIC's NULL).

Why i need that:

I have edit form in my web app and some fields in the edit form
are prefilled with nothing. On submission the DB raises an exception
that an empty string is being inserted to a integer field.

Hence I feel like having a global filter that turns all blanks to
undef.

The question is where to put this global filter.

Regds
mallah.




___
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] transforming empty values in request to perl's undef

2017-03-02 Thread Rajesh Kumar Mallah

By empty i mean string with length 0 ie ''

__CODE__


I am posting to rest endpoint Automagically generated via
Catalyst::Controller::DBIC::API  there is no explicit code hand
written by me.And that is why looking for a global filter.

There are three great virtues of a programmer; Laziness, Impatience and
Hubris -- Larry Wall.



> Just curious: when you say "prefilled with nothing", you mean the field is
> empty, or the field is filled with one or more white spaces (like " "), or
> the field is a  with the first  having the attribute
> "value" equals to ""? Or something else?
>
> gil
>
> On Thu, Mar 02, 2017 at 10:25:27AM -0500, Rajesh Kumar Mallah wrote:
>>
>> Hi ,
>>
>> I want to transform request parameters in GET & POST requests
>> so that any thing which is empty (string) gets converted/replaced
>> my perl's undef (and DBIC's NULL).
>>
>> Why i need that:
>> 
>> I have edit form in my web app and some fields in the edit form
>> are prefilled with nothing. On submission the DB raises an exception
>> that an empty string is being inserted to a integer field.
>>
>> Hence I feel like having a global filter that turns all blanks to
>> undef.
>>
>> The question is where to put this global filter.
>>
>> Regds
>> mallah.
>>
>>
>>
>>
>> ___
>> 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] Change of server

2017-03-03 Thread Rajesh Kumar Mallah

Dear Andres ,

in my systemd based system it is possible to start apache2 from root
prompt like below:

# ( .  /etc/apache2/envvars   &&  apache2  -f /etc/apache2/apache2.conf 
-e Debug   -X )


and it does spits out the messages to terminal. After stopping the
apache2 using systemctl try to start using the command above.

the above command executes in a subshell , first part populates
env variable , -f is path to main config -e sets level to debug
and -X prevents from detaching from terminal.


regds
mallah.















>
>
> Active Internet connections (only servers)
> Proto Recv-Q Send-Q Local
> Address           Foreign
> Address        
> State       PID/Program name
> tcp        0      0
> 127.0.0.1:3306         
> 0.0.0.0:*              
> LISTEN      1134/mysqld    
> tcp        0      0
> 0.0.0.0:22             
> 0.0.0.0:*              
> LISTEN      1112/sshd      
> tcp6       0      0
> :::22                  
> :::*                   
> LISTEN      1112/sshd 
>
> ps aux|grep apache
> root      1738  0.0  0.0  14228  1012
> pts/0    S+   09:30   0:00 grep --color=auto apache
>
> /dev/mapper/iac--vg-root  5.4G  2.2G  3.0G  43% /
>
> The
> directories you mention, were NFS mounted on the system at the old server,
> new server
> everything is local...
>
> here's the new config:
>
>         PerlSwitches -I /var/www/web/lib
>         PerlModule IAC
>
>  *:80>
>         ServerAdmin and...@chandia.net
>         ServerName local.iac
>         ServerAlias local.iac
>         DocumentRoot /var/www/web/root
>         
>
>         use lib qw( /var/www/web/lib );
>
>         
>         
>                
> SetHandler          modperl
>                
> PerlResponseHandler IAC
>         
>
>         
>                
> SetHandler none
>         
>
>         Alias /iac/stats_tasks/
> "/srv/iac_data/stats-tasks"
>        
> 
>                
> SetHandler none
>                
> Order allow,deny
>                
> Allow from all
>     
>
>         Alias /iac/txt_output/
> "/srv/iac_data/txt_output"
>        
> 
>                
> SetHandler none
>                
> Order allow,deny
>                
> Allow from all
>     
>
>         CustomLog /var/log/apache2/local.iac.access.log
> combined
>         ErrorLog
> /var/log/apache2/local.iac.error.log
> 
>
>
> Thanks
> again
>
>
>
> El Vie, 3 de Marzo de 2017, 9:05, Juan Miguel Paredes
> escribió:
>
>
>
> On Fri, Mar 3, 2017 at 7:35 AM, "Andrés
> Chandía" and...@chandia.net> wrote:
> Thanks for your concern, I have tried that also:
>
> systemctl
> status apache2
>
>  apache2.service - LSB: Apache2 web server
>    Loaded: loaded (/etc/init.d/apache2; bad; vendor preset:
> enabled)
>   Drop-In: /lib/systemd/system/apache2.service.d
>           
> └─apache2-systemd.conf
>   
> Active: failed (Result: exit-code) since Fri 2017-03-03 07:31:59 CET; 4s
> ago
>      Docs: man:systemd-sysv-generator(8)
>   Process: 1187 ExecStart=/etc/init.d/apache2 start (code=exited,
> status=1/FAILURE)
>
> Mar 03 07:27:02 iac apache2[1187]: |
> /results/stats_query/...           
> |
>
 /results/stats_query              
  
> |
> Mar 03 07:27:02 iac apache2[1187]: |
> /results/stats_results/...         
> |
>
 /results/stats_results              
> |
> Mar 03 07:27:02 iac apache2[1187]:
>
 '-+--'
> Mar 03 07:27:02 iac apache2[1187]: [info] IAC powered by Catalyst 5.90103
> Mar 03
> 07:31:59 iac apache2[1187]:  *
> Mar 03 07:31:59 iac
> apache2[1187]:  * The apache2 instance did not start within 20 seconds.
> Please
> read the log file
> Mar 03 07:31:59 iac systemd[1]: apache2.service: Control process
> exited, code=exited status=1
> Mar 03 07:31:59 iac systemd[1]: Failed to start LSB: Apache2
> web server.
> Mar 03 07:

Re: [Catalyst] Change of server

2017-03-03 Thread Rajesh Kumar Mallah

Its not typo , the reason is that the env variable
${APACHE_LOCK_DIR} is not set  ,

.  /etc/apache2/envvars  takes care of that part.


> It seems that you have a typo in the file /etc/apache2/apache2.conf near
> line 74. Fix that and probably the other errors will vanish!
>
> On Mar 3, 2017 7:39 AM, Andrés Chandía  wrote:
>
>> Thanks, finally I'm getting some logs:
>>
>> [Fri Mar 03 11:34:41.061210 2017] [core:warn] [pid 2111] AH00111: Config
>> variable ${APACHE_LOCK_DIR} is not defined
>> [Fri Mar 03 11:34:41.061282 2017] [core:warn] [pid 2111] AH00111: Config
>> variable ${APACHE_PID_FILE} is not defined
>> [Fri Mar 03 11:34:41.061298 2017] [core:warn] [pid 2111] AH00111: Config
>> variable ${APACHE_RUN_USER} is not defined
>> [Fri Mar 03 11:34:41.061303 2017] [core:warn] [pid 2111] AH00111: Config
>> variable ${APACHE_RUN_GROUP} is not defined
>> [Fri Mar 03 11:34:41.061313 2017] [core:warn] [pid 2111] AH00111: Config
>> variable ${APACHE_LOG_DIR} is not defined
>> [Fri Mar 03 11:34:41.070952 2017] [core:warn] [pid 2111] AH00111: Config
>> variable ${APACHE_LOG_DIR} is not defined
>> AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
>> Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
>>
>>
>> El Vie, 3 de Marzo de 2017, 11:15, mallah escribió:
>> Have you tried starting apache2 binary from cmdline by specifying the
>> path
>> of main configuration file.
>>
>> Check apache2 -h
>>
>> Also check netstat -lnp output if there is something bound to the same
>> port (possibly 80 )
>>
>>
>>
>> Sent from my Samsung Galaxy smartphone.
>>
>>  Original message 
>> From: Andrés Chandía
>> Date: 3/3/17 12:05 (GMT+05:30)
>> To: The elegant MVC web framework
>> Subject: Re: [Catalyst] Change of server
>>
>> Thanks for your concern, I have tried that also:
>>
>> systemctl status apache2
>>
>> apache2.service - LSB: Apache2 web server
>> Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
>> Drop-In: /lib/systemd/system/apache2.service.d
>> └─apache2-systemd.conf
>> Active: failed (Result: exit-code) since Fri 2017-03-03 07:31:59 CET; 4s
>> ago
>> Docs: man:systemd-sysv-generator(8)
>> Process: 1187 ExecStart=/etc/init.d/apache2 start (code=exited,
>> status=1/FAILURE)
>>
>> Mar 03 07:27:02 iac apache2[1187]: | /results/stats_query/... |
>> /results/stats_query |
>> Mar 03 07:27:02 iac apache2[1187]: | /results/stats_results/... |
>> /results/stats_results |
>> Mar 03 07:27:02 iac apache2[1187]: '-
>> +--'
>> Mar 03 07:27:02 iac apache2[1187]: [info] IAC powered by Catalyst
>> 5.90103
>> Mar 03 07:31:59 iac apache2[1187]: *
>> Mar 03 07:31:59 iac apache2[1187]: * The apache2 instance did not start
>> within 20 seconds. Please read the log file
>> Mar 03 07:31:59 iac systemd[1]: apache2.service: Control process exited,
>> code=exited status=1
>> Mar 03 07:31:59 iac systemd[1]: Failed to start LSB: Apache2 web server.
>> Mar 03 07:31:59 iac systemd[1]: apache2.service: Unit entered failed
>> state.
>> Mar 03 07:31:59 iac systemd[1]: apache2.service: Failed with result
>> 'exit-code'.
>>
>> tail -f /var/log/apache2/error.log says nothing
>>
>> tail -f /var/log/apache2/local.iac.error.log says nothing
>>
>> tail -f /var/log/syslog
>> Mar 3 07:33:43 iac apache2[1466]: | /results/stats_query/... |
>> /results/stats_query |
>> Mar 3 07:33:43 iac apache2[1466]: | /results/stats_results/... |
>> /results/stats_results |
>> Mar 3 07:33:43 iac apache2[1466]: '-
>> +--'
>> Mar 3 07:33:43 iac apache2[1466]: [info] IAC powered by Catalyst 5.90103
>> Mar 3 07:34:03 iac apache2[1466]: *
>> Mar 3 07:34:03 iac apache2[1466]: * The apache2 instance did not start
>> within 20 seconds. Please read the log files to discover problems
>> Mar 3 07:34:03 iac systemd[1]: apache2.service: Control process exited,
>> code=exited status=1
>> Mar 3 07:34:03 iac systemd[1]: Failed to start LSB: Apache2 web server.
>> Mar 3 07:34:03 iac systemd[1]: apache2.service: Unit entered failed
>> state.
>> Mar 3 07:34:03 iac systemd[1]: apache2.service: Failed with result
>> 'exit-code'.
>>
>>
>>
>> El Vie, 3 de Marzo de 2017, 6:33, mallah escribió:
>>
>>
>> The real error message is so

Re: [Catalyst] Change of server

2017-03-03 Thread Rajesh Kumar Mallah
Dear Andres ,

in my systemd based system it is possible to start apache2 from root
prompt like below:

# ( .  /etc/apache2/envvars   &&  apache2  -f /etc/apache2/apache2.conf 
-e Debug   -X )


and it does spits out the messages to terminal. After stopping the apache2
using systemctl try to start using the command above.

the above command executes in a subshell , first part populates
env variable , -f is path to main config -e sets level to debug
and -X prevents from detaching from terminal.


regds
mallah.















>
>
> Active Internet connections (only servers)
> Proto Recv-Q Send-Q Local
> Address           Foreign
> Address        
> State       PID/Program name
> tcp        0      0
> 127.0.0.1:3306         
> 0.0.0.0:*              
> LISTEN      1134/mysqld    
> tcp        0      0
> 0.0.0.0:22             
> 0.0.0.0:*              
> LISTEN      1112/sshd      
> tcp6       0      0
> :::22                  
> :::*                   
> LISTEN      1112/sshd 
>
> ps aux|grep apache
> root      1738  0.0  0.0  14228  1012
> pts/0    S+   09:30   0:00 grep --color=auto apache
>
> /dev/mapper/iac--vg-root  5.4G  2.2G  3.0G  43% /
>
> The
> directories you mention, were NFS mounted on the system at the old
server, new server
> everything is local...
>
> here's the new config:
>
>         PerlSwitches -I /var/www/web/lib
>         PerlModule IAC
>
>  *:80>
>         ServerAdmin and...@chandia.net
>         ServerName local.iac
>         ServerAlias local.iac
>         DocumentRoot /var/www/web/root
>         
>
>         use lib qw( /var/www/web/lib );
>
>         
>         
>                
> SetHandler          modperl
>                
> PerlResponseHandler IAC
>         
>
>         
>                
> SetHandler none
>         
>
>         Alias /iac/stats_tasks/
> "/srv/iac_data/stats-tasks"
>        
> 
>                
> SetHandler none
>                
> Order allow,deny
>                
> Allow from all
>     
>
>         Alias /iac/txt_output/
> "/srv/iac_data/txt_output"
>        
> 
>                
> SetHandler none
>                
> Order allow,deny
>                
> Allow from all
>     
>
>         CustomLog /var/log/apache2/local.iac.access.log
> combined
>         ErrorLog
> /var/log/apache2/local.iac.error.log
> 
>
>
> Thanks
> again
>
>
>
> El Vie, 3 de Marzo de 2017, 9:05, Juan Miguel Paredes
> escribió:
>
>
>
> On Fri, Mar 3, 2017 at 7:35 AM, "Andrés
> Chandía" and...@chandia.net> wrote:
> Thanks for your concern, I have tried that also:
>
> systemctl
> status apache2
>
>  apache2.service - LSB: Apache2 web server
>    Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
>   Drop-In: /lib/systemd/system/apache2.service.d
>           
> └─apache2-systemd.conf
>   
> Active: failed (Result: exit-code) since Fri 2017-03-03 07:31:59 CET; 4s
ago
>      Docs: man:systemd-sysv-generator(8)
>   Process: 1187 ExecStart=/etc/init.d/apache2 start (code=exited,
status=1/FAILURE)
>
> Mar 03 07:27:02 iac apache2[1187]: |
> /results/stats_query/...            |
>
 /results/stats_query              
  
|
> Mar 03 07:27:02 iac apache2[1187]: |
> /results/stats_results/...         
> |
>
 /results/stats_results              
|
> Mar 03 07:27:02 iac apache2[1187]:
>
 '-+--'
Mar 03 07:27:02 iac apache2[1187]: [info] IAC powered by Catalyst
5.90103 Mar 03
> 07:31:59 iac apache2[1187]:  *
> Mar 03 07:31:59 iac
> apache2[1187]:  * The apache2 instance did not start within 20
seconds. Please
> read the log file
> Mar 03 07:31:59 iac systemd[1]: apache2.service: Control process exited,
code=exited status=1
> Mar 03 07:31:59 iac systemd[1]: Failed to start LSB: Apache2
> web server.
> Mar 03 07:31:59 iac systemd[1]: apache2.service: Unit entered f

Re: [Catalyst] transforming empty values in request to perl's undef

2017-03-03 Thread Rajesh Kumar Mallah


Thanks for that , it looks elegant .

Could you please send some pointer to docs for Traits
approach.

regds
mallah.



> Not sure if that's the best way to do it or if it's a good approach, but I
> have a trait which is applied to all result classes.
>
> TraitFor::Result::ForceNULL;
> use strict;
> use warnings;
>
> my $null = undef;
>
> sub insert
> {
>   my $self = shift;
>
>   for my $col ($self->columns) {
> next unless defined $self->$col;
> next unless $self->$col eq "";
>
> my $info = $self->result_source->column_info($col);
> $self->$col($null) if $info->{is_nullable};
>   }
>   return $self->next::method(@_);
> }
>
> sub update
> {
>   my $self  = shift;
>   my %to_update = $self->get_dirty_columns;
>
>   return $self->next::method(@_) unless keys %to_update;
>
>   for my $col (keys %to_update) {
> next unless $to_update{$col} eq "";
> my $info = $self->result_source->column_info($col);
> $self->{_column_data}{$col} = $null if $info->{is_nullable};
>   }
>   return $self->next::method(@_);
> }
>
> 1;
>
> Best regards
>
> On Thu, Mar 2, 2017 at 5:14 PM, Rajesh Kumar Mallah 
> wrote:
>
>>
>> By empty i mean string with length 0 ie ''
>>
>> __CODE__
>>
>>
>> I am posting to rest endpoint Automagically generated via
>> Catalyst::Controller::DBIC::API  there is no explicit code hand
>> written by me.And that is why looking for a global filter.
>>
>> There are three great virtues of a programmer; Laziness, Impatience and
>> Hubris -- Larry Wall.
>>
>>
>>
>> > Just curious: when you say "prefilled with nothing", you mean the
>> field
>> is
>> > empty, or the field is filled with one or more white spaces (like "
>> "),
>> or
>> > the field is a  with the first  having the attribute
>> > "value" equals to ""? Or something else?
>> >
>> > gil
>> >
>> > On Thu, Mar 02, 2017 at 10:25:27AM -0500, Rajesh Kumar Mallah wrote:
>> >>
>> >> Hi ,
>> >>
>> >> I want to transform request parameters in GET & POST requests
>> >> so that any thing which is empty (string) gets converted/replaced
>> >> my perl's undef (and DBIC's NULL).
>> >>
>> >> Why i need that:
>> >> 
>> >> I have edit form in my web app and some fields in the edit form
>> >> are prefilled with nothing. On submission the DB raises an exception
>> >> that an empty string is being inserted to a integer field.
>> >>
>> >> Hence I feel like having a global filter that turns all blanks to
>> >> undef.
>> >>
>> >> The question is where to put this global filter.
>> >>
>> >> Regds
>> >> mallah.
>> >>
>> >>
>> >>
>> >>
>> >> ___
>> >> 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] transforming empty values in request to perl's undef

2017-03-03 Thread Rajesh Kumar Mallah


Thanks, It helps.


regds
Mallah.


> It's just a package and I have in make_schema_at.pl to apply the
> components
> that I want to use:
>
>   make_schema_at(
> "My::Schema::${class_name}",
> {
>   exclude   => qr/_\d+$/,
>   dump_directory=> "$Bin/../lib",
>   components=> [ '+My::TraitFor::Result::ForceNULL',
> '+My::TraitFor::Result::AuditLog' ],
>   schema_components => [ 'Schema::RestrictWithObject' ],
>   qualify_objects => 1, # prepend dpl/public in the
> __PACKAGE__->table(...) call
>   db_schema=> $schema,
> }
>   );
>
> Cheers
>
> On Fri, Mar 3, 2017 at 1:34 PM, Rajesh Kumar Mallah 
> wrote:
>
>>
>>
>> Thanks for that , it looks elegant .
>>
>> Could you please send some pointer to docs for Traits
>> approach.
>>
>> regds
>> mallah.
>>
>>
>>
>> > Not sure if that's the best way to do it or if it's a good approach,
>> but
>> I
>> > have a trait which is applied to all result classes.
>> >
>> > TraitFor::Result::ForceNULL;
>> > use strict;
>> > use warnings;
>> >
>> > my $null = undef;
>> >
>> > sub insert
>> > {
>> >   my $self = shift;
>> >
>> >   for my $col ($self->columns) {
>> > next unless defined $self->$col;
>> > next unless $self->$col eq "";
>> >
>> > my $info = $self->result_source->column_info($col);
>> > $self->$col($null) if $info->{is_nullable};
>> >   }
>> >   return $self->next::method(@_);
>> > }
>> >
>> > sub update
>> > {
>> >   my $self  = shift;
>> >   my %to_update = $self->get_dirty_columns;
>> >
>> >   return $self->next::method(@_) unless keys %to_update;
>> >
>> >   for my $col (keys %to_update) {
>> > next unless $to_update{$col} eq "";
>> > my $info = $self->result_source->column_info($col);
>> > $self->{_column_data}{$col} = $null if $info->{is_nullable};
>> >   }
>> >   return $self->next::method(@_);
>> > }
>> >
>> > 1;
>> >
>> > Best regards
>> >
>> > On Thu, Mar 2, 2017 at 5:14 PM, Rajesh Kumar Mallah
>> > >
>> > wrote:
>> >
>> >>
>> >> By empty i mean string with length 0 ie ''
>> >>
>> >> __CODE__
>> >>
>> >>
>> >> I am posting to rest endpoint Automagically generated via
>> >> Catalyst::Controller::DBIC::API  there is no explicit code hand
>> >> written by me.And that is why looking for a global filter.
>> >>
>> >> There are three great virtues of a programmer; Laziness, Impatience
>> and
>> >> Hubris -- Larry Wall.
>> >>
>> >>
>> >>
>> >> > Just curious: when you say "prefilled with nothing", you mean the
>> >> field
>> >> is
>> >> > empty, or the field is filled with one or more white spaces (like "
>> >> "),
>> >> or
>> >> > the field is a  with the first  having the
>> attribute
>> >> > "value" equals to ""? Or something else?
>> >> >
>> >> > gil
>> >> >
>> >> > On Thu, Mar 02, 2017 at 10:25:27AM -0500, Rajesh Kumar Mallah
>> wrote:
>> >> >>
>> >> >> Hi ,
>> >> >>
>> >> >> I want to transform request parameters in GET & POST requests
>> >> >> so that any thing which is empty (string) gets converted/replaced
>> >> >> my perl's undef (and DBIC's NULL).
>> >> >>
>> >> >> Why i need that:
>> >> >> 
>> >> >> I have edit form in my web app and some fields in the edit form
>> >> >> are prefilled with nothing. On submission the DB raises an
>> exception
>> >> >> that an empty string is being inserted to a integer field.
>> >> >>
>> >> >> Hence I feel like having a global filter that turns all blanks to
>> >> >> undef.
>> >> >>
>> >> >> The question is where to put this global filter.
>> >> >>
&g

Re: [Catalyst] Change of server

2017-03-03 Thread Rajesh Kumar Mallah


any idea why the error below ?

-e: command not found








___
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] Change of server

2017-03-03 Thread Rajesh Kumar Mallah


I assume the command keeps running in that state and
while it is doing so , can you check if apache2 listening
on configured port (80) and if it is so does , is it serving
the app in expected manner ?


regds
mallah.







___
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] Change of server

2017-03-03 Thread Rajesh Kumar Mallah


(1) disabling local.iac.conf brings apache2 to a listening state
(2) enabling  local.iac.conf brings apache2 to dysfunctional state.


try to narrow down whats wrong with  local.iac.conf
using a binary search approach between (1) and (2)

hope u got the approach. :-)

regds
mallah.

>
>
> root@iac:/home/andres# a2dissite local.iac.conf (the configuration with
> Catalyst)
> Site
> local.iac disabled.
> To activate the new configuration, you need to run:
>  
> service apache2 reload
> root@iac:/home/andres# /etc/init.d/apache2 restart
> [ ok ]
> Restarting apache2 (via systemctl): apache2.service.
>




___
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] JSONP support Catalyst::Controller::DBIC::API

2017-03-08 Thread Rajesh Kumar Mallah
Hi ,

How to get JSON response body wrapped in a callback function
call (a.k.a JSONP) when using Catalyst::Controller::DBIC::API::REST

I use Catalyst::Controller::DBIC::API and 'end' function
in ControllerBase is like below:

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

##
 # code for manipulating stash here
##

$c->forward('serialize');
}

=
In   Catalyst/Controller/DBIC/API.pm

# from Catalyst::Action::Serialize
sub serialize : ActionClass('Serialize') { }

=


My other JSON responses which are rendered via MyApp::View::JSON
can be modified as JSONP compatible as i have below in my App config

__PACKAGE__->config({
  'View::JSON' => {
  allow_callback  => 1,# defaults to 0
  },
});


===


The problem is only with automatically generated rest endpoints
from  Catalyst::Controller::DBIC::API.

Thanks in anticipation.


Regds
mallah.




















___
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] JSONP support Catalyst::Controller::DBIC::API

2017-03-09 Thread Rajesh Kumar Mallah




For the time being i have modified and solved my issue as below:

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

 ##
 # code for manipulating stash here
 ##

 $c->forward('serialize');

 my $cb = $c->request->params->{callback} ;

 if ($cb) {
my $body = \$c->res->body;
$$body = "$cb ($$body);";
$c->res->body($$body);
 }

}


regds
mallah.


> Hi ,
>
> How to get JSON response body wrapped in a callback function
> call (a.k.a JSONP) when using Catalyst::Controller::DBIC::API::REST
>
> I use Catalyst::Controller::DBIC::API and 'end' function
> in ControllerBase is like below:
>
> sub end : Private {
> my ( $self, $c ) = @_;
>
> ##
>  # code for manipulating stash here
> ##
>
> $c->forward('serialize');
> }
>
> =
> In   Catalyst/Controller/DBIC/API.pm
>
> # from Catalyst::Action::Serialize
> sub serialize : ActionClass('Serialize') { }
>
> =
>
>
> My other JSON responses which are rendered via MyApp::View::JSON
> can be modified as JSONP compatible as i have below in my App config
>
> __PACKAGE__->config({
>   'View::JSON' => {
>   allow_callback  => 1,# defaults to 0
>   },
> });
>
>
> ===
>
>
> The problem is only with automatically generated rest endpoints
> from  Catalyst::Controller::DBIC::API.
>
> Thanks in anticipation.
>
>
> Regds
> mallah.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





___
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] complex search using Catalyst::Controller::DBIC::API::REST

2017-03-14 Thread Rajesh Kumar Mallah


Hi ,

How to perform below search:

select member_id,holder1 from general.members where
 member_balance(member_id , '2017-03-14') < 0 ;

there is a function on LHS of the condition

Regds
Mallah.






> Hello Rajesh,
>
> C::C::DBIC::API supports that under the hood, so not sure what are you
> going after.
>
> You can either use: search=JSON.stringify(object) or construct the search
> passing params like: search.holder.-ilike=%mis%. Both should work out of
> the box.
>
> Regards
>
> On Wed, Mar 1, 2017 at 10:24 AM, Rajesh Kumar Mallah
> 
> wrote:
>
>>
>>
>> Hi ,
>>
>> CGI::Expand collapse_hash comes to rescue ,
>> below is a small snippet that converts the perl
>> hash reference to the TT's dotted format using
>> CGI::Expand.
>>
>>
>> 
>> #!/usr/bin/perl -w
>>
>> use strict;
>>
>> use CGI::Expand qw(expand_hash  collapse_hash);
>> use Data::Dumper;
>> use JSON::XS;
>> use URI::Escape;
>>
>>
>> # SQL::Abstract Syntax comes here.
>> my $where  = {
>>search => {
>>   holder1 => { -ilike => '%mis%' },
>>   mobile1 => { -ilike => '%967%' },
>>   flat_no => 'A203'
>> }
>> } ;
>>
>>
>>
>> my $flat_hash = collapse_hash( $where );
>>
>> print  join '&' ,   map { my $k = $_; my $v = uri_escape(
>> $flat_hash->{$k})  ; "$k=$v"   } keys %{$flat_hash};
>>
>> print "\n";
>> ==
>>
>> Output:
>>
>>
>> $VAR1 = {
>>   'search.mobile1.-ilike' => '%967%',
>>   'search.holder1.-ilike' => '%mis%',
>>   'search.flat_no' => 'A203'
>> };
>> search.mobile1.-ilike=%25967%25&search.holder1.-ilike=%
>> 25mis%25&search.flat_no=A203
>>
>>
>>
>> Regds
>> Mallah.
>>
>>
>>
>>
>> >
>> > Hi ,
>> >
>> > In continuation of previous query kindly guide how to do a
>> > anchored or unanchored ilike search using
>> > Catalyst::Controller::DBIC::API::REST
>> >
>> >
>> > I have used DBIC search with lots of search conditions in past
>> > that uses SQL::Abstract, at this moment I need a guide(document)
>> > on how to convert SQL::Abstract's conventions to Query parameter
>> > format
>> >
>> >
>> > Eg:
>> >
>>  http://10.100.102.38:3000/api/rest/general/members?list_
>> returns=holder1&list_count=10
>> >
>> > Returns:
>> >
>> > {
>> >   "Result": "OK",
>> >   "Records": [
>> > {
>> >   "holder1": "Sh. R. Krishna Kumar"
>> > },
>> > {
>> >   "holder1": "Sh. Sharad Kumar Srivastava"
>> > },
>> > {
>> >   "holder1": "Smt. Shubhra Jain ."
>> > },
>> > {
>> >   "holder1": "Sh. Balam Singh Negi"
>> > },
>> > {
>> >   "holder1": "Sh. Subodh Jain"
>> > },
>> > {
>> >   "holder1": "Smt. Punita Batra"
>> > },
>> > {
>> >   "holder1": "Sh.K C Sardana"
>> > },
>> > {
>> >   "holder1": "Smt. Sunita Mishra"
>> > },
>> > {
>> >   "holder1": "Sh. Vijay Kumar Khanna"
>> > },
>> > {
>> >   "holder1": "Smt. Daisy Tyagi"
>> > }
>> >   ]
>> > }
>> >
>> >
>> > I need a Query param that would return all holder1 matching
>> > Mis. ie holder1 ilike '%Mis%'
>> >
>> >
>> > As always Thanks in anticipation of your valuable time/attention.
>> >
>> >
>> > Regds
>> > Mallah.
>> >
>> >
>> >
>> >
>> >
>> > ___
>> > 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] JSONP support Catalyst::Controller::DBIC::API

2017-03-16 Thread Rajesh Kumar Mallah




Ok are you suggesting DBIC::API needs to be enhanced for
JSONP support ?


Regds
Mallah.

> Looks like a code injection attack vector to me...
>
> Patch + Tests for DBIC::API welcome!
>
>
> On 2017-03-09 11:05, Rajesh Kumar Mallah wrote:
>>
>>
>>
>> For the time being i have modified and solved my issue as below:
>>
>> sub end : Private {
>>   my ( $self, $c ) = @_;
>>
>>   ##
>>   # code for manipulating stash here
>>   ##
>>
>>   $c->forward('serialize');
>>
>>   my $cb = $c->request->params->{callback} ;
>>
>>   if ($cb) {
>>   my $body = \$c->res->body;
>>   $$body = "$cb ($$body);";
>>   $c->res->body($$body);
>>   }
>>
>> }
>>
>>
>> regds
>> mallah.
>>
>>
>>> Hi ,
>>>
>>> How to get JSON response body wrapped in a callback function
>>> call (a.k.a JSONP) when using Catalyst::Controller::DBIC::API::REST
>>>
>>> I use Catalyst::Controller::DBIC::API and 'end' function
>>> in ControllerBase is like below:
>>>
>>> sub end : Private {
>>>  my ( $self, $c ) = @_;
>>>
>>>  ##
>>>   # code for manipulating stash here
>>>  ##
>>>
>>>  $c->forward('serialize');
>>> }
>>>
>>> =
>>> In   Catalyst/Controller/DBIC/API.pm
>>>
>>> # from Catalyst::Action::Serialize
>>> sub serialize : ActionClass('Serialize') { }
>>>
>>> =
>>>
>>>
>>> My other JSON responses which are rendered via MyApp::View::JSON
>>> can be modified as JSONP compatible as i have below in my App config
>>>
>>> __PACKAGE__->config({
>>>'View::JSON' => {
>>>allow_callback  => 1,# defaults to 0
>>>},
>>> });
>>>
>>>
>>> ===
>>>
>>>
>>> The problem is only with automatically generated rest endpoints
>>> from  Catalyst::Controller::DBIC::API.
>>>
>>> Thanks in anticipation.
>>>
>>>
>>> Regds
>>> mallah.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>> ___
>> 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/
>
>
>
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
> Handelsgericht Wien, FN 79340b
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> Notice: This e-mail contains information that is confidential and may be
> privileged.
> If you are not the intended recipient, please notify the sender and then
> delete this e-mail immediately.
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
>
> ___
> 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] JSONP support Catalyst::Controller::DBIC::API

2017-03-17 Thread Rajesh Kumar Mallah

Thanks for clarifying .
I shall try to see and explore.


regds
mallah.

> If someone wants JSONP support, yes.
>
> Best regards, Alex
>
>
> On 2017-03-16 18:07, Rajesh Kumar Mallah wrote:
>>
>>
>>
>> Ok are you suggesting DBIC::API needs to be enhanced for
>> JSONP support ?
>>
>>
>> Regds
>> Mallah.
>>




___
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] complex search using Catalyst::Controller::DBIC::API::REST

2017-03-18 Thread Rajesh Kumar Mallah

Hi ,

Including member_balance(member_id) in 'search_exposes' config param
did help to proceed to some extent , but the function is being
prefixed by the table alias whereas it should be left alone.

eg:


 search_exposes => [
qw/member_balance(member_id)/,

. . . . .
],);


produces following invalid SQL note: member_balance is prefixed by
'me' .


ERROR DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception:
DBD::Pg::st execute failed: ERROR:  schema "me" does not exist [for
Statement

"SELECT me.holder1 FROM general.members me WHERE ( (
me.member_balance(member_id) = ? AND me.society_id = ? ) ) ORDER BY
member_id" with ParamValues: 1='21', 2='50']


Any help is appreciated.

regds
mallah.

>
>
> Hi ,
>
> How to perform below search:
>
> select member_id,holder1 from general.members where
>  member_balance(member_id , '2017-03-14') < 0 ;
>
> there is a function on LHS of the condition
>
> Regds
> Mallah.
>
>
>
>
>
>
>> Hello Rajesh,
>>
>> C::C::DBIC::API supports that under the hood, so not sure what are you
>> going after.
>>
>> You can either use: search=JSON.stringify(object) or construct the
>> search
>> passing params like: search.holder.-ilike=%mis%. Both should work out of
>> the box.
>>
>> Regards
>>
>> On Wed, Mar 1, 2017 at 10:24 AM, Rajesh Kumar Mallah
>> 
>> wrote:
>>
>>>
>>>
>>> Hi ,
>>>
>>> CGI::Expand collapse_hash comes to rescue ,
>>> below is a small snippet that converts the perl
>>> hash reference to the TT's dotted format using
>>> CGI::Expand.
>>>
>>>
>>> 
>>> #!/usr/bin/perl -w
>>>
>>> use strict;
>>>
>>> use CGI::Expand qw(expand_hash  collapse_hash);
>>> use Data::Dumper;
>>> use JSON::XS;
>>> use URI::Escape;
>>>
>>>
>>> # SQL::Abstract Syntax comes here.
>>> my $where  = {
>>>search => {
>>>   holder1 => { -ilike => '%mis%' },
>>>   mobile1 => { -ilike => '%967%' },
>>>   flat_no => 'A203'
>>> }
>>> } ;
>>>
>>>
>>>
>>> my $flat_hash = collapse_hash( $where );
>>>
>>> print  join '&' ,   map { my $k = $_; my $v = uri_escape(
>>> $flat_hash->{$k})  ; "$k=$v"   } keys %{$flat_hash};
>>>
>>> print "\n";
>>> ==
>>>
>>> Output:
>>>
>>>
>>> $VAR1 = {
>>>   'search.mobile1.-ilike' => '%967%',
>>>   'search.holder1.-ilike' => '%mis%',
>>>   'search.flat_no' => 'A203'
>>> };
>>> search.mobile1.-ilike=%25967%25&search.holder1.-ilike=%
>>> 25mis%25&search.flat_no=A203
>>>
>>>
>>>
>>> Regds
>>> Mallah.
>>>
>>>
>>>
>>>
>>> >
>>> > Hi ,
>>> >
>>> > In continuation of previous query kindly guide how to do a
>>> > anchored or unanchored ilike search using
>>> > Catalyst::Controller::DBIC::API::REST
>>> >
>>> >
>>> > I have used DBIC search with lots of search conditions in past
>>> > that uses SQL::Abstract, at this moment I need a guide(document)
>>> > on how to convert SQL::Abstract's conventions to Query parameter
>>> > format
>>> >
>>> >
>>> > Eg:
>>> >
>>>  http://10.100.102.38:3000/api/rest/general/members?list_
>>> returns=holder1&list_count=10
>>> >
>>> > Returns:
>>> >
>>> > {
>>> >   "Result": "OK",
>>> >   "Records": [
>>> > {
>>> >   "holder1": "Sh. R. Krishna Kumar"
>>> > },
>>> > {
>>> >   "holder1": "Sh. Sharad Kumar Srivastava"
>>> > },
>>> > {
>>> >   "holder1": "Smt. Shubhra Jain ."
>>> > },
>>> > {
>>> >   "holder1": "Sh. Balam Singh Negi"
>>> > },

[Catalyst] Paging support in Catalyst::Controller::DBIC::API

2017-03-19 Thread Rajesh Kumar Mallah
Hi ,

We know that Catalyst::Controller::DBIC::API supports paging
via list_count  , list_page and list_offset  options and
its possible to fetch a page of a large result set.

However what it does not seems to support is to tell
the View(caller) of how many records in total exists , ie
the total_entries of the Data::Page object.

This compels us to make two queries one to get the total count
and another to get the paged result.

Does this feature really does not exists or am I missing something?

(The reason I love and thoroughly use Catalyst::Controller::DBIC::API is 
that it allows me to be lazy :p )

regds
Rajesh Kumar Mallah.




___
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] complex search using Catalyst::Controller::DBIC::API::REST

2017-03-28 Thread Rajesh Kumar Mallah

Hi ,

Thanks for the response.

(1) The HTTP Request is:

/api/rest/general/members?list_returns=holder1&search.member_balance(member_id)=21

(2) controller config is:   https://pastebin.com/2iT1YSPm


Error log:

[2017/03/28 22:22:44]- API.pm-290: ERROR
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st
execute failed: ERROR:  schema "me" does not exist [for Statement "SELECT
me.holder1 FROM general.members me WHERE ( ( me.member_balance(member_id)
= ? AND me.society_id = ? ) ) ORDER BY member_id" with ParamValues:
1='21', 2='50']


Regds
Mallah.

> Hi,
>
> please include your controller config and the http call.
>
> Best regards, Alex
>
>
> On 2017-03-19 04:49, Rajesh Kumar Mallah wrote:
>> Hi ,
>>
>> Including member_balance(member_id) in 'search_exposes' config param
>> did help to proceed to some extent , but the function is being
>> prefixed by the table alias whereas it should be left alone.
>>
>> eg:
>>
>>
>>   search_exposes => [
>>  qw/member_balance(member_id)/,
>>  
>>  . . . . .
>>  ],);
>>
>>
>> produces following invalid SQL note: member_balance is prefixed by
>> 'me' .
>>
>>
>> ERROR DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception:
>> DBD::Pg::st execute failed: ERROR:  schema "me" does not exist [for
>> Statement
>>
>> "SELECT me.holder1 FROM general.members me WHERE ( (
>> me.member_balance(member_id) = ? AND me.society_id = ? ) ) ORDER BY
>> member_id" with ParamValues: 1='21', 2='50']
>>
>>
>> Any help is appreciated.
>>
>> regds
>> mallah.
>>
>>>
>>> Hi ,
>>>
>>> How to perform below search:
>>>
>>> select member_id,holder1 from general.members where
>>>   member_balance(member_id , '2017-03-14') < 0 ;
>>>
>>> there is a function on LHS of the condition
>>>
>>> Regds
>>> Mallah.
>>>
>>>
>>>
>>>
>>>
>>>
>>>> Hello Rajesh,
>>>>
>>>> C::C::DBIC::API supports that under the hood, so not sure what are you
>>>> going after.
>>>>
>>>> You can either use: search=JSON.stringify(object) or construct the
>>>> search
>>>> passing params like: search.holder.-ilike=%mis%. Both should work out
>>>> of
>>>> the box.
>>>>
>>>> Regards
>>>>
>>>> On Wed, Mar 1, 2017 at 10:24 AM, Rajesh Kumar Mallah
>>>> 
>>>> wrote:
>>>>
>>>>>
>>>>> Hi ,
>>>>>
>>>>> CGI::Expand collapse_hash comes to rescue ,
>>>>> below is a small snippet that converts the perl
>>>>> hash reference to the TT's dotted format using
>>>>> CGI::Expand.
>>>>>
>>>>>
>>>>> 
>>>>> #!/usr/bin/perl -w
>>>>>
>>>>> use strict;
>>>>>
>>>>> use CGI::Expand qw(expand_hash  collapse_hash);
>>>>> use Data::Dumper;
>>>>> use JSON::XS;
>>>>> use URI::Escape;
>>>>>
>>>>>
>>>>> # SQL::Abstract Syntax comes here.
>>>>> my $where  = {
>>>>> search => {
>>>>>holder1 => { -ilike => '%mis%' },
>>>>>mobile1 => { -ilike => '%967%' },
>>>>>flat_no => 'A203'
>>>>>  }
>>>>> } ;
>>>>>
>>>>>
>>>>>
>>>>> my $flat_hash = collapse_hash( $where );
>>>>>
>>>>> print  join '&' ,   map { my $k = $_; my $v = uri_escape(
>>>>> $flat_hash->{$k})  ; "$k=$v"   } keys %{$flat_hash};
>>>>>
>>>>> print "\n";
>>>>> ==
>>>>>
>>>>> Output:
>>>>>
>>>>>
>>>>> $VAR1 = {
>>>>>'search.mobile1.-ilike' => '%967%',
>>>>>'search.holder1.-ilike' => '%mis%',
>>>>>'search.flat_no' => 'A203&#x

Re: [Catalyst] complex search using Catalyst::Controller::DBIC::API::REST

2017-03-28 Thread Rajesh Kumar Mallah

leaving out the appending of base in RequestArguments.pm


does makes it work in my case.


--- RequestArguments.pm.orig2017-03-28 22:59:23.117637072 +0530
+++ RequestArguments.pm 2017-03-28 22:59:34.685636949 +0530
@@ -371,12 +371,11 @@
 # might be a sql function instead of a column name
 # e.g. {colname => {like => '%foo%'}}
 else {
 # but only if it's not a hashref
 unless ( ref $value eq 'HASH' ) {
-$search_params->{ join( '.', $base, $column ) } =
-$param->{$column};
+$search_params->{ $column } = $param->{$column};
 }
 else {
 die "unsupported value '$value' for column
 '$column'\n";
 }
 }


>
> Hi ,
>
> Thanks for the response.
>
> (1) The HTTP Request is:
>
>
 
/api/rest/general/members?list_returns=holder1&search.member_balance(member_id)=21
>
> (2) controller config is:   https://pastebin.com/2iT1YSPm
>
>
> Error log:
>
> [2017/03/28 22:22:44]- API.pm-290: ERROR
> DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st
> execute failed: ERROR:  schema "me" does not exist [for Statement "SELECT
> me.holder1 FROM general.members me WHERE ( ( me.member_balance(member_id)
> = ? AND me.society_id = ? ) ) ORDER BY member_id" with ParamValues:
> 1='21', 2='50']
>
>
> Regds
> Mallah.
>
>> Hi,
>>
>> please include your controller config and the http call.
>>
>> Best regards, Alex
>>
>>
>> On 2017-03-19 04:49, Rajesh Kumar Mallah wrote:
>>> Hi ,
>>>
>>> Including member_balance(member_id) in 'search_exposes' config param
>>> did help to proceed to some extent , but the function is being
>>> prefixed by the table alias whereas it should be left alone.
>>>
>>> eg:
>>>
>>>
>>>   search_exposes => [
>>>  qw/member_balance(member_id)/,
>>>  
>>>  . . . . .
>>>  ],);
>>>
>>>
>>> produces following invalid SQL note: member_balance is prefixed by
>>> 'me' .
>>>
>>>
>>> ERROR DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception:
>>> DBD::Pg::st execute failed: ERROR:  schema "me" does not exist [for
>>> Statement
>>>
>>> "SELECT me.holder1 FROM general.members me WHERE ( (
>>> me.member_balance(member_id) = ? AND me.society_id = ? ) ) ORDER BY
>>> member_id" with ParamValues: 1='21', 2='50']
>>>
>>>
>>> Any help is appreciated.
>>>
>>> regds
>>> mallah.
>>>
>>>>
>>>> Hi ,
>>>>
>>>> How to perform below search:
>>>>
>>>> select member_id,holder1 from general.members where
>>>>   member_balance(member_id , '2017-03-14') < 0 ;
>>>>
>>>> there is a function on LHS of the condition
>>>>
>>>> Regds
>>>> Mallah.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Hello Rajesh,
>>>>>
>>>>> C::C::DBIC::API supports that under the hood, so not sure what are
>>>>> you
>>>>> going after.
>>>>>
>>>>> You can either use: search=JSON.stringify(object) or construct the
>>>>> search
>>>>> passing params like: search.holder.-ilike=%mis%. Both should work out
>>>>> of
>>>>> the box.
>>>>>
>>>>> Regards
>>>>>
>>>>> On Wed, Mar 1, 2017 at 10:24 AM, Rajesh Kumar Mallah
>>>>> 
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Hi ,
>>>>>>
>>>>>> CGI::Expand collapse_hash comes to rescue ,
>>>>>> below is a small snippet that converts the perl
>>>>>> hash reference to the TT's dotted format using
>>>>>> CGI::Expand.
>>>>>>
>>>>>>
>>>>>> 
>>>>>> #!/usr/bin/perl -w
>>>>>>
>>>>>> use strict;
>>>>>>
>>>>>> use CGI::Expand qw(expand_hash  collapse_hash);
>>>&g

Re: [Catalyst] Paging support in Catalyst::Controller::DBIC::API

2017-03-29 Thread Rajesh Kumar Mallah


Thanks , It does return *when* paging related params are passed.
I have now used that result in my code.


Kind Regds
mallah.

> Hi,
>
> it does return it in the totalcount property by default.
>
> The name can be configured with the 'total_entries_arg' config parameter:
>
 
https://metacpan.org/pod/Catalyst::Controller::DBIC::API#count_arg,-page_arg,-select_arg,-search_arg,-grouped_by_arg,-ordered_by_arg,-prefetch_arg,-as_arg,-total_entries_arg
>
> Best regards, Alex
>
> On 2017-03-19 18:38, Dimitar Petrov wrote:
> Hello Rajesh,
>
> I usually have my own: MyApp::REST which extends
>
> package MyApp::REST;
> use Moose;
> use Try::Tiny;
> use DBIx::Class::ResultSet::RecursiveUpdate;
> use Scalar::Util qw( reftype );
>
> BEGIN { extends 'Catalyst::Controller::DBIC::API::REST' }
>
> with 'Iris::Web::TraitFor::Controller::Datatables';
>
> ….
>
> and later on modifier:
>
>
> =head2 list_format_output
>
> Add more information about current search
>
> =cut
>
> after 'list_format_output' => sub {
>   my ($self, $c) = @_;
>
>   if (!$self->has_errors($c) && $c->req->has_search_total_entries) {
> my $current_result_set = $c->req->current_result_set;
>
> $c->stash->{ $self->stash_key }{last_page}=
> $current_result_set->pager->last_page + 0;
> $c->stash->{ $self->stash_key }{current_page} =
> $current_result_set->pager->current_page + 0;
> $c->stash->{ $self->stash_key }{entries_per_page} =
> $current_result_set->pager->entries_per_page + 0;
> $c->stash->{ $self->stash_key }{entries_on_this_page} =
> $current_result_set->pager->entries_on_this_page + 0;
>   }
> };
>
> Best regards,
>
>
> On Mar 19, 2017, at 09:28, Rajesh Kumar Mallah
> mailto:mal...@redgrape.tech>> wrote:
>
> Hi ,
>
> We know that Catalyst::Controller::DBIC::API supports paging
> via list_count  , list_page and list_offset  options and
> its possible to fetch a page of a large result set.
>
> However what it does not seems to support is to tell
> the View(caller) of how many records in total exists , ie
> the total_entries of the Data::Page object.
>
> This compels us to make two queries one to get the total count
> and another to get the paged result.
>
> Does this feature really does not exists or am I missing something?
>
> (The reason I love and thoroughly use Catalyst::Controller::DBIC::API is
> that it allows me to be lazy :p )
>
> regds
> Rajesh Kumar Mallah.
>
>
>
>
> ___
> List: Catalyst@lists.scsys.co.uk<mailto: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<mailto: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/
>
>
>
>
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
> Handelsgericht Wien, FN 79340b
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> Notice: This e-mail contains information that is confidential and may be
> privileged.
> If you are not the intended recipient, please notify the sender and then
> delete this e-mail immediately.
>
 *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> ___
> 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] complex search using Catalyst::Controller::DBIC::API::REST

2017-04-04 Thread Rajesh Kumar Mallah

Thanks for the response, I shall relook that approach and
post when I work on it again.

Kind Regds
mallah

> Have you tried using the search parameter with JSON encoded parameters
> as suggested before?
>
> DBI::API doesn't guess if the search parameter you've provided is a
> column name or a db function.
>
> Best regards, Alex
>
>
> On 2017-03-28 18:58, Rajesh Kumar Mallah wrote:
>> Hi ,
>>
>> Thanks for the response.
>>
>> (1) The HTTP Request is:
>>
>>
 
/api/rest/general/members?list_returns=holder1&search.member_balance(member_id)=21
>>
>> (2) controller config is:   https://pastebin.com/2iT1YSPm
>>
>>
>> Error log:
>>
>> [2017/03/28 22:22:44]- API.pm-290: ERROR
>> DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st
>> execute failed: ERROR:  schema "me" does not exist [for Statement
>> "SELECT
>> me.holder1 FROM general.members me WHERE ( (
>> me.member_balance(member_id)
>> = ? AND me.society_id = ? ) ) ORDER BY member_id" with ParamValues:
>> 1='21', 2='50']
>>
>>
>> Regds
>> Mallah.
>>
>>> Hi,
>>>
>>> please include your controller config and the http call.
>>>
>>> Best regards, Alex
>>>
>>>
>>> On 2017-03-19 04:49, Rajesh Kumar Mallah wrote:
>>>> Hi ,
>>>>
>>>> Including member_balance(member_id) in 'search_exposes' config param
>>>> did help to proceed to some extent , but the function is being
>>>> prefixed by the table alias whereas it should be left alone.
>>>>
>>>> eg:
>>>>
>>>>
>>>>search_exposes => [
>>>>   qw/member_balance(member_id)/,
>>>>   
>>>>   . . . . .
>>>>   ],);
>>>>
>>>>
>>>> produces following invalid SQL note: member_balance is prefixed by
>>>> 'me' .
>>>>
>>>>
>>>> ERROR DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception:
>>>> DBD::Pg::st execute failed: ERROR:  schema "me" does not exist [for
>>>> Statement
>>>>
>>>> "SELECT me.holder1 FROM general.members me WHERE ( (
>>>> me.member_balance(member_id) = ? AND me.society_id = ? ) ) ORDER BY
>>>> member_id" with ParamValues: 1='21', 2='50']
>>>>
>>>>
>>>> Any help is appreciated.
>>>>
>>>> regds
>>>> mallah.
>>>>
>>>>> Hi ,
>>>>>
>>>>> How to perform below search:
>>>>>
>>>>> select member_id,holder1 from general.members where
>>>>>member_balance(member_id , '2017-03-14') < 0 ;
>>>>>
>>>>> there is a function on LHS of the condition
>>>>>
>>>>> Regds
>>>>> Mallah.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hello Rajesh,
>>>>>>
>>>>>> C::C::DBIC::API supports that under the hood, so not sure what are
>>>>>> you
>>>>>> going after.
>>>>>>
>>>>>> You can either use: search=JSON.stringify(object) or construct the
>>>>>> search
>>>>>> passing params like: search.holder.-ilike=%mis%. Both should work
>>>>>> out
>>>>>> of
>>>>>> the box.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> On Wed, Mar 1, 2017 at 10:24 AM, Rajesh Kumar Mallah
>>>>>> 
>>>>>> wrote:
>>>>>>
>>>>>>> Hi ,
>>>>>>>
>>>>>>> CGI::Expand collapse_hash comes to rescue ,
>>>>>>> below is a small snippet that converts the perl
>>>>>>> hash reference to the TT's dotted format using
>>>>>>> CGI::Expand.
>>>>>>>
>>>>>>>
>>>>>>> 
>>>>>>> #!/usr/bin/perl -w
>>>>>>>
>>>>>>> use strict;
>>>>>>>
>>>>>>> use CGI::Expand qw(expand_hash  collapse_hash);

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

2017-04-15 Thread Rajesh Kumar Mallah
> 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/


[Catalyst] Please Help: Aborting a Catalyst request in auto method

2017-04-15 Thread Rajesh Kumar Mallah


Hi ,

I want to return HTTP Status 401 along with a body indicating
the friendly description from my auto method.


so i have below in my auto:
=
sub auto :Private {
my ( $self, $c ) = @_;
my $path = $c->request->path ;

if ($path !~ /login.html/ && ! $c->session->{username}) {
 $c->log->warn('*** Not logged in Authorized ');
 $c->response->status(401);
 $c->response->body(qq{Sorry please login to access this
resource});
 return 0;
}
return 1;
}

==


However the request proceeds to other part of the chain
and does things which are not required.


===



[info] *** Request 1 (0.003/s) [839042] [Sun Apr 16 05:23:25 2017] ***
[debug] Path is "/api/rest/articlearticle/list_objects"
[debug] "GET" request for "api/rest/zingyhomes/article_article/" from
"127.0.0.1"
[debug] Query Parameters are:
.-+--.
| Parameter   | Value 
  |
+-+--+
| _   | 1492317689850 
  |
| callback|
jQuery31001955130972547411_14923176- |
| | 89849 
  |
| list_count  | 5 
  |
| list_offset | 0 
  |
'-+--'
[debug] Created session "37077cb431fb8502ac220d4c624b1db2b1217de7"
[warn] *** Not logged in Authorized 
[debug] end subroutine.
[debug] Response Code: 401; Content-Type: unknown; Content-Length: unknown
[info] Request took 0.069336s (14.423/s)
.+---.
| Action | Time  |
++---+
| /api/rest/articlearticle/begin | 0.057763s |
| /auto  | 0.005666s |
< I want to break
| /api/rest/articlearticle/end   | 0.000543s |
  here :-(
|  -> /api/rest/articlearticle/serialize | 0.000162s |
'+---'

=


Previous discussions has been there
but it did not help me:

http://grokbase.com/t/sc/catalyst/055r77h11s/returning-false-in-auto-action
http://grokbase.com/t/sc/catalyst/083ev978bd/again-die-in-an-action-chain-does-not-break-the-chain


is there anything to halt the request after the appropriate
HTTP Status  and
Headers  and
Body

as been setup.


Regds
Rajesh Kumar Mallah.














___
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] Please Help: Aborting a Catalyst request in auto method

2017-04-17 Thread Rajesh Kumar Mallah


Thanks for the Response.,

by default end is defined as:

sub end : ActionClass('RenderView') {}

It helped me to split it in 2 parts:


sub end : Private {
my ($self, $c) = @_;
$c->forward('render') unless $c->res->output ;
}

sub render : ActionClass('RenderView') { }


=

so forwarding to default rendering action was skipped
if any previous actions had set an output.

If was the default RenderView that was leading to
other actions.

Checking for output is only one of the way , I think based
on need other criteria can also be used.


Regds
mallah.


> It looks okay actually, documentation:
>
> "If an |auto| action returns 0, any remaining actions will be skipped,
> except for |end|".
>
> It goes directly to end. You should restructure your code probably, so
> that the main handling doesn't happen in end. You can also use detach if
> you want. Also you may want to use the existing plugins for
> Authentication.
>
>
> Best
>
> On 2017-04-16 08:15, Rajesh Kumar Mallah wrote:
>>
>> Hi ,
>>
>> I want to return HTTP Status 401 along with a body indicating
>> the friendly description from my auto method.
>>
>>
>> so i have below in my auto:
>> =
>> sub auto :Private {
>>  my ( $self, $c ) = @_;
>>  my $path = $c->request->path ;
>>
>>  if ($path !~ /login.html/ && ! $c->session->{username}) {
>>   $c->log->warn('*** Not logged in Authorized ');
>>   $c->response->status(401);
>>   $c->response->body(qq{Sorry please login to access
>> this
>> resource});
>>   return 0;
>>  }
>>  return 1;
>> }
>>
>> ==
>>
>>
>> However the request proceeds to other part of the chain
>> and does things which are not required.
>>
>>
>> ===
>>
>>
>>
>> [info] *** Request 1 (0.003/s) [839042] [Sun Apr 16 05:23:25 2017] ***
>> [debug] Path is "/api/rest/articlearticle/list_objects"
>> [debug] "GET" request for "api/rest/zingyhomes/article_article/" from
>> "127.0.0.1"
>> [debug] Query Parameters are:
>>
 .-+--.
>> | Parameter   | Value
>>|
>>
 +-+--+
>> | _   | 1492317689850
>>|
>> | callback|
>> jQuery31001955130972547411_14923176- |
>> | | 89849
>>|
>> | list_count  | 5
>>|
>> | list_offset | 0
>>|
>>
 '-+--'
>> [debug] Created session "37077cb431fb8502ac220d4c624b1db2b1217de7"
>> [warn] *** Not logged in Authorized 
>> [debug] end subroutine.
>> [debug] Response Code: 401; Content-Type: unknown; Content-Length:
>> unknown
>> [info] Request took 0.069336s (14.423/s)
>>
 .+---.
>> | Action | Time
>> |
>>
 ++---+
>> | /api/rest/articlearticle/begin | 0.057763s
>> |
>> | /auto  | 0.005666s
>> |
>> < I want to break
>> | /api/rest/articlearticle/end   | 0.000543s
>> |
>>here :-(
>> |  -> /api/rest/articlearticle/serialize | 0.000162s
>> |
>>
 '+---'
>>
>>
 
=
>>
>>
>> Previous discussions has been there
>> but it did not help me:
>>
>>
 http://grokbase.com/t/sc/catalyst/055r77h11s/returning-false-in-auto-action
>>
 
http://grokbase.com/t/sc/catalyst/083ev978bd/again-die-in-an-action-chain-does-not-break-the-chain
>>
>>
>> is there anything to halt the request after the appropriate
>> HTTP Status  and
>> 

[Catalyst] using catalyst controllers from script

2017-04-29 Thread Rajesh Kumar Mallah

Hi ,

I have  application logic in controllers which i want to
reuse from some non-http scripts.

Is it doable or should it be done at all ?


I know models can easily be called from scripts , but
my business logic lies in models and controllers.

sorry if it was a FAQ.


Regds
mallah.




___
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] using catalyst controllers from script

2017-04-29 Thread Rajesh Kumar Mallah


I was able to use the controller methods that did not require
$c .

I just used the Module in the script and called the
methods in it and it worked.

Regds
mallah.

>
> Hi ,
>
> I have  application logic in controllers which i want to
> reuse from some non-http scripts.
>
> Is it doable or should it be done at all ?
>
>
> I know models can easily be called from scripts , but
> my business logic lies in models and controllers.
>
> sorry if it was a FAQ.
>
>
> Regds
> mallah.
>





___
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] stash alternative for passing data

2017-05-11 Thread Rajesh Kumar Mallah


Hi

We need to pass value of variables from one stage of request
processing to other. We can use stash , but the problem is
some views like  Catalyst::View::JSON   tend to work on the
entire stash and they convert the stash to JSON output and we
do not want to expose all the intermediate values/variables.


Hence my question is  is there any mechanism to share data
in Catalyst App other than the stash.

Or should i create a simple perl package and use a global
hash variable in it ?

regds
mallah.






___
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] new Catalyst::Authentication::Credential::JWT

2017-06-01 Thread Rajesh Kumar Mallah

Thanks , it shall be useful. I would test it sometime.


> Hey,
>
> I just wrote a new module, to support JWT in Catalyst. I would be happy
> about your opinions. Later, I would like to upload it to CPAN.
>
> http://prepan.org/module/nYdTCdrkEHM
>
> Best, Gerhard
>
>
> ___
> 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] Don't log certain actions?

2017-06-28 Thread Rajesh Kumar Mallah
Hi ,

 debug logs are supposed to be  overwhelmed :-)

the usual approach to avoid debug lines is to bump up
the application loglevel to info or warn.

I assume you are consciously keeping the logging level to debug.

one way to filter out the specific kind of debug lines
would be a simple grep -v "pattern" , where pattern is something
specific you put in that section of application.

please look at NDC (nested diagn.. context) of Log4Perl
 on how to push a specific prefix.

you may consider using Log4Perl via Log::Log4perl::Catalyst


Regds
Rajesh Mallah.





> I have a more or less standard Catalyst app, using the Log::Dispatch
> plugin. Is there any way to avoid logging a certain action, or anything
> from a specific controller? I have something that's called very often and
> is never problematic, and it overwhelms the debug log.
> Thanks!
> Jen___
> 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/