Re: [Catalyst] recommendation

2008-11-10 Thread Martin Ellison
Recommend using version control. Then you know what you have changed.

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Hello, Deployment of Catalyst apps in a shared web hosting account without shell

2008-10-03 Thread Martin Ellison
It may be theoretically possible, but probably would prove impossibly
frustrating. You can be reasonably certain that your host will not have all
the Perl modules that you need and you will need to do a local install.

2008/10/3 Lee Aylward [EMAIL PROTECTED]

 On Thu, Oct 02, 2008 at 06:10:01PM +0100, Ari Constancio wrote:
  Hello,
 
  I'm new to Catalyst, and would like to know if it is possible to
  deploy Catalyst apps in a shared web hosting account without shell?
  For what I've read, it seems not possible but I need to be sure.
 
  Thank you,
  Ari Constancio
 

 Assuming that your shared host has all of the required modules installed
 you can use the .cgi script found in the /scripts directory of your
 catalyst application.

 --
 Lee Aylward

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)

 iEYEARECAAYFAkjlS84ACgkQornF2yojAAcTNACaApYHRpBX22ps6ghzaZ+FQrCe
 NFEAoI7Qw8dBl1EmRG9Fmk7kzN8XfIgK
 =CytI
 -END PGP 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/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Trouble with loading catalyst app onto different machine

2008-09-01 Thread Martin Ellison
Version mismatch in your libraries?

2008/9/1 Conrad Canterford [EMAIL PROTECTED]

 Hi list,
 My app works just fine on my development machine, but when I copy it
 onto my live server (on a different machine), it fails with the
 following whenever I try to access anything past the first page (in this
 example, accessing something in the users controller):

 Couldn't forward to Catalyst::Action. Does not implement process
 Couldn't forward to command users/access_denied: Invalid action or
 component.

 This is the first time I've tried to copy it into the live server, so
 the cause is almost certainly something I don't have installed, or have
 installed differently, on that machine. My problem is that I cannot
 figure out what that is.

 I think its obvious that its attempting to do a forward(), and if I'm
 reading the messages correctly, its trying to forward to
 access_denied(), which is presumably called because the user doesn't
 have permission (using Catalyst::Plugin::Authorization::ACL).

 I have checked that I have the most recent versions (off CPAN) for
 Catalyst::Runtime, Catalyst::Devel, and the Authorization and
 Authentication plugins (on both the development and live machine).

 I have also checked that it is not caused by running under mod_perl in
 Apache2 (which it isn't - the same error occurs running the Catalyst
 server on that machine).

 I have googled for those error messages (and found the source code for
 Catalyst::Dispatcher where they reside), but nothing to point me to
 where to look next.

 In desperation, I copied the access_denied() code into my base
 controller class - it formerly lived in Root.pm - on the theory that
 maybe something was different about the path it was searching to find
 the code, but to no avail.

 So, I'm at a loss as to what to look at next. I'm certainly not an
 experienced Catalyst user (or even a particularly experienced perl
 user). Any pointers would be appreciated.

 Thanks,
 Conrad.




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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] [PATCH] PageCache and white labelling

2008-08-21 Thread Martin Ellison
Will do, slight circular tuit shortage. Also tropical cyclone.

2008/8/22 Matt S Trout [EMAIL PROTECTED]

 On Sat, Aug 16, 2008 at 09:28:57PM +0800, Martin Ellison wrote:
  I am resubmitting this patch *again*, could someone please look at it.

 If you can please send the patch -with- the config key fix, as requested,
 the PageCache maintainer is waiting to look at that version for you.

 --
  Matt S Trout   Need help with your Catalyst or DBIx::Class
 project?
   Technical Director
 http://www.shadowcat.co.uk/catalyst/
  Shadowcat Systems Ltd.  Want a managed development or deployment platform?
 http://chainsawblues.vox.com/
 http://www.shadowcat.co.uk/servers/

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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] PageCache and white labelling?

2008-08-17 Thread Martin Ellison
2008/8/18 Matt S Trout [EMAIL PROTECTED]

 ...config should be under 'Plugin::PageCache' as I said - that's the
 standard for plugin config info.

 If PageCache is still using old style it'd be nice if you could do a first
 patch switching it across.


I'm concerned about doing two things in the one patch; can we do my patch
first?

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] [PATCH] PageCache and white labelling

2008-08-16 Thread Martin Ellison
I am resubmitting this patch *again*, could someone please look at it.
-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.org


14keymaker.t
Description: Troff document
Index: PageCache.pm
===
@@ -311,13 +313,15 @@
 
 sub _get_page_cache_key {
 my $c = shift;
-
+
 # We can't rely on the params after the user's code has run, so
 # use the key created during the initial dispatch phase
 return $c-_page_cache_key if ( $c-_page_cache_key );
 
-my $key = / . $c-req-path;
-
+# override key if required
+my $keymaker = $c-config-{page_cache}-{key_maker};
+my $key = $keymaker ? $keymaker-($c) : / . $c-req-path;
+
 # prepend language if I18N present.
 if ( $c-can('language') ) {
 $key = ':' . $c-language . ':' . $key;
@@ -479,6 +483,17 @@
 Note that this is called BEFORE auto_check_user, so you have more flexibility
 to determine what to do for not logged in users.
 
+To override the generation of page keys:
+
+__PACKAGE__-config(
+page_cache = {
+key_maker = sub {
+my ($c) = @_;
+return $c-req-base . '/' . $c-req-path;
+  }
+}
+);
+
 =head1 METHODS
 
 =head2 cache_page
___
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] [PATCH] PageCache and white labelling

2008-08-16 Thread Martin Ellison
ok, have done, is http://rt.cpan.org/Public/Bug/Display.html?id=38524

2008/8/16 J. Shirley [EMAIL PROTECTED]

 On Sat, Aug 16, 2008 at 6:28 AM, Martin Ellison [EMAIL PROTECTED] wrote:
  I am resubmitting this patch again, could someone please look at it.


 You may have better results filing it as an RT ticket, since the dist
 isn't managed directly by the Catalyst core team.

 http://rt.cpan.org/Public/Bug/Report.html?Queue=Catalyst-Plugin-PageCache


-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] PageCache and white labelling?

2008-08-13 Thread Martin Ellison
I put up the patch several days ago; has anyone looked at it?

