Re: [Catalyst] Where is the form field lost?

2010-01-25 Thread Charlie Garrison

Good evening,

On 25/01/10 at 8:08 AM +0200, orasn...@gmail.com wrote:


From: Charlie Garrison garri...@zeta.org.au
On 24/01/10 at 10:47 PM +0200, Octavian Rasnita orasn...@gmail.com wrote:


I had some problems with InflateColumn::File a few weeks ago which
were going to be hard for me to work around. I asked about it on IRC
and was told *not* to use the broken InflateColumn::File and use
InflateColumn::FS instead.


Can you tell about those problems? I hope I won't create them in the inflator I 
want to create.


I don't recall exactly, but IC::File had problems with multiple 
'file' columns. I remember, the delete part was completely 
broken if all files were not in the same directory. I was trying 
to patch IC::File so that deleting would work; I was advised to 
use IC::FS rather than trying to fix IC::File. (I don't recall 
who said that, sorry.)



Not only did InflateColumn::FS resolve my main issue; it also fixed a
couple of frustrating niggles. I found InflateColumn::FS to be more
robust all around.


I have also tried InflateColumn::FS but the thing I don't like is that
it creates random directories and this is good from a security point of
view, but for ease of use I like the way InflateColumn::File create the
target dirs.


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.


Eg (example from myApp; I used a different naming scheme in the 
end, but this shows the flexibility of IC::FS):


sub fs_file_name {
my ($self, $column, $column_info) = @_;
my MIME::Type $img_mimetype = 
MIME::Types-new-type($self-mime_type); #'image/jpeg'

my $size = $column eq 'media_full_file'  ?
'full' :
   $column eq 'media_thumb_file' ?
'thumb' :
   $column eq 'media_orig_file'  ?
'orig' :
'';
return sprintf(%05d-%s_%s.%s,
$self-user-id,
$self-name,
$size,
$img_mimetype-subType)
}

I ended up using something very close to the original method, I 
just wanted to add the file extension:


sub fs_file_name {
my ($self, $column, $column_info) = @_;
my MIME::Type $img_mimetype = 
MIME::Types-new-type($self-mime_type); #'image/jpeg'

return sprintf(%s.%s, DBIx::Class::UUIDColumns-get_uuid, 
$img_mimetype-subType)
}

I'm sure it's possible to use the original file name (from 
upload param), but I didn't want to use that anyway. So again, 
IC:FS was an easy win for me.


Note, I find the sub-dirs created with IC::FS much more 
desirable than putting them all in one directory (for scaling 
reasons). I was looking at ways of patching IC:File to do that 
since I wasn't looking forward to many thousands of directory 
entries in my media dir. And if I find that two-letter sub dirs 
isn't enough (I hope we get that big), I can easily change that 
by overriding _fs_column_dirs.



With InflateColumn::File the original file name is also used when it is
stored on the disk, and I just need to put a link to that static file,
without needing to create a column for storing the MIME type of the
file and without needing to use code for getting the file and giving it
to those that request it. If it is possible to do that with
InflateColumn::FS, please tell me.


Create a method that returns the file path and call that when 
you need to create URL pointing to the file:


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 I created some wrapper methods for each column:

sub media_full_file_path  { 
shift-fs_file_path('media_full_file');  }
sub media_thumb_file_path { 
shift-fs_file_path('media_thumb_file'); }
sub media_orig_file_path  { 
shift-fs_file_path('media_orig_file');  }


In my template:

[%  img_full_src   = 
c.uri_for(/static/media/${user_image.media_full_file_path} );

img_thumb_src  = 
c.uri_for(/static/media/${user_image.media_thumb_file_path});
-%]

Note, fs_file_path return a two-part path, so the value needs to 
be passed as part of first arg to uri_for. Otherwise, if passed 
as second arg, the slash will get encoded and things may not 
work as expected.




If you're going to upload an HTML::FF inflator module tp CPAN, I
suggest making it work with InflateColumn::FS instead (or at least in
addition to InflateColumn::File).


I have tried that with InflateColumn::File, but without success, but in
any case, the most important changes were to make it work with
HTML::FormFu and to be able to do all the operations 

[Catalyst] Q: Delete old session data

2010-01-25 Thread Bernhard Graf
Is there a recommended way to delete old session data from disk?

I'm Catalyst::Plugin::Session::Store::File for the session store,
because it is quite robust. The doc says there is a method
delete_expired_sessions(), but that module doesn't seem to care about
expiry at all, so that method seems quite useless.

