Re: [Catalyst] Users of search_extra feature - I need to hear from you.

2011-07-18 Thread Rodrigo
On Mon, Jul 18, 2011 at 3:54 PM, Tomas Doran bobtf...@bobtfish.net wrote:

 Hi

 Is anyone actually using the 'search_extra' feature (as documented here:
 http://search.cpan.org/~**bobtfish/Catalyst-Runtime-5.**
 80032/lib/Catalyst.pm#$c-%**3Elocate_components%28_$setup_**
 component_config_%29http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80032/lib/Catalyst.pm#$c-%3Elocate_components%28_$setup_component_config_%29
 )

 I don't see how it's useful to anyone in its current form, and some of the
 refactoring work being done in a branch is being made much harder due to
 it's existence.

 If you're using this feature in a real application, please shout at me!!


We're using 1) search_extra = [ 'MyAppX' ], as an add-on, non core
namespace 2) {setup_components}-{except} 3) an around 'locate_components'
to filter components in a special mode (which is used under a special flag
which is not being really as far as I remember).

if( $ENV{YELLOW_VERSION} ) {
   around 'locate_components' = sub {
my $orig = shift;
grep !/Blue/, $orig-( @_ );
   };
}


Just like Stephen, I'd say that the 'except' part could be thrown into the
locate_components wrap, which is already doing filtering. But I'm not sure
about search_extra... that could mean running Module::Pluggable again on the
same directories already scanned by the first Catalyst instance (but now
looking for 'MyAppX' packages), unless we could hook into Catalyst's own
Module::Pluggable somehow.

-rodrigo
___
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 Jquery UI Autocomplete widget with Catalyst::View::JSON

2010-04-25 Thread Rodrigo
 I noticed, the Autocomplete plugin waits for String-Array or Object-Array,
 (which
 starts and ends with [ ...] )  but my code always starts and ends with {
 ... } (JSON object type).
 I tried many perl data-structure, but always starts with { ...

 Original working response (with HTML header):

 [ { id: Acrocephalus agricola, label: Paddyfield Warbler, value: 
 Paddyfield Warbler } ]

 My not woking response with JSON header:
 {value:Common Shelduck,id:Tadorna tadorna,label:Common Shelduck}


Have you tried this?

sub request : Local {
my ($self,$c) = @_;
$c-stash-{json} = [ { id=Acrocephalus agricola, label= Paddyfield
Warbler, value= Paddyfield Warbler } ];
$c-forward('View::JSON');
}

It gives me back the following response:

$ curl http://localhost:3000/request http://localhost:3000/test
[{value:Paddyfield Warbler,id:Acrocephalus
agricola,label:Paddyfield Warbler}]

Which works with JQuery's autocomplete example just fine

-rodrigo
___
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] ask for help on table with 2 similar columns

2010-03-18 Thread Rodrigo
On Thu, Mar 18, 2010 at 2:57 PM, nhyda nhydanh...@gmail.com wrote:

 Thank you anyway.
 I think I figure it out, it is just matter in what order you put all the {
 [ (.


Do you really need to create the has_many relationship and do a join? I
would just search in table 2 like this:

my $rs = $c-model('DB::Table2')-search({ -or = [ left='B', right='B' ]
});

-rodrigo
___
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 and wordpress

2010-02-25 Thread Rodrigo
On Thu, Feb 25, 2010 at 4:39 PM, Charles cshtr...@yahoo.com wrote:

 I don't want to implement code for a blog. What's the easiest way to
 incorporate wordpress on my site under my single  catalyst instance .
 I'm going to download the wordpress code and not have it hosted elsewhere.

 I'd like to have the blog like mydomainname.com/blog . I've got a
 root/static/images dir currently where my images live and the
 mydomainname.com/static/images/foo.jpg is all visible . I would think that
 the blog code could go in the static dir but doesn't seem to just work out
 of the box.

 Any hlp apprec as always.

 I'm running catalyst-runtime 5.7014 .

 -C


Catalyst is a Perl engine, Wordpress is a PHP application. I suppose you
have a webserver as a frontend to your Catalyst instance. How about if you
route the /blog path in your webserver (say, Apache) to your Wordpress home
directory? Then setup PHP to run .php flies, etc, as per Wordpress
installation instructions.

-rodrigo
___
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] Could use some help from people with Windows boxen...

2010-02-21 Thread Rodrigo

 What I'd like to know from you is:

 1) How well does it work for you as Catalyst users on Windows?
 2) Any modules that should be removed or added?

 I don't use Catalyst myself yet, I'm just a packager.  Feedback will be
 very helpful.


Hi Curtis, I'm a Windows Catalyst user, just wanted to let you know that my
team and I spend 50% of my development time with Catalyst on Windows, and
it's been working great for us so far.

On the other hand, I haven't been using Windows as a production environment
for a while now. And as far as modules go, the last time I've tried,
::Engine::Prefork didn't work in XP, basically due to the well-known Perl
fork() limitations on Windows.

Great work on Strawberry Professional. I'm looking forward to trying it.

cheers

-rodrigo
___
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] Login as another user ...

2010-01-27 Thread Rodrigo
  
  What's the best way to achieve this? I tried $c-authenticate without a
  password, but this doesn't seem to work.
  
  --
 


I use 2 different authentication realms, ldap (normal login) and none
(single-signon, surrogate) and my login controller decides which one to use,
so that root can surrogate as some other user.

if( $single_signon_user || $surrogate_ok ) {
$c-authenticate({ id=$id }, 'none');
} else {  # normal signon
 $c-authenticate({ id=$id, password=$password }, 'ldap');
}

And I havethe follwoing in myapp.conf:
authentication
default_realm ldap
realms
none
credential
class password
password_field password
password_type none
/credential
store
class null
/store
/none
ldap
  . . .
/ldap
/realms
 . . .
/authentication

The bad part is that you can't rely on $c-user for your user data. The user
object will have different data/methods depending on the realm used. So I
use a MyAppUser class that abstracts that, providing the user data
independent from the realm used.

You can also inherit from the Authentication classes and do your own thing
in there, such as ignore the need for a password. But I found the realm
strategy easy and independent. Besides I often use 4 or 5 auth different
realms simultaneously...

-rodrigo
___
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] Fat Model Methodology?

2010-01-22 Thread Rodrigo
 Then, just define an extra type that corresponds to a Moose type, or
 just some basic rules (varchar/char = Str, etc)


How about a metaclass? That way I could add DBIC metadata to my attributes.

Like this:

has 'name' = (
metaclass = 'DBIC',
is= 'rw',
isa   = 'Str',
dbic = { data_type = 'varchar', size = 50, ... }
);