2008/8/9 Martin Ellison [EMAIL PROTECTED]

 OK, here is some corrected code with some POD:

 Index: PageCache.pm
 ===
 --- PageCache.pm(revision 756)
 +++ PageCache.pm(working copy)
 @@ -316,7 +316,9 @@
  # use the key created during the initial dispatch phase
  return $c-_page_cache_key if ( $c-_page_cache_key );

 -my $key = / . $c-req-path;
 +# override key if required
 +my $keymaker = $c-config-{page_cache}-{key_maker};
 +my $key = $keymaker ? $keymaker-($c) : / . $c-req-path;

  # prepend language if I18N present.
  if ( $c-can('language') ) {
 @@ -479,6 +481,17 @@
  Note that this is called BEFORE auto_check_user, so you have more
 flexibility
  to determine what to do for not logged in users.

 +To override the generation of page keys:
 +
 +__PACKAGE__-config(
 +page_cache = {
 +key_maker = sub {
 +my ($c) = @_;
 +return $c-req-base . '/' . $c-req-path;
 +  }
 +}
 +);
 +
  =head1 METHODS

  =head2 cache_page


 and here is a test:

 #!perl

 use strict;
 use warnings;
 no warnings 'redefine';

 use FindBin;
 use lib $FindBin::Bin/lib;
 use Test::More;
 use File::Path;

 BEGIN {
 eval use Catalyst::Plugin::Cache::FileCache;
 plan $@
   ? ( skip_all = 'needs Catalyst::Plugin::Cache::FileCache for
 testing' )
   : ( tests = 8 );
 }

 # This test that options can be passed to cache.

 # remove previous cache
 rmtree 't/var' if -d 't/var';

 use Catalyst::Test 'TestApp';

 # add config option
 TestApp-config-{page_cache}-{key_maker} = sub {
 my ($c) = @_;
 return $c-req-base . q{/} . $c-req-path;
 };

 # cache a page
 ok( my $res = 
 request('http://host1/cache/count'http://host1/cache/count%27),
 'request ok' );
 is( $res-content, 1, 'count is 1' );

 # page will be served from cache
 ok( $res = request('http://host1/cache/count'http://host1/cache/count%27),
 'request ok' );
 is( $res-content, 1, 'count is still 1 from cache' );

 # page will not be served from cache
 ok( $res = request('http://host2/cache/count'http://host2/cache/count%27),
 'request ok' );
 is( $res-content, 2, 'count is 2 from cache' );

 # page will be served from cache
 ok( $res = request('http://host2/cache/count'http://host2/cache/count%27),
 'request ok' );
 is( $res-content, 2, 'count is still 2 from cache' );

 2008/8/9 Martin Ellison [EMAIL PROTECTED]

 What about:... [bad code]...

 What else do you need? POD? Tests?

 2008/8/9 Martin Ellison [EMAIL PROTECTED]

 I'm concerned about impacting the performance; this must be high-traffic
 code. But I'll look into it.

 2008/8/8 Matt S Trout [EMAIL PROTECTED]

 On Fri, Aug 08, 2008 at 05:08:02PM +0800, Martin Ellison wrote:
  But PageCache only works off $c-request-path() ie not the hostname.
 This
  behaviour is coded in the _get_page_cache_key() subroutine. This means
 that
  the PageCache serves up the same page content for all websites,
 irrespective
  of URL, which is not what I want.
 
  It would be nice if there were some way to fix this and keep using
  PageCache, such as overriding _get_page_cache_key(). Does that make
 sense?
  eg writing a derived class from PageCache?

 How about

 __PACKAGE__-config(
  'Plugin::PageCache' = {
key_maker = sub {
  my $c = shift;
  handwave($c);
}
  }
 );

 and making the current implementation the default in the absence
 thereof?

 Fancy having a play with doing a patch?



 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] PageCache and white labelling?

2008-08-09 Thread Martin Ellison
What about:

@@ -316,7 +317,9 @@
 # use the key created during the initial dispatch phase
 return $c-_page_cache_key if ( $c-_page_cache_key );

-my $key = / . $c-req-path;
+# override key if required
+my $keymaker = $c-config-{page_cache}-{key_maker};
+my $key = $keymaker ? $keymaker($c) : / . $c-req-path;

What else do you need? POD? Tests?

2008/8/9 Martin Ellison [EMAIL PROTECTED]

 I'm concerned about impacting the performance; this must be high-traffic
 code. But I'll look into it.

 2008/8/8 Matt S Trout [EMAIL PROTECTED]

 On Fri, Aug 08, 2008 at 05:08:02PM +0800, Martin Ellison wrote:
  But PageCache only works off $c-request-path() ie not the hostname.
 This
  behaviour is coded in the _get_page_cache_key() subroutine. This means
 that
  the PageCache serves up the same page content for all websites,
 irrespective
  of URL, which is not what I want.
 
  It would be nice if there were some way to fix this and keep using
  PageCache, such as overriding _get_page_cache_key(). Does that make
 sense?
  eg writing a derived class from PageCache?

 How about

 __PACKAGE__-config(
  'Plugin::PageCache' = {
key_maker = sub {
  my $c = shift;
  handwave($c);
}
  }
 );

 and making the current implementation the default in the absence thereof?

 Fancy having a play with doing a patch?

 --
  Matt S Trout   Need help with your Catalyst or DBIx::Class
 project?
   Technical Director
 http://www.shadowcat.co.uk/catalyst/
  Shadowcat Systems Ltd.  Want a managed development or deployment
 platform?
 http://chainsawblues.vox.com/
 http://www.shadowcat.co.uk/servers/

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




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] PageCache and white labelling?

2008-08-09 Thread Martin Ellison
OK, here is some corrected code with some POD:

Index: PageCache.pm
===
--- PageCache.pm(revision 756)
+++ PageCache.pm(working copy)
@@ -316,7 +316,9 @@
 # use the key created during the initial dispatch phase
 return $c-_page_cache_key if ( $c-_page_cache_key );

-my $key = / . $c-req-path;
+# override key if required
+my $keymaker = $c-config-{page_cache}-{key_maker};
+my $key = $keymaker ? $keymaker-($c) : / . $c-req-path;

 # prepend language if I18N present.
 if ( $c-can('language') ) {
@@ -479,6 +481,17 @@
 Note that this is called BEFORE auto_check_user, so you have more
flexibility
 to determine what to do for not logged in users.

+To override the generation of page keys:
+
+__PACKAGE__-config(
+page_cache = {
+key_maker = sub {
+my ($c) = @_;
+return $c-req-base . '/' . $c-req-path;
+  }
+}
+);
+
 =head1 METHODS

 =head2 cache_page


and here is a test:

#!perl

use strict;
use warnings;
no warnings 'redefine';

use FindBin;
use lib $FindBin::Bin/lib;
use Test::More;
use File::Path;

BEGIN {
eval use Catalyst::Plugin::Cache::FileCache;
plan $@
  ? ( skip_all = 'needs Catalyst::Plugin::Cache::FileCache for testing'
)
  : ( tests = 8 );
}

# This test that options can be passed to cache.

# remove previous cache
rmtree 't/var' if -d 't/var';

use Catalyst::Test 'TestApp';

# add config option
TestApp-config-{page_cache}-{key_maker} = sub {
my ($c) = @_;
return $c-req-base . q{/} . $c-req-path;
};

# cache a page
ok( my $res = request('http://host1/cache/count'), 'request ok' );
is( $res-content, 1, 'count is 1' );

# page will be served from cache
ok( $res = request('http://host1/cache/count'), 'request ok' );
is( $res-content, 1, 'count is still 1 from cache' );

# page will not be served from cache
ok( $res = request('http://host2/cache/count'), 'request ok' );
is( $res-content, 2, 'count is 2 from cache' );

# page will be served from cache
ok( $res = request('http://host2/cache/count'), 'request ok' );
is( $res-content, 2, 'count is still 2 from cache' );

2008/8/9 Martin Ellison [EMAIL PROTECTED]

 What about:... [bad code]...

 What else do you need? POD? Tests?

 2008/8/9 Martin Ellison [EMAIL PROTECTED]

 I'm concerned about impacting the performance; this must be high-traffic
 code. But I'll look into it.

 2008/8/8 Matt S Trout [EMAIL PROTECTED]

 On Fri, Aug 08, 2008 at 05:08:02PM +0800, Martin Ellison wrote:
  But PageCache only works off $c-request-path() ie not the hostname.
 This
  behaviour is coded in the _get_page_cache_key() subroutine. This means
 that
  the PageCache serves up the same page content for all websites,
 irrespective
  of URL, which is not what I want.
 
  It would be nice if there were some way to fix this and keep using
  PageCache, such as overriding _get_page_cache_key(). Does that make
 sense?
  eg writing a derived class from PageCache?

 How about

 __PACKAGE__-config(
  'Plugin::PageCache' = {
key_maker = sub {
  my $c = shift;
  handwave($c);
}
  }
 );

 and making the current implementation the default in the absence thereof?

 Fancy having a play with doing a patch?



-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] PageCache and white labelling?

2008-08-08 Thread Martin Ellison
I get the impression that PageCache cannot discriminate on URL; is that
correct?

I am trying to 'whitelabel' a site, that is to run several hostnames into
the one Catalyst site and then serve somewhat different content based on the
URL, giving the appearance of multiple websites. However, it seems that the
PageCache plugin does not allow this.

For example, I might have two hostnames:

   - http://www.example1.com   and
   - http://www.example2.net

that both point to the same Catalyst server. I can find out the URL using
$c-request-base() and use that to, say, select the appropriate CSS file
and heading template for that site.

But PageCache only works off $c-request-path() ie not the hostname. This
behaviour is coded in the _get_page_cache_key() subroutine. This means that
the PageCache serves up the same page content for all websites, irrespective
of URL, which is not what I want.

It would be nice if there were some way to fix this and keep using
PageCache, such as overriding _get_page_cache_key(). Does that make sense?
eg writing a derived class from PageCache?

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Re: PageCache and white labelling?

2008-08-08 Thread Martin Ellison
I have tried subclassing PageCache, but it is not doing Catalyst magic: when
asked to do

*   $c-cache_page( ..)

it says *

Can't locate object method cache_page via package



2008/8/8 Martin Ellison [EMAIL PROTECTED]

 I get the impression that PageCache cannot discriminate on URL; is that
 correct?

 I am trying to 'whitelabel' a site, that is to run several hostnames into
 the one Catalyst site and then serve somewhat different content based on the
 URL, giving the appearance of multiple websites. However, it seems that the
 PageCache plugin does not allow this.

 For example, I might have two hostnames:

- http://www.example1.com   and
- http://www.example2.net

 that both point to the same Catalyst server. I can find out the URL using
 $c-request-base() and use that to, say, select the appropriate CSS file
 and heading template for that site.

 But PageCache only works off $c-request-path() ie not the hostname. This
 behaviour is coded in the _get_page_cache_key() subroutine. This means
 that the PageCache serves up the same page content for all websites,
 irrespective of URL, which is not what I want.

 It would be nice if there were some way to fix this and keep using
 PageCache, such as overriding _get_page_cache_key(). Does that make sense?
 eg writing a derived class from PageCache?

 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] PageCache and white labelling?

2008-08-08 Thread Martin Ellison
I'm concerned about impacting the performance; this must be high-traffic
code. But I'll look into it.

2008/8/8 Matt S Trout [EMAIL PROTECTED]

 On Fri, Aug 08, 2008 at 05:08:02PM +0800, Martin Ellison wrote:
  But PageCache only works off $c-request-path() ie not the hostname.
 This
  behaviour is coded in the _get_page_cache_key() subroutine. This means
 that
  the PageCache serves up the same page content for all websites,
 irrespective
  of URL, which is not what I want.
 
  It would be nice if there were some way to fix this and keep using
  PageCache, such as overriding _get_page_cache_key(). Does that make
 sense?
  eg writing a derived class from PageCache?

 How about

 __PACKAGE__-config(
  'Plugin::PageCache' = {
key_maker = sub {
  my $c = shift;
  handwave($c);
}
  }
 );

 and making the current implementation the default in the absence thereof?

 Fancy having a play with doing a patch?

 --
  Matt S Trout   Need help with your Catalyst or DBIx::Class
 project?
   Technical Director
 http://www.shadowcat.co.uk/catalyst/
  Shadowcat Systems Ltd.  Want a managed development or deployment platform?
 http://chainsawblues.vox.com/
 http://www.shadowcat.co.uk/servers/

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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] UTF-16 surrogate warning under FastCGI

2008-07-22 Thread Martin Ellison
Jim, thanks for that. I have the same problem but have not had the time to
create a test case.

2008/7/23 Jim Spath [EMAIL PROTECTED]

 Jim Spath wrote:

 So I know the whole UTF-16 surrogate warning issue has been brought up a
 few times on this list, but I don't think anyone has posted a reliable test
 case, so I thought I would take a stab at it.  We have over 2700 of these
 warnings in todays error logs, so it'd be nice to get rid of them.

 All that's really necessary is to reproduce the problem is to output a
 body of the necessary length:

  # 56338 = 0xdc12
  $c-response-body(1 x 56338);

 And to run your application under FastCGI.  It will produce the following
 warning every time:

 UTF-16 surrogate 0xdc12 at /usr/lib/perl/5.8/IO/Handle.pm line 199.

 I've created a minimal Catalyst application to demonstrate the problem
 which can be downloaded here:

 http://www.filedropper.com/utf16tar

 No plugins are used and binmode is not set.

 Anyways, hopefully this makes it easier for people to figure out what is
 going on.

 - Jim


 The tar.gz file for my demonstration application appears to be messed up,
 sorry about that.  Here's a zip file that is valid:

 http://www.filedropper.com/utf16


 - Jim

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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Capture page on server?

2008-06-23 Thread Martin Ellison
Sorry, bit of a newbie question: is there any way that I can run an action
but capture the results (server-side) to a file? Doing so client side is
easy (eg wget) but I want to keep the page text on the server and to
automate the page generation/save.

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Capture page on server?

2008-06-23 Thread Martin Ellison
I actually want to save a static copy of the front page to improve load
times. My fastcgi process sometimes disappears (I'm on shared hosting and I
think they auto-cancel stale processes), and it takes a while for the
process to be restarted, which impacts the first page load. Subsequent pages
are faster but it's the first page that makes the impression on the user.
The static plugin does not work, because that requires fastcgi to be
running, and my app is too small for me to set up squid.

So I want to redirect the front page to a static page, but regenerate the
static page, and also force the app to do something (so the server can
restart the fastcgi process before the user requests any other page).

2008/6/23 Jonathan Rockway [EMAIL PROTECTED]:

 * On Mon, Jun 23 2008, Martin Ellison wrote:
  Sorry, bit of a newbie question: is there any way that I can run an
 action but
  capture the results (server-side) to a file? Doing so client side is easy
 (eg
  wget) but I want to keep the page text on the server and to automate the
 page
  generation/save.

 If you want to log the output of every request, you probably want to
 wrap finalize and save the file after it runs.

 If you want to run an arbitrary request against your application and see
 the result, you want the Subrequest plugin.  It would be better for your
 app to not depend upon your app, though.  Calling a method is simpler,
 faster, and cleaner than running an entire request and capturing the
 result, so try to structure your app in such a way as to allow that.

 Regards,
 Jonathan Rockway

 --
 print just = another = perl = hacker = if $,=$

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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Capture page on server?

2008-06-23 Thread Martin Ellison
ok, that works thanks (as does the server side wget).

2008/6/23 Kieren Diment [EMAIL PROTECTED]:

 On 23 Jun 2008, at 21:45, Martin Ellison wrote:

  Sorry, bit of a newbie question: is there any way that I can run an action
 but capture the results (server-side) to a file? Doing so client side is
 easy (eg wget) but I want to keep the page text on the server and to
 automate the page generation/save.


 From Catalyst::View::TT:

 render($c, $template, \%args)

 Renders the given template and returns output, or a Template::Exception
   object upon error. ...

 so:

 my $var = $c-render($template, \%args);
 my $file = '/what/ever.html';
 print $FH, , $file;


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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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 site design drafts feedback thread

2008-06-17 Thread Martin Ellison
On my browser (FF3, screen resolution 1440x900):


  (1) http://www.browsing.co.uk/cat


The YouTube box overlaps part of the second column.


  (2) 
  http://agaton.scsys.co.uk/~matthewt/catsite/cat_mock_web_001.pnghttp://agaton.scsys.co.uk/%7Ematthewt/catsite/cat_mock_web_001.png

 Takes a long time to download the graphic.


  (3) http://ion0.com/hx/cat/new-version-2-26.jpg


There is a very dark logo at the top and then the rest of the page is blank
white.


  (4) http://ion0.com/hx/cat/catalystSiteDesign3.jpg




 Most of the page is a blue-grey blank.


  (5) 
  http://agaton.scsys.co.uk/~matthewt/catsite/catsite-Penfold.pdfhttp://agaton.scsys.co.uk/%7Ematthewt/catsite/catsite-Penfold.pdf

 Don't like this one.



-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] UTF-16 surrogate message when writing binary data(image)

2008-05-24 Thread Martin Ellison
Ash,

my $pic_image = $p-ImageToBlob();
$c-res-content_type(q{image/jpeg});
$c-res-header( 'Content-Disposition', q{inline} );
$c-res-body($pic_image);

$p is an ImageMagick picture object which is creating a byte sequence
representing a JPEG image ($pic_image).  I have set the output to Unicode
using the Unicode plugin. This is going into an img tag.

2008/5/23 Ash Berlin [EMAIL PROTECTED]:

 You're going to have to paste some code I've been happily serving up PDFs
 (which has all sorts of binary data in it) fine.
 1) How are you serving the file up?
 2) What headers are you setting?

 -ash

 On 23 May 2008, at 16:00, Martin Ellison wrote:

 Another case... the surrogate is d862 = 55394 but the image size is 45296,
 so it is not looking consistent. So perhaps the 'surrogate' data is just
 random bytes from the JPEG.

 2008/5/23 Martin Ellison [EMAIL PROTECTED]:

 I've found a case
 ...stderr: UTF-16 surrogate 0xdb71 at /usr/lib/perl/5.8/IO/Handle.pm line
 199...
 FastCGI: ... [info] picture size is 55966

 55966 = da9e
 56177 = db71

 So almost the same. Perhaps I have 100 bytes of headers.


 2008/5/20 Martin Ellison [EMAIL PROTECTED]:

 The Content-Type is set to 'UTF-8' for most of my pages, but, in this
 case, it is image/jpeg and the content disposition is set to inline.

 2008/5/19 Ash Berlin [EMAIL PROTECTED]:

 On 19 May 2008, at 12:34, Martin Ellison wrote:

  I've finally had the opportunity to test my code a bit more. The
 $pic_image is a string of some kind and not a file handle.

 Also I tried doing binmode STDOUT but this fails --  the binmode call
 returns false.

 There could be any binary data in my string, so any UTF-8-bad byte
 pairs are definitely possible. I would think the solution is to inform
 Catalyst that the data is not UTF-8 but binary. In the normal case of
 writing to a file, one can use binmode to tell perl that the data is 
 binary
 but that does not work here.

 Is this a gap in the Catalyst API?


 Are you by any chance setting a header to something with UTF8 content?

 I had a problem similar to this that was caused by me setting a
 Content-Disposition header to something including unicode.

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




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: 
 http://thereisnoend.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/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] UTF-16 surrogate message when writing binary data(image)