Bernhard Graf

___
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-25 Thread Octavian Râşniţă

From: Charlie Garrison garri...@zeta.org.au
Can you tell about those problems? I hope I won't create them in the 
inflator I want to create.


I don't recall exactly, but IC::File had problems with multiple
'file' columns. I remember, the delete part was completely
broken if all files were not in the same directory. I was trying
to patch IC::File so that deleting would work; I was advised to
use IC::FS rather than trying to fix IC::File. (I don't recall
who said that, sorry.)



If I remember well, the algorithm for deletion made a single deletion and 
then did a last() thinking that if one file was deleted, all the files were 
deleted. I think there was a little comment there that tells that.
Although I didn't need to store the files in different dirs, I've noticed 
that that piece of code won't work in case of more directories used, however 
I don't think it is so hard to patch it for solving that issue.


Thank you for the code you sent. I will analyse it better to see if I can 
use another way, but what I would like to avoid is exactly to need writing 
too much code like this in order to use the module, so I don't want to need 
writing those wrappers for each file column nor a separate subroutine that 
provides the file name. But maybe I will be able to create one in the 
inflator...


However I am not sure the way InflateColumn::FS works is compatible with 
HTML::FormFu. I think a better way would be the style used by 
InflateColumn::File eventually with a more flexible storage, or 
InflateColumn::FS should be changed so it should get the ID of the row after 
it is stored in the DB.
But in the second case, I don't know how I could store the real file name 
and the random path to the file without using more fields in the table.


Anyway, back to the main issue, the biggest problem is HTTP::Body steals the 
file upload fields if no files were attached.


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/


Re: [Catalyst] Q: Delete old session data

2010-01-25 Thread Tomas Doran

Bernhard Graf wrote:

Is there a recommended way to delete old session data from disk?

I'm Catalyst::Plugin::Session::Store::File for the session store,
because it is quite robust. The doc says there is a method
delete_expired_sessions(), but that module doesn't seem to care about
expiry at all, so that method seems quite useless.


Deleting all the expired sessions from within a web hit is a bad idea, 
as you're going to have to do an arbitrary amount of work, taking an 
arbitrary amount of time... (There may be several _MILLION_ files to 
delete in an extreme case).


I'd recommend just crontabbing find /tmp/session_dir -mtime +2 | xargs 
rm or something similar.. (I'd probably wrap this in a script which is a 
bit smarter and reports / deals with failure better etc, but you get the 
idea)..


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/


[Catalyst] UTF-8 and mails

2010-01-25 Thread Jens Schwarz
Hi,

first of all: I have read 
http://dev.catalystframework.org/wiki/tutorialsandhowtos/Using_Unicode 
(especially the Tips for Troubleshooting Unicode in Perl Web Applications)
Nevertheless I have a strange UTF-8 problem that I need help with:

Concerning UTF-8 everything in my App seems to work correct - except my mail 
action (I use Mail::Sender::Easy) in my Root controller:

code
(...)
use Mail::Sender::Easy qw(email);
use utf8;
(...)
sub mail :Private {
(...)
$mail_return = email({
  (...)
  'subject'= (... something from the database ...),
  '_text_info' = {
charset  = 'utf-8',
encoding = 'quoted-printable',
  },
  '_text'  = (... some text with literal UTF-8 characters NOT from the 
database ...),
  (...)
});
(...)
}
/code

This produces mails that have messed up UTF-8 characters although the charset 
is set in the mail header, and the clients (right now tested with Thunderbird 3 
and Outlook 2003) are configured to treat incoming mails as utf-8 encoded text. 
Strange: If I switch to ISO8859-1 in Thunderbird, the mails look alright. 
Outlook however simply drops the UTF-8 characters, so that p.ex. the German 
sentence Nachricht für Herrn Müller results in Nachricht fr Herrn Mller.
If I remove the use utf8, the UTF-8 characters that do NOT come from the 
database look fine (in the example above: everything in '_text'), the ones from 
the database are messed up (in the example above: everything in 'subject'). 
Removing the charset = 'utf-8' flag of the mail subroutine results in fine 
mails if I set the charset to ISO8859-1 in the clients.

To summerize: I have UTF-8-tifized everything that I am aware of - i.e.:
- Editor where the source code is produced
- source code itself
- in the MySQL database every table is set-up with UTF-8 Unicode charset and 
utf8_general_ci collation.
- the webbrowsers
- the email clients
- Catalyst (use utf8, UTF8Columns)
- Template Toolkit (View::TT = {ENCODING = 'UTF-8'} )
- FormFu (tt_args = {ENCODING = 'UTF-8'})

