[Catalyst] Catalyst::Plugin::Authentication::logout() true?

2007-07-22 Thread apv
Should Catalyst::Plugin::Authentication::logout() return something  
true upon success?


That way you can write code like

$c-logout() || $c-log-error(...);

Maybe reorder somehow to return the values from this expression?

delete @{ $c-session }{qw/__user __user_realm/};

-Ashley


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


Re: [Catalyst] Follow-up to new uri_for() bug

2007-07-20 Thread apv
A long, long time ago. Summation: req-base, and therefore c- 
uri_for, gets hosed in Engine::CGI after redirect requests if the  
request contains regex chars (several are legal for URIs) b/c it's  
doing a non-literal substitution.


The bug is actually worse that I thought before. Not only will it  
hose internal URI stuf, it will crash an app if given an unbalanced  
regex like http://host/path/args(with-problems


I got rebitten by this bug after a Cat update and forgot it never got  
addressed. It took me an hour of reading through the Cat modules to  
write a test but I learned a lot.


So, here's the diff to fix the bug.

--- Catalyst/Engine/CGI.pm.orig 2007-07-18 16:57:09.0 -0700
+++ Catalyst/Engine/CGI.pm  2007-07-18 16:57:24.0 -0700
@@ -115,7 +115,7 @@
 my $base_path;
 if ( exists $ENV{REDIRECT_URL} ) {
 $base_path = $ENV{REDIRECT_URL};
-$base_path =~ s/$ENV{PATH_INFO}$//;
+$base_path =~ s/\Q$ENV{PATH_INFO}\E$//;
 }
 else {
 $base_path = $ENV{SCRIPT_NAME} || '/';

And here is a test which fails (3 of 9 fail) until the patch is  
applied. I hope it's okay. It's the first non-Mech based Cat test  
I've written so a core dev should certainly check it over.


#!perl

use strict;
use warnings;

use FindBin;
use lib $FindBin::Bin/lib;

use Test::More tests = 9;
use Catalyst;
use Catalyst::Test 'TestApp';
use Catalyst::Request;

my ( $creq, $context );

# test that req-base and c-uri_for work correctly after a  
redirected request

{
my $path = '/engine/request/uri/Rx(here)';
my $uri = 'http://localhost' . $path;
local $ENV{REDIRECT_URL} = $path;
local $ENV{PATH_INFO} = $path;

ok( my $response = request($uri), 'Request' );
ok( $response-is_success, 'Response Successful 2xx' );
ok( eval '$creq = ' . $response-content, 'Unserialize  
Catalyst::Request' );


ok( $context = Catalyst-new({ request = $creq, }), Created a  
context from request );


is( $creq-path, 'engine/request/uri/Rx(here)', 'URI contains  
correct path' );

is( $creq-base, 'http://localhost/', 'Base is correct' );
is( $context-uri_for(/bar/baz)-as_string, http://localhost/ 
bar/baz, uri_for creates correct URI from app root );
is( $context-uri_for(foo/qux)-as_string, http://localhost/ 
foo/qux, uri_for creates correct URI );
is( $creq-path, 'engine/request/uri/Rx(here)', 'URI contains  
correct path' );

}




On Sep 11, 2006, at 6:22 PM, Matt S Trout wrote:


apv wrote:

http://lists.rawmode.org/pipermail/catalyst/2006-September/
009531.html (I did start a new message there, blame Mail.app, not me
for the bad threading)

Okay, mean guys. Make me solve my own, er, Catalyst's own, bugs.

Line 118 (5.7001) of Catalyst::Engine::CGI looks like this:
 $base_path =~ s/$ENV{PATH_INFO}$//;

Unless I'm losing it, it should look like this:
 $base_path =~ s/\Q$ENV{PATH_INFO}\E$//;

Otherwise uri_for (well, request-base and anything that uses it)
gets borked by any number of regex chars in the URI.


That seems like a sane complaint.

If you can add a failing test I can get it into 5.70002 ...

--
  Matt S Trout   Offering custom development, consultancy  
and support
   Technical Directorcontracts for Catalyst, DBIx::Class and  
BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more  
information


+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/





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


Re: [Catalyst] error installing Catalyst::Plugin::Session (2)

2007-07-11 Thread apv
I ran into this too doing a clean install last week on DreamHost and  
forgot to report it. I'm sorry! If you're in a hurry, the way I  
solved it (in the CPAN shell) was to install an older version of  
Session and family first and then upgrade from there.


-Ashley

On Jul 11, 2007, at 10:25 PM, Octavian Rasnita wrote:


Hi,

I have seen that when trying to install C::P::Session, appears the  
following error. It seems that C::P::Session depends on  
C::P::Session::State::Cookie but this second module depends on the  
first one.


t/06_finalize.ok 1/3Can't locate Catalyst/Plugin/ 
Session/State/Cookie.pm in @INC (@INC contains: /home/teddy/modules
/Catalyst-Plugin-Session-0.16/blib/lib /home/teddy/modules/Catalyst- 
Plugin-Session-0.16/blib/arch /usr/local/perl588/lib/5.8.8/x86_6
4-linux-thread-multi /usr/local/perl588/lib/5.8.8/x86_64-linux- 
thread-multi /usr/local/perl588/lib/5.8.8 /usr/local/perl588/lib/site
_perl/5.8.8/x86_64-linux-thread-multi /usr/local/perl588/lib/ 
site_perl/5.8.8/x86_64-linux-thread-multi /usr/local/perl588/lib/ 
site_p
erl/5.8.8 /usr/local/perl588/lib/site_perl/5.8.8/x86_64-linux- 
thread-multi /usr/local/perl588/lib/site_perl/5.8.8 /usr/local/perl588
/lib/site_perl . /usr/local/perl588/lib/5.8.8/x86_64-linux-thread- 
multi /usr/local/perl588/lib/5.8.8 /usr/local/perl588/lib/site_per
l/5.8.8/x86_64-linux-thread-multi /usr/local/perl588/lib/site_perl/ 
5.8.8 /usr/local/perl588/lib/site_perl .) at /usr/local/perl588/l

ib/site_perl/5.8.8/Catalyst.pm line 2139.
# Looks like you planned 3 tests but only ran 1.
# Looks like your test died just after 1.
t/06_finalize.dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 2-3
Failed 2/3 tests, 33.33% okay
t/99_pod..skipped
   all skipped: set TEST_POD to enable this test
t/99_podcoverage..skipped
   all skipped: Test::Pod::Coverage 1.04 required
t/live_appskipped
   all skipped: Catalyst::Plugin::Session::State::Cookie 0.03  
or higher is required for this test

Failed Test Stat Wstat Total Fail  List of Failed
-- 
-

t/06_finalize.t  255 65280 34  2-3
4 tests skipped.
Failed 1/8 test scripts. 2/25 subtests failed.
Files=8, Tests=25,  1 wallclock secs ( 0.50 cusr +  0.10 csys =   
0.60 CPU)

Failed 1/8 test programs. 2/25 subtests failed.
make: *** [test_dynamic] Error 255

Octavian



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


Re: [Catalyst] Ask Catalyst: What are your prefered DB and HTML abstraction layers ?

2007-07-07 Thread apv

On Jul 7, 2007, at 7:32 AM, Matt S Trout wrote:
(2) Do you need any of the features DBIC provides that RDBO  
doesn't? (resultset

chaining and support for GROUP BY/HAVING being the obvious candidates)


I'll chime in too. Resultset chaining (which can be used like  
filtering data sets) is a feature I had no idea I needed until I  
discovered it. Without it, even a good RDBO can start to look like  
spaghetti code.


-Ashley


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


Re: [Catalyst] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-07 Thread apv
Thanks Matt. That is much better. Stuffing the session with a ton of  
data up front didn't strike me as a good idea.



On Jul 7, 2007, at 7:11 AM, Matt S Trout wrote:


On Fri, Jul 06, 2007 at 09:30:38PM -0700, apv wrote:

False alarm. I figured it out. Have to prefetch relationships when
putting the user into the session at login or the goodies just ain't
in the session info.


The user object is re-retrieved by the auth plugin anyway, so

$c-user-obj-votes

will work.

if you're storing a 'user' object in the session, something like

$c-session-{user}-result_source($c-model('DB')-schema-source 
('User'));


will restore the result source.

--
  Matt S Trout   Need help with your Catalyst or  
DBIx::Class project?
   Technical DirectorWant a managed development or deployment  
platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk  
for a quote
http://chainsawblues.vox.com/ http:// 
www.shadowcatsystems.co.uk/



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


[Catalyst] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-06 Thread apv
So, in my template I have this and it works fine if I assign user,  
a DBIC object, to the stash from the controller.


 [% user.votes %]

But if I do this to get the user inside the template:

 [% user = Catalyst.session.user %]
 [% user.votes %]

I get this fatal error:

 Couldn't render template undef error - Can't call method source  
on an
 undefined value at /Library/Perl/5.8.6/DBIx/Class/ 
ResultSourceHandle.pm line 62.


I can get all of user's regular columns fine, like email, username,  
etc. Just not any of its relationships without the fatal.


Seems like it's not a session specific issue (both FastMmap and File  
engines fail the same way).


Any ideas?


-Ashley

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


Re: [Catalyst] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-06 Thread apv
False alarm. I figured it out. Have to prefetch relationships when  
putting the user into the session at login or the goodies just ain't  
in the session info.



–Ashley
--


On Jul 6, 2007, at 7:04 PM, apv wrote:

So, in my template I have this and it works fine if I assign  
user, a DBIC object, to the stash from the controller.


 [% user.votes %]

But if I do this to get the user inside the template:

 [% user = Catalyst.session.user %]
 [% user.votes %]

I get this fatal error:

 Couldn't render template undef error - Can't call method source  
on an
 undefined value at /Library/Perl/5.8.6/DBIx/Class/ 
ResultSourceHandle.pm line 62.


I can get all of user's regular columns fine, like email, username,  
etc. Just not any of its relationships without the fatal.


Seems like it's not a session specific issue (both FastMmap and  
File engines fail the same way).