2008-05-23 Thread Martin Ellison
I've found a case
...stderr: UTF-16 surrogate 0xdb71 at /usr/lib/perl/5.8/IO/Handle.pm line
199...
FastCGI: ... [info] picture size is 55966

55966 = da9e
56177 = db71

So almost the same. Perhaps I have 100 bytes of headers.


2008/5/20 Martin Ellison [EMAIL PROTECTED]:

 The Content-Type is set to 'UTF-8' for most of my pages, but, in this case,
 it is image/jpeg and the content disposition is set to inline.

 2008/5/19 Ash Berlin [EMAIL PROTECTED]:

 On 19 May 2008, at 12:34, Martin Ellison wrote:

  I've finally had the opportunity to test my code a bit more. The
 $pic_image is a string of some kind and not a file handle.

 Also I tried doing binmode STDOUT but this fails --  the binmode call
 returns false.

 There could be any binary data in my string, so any UTF-8-bad byte pairs
 are definitely possible. I would think the solution is to inform Catalyst
 that the data is not UTF-8 but binary. In the normal case of writing to a
 file, one can use binmode to tell perl that the data is binary but that does
 not work here.

 Is this a gap in the Catalyst API?


 Are you by any chance setting a header to something with UTF8 content?

 I had a problem similar to this that was caused by me setting a
 Content-Disposition header to something including unicode.

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




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] UTF-16 surrogate message when writing binary data(image)

