[Catalyst] Job posting!

2010-04-29 Thread Byron Young
Hey Catalyst / DBIC folks,

I am leaving my job and, thus, my position is becoming available!

The title is QA Tools Developer - you would be working on custom internal apps 
at Riverbed Technology, a network acceleration company in downtown San 
Francisco, CA.  Good company, good people, good location (IMHO).

A lot of the work is full-stack OO Perl web development using Catalyst and DBIC.

Experience with the following will give you a leg up (ordered from most to 
least desired):
- solid OO Perl background
- Catalyst / DBIx::Class
- Javascript
- managing web servers and MySQL databases
- Bugzilla maintenance and customization

They'll reimburse up to $5k for relocation.

If you're interested please send an email to Stan Russell at 
stan.russ...@riverbed.com, with your resume attached.

Good luck!

Byron

___
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] ldap authentication/db authorization

2009-08-10 Thread Byron Young
Steve Rippl wrote on 2009-08-09:
 Hello!
 
 I have a question that is hopefully trivial for someone here, but I
 haven't seen any examples.  I have an app I'm building, used by folks in
 an Active Directory network.  It's got a DBIx model and I'd like to use
 that for role based authorization and getting staff members
 grade/building info etc (it's a school district), but I'd like to (just)
 authenticate against ldap.  I don't want to store any user/role data
 there (obviously their username is in there and it matches what I have
 in the db), simply try to bind against it as the user, then get store
 data from the database.  This way they can use their network passwords
 and I don't have to fill AD with application specific info.
 
 Make sense? Easy to do?
 
 So far I'm doing it all via the db...
 
 name WsdSis
 authentication
   default_realm dbic
   realms
 dbic
   credential
 class Password
 password_type clear
  /credential
  store
 user_class DB::Staff
 role_relation  roles
 role_field role
   /store
 /dbic
   /realms
 /authentication
 ...
 
 and
 ...
 use Catalyst qw/
  -Debug
  ConfigLoader
  Static::Simple
  StackTrace
  Authentication
  Authorization::Roles
  Session
  Session::Store::FastMmap
  Session::State::Cookie
 /;
 ...
 
 What would these look like if I'm able to squeeze the ldap plugin in
 there?  Can I have 2 Authentication::Store backends in there?
 
 TIA,
 Steve
 
 --
 Steve Rippl
 Technology Director
 Woodland School District
 360 225 9451 x326
 
 

Hey Steve,

I do this in my app.  The way I do is it I have two authentication realms - 
LDAP and DBIC.  I authenticate against the LDAP realm first, and if that is 
successful I do a find_or_create with the user info on my user DB table, so any 
first-time users get a user created in the DBIC realm with default roles and 
whatnot.  Then I authenticate against the DBIC realm.  I do that last because 
$c-user will contain the most recently authenticated user, so in this case 
$c-user would be your DB::Staff object.

HTH

Byron


___
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] ldap authentication/db authorization

2009-08-10 Thread Byron Young

Steve Rippl wrote on 2009-08-10:
 Byron Young wrote:
 Hey Steve,
 
 I do this in my app.  The way I do is it I have two
 authentication realms - LDAP and DBIC.  I authenticate against the
 LDAP realm first, and if that is successful I do a find_or_create
 with the user info on my user DB table, so any first-time users get
 a user created in the DBIC realm with default roles and whatnot.
 Then I authenticate against the DBIC realm.  I do that last because
 $c-user will contain the most recently authenticated user, so in
 this case $c-user would be your DB::Staff object.
 
 HTH
 
 Byron
 
 
 Thanks for the response.  Makes perfect sense, but I'm having a problem
 with the call to $c-authenticate when I add the realm.
 $c-authenticate({ username = $username, password = $password  },
 'ldap') throws an error about not using a string as HASH ref (I've got
 my ldap settings under realms - ldap).  Using $c-authenticate({
 username = $username, password = $password, realm = $realm }) seems
 to work, except it's not authenticating correctly and seems to use dbic
 by default when I don't have a default realm set (I set $realm = 'ldap'
 before the auth call).
 
 What syntax are using?
 
 Many thanks,
 Steve
 

Same as you: $c-authenticate({id = $username, 
   password = $password},
  'ldap')

Not sure why that doesn't work for you.  What's in your ldap realm config?  
Maybe you have a problem with the way the config is being parsed.

Byron

___
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: uri_for() corrupts query parameters hash for caller

2009-06-29 Thread Byron Young
Tomas Doran wrote on 2009-06-29:
 
 On 26 Jun 2009, at 23:19, Byron Young wrote:
 
 Alrighty, here you go, patch + test are attached.  There are based off
 the 5.71001 svn head because that's what I have currently. 5.8's
 uri_for() looks the same, so it should apply there as well, but let me
 know if you need another one from 5.8.
  http://dev.catalyst.perl.org/svnweb/Catalyst/revision/?rev=10736
 
 Thanks very much for the patch, applied ok to 5.80 trunk.
 
 I rewrote your fix to just not mangle $_, which fixes the same issue
 with less code, and avoids the unsafe each..
 
 Unfortunately, this just missed the Catalyst 5.80006 release, so you'll
 have to wait for the next one to see it in released code, sorry!
 
 Cheers
 t0m

Oh, nice, that's a much better solution.  If you don't mind, though, can you 
explain what you mean about the 'unsafe each'?

Thanks!
Byron

___
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: uri_for() corrupts query parameters hash for caller

2009-06-29 Thread Byron Young
Tomas Doran wrote on 2009-06-29:
 On 30 Jun 2009, at 00:31, Byron Young wrote:
  If you don't mind, though, can you explain what you mean about
 the
 'unsafe each'?
  If your application code half iterates through the params hash with
 each before calling uri_for, then the param copy would only copy the
 second half of the hash (as each has an internal iterator).
 
 Cheers
 t0m

Ah, makes sense.  Learn something new every day!

Thanks!
Byron

___
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: uri_for() corrupts query parameters hash for caller

2009-06-26 Thread Byron Young

Tomas Doran wrote on 2009-06-26:
 Byron Young wrote:
 
 I know people have been busy (I think there were some perl
 conferences lately?) and I think my issue slipped through the
 cracks.  Just wanted to know what people thought about this and
 whether I should submit my patch or take a different approach.
 
 
 Sorry for dropping this on the floor.
 
 Yes, please submit a patch :)
 
 Cheers
 t0m


Alrighty, here you go, patch + test are attached.  There are based off the 
5.71001 svn head because that's what I have currently.  5.8's uri_for() looks 
the same, so it should apply there as well, but let me know if you need another 
one from 5.8.

(I'm not sure how tracking contributors works, or if you do, but if so this was 
worked on by myself and Amir Sadoughi).

Byron



uri_for_patch.diff
Description: uri_for_patch.diff
___
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: uri_for() corrupts query parameters hash for caller

