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/


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

2017-03-02 Thread Andrés Chandía


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?

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!
 


___

            andrés
chandía

NMT 

[Catalyst] Change of server

2017-03-02 Thread Andrés Chandía


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

2017-03-02 Thread Gil Magno
Hi

Are you by any chance using HTML::FormFu? If so, check the "ignore_if_empty" 
option.

https://metacpan.org/pod/HTML::FormFu::Model::DBIC#Config-options-for-fields

If not, could you please show the code with which you're "receiving" the params 
and inserting into the DB?

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/