2008-05-23 Thread Martin Ellison
Another case... the surrogate is d862 = 55394 but the image size is 45296,
so it is not looking consistent. So perhaps the 'surrogate' data is just
random bytes from the JPEG.

2008/5/23 Martin Ellison [EMAIL PROTECTED]:

 I've found a case
 ...stderr: UTF-16 surrogate 0xdb71 at /usr/lib/perl/5.8/IO/Handle.pm line
 199...
 FastCGI: ... [info] picture size is 55966

 55966 = da9e
 56177 = db71

 So almost the same. Perhaps I have 100 bytes of headers.


 2008/5/20 Martin Ellison [EMAIL PROTECTED]:

 The Content-Type is set to 'UTF-8' for most of my pages, but, in this case,
 it is image/jpeg and the content disposition is set to inline.

 2008/5/19 Ash Berlin [EMAIL PROTECTED]:

 On 19 May 2008, at 12:34, Martin Ellison wrote:

  I've finally had the opportunity to test my code a bit more. The
 $pic_image is a string of some kind and not a file handle.

 Also I tried doing binmode STDOUT but this fails --  the binmode call
 returns false.

 There could be any binary data in my string, so any UTF-8-bad byte pairs
 are definitely possible. I would think the solution is to inform Catalyst
 that the data is not UTF-8 but binary. In the normal case of writing to a
 file, one can use binmode to tell perl that the data is binary but that 
 does
 not work here.

 Is this a gap in the Catalyst API?


 Are you by any chance setting a header to something with UTF8 content?

 I had a problem similar to this that was caused by me setting a
 Content-Disposition header to something including unicode.

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




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] UTF-16 surrogate message when writing binary data(image)

2008-05-19 Thread Martin Ellison
I've finally had the opportunity to test my code a bit more. The $pic_image
is a string of some kind and not a file handle.

Also I tried doing binmode STDOUT but this fails --  the binmode call
returns false.

There could be any binary data in my string, so any UTF-8-bad byte pairs are
definitely possible. I would think the solution is to inform Catalyst that
the data is not UTF-8 but binary. In the normal case of writing to a file,
one can use binmode to tell perl that the data is binary but that does not
work here.

