Re: [Catalyst] Catalyst::View::Email broken?

2008-01-09 Thread J. Shirley
On Jan 9, 2008 3:26 PM, Bernhard Graf <[EMAIL PROTECTED]> wrote:

> J. Shirley wrote:
>
> > Hi Bernhard
> >
> > Could you file this as an RT bug?  I'm working on the next version
> > which will also have attachment support and don't want to miss this.
>
> Done.
>
> But thinking about this module brought me to the conclusion, that it
> doesn't buy me anything (besides headaches).
>
> Instead I've put a tiny little send_mail method in MyApp's base class,
> that calls Email::MIME::Creator and Email::Send.
>
> Less code that can break (and actually does) and more elegant to say
>  $self->send_mail($email_mime_object);
> instead of
>  $c->stash->{email} = $email_mime_hash;
>  $c->forward('View::Email');
>
> --
> Bernhard Graf
>
>

Thanks for the bug!

I definitely see your point about the simpler send_mail method, and I think
for a lot of cases it probably is easier that way.  I really want to tie
into the template rendering process with it, and that was my main impetus
for writing the module in the first place.

Once I can tie into other views to render attachments, I think it will be
worth it (An attachment sourced from a PDF View, for example).  Until then,
it's just slow progression that way.

Thanks for the feedback, though.  If you are just doing a plugin cycle, you
may want to look at Catalyst::Plugin::Email.

-J
-- 
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird...
http://www.toeat.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] Catalyst::View::Email broken?

2008-01-09 Thread Bernhard Graf
J. Shirley wrote:

> Hi Bernhard
>
> Could you file this as an RT bug?  I'm working on the next version
> which will also have attachment support and don't want to miss this.

Done.

But thinking about this module brought me to the conclusion, that it 
doesn't buy me anything (besides headaches).

Instead I've put a tiny little send_mail method in MyApp's base class, 
that calls Email::MIME::Creator and Email::Send.

Less code that can break (and actually does) and more elegant to say
  $self->send_mail($email_mime_object);
instead of
  $c->stash->{email} = $email_mime_hash;
  $c->forward('View::Email');

-- 
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] Re: [Dbix-class] Re: utf8 / pg double encoding problem

2008-01-09 Thread Ashley

And thank you for the chance to not look like a dummy for a change. :)

On Jan 9, 2008, at 1:32 PM, Daniel McBrearty wrote:


Thanks Ashley, that did indeed fix the JSON problem!

(wish I'd remembered to write a test *before* I fixed it like this  
though ;-)


cheers

Daniel

On Jan 7, 2008 9:28 PM, Ashley Pond V <[EMAIL PROTECTED]> wrote:

This may or may not be germane: try installing JSON::XS and updating
your JSON and JSON::Any. JSON::XS is one of, if not the, fastest
serializers in all data classes and its utf8 handling is better. JSON
now, IIRC, calls it if it's present instead of its older Perl  
version.


-Ashley

On Jan 7, 2008, at 7:57 AM, Daniel McBrearty wrote:


Data is actually sent in URI encoded utf8 (looks like "ab%C3%A7
"), which is fine. The string is then picked up, decoded and
stored in the db just fine. The problem is that what gets sent back
the other way (via Catalyst::View::JSON ) is not getting encoded. I
don't know quite why just now (according to the docs it should do).
Manually adding the Encode::encode_utf8( $result ) step fixes it for
now. I may try peeking to see why it doesn't get handled by the  
View.





___
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: [Dbix-class] Re: utf8 / pg double encoding problem

2008-01-09 Thread Daniel McBrearty
Thanks Ashley, that did indeed fix the JSON problem!

(wish I'd remembered to write a test *before* I fixed it like this though ;-)

cheers

Daniel

On Jan 7, 2008 9:28 PM, Ashley Pond V <[EMAIL PROTECTED]> wrote:
> This may or may not be germane: try installing JSON::XS and updating
> your JSON and JSON::Any. JSON::XS is one of, if not the, fastest
> serializers in all data classes and its utf8 handling is better. JSON
> now, IIRC, calls it if it's present instead of its older Perl version.
>
> -Ashley
>
> On Jan 7, 2008, at 7:57 AM, Daniel McBrearty wrote:
>
> > Data is actually sent in URI encoded utf8 (looks like "ab%C3%A7
> > "), which is fine. The string is then picked up, decoded and
> > stored in the db just fine. The problem is that what gets sent back
> > the other way (via Catalyst::View::JSON ) is not getting encoded. I
> > don't know quite why just now (according to the docs it should do).
> > Manually adding the Encode::encode_utf8( $result ) step fixes it for
> > now. I may try peeking to see why it doesn't get handled by the View.
>
>
> ___
> 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/
>



-- 
Daniel McBrearty
email : danielmcbrearty at gmail.com
http://www.engoi.com
http://danmcb.vox.com
http://danmcb.blogger.com
find me on linkedin and facebook
BTW : 0873928131

___
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] hostname

2008-01-09 Thread Wade . Stuart
"Octavian Rasnita" <[EMAIL PROTECTED]> wrote on 01/09/2008 02:01:02 PM:

> From: <[EMAIL PROTECTED]>
> > So if you want the cookie to be set on the client without worrying
about
> > the hostname requested don't set the domain_name or set the domain_name
to
> > the common domain for all hosts.
>
> Thank you very much! That was it.
> I thought that if I won't set a domain name, it wont set the cookie
> correctly.
>
> Octavian

No problem,  I am impressed you were able to understand that post -- I was
interrupted six times while writing it and after I hit send noticed how
non-english-like it turned out.

-Wade


___
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] hostname

2008-01-09 Thread Octavian Rasnita

From: <[EMAIL PROTECTED]>

So if you want the cookie to be set on the client without worrying about
the hostname requested don't set the domain_name or set the domain_name to
the common domain for all hosts.


Thank you very much! That was it.
I thought that if I won't set a domain name, it wont set the cookie 
correctly.


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] hostname