The Moose class would probably need to inherit from DBIx::Class somehow, so
I can set the table name. But I guess this is just the opposite (use DBIC in
Moose) from what you're suggesting (use Moose in DBIC).

-rod
___
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] Fat Model Methodology?

2010-01-21 Thread Rodrigo
On Thu, Jan 21, 2010 at 6:37 PM, Jeff Albert jralb...@uvic.ca wrote:


 or should I create a separate ‘application object’ model which brokers
 requests from the Controllers and uses the DBIC model to implement them if
 they fit the application’s logic? I’ve looked far and wide to try to better
 understand how this pattern should work, since I can see the benefit of the
 better code reuse and easier maintenance it would entail; I just need some
 advice to get me started. Suggestions?



Cheers,

 Jeff Albert

 jralb...@uvic.ca




I personally try not to put logic in the DBIC schema classes, because I use
Moose features, such as roles, extensively. Hence I end up having many Moose
classes (ie Employee.pm) that look just like their underneath DBIC schema
class (ie Schema/Result/Employee.pm). The Moose class will implement all
complex calculations and validations, and proxy for the bare basic DBIC one.
The decoupling is certainly beneficial, but the attribute redundancy bugs me
nonetheless.

So ideally I would like to have DB entities represented by a single Moose
class, rather than in 2 or more places. For that there's KiokuDB and
MooseX::NonMoose-- the latter should allow a moose class to inherit from a
DBIC class. Haven't tried neither, though.

- rodrigo
___
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] local helper?

2009-11-25 Thread Rodrigo
 But I can't run it using

 perl script/myapp_create.pl model MyModel MyHelper

 because myapp_create.pl doesn't add the local lib to @INC so it can't find
 it.


Have you tried:

perl -Ilib script/myapp_create.pl model MyModel MyHelper
___
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] How to reduce the memory footprint?

2009-11-23 Thread Rodrigo
On Mon, Nov 23, 2009 at 10:45 PM, J. Shirley jshir...@gmail.com wrote:


 I wouldn't trust the output of top/ps to determine how much memory is used.

 -J


I do.
Not for individual processes, though. But for the totals top is perfectly
fine for me.


I don't have many other processes running on the box. If I turn off
 catalyst, I use less than 250MB or memory. With Catalyst, I'm over 800MB
 with some occasional swapping.



When you say you go from less than 250 to over 800MB, it seems a little too
much. What does small app mean in this case?

My ubuntu box does not have swapping (it's OpenVZ), when it goes over my
allocated 256MB ram, out-of-memory hell breaks loose. So what I'm watching
for is actually my total free memory.

Before starting up my Catalyst app:

top - 23:16:01 up 14 days,  4:57,  1 user,  load average: 0.02, 0.02, 0.00
Tasks:  23 total,   2 running,  21 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,
0.0%st
Mem:262144k total,25720k used,   *236424k* *free*,0k buffers
Swap:0k total,0k used,0k free,0k cached

After startup (out-of-the-box HTTP::Prefork, small app), 30MB are gone:

top - 23:14:36 up 14 days,  4:56,  1 user,  load average: 0.07, 0.03, 0.01
Tasks:  29 total,   2 running,  27 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,
0.0%st
Mem:262144k total,55448k used,   *206696k* *free*,0k buffers
Swap:0k total,0k used,0k free,0k cached

  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+
COMMAND

 3637 catw  18   0 28448  24m 1524 S  0.0  9.5   0:00.00
perl

 3673 catw  20   0 28448  23m  748 S  0.0  9.2   0:00.00
perl

 3675 catw  20   0 28448  23m  628 S  0.0  9.2   0:00.00
perl

 3676 catw  20   0 28448  23m  628 S  0.0  9.2   0:00.00
perl

 3677 catw  24   0 28448  23m  628 S  0.0  9.2   0:00.00
perl

 3678 catw  25   0 28448  23m  628 S  0.0  9.2   0:00.00 perl


After a few thousand hits, total mem usage seems to level out at 62MB:

top - 23:48:13 up 14 days,  5:29,  1 user,  load average: 0.02, 0.02, 0.00
Tasks:  29 total,   2 running,  27 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,
0.0%st
Mem:262144k total,87264k used,   *174880k free*,0k buffers
Swap:0k total,0k used,0k free,0k cached

  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+
COMMAND

 3637 catw  15   0 28560  24m 1524 S  0.0  9.5   0:00.01
perl

 3673 catw  15   0 29320  25m 1616 S  0.0  9.9   0:00.24
perl

 3675 catw  15   0 29308  25m 1616 S  0.0  9.9   0:00.28
perl

 3676 catw  15   0 29308  25m 1616 S  0.0  9.9   0:00.25
perl

 3677 catw  15   0 29308  25m 1616 S  0.0  9.9   0:00.20
perl

 3678 catw  15   0 29244  25m 1616 S  0.0  9.9   0:00.22 perl

Maybe the Catalyst wiki should have some profiling and performance oriented
info. That way people can have an idea on how to measure and what to expect
from their apps. And what to expect after using some of the most popular
modules (ie DBIC).

-rodrigo
___
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] Splitting up a large application: Shared config and templates for multiple applications

2009-08-28 Thread Rodrigo
 Anyone building applications out of multiple small Catalyst applications
 like this?  How do you set up the apps to share templates and a config?
 Anything more interesting than passing in paths?


I have a working module called CatalystX::Featurizer that I've been using in
an app at $work. It's still at a very early stage, but I'm just going to
push early. No POD included, no tests... You've been warned. :D

http://github.com/rodrigolive/catalystx_featurizer

It's a mix of Eclipse features/plugins and RoR plugins. Ideas are welcome. I
have many myself... just don't have time to implement them all right now.

Since there is no POD, I've included a very simple TestApp. Basically the
idea is:

- create a /features directory under your app home.
- each feature home dir should be named something like

/features/my.demo.feature_1.0.0

- it's a split on underscore _, the first part is the feature name (very
javaish, I know, with dots and all), the second is the version.
- if a higher version of a feature is found, that's the one to be used, the
rest is ignored
- a feature without a version is ok, it will be the highest version
available - good for local dev and pushing to a repository.
- a debug box is printed on startup, so you can check which version is
running:

[debug] Features Loaded:
.++--.
| Feature Name   | Class  | Version
|
+++--+
| simple.feature_1.0.0   | simple.feature | 1.0.0
|
.-+--.


- the idea is to merge /root dirs (right now for Static::Simple, TT and
Mason)
- controllers, models, schema, etc. should work just like when underneath
MyApp/lib
- simple.feature.conf is loaded as part of the main conf (appended) - the
filename has to match the feature class name, ie simple.feature.
- extend the main app part by part (depending on your needs), replacing the
standard plugin with an extended one:

use Catalyst qw/-Debug
+CatalystX::Featurizer   this one is a must, loads
features and push things into @INC
+CatalystX::Featurizer::Plugin::ConfigLoader   -
optional
+CatalystX::Featurizer::Plugin::Static::Simple  --
optional
/;

- I'm also including CF::View::Mason and CF::View::TT. To use them, just
subclass it in your MyApp::View::TT or Mason, instead of the C::V::TT,Mason.
- a CF::Plugin::I18N is included too.
- $c-features returns an array of CF::Feature objects that can be used to
identify features, etc.

Let me know what you think.

cheers
   -rodrigo
___
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] problem extending Plugin::I18N

2009-08-26 Thread Rodrigo
On Wed, Aug 26, 2009 at 7:47 PM, Tomas Doran bobtf...@bobtfish.net wrote:

 Rodrigo wrote:

 The problem is that the original Plugin::I18N::setup() gets called twice,
 which breaks it, I guess due to the eval Locale::Maketext::Simple part.

 I've tried to use Moose and around 'setup' = sub { ... } and it gets
 loaded twice also.

 What am I missing?


 Not sure.

 Can you:

 1) Add a Carp::cluck to your setup method, and so get a full stack trace of
 both calls.

 2) print Dumper(mro::get_linear_mro(ref($self) ? ref($self) : $self)); so
 that we can get what perl thinks your application's method resolution order
 is


Found it. Should have clucked to myself before clucking in public...

...
Catalyst::Plugin::Session::setup('MyApp') called at
C:/strawberry/perl/lib/NEXT.pm line 75
NEXT::AUTOLOAD('MyApp') called at
C:/strawberry/perl/site/lib/Catalyst/Plugin/Session.pm line 42
Catalyst::Plugin::Session::setup('MyApp') called at
C:/strawberry/perl/site/lib/Catalyst/Plugin/Cache.pm line 28
...

And that NEXT::AUTOLOAD hurt the eye real bad. Things were just going round
and round, from NEXT to mro::next, etc.

An upgrade of Plugin::Session did it.

Thanks.
  -rodrigo
___
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] passwordless LDAP authentication

2009-07-27 Thread Rodrigo
Hi all,
I'm using Catalyst::Authentication::Store::LDAP to authenticate users, but
now I need to allow some of them to single-signon without a password, like
this:

if( $is_sso ) {
$c-authenticate({ id= $user });  ## I trust this dude, so skip the
check_password sub
} else {
   $c-authenticate({ id= $user, password=$password );  ## old fashioned
}

I'm looking at the authentication internals and it seems to be missing a
per-user flag to disable password checking. Only a global realm-based
password_type='none' exists. Am I correct?

On the other hand, switching realms to a passwordless LDAP where
password_type='none' either duplicates information sensesly, or is a little
bit messy since it needs a MyApp.pm startup config hack. But it seems like
the only doable option right now.

To make matters worse, LDAP::User::check_password also checks user roles
since it needs the password to bind to the ldap server. That could make it
more difficult to implement a passwordless flag at any level on the
authenticate chain.

Any views on this?

regards,
   rodrigo
___
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] featurizing a catalyst app

2009-06-28 Thread Rodrigo
 Assuming that you're mandating a TT view for your pluggable parts, then you
 can just subclass View::TT to have an INCLUDE_PATH which picks up the 'root'
 directories from all your loaded 'Components'.


I usually have /static stuff too, mostly css and images.
___
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] featurizing a catalyst app

2009-06-25 Thread Rodrigo
Hi all,
I have an application that has many features (or plugins, or extensions,
or bundles, or whatever, but I'll call it feature for uniqueness sake),
which are subsets of the app that may or may not be bundled into the
application, depending on the customer it will be shipped to.

What I'm looking for is to have a very Eclipse-like directory structure:

MyApp/features/my_first_feature_1.0.0/root/
MyApp/features/my_first_feature_1.0.0/lib/Controller
MyApp/features/my_first_feature_1.0.0/lib/Model
MyApp/features/my_first_feature_1.0.0/lib/View

MyApp/features/another_feature_1.2.0/root/
MyApp/features/another_feature_1.2.0/lib/Controller
MyApp/features/another_feature_1.2.0/lib/Model
MyApp/features/another_feature_1.2.0/lib/View

The idea is that modules contained in features should not be aware that they
are in a feature, but work like they are in the default /lib or /root.

I think the /lib part can probably be setup using this:

__PACKAGE__-config( setup_components = { search_extra = [ @features ] }
);

With a little bit of code to fillup @features correctly, and some @INC
tweaking...

But how about the /root part? Can mixed-up root dirs be seen as a single
root dir easily?

cheers,
   rodrigo
___
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] Bug into Catalyst::Devel 1.16 and later?

2009-05-25 Thread Rodrigo
On Mon, May 25, 2009 at 10:57 AM, Emmanuel Quevillon t...@pasteur.frwrote:

 Hi,

 I've just upgraded my Catalyst::Devel to 1.17 (was in 1.15).
 Unfortunately, when I attempted to start my dev server I couldn't
 and received an error :

 t...@gin bibliolist$ script/bibliolist_server.pl -r
 Can't locate object method _fork_and_start via package
 Catalyst::Restarter at
 /usr/local/share/perl/5.10.0/Catalyst/Restarter.pm line 62.
(in cleanup) Can't locate object method _kill_child via
 package Catalyst::Restarter at
 /usr/local/share/perl/5.10.0/Catalyst/Restarter.pm line 103.



Just update your scripts. It's advisable to do it with every Catalyst
update, specially with a ::Devel update.

# from directory one level above your app:

/apps/MyApp $ cd ..
/apps $ catalyst.pl -force -scripts MyApp
___
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] New restarter code in Catalyst::Devel 1.14_01

2009-05-24 Thread Rodrigo
On Sun, May 24, 2009 at 2:20 AM, Dave Rolsky auta...@urth.org wrote:

 On Tue, 19 May 2009, Rodrigo wrote:

  Since I needed to have the restarter working badly on that machine in
 particular, I quickly patched the code with Proc::Background. Something
 like
 this:


 I implemented something like this in the latest Catalyst::Devel. I did more
 thorough testing on Windows and it seems to really work now.

 Please give it a shot on your system.



 -dave


That's just hack-tastic! Works great. Thanks.

Shame we can't use the new pre-loading functionality on Windows though. I
tested with different versions of things and errors just got nastier and
nastier.

IMO, to be able to pick restarter engines via %ENV was also a necessary
change anyway. Say, in the future we could have a threaded implementation,
and that would be a whole new ballgame for the restarter.

-rodrigo
___
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] New restarter code in Catalyst::Devel 1.14_01