2009-06-25 Thread Byron Young
Byron Young wrote on 2009-06-12:
 Byron Young wrote on 2009-06-12:
 Hey everybody,
 
 I ran into an issue at $work where we keep passing the same
 $query_params hashref to a number of uri_for() calls successively, but
 if there are characters in the query params that need to be escaped
 they get escaped each time, leading to sequences like
 
 ?filter=Not%25252BRun
 
 after the same $query_params have been run through uri_for a few of
 times (because the '%' keeps getting escaped).  The query hash was
 originally { filter = 'Not Run' }.
 
 So, we patched uri_for() here at work to create a copy of $params
 and work with that, and that fixes the issue.  However, it seems
 like such a simple fix that I feel like it must have been thought
 of and discussed and shot down in the past, but I didn't find
 anything in the list archives indicating that.  Is there some
 reason uri_for() does things that way?
 
 If not I'll gladly supply patch + test.
 
 Thanks,
 Byron
 

 I also noticed that the docs for uri_for used to warn of the
 destructiveness but that warning has been removed in more recent
 versions.  I'd like to suggest that it be added back and made more
 prominent if there really is a good reason for mangling the
 caller's data.  I can provide a doc patch in that case, too.
 
 Byron
 

Hey,

I know people have been busy (I think there were some perl conferences lately?) 
and I think my issue slipped through the cracks.  Just wanted to know what 
people thought about this and whether I should submit my patch or take a 
different approach.

Thanks
Byron

___
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] uri_for() corrupts query parameters hash for caller

2009-06-12 Thread Byron Young
Hey everybody,

I ran into an issue at $work where we keep passing the same $query_params 
hashref to a number of uri_for() calls successively, but if there are 
characters in the query params that need to be escaped they get escaped each 
time, leading to sequences like

?filter=Not%25252BRun 

after the same $query_params have been run through uri_for a few of times 
(because the '%' keeps getting escaped).  The query hash was originally { 
filter = 'Not Run' }.

So, we patched uri_for() here at work to create a copy of $params and work with 
that, and that fixes the issue.  However, it seems like such a simple fix that 
I feel like it must have been thought of and discussed and shot down in the 
past, but I didn't find anything in the list archives indicating that.  Is 
there some reason uri_for() does things that way?

If not I'll gladly supply patch + test.

Thanks,
Byron

___
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: uri_for() corrupts query parameters hash for caller

2009-06-12 Thread Byron Young
Byron Young wrote on 2009-06-12:
 Hey everybody,
 
 I ran into an issue at $work where we keep passing the same
 $query_params hashref to a number of uri_for() calls successively,
 but if there are characters in the query params that need to be
 escaped they get escaped each time, leading to sequences like
 
 ?filter=Not%25252BRun
 
 after the same $query_params have been run through uri_for a few of
 times (because the '%' keeps getting escaped).  The query hash was
 originally { filter = 'Not Run' }.
 
 So, we patched uri_for() here at work to create a copy of $params
 and work with that, and that fixes the issue.  However, it seems
 like such a simple fix that I feel like it must have been thought
 of and discussed and shot down in the past, but I didn't find
 anything in the list archives indicating that.  Is there some
 reason uri_for() does things that way?
 
 If not I'll gladly supply patch + test.
 
 Thanks,
 Byron
 
 ___ 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/

I also noticed that the docs for uri_for used to warn of the destructiveness 
but that warning has been removed in more recent versions.  I'd like to suggest 
that it be added back and made more prominent if there really is a good reason 
for mangling the caller's data.  I can provide a doc patch in that case, too.

Byron

___
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] Passing connection info to an custom model/external lib

2009-04-10 Thread Byron Young
Eric Wright wrote on 2009-04-10:
 I have what I hope is not a dumb question. I'm trying to follow best
 practices here and am writing a piece of business logic that I feel
 should be Catalyst agnostic and therefore am creating a custom model.
 (However, at the moment Catalyst is the primary consumer of this lib.)
 I'd like to use my DBIC::Schema goodness for DB access and happily have
 abstracted that via Catalyst::Model::DBIC::Schema. The thing is I
 realized that if I connect to this schema outside of the scope of
 Catalyst via DBIx::Class::Schema-connect I have to pass in the
 connection info separately which really bugs me because I've already
 defined it via a configuration file for the Catalyst app (using
 Config::General). I suppose I could just pass that info into the model
 but that seems messy and redundant to me. If I subclass Catalyst::Model
 well then I'm tightly coupled with Catalyst again. I'd like to just be
 able to glue the model to Catalyst and do a:
 
 $c-model('MyCustomModel')-foo(...)
 
 and it just work.
 
 It seems to me there should be a simple way for this schema to know its
 connection info based on context and I figured there's like a slick
 Catalyst ninja kind of method for doing this that my brain is just not
 grasping at the moment. How do you do this sort of thing? Is the magic
 in the Catalyst glue?
 
 Thanks in advance for any advice/thoughts/comments...
 
 -Eric
 

I'm not sure if there's a special Catalyst way of doing this, but I use my 
schema classes from my various places, so I moved my db connection data into a 
separate config file that all apps can access.  I have a separate class I wrote 
that looks for the config file in a few specific places (depending on whether 
you're in dev mode or production mode) and reads it.  This class provides the 
connection info to the schema class.  This way I can easily move my database, 
update the info in one file, and all apps automatically get the new connection 
info.

Hope that helps.

Byron

___
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] Custom changes to different instances of the same app

2009-04-02 Thread Byron Young
That's a pretty broad question, but three basic ideas come to mind.  First 
start by factoring as much common code as possible out into separate classes.  
If they are asking for major differences in their custom versions, using a 
version control system and branching for their changes might be a good idea, 
but it brings with it the overhead of maintaining branches and backporting 
fixes as needed.  If the customizations are not so vast, you can use a Strategy 
pattern to codify the customizable behaviors into interchangeable classes and 
then either create an Admin page or a config file where they can select the 
ones they want.

But I think the solution you choose will depend on the sort of customization 
you're facing.  In general I think the design practise of creating well-defined 
interfaces for the various components of your app makes it easy to create 
interchangeable components and behaviors.  Whether you are picking the 
components at runtime with some configuration options or at compile time by 
actually selecting a subset of files to deploy (via makefiles or version 
control) is not as important in my mind.

I'm sure there are many other possible solutions as well.  If you could provide 
some more info about the sorts of customizations I think you'll probably get 
some interesting answers.

Byron

From: Michael Reddick [mailto:michael.redd...@gmail.com]
Sent: Thursday, April 02, 2009 1:32 PM
To: catalyst@lists.scsys.co.uk
Subject: [Catalyst] Custom changes to different instances of the same app

If you have a Catalyst app installed at several different customers, and they 
all want their own customizations, whether it be to the interface or the 
business logic, what are some different strategies for doing that using good 
coding standards?

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


[Catalyst] Catalyst::View::Email tests failing

2009-02-05 Thread Byron Young
Hi J Shirley

I'm trying to install your neat C::V::Email package but I'm running into some 
test failures.  I thought you might like to know about them.  The test failures 
look benign to me so I'm going to force install, but let me know if you think 
that the errors could be dangerous.

Let me know if you want me to try out a test patch.

Thanks
Byron


  CPAN.pm: Going to build J/JS/JSHIRLEY/Catalyst-View-Email-0.11.tar.gz