Any ideas?




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


[Catalyst] Silently failing PageCache with Cache::FastMmap

2007-06-12 Thread apv
On my dev box, with the test server and with apache/fcgi, PageCache  
is working fine. On my live box (with DreamHost, test and apache/ 
fcgi), it's reporting that it's caching

  [debug] Caching page / for 300 seconds
but it reports it for every request instead of serving out of the  
cache for X seconds after the first request.


I've looked through the debug output and the POD for all the related  
files. Can't figure it out or find any related info in mailing list  
archive. I updated all my related Cache modules and I believe  
everything that's running is current.


The app is loading these
Cache::FastMmap
PageCache
last, after session and such.

And the config has
  page_cache:
set_http_headers: 1
debug: 1

Any ideas where to poke it to figure out why it's failing and how it  
can fail silently? Surely it has to do with the filesystem or  
permissions underneath? But that causes fatals on my dev box so I am  
not sure where to look…


Also, after I already wrote the above I tried Cache::FileCache  
instead of Cache::FastMmap and it works dev and live. I'm still  
curious why the other won't and which anyone recommends if you have a  
reason for a preference.



–Ashley
--



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


Re: [Catalyst] Silently failing PageCache with Cache::FastMmap

2007-06-12 Thread apv

On Jun 12, 2007, at 8:00 PM, Matt S Trout wrote:
Catalyst::Plugin::Cache::* are deprecated, use  
Catalyst::Plugin::Cache.


