Re: [Catalyst] How to de-serialize json?

2010-01-26 Thread Zbigniew Lukasiak
On Sun, Jan 24, 2010 at 8:01 AM, Bill Moseley mose...@hank.org wrote:


 On Sat, Jan 23, 2010 at 7:20 PM, Hans Dieter Pearcey
 hdp.perl.catalyst.us...@weftsoar.net wrote:

 As far as I can tell, you missed the point of my message, which makes me
 wonder
 if I've missed the point of yours.  Are you talking about a set of
 conventions
 you'd like to be able to build for your own use on top of HTTP::Body, or a
 set
 of conventions that you expect everyone will want and so should be built
 into
 HTTP::Body, or something else entirely?

 I thought you were saying that the request might not be a normal form
 posting, and I was saying only that HTTP::Body can support that, too.
 I was not suggesting everyone should use one method over another.
 HTTP::Body seems (to me) like the natural place to deserialize.  Yet, the
 REST modules I cited use an action class to deserialize.  Thus, I was
 wondering if there was a specific reasons for that approach that I had not
 understood.  That's really all.

I cannot claim to understand all the concerns here - but to add my two
cents: it sounds like this deserialisation thing is not something
specific to Catalyst and now with other frameworks and libraries
gaining grounds - it would make sense to put that logic into something
reusable across them.


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

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


Re: [Catalyst] How to de-serialize json?

2010-01-26 Thread J. Shirley
On Tue, Jan 26, 2010 at 1:49 AM, Zbigniew Lukasiak zzb...@gmail.com wrote:
 On Sun, Jan 24, 2010 at 8:01 AM, Bill Moseley mose...@hank.org wrote:


 On Sat, Jan 23, 2010 at 7:20 PM, Hans Dieter Pearcey
 hdp.perl.catalyst.us...@weftsoar.net wrote:

 As far as I can tell, you missed the point of my message, which makes me
 wonder
 if I've missed the point of yours.  Are you talking about a set of
 conventions
 you'd like to be able to build for your own use on top of HTTP::Body, or a
 set
 of conventions that you expect everyone will want and so should be built
 into
 HTTP::Body, or something else entirely?

 I thought you were saying that the request might not be a normal form
 posting, and I was saying only that HTTP::Body can support that, too.
 I was not suggesting everyone should use one method over another.
 HTTP::Body seems (to me) like the natural place to deserialize.  Yet, the
 REST modules I cited use an action class to deserialize.  Thus, I was
 wondering if there was a specific reasons for that approach that I had not
 understood.  That's really all.

 I cannot claim to understand all the concerns here - but to add my two
 cents: it sounds like this deserialisation thing is not something
 specific to Catalyst and now with other frameworks and libraries
 gaining grounds - it would make sense to put that logic into something
 reusable across them.


I'm all for reusable code, but in no way should HTTP::Body start
taking this behavior by default.  I'm not really that sure how
effective it is, anyway.

decode_json( $c-req-body ); Is just not that hard :)


-J

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


Re: [Catalyst] How to de-serialize json?

2010-01-26 Thread Tomas Doran

Zbigniew Lukasiak wrote:

I cannot claim to understand all the concerns here - but to add my two
cents: it sounds like this deserialisation thing is not something
specific to Catalyst and now with other frameworks and libraries
gaining grounds - it would make sense to put that logic into something
reusable across them.


You mean like Data::Serializer, which is what C::A::REST uses?

Cheers
t0m


___
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] Where is the form field lost?

2010-01-26 Thread Octavian Rasnita

From: Charlie Garrison 

garri...@zeta.org.au


One of the reasons I found IC::FS so much better, was the extra
control for things like how files are named/stored on disk. From
the POD:

fs_file_name
  Provides the file naming algorithm. Override this method to
change it.
  This method is called with two parameters: The name of the
column and the column_info object.

_fs_column_dirs
  Returns the sub-directory components for a given file name.
Override it to provide a deeper directory tree or change the algorithm.


That's true, but I still don't know how can I store the path to the file.

If in the file field I store just the file name, I need to create a second
column just for storing the random path for each file upload field.

If I will store the random path and the file name in the same column like
/e3/e3434ae1b/The original file name.pdf

then each time I would need to create a subroutine that takes this file name
and gets only the original file name for printing it on the page, but I 
think this is the most simple way though.


Octavian


___
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] Default running over chained