2009-05-19 Thread Rodrigo
 I did test this on WinXP using Strawberry (5.8.8, IIRC), and it worked
 fine. Win32 Perl does support a fork emulation that uses thread under the
 hood.


Strange. I'll try it with a different/older version of Strawberry Perl and
see what happens.



 I don't think the fork implementation in Strawberry is any different than
 ActivePerl. ActiveState wrote the fork implementation (again, IIRC) and
 contributed it to the Perl core.


Their forks seem to behave slightly different (it's a feeling more than a
fact), even though I agree that the code is probably the same one Microsoft
helped develop originally. The compilers are different though, VisualStudio
vs MinGW.



 That said, I was thinking it might be good to also have a threads-based
 version available, and that could be the default to use on Win32.

 I took a stab at doing this at one point, but got stuck on trying to
 actually kill the child thread.


Since I needed to have the restarter working badly on that machine in
particular, I quickly patched the code with Proc::Background. Something like
this:

sub _fork_and_start() {
   my $proc = new Proc::Background(perl $0);  # I'm writing this from
memory; not this exactly, there were more args...
   my $pid = $proc-pid;
...}

It did the job since the background process was a non-restarter dev server.
And the restarter was able to kill it just fine when changes were detected
because $pid is a real os pid.

I think I put threads / async { } somewhere in there before using
Proc::Background but I got an error... and don't recall which. Killing the
thread requires it to die from the inside, sending it a signal of some sort.


Couldn't the restarter be subclassed then changed in myapp_script.pl through
an %ENV variable?

-rodrigo
___
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] How and where to run a method at Catalyst start up?

2009-05-18 Thread Rodrigo

#Create appropriate model
my $model = join(::, GenoList, $db, Organism);
my $r = BiblioList-model($model)-search()-first();
$ROrgs-{$db} = $r;
}


Emmanuel, make sure that GenoList::$db::Organism actually resolves to a
correct model name for you application. I have a feeling that it doesn't.

Make sure you understand the way DB models are invoked in Catalyst.
Typically:

$c-model('MyModelName::MyResultClassName');

Where:
- ModelName is a module called lib/MyApp/Model/MyModelName.pm
- ResultClassName (usually points to a db table)  is a module called
lib/MyApp/Schema/Result/ResultClassName.pm

The paths may vary sensibly depending on how you created them and if it's a
DBIC schema or something else, but hopefully you get the idea.

There's good reading material on this here:
http://search.cpan.org/~hkclark/Catalyst-Manual-5.7021/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod#Create_Static_DBIx::Class_Schema_Files


 Couldn't instantiate component BiblioList::Model::Mapping, Can't
 call method search on an undefined value at

 /home/tuco/src/perl/projects/Catalyst/BiblioList/dev/bibliolist-0.08/script/../lib/BiblioList/Model/Mapping.pm
 line 28. at script/bibliolist_server.pl line 66
 Compilation failed in require at script/bibliolist_server.pl line 66.


The method  -search() is being called on an undefined value probably
because Catalyst could not find a model for the parameter you passed to
BiblioList-model('...').


 If I use $self instead of BiblioList the error change:

 Couldn't instantiate component BiblioList::Model::Mapping, Can't
 locate object method model via package
 BiblioList::Model::Mapping at

 /home/tuco/src/perl/projects/Catalyst/BiblioList/dev/bibliolist-0.08/script/../lib/BiblioList/Model/Mapping.pm
 line 28. at script/bibliolist_server.pl line 66
 Compilation failed in require at script/bibliolist_server.pl line 66.


Don't use $self. The model method hangs from your application object, which
is $c not $self.

$self points to an instance of you BiblioList::Model::Mapping, which is a
child of Catalyst::Model, which does not give you a -model() method.

-rodrigo
___
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] How and where to run a method at Catalyst start up?

2009-05-18 Thread Rodrigo

 The strange thing is that if I copy the body of BUILD to
 BiblioList.pm (just after __PACKAGE__-setup())
 The function works just fine and I don't get any error.


Strange indeed.
Just try, as a possible workaround, just get rid of the GenoList level in
your Model. That would shorten the model call to something like
MyApp-model('bovisR1db::Organism'). See if that works.

-rodrigo
___
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] New restarter code in Catalyst::Devel 1.14_01

2009-05-18 Thread Rodrigo


 Restarting is also much faster. All of the Catalyst core code is preloaded
 in a parent process, and the server runs in a child. That means that when
 the child is killed and a new child spawned for a new server, it does not
 need to load all that Catalyst code again, just your application.


I'm getting a misbehaving action dispatcher with the new restarter, even
before the app is restarted:

C:\ catalyst MyApp
C:\MyApp perl script\myapp_server.pl -r
...
[info] MyApp powered by Catalyst 5.80003
You can connect to your server at http://localhost:3000

The response to the first request to http://localhost:3000 is this:

[info] *** Request 1 (0.333/s) [-2208] [Mon May 18 17:02:38 2009] ***
[debug] GET request for / from 127.0.0.1
[debug] Couldn't forward to command //_DISPATCH: Invalid action or
component.
[error] Couldn't forward to command //_DISPATCH: Invalid action or
component.
[info] Request took 0.008397s (119.090/s)

The app works just fine without the -r option.

This is a fresh Strawberry Perl 5.8.9 (Apr 2009) install + Catalyst::Devel.

Has anyone tested the new restarter on Win32? It looks like some kindda
issue with the fork at  Catalyst::Restarter::_fork_and_start(). IMHO, a
parent process loaded with the core code could too advanced for windows'
pseudo-fork. So I was wondering if maybe this was tested on ActivePerl
--I've feeling that their fork works better than Strawberry's.

-rodrigo
___
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] How and where to run a method at Catalyst start up?

2009-05-15 Thread Rodrigo
On Fri, May 15, 2009 at 12:12 PM, Emmanuel Quevillon t...@pasteur.frwrote:

 Hi all,

 I am developing a Catalyst App and I'd like to know how to launch a
 method at Catalyst start up?


In MyApp.pm:

# Start the application
__PACKAGE__-setup();
mymethod();
sub mymethod {
...
}
But that's probably not what you're looking for...



 The idea is to check and create some kind of a data structure that
 will be loaded into memory (__PACKAGE__-{mydata} = { ... }) of my
 application and will be then accessible at anytime from anywhere in
 any controller


Create a model for it.
$ script/myapp_create.pl model MyData

Then create the data structure in Model/MyData.pm:

package MyApp::Model::MyData;
use Moose;
extends 'Catalyst::Model';
has 'mydata' = ( is='rw', isa='HashRef', default=sub{{}} );
no Moose;
sub BUILD {
   my $self=shift;
   my $data = MyApp-model('DB::Table')-search(...)-first; # I rather
avoid storing dbic resultsets in memory for a long time.
$self-mydata({  foo= $data } ); }
}