Thanks. I got it out of the current Cookbook POD. I hadn't read any  
core documents through in a year so I thought I was catching up. :)


-Ashley


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


Re: [Catalyst] HOWTO: extend the Authentication tutorial example and redirect to original URI

2007-03-29 Thread apv

On Thursday, Mar 29, 2007, at 08:28 US/Pacific, Chisel Wright wrote:

On Thu, Mar 29, 2007 at 09:13:31AM -0700, Jeff Chimene wrote:

As a side question, why does this particular technique use redirect()?
As opposed to, e.g. detach()?


Because Parley has kinda evolved over [a long period of] time, and I
expect there wasn't a detach() method when I wrote that method. :)

For the first redirect (to the /user/login page) I think a detach is 
nice

because the URI stays the same as where you want to go. For the second,
back to {after_login}, a redirect is probably how you should do it.
You're logging in so you're doing a POST request and you want to
redirect after that and have the right URL so the user isn't on
the page that corresponds to /admin/user/edit or something while the
URI is still /user/login.

-Ashley


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


[Catalyst] Slight return: error using session and authn plug-ins under apache

2007-03-25 Thread apv
I found this somewhat unresolved thread -- http://lists.rawmode.org/ 
pipermail/catalyst/2006-July/008854.html -- when having the same  
problem, approximately, after updating my OS X today.


Turned out, for me, to be the Storable install got itself or its  
libraries confused/remapped. I was able to fix it with reinstalling  
Storable *and* DBIx::Class::Serialize::Storable. Both cases I did a  
force install at the cpan prompt b/c they were up to date, just  
linked in, I think, the wrong lib.


Related error string for searches:
  Caught exception in engine Can't store CODE items at…


–Ashley
--
http://ashleypond.com/v/ · http://sedition.com/ · http://querylog.com/




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


Re: [Catalyst] Problem with POST from IE and Catalyst::Engine::HTTP

2007-03-23 Thread apv

H…

---
[EMAIL PROTECTED]/MyAppsetenv CATALYST_HTTP_DEBUG 1
[EMAIL PROTECTED]/MyApp./script/myapp_server.pl -d
[debug] Debug messages enabled
[debug] Loaded plugins:
.--- 
-.
| Catalyst::Plugin::ConfigLoader   
0.13   |
| Catalyst::Plugin::Static::Simple   
0.15 |
'--- 
-'


[debug] Loaded dispatcher Catalyst::Dispatcher
[debug] Loaded engine Catalyst::Engine::HTTP
[debug] Found home /Users/jinx/MyApp
[debug] Loaded Config /Users/jinx/MyApp/myapp.yml
[debug] Loaded components:
.- 
+--.
| Class   |  
Type |
+- 
+--+
| MyApp::Controller::Root |  
instance |
'- 
+--'


[debug] Loaded Private actions:
.--+-- 
+--.
| Private  | Class|  
Method   |
+--+-- 
+--+
| /default | MyApp::Controller::Root  |  
default  |
| /end | MyApp::Controller::Root  |  
end  |
'--+-- 
+--'


[info] MyApp powered by Catalyst 5.7007
You can connect to your server at http://jasper.local:3000
---

Same, nothing… tried with the -k too, as well as adding arbitrary  
strings to the URI, like http://jasper.local:3000/asdf -- no trouble  
with Firefox or IE.


OS 10.4.8, Safari 2.0.4 (419.3)

? Thanks for looking at it.

–Ashley
--


On Mar 23, 2007, at 3:48 PM, Andy Grundman wrote:

On Mar 23, 2007, at 4:38 PM, Ashley Pond V wrote:


On Friday, Mar 23, 2007, at 13:47 US/Pacific, Andy Grundman wrote:
I believe Safari is fine, it doesn't have the same bug IE does.   
Have you had problems with it?


Yep. I think I brought this up like … over a year ago. I'll go  
fire up a clean test app to make sure it's still an issue and not  
something left over from older development I've done.


Yep. Starting a clean App with the test server just hangs Safari:

  Safari can’t open the page.
  Safari could not open the page “http://localhost:3000/” because  
the server stopped responding.


-k has no effect. The debug output never shows the request at all.  
I *think* IE for Mac (not to support development for it, I know  
it's abandon-ware) had the same problem with earlier versions of  
Cat's test server but it did not have any trouble just now. I had  
the same problem on Safari years ago with a socket level chat  
server and it had to do with knowing when to stop reading the  
incoming request (that's why I was guessing it might be related to  
the char counting, line ending issue). Sorry I don't have the code  
in front of me to compare.


It dies on a GET request?  Can you run your server like this:

CATALYST_HTTP_DEBUG=1 perl script/myapp_server.pl -d

Then repeat the same thing and add -k.

Here's my output for reference (non-keepalive):

New connection
Read 239 bytes
Parsed request: GET / HTTP/1.1
Parsed headers: bless({
  accept = */*,
  accept-encoding = gzip, deflate,
  accept-language = en,
  connection = keep-alive,
  host = localhost:3000,
  user-agent = Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en)  
AppleWebKit/419 (KHTML, like Gecko) Safari/419.3,

}, HTTP::Headers)
write: Wrote headers and first chunk (5807 bytes)
[info] *** Request 7 (0.123/s) [693] [Fri Mar 23 15:46:54 2007] ***
[debug] GET request for / from 127.0.0.1
[info] Request took 0.007717s (129.584/s)
. 
+---.
| Action |  
Time  |
+ 
+---+
| /default   |  
0.000750s |
| /end   |  
0.000199s |
' 
+---'


Request done
Closing connection
New connection
Read 303 bytes
Parsed request: GET /static/images/catalyst_logo.png HTTP/1.1
Parsed headers: bless({
  accept = */*,
  accept-encoding = gzip, deflate,
  accept-language = en,
  connection = keep-alive,
  host = localhost:3000,
  referer = http://localhost:3000/;,
  user-agent = Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en)  
AppleWebKit/419 (KHTML, like Gecko) Safari/419.3,

}, HTTP::Headers)
write: Wrote headers and first chunk (13912 bytes)
Request done
Closing connection