Cannot determine perl version info from lib/Catalyst/View/Email.pm
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- Catalyst  ...loaded. (5.71000 = 5.7)
- Class::C3 ...loaded. (0.19)
- Email::Send   ...loaded. (2.194 = 2.185)
- Email::MIME   ...loaded. (1.863 = 1.859)
- Email::MIME::Creator  ...loaded. (1.455 = 1.453)
[Template Toolkit Support]
- Catalyst::View::TT...loaded. (0.26)
[Mason Support]
- Catalyst::View::Mason ...loaded. (0.16)
[Net::SMTP Support]
- MIME::Base64  ...loaded. (3.07)
- Authen::SASL  ...missing.
== Auto-install the 1 optional module(s) from CPAN? [n]
*** Module::AutoInstall configuration finished.
Checking if your kit is complete...
Warning: the following files are missing in your kit:
t/lib/TestApp/cache/obj/
Please inform the author.
Writing Makefile for Catalyst::View::Email
cp lib/Catalyst/View/Email.pm blib/lib/Catalyst/View/Email.pm
cp lib/Catalyst/View/Email/Template.pm blib/lib/Catalyst/View/Email/Template.pm
cp lib/Catalyst/Helper/View/Email.pm blib/lib/Catalyst/Helper/View/Email.pm
cp lib/Catalyst/Helper/View/Email/Template.pm 
blib/lib/Catalyst/Helper/View/Email/Template.pm
Manifying blib/man3/Catalyst::View::Email.3pm
Manifying blib/man3/Catalyst::View::Email::Template.3pm
Manifying blib/man3/Catalyst::Helper::View::Email::Template.3pm
Manifying blib/man3/Catalyst::Helper::View::Email.3pm
  JSHIRLEY/Catalyst-View-Email-0.11.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 
'inc', 'blib/lib', 'blib/arch') t/01use.t t/02pod.t t/04basic.t t/05template.t 
t/06config.t t/07mason.t
t/01use.ok
t/02pod.skipped: set TEST_POD to enable this test
t/04basic...[warn] DEPRECATION WARNING: TestApp::View::Mason sets the 
use_match config variable to a true value.
This has been deprecated. Please see the Catalyst::View::Mason
documentation for details on use_match.
t/04basic...ok
t/05template[warn] DEPRECATION WARNING: TestApp::View::Mason sets the 
use_match config variable to a true value.
This has been deprecated. Please see the Catalyst::View::Mason
documentation for details on use_match.
t/05template2/11
#   Failed test 'text/plain part ok'
#   at t/05template.t line 33.
#  got: 'text/plain'
# expected: 'text/plain; charset=us-ascii'

#   Failed test 'text/html ok'
#   at t/05template.t line 36.
#  got: 'text/html'
# expected: 'text/html; charset=us-ascii'
# Looks like you failed 2 tests of 11.
t/05template Dubious, test returned 2 (wstat 512, 0x200)
 Failed 2/11 subtests
t/06config..[warn] DEPRECATION WARNING: TestApp::View::Mason sets the 
use_match config variable to a true value.
This has been deprecated. Please see the Catalyst::View::Mason
documentation for details on use_match.
t/06config..1/13
#   Failed test 'text/plain ok'
#   at t/06config.t line 37.
#  got: 'text/plain'
# expected: 'text/plain; charset=us-ascii'

#   Failed test 'text/html ok'
#   at t/06config.t line 39.
#  got: 'text/html'
# expected: 'text/html; charset=us-ascii'
# Looks like you failed 2 tests of 13.
t/06config.. Dubious, test returned 2 (wstat 512, 0x200)
 Failed 2/13 subtests
t/07mason...[warn] DEPRECATION WARNING: TestApp::View::Mason sets the 
use_match config variable to a true value.
This has been deprecated. Please see the Catalyst::View::Mason
documentation for details on use_match.
t/07mason...1/10
#   Failed test 'text/plain ok'
#   at t/07mason.t line 32.
#  got: 'text/plain'
# expected: 'text/plain; charset=us-ascii'

#   Failed test 'text/html ok'
#   at t/07mason.t line 34.
#  got: 'text/html'
# expected: 'text/html; charset=us-ascii'
# Looks like you failed 2 tests of 10.
t/07mason... Dubious, test returned 2 (wstat 512, 0x200)
 Failed 2/10 subtests

Test Summary Report
---
t/05template (Wstat: 512 Tests: 11 Failed: 2)
  Failed tests:  8, 10
  Non-zero exit status: 2
t/06config  (Wstat: 512 Tests: 13 Failed: 2)
  Failed tests:  10, 12
  Non-zero exit status: 2
t/07mason   (Wstat: 512 Tests: 10 Failed: 2)
  Failed tests:  7, 9
  Non-zero exit status: 2
Files=6, Tests=40,  3 wallclock secs ( 0.01 usr  0.07 sys +  0.65 cusr  2.12 
csys =  2.85 CPU)
Result: FAIL
Failed 3/6 test programs. 6/40 subtests failed.
make: *** [test_dynamic] Error 2
  JSHIRLEY/Catalyst-View-Email-0.11.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the 

RE: [Catalyst] Catalyst::View::Email tests failing

2009-02-05 Thread Byron Young

J. Shirley wrote on 2009-02-05:
 On Thu, Feb 5, 2009 at 11:10 AM, Robert L Cochran
 cochr...@speakeasy.net wrote:
 Dangerous? Well I don't think this module runs around with a Uzi
 spraying everyone.
 
 I don't think it is a good practice to force an install on errors. You
 should always get to the bottom of why the errors are happening to
 start with. Once you do and have applied a fix, it should install
 cleanly, and you will be a better programmer for having investigated
 the cause.
 
 Bob
 
 
 
 Hi Bob,
 
 As a matter of etiquette, please don't top-post.  Put your reply below
 in the thread to keep things consistent.
 
 In this case, the test failures are actually a problem that was resolved
 in Email::MIME::Creator and while it certainly doesn't carry firearms,
 it can break your application under certain circumstances.
 
 I think, relatively speaking, that counts as dangerous.
 
 However, I'm just totally going crazy and senile.  I misread the test
 failure, as I already have a fixed version that never made it to CPAN
 though I would have sworn under oath it actually did.
 
 Catalyst::View::Email 0.12 just shipped to CPAN, that should resolve the
 error and had the fixed version of Email::MIME::Creator listed as a
 dependency.
 
 Thanks,
 -J

Thanks for the quick fix, J.  My Email::MIME::Creator is up to date at v1.455.  
I grabbed 
ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module/Catalyst/Catalyst-View-Email-0.12.tar.gz
 and the tests worked.

Thanks
Byron



___
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: Supressing passwords in debug messages

2009-01-30 Thread Byron Young
Tomas Doran wrote on 2009-01-29:
 
 On 29 Jan 2009, at 18:53, Byron Young wrote:
 
 Hi - I'm not sure what the repost policy on patches, but I have the
 feeling this one slipped through the cracks.  Let me know if it's
 generally annoying to repost stuff.
 
 No, reposting if things get dropped on the floor good :)
 
 If you have time, then arriving on #catalyst-dev and making noise
 also gets stuff done.
 
 This is a patch that allows you to suppress printing the value of
 certain query or body parameters when running Catalyst in debug
 mode - For example, if you want to hide passwords sent from the
 login page, you can put this in your app config (yaml):
  Having been discussed in #catalyst-dev, we think that the patch could
 be made both more generic, and more elegant.
 
 The key thing is to split the table drawing, and the data filtering
 into separate methods (maybe filter_debug_data?).
 
 This would then allow you to filter per-type, and support things such as
  redact_parameters (all), redact_body_parameters,
 redact_query_parameters, and even potentially to add support for
 filtering things like the URI (I can see use-cases where that'd be
 significant - e.g. not wanting to log session IDs which are in URIs)..
 
 Have a look at the way the debug screen stuff works (in
 Catalyst::Engine), this is more elegant and would also benefit from
 being able to have things redacted I guess - as with the current
 patch, you're going to display the things you're redacting in the
 logs to the end user...
 
 Cheers
 t0m
 