Is this a gap in the Catalyst API?

2008/5/12 Merlyn Kline [EMAIL PROTECTED]:

  I've just been looking at this same problem as I see it occasionally in
 my logs. In my test case the warning occurs when writing plain HTML which
 I'm certain doesn't contain any UTF-16 surrogates. After some (too much!)
 poking around, I eventually realised that the reported surrogate is actually
 the size of the output (so in your example case, I'm guessing your output
 was DF98 == 57240 bytes). So that suggests to me that it's something to do
 with the FastCGI protocol header. However a cursory examination of the
 contents of the buffer passed to syswrite doesn't reveal this header to be
 present, and a quick look through the calling stack doesn't reveal any
 routine which might add it. The length of the buffer is, however, always the
 number which is later reported as a UTF-16 surrogate. So I conclude that the
 FastCGI protocol header is being put in place on a lower layer, out of my
 reach.

 All this neatly explains the previously opaque distribution of the warning
 in my logs (output size isn't often in the UTF-16 reserved range), and why
 it was so difficult for me to find a reliable, simple test case (every time
 I tried to simplify the test case to isolate the cause, the warning went
 away because the simplified case wasn't in the right size range).
 Unfortunately, it also tells me that I'm not going to be able to fix it on
 this particular attack - I've run out of time so I'm going to have to put it
 aside (again) until I can make another chance to investigate further.

 Hope all this helps - I look forward to someone else solving it for me ;)

 Merlyn Kline


 -Original Message-
 *From:* Martin Ellison [mailto:]
 *Sent:* 12 May 2008 10:05
 *To:* The elegant MVC web framework
 *Subject:* Re: [Catalyst] UTF-16 surrogate message when writing binary
 data(image)

 The error is specifically at /usr/lib/perl/5.8/IO/Handle.pm line 199, which
 is the second syswrite call in

 sub syswrite {
 @_ = 2  @_ = 4 or croak 'usage: $io-syswrite(BUF [, LEN [,
 OFFSET]])';
 if (defined($_[2])) {
 syswrite($_[0], $_[1], $_[2], $_[3] || 0);
 } else {
 syswrite($_[0], $_[1]);
 }
 }

 The error is in production, so I am adding some trace code to investigate
 further, but results will need to wait until I have pushed the code.

 2008/5/10 Matt S Trout [EMAIL PROTECTED]:

 On Fri, May 09, 2008 at 02:58:41PM +0800, Martin Ellison wrote:
  If I write binary data (a JPEG) using $c-res-body then I get all these
  errors
 
   stderr: UTF-16 surrogate 0xdf98 at /usr/lib/perl/5.8/IO/Handle.pm line
 199.
 
  My code looks like
 
$c-res-content_type(q{image/jpeg});
  $c-res-header( 'Content-Disposition', q{inline} );
  $c-res-body($pic_image);
 
  Presumably, something is assuming that the output is Unicode text and
 trying
  to interpret it accordingly. These error messages are all over the log,
  making it difficult to read, besides any impact the situation may be
 having
  on the output.
 
  Is there any way to fix this issue (eg something like binmode)?

 My best guess here is that $pic_image is, or looks like, a file handle,
 and so when Catalyst is sending the response it's doing so by reading
 from the filehandle and the error's turning up during $fh-read.

 It'd of course be easier for you to confirm this, since you have the
 copy of IO/Handle.pm and the line number - maybe you could look?

 A good way to check would be to loop reading $pic_image yourself and
 see if you get the same warning ...

 --
  Matt S Trout   Need help with your Catalyst or DBIx::Class
 project?
   Technical Director
 http://www.shadowcat.co.uk/catalyst/
  Shadowcat Systems Ltd.  Want a managed development or deployment
 platform?
 http://chainsawblues.vox.com/
 http://www.shadowcat.co.uk/servers/

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




 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.org
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http

Re: [Catalyst] UTF-16 surrogate message when writing binary data(image)

2008-05-19 Thread Martin Ellison
The Content-Type is set to 'UTF-8' for most of my pages, but, in this case,
it is image/jpeg and the content disposition is set to inline.

2008/5/19 Ash Berlin [EMAIL PROTECTED]:

 On 19 May 2008, at 12:34, Martin Ellison wrote:

  I've finally had the opportunity to test my code a bit more. The
 $pic_image is a string of some kind and not a file handle.

 Also I tried doing binmode STDOUT but this fails --  the binmode call
 returns false.

 There could be any binary data in my string, so any UTF-8-bad byte pairs
 are definitely possible. I would think the solution is to inform Catalyst
 that the data is not UTF-8 but binary. In the normal case of writing to a
 file, one can use binmode to tell perl that the data is binary but that does
 not work here.

 Is this a gap in the Catalyst API?


 Are you by any chance setting a header to something with UTF8 content?

 I had a problem similar to this that was caused by me setting a
 Content-Disposition header to something including unicode.

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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] UTF-16 surrogate message when writing binary data (image)

2008-05-09 Thread Martin Ellison
If I write binary data (a JPEG) using $c-res-body then I get all these
errors

 stderr: UTF-16 surrogate 0xdf98 at /usr/lib/perl/5.8/IO/Handle.pm line 199.

My code looks like

  $c-res-content_type(q{image/jpeg});
$c-res-header( 'Content-Disposition', q{inline} );
$c-res-body($pic_image);

Presumably, something is assuming that the output is Unicode text and trying
to interpret it accordingly. These error messages are all over the log,
making it difficult to read, besides any impact the situation may be having
on the output.

Is there any way to fix this issue (eg something like binmode)?
-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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: UTF-16 surrogate message when writing binary data (image)

2008-05-09 Thread Martin Ellison
my $p   = new Image::Magick;
... lots of code
my $pic_image = $p-ImageToBlob();

I'm not sure if that makes it a character string but surely not?

I am using the Unicode plugin; does it cause any problems?

2008/5/9 Aristotle Pagaltzis [EMAIL PROTECTED]:

 * Martin Ellison [EMAIL PROTECTED] [2008-05-09 14:46]:
  My code looks like
 
  $c-res-content_type(q{image/jpeg});
  $c-res-header( 'Content-Disposition', q{inline} );
  $c-res-body($pic_image);

 Is `$pic_image` marked as a character string? Are you using
 Catalyst::Plugin::Unicode?

 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/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] FastCGI: incomplete headers (0 bytes) received from server

2008-05-07 Thread Martin Ellison
The error is presumably because your fast cgi system has a timeout. Do you
have some code that sometimes  takes a long time to run? If it only happens
about 1% of the time it may be normally just quicker than the limit, but
occasionally going over.

2008/5/7 John Goulah [EMAIL PROTECTED]:

 On Tue, May 6, 2008 at 1:01 PM, Ryan Pack [EMAIL PROTECTED] wrote:
 
 
 
 
  I'm having an issue with my Catalyst app but I can only get it to break
  about 1 in 100 tries.  The error log shows:
 
 
 
  [Tue May 06 11:02:46 2008] [error] [client 12.37.36.66] FastCGI: comm
 with
  server /u/lxlib/BookingEngine/script/bookingengine_fastcgi.pl aborted:
  idle timeout (60 sec), referer: http://be.genares.net/11
 
  [Tue May 06 11:02:46 2008] [error] [client 12.37.36.66] FastCGI:
 incomplete
  headers (0 bytes) received from server
  /u/lxlib/BookingEngine/script/bookingengine_fastcgi.pl, referer:
  http://be.genares.net/11
 
 
 


 For what its worth, I also get the latter error quite a bit in my
 error logs.  Haven't really had time to trace it down, looks similar
 something like:

  [Tue May 06 10:09:34 2008] [error] [client 204.2.215.55] FastCGI:
 incomplete headers (0 bytes) received from server
 /opt/myapp.com/app/MyApp/1.007556/fake/www


 I think the only thing in common here is Session::State::Cookie;  we
 use Session::Store::Cache.   Probably doesn't help much but I guess
 the problem does exist for various reasons if anyone has any ideas I'd
 be glad to try, but adding some debug messages in key places isn't
 going to cut 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/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Wikipedia article improvement?