Re: [Catalyst] Problem with POST from IE and Catalyst::Engine::HTTP

2007-03-23 Thread apv
Strangely enough, I was running an older Runtime but upgraded before  
double checking against your stuff.


On Mar 23, 2007, at 4:32 PM, Andy Grundman wrote:
I think the problem may be that you're using the weird Mac hostname  
'jasper.local' instead of localhost.  Maybe Safari resolves this  
differently than Firefox?



Could be, and it's certainly not a big deal (especially if I'm the  
only one with the problem). Thanks a lot for looking at it. Seriously.


-Ashley

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


Re: [Catalyst] Problem with POST from IE and Catalyst::Engine::HTTP

2007-03-23 Thread apv

On Mar 23, 2007, at 6:41 PM, Andy Grundman wrote:

On Mar 23, 2007, at 6:27 PM, Ashley Pond V wrote:
Oh, to add confusion upon confusion. It works fine across my  
Airport. Safari won't load it on the computer which is running the  
server, but Safari on the computer in the other room has no  
trouble at all with the test server at the exact same URI.


And what if you manually use http://localhost:3000 or http:// 
1.2.3.4:3000 where 1.2.3.4 is your IP address?


Nice. You solved it after all. http://localhost:3000/ works fine on  
the box running the script.




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


Re: [Catalyst] YAML config embedded path_to mysql_read_default_file

2007-03-20 Thread apv
Worked perfectly, thanks. Sorry I didn't extrapolate from the docs to  
just try it. Once you showed it, it seemed obvious.


-Ashley

On Monday, Mar 19, 2007, at 05:51 US/Pacific, Jason Kohles wrote:


On Mar 18, 2007, at 7:26 PM, apv wrote:

So, I would like to use a mysql connection file instead of putting  
the password and user in the config file. Can I get a path_to to work  
with this? I did Google and check the lists but couldn't find an  
answer. Where the __HERE__ is is where the  
mysql_read_default_file=(path_to) goes.


  Model::DBIC:
schema_class: MyApp::Schema::DBIC
connect_info:
   - dbi:mysql:opendevil;__HERE__;
   - ~
   - ~



If you are using Catalyst::Plugin::ConfigLoader to load your  
configuration (if you aren't sure then you probably are, it's the  
default), then you can do this...


Model::DBIC:
  schema_class: MyApp::Schema::DBIC
  connect_info:
-  
dbi:mysql:opendevil;mysql_read_default_file=__path_to(configfile.cfg)__



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


[Catalyst] YAML config embedded path_to mysql_read_default_file

2007-03-18 Thread apv
So, I would like to use a mysql connection file instead of putting  
the password and user in the config file. Can I get a path_to to work  
with this? I did Google and check the lists but couldn't find an  
answer. Where the __HERE__ is is where the mysql_read_default_file= 
(path_to) goes.


  Model::DBIC:
schema_class: MyApp::Schema::DBIC
connect_info:
   - dbi:mysql:opendevil;__HERE__;
   - ~
   - ~

Thanks!

–Ashley
--


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


Re: [Catalyst] Templates in the database

2007-01-18 Thread apv

On Jan 18, 2007, at 3:22 PM, Bill Moseley wrote:

I do maintain a history of these pages, and I have a crude diff view
using Algorithm::Diff.  I have a table that holds the history of the
content and use triggers to write to it on update.

Is this how you are (or would) do this?


I am doing post history/revision with a similar, but crude, interface  
to what wikimedia uses.
Doing it with Algorithm::Diff and Algorithm::Diff::Apply (and YAML).  
I'm not confident my code is clean or something to emulate but I put  
part of it in the foot. Not including the TT stuff but I'll send it  
to you if you're curious.