Then call it from any controller:

sub foo : Local {
  my $c=pop;
  $c-stash-{foome} = $c-model('MyData')-mydata-{foo};
}



 But how can I access my database within MyApp.pm ?
 I tried (in MyApp.pm):


If don't have $c defined, you can use MyApp-model() most of the time.

--rodrigo
___
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] The Netiquette thread (OT)

2009-04-28 Thread Rodrigo
On Tue, Apr 28, 2009 at 10:59 AM, Ian Wells i...@cack.org.uk wrote:

 People:

 Top posting is bad.

 Bottom posting is bad.



I'm on gmail, like some people here. It handles top, bottom and interwoven
posting just fine in its conversations (I think that's what google calls
it). It folds useless quotes too.

I'm not hailing gmail, but aren't there more email readers that can do such
tricks? I think it all comes down to finding a mail client that can handle
long conversations well.

-rodrigo
___
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] Eclipse and Catalyst

2009-04-13 Thread Rodrigo
On Mon, Apr 13, 2009 at 9:43 AM, abhishek jain
abhishek.netj...@gmail.comwrote:

 Has anyone used Eclipse or any other IDE.Can someone guide me in some
 steps how can i use Eclipse as an ide for Catalyst application?
 Pl. help.
 Early replies will be appreciated.


Have you installed the EPIC plugin? I think that's the first step.

-rodrigo
___
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] Eclipse and Catalyst

2009-04-13 Thread Rodrigo
 yes i have installed EPIC , but i am on windows, i need to issue
 catalyst.pl command and I am not sure how can Eclipse do that for me.


Follow this tutorial for setting up a RunAs command:

http://www.epic-ide.org/running_perl_scripts_within_eclipse/entry.htm

I have entered the following options in the Run a program window (I did
not use the cmd /C command):

Location: c:\strawberry\perl\bin\perl.exe
WorkingDirectory: ${project_loc}
Arguments: -S catalyst.pl ${project_name}

That will use the project name as the current application name and create it
within the current selected project. You can easily create commands for your
favorite myapp_create.pl scripts and another one to start myapp_server.pl.

-rodrigo
___
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 Rodrigo
 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.


To me it doesn't seem messy to parse myapp.conf from your non-catalyst app
using Config::General-getall, then pass the connect_info data to your
DBIC::Schema class. Besides, you can use your MyApp::Schema classes from
anywhere, in case you created them with DBIC::Schema::Loader.
My 2c.

-rodrigo
___
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 Rodrigo

 My questions:
 a) Where do I store the intermediate values of the attributes. I can't put
 them in the object itself
 as it would generate a invalid object. Do I store them simply as data
 somewhere else? Do
 I have to create a proxy object with lighter rules?


I wouldn't. Just instantiate your object at the entry controller and store
the instance in the $c-session, or wherever you find appropiate depending
on the object characteristics and the kind of state handling you need.

Do your entry validation as part of the attribute checking validation, as in
Moose:

package MyClass;
use Moose;
use Moose::Util::TypeConstraints;
subtype 'AcceptedAge' = as 'Int' = where { $_ = 16 } = message { 'You
must be at least 16 to use this.' };
subtype 'NameStr' = as 'Str' = where { length($_)  1 } = message { What
kinda name is '$_'? };
has 'name' = (is='rw', isa='NameStr', required = 1 );
has 'age' = (is='rw', isa='AcceptedAge', required = 1 );
has 'sex' = (is='rw', isa='Str', required = 1 );

In your (overly-simplified) controller:

sub submit : Local {
   $c-session-{obj} = new MyClass( $c-req-params );  # dies if
constraint fails, so trap errors
}



 b) How can I verify attribute rules as early as possible in that entering
 process? Do I have to
 dublicate the knowledge of the rules outside the class? (e.g. Length of
 String attribute less than 20)
 The class itself would check such a restriction.


Then, just finish validating your object in the exit controller.

sub wrap_it_up : Local {
 ...
 if( $c-session-{obj}-validate ) {
 ## yup
 } else {
   ## nope
}
}

Back in your class, do the more complex validations:

sub validate {
  return 1 if(  ( $self-sex eq 'F'  $self-age =16 )  ## girls
mature earlier...
   || (  $self-sex eq 'M'  $self-age =18 ) );
}



 What ways are you going? Which is the right OO-way of doing it?



TIMTOWTDI



 At the moment I really don't know where to place the input validation
 knowledge and where and how
 to store the partly created objects. I hope it sounds not to academic, but
 I want to clearly seperate
 the responsibilities.


Moose will give you a lot of ammo to help you with this, things such as
coersion and roles. Check with the moosers in their maling list for further
OO questions.

On the other hand, if you need client-side validation, take a peek at
HTML::FormFu, as it may help you with putting some of those rules on the
client side. Catalyst::Model::Adaptor may also come in handy if you feel you
need to turn your class into a model.

-rodrigo
___
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 Rodrigo

 But that' s my problem: One one web page I do not get all attributes I need
 to instantiate the object correctly. Simple unrealistic example. One one
 page
 the user can enter a name on the second the age. The object can be
 instatiated
 if you provide a valid name and age.


Well, just instantiate an empty object then use the accessors Moose creates
for you automagically. Accessors validate as well:

sub start_up : Local {
$c-session-{obj} = new MyClass();
}
sub submit_name : Local {
$c-session-{obj}-name( $c-req-params-{name} );
}
sub submit_age : Local {
$c-session-{obj}-age( $c-req-params-{age} );
}


 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.



  Catalyst::Model::Adaptor may also come in handy if
  you feel you need to turn your class into a model.

 What do you mean with that?


First, read up on the Model part of MVC, that's where most of your
application storage should end up. Have you decided what are you going to do
with the object once it's filled up?

--rodrigo
___
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 Rodrigo
 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).


Well, if the object gets an arrayref when it was expecting an Str then he
can't use the object and it should throw an exception.
___
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] Google Summer of Code: mentors, projects

2009-03-03 Thread Rodrigo
I have a dream... project. A Catalyst Application Server (i.e. Websphere,
Weblogic, JBoss in javaland).

It would be a catalyst app for managing and deploying other catalyst apps.
It would take care of starting separate perl processes (virtual servers),
plug them into Apache/lighttpd config files (fcgi, mod_perl), or maybe even
run the app in the same shared perl process where the catalyst app server is
running.