Any hints on where the problem might be?
Thanks

Jens
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser

___
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-25 Thread Charlie Garrison

Good evening,

On 25/01/10 at 11:30 AM +0200, orasn...@gmail.com wrote:


If I remember well, the algorithm for deletion made a single deletion
and then did a last() thinking that if one file was deleted, all the
files were deleted. I think there was a little comment there that tells
that. Although I didn't need to store the files in different dirs, I've
noticed that that piece of code won't work in case of more directories
used, however I don't think it is so hard to patch it for solving that
issue.


That's the issue and that's what I was going to patch. But 
IC::FS was a better solution (at least in my case).



Thank you for the code you sent. I will analyse it better to see if I
can use another way, but what I would like to avoid is exactly to need
writing too much code like this in order to use the module, so I don't
want to need writing those wrappers for each file column nor a separate
subroutine that provides the file name. But maybe I will be able to
create one in the inflator...


Those wrappers aren't needed; it was just a convenience to make 
usage from TT easier.



However I am not sure the way InflateColumn::FS works is compatible
with HTML::FormFu. I think a better way would be the style used by
InflateColumn::File eventually with a more flexible storage, or
InflateColumn::FS should be changed so it should get the ID of the row
after it is stored in the DB.


I use HTML::FF, but not for any file uploads, so I have no idea 
what sort of compatibility is needed (or available). I don't 
recall any difference between IC::File and IC::FS in relation to 
how files are assigned to columns. Hmm, there is a vague memory 
that with IC::File I had to create a hashref and store that 
instead, so again IC::FS is a win for simplicity.



But in the second case, I don't know how I could store the real file
name and the random path to the file without using more fields in the
table.


Create a fs_file_name method and have it assign the name? Maybe 
HTML::FF upload element doesn't allow any flexibility there. I 
know that I was able to use the supplied file name, but I was 
also passing around the $req-upload object so it was easy for 
me to grab the file name. In the end I decided I didn't want 
that anyway.



Anyway, back to the main issue, the biggest problem is HTTP::Body
steals the file upload fields if no files were attached.


Sorry, can't help with that. I'm not sure I understand the issue 
either; if there is no upload field then just assign undef to 
the file column. Ahh, cause HTML::FF is doing it all for you. 
While I find HTML::FF is a great solution for many cases, there 
are also many cases where it needs manual intervention; this may 
be one of them.


I just had a look at HTML::FormFu::Element::File and I don't see 
how it's doing anything to assist with creating the hashref 
required by IC::File. Is HTML::FormFu::Model::DBIC handling that?



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/


Re: [Catalyst] UTF-8 and mails

2010-01-25 Thread Alexander Hartmaier
Before testing end-to-end figure out if the chars from your database are
*really* utf-8.
I forgot to set an env var for the oracle client library to tell it I
want unicode which broke my app under fcgid.

If you're using DBIx::Class to access your database see
http://www.perlmonks.org/?node_id=736234.

--
Best regards, Alex


Am Montag, den 25.01.2010, 13:43 +0100 schrieb Jens Schwarz:
 Hi,

 first of all: I have read 
 http://dev.catalystframework.org/wiki/tutorialsandhowtos/Using_Unicode 
 (especially the Tips for Troubleshooting Unicode in Perl Web Applications)
 Nevertheless I have a strange UTF-8 problem that I need help with:

 Concerning UTF-8 everything in my App seems to work correct - except my mail 
 action (I use Mail::Sender::Easy) in my Root controller:

 code
 (...)
 use Mail::Sender::Easy qw(email);
 use utf8;
 (...)
 sub mail :Private {
 (...)
 $mail_return = email({
   (...)
   'subject'= (... something from the database ...),
   '_text_info' = {
 charset  = 'utf-8',
 encoding = 'quoted-printable',
   },
   '_text'  = (... some text with literal UTF-8 characters NOT from the 
 database ...),
   (...)
 });
 (...)
 }
 /code

 This produces mails that have messed up UTF-8 characters although the charset 
 is set in the mail header, and the clients (right now tested with Thunderbird 
 3 and Outlook 2003) are configured to treat incoming mails as utf-8 encoded 
 text. Strange: If I switch to ISO8859-1 in Thunderbird, the mails look 
 alright. Outlook however simply drops the UTF-8 characters, so that p.ex. the 
 German sentence Nachricht für Herrn Müller results in Nachricht fr Herrn 
 Mller.
 If I remove the use utf8, the UTF-8 characters that do NOT come from the 
 database look fine (in the example above: everything in '_text'), the ones 
 from the database are messed up (in the example above: everything in 
 'subject'). Removing the charset = 'utf-8' flag of the mail subroutine 
 results in fine mails if I set the charset to ISO8859-1 in the clients.

 To summerize: I have UTF-8-tifized everything that I am aware of - i.e.:
 - Editor where the source code is produced
 - source code itself
 - in the MySQL database every table is set-up with UTF-8 Unicode charset and 
 utf8_general_ci collation.
 - the webbrowsers
 - the email clients
 - Catalyst (use utf8, UTF8Columns)
 - Template Toolkit (View::TT = {ENCODING = 'UTF-8'} )
 - FormFu (tt_args = {ENCODING = 'UTF-8'})

 Any hints on where the problem might be?
 Thanks

 Jens


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


