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

2008-01-10 Thread Moritz Onken

Hi,

could you also implement a way to put the subject in the template?

Something like (TT):
[% subject = My Subject %]
[% BLOCK content %]
Email content
[% END %]

This makes localization possible for the subject,

when can we expect a new version?

Greets,

Moritz

Am 10.01.2008 um 01:50 schrieb 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/



___
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-10 Thread Carl Johnstone

from the context object, but is unavailable to MyApp.pm.  cookie_domain


Both the context object and the hostname should be available to code within 
MyApp.pm, but only if the code is running during a request.


In any case I wouldn't point multiple domains at the same site, you're 
always best off choosing your preferred name and redirecting alternatives. 
Otherwise you're going to have fun with users following links to domain1.com 
and coming back via links to domain2.com - often within minutes of each 
other.


That said, there's a case for needing to know the hostname if you've got 
multiple sites running from the same Cat App.



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/


Re: [Catalyst] hostname

2008-01-10 Thread Wade . Stuart
Carl Johnstone [EMAIL PROTECTED] wrote on 01/10/2008 09:44:30
AM:

  from the context object, but is unavailable to MyApp.pm.  cookie_domain

 Both the context object and the hostname should be available to code
within
 MyApp.pm, but only if the code is running during a request.

 In any case I wouldn't point multiple domains at the same site, you're
 always best off choosing your preferred name and redirecting
alternatives.
 Otherwise you're going to have fun with users following links to
domain1.com
 and coming back via links to domain2.com - often within minutes of each
 other.

How would you propose handling an ASP like service that is branded (both
host whatever.companya.com ... othersuch.company9.com, and templates)
for 1 companies? 1 instances of your app on different servers + all
of the cache and proxy services?  Or would you have companya.com redirect
to service.aspprovider.com and lose the ability (and pretty important
branding sometimes) to masquerade the service as if it were run by
companya?

I am just saying,  it is a completely valid and useful ability.

-Wade


 That said, there's a case for needing to know the hostname if you've got
 multiple sites running from the same Cat App.


 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/


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

2008-01-10 Thread J. Shirley
On Jan 10, 2008 1:36 AM, Moritz Onken [EMAIL PROTECTED] wrote:

 Hi,

 could you also implement a way to put the subject in the template?

 Something like (TT):
 [% subject = My Subject %]
 [% BLOCK content %]
 Email content
 [% END %]

 This makes localization possible for the subject,

 when can we expect a new version?

 Greets,

 Moritz

 Am 10.01.2008 um 01:50 schrieb 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/


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


Moritz,

That patch isn't likely to go in, since subject belongs in the headers which
is outside of the rendering cycle or that mime-part.  If you want to do
localization of the subject, just do:
  $c-stash-{email}-{subject} = $c-localize(Subject Here);

-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-10 Thread Moritz Onken
You could run the code which sends the mail within a template which  
gets post processed.
There you can access subject and content and attachments if you  
like and pass them to the mail function.


the post processed template could check whether subject or content is  
avaiable. if so pass it all together to create the mail. Otherwise use  
the stashed subject and the template output for the mail.


I'd prefer this way because you have all your localization in one place.

Moritz

Am 10.01.2008 um 17:20 schrieb J. Shirley:


On Jan 10, 2008 1:36 AM, Moritz Onken [EMAIL PROTECTED] wrote:
Hi,

could you also implement a way to put the subject in the template?

Something like (TT):
[% subject = My Subject %]
[% BLOCK content %]
Email content
[% END %]

This makes localization possible for the subject,

when can we expect a new version?

Greets,

Moritz

Am 10.01.2008 um 01:50 schrieb 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/


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

Moritz,

That patch isn't likely to go in, since subject belongs in the  
headers which is outside of the rendering cycle or that mime-part.   
If you want to do localization of the subject, just do:

  $c-stash-{email}-{subject} = $c-localize(Subject Here);

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



___
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-10 Thread Jason Kohles


On Jan 10, 2008, at 1:54 PM, Octavian Rasnita wrote:


From: Carl Johnstone [EMAIL PROTECTED]
Both the context object and the hostname should be available to  
code within MyApp.pm, but only if the code is running during a  
request.


Ok, but how to get the hostname during a request in MyApp.pm if a $c  
variable is not available?





What you seem to be missing is that (in the current version at least)  
MyApp *IS* $c.


package MyApp;
sub get_hostname {
my ( $self ) = @_;
return $self-request-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/


Re: [Catalyst] hostname

2008-01-10 Thread Octavian Rasnita

From: [EMAIL PROTECTED]

Sys::Hostname or a statically set config var,  as there is no reference to
a request at that point (or any real way to derive the list of possible
hostnames hat could be requested).  But then again,  unless you know the
hostname that will always be requested why try to set it at that point at
all?  I would still opt for using the request to set a dynamic hostname
later in the process unless you have good reason not to (ssl cert tied to 
a

hostname for example).  I think most times it is better to not assume that
the hostname requested will be static in code. It makes for a more 
flexible

and  deployment easier for your app (do you really want to go change a
hardcoded hostname when dns changes need to happen).



Yes, these days we've just made some changes including DNS changes and for a 
few days we will have a temporary address for internal use, just a public 
IP, and I hope as soon as possible we've have a real address working and I 
would like to make all those ways of accessing the server work.


You said that I could make those settings later. Did I understand correctly 
that I could re-write that config settings in the Root.pm controller for 
making it available to all the controllers?


It could be  helpful for other things, because for this problem I learned 
that I can simply avoid setting a domain for the cookie.


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-10 Thread Jason Kohles

On Jan 10, 2008, at 3:15 PM, Octavian Rasnita wrote:


From: Ash Berlin [EMAIL PROTECTED]

How did you get to a function in MyApp.pm during a request

# in MyApp.pm

sub foobarbaz {
  my ($c) = @_;
}

# In controller code.
$c-foobarbaz();

Make sense?


Not really.

I've tried (in MyApp.pm):

sub the_host {
my ($c) = @_;
return $c-req-hostname;
}

and then I've tried to use

cookie_domain = the_host()
in the MyApp config, but when I try to start the server it gives an  
error telling that I can't use the method req because $c is  
undefined.


Because you didn't define it.  You have to call it as a method ($c- 
the_host()), and you have to call it *during a request*.  I don't  
know how you still expect to be able to get a value that is sent by  
the browser during startup when there is no browser.


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


Re: [Catalyst] POD viewer

2008-01-10 Thread Ashley

On Jan 10, 2008, at 10:59 PM, Jonathan Rockway wrote:

Silly quoting below, so I'm top posting.  Take that!

Anyway, the Catalyst Advent Calendar is basically a POD server.  Is it
pretty?  No... but it is something you can cargo cult if you want.


I don't know if the code is pretty yet but the presentation is quite  
nice.


Thanks!



http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/ 
CatalystAdvent/


Regards,
Jonathan Rockway

On Wed, 2008-01-09 at 08:19 +0100, Dami Laurent (PJ) wrote:

-Message d'origine-
De : Ashley [mailto:[EMAIL PROTECTED]
Envoyé : mercredi, 9. janvier 2008 04:05
À : The elegant MVC web framework
Objet : [Catalyst] POD viewer

Through a somewhat shallow search (difficult terms to search out
effectively) of the archives and search.CPAN I can't find if anyone
has hacked up a Cat based POD viewer/Controller; like the modperl
Apache one but, one hopes, without the (early?) security issues.

I want to be able to share internal POD at work to encourage both  
its

reading and writing.

Thanks!
-Ashley



The lack of a one-line attribution makes it impossible to cleanly  
reply

to this message (while keeping fragments from both your reply and the
original question).   Try to avoid this kthx.



Hi Ashley,

I've hacked up a pod viewing app : see Pod::POM::Web. It's not a  
Catalyst app, but it's a web app, sitting in mod_perl or cgi-bin  
or its own Http server, and serving all pod installed in your @INC.


Enjoy,

Laurent Dami



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