The only thing I'd also suggest (which I'm not actually doing yet) is  
doing a compilation of the edited template before saving it. Only  
save it and catch the revision if it compiles (i.e. the editor  
working on it hasn't broken it). There would be no reason to allow  
broken templates into your history. It would just gum up the revision  
process.



-Ashley
--

# IN the table's schema
sub store_column {
my ( $self, $name, $value ) = @_;
$value =~ s/[^[:print:]\s]//g; # not sure this is a good idea  
321 222

if ( $name eq body
 and $self-in_storage
 and $self-body )
{
my @original = split /\n/, $self-body;
my @new = split /\n/, $value;
chomp( @original, @new );
my @diff = Algorithm::Diff::diff( [EMAIL PROTECTED], [EMAIL PROTECTED] 
);
$self-add_to_revisions({ diff = YAML::freeze([EMAIL PROTECTED]) })
if @diff;
}
$self-next::method($name, $value);
}


# IN the table's editor/admin
sub rev : Chained(/article/article) : Args(1) {
my ( $self, $c, $rev ) = @_;
my $article = $c-stash-{article};

my @revisions = $article-revisions;
@revisions = $rev ||
die RC_404: no such revision to article  . $article-id;

my ( @reverted, @tmp );
my @body = split /\n/, $article-body;
@tmp = @body;

for ( my $i = @revisions; $i = $rev; )
{
$i--;
my $diff = YAML::thaw($revisions[$i]-diff);
@tmp = @reverted if @reverted;
@reverted = Algorithm::Diff::Apply::apply_diff([EMAIL PROTECTED], 
$diff);
}
chomp(@reverted);
chomp(@body);
s/$CRLF|$LF|$CR// for @reverted, @body;
my @sdiff = Algorithm::Diff::sdiff( [EMAIL PROTECTED], [EMAIL PROTECTED] );

my %english = (
   '+' = 'added',
   '-' = 'removed', # removed-ish
   'u' = 'unmodified',
   'c' = 'changed',
   );

$_-[0] = $english{$_-[0]} for @sdiff;

$c-stash(
  template = 'admin/article/edit.tt',
  nosidebar = 1,
  revision = $rev,
  sdiff = [EMAIL PROTECTED],
  body = join(\n, @reverted)
  );
}




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


Re: [Catalyst] $c-email

2007-01-07 Thread apv
You might also look at the guts of Catalyst::Plugin::Email::Japanese  
to see if it's of any interest.


-Ashley


On Jan 6, 2007, at 8:52 PM, Octavian Rasnita wrote:

Ok, thank you. I had previously used MIME::Lite (not using UTF-8  
though) and I think I will follow this way.

I asked about $c-email because I thought it might be easier.

Octavian
- Original Message -
From: vb
To: The elegant MVC web framework
Sent: Sunday, January 07, 2007 12:41 AM
Subject: Re: [Catalyst] $c-email

I use MIME::Lite, don't know $c-email...
A concrete example, from a real salary application  
(salar.sitsco.com - in short time

I provide a new, many featured, version):

sub send_fisa : Local {
  my ( $self, $c, $ia ) = @_;
  my $st = salar::Model::State-retrieve($ia);
  my $emal = $st-id_angajat-email;
  my $from = $st-id_scoala-email;
  my $subj = 'fişă salariu';
  $st-subrute;
  $c-stash-{angaj} = $st;
  $c-stash-{sendto} = 1;
  my $out = $c-view('TT')-render($c, 'fisa_stang.html');
  my $msg = new MIME::Lite(
   From = $from,
   To = $emal,
   Subject = $subj,
   Type = 'TEXT',
   Data = $out
);
 $msg-attr(Content-type = text/html;charset=utf-8);
 $msg-send;
#   $c-res-redirect('/');
return $c-res-body(scripthideLev('hsind');/script);
}

--vb

On 1/6/07, Octavian Rasnita [EMAIL PROTECTED] wrote: Hi,

Does anyone have an example of sending a UTF-8 encoded email  
message using

$c-email?

Thank you.

Octavian


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

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

Dev site: http://dev.catalyst.perl.org/



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


[Catalyst] AJAX under application/xhtml+xml

2006-12-06 Thread apv
Does anyone have sample code of anything AJAXy (don't care about the  
library or if it's hand rolled) that runs under application/xhtml 
+xml? By default Prototype puts out incompatible script tags and I  
know in the past some of y'all said you like other libraries better  
anyway.



–Ashley
--




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


Re: [Catalyst] Last Chance / Last Day: Web development platform contestand Perl / Catalyst

2006-12-01 Thread apv

On Dec 1, 2006, at 8:45 AM, Jonathan Rockway wrote:

Perl.  Is.  Not.  Dead.

Is there anything more we need to add to this discussion?
The last two big companies I worked for were both moving away from  
Perl. One of them was Amazon.com (I known there are still a few  
boosters and projects for Perl there but as a whole the company has  
become quite anti-Perl and has been rewriting everything in Java it  
can get budget money for). It isn't because Perl isn't useful, Perl  
helped build both of the companies, but because it has an image of  
not being up to the task. Sure Perl's not dead but that's at least  
100 high paying, high profile Perl jobs in my town alone that are  
gone. Not because Perl sucks but because a lot of people think it does.


There is nothing wrong with trying to improve Perl's image.


...If you're not part of the solution, you're part of the problem.


Yep.

-Ashley


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


[Catalyst] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple

2006-11-26 Thread apv
I'm probably about to write a sub-class of  
Catalyst::Plugin::Static::Simple which writes the file to disk on the  
first request. The reason is I like to have all my extra static files  
(images, media, css, etc) in the same bundle as the application but I  
also want to let Apache serve them, obviously. So I can either try to  
keep a tree sync'd between my app path and my webserver path or do  
this so the authoritative versions in the app path are written to  
disk on first request. (Semi-)Permanent cache.


Do you think this is something useful enough to also put on the CPAN?  
Other feedback?


Name? Catalyst::Plugin::Static::DiskWrite? The idea is not to be able  
to check for freshness or other cache-like behavior but to write it  
if it's not there and leave it at that. Used with things like:


  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*) /index.fcgi/$1 [QSA,L]


Thanks!

–Ashley
--




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


Re: [Catalyst] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple

2006-11-26 Thread apv


On Nov 26, 2006, at 2:01 PM, Ash Berlin wrote:

apv wrote:
I'm probably about to write a sub-class of  
Catalyst::Plugin::Static::Simple which writes the file to disk on  
the first request. The reason is I like to have all my extra  
static files (images, media, css, etc) in the same bundle as the  
application but I also want to let Apache serve them, obviously.  
So I can either try to keep a tree sync'd between my app path and  
my webserver path or do this so the authoritative versions in the  
app path are written to disk on first request. (Semi-)Permanent  
cache.
Do you think this is something useful enough to also put on the  
CPAN? Other feedback?
Name? Catalyst::Plugin::Static::DiskWrite? The idea is not to be  
able to check for freshness or other cache-like behavior but to  
write it if it's not there and leave it at that. Used with things  
like:

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*) /index.fcgi/$1 [QSA,L]



