Re: [Catalyst] General Web- and OO-question

2009-03-27 Thread Scott McWhirter
2009/3/27 Cory Watson jheep...@gmail.com:
 2009/3/27 Rodrigo rodrigol...@gmail.com



 But I can't instatiate
 the object because it throws an exception because age is not valid, isn't
 it?



 Or does Moose check constraints only on provided attributes. This can't
 be true
 with required attributes, can it?

 As long as the attribute is not required = 1, no exception is thrown.

 I think you are missing his point.  He wants to instantiate an object from
 the form, but if he uses his Moose object then the things he wants to
 validate (errors) will prevent him from getting an instance of his class.
  If name is required or isa 'Str' then if it gets an arrayref, he can't
 use the object (as either it missing or being the wrong type throws an
 exception).
 I don't know if this is a good idea yet, but it's fairly easy to create a
 proxy object for a given class, less all the validation:
 http://www.pastie.org/429140

 YMMV, but it would do what you want, as you could promote it to a real
 value iteratively after validation...

Why try to make your objects work harder than they have to?

If you have a multi-step process, collect all your data along each
step then initialize your object with the data at the end. If you need
to do validation along the way, you could reuse the moose type
constraints in the classes meta information without constructing an
object.


-- 
-Scott McWhirter- | -Technology Consultant-
[ Cloudtone Studios - http://www.cloudtone.ca ]

___
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] General Web- and OO-question

2009-03-27 Thread Scott McWhirter
On Fri, Mar 27, 2009 at 5:41 PM, Hans Dieter Pearcey
hdp.perl.catalyst.us...@weftsoar.net wrote:
 Another option mentioned elsewhere in the thread is a proxy object.  Moose
 certainly exposes enough metainformation to make this possible, but I think
 there'd still be a good amount of fiddly work required; for example, you'd
 either have to use AUTOLOAD or generate anonymous classes on the fly, or 
 switch
 to an explicit proxy API.

 I don't think any of this is insurmountable; the biggest reason I haven't 
 tried
 one or all of these is that I'm lazy.

No doubt someone could expand upon MooseX::Params::Validate along with
using the metaclass for the Moose Class.


-- 
-Scott McWhirter- | -Technology Consultant-
[ Cloudtone Studios - http://www.cloudtone.ca ]

___
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] Requirements for Catalyst

2009-02-24 Thread Scott McWhirter
On Tue, Feb 24, 2009 at 13:38, Jason Kohles em...@jasonkohles.com wrote:
 EC2 has persistent storage now (now meaning as of last April), so you can
 have volumes on your hosts that are backed by S3, so you don't lose your
 data when the instance goes away.

EBS volumes aren't backed on S3. They are simply persistent block
devices (run on NAS storage) that you can attach and detach from EC2
instances. However, you can snapshot the volume and these snapshots
are stored on S3. The benefit to snapshots is that the snapshots are
incremental backups (only store what has changed since the last
snapshot) and they are stored compressed. To re-initialize a snapshot,
you can simply create a new EBS volume based on a snapshot.

Also important to note is that with EBS volumes, you get charged based
on IO requests as well as the storage space used by the size of the
volume (ie: you have a volume of 180Gb, you get charges for 180Gb of
storage even if you have nothing on it).

 Ultimately though, if you don't need the flexibility of EC2 and are planning
 to just have one host running 24/7, then EC2 is roughly the same price as
 just getting a colocated server somewhere.

For a small instance it's about $75 a month on average to run
(instance hours charges). A large instance is about $300 a month. If
you want to run a database server, i recommend backing onto an EBS
volume and running a large instance... there are some serious
problems with IO performance on the small ec2 instances.

ta!


-- 
-Scott McWhirter- | -konobi-
[ Technology Consultant - Cloudtone Studios ]

___
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] [OT] Catayst-ish PHP web framework?