2008-01-09 Thread Wade . Stuart
Ash Berlin <[EMAIL PROTECTED]> wrote on 01/09/2008 05:39:22 AM:

>
> On Jan 9, 2008, at 11:12 AM, Octavian Rasnita wrote:
>
> > From: "Ashley" <[EMAIL PROTECTED]>
> >
> >> Oh, I was too fast. Blush. You mean without the context object. :(
> >
> > Yes, that's what I want.
> > Can't the context object be accessed in MyApp.pm?
> >
> > Thanks.
> >
> > Octavian
> >
> >
>
> Currently MyApp.pm *is* the context object. The problem is Catalyst
> has no idea of the hostname until it sees the request headers - you
> can have multiple hosts point at the same Catalyst app. Only you know
> what the hostname is - so you'll have to set it in the config.
>
> -ash

Not really,  the http request also includes the clients version of the host
it is requesting from.  This is how virtual servers work (where one http
process serves different data based on the hostname the client is
requesting).  $c->req->header( 'Host' ) provides the information needed
from the context object, but is unavailable to MyApp.pm.  cookie_domain
setting in Catalyst::Plugin::Session::State::Cookie needs to be set to
reflect the requested hostname in this case else the browser will not set
the cookie nor include it on round trips to the application if the
requested host/domain is different from the host that Catalyst believes it
is running as.  I believe a workaround for this issue is to leave the
cookie_domain setting unset which I believe will produce a cookie that is
not stating its domain and the client browser will treat as locked to the
requested host's name for the domain.



So if you want the cookie to be set on the client without worrying about
the hostname requested don't set the domain_name or set the domain_name to
the common domain for all hosts.



-Wade





___
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 broken?

2008-01-09 Thread J. Shirley
On Jan 7, 2008 3:27 PM, Bernhard Graf <[EMAIL PROTECTED]> wrote:

> I'm unable to create multipart/alternative email with C:V:Email 0.10.
>
> This worked with 0.06:
> $stash->{email} = {
>header => [ From => $from, To => $to, Subject => $subject],
>content_type => 'multipart/alternative',
>parts => [
>Email::MIME->create(
>attributes => {
>content_type => 'text/plain',
>charset => $cs_plain,
>encoding => $enc_plain,
>},
>body => $plain,
>),
>Email::MIME->create(
>attributes => {
>content_type => 'text/html',
>charset => $cs_html,
>encoding => $enc_html,
>},
>body => $html,
>),
>],
> }
>
> From how I see the code, it is broken at least in process:
>
>my %mime = ( header => $header );
>
>if ( $parts and ref $parts eq 'ARRAY' ) {
>$mime{parts} = $parts;
>} else {
>$mime{body} = $body;
>}
>
>if ( $mime{attributes} and not $mime{attributes}->{charset} and
> $self->{default}->{charset} )
>{
>$mime{attributes}->{charset} = $self->{default}->{charset};
>}
>
> $mime{attributes} is queried here, but never set.
> --
> Bernhard Graf
>

Hi Bernhard

Could you file this as an RT bug?  I'm working on the next version which
will also have attachment support and don't want to miss this.

Thanks,
-J

-- 
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird...
http://www.toeat.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] Catalyst::Utils::env_value ?

2008-01-09 Thread Brian Cassidy

Jesper Krogh wrote:

Can anyone help me find out what my problem is here?

$ perl -MDevel::SimpleTrace script/efam_server.pl
Undefined subroutine &Catalyst::Utils::env_value called


What version of Catalyst do you have? The env_value sub only appears in 
5.7008 and above..


-Brian

___
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] hostname

2008-01-09 Thread Jason Kohles

On Jan 9, 2008, at 6:16 AM, Octavian Rasnita wrote:

Is it possible to get the host name in MyApp.pm just like I can do  
it in a controller using


$c->req->hostname;


I want to use the current hostname for setting the cookie in the  
session, and the site could be accessed with 2 or more different  
host names. If I hard-code a certain hostname, the login won't work  
on other host names.


$c->req->hostname doesn't return the server hostname, it returns the  
client hostname.



Can't the current host that was requested be accessed in MyApp.pm?



$c->req->header( 'Host' );