Re: [Catalyst] UTF-8 and mails

2010-01-25 Thread Octavian Râsnita

From: Jens Schwarz blacky6...@gmx.de


Hi,

first of all: I have read 
http://dev.catalystframework.org/wiki/tutorialsandhowtos/Using_Unicode 
(especially the Tips for Troubleshooting Unicode in Perl Web 
Applications)

Nevertheless I have a strange UTF-8 problem that I need help with:

Concerning UTF-8 everything in my App seems to work correct - except my 
mail action (I use Mail::Sender::Easy) in my Root controller:


Try using Mail::Builder::Simple for sending UTF-8 encoded email messages 
(headers and body).


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/


Re: [Catalyst] UTF-8 and mails

2010-01-25 Thread Jens Schwarz
Hi,

 Original-Nachricht 
 Datum: Mon, 25 Jan 2010 13:52:45 +0100
 Von: Alexander Hartmaier alexander.hartma...@t-systems.at
 An: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Betreff: Re: [Catalyst] UTF-8 and mails

 Before testing end-to-end figure out if the chars from your database are
 *really* utf-8.
 I forgot to set an env var for the oracle client library to tell it I
 want unicode which broke my app under fcgid.
 
 If you're using DBIx::Class to access your database see
 http://www.perlmonks.org/?node_id=736234.

If I set mysql_enable_utf8 (I guess that's what you're referring to), it does 
not change anything. Beside: 
http://dev.catalystframework.org/wiki/tutorialsandhowtos/Using_Unicode#Note 
states that this flag is experimental and may change in future versions so I 
tried to avoid it.

Any other ideas?
Thanks.
-- 
Nur noch bis 31.01.2010: DSL-Komplettpaket für 16,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl02

___
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] Q: Delete old session data

2010-01-25 Thread Bernhard Graf
Tomas Doran schrieb:

 Deleting all the expired sessions from within a web hit is a bad idea,
 as you're going to have to do an arbitrary amount of work, taking an
 arbitrary amount of time... (There may be several _MILLION_ files to
 delete in an extreme case).

I know, I know. Of course such tasks don't belong in a HTTP request
loop. I'm just asking to be sure that I'm not missing some clever
feature here. ;-)
Look at Apache::Session::Counted for a file system based session module
with (optional) implicit garbage collection.

 I'd recommend just crontabbing find /tmp/session_dir -mtime +2 | xargs
 rm or something similar.. (I'd probably wrap this in a script which is a
 bit smarter and reports / deals with failure better etc, but you get the
 idea)..

So if C:P:S:Store::File doesn't honour any expiration information your
suggestion makes sense.


Bernhard Graf


___
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] UTF-8 and mails

2010-01-25 Thread Bernhard Graf
Jens Schwarz schrieb:

 first of all: I have read 
 http://dev.catalystframework.org/wiki/tutorialsandhowtos/Using_Unicode 
 (especially the Tips for Troubleshooting Unicode in Perl Web Applications)
 Nevertheless I have a strange UTF-8 problem that I need help with:
 
 Concerning UTF-8 everything in my App seems to work correct - except my mail 
 action (I use Mail::Sender::Easy) in my Root controller:
 
 code
 (...)
 use Mail::Sender::Easy qw(email);
 use utf8;
 (...)
 sub mail :Private {
 (...)
 $mail_return = email({
   (...)
   'subject'= (... something from the database ...),
   '_text_info' = {
 charset  = 'utf-8',
 encoding = 'quoted-printable',
   },
   '_text'  = (... some text with literal UTF-8 characters NOT from the 
 database ...),
   (...)
 });
 (...)
 }
 /code
 
 This produces mails that have messed up UTF-8 characters although the charset 
 is set in the mail header, and the clients (right now tested with Thunderbird 
 3 and Outlook 2003) are configured to treat incoming mails as utf-8 encoded 
 text. Strange: If I switch to ISO8859-1 in Thunderbird, the mails look 
 alright. Outlook however simply drops the UTF-8 characters, so that p.ex. the 
 German sentence Nachricht für Herrn Müller results in Nachricht fr Herrn 
 Mller.
 If I remove the use utf8, the UTF-8 characters that do NOT come from the 
 database look fine (in the example above: everything in '_text'), the ones 
 from the database are messed up (in the example above: everything in 
 'subject'). Removing the charset = 'utf-8' flag of the mail subroutine 
 results in fine mails if I set the charset to ISO8859-1 in the clients.