2009-02-10 Thread Scott McWhirter
On Tue, Feb 10, 2009 at 12:59, Julien Gervais-Bird catal...@jgb.ca wrote:
 So, I'm thinking there's no better place, than Catalist, to ask about a
 good PHP framework, that will make sense to a Catalyster.

 I'm in a similiar situation. I initially attempted to use CakePHP. After
 having wasted too much time with Cake, I switched to Symfony. I'm still in
 the process of learning it (I'm working on their Jobeet tutorial) but I
 already have a much better feeling about it.

 For example, with Cake, I was struggling simply to get the user interface
 language in urls. With Symfony, I just have to follow lesson 19 of their
 Jobeet tutorial.

I've been using CodeIgniter recently and it was pretty reasonable.
It's more like catalyst in terms of providing a structure for
organizing your code, but it doesn't really enforce anything specific
upon you.

As far as MVC frameworks go, I didn't mind it too much.

ta!


-- 
-Scott McWhirter- | -konobi-

___
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 Selenium to test Catalyst app

2009-01-27 Thread Scott McWhirter
You need to be running the Selenium-RC server yourself.

You can get that from http://www.openqa.org/


-- 
-Scott McWhirter- | -konobi-

On Tue, Jan 27, 2009 at 19:15, Daniel Austin daniel.aus...@gmail.comwrote:

 Hi

 Is anyone successfully using Test::WWW::Selenium::Catalyst?

 I can't get the module to install on Fedora. Looking at reports
 JROCKWAY/Test-WWW-Selenium-Catalyst-0.02.tar.gz in cpan suggests that most
 people can't. Have had a look at the doco and checked firefox-bin is in my
 path and LD_LIBRARY_PATH is set but no joy.

 The actual error message I'm getting is

 Can't start selenium: Error requesting
 http://localhost:/selenium-server/driver/:

 If I go to that URL in a browser Selenium responds but with a 403 error
 Forbidden for proxy.

 Have used Selenium successfully for both Rails and Java projects but I
 confess that I find its internals opaque.

 Any ideas? Am running Perl 5.10.0.

 Thanks

 Dan


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


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


Re: [Catalyst] Catalyst modperl - child process segmentation fault

2009-01-05 Thread Scott McWhirter
Hi,

This looks like the general DBI multi-process issue. When you fork any child
processes, any variables in the parent process are copied across, this
includes the filehandle no. for the socket to the mysql server. All of a
sudden you have 50 processes talking down the same wire. What you want to do
is disconnect (but not destroy) the database handle before forking and then
get each child to reconnect() themselves (DBI can deal with pooling
transparently, iirc).

Apache::DBI does this for you, but iirc it doesn't _quite_ work correctly.

ta!


-- 
-Scott McWhirter- | -konobi-

On Mon, Jan 5, 2009 at 11:40, Todd Lyons tly...@ivenue.com wrote:

 On Mon, Jan 5, 2009 at 3:15 AM, Terence Monteiro tere...@deeproot.co.in
 wrote:

  Is it necessary to close open database handles after handling each HTTP
  request? Should I add code in my begin and end actions to open and close
  handles each time? I'm still pulling off hair on this segfault problem.

 It shouldn't be necessary.  You completely throw away the benefits of
 connection pooling if you create/teardown a db connection every single
 webpage access.

  I am initializing the database connection in a Controller. Is
  there any problem in this, though it may not be the best design. Will
  putting the database initialization code in the Model help? I have
 included
  the backtrace for your information. Have I missed anything?

 Model here, works well for us. Ultimately it's up to your if you want
 to try.  I'm not expert enough to know whether it would make a
 difference.

  #0  0xb6038590 in mysql_ping () from /usr/lib/libmysqlclient.so.15
  #1  0xb61e9d93 in XS_DBD__mysql__db_ping () from
  /usr/lib/perl5/auto/DBD/mysql/mysql.so

 What's your max clients set to in mysql?  How many connections are
 open? (show processlist when logged in to mysql as root will be most
 illuminating).

 What's your connection_timeout set to?  If you have a short connection
 timeout, then low traffic will result in db connections getting closed
 by mysql, which DBI only handles if your code is written to handle it
 (though I don't expect this to be a problem because your description
 seems to imply a problem on startup, not while running).

  I don't face the problem when I run apache as a single process
 (MaxClients
  = 1).

 Another problem we had was if you configured pam/nss to use LDAP, when
 apache started and tried to create all the threads at once, not all
 threads were able to get the uid from nss, so some would be the apache
 user, and some would still be root.  Was very strange.  But that
 doesn't sound like what you're seeing either.

 Good luck!
 --
 Regards...  Todd
 All truth passes through three stages. First, it is ridiculed. Second,
 it is violently opposed. Third, it is accepted as being self-evident.

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