2010-01-26 Thread xenoterrac...@gmail.com
I added a default action to my user controller. When I access /user/ a chained 
action is supposed to run, and it ran just fine until i added the default 
action. Now the default runs instead of the chained. No index exists in the 
controller 

 sub base :Chained('/') : PathPrefix : CaptureArgs(0) { ... }

 sub list : Chained('base') : PathPart('') : Args(0) { ... } 

 sub default : Path { ... }


___
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::View::Email 0.20 Has Been Released

2010-01-26 Thread Devin Austin

Hello everyone,

I apologize for the recent breakage in Catalyst::View::Email.  Luckily 
myself and a few others (apeiron++, rjbs++, confound++, t0m++, everyone 
else ++) tracked down the errors and fixed everything we could grab a 
hold of.


Please install (most conveniently using cpanf (which can be installed 
via App::CPAN::Fresh)) and test, and PLEASE notify the list if something 
has gone awry.


Thanks and take care,
dhoss

___
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::View::Email stopped working

2010-01-26 Thread Devin Austin

Charlie Garrison wrote:

Good morning,

I'm getting errors like the following when sending emails from my app 
(it was working fine previously):


Caught exception in MMM::View::Email::Template-process Can\'t locate 
object method is_simple via package sendmail (perhaps you forgot 
to load sendmail?) at /Library/Perl/5.8.8/Email/Sender/Simple.pm 
line 100.


When trying to find out exactly where the problem was; I noted that 
backend is no longer using Email::Send like it used to ( the 
documentation says), eg:


# Setup how to send the email
# all those options are passed directly to Email::Send
sender = {
mailer = 'SMTP',
# mailer_args is passed directly into Email::Send
mailer_args = {
Host = 'smtp.example.com', # defaults to localhost
username = 'username',
password = 'password',
}

C::V::Email now seems to be using Email::Sender instead. And I'm 
having trouble working out the correct config options I should be 
using. I've got 'mailer' set to 'SMTP' and there should be a 
$transport for that in Email::Sender. I'm using the following config 
(for local test server):


View::Email::Template
sender
mailer  SMTP
mailer_args
Host192.168.1.5
/mailer_args
/sender
/View::Email::Template


Is this a bug with C::V::Email or Email::Sender, or am I doing 
something wrong?



Charlie


Hi Charlie/Everyone Else Who Experienced the Breakage,

Catalyst::View::Email version 0.20 *should* in theory fix the recent 
breaks.  Please install (most conveniently using cpanf, attainable 
through App::CPAN::Fresh) and test, and notify the list/irc channel if 
you have any issues.


Also, see my previous email to the list regarding this fix/release.

Thanks,

dhoss

___
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] Where is the form field lost?

2010-01-26 Thread Charlie Garrison

Good morning,

On 26/01/10 at 7:56 PM +0200, Octavian Rasnita 
orasn...@gmail.com wrote:



From: Charlie Garrison garri...@zeta.org.au



_fs_column_dirs
 Returns the sub-directory components for a given file name.
Override it to provide a deeper directory tree or change the algorithm.


That's true, but I still don't know how can I store the path to the file.


Don't store it, retrieve it via the file field combined with the 
config (column_info) for the file field; add a method like this:


sub fs_file_path {
my ($self, $column) = @_;
my $fh = $self-$column;
return $fh-relative( 
$self-result_source-column_info($column)-{fs_column_path} )-stringify;

}

And if you only have one file field, then create a second method 
and call it instead (eg, for field named 'image'):


sub image_path  { shift-fs_file_path('image'); }



If in the file field I store just the file name, I need to create a second
column just for storing the random path for each file upload field.


Nope, use a method, no need to store the value in the db.


If I will store the random path and the file name in the same column like
/e3/e3434ae1b/The original file name.pdf


You don't need to store a random path either; Override the 
_fs_column_dirs  fs_file_name methods to name the file the way 
you want ( store it in the sub-directory you want).



then each time I would need to create a subroutine that takes this file name
and gets only the original file name for printing it on the 
page, but I think this is the most simple way though.


I'm not following that, you would only create the subroutine 
once. If you are writing lots of apps and need to the same 
functionality then either create a base class or role and put 
the sub there.



Charlie

--
   Ꮚ Charlie Garrison ♊ garri...@zeta.org.au
   〠 PO Box 141, Windsor, NSW 2756, Australia

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

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