Does Mail::Sender::Easy automatically encode _text into the encoding
given in charset? If not, then /you/ have to do it:
Encode::encode(utf-8, $string);

Concerning use utf8: As soon as you have any non-ASCII literals in
your code (Herr Müller), then you want to use that, BUT only if your
perl code file is also utf-8 encoded. Read the perl man pages about
unicode, if you are not sure. Read them twice, and then once more. ;-)
It's not a shame, if you don't get the whole picture at first.

And LBNL the charset in the header has no meaning for any header line.
For your subject line your have to encode this acording to RFC 2047 (but
you don't actually have to code that yourself - CPAN is your friend ;-).

Maybe you should change to another email module anyway. I don't know
Mail::Sender::Easy, but it seems old and unmaintained.

HTH

Bernhard

___
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] UTF-8 and mails

2010-01-25 Thread Bernhard Graf
Jens Schwarz schrieb:

 If I set mysql_enable_utf8 (I guess that's what you're referring to), it does 
 not change anything. Beside: 
 http://dev.catalystframework.org/wiki/tutorialsandhowtos/Using_Unicode#Note 
 states that this flag is experimental and may change in future versions so 
 I tried to avoid it.

Don't avoid mysql_enable_utf8, it works! Use it (DBD::SQLite and DBD::Pg
have similar options if you are concerned about portability)!

Instead I'd suggest avoiding DBIx::Class::UTF8Columns, if you are using
that. That component really helps to shoot you into your own feet!

If your data is stored correctly in the database, then with option
mysql_enable_utf8 data is implicitly decoded from utf8 into Perl strings
 and vice versa.

If you are not sure if your data is encoded correctly in your MySQL
database, then read http://bugs.mysql.com/bug.php?id=37739 . If found
this really helpful and comprehensive.

But from your original post it didn't seem that the database was your
problem, right?


Bernhard Graf

___
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] UTF-8 and mails

2010-01-25 Thread Bill Moseley
On Mon, Jan 25, 2010 at 6:54 AM, Bernhard Graf cataly...@augensalat.dewrote:


 Does Mail::Sender::Easy automatically encode _text into the encoding
 given in charset? If not, then /you/ have to do it:
 Encode::encode(utf-8, $string);


That's what I do.   Specifically, I have this for generating inline text
emails:


for my $template ( @templates ) {
my $body_content = $self-render_email_template( $template,
$c-{stash} );

push @parts, Email::MIME-create(
attributes = {
content_type = ( $template =~ /_html$/ ? 'text/html' :
'text/plain' ),
charset  = 'utf-8',
disposition  = 'inline',
encoding = 'base64',
},
body = encode_utf8( $body_content ),
);
}

}



 Concerning use utf8: As soon as you have any non-ASCII literals in
 your code (Herr Müller), then you want to use that, BUT only if your
 perl code file is also utf-8 encoded. Read the perl man pages about
 unicode, if you are not sure. Read them twice, and then once more. ;-)
 It's not a shame, if you don't get the whole picture at first.


And IMO string literals are better left in templates, in the databaes, and
.po files.

I use English, so I don't worry about utf-8 variable names.  I always
assumed at some point utf8 would become the default for Perl source, though.



-- 
Bill Moseley
mose...@hank.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] Tutorial work atten hkclark

2010-01-25 Thread xenoterrac...@gmail.com
I've been evicted from my home, and am unable to access the internet on 
anything but this sad little phone.
I'm unsure how long it will take me to acquire access, as my rural 
conditions makes my options limited. 
So for now i won't be able to continue the work on the tutorial, and if 
someone has time i wouldn't wait for me to resume updating it. 