Can you not just do:

Alias /static /path/to/my/app/static

In your Apache (or whatever) config?
Hm… I could but I'm not smart/awake enough to think to try it  
first. Sigh!


I realize now that when I was doing this idea previously (manually  
from and end) it was using templates so the content was dynamic but  
rarely changing. I'll rethink the whole thing.


Thanks, man.

-Ashley
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Epiphany Sunday: chained action vs namespaces

2006-11-26 Thread apv
I just thought I'd share an epiphany in case any other lunkheads were  
under the same misconception I was.


I had been avoiding chained actions for months b/c I was under the  
impression they were synonymous with code namespaces. Today, I  
realized they aren't.


So, I was doing things like:
 /post/[id]
 /admin/post/[id]

With plenty of duplicated code between them because I thought the  
admin paths had to be under Admin::auto to do blanket security stuff  
and I didn't want to seed security checks everywhere b/c I know I'd  
miss something.


I realize now I can do
 /post/[id]
 /post/[id]/edit
 /post/[id]/private_notes # whatever

And put the edit code into Admin::Post::edit and just chain it back  
to the public Post view.


Like built-in information architecture. Thanks again to all the Cat  
developers. SO NICE.



–Ashley
--



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


[Catalyst] write utf8 to STDOUT wide character in print

2006-11-18 Thread apv
I am getting wide character in print warnings to the terminal for  
tests and such still when all my utf8 is acting perfect in the  
browser (and even in MIME headers for email the app is sending, so  
I'm pretty sure I'm doing it all correctly).


I think it's happening here:

In Catalyst/Engine.pm
print STDOUT $buffer;

Putting
  binmode STDOUT, :utf8;
in the sub fixes it, but not elsewhere (like in MyApp.pm).

Since the engine is trying to be aware of the content (and the  
default headers are utf8), shouldn't it try to talk to the output the  
same way?


Thanks!
-Ashley 


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


Re: [Catalyst] uri_for (or lack thereof) in static pages

2006-11-16 Thread apv
Something I have done and will probably do again (but I'm not using 
right

now) is having static pages like that served by Catalyst the first time
they are requested and then writing them to disk (as part of the end
handler to let apache serve) them as static going forward. To update
files, erase them. Catalyst will rewrite them on the next request
and only the first one will have any kind of performance hit. A semi-
permanent disk cache, really.

You need apache to serve static files that alrady exist instead of
asking Catalyst for them. MST put up some htaccess instructions
for that in one of the fastcgi set up pages. Also, the webuser
needs to have file/dir write permissions which isn't always
possible (bride admin scenario again) or recommended.

-Ashley

On Thursday, Nov 16, 2006, at 13:47 US/Pacific, Cédric Bouvier wrote:

I have a ѕimple yet thorny problem, which I expect most of you also 
have
or had. It has several possible solutions, but I'm chiefly interested 
in

knowing how *you* would solve it and why.

We're developing a Catalyst application. It serves HTML, CSS,
JavaScript, and images. HTML is the output of TT2, but CSS, images and
JavaScript are static. We have them served by C::P::Static::Simple on
the built-in server, and we use a Location the have them directly
served by Apache/mod_perl, one the production server. Under mod_perl,
the application's root is not the server's root, i.e., it is
http://server/myapp, whereas it is http://localhost:3000 on the 
built-in

test server.

This would not be a problem if the CSS were not linking to images. And
because CSS pages are static, they cannot make use of uri_for(), and
therefore get the links to the pictures wrong.

Several solutions come to mind, and I cannot choose which one I like
best (or I dislike the least):
- have CSS served through TT2. I'm wondering about the extra load it
  would put on the Catalyst engine. Maybe it's completely negligeable,
  maybe not... Is it worth the effort to cache them? If so, what are 
the

  recommended best practices?
- make all links in CSS relative. This makes it harder to spread the
  stylesheets in a deep directory structure, unless one is willing to
  tediously count the ../../.. (or was it ../..?) and count them again
  when a stylesheet moves.
- insist that MyApp be installed at the server's root, bribing the
  sysadmin if need be (or threatening, or loudly shouting at, or 
blackmailing, or

  sacking, torturing...)
- use some black magic involving mod_rewrite or even HTTP::Proxy to
  modify the broken links on the fly... Hmmm, blackmailing the sysadmin
  should be easier than having him tweak mod_rewrite...
- Pre-process the CSS at install time, with some sort of ttree, and 
then

  serve them as static content.

Any war stories worth telling, Gentlemen, Ladies?

--
C é d r i c   B o u v i e r
signature.asc___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/




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


Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?

2006-11-01 Thread apv

I was getting the same thing in my apps. They display utf8 fine
as long as there is no utf8 in a form in the same page.

Catalyst::Plugin::Unicode combined with Catalyst::View::TT::ForceUTF8
fixes this for me. I don't speak Chinese but it is what I usually
use to test the unicode and it appears to work fine for both
FCGI and the test server. I am not doing any AJAX right now so
I'm not sure if there are any issues in that layer (JS-Perl).

-Ashley


On Tuesday, Oct 31, 2006, at 23:47 US/Pacific, Mao DengFeng-e13751 
wrote:



Hi, all

