RE: [Catalyst] question about sharing models with differentapplications/hosts

2007-07-20 Thread Hartmaier Alexander
Hi Barry!

I have a MyApp::Model::DBIC module I use in every app which needs it.
At the beginning I extended it with table/resultset methods I need in my 
various apps, but now I only put those in the model which are shared and 
subclass classes which need more functionality in the apps.

-Alex


 -Original Message-
 From: Barry Hoggard [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 19, 2007 9:30 PM
 To: catalyst@lists.rawmode.org
 Subject: [Catalyst] question about sharing models with
 differentapplications/hosts
 
 I'm investigating migrating an art website hosting service
 (www.artcat.com) from CGI::Application under mod_perl to Catalyst.
 There are 2 parts to the application -- the admin interface for
 clients and the application that serves the pages.  Eventually the two
 may be served on different servers, such as clientsite.com and
 admin.artcat.com.  They would need to use the same model classes of
 course.
 
 What is considered the best way to do this now?  One catalyst app with
 different vhosts and URL rewriting, or some kind of shared repository
 for the lib directory, or something else?
 
 ___
 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/

***
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
***
Notice: This e-mail contains information that is confidential and may be 
privileged.
If you are not the intended recipient, please notify the sender and then delete 
this e-mail immediately.
***
___
List: Catalyst@lists.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] (Russian) Catalyst Job offer

2007-07-20 Thread Илья Кантор
Russian company Obnovlenie http://obnovlenie.ru invites perl developer.

We are actively advancing touristic campany with large IT share.

Our perl-based site occupies leading (or close to leading) positions in
search engines and visitor ratings.

Your job would be integration of current system with newest
technologies, development of the project.

There's much more places where you could participate, of course.

Perl team leader position is possible in the future.

Age - 21+ years, experience with Perl/MySQL/Catalyst required.

Salary 35000-7 RUR (or 1500-2500 USD)

Full time job with flexible schedule among nice people :)

Ping me on
ilia {#} obnovlenie.ru
or
ICQ 820317







___
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] Gentoo portage overlay

2007-07-20 Thread Toby Corkindale
Hi guys,
I've been travelling for quite a while and am now on the other side of
the world, but am back at work on Catalyst-based apps, and re-subbed to
the list.

Anyway, I just wondered who was maintaining the Gentoo portage Catalyst
overlay, as I have a couple of ebuilds for them.

-Toby
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$

inherit perl-module

DESCRIPTION=Infrastructure plugin for the Catalyst authentication framework
HOMEPAGE=http://search.cpan.org/dist/${PN}/;
SRC_URI=mirror://cpan/authors/id/N/NU/NUFFIN/${P}.tar.gz
RESTRICT=nomirror

IUSE=

SLOT=0
LICENSE=|| ( Artistic GPL-2 )
KEYWORDS=alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc 
x86

DEPEND=
dev-perl/Catalyst-Runtime
=dev-perl/Catalyst-Plugin-Session-0.10
dev-perl/Class-Inspector


# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$

inherit perl-module

DESCRIPTION=Authentication and authorization against a DBIx::Class schema
SRC_URI=mirror://cpan/authors/id/J/JA/JAYK/${P}.tar.gz
HOMEPAGE=http://search.cpan.org/dist/${PN}/;
RESTRICT=nomirror

IUSE=

SLOT=0
LICENSE=|| ( Artistic GPL-2 )
KEYWORDS=alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc 
x86

DEPEND=dev-perl/module-build
dev-perl/Catalyst-Runtime
=dev-perl/Catalyst-Plugin-Authentication-0.10
dev-perl/DBIx-Class

___
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] setup_home() bug

2007-07-20 Thread Jonathan T. Rockway
On Mon, Jul 09, 2007 at 04:53:18PM -0400, Adam Herzog wrote:
  Okay. I added Catalyst::Utils::env_value(), and updated Catalyst.pm 
  Index: t/unit_utils_env_value.t
  Index: lib/Catalyst.pm
  Index: lib/Catalyst/Utils.pm

Thanks for the patch, it looks great.  The only problem is that your
mail client seems to have wrapped some long lines, and even when I
manually fix it Cpatch is unable to apply the patch.

If you could regenerate and send it unmunged, then I'll get this
applied ASAP.

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/


Re: [Catalyst] setup_home() bug

2007-07-20 Thread Adam Herzog

On Jul 20, 2007, at 5:47 PM, Jonathan T. Rockway wrote:

Thanks for the patch, it looks great.  The only problem is that your
mail client seems to have wrapped some long lines, and even when I
manually fix it Cpatch is unable to apply the patch.


But... but... the longest line is only 79 chars. Stupid mail client.  
*shakes fist angrily*


Anyway, patch attached.

Thanks!

-A

Index: t/unit_utils_env_value.t
===
--- t/unit_utils_env_value.t(revision 0)
+++ t/unit_utils_env_value.t(revision 0)
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More tests = 5;
+
+BEGIN { use_ok(Catalyst::Utils) }
+
+##
+### No env vars defined
+##
+{
+ok( !Catalyst::Utils::env_value( 'MyApp', 'Key' ),
+'No env values defined returns false'
+);
+}
+
+##
+### App env var defined
+##
+{
+$ENV{'MYAPP2_KEY'} = 'Env value 2';
+is( Catalyst::Utils::env_value( 'MyApp2', 'Key' ),
+'Env value 2', 'Got the right value from the application var' );
+}
+
+##
+### Catalyst env var defined
+##
+{
+$ENV{'CATALYST_KEY'} = 'Env value 3';
+is( Catalyst::Utils::env_value( 'MyApp3', 'Key' ),
+'Env value 3', 'Got the right value from the catalyst var' );
+}
+
+##
+### Catalyst and Application env vars defined
+##
+{
+$ENV{'CATALYST_KEY'} = 'Env value bad';
+$ENV{'MYAPP4_KEY'}   = 'Env value 4';
+is( Catalyst::Utils::env_value( 'MyApp4', 'Key' ),
+'Env value 4', 'Got the right value from the application var' );
+}
+
Index: lib/Catalyst.pm
===
--- lib/Catalyst.pm (revision 6588)
+++ lib/Catalyst.pm (working copy)
@@ -1924,15 +1924,10 @@
 $dispatcher = 'Catalyst::Dispatcher::' . $dispatcher;
 }
 