Tom,

Thanks for the feedback.  I think you're referring to $c-dump_these() and it's 
usage in finalize_error().  I'll refactor log_parameters() to call a separate 
method that will return the params to log, akin to dump_these().  Not sure when 
I'll have time for it since my current solution is working for me and I have 
some big deadlines coming up.  Hopefully within the next month.

Thanks
byron


___
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: Supressing passwords in debug messages

2009-01-29 Thread Byron Young
Hi - I'm not sure what the repost policy on patches, but I have the feeling 
this one slipped through the cracks.  Let me know if it's generally annoying to 
repost stuff.

This is a patch that allows you to suppress printing the value of certain query 
or body parameters when running Catalyst in debug mode - For example, if you 
want to hide passwords sent from the login page, you can put this in your app 
config (yaml):

Debug:
  redact_parameters: 
- password

and the resulting log will look like:

[debug] Query Parameters are:
 .-+--.
 | Parameter   | Value|
 +-+--+
 | password| (redacted by config) |
 | username| some_user|
 '-+--'

There are two patches attached
  - redact-patch.diff - contains patch and test
  - cookbook-patch.diff - patch for cookbook entry about this

Thanks to J Shirley for help with this.

Thanks
Byron


Byron Young wrote on 2009-01-16:
 -Original Message-
 From: Byron Young [mailto:byron.yo...@riverbed.com]
 Sent: Friday, January 16, 2009 6:39 PM
 To: The elegant MVC web framework
 Subject: RE: [Catalyst] Re: Supressing passwords in debug messages
 
 Byron Young wrote on 2009-01-12:
 
 J. Shirley wrote on 2009-01-12:
 On Mon, Jan 12, 2009 at 2:35 PM, Byron Young
 byron.yo...@riverbed.com wrote:
 J. Shirley wrote on 2009-01-12:
 On Mon, Jan 12, 2009 at 10:45 AM, Byron Young
 byron.yo...@riverbed.com wrote:
 
 [snip]
 
 The patch I'm creating needs to be configured in some way, I am
 thinking at this point it can be configured as follows:
 
 package MyApp;
 
 __PACKAGE__-config(
 'Debug' = {
 skip_dump_parameters = 1, # Simply don't render the
 parameters incoming, very shotgunny skip_dump_parameters =
 [ qw/password/ ], # Show '(redacted
 by
 config)' as the value of these fields
 }
 );
 
 I'll need to bake tests for this, which there are currently no tests
 for handling the dumping of parameters so it will be a bit more. If
 someone wants to help with that, let me know and I can help guide.
 
 -J
 
 
 I'd be happy to write some unit tests.  I haven't worked with
 any
 of the Catalyst unit tests before so I'm not sure what the process is
 like for getting the code, setting up the test environment, making and
 submitting changes and unit tests, etc.  Is there a doc you can point
 me to?  I don't see anything in the manual or wiki.
 
 Byron
 
 Mostly it is just checking out the code from svn and starting.
 The
 patch that I've started is at http://scsys.co.uk:8001/22410 - you can
 apply this to a svn checkout of
 http://dev.catalystframework.org/repos/Catalyst/Catalyst- Runtime/5.70
 
 It doesn't have the actual testing part, just a stub.  I'll be working
 on it more over today and tomorrow when I get free moments, but
 they're few and far between.
 
  Ditto on the lack of free time.  I'll check it out and let you know
 what I come up with.
 
 byron
 
 
 J Shirley - I finally got a chance to look at this today.  You did
 most of the work for me.  I just updated the unit test, changed the
 'skip_dump_parameters' parameter to 'redact_parameters', and
 expanded the log_parameters() documentation a bit.  I also added a
 section to the cookbook explaining how to use the parameter.
 
 Attached are two patches:
   redact-patch.diff - patch containing the new unit test and changes to
   Catalyst.pm. cookbook-patch.diff - patch containing a new cookbook
   section on
 this feature, for the Catalyst-Manual repository
 
 Anything else I need to do?
 
 Byron




redact-patch.diff
Description: redact-patch.diff


cookbook-patch.diff
Description: cookbook-patch.diff
___
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] generic way of session has expired message?

2009-01-28 Thread Byron Young

Jens Schwarz wrote on 2009-01-28:
 Hi,
 
 I there some generic way of providing a session has expired
 message to the user after a session has expired? I don't know how
 to distinct between a user whose session just expired and a user
 that has not yet logged in (a session has expired message does
 not make sense for the latter one).
 
 Any hints?
 
 Thanks
 
 Jens -- NUR NOCH BIS 31.01.! GMX FreeDSL - Telefonanschluss + DSL für
 nur 16,37 EURO/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

Hi Jens

I haven't used it myself, but check out $c-session_delete_reason() in the 
Catalyst::Plugin::Session docs.

Byron

___
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: OT: Better TT pager?

2009-01-22 Thread Byron Young
Aristotle Pagaltzis wrote on 2008-12-24:

[snip]

 This is also a perfect demonstration of why I say that TT sucks.
 This should by all rights be handled in the template since it’s
 display logic, but writing it in that TT mini-language rather
 than Perl is fugly. And PERL and RAWPERL blocks have their own
 problems. Anyway. Someday I’ll quit yapping and write some code.

Have you tried Mason?  It's delicious.

Byron
___
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: Supressing passwords in debug messages

2009-01-16 Thread Byron Young
Byron Young wrote on 2009-01-12:

 J. Shirley wrote on 2009-01-12:
 On Mon, Jan 12, 2009 at 2:35 PM, Byron Young
 byron.yo...@riverbed.com wrote:
 J. Shirley wrote on 2009-01-12:
 On Mon, Jan 12, 2009 at 10:45 AM, Byron Young
 byron.yo...@riverbed.com wrote:

 [snip]

 The patch I'm creating needs to be configured in some way, I am
 thinking at this point it can be configured as follows:

 package MyApp;

 __PACKAGE__-config(
 'Debug' = {
 skip_dump_parameters = 1, # Simply don't render the
 parameters incoming, very shotgunny skip_dump_parameters = [
 qw/password/ ], # Show '(redacted
 by
 config)' as the value of these fields
 }
 );

 I'll need to bake tests for this, which there are currently no tests
 for handling the dumping of parameters so it will be a bit more. If
 someone wants to help with that, let me know and I can help guide.

 -J


 I'd be happy to write some unit tests.  I haven't worked with
 any
 of the Catalyst unit tests before so I'm not sure what the process is
 like for getting the code, setting up the test environment, making and
 submitting changes and unit tests, etc.  Is there a doc you can point
 me to?  I don't see anything in the manual or wiki.

 Byron

 Mostly it is just checking out the code from svn and starting.
 The
 patch that I've started is at http://scsys.co.uk:8001/22410 - you can
 apply this to a svn checkout of
 http://dev.catalystframework.org/repos/Catalyst/Catalyst- Runtime/5.70

 It doesn't have the actual testing part, just a stub.  I'll be working
 on it more over today and tomorrow when I get free moments, but they're
 few and far between.


 Ditto on the lack of free time.  I'll check it out and let you know
 what I come up with.

 byron