It would allow developers and admins to manage their apps
(start/stop/restart), deploy .par/.tar/.zip files that would then be
expanded into the app server directory, setup dbi datasources, have a common
security realm, maybe a simple communication layer in between apps, etc.
Web-console, web-service and CLI enabled. Well, you get the idea.

I think it may appeal to a student to write something like this. It has good
visibility. It scales well as a project, it could start as something simple,
to fit the Summer of code timeline, then allow for extensions to be writen
later. It wouldn't mess with Catalyst internals, which IMO makes it easier
to tutor. It's something that would help sell Catalyst as a corporate-wide
application infraestructure, or for webserver providers to manage installed
apps, or simply for us mortals to manage our scattered cat apps from a
central control panel.

-rodrigo
___
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 on Windows: fork issues

2009-02-26 Thread Rodrigo
Stefan, I've had similar problems in windows with prefork, which can be
started up after some tweaking, but will hang after a few requests. Perl's
fork() is a no-no in windows. FCGI can be painful to setup, so I ended up
giving up on it. I went on to use mod_perl with Apache, which has problems
of its own too, but a more trivial setup. Finally, the approach I'm using
right now is to setup a pool of single-threaded Catalyst dev servers,
starting them up in a startup.bat such as this:

start /b perl script\myapp_server.pl -p 3000
start /b perl script\myapp_server.pl -p 3001
start /b perl script\myapp_server.pl -p 3002
...

If you wish to keep all your logs in one place:

startup.bat myapp.log 21

Then setup an Apache mod_proxy load-balancer (or lighttpd's, etc.) to
balance the load among dev servers. Make sure you understand the drawbacks
of using catalyst dev servers in this manner, even though they work
superbly.

httpd.conf (or apache2.conf or etc.):

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Proxy balancer://cat
  BalancerMember http://localhost:3000
  BalancerMember http://localhost:3001
   BalancerMember http://localhost:3002
/Proxy

ProxyPass / balancer://cat/
ProxyPassReverse / balancer://cat/

Take a look around the web for other settings that you may need, such as
catalyst's using_frontend_proxy and apache's static aliases, balancer
features, etc. Apache is extremely lightweight if you only run it for
reverse proxy load-balancing.

If you want to startup your catalyst server pool from a windows service
using a configuration file, I have a perl script that does that somewhere.
Just let me know.

Hope this works for you.

--rodrigo
___
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-25 Thread Rodrigo


 Cat is using only approx. 50MB of memory, which is great. Although we
 do no great deal of caching yet. But this will be done using dbd or
 memcached anyway, so it won't increase the memsize of cat.
 And we have yet to find any memleaks, the app is running for months with
 now...


Is that mod_perl, FastCGI or HTTP::Prefork?

-rodrigo
___
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] windows install issues (Was: RFC: New to Catalystquestions)

2009-02-24 Thread Rodrigo
I set the variable DBICTEST_NO_SQLITE_CHECK to 1 and ignored the error.

The Makefile.PL for DBIx::Class happens to be doing a fork() just before it
connects to dbi:SQLite:memory and runs its tests. And using fork() in
Windows may just-work... or may not. Specially when loading a dll is
involved.

--rodrigo

On Tue, Feb 24, 2009 at 7:45 AM, Dan Dascalescu 
ddascalescu+catal...@gmail.com ddascalescu%2bcatal...@gmail.com wrote:

  I also couldn't install DBD::mysql, even though I've also tried without
  cpan, because on dmake it gives some errors I don't understand

 I had DBD::SQLite fail the stress test that DBIx::Class runs. Any
 solution for that one? I also just posted about it on the Strawberry
 Perl mailing list:

 http://www.mail-archive.com/win32-vani...@perl.org/msg00103.html

 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] windows install issues (Was: RFC: New to Catalystquestions)

2009-02-21 Thread Rodrigo
 I've tried to use Strawberry Perl, but I've seen that I can't install some
 modules on it.

 I needed to install MIME::Tools by downloading the package manually, and
 doing perl Makefile.PL, dmake, skip dmake test and do only dmake install,
 because I couldn't do it using cpan. On the dmake test, it freezes on a
 certain test.


Strange, MIME::Tools is another module that installs fine in my Strawberry
5.10.0.0. No freezing on tests. Make sure that, if you're going to install
things manually, use the command look to get the correct build
environment:

cpan look MIME::Tools



 I also couldn't install DBD::mysql, even though I've also tried without
 cpan, because on dmake it gives some errors I don't understand, even though
 I've added all those directories which perl Makefile.PL needs.



 I have also tried to install WxPerl with it, but without success.

 Another strange one... WxWidgets is one of Strawberry star installations
for the October2008 release.

http://strawberryperl.com/releases.html

I don't develop for Wx, but I installed it (and Tk) successfully in
Strawberry with cpan.

DBD::mysql needs the mysql source code to link to. That's a good candidate
for ppm.



 I've seen that the ppm it uses seems to be either very old or a different
 kind than that used by Activeperl because it seems to have less features.



 The strawberry ppm has given me problems also. That's supposed to be one of
the improvements in the latest Strawberry Jan 2009, but I haven't tried so
far.

 From this point of view, Perl is not a very good language for Windows
 because it is hard to adapt the modules that work fine under other systems.

 I agree that perl and cpan modules favor posix features, such as fork(),
and that's a no-go for windows. I just try to avoid those by using no-posix
modules. I use ppms for tough to install modules, sometimes unzipping them
straight into c:\strawberry\perl\site\lib if the ppm installer is not
working well, which has been the case for strawberry lately.

--rodrigo
___
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] RFC: New to Catalyst questions

2009-02-20 Thread Rodrigo

 First I was not able to install File::NFSLock with cpan, but I found a ppm
 distribution for it.
 But I've seen that after doing this, more other cpan modules couldn't be
 installed, and one of them is Cache::FastMmap which I know that it can't be
 installed under Windows.


I switched Cache::FastMmap for Cache::FileCache (in MojoMojo.pm) which seems
to work fine, but I haven't run a full test suite or used in production. I
didn't have a problem with File::NFSLock compiling with the latest
Strawberry version.

-rodrigo
___
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] RFC: New to Catalyst questions

2009-02-20 Thread Rodrigo
On Fri, Feb 20, 2009 at 8:21 AM, Dan Dascalescu 
ddascalescu+catal...@gmail.com ddascalescu%2bcatal...@gmail.com wrote:


 Rodrigo,
 MojoMojo now supports custom styles. A different theme can be seen at
 http://nordaaker.no/wiki/. We think the typography needs improvement,
 and a Mediawiki-like theme would be very good to have.


I know. I brute-forced the main catalystframework.org css into a MojoMojo
theme to see how it would look. I'm not a web-designer, so don't expect
wonders... You can see it here:

http://rodrigolive.googlepages.com/catmojo.jpg