2008-05-07 Thread Martin Ellison
The Wikipedia article on Catalyst (
http://en.wikipedia.org/wiki/Catalyst_%28software%29) could do with some
improvement and updating.

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Strange UTF16 warning

2008-05-07 Thread Martin Ellison
I've got the same problem for the same reason (trying to return a JPEG).
Presumably something thinks that it is getting text (Unicode) and picks up
some special characters. Is there some equivalent of binmode for body?

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Strange UTF16 warning

2008-05-07 Thread Martin Ellison
Sorry, my mailer did not quote the original post from Tue, 30 Oct 2007
17:10:07 -0800

I'm seeing warnings of the type UTF-16 surrogate 0xABCD in my logs that
I'm not quite sure how to explain. I am familiar with the nature of the
warning message, and I've tracked it to Catalyst::Engine-write -- but I'm
not sure exactly what's triggering it. The response body does contain the
character sequences in question, but the Content-Type is
application/octet-stream (that's JPEG to you AOL folks) and the UTF flag is
off for the string. There doesn't seem to be any corruption of the output,
the JPEGs work. But I'm concerned that something is treating my output as
UTF8 or otherwise stringy when it shouldn't be.

Any ideas?

Thanks in advance,
Brian Kirkbride



2008/5/7 Martin Ellison [EMAIL PROTECTED]:

 I've got the same problem for the same reason (trying to return a JPEG).
 Presumably something thinks that it is getting text (Unicode) and picks up
 some special characters. Is there some equivalent of binmode for body?


-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] CatalystSites.org

2008-04-06 Thread Martin Ellison
我看没懂。。。

On 06/04/2008, Oleg Pronin [EMAIL PROTECTED] wrote:

 5 ballov :

 2008/4/6, Marcus Ramberg [EMAIL PROTECTED]:
 
  ty chego raspizdelsia po-russki, suka? :D
 
  Marcus
 
  On 2. april. 2008, at 19.17, Oleg Pronin wrote:
 
   ti che raspizdilsya po-nemetski, suka ?
  
   2008/4/2, Ulf Lenski [EMAIL PROTECTED]:
  
   
Hallo Ulrich,
ich habe, dein Einverständnis vorausgesetzt, unsere pspf-app mal auf
der
unten genannten Seite veröffentlicht.
http://drs.dife.de/ könnte dort doch auch gelistet werden?
   
Wollen wir uns bei Gelegenheit mal wieder treffen?
   
bis bald - ulf.
   
   
Stephen Sykes schrieb:
   
 Hello Friends,

 For the past few days I have been putting together a site for
 listings
 of websites driven by the Catalyst MVC framework. The site idea
 was
 born out of a discussion on the list here a few weeks ago
 regarding a
 lack of any definitive list of sites based on the Catalyst MVC
 framework. Well, today I would like to announce the site launch. I
 hope everyone finds the site to their liking and can find the time
 to
 register and post their Catalyst driven websites.

 Note: I am also planning to release the source code for the site
 via
 subversion/trac as soon as I get a couple more admin features
 finished. So if anyone is interested in helping with the site code
 we
 can do this under version control, a sort of community driven
 project
 if you will.

 URL: http://www.catalystsites.org

 Kind Regards,
 Stephen Sykes

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


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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] CGI.pm and Catalyst?

2008-03-07 Thread Martin Ellison
Is there anything attached to Catalyst similar to the CGI.pm module? That
is, creating the HTML by a series of procedure calls rather than by
instantiating a template?