J Shirley - I finally got a chance to look at this today.  You did most of the 
work for me.  I just updated the unit test, changed the 'skip_dump_parameters' 
parameter to 'redact_parameters', and expanded the log_parameters() 
documentation a bit.  I also added a section to the cookbook explaining how to 
use the parameter.

Attached are two patches:
  redact-patch.diff - patch containing the new unit test and changes to 
Catalyst.pm.
  cookbook-patch.diff - patch containing a new cookbook section on this 
feature, for the Catalyst-Manual repository

Anything else I need to do?

Byron


redact-patch.diff
Description: redact-patch.diff


cookbook-patch.diff
Description: cookbook-patch.diff
___
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: Supressing passwords in debug messages

2009-01-12 Thread Byron Young
Ansgar Burchardt wrote on 2009-01-11:
 Hi,

 J. Shirley jshir...@gmail.com writes:
 === lib/Catalyst.pm

 == ---
 lib/Catalyst.pm   (revision 18145) +++ lib/Catalyst.pm   (local) @@
 -1830,7 +1830,11 @@

  if ( $c-debug  keys %{ $c-request-query_parameters } )
 {
  my $t = Text::SimpleTable-new( [ 35, 'Parameter' ], [
 36, 'Value' ] );
 +my %skip = map { $_ = $_ } @{
 +$c-config-{'Plugin::Debug'}-
 {'skip_dump_parameters'} || []
 +};
  for my $key ( sort keys %{ $c-req-query_parameters } )
 {
 +next if $skip{$key};
  my $param = $c-req-query_parameters-{$key};
  my $value = defined($param) ? $param : '';
  $t-row( $key,

 I think it would be better to show that the parameter was sent, but
 Catalyst configured to not display its value.  This can be done for
 example by displaying a value of `(hidden)'.

 If the parameter is simply skipped, it might be confusing if you forget
 that you configured Catalyst to not display it.

 Regards,
 Ansgar


Yeah, I agree that the parameter should be shown as sent, but just not show the 
value.

J Shirley - Thanks for looking into it.  Let me know if there's anything I can 
do to help.

Thanks,
Byron


___
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: Supressing passwords in debug messages

2009-01-12 Thread Byron Young
J. Shirley wrote on 2009-01-12:
 On Mon, Jan 12, 2009 at 10:45 AM, Byron Young
 byron.yo...@riverbed.com wrote:
 Ansgar Burchardt wrote on 2009-01-11:
 Hi,

 J. Shirley jshir...@gmail.com writes:
 === lib/Catalyst.pm


 ==
 ---
 lib/Catalyst.pm   (revision 18145) +++ lib/Catalyst.pm (local) @@
 -1830,7 +1830,11 @@

  if ( $c-debug  keys %{ $c-request-query_parameters }
 )
 {
  my $t = Text::SimpleTable-new( [ 35, 'Parameter' ], [
 36, 'Value' ] );
 +my %skip = map { $_ = $_ } @{
 +$c-config-{'Plugin::Debug'}-
 {'skip_dump_parameters'} || []
 +};
  for my $key ( sort keys %{ $c-req-query_parameters }
 )
 {
 +next if $skip{$key};
  my $param = $c-req-query_parameters-{$key};
  my $value = defined($param) ? $param : '';
  $t-row( $key,
  I think it would be better to show that the parameter was sent, but
 Catalyst configured to not display its value.  This can be done for
 example by displaying a value of `(hidden)'.

 If the parameter is simply skipped, it might be confusing if you
 forget that you configured Catalyst to not display it.

 Regards,
 Ansgar

  Yeah, I agree that the parameter should be shown as sent, but just not
 show the value.

 J Shirley - Thanks for looking into it.  Let me know if there's
 anything I can do to help.

 Thanks,
 Byron



 The patch I'm creating needs to be configured in some way, I am
 thinking at this point it can be configured as follows:

 package MyApp;

 __PACKAGE__-config(
 'Debug' = {
 skip_dump_parameters = 1, # Simply don't render the parameters
 incoming, very shotgunny skip_dump_parameters = [ qw/password/
 ], # Show '(redacted
 by
 config)' as the value of these fields
 }
 );

 I'll need to bake tests for this, which there are currently no tests for
 handling the dumping of parameters so it will be a bit more. If someone
 wants to help with that, let me know and I can help guide.

 -J


I'd be happy to write some unit tests.  I haven't worked with any of the 
Catalyst unit tests before so I'm not sure what the process is like for getting 
the code, setting up the test environment, making and submitting changes and 
unit tests, etc.  Is there a doc you can point me to?  I don't see anything in 
the manual or wiki.

Byron

___
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: Supressing passwords in debug messages

2009-01-12 Thread Byron Young

J. Shirley wrote on 2009-01-12:
 On Mon, Jan 12, 2009 at 2:35 PM, Byron Young
 byron.yo...@riverbed.com wrote:
 J. Shirley wrote on 2009-01-12:
 On Mon, Jan 12, 2009 at 10:45 AM, Byron Young
 byron.yo...@riverbed.com wrote:

[snip]

 The patch I'm creating needs to be configured in some way, I am
 thinking at this point it can be configured as follows:

 package MyApp;

 __PACKAGE__-config(
 'Debug' = {
 skip_dump_parameters = 1, # Simply don't render the
 parameters incoming, very shotgunny skip_dump_parameters = [
 qw/password/ ], # Show '(redacted
 by
 config)' as the value of these fields
 }
 );

 I'll need to bake tests for this, which there are currently no tests
 for handling the dumping of parameters so it will be a bit more. If
 someone wants to help with that, let me know and I can help guide.

 -J


 I'd be happy to write some unit tests.  I haven't worked with any
 of the Catalyst unit tests before so I'm not sure what the process
 is like for getting the code, setting up the test environment,
 making and submitting changes and unit tests, etc.  Is there a doc
 you can point me to?  I don't see anything in the manual or wiki.

 Byron

  Mostly it is just checking out the code from svn and starting.  The
 patch that I've started is at http://scsys.co.uk:8001/22410 - you can
 apply this to a svn checkout of
 http://dev.catalystframework.org/repos/Catalyst/Catalyst- Runtime/5.70

 It doesn't have the actual testing part, just a stub.  I'll be working
 on it more over today and tomorrow when I get free moments, but they're
 few and far between.


Ditto on the lack of free time.  I'll check it out and let you know what I come 
up with.

byron


___
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] Supressing passwords in debug messages

2009-01-09 Thread Byron Young
Jesse Sheidlower wrote on 2009-01-07:
 On Wed, Jan 07, 2009 at 10:39:34AM -0800, Byron Young wrote:
 I like the CATALYST_DEBUG mode for the test server - it's really
 nice to be able to see all the GET and POST params and requests as
 they happen.  However, my app uses LDAP authentication and I really
 don't want people's LDAP passwords getting printed with the rest of
 the parameters.

 Is there a way to suppress certain parameters from being printed?
 I didn't see anything in the docs about it, but thought I'd ask
 before jumping into the code.


 This is a FAQ:

 http://dev.catalystframework.org/wiki/faq

 How do I hide certain variables (e.g. user/password) from the
 debug screen?

 Jesse Sheidlower


Jesse,

Thanks for the reply, but that doesn't quite do what I'm asking (or I'm using 
it wrong?).  I mean the debug log that's prints request info when -Debug or 
CATALYST_DEBUG is turned on.  For example:

[debug] Body Parameters are:
.-+--.
| Parameter   | Value|
+-+--+
| password| REDACTED |
| submit  | Go   |
| username| youngb   |
'-+--'
[debug] POST request for login from 10.16.5.10
[debug] Path is login
[debug] Found sessionid e4202e839e17004bc05baff653ad659f7b165ee7 in cookie
[debug] Restored session e4202e839e17004bc05baff653ad659f7b165ee7
[debug] Icebox::Controller::Login - Found username youngb, attempting login
[debug] Icebox::Controller::Login - LDAP login successful for youngb
[debug] Icebox::Controller::Login - Database login successful for youngb
[debug] ***Login::index - redirecting to http://icebox-dev.lab.nbttech.com:3000/
[debug] Redirecting to http://icebox-dev.lab.nbttech.com:3000/;
[info] Request took 1.282297s (0.780/s)
.+---.
| Action | Time  |
++---+
| /auto  | 0.000270s |
| /login/index   | 0.078559s |
| /end   | 0.000765s |
'+---'


It's in that 'Body Parameters' section that I don't want the password to be 
displayed.  It ends up there in plain text if debugging is turned on.  Is there 
a simple way to remove or it or replace the value with ''?


 (but thanks for the link to the FAQ - I was only reading the POD.  I have been 
using Catalyst for a while and have never seen a link to the Catalyst Wiki 
before - Maybe it would be a good idea to add a link to the Manual?)

Thanks,
Byron

___
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] Supressing passwords in debug messages

2009-01-07 Thread Byron Young
I like the CATALYST_DEBUG mode for the test server - it's really nice to be 
able to see all the GET and POST params and requests as they happen.  However, 
my app uses LDAP authentication and I really don't want people's LDAP passwords 
getting printed with the rest of the parameters.

Is there a way to suppress certain parameters from being printed?  I didn't see 
anything in the docs about it, but thought I'd ask before jumping into the code.

Thanks,
Byron

___
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] configuring plugin's

2008-06-30 Thread Byron Young

Dermot wrote on 2008-06-30:
 Hi,

 I seem to be struggling with the configuring of plugins, in this case
 Authorization::Roles.

 I have the following in lib/MyApp.pm

 __PACKAGE__-setup(qw/-Debug
 ConfigLoader
 Static::Simple
 StackTrace
 Authentication
 Authorization::Roles
 Session::State
 Session::Store
 Session::Store::FastMmap
 Session
 /);

 and MyApp.yml has

 name: MyApp
 Model::MyAppDB:
   connect_info:
 - DBI:SQLite:__HOME__/MyApp.db
 Authentication:
  default_realm: user
  realms:
   user:
credential:
 class: Password password_field: password password_type: clear store:
 class: DBIx::Class user_class: UsersRoles role_relation: role_id
 role_field: role
  I think that all the above is correctly configured. The grapping void
 in my understanding is making the schema available in my methods. So

 sub list : Local {
   my ($self, $c) = @_;
   print STDERR login=,$c-check_roles('admin'),\n;
   $c-detach('denied') unless $c-check_roles('admin');
   $c-stash-{stuff} = [$c-model('MyAppDB::Stuff')-all];
   $c-stash-{template} = 'submissions/list.tt2
 }

 Give me the error:

 Can't locate object method asser_user_roles via package MyApp


Looks like you have a typo somewhere.  Should be 'assert_user_roles', maybe?

byron


___
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] Multiple inheritance of controllers

2008-06-13 Thread Byron Young
I ran into the same problem.  But I found that adding this to my controllers 
that inherit from multiple controller base classes works as a work around:

use Class::C3;

sub create_action {
my $self = shift;

return $self-maybe::next::method(@_);
}

It's an annoying workaround, but I didn't have time to pursue the issue any 
further :P  Does anybody know why this might be happening?

Anyway, I hope that helps somewhat..

Byron


Zbigniew Lukasiak wrote on 2008-06-13:
 I've tried to build a module that would merge two base controllers and
 then use it as another base controller.  Unfortunately it looks like
 only actions from the first base class in the 'use base ...' phrase are
 being inherited:

 I've created a test case for that - it is attached and I paste it
 below for your convenience.

 If someone sent me some instructions how to modify it to fit into the
 Moose model I'll test it on the Moose branch as well (I am not sure if
 they would be base controllers there at all - perhaps Roles instead?).

 Cheers,
 Zbigniew


 package TestApp::Controller::Action::SubclassedChained;
 use strict;
 use warnings;

 use base qw/Intermediate/;
 1;

 ==
 package Intermediate; use strict; use warnings;

 use base qw/Catalyst::Controller::REST Base/;  # this one does not
 inherit actions from Base
 #use base qw/Base Catalyst::Controller::REST/; # this one does

 1; ==
 package Base; use strict; use warnings;

 use base qw/Catalyst::Controller/;

 sub basefoo  :CaptureArgs(1) :Chained('/') { }
 sub baseendpoint :Args(1) :Chained('basefoo') { }
 1;



 --
 Zbigniew Lukasiak
 http://brudnopis.blogspot.com/
 http://perlalchemy.blogspot.com/


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


RE: [Catalyst] Using URIs for my app in another program

2008-06-06 Thread Byron Young

Tomas Doran wrote on 2008-06-06:

 On 7 Jun 2008, at 01:17, Byron Young wrote:
 Is there any way to fake a request when my app starts?  It seems
 like a bit of a catch-22 -- I need to know a URL in order to fake
 the request, but in order to generate the URL I need to have a
 request...
  The problem which you have here is that the application doesn't know
 what URLs it's attached to until run time.

 Remember - you can have multiple virtual hosts pointing to the same
 application instance, therefore catalyst *can't* know in advance
 where it is going to be served from.


True.  All I need to know in this case is just one valid URL, though.

 The simple perl HTTP engine which script/myapp_server.pl uses prints a
 nice message with the app URL - but that's because it's a toy compared
 to what you might do in real deployment.

 Am I doomed to storing the URL for my 'populate database with urls'
 action in a config file and updating it by hand when I move the web app?
  I think so, but I think that you *want* to do this. Otherwise, how do
 you deal with testing the app? And also testing your thing which
 requests the app. Surely you're gonna want to be able to test against
 demo servers you've brought up on localhost?


Actually, that's specifically the use case I'm thinking of here.  Each 
developer on this project has his own testing setup on the dev machine, while 
the production version runs on another host.  Each test setup includes a 
database, daemon, and web app.  We do use config files to point everything to 
the right codebase and database, so it's not the end of the world to add 
another entry for the url, but I try to be careful of the amount of 
configuration we need.  I want to avoid the situation where a developer forgets 
to change his dev config file to point to his dev web app and so his daemon 
ends up talking to the production server instead, potentially resulting in 
something bad happening.  So, if there is some totally automated way to do 
things instead, I opt for that.

Of course, this may just be exposing some bad practices on our end wrt to dev 
environments and config files and protecting the production server from 
fallible developers such as myself.

 I think that you're trying to solve the wrong problem here, sorry. To be
 honest - how often are you really going to move the webapp once it's
 deployed? What's wrong with giving it it's own DNS CNAME which you
 switch between boxen hosting it?


Yeah, that's true - we probably won't move the production app, and we'll use a 
CNAME if we do.

Thanks for your help
Byron

 Cheers
 Tom




___
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] Using URIs for my app in another program

2008-05-01 Thread Byron Young
Hi all