--
Jason Kohles, RHCA RHCDS RHCE
[EMAIL PROTECTED] - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire



___
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::Utils::env_value ?

2008-01-09 Thread Jesper Krogh

Hi

Can anyone help me find out what my problem is here?

$ perl -MDevel::SimpleTrace script/efam_server.pl
Undefined subroutine &Catalyst::Utils::env_value called
at 
Catalyst::Plugin::ConfigLoader::get_config_path(/usr/share/perl5/Catalyst/Plugin/ConfigLoader.pm:165)
at 
Catalyst::Plugin::ConfigLoader::find_files(/usr/share/perl5/Catalyst/Plugin/ConfigLoader.pm:109)
at 
Catalyst::Plugin::ConfigLoader::setup(/usr/share/perl5/Catalyst/Plugin/ConfigLoader.pm:52)

at Catalyst::setup(/usr/share/perl5/Catalyst.pm:851)
at 
(/net/atlas.nzcorp.net/z/fx1200/bio/home/jk/NzDB/devel/script/../lib/Efam.pm:49)

at main::(script/efam_server.pl:59)
Compilation failed in require at script/efam_server.pl line 59.

Efam.pm:49 is
__PACKAGE__->setup();


Jesper

___
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] Gentoo Catalyst overlay: repository moved!

2008-01-09 Thread Michele Beltrame
Hello!

The Catalyst-related ebuilds (along with some others) are now part of the
perl-exprimental Gentoo overlay.

If you're using layman, please delete the old "catalystframework" overlay and
add "perl-experimental" instead.

If you fetch the ebuilds with Subversion, please update your repository addess 
to:

http://overlays.gentoo.org/svn/proj/perl/perl-experimental/

Old repository and overlay will not be maintained any more.

Thanks,
Michele.

-- 
Michele Beltrame
http://www.cattlegrid.info/
ICQ 76660101 - MSN [EMAIL PROTECTED]

___
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] process a restored request

2008-01-09 Thread catalyst
> Just a stupid thought...having not look at continuation...
> What if $c->request have freeze/thaw hooks?
... and a way to tell catalyst to unwind processing and start over with the
thawed request.

-- 
Julien Gervais-Bird

___
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] process a restored request

2008-01-09 Thread Christopher H. Laco
[EMAIL PROTECTED] wrote:
>> Catalyst::Plugin::Continuation should do that. But it appears to be
>> broken with the current Catalyst version. Or at least I was not able
>> to make it work.
> 
> Catalyst::Plugin::Continuation would have been perfect (it even has a test 
> case that suits my needs: 
> http://search.cpan.org/src/NUFFIN/Catalyst-Plugin-Continuation-0.01/t/05_login_example.t
>  ), 
> but I haven't been able to make it work either. 
> 
> At the moment, I am not comfortable enough with the inner workings of 
> Catalyst 
> to fix the module myself. Maybe later...
> 

Just a stupid thought...having not look at continuation...
What if $c->request have freeze/thaw hooks?



signature.asc
Description: OpenPGP digital signature
___
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] process a restored request

2008-01-09 Thread catalyst
> Catalyst::Plugin::Continuation should do that. But it appears to be
> broken with the current Catalyst version. Or at least I was not able
> to make it work.

Catalyst::Plugin::Continuation would have been perfect (it even has a test 
case that suits my needs: 
http://search.cpan.org/src/NUFFIN/Catalyst-Plugin-Continuation-0.01/t/05_login_example.t
 ), 
but I haven't been able to make it work either. 

At the moment, I am not comfortable enough with the inner workings of Catalyst 
to fix the module myself. Maybe later...

-- 
Julien Gervais-Bird

___
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] hostname

2008-01-09 Thread Ash Berlin


On Jan 9, 2008, at 11:12 AM, Octavian Rasnita wrote:


From: "Ashley" <[EMAIL PROTECTED]>


Oh, I was too fast. Blush. You mean without the context object. :(


Yes, that's what I want.
Can't the context object be accessed in MyApp.pm?

Thanks.

Octavian




Currently MyApp.pm *is* the context object. The problem is Catalyst  
has no idea of the hostname until it sees the request headers - you  
can have multiple hosts point at the same Catalyst app. Only you know  
what the hostname is - so you'll have to set it in the config.


-ash


___
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] hostname

2008-01-09 Thread Octavian Rasnita
From: Oleg Pronin 


  > If you mean to get hostname in offline mode (off the processing request) - 
the hostname is not known because there are no request.
  > You can get the server's real hostname by Sys::Hostname::hostname() but 
this probably won't help. 

  I want to use the current hostname for setting the cookie in the session, and 
the site could be accessed with 2 or more different host names. If I hard-code 
a certain hostname, the login won't work on other host names.

  Can't the current host that was requested be accessed in MyApp.pm?

  How can I do this?

  Thank you.

  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] hostname

2008-01-09 Thread Octavian Rasnita

From: "Ashley" <[EMAIL PROTECTED]>


Oh, I was too fast. Blush. You mean without the context object. :(



Yes, that's what I want.
Can't the context object be accessed in MyApp.pm?

Thanks.

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/