I am studying MiniMojo example in catalyst.
I try to use mysql as the database.
The sample can work well but  I got wild charater when I input chinese
charater.
Please review below steps
1. I use UTF8 charset both webpage and mysql database.
2. When I input chinese charaters and submit, The text area and mysql
database can display chinese charaters correctly. But I got wild
charaters in   div id=view/div
3. I have checked mysql database which is updated by the example. The
chinese characters can be displayed correctly.

Because the view area is updated by Catalyst-plugin-prototype
according the input of text area. I think the issue is caused by
Catalyst-plugin-prototype.

Please give me some advice to fix this issue

Thanks

Mao Deng feng

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/






-Ashley
--
http://sedition.com · http://sedition.com/ddx
http://querylog.com · http://ashleypond.com/v


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


Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?

2006-11-01 Thread apv

Yes, I do think this is the same problem I was having. The form
field is fine. The other utf-8 on the page which is displayed
correctly when there is not a form loaded with utf8 becomes mangled.

Try Catalyst::View::TT::ForceUTF8 if you are using TT2. It fixed
my problems completely (except that it doesn't acknowledge
non-standard tags have been defined, and I normally prefer
not to use [% %]). Still, small price to pay.

On Wednesday, Nov 1, 2006, at 00:38 US/Pacific, Mao DengFeng-e13751 
wrote:



Thanks for your quikly reply.
For the form in the page, The utf8 characters can be displayed 
correctly

.
For example, chinese characters can be displayed correctly in
textara/textarea

Mao DengFeng



-Original Message-
From: apv [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 01, 2006 4:29 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Catalyst-plugin-prototype supports UTF8?

I was getting the same thing in my apps. They display utf8 fine as long
as there is no utf8 in a form in the same page.

Catalyst::Plugin::Unicode combined with Catalyst::View::TT::ForceUTF8
fixes this for me. I don't speak Chinese but it is what I usually use 
to

test the unicode and it appears to work fine for both FCGI and the test
server. I am not doing any AJAX right now so I'm not sure if there are
any issues in that layer (JS-Perl).

-Ashley


On Tuesday, Oct 31, 2006, at 23:47 US/Pacific, Mao DengFeng-e13751
wrote:


Hi, all

I am studying MiniMojo example in catalyst.
I try to use mysql as the database.
The sample can work well but  I got wild charater when I input chinese



charater.
Please review below steps
1. I use UTF8 charset both webpage and mysql database.
2. When I input chinese charaters and submit, The text area and mysql
database can display chinese charaters correctly. But I got wild
charaters in   div id=view/div
3. I have checked mysql database which is updated by the example. The
chinese characters can be displayed correctly.

Because the view area is updated by Catalyst-plugin-prototype
according the input of text area. I think the issue is caused by
Catalyst-plugin-prototype.

Please give me some advice to fix this issue

Thanks

Mao Deng feng

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






-Ashley
--
http://sedition.com * http://sedition.com/ddx http://querylog.com *
http://ashleypond.com/v


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

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: 
http://www.mail-archive.com/catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/






-Ashley
--
http://sedition.com · http://sedition.com/ddx
http://querylog.com · http://ashleypond.com/v


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


[Catalyst] Sharing code / Feedback request: TT macro for uri_for([current uri]); same page links

2006-10-21 Thread apv
Something common that irritates me on sites is links on a page which  
point to the page they're on.

Say you're viewing / (home) and there are links which go to / --  
not sensible. The following macro, link, disables them with JS  
(makes more sense semantically than not using a tags) and adds a  
CSS class so they can be made to look different, or disappear  
altogether.

Does it look like a good way to do it? Improvements?

[% MACRO link(path,title) BLOCK %]
[% FILTER trim %]
[% IF Catalyst.uri_for(/, Catalyst.request.path) == Catalyst.uri_for 
(path)  %]
a title=The current page class=current href=javascript:void 
(0);[% title | html_entity %]/a
[% ELSE  %]
a title=[% title | truncate(50,hellip;) | html_entity %]  
href=[% Catalyst.uri_for(path) %][% title | html_entity %]/a
[% END %]
[% END %]
[% END %]


-Ashley

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


[Catalyst] Follow-up to new uri_for() bug

2006-09-11 Thread apv
http://lists.rawmode.org/pipermail/catalyst/2006-September/ 
009531.html (I did start a new message there, blame Mail.app, not me  
for the bad threading)

Okay, mean guys. Make me solve my own, er, Catalyst's own, bugs.

Line 118 (5.7001) of Catalyst::Engine::CGI looks like this:
 $base_path =~ s/$ENV{PATH_INFO}$//;

Unless I'm losing it, it should look like this:
 $base_path =~ s/\Q$ENV{PATH_INFO}\E$//;

Otherwise uri_for (well, request-base and anything that uses it)  
gets borked by any number of regex chars in the URI.



–Ashley
-- 




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


Re: [Catalyst] Follow-up to new uri_for() bug

2006-09-11 Thread apv
Yay. I'll take a look through the tests to see if I can figure out  
where to send you a new one (or the diff for a current one).

-Ashley

On Sep 11, 2006, at 6:22 PM, Matt S Trout wrote:
 That seems like a sane complaint.

 If you can add a failing test I can get it into 5.70002 ...


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


[Catalyst] utf-8 test server apache disagreement resolved with DBIC 7.001

2006-08-18 Thread apv
 From this thread: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/msg00778.html

I saw on the DBIC lists that the new release changed its utf8 handling.

  - UTF8Columns changed to use utf8 instead of Encode

I just grabbed it off the pause server and it does indeed fix the  
earlier problem which eluded a lot of confusing debugging on my part  
(just one example: utf8 worked on apache fine if the charset was  
Latin). (And I was not thinking right b/c the other app that wasn't  
having any disagreement between testing and live still uses CDBI  
underneath with a utf8 hack, so it was almost certainly related to  
the Model's handling of the data.)

Thanks to castaway and anyone else who is working on DBIC (and  
Catalyst for that matter). It's all really great.


–Ashley
-- 


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


Re: [Catalyst] Major (for me) problem fixed!

2006-07-28 Thread apv
I complained about this quite some time ago and was told to use the  
restartregex option to filter that out (and scratch_file~ of  
course). Instead of suggesting that, I'll join in in complaining  
again. :)


–Ashley
--


On Jul 28, 2006, at 1:05 AM, Jonathan Rockway wrote:
 After upgrading to 5.7, I occasionally got the following error when
 starting my server:

 $ CATALYST_DEBUG=1 perl script/blog_server.pl -r
 Warning: Use of require without parentheses is ambiguous at (eval  
 94)
 line 1.
 syntax error at (eval 94) line 2, at EOF
 Compilation failed in require at script/blog_server.pl line 52.

 This was very annoying, and since it would randomly come and go, I
 couldn't debug the cause.  I finally decided to run the program under
 the Perl debugger, and immediately the cause of the problem became  
 clear:

 Warning: Use of require without parentheses is ambiguous at (eval
 108)[/usr/local/share/perl/5.8.8/Catalyst/Utils.pm:252] line 1.
  at (eval 108)[/usr/local/share/perl/5.8.8/Catalyst/Utils.pm:252]  
 line 1
 eval 'require Blog::Controller::.#Feeds;' called at
 /usr/local/share/perl/5.8.8/Catalyst/Utils.pm line 252

 Catalyst::Utils::ensure_class_loaded('Blog::Controller::.#Feeds',
 'HASH(0x9f8d004)') called at /usr/local/share/perl/5.8.8/Catalyst.pm
 line 1798
 Catalyst::setup_components('Blog') called at
 /usr/local/share/perl/5.8.8/Catalyst.pm line 836
 -- 8 cut 8 --

 As you can see, Catalyst was trying (and failing) to load emacs'
 autosave files as a Controller!  I don't know if emacs is widespread
 enough to warrant ignoring all files that are like .#[^/]+, but if
 you're having this problem, there's the fix.  Delete all non- 
 Controller
 files in your Controller folder, and you'll be very happy :)

 Regards,
 Jonathan Rockway

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


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


Re: [Catalyst] Testing server hangs with Safari and some others

2006-07-26 Thread apv
Hmmm. I'm not using CGI (it hangs on the most minimal 
install/welcome-page) and I have the most recent regular TT2 release.