Is the Catalyst Wiki code in the svn repository or backed-up somewhere? I
think it would be good to have a development version (with the current
content snapshot) so I can work on a makeover.
___
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] RFC: New to Catalyst questions

2009-02-20 Thread Rodrigo

 I have also removed it, but I found that I can't install
 DBIx::Class::EncodedColumn  with cpan, and there is no ppm distribution for
 it.

 Octavian


Wow. I haven't had a problem with that either, in at least 5 different XP
machines. Are you running Vista? What's the error?

I'm using the October 2008 versions, so I've just downloaded Jan 2009
Strawberry 5.10.0.4, installed it to c:\strawberry, ran cpan, then notest
install DBIx::Class::EncodedColumn and it installed it ok. On the other
hand, DBIx::Class didn't due to SQLite issues, but EncodedColumn didn't seem
to care. Obviously that would need some testing, but as far as installation
goes, it seems to be fine.
___
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] windows install issues (Was: RFC: New to Catalyst questions)

2009-02-20 Thread Rodrigo

 I think the relevant error is:

 t/02digest1/32 Can't call method keysize on an undefined value at
 E:/perl510/site/lib/Crypt/OpenPGP.pm line 525.
 I have tried a:

 cpan install Crypt::OpenPGP

 But I received the message that this module is up to date.

 I use ActivePerl 5.10.0 build 1004.



Oops, ok, sorry, I thought you had Strawberry. Last year I swapped all
things Active for Strawberry Perl.

In any case, maybe you can tinker with the ActivePerl cpan Config.pm so that
it uses the MinGW compiler and the Strawberry cpan settings. The idea would
be to make ActivePerl compile its modules using the Strawberry config
settings.Don't know if that would work.

Another way (if don't want to switch to strawberry flavored perl) is to just
install Strawberry, then edit your PATH and strip off all c:\strawberry\...
directories so that it won't disturb your ActivePerl installation. Then
create a little bat file that will give you a strawberry prompt. Install
modules with strawberry cpan, then copy them from strawberry\perl\site (and
auto) into ActivePerl's \site directories.
___
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] RFC: New to Catalyst questions

2009-02-19 Thread Rodrigo
 On Tue, Feb 17, 2009 at 11:02 PM, Devin Austin devin.aus...@gmail.comwrote:

 Rodrigo,

 If you have any, you're more than welcome to ask for SVN permissions to
 check in some.  I know i have a few example apps I'd like to show off in
 /examples


Sure! Where can I request svn permissions?

Actually, I'd like to work also on a sassier getting-started page for the
dev.catalystframework.org/wiki http://catalystframework.org site. IMO, the
Catalyst Wiki could get a makeover: some css styling (so that the wiki is
aligned with the homepage), column separated content, more short description
of links or sections, or anything that improves usability really, for
beginners and experienced users alike.

The CatalystFramework homepage, on the other hand, would benefit from a more
dynamic news or latest section, so it won't be so static. Of course,
that means maintaining it to keep it dynamic...

But nothing fancy here. Content is certainly more important than looks. But
the raw idea is to make information pop out, making things faster/easier to
find.

What do you think?

-rodrigo
___
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] RFC: New to Catalyst questions

2009-02-17 Thread Rodrigo


  3) Walkthrough of creation of a simple app end to end.

 Yes please, a full example tutorial is just what we need!


And example apps!

As a Catalyst beginner, I craved example apps the most (I still do!). While
learning, I find it more productive checking out a small example app by both
reading code and doing a run through the interface, rather than big
walkthrough tutorials or pod copy-pasting. Also, tiny apps can easily be
used as quick-starters for your real apps, sorta like the next step up from
Catalyst::Helper modules.

The stuff in the wiki and
http://dev.catalystframework.org/repos/Catalyst/trunk/examples/ may serve as
a starting point. CPAN also hosts some apps, including MojoMojo. And I'm
sure we all have many small test apps laying around we can just tarball and
share.


-rodrigo
___
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]? Extends TheSchwartz

2009-02-12 Thread Rodrigo
On Wed, Feb 11, 2009 at 5:38 PM, Lindolfo Lorn Rodrigues
lorn...@gmail.comwrote:

 Hi, sorry for the off-topic but i'm search at google and the uniq list that
 i found ( http://groups.google.com/group/theschwartz ) dont have nothing.
 I need a something like TheSchwartz::Scheduler, i was thinking in change
 TheSchwartz-work method, they will look the time to run a job  and execute
 the job only when is the rigth time
 Does anyone have some tips? I looked at CPAN but dont find anything like
 this.


I've been using TheSchwartz::Moosified in my Catalyst app to schedule jobs.
Something along these lines:

package MyApp::Worker;
use base 'TheSchwartz::Moosified::Worker';
sub work {
my ($class, $job) = @_;
print WORKING:. $job-dump();
$job-completed;
}

package main;
use strict;
require MyApp;
use TheSchwartz::Moosified;
my $client = TheSchwartz::Moosified-new( verbose = 1);
MyApp-model('DBIC')-storage-dbh_do(
sub {
my ($storage, $dbh) = @_;
$client-databases([$dbh]) or die $!;
} );

use Date::Manip; Date_Init( TZ=CET);
## schedule a job
my $job = TheSchwartz::Moosified::Job-new(
funcname = 'MyApp::Worker',
run_after= UnixDate(ParseDate('2009-02-12 13:00:00'), '%s' ),  ##
run_after expects a secs since epoch value
  ## you may also wanna set grabbed_until
arg  = [ foo = 'bar' ],
);
$client-insert($job) or die $!;
$client-can_do('MyApp::Worker');
$client-work();


-rodrigo
___
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] Plugin::Authentication overrides $c-req-user

2009-02-11 Thread Rodrigo
On Tue, Feb 10, 2009 at 9:46 PM, Daniel Westermann-Clark d...@pobox.comwrote:

 Hi,

 At work we use, among other things, the value of REMOTE_USER in the
 request environment to authenticate users using our single-sign on
 system.  We access this via $c-req-user, which the various engines
 set using the data available to them.

 However, Catalyst::Plugin::Authentication-set_authenticate overrides
 this value with the blessed user object in addition to setting
 $c-user.  Looking at the commit logs, it looks like this has been
 true since 2005 but I'm having a hard time finding a reason why.

 Also, Catalyst::Request lists $c-req-user as deprecated.  If it were
 to be removed, how would one access the value in an engine-agnostic
 way?


I'm not familiar with $c-req-user, but isn't REMOTE_USER a header you can
read with $c-req-header('remote_user'), or whatever header name is being
passed around?
___
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] how to confirm before deleteing

2009-01-21 Thread Rodrigo
Paul, how about a javascript confirm() box?