___
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] Postgres and 'create model DBIC::Schema'

2010-01-25 Thread Wes Cravens

I've found that 'create model DBIC::Schema' is getting two things wrong:
timestamp default now() and serial sequences.

This means that I have to either delete the schema, recreate, and repair 
every time or I have to alter the schema manually when things change. 
Neither is optimal.


Is there something I can do to make sure that the schema is created 
'correctly'?


Wes

___
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] Postgres and 'create model DBIC::Schema'

2010-01-25 Thread Tomas Doran


On 25 Jan 2010, at 20:59, Wes Cravens wrote:
Is there something I can do to make sure that the schema is created  
'correctly'?


Describe your issue more fully on the DBIx::Class list, write failing  
tests?


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/


[Catalyst] C::A::Store::LDAP and multiple UID attributes

2010-01-25 Thread Peter Karman

There are 3 open RTs against Store::LDAP:

https://rt.cpan.org/Ticket/Display.html?id=51499
https://rt.cpan.org/Ticket/Display.html?id=51504
https://rt.cpan.org/Ticket/Display.html?id=51505

All three are about the same issue, which is multiple UID attributes on a single 
LDAP entry breaking role lookups.


I'm the current maintainer of the module but am unsure at this point what the 
best way to address the issue is. I'm inclined to simply update the POD to 
include a caveat about assuming one uid per LDAP entry, which is the 
*convention* with the POSIX schema even if the schema does not *require* it. 
OTOH, it might be a legitimate feature request to support multiple UIDs in a 
single entry, in which case I'll have to put on my thinking cap about how best 
to fix it.


I'm soliciting feedback here from other devs and users of the LDAP auth stuff.

--
Peter Karman  .  http://peknet.com/  .  pe...@peknet.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] Re: Unicode trouble with Catalyst::Engine::FastCGI

2010-01-25 Thread Rod Taylor
0.6802 does not seem to work for me.


I have some unicode text in a PostgreSQL database. It extracts
properly with the utf8 flag on (checked), it renders properly into the
template (save $c-response-body() to disk and serve static version
with apache shows perfectly), it also works as expected when served
via Server instead of FastCGI.

The headers are slightly different (charset=utf-8 vs charset=UTF-8)
but Firefox takes both as being UTF-8.

The content has UTF-8 characters double encoded with the new FastCGI module.

Note, I'm stuck on Apache 1.3.41.


Also using Unicode::Encoding (encoding = 'UTF-8'), View::TT2
(ENCODING = 'UTF-8'), and FormFu ({ constructor = { tt_args = {
ENCODING = 'UTF-8' }, }, }).

PostgreSQL connects via with pg_enable_utf8 = 1.




On Fri, Jan 22, 2010 at 08:48, Tomas Doran bobtf...@bobtfish.net wrote:
 Neo [GC] wrote:

 Thanks for this thread! I had the same problem with double encoding while
 running Catalyst with FastCGI (even more strange - only on newer
 applications on the same server).

 Bernhard Grafs proposal for a quick fix in
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg08401.html
 actually worked for me.

 You would be wanting this:

 http://search.cpan.org/CPAN/authors/id/M/MS/MSTROUT/FCGI-0.68_02.tar.gz

 which fixes the issue properly. :)

 If people could test and shout up if it works for them, that'd be
 appreciated!

 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/


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


Re: [Catalyst] Re: How to forward to a specific path

2010-01-25 Thread Julien Sobrier
Thanks.

I have pages in /page/number/title

I created a couple of categories: /ca1, /cat2, etc. Each of them map to a
/page/number/title

/page/1/some-title
/cat1/page/1/some-title
/cat2/page/1/some-title

For cat1 and cat2, I wanted to set some variables. So I intercept the page
in /cat1 and send it back to /page/1/some-title

/cat1, /cat2 and /page reside in different controller.

I'm just starting with Catalyst, so there might be a better way to do it.


Julien


On Sat, Jan 2, 2010 at 4:09 AM, Aristotle Pagaltzis pagalt...@gmx.dewrote:

 Hi Julien,

 * Julien Sobrier jul...@sobrier.net [2010-01-01 23:30]:
  I'm try to do a forward to a path rather than a controller. For
  example, if I get the url /foo/my/path, I want to redirect it
  to /my/path which belongs to a different controller.

 this sounds like there may be a way to achieve the goal you are
 trying to achieve. What is your goal here?

 Regards,
 --
 Aristotle Pagaltzis // http://plasmasturm.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/