-if ( $ENV{CATALYST_DISPATCHER} ) {
-$dispatcher = 'Catalyst::Dispatcher::' . $ENV{CATALYST_DISPATCHER};
+if ( my $env = Catalyst::Utils::env_value( $class, 'DISPATCHER' ) ) {
+$dispatcher = 'Catalyst::Dispatcher::' . $env;
 }
 
-if ( $ENV{ uc($class) . '_DISPATCHER' } ) {
-$dispatcher =
-  'Catalyst::Dispatcher::' . $ENV{ uc($class) . '_DISPATCHER' };
-}
-
 unless ($dispatcher) {
 $dispatcher = $class-dispatcher_class;
 }
@@ -1958,14 +1953,10 @@
 $engine = 'Catalyst::Engine::' . $engine;
 }
 
-if ( $ENV{CATALYST_ENGINE} ) {
-$engine = 'Catalyst::Engine::' . $ENV{CATALYST_ENGINE};
+if ( my $env = Catalyst::Utils::env_value( $class, 'ENGINE' ) ) {
+$engine = 'Catalyst::Engine::' . $env;
 }
 
-if ( $ENV{ uc($class) . '_ENGINE' } ) {
-$engine = 'Catalyst::Engine::' . $ENV{ uc($class) . '_ENGINE' };
-}
-
 if ( $ENV{MOD_PERL} ) {
 
 # create the apache method
@@ -2078,15 +2069,10 @@
 sub setup_home {
 my ( $class, $home ) = @_;
 
-if ( $ENV{CATALYST_HOME} ) {
-$home = $ENV{CATALYST_HOME};
+if ( my $env = Catalyst::Utils::env_value( $class, 'HOME' ) ) {
+$home = $env;
 }
 
-if ( $ENV{ uc($class) . '_HOME' } ) {
-$class =~ s/::/_/g;
-$home = $ENV{ uc($class) . '_HOME' };
-}
-
 unless ($home) {
 $home = Catalyst::Utils::home($class);
 }
@@ -2110,14 +2096,8 @@
 $class-log( Catalyst::Log-new );
 }
 
-my $app_flag = Catalyst::Utils::class2env($class) . '_DEBUG';
-
-if (
-  ( defined( $ENV{CATALYST_DEBUG} ) || defined( $ENV{$app_flag} ) )
-? ( $ENV{CATALYST_DEBUG} || $ENV{$app_flag} )
-: $debug
-  )
-{
+my $env_debug = Catalyst::Utils::env_value( $class, 'DEBUG' );
+if ( defined($env_debug) ? $env_debug : $debug ) {
 no strict 'refs';
 *{$class\::debug} = sub { 1 };
 $class-log-debug('Debug messages enabled');
Index: lib/Catalyst/Utils.pm
===
--- lib/Catalyst/Utils.pm   (revision 6588)
+++ lib/Catalyst/Utils.pm   (working copy)
@@ -292,7 +292,29 @@
 return \%merged;
 }
 
+=head2 env_value($class, $key)
 
+Checks for and returns an environment value. For instance, if $key is
+'home', then this method will check for and return the first value it finds,
+looking at $ENV{MYAPP_HOME} and $ENV{CATALYST_HOME}.
+
+=cut
+
+sub env_value {
+my ( $class, $key ) = @_;
+
+$key = uc($key);

Re: [Catalyst] setup_home() bug

2007-07-20 Thread Ashley
Whoops! That's what I get for reading all the way down. I thought it  
was about the patch I just sent.


-Ashley

On Jul 20, 2007, at 4:27 PM, Adam Herzog wrote:


On Jul 20, 2007, at 5:47 PM, Jonathan T. Rockway wrote:

Thanks for the patch, it looks great.  The only problem is that your
mail client seems to have wrapped some long lines, and even when I
manually fix it Cpatch is unable to apply the patch.


But... but... the longest line is only 79 chars. Stupid mail  
client. *shakes fist angrily*


Anyway, patch attached.

Thanks!

-A

env_value-diff.txt




___
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] setup_home() bug

2007-07-20 Thread Jonathan Rockway
On Friday 20 July 2007 06:27:22 pm Adam Herzog wrote:
 On Jul 20, 2007, at 5:47 PM, Jonathan T. Rockway wrote:
  Thanks for the patch, it looks great.  The only problem is that your
  mail client seems to have wrapped some long lines, and even when I
  manually fix it Cpatch is unable to apply the patch.

 But... but... the longest line is only 79 chars. Stupid mail client.
 *shakes fist angrily*

 Anyway, patch attached.

Thanks!  Applied as r6589.  Hopefully it will be on CPAN Real Soon Now.

Regards,
Jonathan Rockway

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;


signature.asc
Description: This is a digitally signed message part.
___
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/