I'm glad you mention it though b/c I did have the problem you list with 
another TT2 form (not in Catalyst) and I found on antoher list that 
naming the CGI instance or calling it with a namespace fixed the 
hanging. [% USE CGI(foo) %] or [% USE mycgi = CGI(foo) %].

http://www.template-toolkit.org/pipermail/templates/2002-May/003242.html

I wrote a chat server about 4 years ago that had the same problem of 
hanging on Safari but not on the others. I can't remember how I solved 
it now but there was something different about the way Safari handled 
the socket blocking on reads between headers and body, I think. I'll 
try to dig up that code and compare it to the test server code.

-Ashley

On Wednesday, Jul 26, 2006, at 08:16 US/Pacific, Jonathan Rockway wrote:

 Doh, 5.7001


 I had this problem (on many platforms) with older versions of TT.  For 
 some reason, TT would time out if [% USE CGI %] appeared anywhere in 
 any templates.  Sometimes.  Other times it wouldn't.  It was really 
 weird, and I pulled out a lot of hair debugging it, but could never 
 get enough info to file a bug report.  For all I know, this is still a 
 problem; I stopped using CGI and just printed out my forms manually.  
 (I was also using cgi's escape function, to escape UTF-8 characters in 
 URIs [required by the W3C, apparently, although I don't know why], but 
 I eventually got TT's [% foo | uri | html %] to work -- if you set 
 TT's charset to UTF-8, it won't escape URIs.  Irritating.  I reported 
 this as a bug, and it was immediately marked resolved without being 
 resolved.  *sigh*)

 As for debugging this, use Carp and then confess in various places.  
 Eventually you'll put the confess somewhere after the timeout, and 
 then you can narrow down what exactly is causing the problem.  
 Although, sometimes catalyst eats dies for some reason, and you don't 
 get this (with the server).  In that case, try just running perl 
 -MMyApp -e 'MyApp-start'.

 Any advice from the developers on how to get die to be more fatal 
 would be greatly appreciated :)

 Regards,
 Jonathan Rockway


 signature.asc___
 List: Catalyst@lists.rawmode.org
 Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
 Searchable archive: 
 http://www.mail-archive.com/catalyst@lists.rawmode.org/
 Dev site: http://dev.catalyst.perl.org/


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


[Catalyst] Weird variable chop out of manually set response body

2006-07-19 Thread apv
I ran into a weird thing today (coming back to Catalyst after a long  
hiatus so I hope I'm not just being obtuse; I love all the changes  
I've found so far). Catalyst 5.7000, perl 5.8.6. Using test server.

This in MyApp::Controller::Word:

sub single : Path : Args(1) {
 my ( $self, $c, $word ) = @_;
 $c-response-body(Word: $word);
}

Called with http://host.local:3000/word/asdf

Gives: Word:

But modifying this line with a newline:
$c-response-body(Word: $word\n);

Gives the correct response: Word: asdf

So what gives? Expected behavior? If so, why? It didn't matter what  
the variable was either. Things like $c-response-body(Word:  .  
$c) would not make it to output either.


-Ashley


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