I've run into a situation that I can't find a good solution to and am hoping to 
solicit some ideas from people on the list here.

An app I've been working on consists of two main parts - a Catalyst-based web 
app which provides the UI, and a daemon that does the heavy lifting.  They are 
totally separate applications that talk to one another via database.  The 
daemon will sometimes send emails to users when it finishes certain tasks that 
the users are interested in, and I want to include links in the emails that 
would bring the user to a Results page on the web app where they can get more 
information about the result of the task.

So, what I would like is to be able to call $c-uri_for() from my daemon.  Is 
there any 'sanctioned' way of doing that?  If possible, I'd like to avoid 
loading my whole catalyst app and somehow tricking it into believing its 
running under the same environment as my real app.

Another option is to use the database to pass URIs around.  Maybe a URI table 
that maps finished tasks to URIs.  However, I would rather just be able to 
arbitrarily call $c-uri_for() whenever I decide I need to include a URI in my 
daemon instead of having to create a table or column whenever I decide I want 
to send a link to a new type of resource.

Any suggestions?  Maybe I'm just going about it all wrong?

Thanks!

Byron

___
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] Using URIs for my app in another program

2008-05-01 Thread Byron Young
Ah, right, I need a HTTP request to get base.  I wasn't thinking straight about 
that.

I think storing links in the database is what I'll do, because that leaves the 
responsibility of generating URIs solely with the catalyst app.  If I refactor 
code or move things around I don't want to have to update my daemon at all.

Thanks for your feedback, Robert.

Byron

From: Robert Krimen [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 01, 2008 3:34 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Using URIs for my app in another program

The most straightforward method I can think of is to factor out the URIs to a 
common config file.

You can have your daemon read in the config file and generate URIs from that. 
Your Catalyst application can either continue to use
base to generate URIs or you can generate some special URIs from the config 
file as well.

The problem with having your daemon load up Catalyst to generate a URI is that 
I'm not sure how that would work. Catalyst generates URIs
given a HTTP request. No HTTP request, no base URI.

Another safety measure is that you can have your Catalyst appl do a sanity 
check against the URI config file to make sure it doesn't become out of date 
(maybe a startup test request).

Rob
On Thu, May 1, 2008 at 2:27 PM, Byron Young [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] wrote:
Hi all

I've run into a situation that I can't find a good solution to and am hoping to 
solicit some ideas from people on the list here.

An app I've been working on consists of two main parts - a Catalyst-based web 
app which provides the UI, and a daemon that does the heavy lifting.  They are 
totally separate applications that talk to one another via database.  The 
daemon will sometimes send emails to users when it finishes certain tasks that 
the users are interested in, and I want to include links in the emails that 
would bring the user to a Results page on the web app where they can get more 
information about the result of the task.

So, what I would like is to be able to call $c-uri_for() from my daemon.  Is 
there any 'sanctioned' way of doing that?  If possible, I'd like to avoid 
loading my whole catalyst app and somehow tricking it into believing its 
running under the same environment as my real app.

Another option is to use the database to pass URIs around.  Maybe a URI table 
that maps finished tasks to URIs.  However, I would rather just be able to 
arbitrarily call $c-uri_for() whenever I decide I need to include a URI in my 
daemon instead of having to create a table or column whenever I decide I want 
to send a link to a new type of resource.

Any suggestions?  Maybe I'm just going about it all wrong?

Thanks!

Byron

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

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


RE: [Catalyst] Using URIs for my app in another program

2008-05-01 Thread Byron Young
J. Shirley wrote on 2008-05-01:
 On Thu, May 1, 2008 at 4:00 PM, Byron Young
 [EMAIL PROTECTED] wrote:




 Ah, right, I need a HTTP request to get base.  I wasn't thinking
 straight about that.



 I think storing links in the database is what I'll do, because that
 leaves the responsibility of generating URIs solely with the catalyst
 app.  If I refactor code or move things around I don't want to have to
 update my daemon at all.



 Thanks for your feedback, Robert.

  Another option is to use a distributed cache system like memcached.
 Pretty easy to setup, and then you can have a warm cache action that
 populates the configured URIs in the cache.  So, your daemon queries
 cache, if it comes up empty then make a call out to the app to generate
 the URLs and stuff them in cache.

 -J

Hey J.  Yes, that could work too, but it requires making a call to the catalyst 
app, which means at least one hard-coded url will be in the daemon.  I 
considered having a page on my app that would just serve up a requested url, 
which is similar to your proposal, but I'd rather avoid hard-coding any urls in 
the daemon.

Thanks for the suggestion.

byron

___
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] Usage of $c-uri_for and $c-res-redirect