Or is there some way to link up the existing CGI module?
$c-response-body(ul(li(q{hello}),
li(q{world} ?

Or is it not a good idea?

I couldn't find anything from a search, so excuse me please if this has been
covered before.

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Debugging Catalyst with Eclipse

2008-01-23 Thread Martin Ellison
Try going through the mailing list archives and extracting useful
information. I got some useful advice on several sticking points, and I am
sure others did too. Take that out and organise it.

On 23/01/2008, Matt S Trout [EMAIL PROTECTED] wrote:

 On Tue, Jan 22, 2008 at 09:13:51AM -0600, Nathan Waddell wrote:
  Matt,
   I'd love to help write more docs. What format do I use and who do I
  submit them to?

 That's where my what can't you find that you want to know? question
 comes
 from. There's a lot in various lists members' heads that isn't in the docs
 because it's either (a) obvious to us (b) we're crap writers (me, for
 example)
 (c) we didn't get round to it.

 If you ask for info/techniques/etc. from people and make it clear that
 you're
 planning to turn the results into docs, I think you'll find you get an
 excellent response.

 --
   Matt S Trout   Need help with your Catalyst or DBIx::Class
 project?
Technical Director
 http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
 http://chainsawblues.vox.com/
 http://www.shadowcat.co.uk/servers/

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




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] warning

2008-01-23 Thread Martin Ellison
On 23/01/2008, Carl Johnstone [EMAIL PROTECTED] wrote:


 I can't think of any reason why you should be serving the same site on
 different domains.

 Note (before somebody pulls me up again) that different white-labelled
 sites
 based on the same app is a different situation.


You may want to deliver somewhat different content depending on which URL
they use; is that what you mean by 'white-labelled'?

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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: white-labelling [Catalyst] (Was: warning)

2008-01-23 Thread Martin Ellison
Interesting term, 'white labelling'; where do you get it from.

A client wants something similar so I am interested in the issue. The sites
will have some differences such as CSS but access the same application.

On 24/01/2008, Carl Johnstone [EMAIL PROTECTED] wrote:

  You may want to deliver somewhat different content depending on which
 URL
  they use; is that what you mean by 'white-labelled'?

 By white labelling I mean the same functionality and data wrapped up in
 different branding like:

 http://www.stockportexpress.co.uk/news/s/1033042_wii_posing_injury_risk


 http://www.manchestereveningnews.co.uk/news/s/1033042_wii_posing_injury_risk


 The main part of the content is the same, however the stuff around that is
 different. That said you might want to do more subtle tweaks according to
 domain name. However I can't see a reason for doing stuff like this:

 http://www.thesun.co.uk/sol/homepage/

 http://thesun.co.uk/sol/homepage/

 Never mind the case where the actual domains are different.

 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/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Serving html pages

2008-01-12 Thread Martin Ellison
location cannot be used with a .htaccess file. Neither can Alias.

On 13/01/2008, Len Jaffe [EMAIL PROTECTED] wrote:



 On Jan 11, 2008 10:18 PM, Martin Ellison [EMAIL PROTECTED] wrote:

  I have a similar problem, but I am on shared hosting and I do not have
  access to httpd.conf, only to the local .htaccess files. I have the
  static plugin set up so we are delivering HTML, image files and other static
  pages via Catalyst, but similarly to Alejandro I would like to serve up the
  pages directly from Apache.
 
  [edit]
 
  On 12/01/2008, Alejandro Imass [EMAIL PROTECTED] wrote:
  
   Usually you would try to serve your static content directly with your
   Web Server and let only the dynamic part with Catalyst. For example
   you could have a configuration in your apache vhost as such:
  
   Suppose your app's name is vdc...
  
  
   # Aliases
   Alias /static /var/www/vdc/root/static
   Alias /other-static-files /var/vdc/whatever
  
   # The static content is served by apache directly
   Location /static
   SetHandler default-handler
   /Location
   Location /other-static-files
   SetHandler default-handler
   /Location
  
 
 Those are the important bits.
 They tell apache where the files really live in the file system,
 and to use the regular file serving mechanism on them.

  You're defining / to serve your cat app. So any subdirectories of /, like
 /static have to be configured to be served by the default handler.

 Len.

 --
 [EMAIL PROTECTED]
 614-404-4214
 ___
 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/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Serving html pages

2008-01-11 Thread Martin Ellison
I have a similar problem, but I am on shared hosting and I do not have
access to httpd.conf, only to the local .htaccess files. I have the static
plugin set up so we are delivering HTML, image files and other static pages
via Catalyst, but similarly to Alejandro I would like to serve up the pages
directly from Apache.

I have tried using mod_rewrite but it seems to be an invention of the
Adversary designed to lead us into despair. Has anyone managed to serve
static files directly using just .htaccess?

On 12/01/2008, Alejandro Imass [EMAIL PROTECTED] wrote:

 Usually you would try to serve your static content directly with your
 Web Server and let only the dynamic part with Catalyst. For example
 you could have a configuration in your apache vhost as such:

 Suppose your app's name is vdc...

 VirtualHost *

 [...]

 # root of your app
 DocumentRoot /var/www/vdc/root

 # Aliases
 Alias /static /var/www/vdc/root/static
 Alias /other-static-files /var/vdc/whatever
 Alias / /var/www/vdc/script/vdc_cgi.pl

 # The Catalyst part is via mod_perl
 Location /
 SetHandler modperl
 PerlResponseHandler vdc
 /Location

 # The static content is served by apache directly
 Location /static
 SetHandler default-handler
 /Location
 Location /other-static-files
 SetHandler default-handler
 /Location

 # main app directory conf
 Directory /var/www/vdc
 DefaultLanguage es
 AddHandler cgi-script .pl
 AllowOverride None
 Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 /Directory

 # personal error file
 ErrorLog /var/log/apache2/vdc-error.log

 # personal log file
 LogLevel warn
 CustomLog /var/log/apache2/vdc-access.log combined
 ServerSignature On


 /VirtualHost

 On Jan 11, 2008 10:27 AM, Marcello Romani [EMAIL PROTECTED] wrote:
  Emmanuel Quevillon ha scritto:
   Hi,
  
   I am quite new with catalyst and I'd like to know how I could serve
 some
   html pages (actually documentation) e.g.:
   www.myapp.com/docs/index.html ?
  
   When I try to integrate such link in my template page, Pages are not
   served and as mentioned in the C::P::Static::Simple it does not serve
   .html file.
  
   Is there any magic thing to do without changing
   MyApp-config-{static}-{ignore_extensions} ?
  
   Thanks a lot
  
   Regards
  
 
  If I recall correctly, the default is to serve as static files only the
  ones under root/static, so try to put doc/ there.
 
  P.S.: Please don't start a new thread under an existing one.
 
  HTH
 
  --
  Marcello Romani
  Responsabile IT
  Ottotecnica s.r.l.
  http://www.ottotecnica.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/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] Web hosting?

2008-01-05 Thread Martin Ellison
I've now sorted this out with DreamHost and we now have an account.

On 04/01/2008, Martin Ellison [EMAIL PROTECTED] wrote:

 The refusal email was (on face) from a human, and did not state any
 reason. I've replied asking for an explanation.

 On 04/01/2008, Jon Schutz  [EMAIL PROTECTED] wrote:
 
  On Fri, 2008-01-04 at 09:28 +0800, Martin Ellison wrote:
   Dreamhost have refused to accept our site on the grounds of their
   frad detection system. No explanation given, and I have no idea why
   as this is a legitimate business.
 
  Did you contact a human at Dreamhost and ask why?  In contrast to some
  hosting providers, I have found Dreamhost's humans to be reasonable
  people.
 
  --
  Jon SchutzMy tech notes http://notes.jschutz.net
  Chief Technology Officer
  http://www.youramigo.com
  YourAmigo
 
 
 
 
  ___
  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/
 



 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] CPAN install without test? [ot]

2008-01-05 Thread Martin Ellison
Does anyone know how to get CPAN to install a module without doing the test
steps at all? Force install still does the test steps; I just want to go to
the actual make install.

Slightly off topic, but if anyone knows how to install modules, it must be
Catalyst developers...   (the module in question is DBIx::Class; for some
reason it is failing the populate test).

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
Sorrry, this is another newbie question.

I am using HTML::Widget and DBIx::Class to do simple CRUD on some MySQL
tables. I have defined an auto-increment primary key on one of my tables,
and I want to use an HTML form to populate and create a new object. I then
want to retrieve the newly-generated key.

Sup[pose the SQL has:

CREATE TABLE mytable (
   mytable_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
   title VARCHAR(64) NOT NULL,
   date VARCHAR(10) NOT NULL,
   PRIMARY KEY (mytable_id);

Having read the examples, I thought that all I had to do is:

my $obj = $c-model(q{MyAppDB::MyTable})-new({});
$obj-populate_from_widget($result);
my $newid = $obj-mytable_id;

but I am finding that the generated SQL is in fact setting the key field to
zero, and then the last line of the above code is getting an undefined value
back.

But then I have not actually told my DBIx::Class package for the table that
the column is autoincrement -- do I need to do this and if so how?

-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
I tried  my $newid = $c-model( q{MyAppDB::MyTable}
)-result_source-storage-last_insert_id();  and it gave me zero, so I'm
not sure how to proceed.

On 10/12/2007, Martin Ellison [EMAIL PROTECTED] wrote:

 Yes, I had a form field with the same name as the table key, because, when
 I do an update on an existing object, I want to save its key value
 somewhere. ...I've put in a test, so it only includes the field when I want
 to d an update. So now it is formulating the INSERT without the key field,
 which is good. However $obj-id is returning zero, implying that the model
 is not being updated after the insert.

 So now I am trying to work out how to get the last insert id. I think if I
 can retrieve the relevant DBIx::Schema I should be able to  use
 $schema-storage-last_input_id, but I'm still trying to find out  how to
 get to the schema.

 As to the latest in Catalyst modules, I was using what the documentation
 recommended. I don't want to rewrite everything in another module now.

 On 09/12/2007, Carl Franks [EMAIL PROTECTED] wrote:
 
  On 09/12/2007, Martin Ellison [EMAIL PROTECTED] wrote:
   Sorrry, this is another newbie question.
  
   I am using HTML::Widget and DBIx::Class to do simple CRUD on some
  MySQL
   tables. I have defined an auto-increment primary key on one of my
  tables,
   and I want to use an HTML form to populate and create a new object. I
  then
   want to retrieve the newly-generated key.
  
   Sup[pose the SQL has:
  
   CREATE TABLE mytable (
   mytable_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
  title VARCHAR(64) NOT NULL,
   date VARCHAR(10) NOT NULL,
  PRIMARY KEY (mytable_id);
  
   Having read the examples, I thought that all I had to do is:
  
   my $obj =
   $c-model(q{MyAppDB::MyTable})-new({});
$obj-populate_from_widget($result);
   my $newid = $obj-mytable_id;
  
   but I am finding that the generated SQL is in fact setting the key
  field to
   zero, and then the last line of the above code is getting an undefined
  value
   back.
 
  I can't remember for sure how populate_from_widget() works, but I
  suspect that you've a field in your form corresponding to the table's
  'id' column. If that's empty, populate_from_formfu() may be trying to
  blank that column (), and mysql's converting it to a zero.
  You can see that exact SQL that's being issued, by setting the
  environment variable DBIC_TRACE=1
  If this is new development, HTML::Widget is deprecated in favour of
  HTML::FormFu.
  If you decide to look at HTML::FormFu, take note that
  DBIx::Class::HTML::FormFu is about to be replaced by
  HTML::FormFu::Model::DBIC, which is still in svn, and will be released
  to cpan at some point this month.
 
  Cheers,
  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/[EMAIL PROTECTED]/
  Dev site: http://dev.catalyst.perl.org/
 



 --
 Regards,
 Martin
 ([EMAIL PROTECTED])
 IT: http://methodsupport.com Personal: http://thereisnoend.org




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
Yes, I had the DBIC trace going. Basically it did an INSERT (without the key
field, correctly), but not a (select of the) LAST_INSERT_ID(), at least, not
in the trace. So perhaps it had no way of knowing the new key.

On 10/12/2007, Carl Franks [EMAIL PROTECTED] wrote:

 On 09/12/2007, Martin Ellison [EMAIL PROTECTED] wrote:
  Yes, I had a form field with the same name as the table key, because,
 when I
  do an update on an existing object, I want to save its key value
 somewhere.
  ...I've put in a test, so it only includes the field when I want to d an
  update. So now it is formulating the INSERT without the key field, which
 is
  good. However $obj-id is returning zero, implying that the model is not
  being updated after the insert.
 
  So now I am trying to work out how to get the last insert id. I think if
 I
  can retrieve the relevant DBIx::Schema I should be able to  use
  $schema-storage-last_input_id, but I'm still trying to
  find out  how to get to the schema.
 
  As to the latest in Catalyst modules, I was using what the documentation
  recommended. I don't want to rewrite everything in another module now.

 That's fair enough, as long as you know it's not being maintained by
 anyone.

 Did you turn on DBIC's tracing to see exactly what's going on in the SQL?
 $obj-id() should work fine, without having to use last_insert_id.

 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/[EMAIL PROTECTED]/
 Dev site: http://dev.catalyst.perl.org/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: How to insert from form to MySQL with autoincrement primary key?

2007-12-09 Thread Martin Ellison
My table class is basically:

use base qw/DBIx::Class/;

__PACKAGE__-load_components(qw/PK::Auto Core HTMLWidget/);

# Set the table name
__PACKAGE__-table('mytable');

# Set columns in table
__PACKAGE__-add_columns(
qw/mytable_id title date/
);

# Set the primary key for the table
__PACKAGE__-set_primary_key(q/mytable_id/);

That should cover off Paul's concerns.

It seems that set_primary_key can take either a single string or a reference
to an array of strings, but neither work for me. (Or rather, they work for
update but not insert).

On 10/12/2007, kevin montuori [EMAIL PROTECTED] wrote:

  PH == Paul Henrich [EMAIL PROTECTED] writes:

 PH You might check to make sure that you are loading PK::Auto in
 PH MyAppDB::MyTable:

 I belive that with a recent DBIx::Class that's not necessary: perldoc
 DBIx::Class::PK::Auto indicates that PK::Auto is now part of Core.


 k.

 --
 kevin montuori
 [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/[EMAIL PROTECTED]/
 Dev site: http://dev.catalyst.perl.org/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Newbie question - $c-login is missing

2007-12-04 Thread Martin Ellison
I have tried doing

if ($c-authenticate( { username = $username,
password = $password })) {
   # if ($c-login($username, $password)) {
(ie using authenticat instead on login) but then I get
Use of uninitialized value in string eq at
/usr/lib/perl5/site_perl/5.8.8/Catalyst/Authentication/Credential/Password.pm
line 84.
I'm not sure at all how that happens.

Jason: Catalyst::Plugin::Authentication::Credential::Password says it is a
compatibility shim for old code (see
http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10003/lib/Catalyst/Plugin/Authentication/Credential/Password.pm);
then it refers us to Catalyst::Authentication::Credential::Password which
advises using authenticate.

But anyway authenticate does not appear to do all the login, as I thought
login was also suppose to register the user with the session (and what
else?)

So I am still not sure how to proceed.


On 04/12/2007, Jason Kohles [EMAIL PROTECTED] wrote:

 On Dec 4, 2007, at 8:40 AM, Martin Ellison wrote:

 I am getting this message
 [error] Caught exception in myapp::Controller::User-loginuser Can't
 locate object method login via package myapp at ...Controller/User.pm
 line 41.

 My application class loads the following plugins: -Debug ConfigLoader
 Static::Simple StackTrace Session Session::State Session::Store
 Session::Store::File Session::State::Cookie Authentication
 Authentication::Store::DBIC Authorization::Roles.

 I thought I had everything set up according to the tutorial.

 Does anyone know what I should be doing? I thought one of these plugins
 would provide the 'login' method for me.


 You need a credential plugin, probably
 Catalyst::Plugin::Authentication::Credential::Password.

 --
 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/[EMAIL PROTECTED]/
 Dev site: http://dev.catalyst.perl.org/




-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Newbie question - $c-login is missing

2007-12-04 Thread Martin Ellison
Jonathan:
my $username = $c-request-params-{username} || ;
   my $password = $c-request-params-{password} || ;
These had non-empty values (verified from the trace).

On 05/12/2007, Jonathan Rockway [EMAIL PROTECTED] wrote:


 On Wed, 2007-12-05 at 01:31 +0800, Martin Ellison wrote:
  I have tried doing
 
  if ($c-authenticate( { username = $username,
  password = $password })) {
 # if ($c-login($username, $password)) {
  (ie using authenticate instead on login) but then I get
  Use of uninitialized value in string eq
  at
 /usr/lib/perl5/site_perl/5.8.8/Catalyst/Authentication/Credential/Password.pm
 line 84.
  I'm not sure at all how that happens.

 What are $username and $password set to?

 
  Jason: Catalyst::Plugin::Authentication::Credential::Password says it
  is a compatibility shim for old code (see
 
 http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10003/lib/Catalyst/Plugin/Authentication/Credential/Password.pm);
 then it refers us to Catalyst::Authentication::Credential::Password which
 advises using authenticate.
 
  But anyway authenticate does not appear to do all the login, as I
  thought login was also suppose to register the user with the session
  (and what else?)

 Catalyst::Authentication::Credential::Password::authenticate doesn't do
 that, but that's not the method that $c-authenticate calls.
 $c-authenticate does the same thing that $c-login does.  (Actually
 $c-login doesn't *have* to do anything; it was all very ad-hoc.  The
 new authentication separates the various concerns and ensures that
 Credentials only verify credentials.)

 Regards,
 Jonathan Rockway


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





-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.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/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/