body
a href=yourcontroller/delete/row_id onclick=javascript:return
confirm('You selected delete. Do you really want todo this?')Delete
Row/a
/body

cheers,
-rodrigo

On Wed, Jan 21, 2009 at 2:23 PM, Paul Falbe p...@cassens.com wrote:


 I writting my first little Catalyst app and need todo a delete function.  I
 have a link for users to delete a row in a sqlite table.  My question is
 what is the prefered rocess for asking You selected delete.  Do you really
 want todo this?.

 Thanks in advance!

 -Paul
 --
 View this message in context:
 http://www.nabble.com/how-to-confirm-before-deleteing-tp21583057p21583057.html
 Sent from the Catalyst Web Framework mailing list archive at Nabble.com.


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

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


Re: [Catalyst] controller subclass and :Local actions

2009-01-17 Thread Rodrigo
On Fri, Jan 16, 2009 at 6:13 PM, Marcello Romani mrom...@ottotecnica.comwrote:

 Hallo,
I have a controller base class that implements the usual crud actions
 (list, create, etc.), and I would like to override i.e. the list method in a
 subclass, but the subclass' list method doesn't seem to get called...

 In MyApp::Controller::Base:

 use base qw( Catalyst::Controller );

 sub list : Local {
do stuff
 }

 In MyApp::Controller::CD:

 use base qw( MyApp::Controller::Base );

 sub list : Local {
do other stuff
 }


 when I call /myapp/cd/list the base controller's list action gets called...

 Can someone give me a hint ?

 Thank you.

 --
 Marcello Romani


Strange. That works fine for me. What does the debug output prints out for
the path dispatch table when the server starts up?

It should look something like this:

[debug] Loaded Path actions:
.-+.
| Path| Private|
+-++
| /base/list  | /base/list |
| /cd/list| /cd/list   |
'-+'

-rodrigo
___
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] Catalys TheSchwartz, was Catalyst modperl - child process segmentation fault

2009-01-08 Thread Rodrigo
This is what I'm using for creating TheSchwartz::Moosified connections from
Catalyst:

use TheSchwartz::Moosified;
my $client = TheSchwartz::Moosified-new();
#  this will get you a dbh with DBIx::Class::Storage::DBI exception
handling:
MyCatalystApp-model('MyModel')-storage-dbh_do(
sub {
my ($storage, $dbh) = @_;
$client-databases([$dbh]) or die $!;
}
);
# this also works:
#  $client-databases([MyCatalystApp-model('MyModel')-storage-dbh]);

$client-insert( ... );

The advantage is that you won't have to create a new dbh connection
everytime you insert a job, in case that's what you want.

The disadvantage is that I don't know how far the moosified version is
backward compatible with the original TheSchwartz (it has worked fine for me
so far).

cheers,
  rodrigo

On Thu, Jan 8, 2009 at 5:42 PM, J. Shirley jshir...@gmail.com wrote:

 On Thu, Jan 8, 2009 at 3:39 AM, Matija Grabnar mat...@serverflow.com
 wrote:
  afaict, you should let dbic / cat-model handle the connection to the
  database.
 
  That reminds me. Does anybody have experience submitting TheSchwartz jobs
  from a Catalyst?
 
  TheSchwartz uses it's own system of allocating DB handles, and I have no
  idea how it interacts with
  Catalyst's.
 
  I *think* I'm safe because I'm not allocating any schwatz connections
 until
  I'm actually serving a
  Catalyst request, but I'd like to hear from anybody who has actual
  experience...
 

 I've done quite a bit of work with TheSchwartz and Catalyst.

 Catalyst does -nothing- with database handles.  Absolutely nothing.
 If you use a database, chances are you are using
 Catalyst::Model::DBIC::Schema which then uses DBIx::Class.

 TheSchwartz uses Data::ObjectDriver for its ORM.  The two play just
 fine together.

 The model class for TheSchwartz is quite simple:

 package MyApp::Model::TheSchwartz;

 use base 'Catalyst::Model';

 use TheSchwartz;

 sub COMPONENT {
return TheSchwartz-new( databases = $DATABASE_INFO );
 }

 1;

 From there, you can just do $c-model(TheSchwartz)-insert(...); and
 the job will be inserted.  Look at the pod for TheSchwartz for the
 database info, and the schema for TheSchwartz database is hidden away
 in the distribution with no links:
 http://search.cpan.org/src/BRADFITZ/TheSchwartz-1.07/doc/

 TheSchwartz also fails tests so you have to force install, has
 terrible documentation and is generally frustrating to use because of
 these superficial shortcomings.

 The code itself is sound enough, but the packaging and release is
 quite terrible.  It will take you some time to sort it out and get
 everything running, so good luck.  Once it is up and running, it is
 quite simple and the API is good.


 -J

 ___
 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] Re: Upload problem

2008-12-24 Thread Rodrigo
Try Google Chrome. It doesn't seem to complain about 4Gb file uploads. Using
the Catalyst test server should be fine.

Maybe you're pushing the multipart/form-data envelope here. Have you looked
into a more specialized, gmail-upload style, browser solution, such as
javascript libraries (extjs, dojo, etc.) or flash?

I haven't tried it myself, but it looks darn good:
http://max-bazhenov.com/dev/upload-dialog-2.0/index.php

cheers,
  rodrigo

On Tue, Dec 23, 2008 at 9:04 PM, Bernhard Graf cataly...@augensalat.dewrote:

 On Tue 23 Dezember 2008, Florent Angly wrote:

  I have now tried several browsers (Firefox, Epiphany, Internet
  Explorer), but none of them worked. Firefox and Epiphany did not
  complain and just refreshed the page, whereas Internet Explorer
  complained that The page cannot be displayed.

 A very very vague remembrance comes to my mind: I had a similar problem
 once, and AFAIR this was related to a broken Content-Length header...

 --
 Bernhard Graf

 ___
 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] vote for Catalyst in Enterprise Open Source Directory

2008-12-11 Thread Rodrigo
Perl 5.10 is also listed, so vote to make a great-looking language look even
better.

http://www.eosdirectory.com/project/61/Perl.html

On Thu, Dec 11, 2008 at 3:50 PM, Dami Laurent (PJ) 
laurent.d...@justice.ge.ch wrote:

  Hi Catalysters,

 If you are happy users of Catalyst, please vote for it on the Enterprise
 Open Source Directory.

 Currently the user rating is good but there are only 4 votes; more votes
 could improve the visibility of Catalyst, especially for Enterprise
 deciders.

 *http://www.eosdirectory.com/project/382/Catalyst+Framework.html*http://www.eosdirectory.com/project/382/Catalyst+Framework.html


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