2008-04-02 Thread Byron Young
 -Original Message-
 From: Dustin Suchter [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2008 5:44 PM
 To: The elegant MVC web framework
 Subject: Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

 So I tried to look at the source of the test that failed, and I'm
 not sure I even understand what it is doing. Here's the actual
 error
 message I'm getting:

 t/01useok
 t/02podskipped: set TEST_POD to enable this test
 t/03podcoverageskipped: Test::Pod::Coverage 1.04 required
 t/04ssl1/15
 #   Failed test 'redirect uri ok'
 #   at t/04ssl.t line 43.
 #  got: 'http://localhost:443/ssl/unsecured'
 # expected: 'http://localhost/ssl/unsecured'

 #   Failed test 'redirect with params ok'
 #   at t/04ssl.t line 47.
 #  got:
 'http://localhost:443/ssl/unsecured?a=1a=2b=3c=4'
 # expected: 'http://localhost/ssl/unsecured?a=1a=2b=3c=4'
 # Looks like you failed 2 tests of 15.
 t/04ssl Dubious, test returned 2 (wstat 512, 0x200)
   Failed 2/15 subtests
 t/05ssl_host...ok
 t/06remain_in_ssl..ok

 The top error came from:

 40 # test redirect back to http mode
 41 ok( $res = request('https://localhost/ssl/unsecured'),
 'request ok' );
 42 is( $res-code, 302, 'redirect back to http ok' );
 43 is( $res-header('location'),
 'http://localhost/ssl/unsecured', 'redirect uri ok' );

 So I'm guessing that line #41 is trying to request a secure action
 that would normally redirect you back to an insecure place. This
 jives, because it is requesting an HTTPS URL. However, If I am
 right, then why is it considered a failure to end up on a non-
 secure
 URL? I guess I don't understand what these tests are doing.

 -d





 Those don't make sense to anyone else, either, right? I mean, if
 you
 are going to request a URL from port 443,



Heh, you know, I think I force installed that plugin because those test results 
looked like false negatives.  It has been working fine for me, though.  I 
probably should have investigated it more, but I just went with it and never 
looked back.  I'm going to be installing a bunch of the catalyst modules on 
another server this week, so I'll let you know if I run into the same thing 
again, and I'll try to look into it if I have time.

Byron


 Dustin Suchter wrote:
  So I like the idea of the plugin, but I'm having a hard time
 installing
  it. I found one hit on the Internet that with a report of someone
 else
  having the exact same problem as me, but I don't see the solution
 online:
 
 
 http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.
 html
 
  Any ideas?
 
  Byron Young wrote:
  -Original Message-
  From: Dustin Suchter [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, March 26, 2008 1:13 PM
  To: The elegant MVC web framework
  Subject: [Catalyst] Usage of $c-uri_for and $c-res-redirect
 
  Let's say I want to send people back and forth between an HTTP
  connection and an HTTPS connection on a server based on some
  action. For
  example, clicking on a logout button from within my
 application
  while
  connected via HTTPS does something like:
 
  $c-res-redirect(http://foo.com/;);
 
  The above seems like a fine solution except it totally
 disregards
  the
  beauty of uri_for, which I would love to be using for stuff
 like
  this.
  Without uri_for, problems arise when you do things like test
 via
  the
  built in Perl webserver (the one running on port 3000 by
 default)
  while
  on the same webserver as my production application.
 
  So the real question is, how do I properly refer to my
 webserver
  and/or
  application root and include port or SSL flags? I guess I'm
 looking
  for
  something like $0 within uri_for.
 
  -d
 
  Hey Dustin,
 
  There's actually a neat plugin for doing this called
  Catalyst::Plugin::RequireSSL.  You just include it in your
 plugins and
  then call $c-require_ssl() at the top of any actions you want
 to use
  SSL for.  It will disable itself automatically on the test
 server, too.
 
  Cheers,
  Byron
 
  ___
  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/


RE: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-03-26 Thread Byron Young
 -Original Message-
 From: Dustin Suchter [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 26, 2008 1:13 PM
 To: The elegant MVC web framework
 Subject: [Catalyst] Usage of $c-uri_for and $c-res-redirect

 Let's say I want to send people back and forth between an HTTP
 connection and an HTTPS connection on a server based on some
 action. For
 example, clicking on a logout button from within my application
 while
 connected via HTTPS does something like:

 $c-res-redirect(http://foo.com/;);

 The above seems like a fine solution except it totally disregards
 the
 beauty of uri_for, which I would love to be using for stuff like
 this.
 Without uri_for, problems arise when you do things like test via
 the
 built in Perl webserver (the one running on port 3000 by default)
 while
 on the same webserver as my production application.

 So the real question is, how do I properly refer to my webserver
 and/or
 application root and include port or SSL flags? I guess I'm looking
 for
 something like $0 within uri_for.

 -d

Hey Dustin,

There's actually a neat plugin for doing this called 
Catalyst::Plugin::RequireSSL.  You just include it in your plugins and then 
call $c-require_ssl() at the top of any actions you want to use SSL for.  It 
will disable itself automatically on the test server, too.

Cheers,
Byron

___
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] On authentication again

2008-03-06 Thread Byron Young
Alex Povolotsky wrote:
 I even don't understand what __PACKAGE__-config- I should use -
 {'Plugin::Authentication'}, {authentication}
 or{authentication}{dbic}.
 Docs are unclear.
 

Alex,

It should be {authentication}.  Here's mine:

authentication:
default_realm: database
realms:
database:
credential:
class: Password
password_field: password
password_type: hashed
password_hash_type: SHA-1
store: 
class: DBIx::Class
user_class: DB::Users
id_field: username
role_field: name
role_relation: roles

Hope that helps

Byron

___
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] Base controllers and multiple inheritance

2008-03-06 Thread Byron Young
Peter Karman wrote:
 Byron Young wrote on 3/5/08 4:29 PM:
 
 
 Everything looks good, right?  My List actions work! However, the
 CRUD actions don't work because the FormConfig actions seem to have
 been ignored -- $c-stash-{form} is undef :(
 
 I wouldn't expect anything in stash() to persist from request to
 request. Don't do anything with stash during new(). new() is called
 once per app life, at startup. stash() is for each request.
 

Peter - thanks for taking the time to respond.

Sorry, I was unclear about that $c-stash-{form} comment.
$c-stash-{form} is created by the FormConfig action provided by
Catalyst::Controller::HTML::FormFu, which is a base class of my CRUD
base controller.  For some reason, even though it appears new() is being
called down both inheritance chains, the HTML::FormFu actions aren't set
up properly.

I want to be using new() in my base controllers mainly to set up and
error check config().  I understand it's only called once per app life -
I don't want to do config() error checking every request.

$class-NEXT::new() doesn't do the right thing with this crazy
diamond-ish inheritance I have, and I think using Class::C3 in my base
classes while Catalyst::Controller and C::C::HTML::FormFu use NEXT is
causing some problems.  I'll try to reproduce the behavior with a small
test later.  I guess it's not really Catalyst-specific, but I figured
Catalyst people would know since I saw some notes in the docs about
wanting to switch Catalyst over to c3.

My workaround for now is to have new() in each of my actual controller
classes which passes control up to Catalyst::Controller::new() and then
calls each superclass's __setup() method specifically.  I don't like
doing it this way, but for now I need to just keep moving ahead with
this project so I will leave it until a better solution appears.

 
 Does anyone have any suggestions?  Should I just forego using new()
 and do initial setup the first time auto() is called in each of my
 base controllers?
 
 depends on what kind of thing you are setting up. I have used multiple
 inheritance in my controllers to good effect (see
 CatalystX::CRUD::Controller
 and its descendents for example). In general, only set up things in
 new() (or its cousins) for stuff you want to set up once per app:
 config, persistent objects, etc. IME, there isn't much you want like
 that.

I think the difference between your CX::CRUD::Controller's multiple
inheritance and mine is that you don't have the diamond pattern.

As an aside -- I wish I had seen your CatalystX::CRUD::Controller
before!  I actually based mine off of your C::C::Rose::CRUD but wanted
to use DBIC and C::C::HTML::FormFu, so I made my own.  Anyway, kudos!

Thanks,
Byron

___
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] sending a variable to more than one tt2 template

2008-03-06 Thread Byron Young
You can call another template from within the template you specified in
the stash, and pass the stash parameters along.  I don't use TT, but I
think PROCESS is how you call other templates.
 
HTH
 
Byron



From: Emily Heureux [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 06, 2008 2:36 PM
To: 'The elegant MVC web framework'
Subject: [Catalyst] sending a variable to more than one tt2 template



Hi, I have a variable in a Controller method sent to the stash for a
particular tt file.  What if I want that same variable to be available
to another tt file?  I assume I cannot set two templates in one method.

 

Thanks,

Emily

 

___
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] Base controllers and multiple inheritance

2008-03-04 Thread Byron Young
Hi,

I've been using Catalyst for a project and decided to make some base
controllers for common functionality.  So far I've made two: CRUD, and
List, for standard database operations and for sortable, paged listings
of data.  They work fine on their own but I'm running into trouble with
multiple inheritance.  If I have a controller for some database table
that I want to inherit the actions from both CRUD and List, only the
first one inherited will initialize properly.

The inheritance looks like this:

   Catalyst::Controller
/\
   /  \
  /\
 /Catalyst::Controller::HTML::FormFu
/   |
MyApp::Base::Controller::List   |
\   |
 \MyApp::Base::Controller::CRUD
  \/
   \  /
\/
   MyApp::Controller::SomeDatabaseTable


Each of the controller base classes has a new() method which sets up
config data and does error checking and whatnot.  If I inherit both of
my base classes, only new() on the first inherited is called.  I've
tried calling $class-NEXT::new(@_) in each, and I've also tried
Class::C3's $class-maybe::next::method(@_), but new() is still not
called down the second inheritance chain.  When I tried the Class::C3
approach I called Class::C3::initialize() in MyApp.pm - I wasn't sure
where to call it so I tried before and after MyApp-setup() - still no
luck.

Can somebody tell me why new() isn't called down both paths?

Thanks,
Byron

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