Re: [Catalyst] Where is the form field lost?

2010-01-25 Thread Octavian Râşniţă

From: Charlie Garrison garri...@zeta.org.au
Can you tell about those problems? I hope I won't create them in the 
inflator I want to create.


I don't recall exactly, but IC::File had problems with multiple
'file' columns. I remember, the delete part was completely
broken if all files were not in the same directory. I was trying
to patch IC::File so that deleting would work; I was advised to
use IC::FS rather than trying to fix IC::File. (I don't recall
who said that, sorry.)



If I remember well, the algorithm for deletion made a single deletion and 
then did a last() thinking that if one file was deleted, all the files were 
deleted. I think there was a little comment there that tells that.
Although I didn't need to store the files in different dirs, I've noticed 
that that piece of code won't work in case of more directories used, however 
I don't think it is so hard to patch it for solving that issue.


Thank you for the code you sent. I will analyse it better to see if I can 
use another way, but what I would like to avoid is exactly to need writing 
too much code like this in order to use the module, so I don't want to need 
writing those wrappers for each file column nor a separate subroutine that 
provides the file name. But maybe I will be able to create one in the 
inflator...


However I am not sure the way InflateColumn::FS works is compatible with 
HTML::FormFu. I think a better way would be the style used by 
InflateColumn::File eventually with a more flexible storage, or 
InflateColumn::FS should be changed so it should get the ID of the row after 
it is stored in the DB.
But in the second case, I don't know how I could store the real file name 
and the random path to the file without using more fields in the table.


Anyway, back to the main issue, the biggest problem is HTTP::Body steals the 
file upload fields if no files were attached.


Octavian


___
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] Where is the form field lost?

2010-01-24 Thread Octavian Râşniţă

From: Charlie Garrison garri...@zeta.org.au
On 24/01/10 at 10:47 PM +0200, Octavian Rasnita
orasn...@gmail.com wrote:

I made a InflateColumn::FileUpload inflator similar to InflateColumn::File, 
which also works with HTML::FormFu and it has an additional feature.


I had some problems with InflateColumn::File a few weeks ago which were 
going to be hard for me to work around. I asked about it on IRC and was 
told *not* to use the broken InflateColumn::File and use InflateColumn::FS 
instead.


Can you tell about those problems? I hope I won't create them in the 
inflator I want to create.


Not only did InflateColumn::FS resolve my main issue; it also fixed a 
couple of frustrating niggles. I found InflateColumn::FS to be more robust 
all around.


I have also tried InflateColumn::FS but the thing I don't like is that it 
creates random directories and this is good from a security point of view, 
but for ease of use I like the way InflateColumn::File create the target 
dirs.


With InflateColumn::File the original file name is also used when it is 
stored on the disk, and I just need to put a link to that static file, 
without needing to create a column for storing the MIME type of the file and 
without needing to use code for getting the file and giving it to those that 
request it.

If it is possible to do that with InflateColumn::FS, please tell me.

If you're going to upload an HTML::FF inflator module tp CPAN, I suggest 
making it work with InflateColumn::FS instead (or at least in addition to 
InflateColumn::File).


I have tried that with InflateColumn::File, but without success, but in any 
case, the most important changes were to make it work with HTML::FormFu and 
to be able to do all the operations to the file (add/modify/delete), and for 
beeing able to also do the delete, I need to be able to get the file upload 
field even if it is empty.


Octavian


___
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] Getting the file upload fields

2009-12-30 Thread Octavian Râşniţă

Hi,

I have seen that after a form that contains a file upload field is 
submitted, I can't access the name of that field if it was sent empty (no 
file was submitted).


I have tried to override more Catalyst methods like prepare_body_parameters, 
prepare_uploads, finalize_uploads, and even finalize_body and in each of 
them I tried to get the list of parameters using $c-req-params and 
$c-req-uploads.


I've seen that the field is submitted to the server even if it is empty and 
it looks like:


Content-Disposition: form-data; name=file; filename=
Content-Type: application/octet-stream

In the application I need to know which are the file upload fields that were 
sent, even if they are empty.


Does anyone know how I can find this?

Thank you.

Octavian


___
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] Building complex layouts

2009-12-30 Thread Octavian Râşniţă

From: Pavel O. Karoukin pa...@yepcorp.com


Hello,

I wonder what is a best practice to build complex layouts (sidebars, forms
in 'em, list of latest news in sidebar, etc)?
Right now I see it in chaining several actions and each one adding content
into stash. Is there any other dry approaches?
May be there is a way to separate each element of layout into it's own
action + template and call this from base template?


You can do:

sub main_action : Path {
 my ($self, $c) = @_;
 $c-forward('action1');
 $c-forward('action2', ['arg1', 'arg2']);
 #...
}

sub action1 : Private {
 my ($self, $c) = @_;
 #Get the content, eventually get/put it in/from the cache, and stuff it in 
the stash

 $c-stash(first_component = $content);
}

sub action2 : Private {
 my ($self, $c, $arg1, $arg2) = @_;
 # Same as previous
}

The template of the main_action will be able to use 
$c-stash-{first_component} or other variables you will put in the stash.
The results of the private subroutines can be used in more public actions, 
can be cached individually and their content can be created using their own 
templates, with a code like:


my $body_of_the_action = $c-view('TT')-render($c, 'path/to/template.tt');

Octavian


___
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] Limit Catalyst::Helper::Model::DBIC::Schema to a singletable ...

2009-12-25 Thread Octavian Râşniţă

From: Kiffin Gish kiffin.g...@planet.nl

Normally myapp_create.pl is run with the whole database given on the
command line, e.g.

script/myapp_create.pl model DB DBIC::Schema MyApp::Schema \
   create=static dbi:SQLite:myapp.db

Can I restrict this to a single table or tables only? For example, I
have an existing application and I add a new table I don't want to
recreate Schema/Results with a bunch of .new files and have to delete
them after-wards.

--
Kiffin Gish kiffin.g...@planet.nl



Don't know if it has that option, but the script below might help you:


use warnings;
use strict;
use FindBin qw/$Bin/;
use DBIx::Class::Schema::Loader qw/ make_schema_at /;

my %options;
if (@ARGV) {
my $table = shift @ARGV;
%options = (
constraint = ^$table\$,
#exclude = ^$table\$,
components = [...@argv]);
}

make_schema_at(MyApp::Schema,
{
%options,
debug = 1,
relationships = 1,
use_namespaces = 1,
dump_directory = $Bin/../lib ,
},
[dbi:mysql:database=mydb,
user,password]);

Octavian
 



___
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] Accessing $self in a plugin?

2009-12-23 Thread Octavian Râşniţă

Hi,

I use Catalyst::Controller::HTML::FormFu but in some actions I don't want to 
use the FormConfig attribute because it would automaticly generate and 
process a form, which takes much time. I want to do that only if the already 
generated template and data was not found in the cache.


But instead of writing each time

my $form = $self-form;
$form-load_config_filestem('path/to/config_file');
$form-process;
$c-stash-{form} = $form;

I would prefer to write a plugin, and write only something like:

$c-ff('path/to/config_file');

First, is this correct? (or it might appear some issues). I know that the 
plugins are not recommended, but it is not a Catalyst plugin for public use, 
but only one for my app.


And if it is ok, is it possible to get $self in the plugin in order to do 
$self-form?


Or I will need to send it explicitly using:

$ff($self, 'path/to/config_file');

Thanks.

Octavian


___
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] Bug in latest Catalyst::Runtime?

2009-12-18 Thread Octavian Râşniţă

Hi,

I found that in Catalyst::Runtime 5.80016 the following error still appears 
when there is a bug in the current application:


[error] Caught exception in engine Can't use string 
(8e6ef33a63f84c0132bf6e605898b7cc) as a HASH ref while strict refs in 
use at E:/perl510/site/lib/Catalyst/Engine.pm line 117.


The debug is not printed in the browser, but a Cannot find server only.

Octavian


___
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] [ANNOUNCE] Catalyst-Runtime 5.80016

2009-12-15 Thread Octavian Râşniţă

From: Felix Antonius Wilhelm Ostmann ostm...@websuche.de


Oleg Kostyuk schrieb:

2009/12/14 Alexander Hartmaier alexander.hartma...@t-systems.at:

All app errors result in this cat error with the new version for me:

[error] Caught exception in engine Can't use string
(508706d1a94648443fa31ffc8b2b5ccb) as a HASH ref while strict refs
in use at /home/ahartmai/perl5/lib/perl5/Catalyst/Engine.pm line 117.


Try update scripts with catalyst.pl -scripts -force YourAppName, I
had similar issue.


Same problem here and update did not help. Only occure after errors in
the app.



I have also installed the latest Catalyst::Runtime, Catalyst::Devel and 
re-created the app scripts, but that error still appears (I use Perl 5.10.0 
under Windows XP Pro).


Octavian


___
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 get the name of the subroutine accessed?

2009-12-08 Thread Octavian Râşniţă

2009/12/8 Octavian Râşniţă orasn...@gmail.com:

Is there a similar method for $c-action that can be used for getting the
name of the subroutine which is accessed?

[...]

If the information from my post from long ago [1] still holds true,
you should be able to use $c-stack-[ -1 ] to get the most recent
action.

$c-stack-[ -1 ] is what I used in the Dispatcher chapter of the book
for this very purpose.

Great! It was exactly what I needed.

Thank you all for your help.

Octavian


___
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] Conflict between C::TraitFor::Model::DBIC::Schema::Caching and C::P::I18N::DBI

2009-12-02 Thread Octavian Râşniţă

Hello,

I've installed Catalyst::TraitFor::Model::DBIC::Schema::Caching and it seems 
to work fine, but it conflicts with Catalyst::Plugin::I18N::DBI.


I made the following settings in order to be able to use C::TraitFor::...

'Model::DB' = {
 traits = ['Caching'],
 schema_class = 'BRK::Schema',
 connect_info = {
   dsn = 'dbi:mysql:database=brk',
   user = 'root',
   password = ,
   quote_char = '`',
   name_sep = '.',
 },
},

'Plugin::Cache' = {
 backend = {
   class = 'Cache::FileCache',
   cache_root = '__path_to(temp,cache)__',
 },
},

Each time I access a page that contains a string which was not translated, 
instead of replacing the key with ? $key and inserting that key in the 
database, MyApp just prints the key and it doesn't insert it into the DB.

And the follow error message is printed to STDERR:

[error] Failed within fail_with(): Can't use string (BRK) as a HASH ref 
while strict refs in use at E:/perl510/site/lib/Class/Accessor/Fast.pm 
line 10.


This error is printed in the module
Catalyst::Plugin::I18N::DBI
at line 255.

If I comment the line
 traits = ['Caching'],
in the Model::DB settings above, then Catalyst::Plugin::I18N::DBI works fine 
again.


I've seen that the program seems to end in Catalyst::Plugin::I18N::DBI at 
line 240, and this line is:


   my $res = $c-model($cfg-{lex_class})-search({ key 
= $key, lang = $lang, lex = $default_lex })-first;


I've seen that the program ends there no matter what search I made using 
DBIC.


That line is enclosed in a eval {} block, but no matter it is enclosed in 
eval {} or not, the program doesn't break, although when it is enclosed in 
eval it fails and sets that error in $...@.


If I take that line outside the eval {} block and put a $c-log-error line 
above it and another $c-log-error line below it, the error put above it 
prints to the error log, but the line below it it doesn't.
(And it is the same if I do this in the eval {} block. That's why I said 
that the program seems to end on that line.)


I don't know what's Catalyst::TraitFor::Model::DBIC::Schema::Caching doing 
that it doesn't allow C::P::I18N::DBI work correctly, but I have no idea how 
to solve this issue.


Help!

Thank you.

Octavian


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

2009-11-25 Thread Octavian Râşniţă

Hi,

I've created in MyApp/lib the module

MyApp/lib/Catalyst/Helper/Model/MyHelper.pm

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.


Is there any reason the local lib is not added to @INC in myapp_create.pl, 
or it is added but I am doing something wrong?


Thanks.

Octavian


___
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] Organize tests in sub-directories

2009-11-25 Thread Octavian Râşniţă

From: Tomas Doran bobtf...@bobtfish.net
On 24 Nov 2009, at 20:31, Octavian Râşniţă wrote:
I would like to structure the t directory as lib/MyApp is  structured. Is 
it possible to be able to configure the app somehow  so `make test` checks 
all the test files even if they are in sub- directories?


Yes, you just say something like:

tests 't/*.t', 't/*/*.t', 't/*/*/*.t'; # However many levels deep you
need
in Makefile.PL


This is good news. But unfortunately it executes only the tests from the t 
directory, not those from its subdirectories.


I have tried to put this line of code in more places in Makefile.PL with no 
difference.


Thanks.

Octavian


___
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] Organize tests in sub-directories

2009-11-25 Thread Octavian Râşniţă

From: Wallace Reis wall...@reis.org.br

On 25/11/2009, at 09:36, Octavian Râşniţă wrote:
This is good news. But unfortunately it executes only the tests from the t 
directory, not those from its subdirectories.


I have tried to put this line of code in more places in Makefile.PL with 
no difference.



You can use tests_recursive from Module::Install::Makefile.


Great! It works fine that way.

With this ocasion I've seen that the correct way of using tests() is not:

tests 't/*.t', 't/*/*.t', 't/*/*/*.t', 't/*/*/*/*.t', 't/*/*/*/*/*.t';

but probably

tests 't/*.t, */*.t';

(including all the file specifications in a single string)

Octavian



___
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] Organize tests in sub-directories

2009-11-24 Thread Octavian Râşniţă

Hello,

I would like to structure the t directory as lib/MyApp is structured. Is it 
possible to be able to configure the app somehow so `make test` checks all 
the test files even if they are in sub-directories?


`prove -r -l t` can do this, but it works well only under Linux or if I also 
add the -j parameter and a big enough number of parallel jobs, so I'm not 
sure it will always work.


Thanks.

Octavian


___
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] attrs for DBIx::Class::Row

2009-11-15 Thread Octavian Râşniţă

Hi,

After I constructed a resultset object, I can get the hash of attributes 
used for generating it using:

my $attrs = $rs-{attrs}

But if I get a row object from that resultset, I can't get the attributes 
anymore using:


my $row = $rs-first;
my $attrs = $row-{attrs};

Is there a way of getting the attributes used for searching, ordering, 
paginating... from a row object?


I want to use those attributes for generating a digest key in order to store 
the object in the cache, and I need to get those attributes after I created 
the row object.


Thank you.

Octavian


___
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] Debian recommendation

2009-10-17 Thread Octavian Râşniţă

From: J. Shirley jshir...@gmail.com


cpan look ModuleName
$ perl Makefile.PL
$ make
$ make test
$make install

I can install the modules without problem (usually).
However, I need to manually install each dependency.

I've seen this strange thing under 2 Debian systems so I think it is not 
a

Debian bug.

Does this happen to you? If yes, how do you solve it?

Thank you.

Octavian


 My Debian steps are:


(as root)
1. Upgrade CPAN (Bundle::CPAN)
2. Upgrade CPANPLUS
3. Upgrade/Install Module::Install
4. Upgrade/Install Module::Build
5. Install local::lib


Well, after upgrading these modules, the installation of other modules seems 
to work better with the cpan shell.



(as app user)
6. Install deps for application

I've never had a problem with things not building doing this, but haven't
tried other ways.


Can you tell me more about this last step?

I have tried to put in Makefile.PL:

use FindBin;
use local::lib $FindBin::Bin/support;

But when I run it, it still tries to write to /var/www which is the home dir 
of www-data user (the current user).


So I have also tried removing those 2 lines and doing:

$ perl -Mlocal::lib

Then
$ perl Makefile.PL

But it asked me:

[sudo] password for www-data:

and I must give the root password (and www-data is not in the sudoers 
group).


I have tried with another user:

# adduser octavian
# su octavian
$ cd /home/octavian
$ perl -Mlocal::lib
...
$ perl Makefile.PL

But it also asked me:

[sudo] password for octavian:

...when trying to install Catalyst::Runtime, so I must be doing something 
wrong.


For the first time I tried to su www-data and use this user because it is 
the user used by Apache and if I'd use another user and generate a temporary 
file, for example a compiled TT template, when Apache tries to re-write that 
file, it gives an error telling that it doesn't have the necessary 
permissions to overwrite it.


Thanks.

Octavian


___
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] Debian recommendation

2009-10-16 Thread Octavian Râşniţă

Hi,

I've seen a recommendation on this list for Debian for running perl apps, 
and recently I started to use this distro.


I've seen that I can install perl modules very hard under Debian if I use 
the CPAN shell.

For example if I run

$ cpan
cpan install Class::MOP

it gives an Unknown error and it doesn't want to install and the same with 
Catalyst::Runtime.


But if I do then

cpan look ModuleName
$ perl Makefile.PL
$ make
$ make test
$make install

I can install the modules without problem (usually).
However, I need to manually install each dependency.

I've seen this strange thing under 2 Debian systems so I think it is not a 
Debian bug.


Does this happen to you? If yes, how do you solve it?

Thank you.

Octavian


___
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] Debian recommendation

2009-10-16 Thread Octavian Râşniţă

From: J. Shirley jshir...@gmail.com

Hi,

I've seen a recommendation on this list for Debian for running perl apps,
and recently I started to use this distro.

I've seen that I can install perl modules very hard under Debian if I use
the CPAN shell.
For example if I run

$ cpan
cpan install Class::MOP

it gives an Unknown error and it doesn't want to install and the same
with Catalyst::Runtime.

But if I do then

cpan look ModuleName
$ perl Makefile.PL
$ make
$ make test
$make install

I can install the modules without problem (usually).
However, I need to manually install each dependency.

I've seen this strange thing under 2 Debian systems so I think it is not a
Debian bug.

Does this happen to you? If yes, how do you solve it?

Thank you.

Octavian



My Debian steps are:

(as root)
1. Upgrade CPAN (Bundle::CPAN)
2. Upgrade CPANPLUS
3. Upgrade/Install Module::Install
4. Upgrade/Install Module::Build
5. Install local::lib

(as app user)
6. Install deps for application

I've never had a problem with things not building doing this, but haven't
tried other ways.

-J

I guess your installing the deps for the application using local::lib, 
right?


Good idea. Is there a way of using Makefile.PL of the application to 
automaticly install all the dependencies using local::lib?


Thanks.

Octavian


___
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] Deployment in practice

2009-10-11 Thread Octavian Râşniţă

From: Bill Moseley mose...@hank.org
2009/10/9 Octavian Râşniţă orasn...@gmail.com


Hi,

I've recently started to use Mercurial for revision control and the pages
regarding the deployment of a Catalyst app from the Catalyst wiki also 
help

me very much, but I still don't know what would be the best method for
uploading the files to the server.

How do you do it?
Archive the entire app an dupload to the server then change the 
permissions

of the files and folders there?
Or upload the modified files one by one?
Or generate a tarball on each revision and unarchive and make, make test 
it

on the server?



I have a script on a build server that does an svn export of a specific
branch and version  (or latest trunk if no version specified).  The script
then runs the test suite, runs the build scripts that generate minified
css, javascript, and anything else that prepares the package such as create
a meta file with build info, and then builds a tarball named after the
reversion.  Also, a symlink is created as latest on the build server.

Then on target machines (testing, staging, and production) I have a push
script that fetches the tarball (based on a specific version or latest),
untars it on the machine.  It's untarred into a directory named after the
revision it came from.  Tests are run that verify that it can talk to
whatever it needs (database, services).  Then do a graceful stop of the
existing server, move symbolic links, start the server back up and then use
wget to validate a number of test URLs.  Depending on the update some
servers may get pulled out of the balancer before upgrading to do it in
stages.

Pushing a previous version will just update the symlinks if they revesion
exists.

Not perfect but seems to work ok for now.


Thank you all for your answers. It was very helpful.
What about the database? If starting from a certain revision you need to 
make some database changes (adding tables, adding/deleting some table 
fields) how can we automate this?


I mean, I think that we could run a script that add some tables and remove 
the unneeded fields from other tables, but if something goes wrong and we 
need to go back to the previous version, we would need the records from 
those fields.


What can we do in these situations? Do the database update and the tests 
manually? Or back-up the entire database and then test the latest version of 
the app?


Thanks.

Octavian


___
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] Deployment in practice

2009-10-09 Thread Octavian Râşniţă

Hi,

I've recently started to use Mercurial for revision control and the pages 
regarding the deployment of a Catalyst app from the Catalyst wiki also help 
me very much, but I still don't know what would be the best method for 
uploading the files to the server.


How do you do it?
Archive the entire app an dupload to the server then change the permissions 
of the files and folders there?

Or upload the modified files one by one?
Or generate a tarball on each revision and unarchive and make, make test it 
on the server?

Or something else?

Thank you.

Octavian


___
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] Deployment in practice

2009-10-09 Thread Octavian Râşniţă

From: J. Shirley jshir...@gmail.com

On Fri, Oct 9, 2009 at 7:55 AM, Tobias Kremer 
tobias.kre...@gmail.comwrote:



2009/10/9 Octavian Râşniţă orasn...@gmail.com:
 I've recently started to use Mercurial for revision control and the 
 pages

 regarding the deployment of a Catalyst app from the Catalyst wiki also
help
 me very much, but I still don't know what would be the best method for
 uploading the files to the server.
 How do you do it?

We do a checkout of the latest version on our staging server, test
everything and then rsync it to the webservers. Works like a charm.



I have deployment branches, and then push from there.  It's git, but I'd
assume you can do the same in hg (though I've never used it)

Thank you Tobias and J.

For the moment I think I will use Tobias' way, because I use Mercurial only 
for a few days and I don't know if it supports hooks made in bash.


I know that git is made in C and some perl scripts, that it is faster, much 
advanced than Mercurial (which is made in Python), but unfortunately it 
doesn't work well under Windows, and I do the development under Windows and 
the testing and production use under Linux...


Octavian


___
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] use base vs use parent

2009-08-25 Thread Octavian Râşniţă

Hi,

I've seen some Catalyst sample modules that use use base and some others 
that use use parent.


I know that the recommendation could be to use Moose and extends..., but 
if Moose is not needed, what's the difference between use parent and use 
base?


When should be use parent be used and not use base or it really doesn't 
matter which one is used?


Thanks.

Octavian


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

2009-07-19 Thread Octavian Râşniţă

Hi,

In DBIx::Class::ResultSource.pm's POD documentation I read:


add_columns
...
   Adds columns to the result source. If supplied key = hashref pairs,
   uses the hashref as the column_info for that column. Repeated calls of
   this method will add more columns, not replace them.


But in Catalyst::Manual::Tutorial::04_BasicCRUD.pod I read:


   __PACKAGE__-add_columns(
   created,
   { data_type = 'datetime', set_on_create = 1 },
   updated,
   { data_type = 'datetime', set_on_create = 1, set_on_update = 
1 },

   );

   This will override the definition for these fields that Schema::Loader
   placed at the top of the file.


What's the truth? Repeating calls of this method adds more columns and not 
replace them, or the columns are overriden?


I tend to believe the Catalyst tutorial, but I am not very sure.

Thanks.

Octavian


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

2009-07-19 Thread Octavian Râşniţă
In Catalyst::Manual::Tutorial::04_BasicCRUD.pod I read that we need to 
specify the ResultSet classes we want to use with:


__PACKAGE__-resultset_class('MyApp::Schema::ResultSet::Book');

I've seen that it works even without it. Is this line really needed?

Octavian


___
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] Can't validate the user on dev.catalystframework.org

2009-06-20 Thread Octavian Râşniţă

Hi,

I've tried for more times to create an user on dev.catalystframework.org but 
without success. It tells me that:



We've sent you an email with an activation link. Please click on it to 
activate your account!

The email was sent to orasn...@gmail.com.


But I never received that email, not even in the SPAM folder. So I gave 
another email address, but I didn't receive any message at that email 
address either.


Is there something wrong with the site?

Octavian


___
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] Can't validate the user on dev.catalystframework.org

2009-06-20 Thread Octavian Râşniţă

From: Tomas Doran bobtf...@bobtfish.net
On 20 Jun 2009, at 07:28, Octavian Râşniţă wrote:


But I never received that email, not even in the SPAM folder. So I  gave 
another email address, but I didn't receive any message at  that email 
address either.


Is there something wrong with the site?


No, there is nothing wrong. I don't know why you're not getting this..

I just tested it, and I can confirm I do get email from registering.

Cheers
t0m

I created a new account and this time I received the confirmation message 
immediately, but I still don't receive the confirmation message for the old 
account (but now I don't need it anymore).


Thanks.

Octavian


___
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 do you distribute a catalyst app

2009-06-11 Thread Octavian Râşniţă
From: Hans Dieter Pearcey hdp.perl.catalyst.us...@weftsoar.netOn Wed, 
Jun 10, 2009 at 10:33:26PM +0300, Octavian Râşniţă wrote:

 When using this syntax, where can I specify the local path where I want
 to install the Some::Module?



You never do that with local::lib.  It sets up the env variables for you
(PERL_MM_OPT and MODULEBUILDRC) -- CPAN.pm doesn't know anything about it.
hdp.


I read in the POD of local::lib that I can specify the local path where the 
modules are installed ('my_lwp'):


 # Install LWP and it's missing dependencies to the 'my_lwp' directory
 perl -MCPAN -Mlocal::lib=my_lwp -e 'CPAN::install(LWP)'

When using this syntax for installing modules in the directory 'my_lwp' I 
don't know how I can specify the force parameter of the cpan shell.


Thanks.

Octavian




___
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 do you distribute a catalyst app

2009-06-11 Thread Octavian Râşniţă

From: Tomas Doran bobtf...@bobtfish.net
Octavian Râşniţă wrote:
When using this syntax for installing modules in the directory 'my_lwp' I 
don't know how I can specify the force parameter of the cpan shell.


perl -MCPAN -Mlocal::lib=my_lwp -e 'CPAN::force(qw/install LWP/)'

Cheers
t0m

Thank you. local::lib seems to work fine, but not always:

 perl -MCPAN -Mlocal::lib=support -e CPAN::install(HTML::FormFu)

The result:

Database was generated on Thu, 11 Jun 2009 17:08:37 GMT
HTML::FormFu is up to date (0.05000).

But HTML::FormFu is not installed under the support path.

Sometimes I succeed to install some of the modules if I add the 
parameter --self-contained, but sometimes I can't because some dependencies 
are not installed automaticly, or some modules give very many errors like 
the case of Moose:


Failed 185/213 test programs. 20/536 subtests failed.

(This error is given when I try to install Moose using the standard cpan 
command line also.)


Octavian 



___
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 do you distribute a catalyst app

2009-06-11 Thread Octavian Râşniţă

From: Hans Dieter Pearcey hdp.perl.catalyst.us...@weftsoar.net

Failed 185/213 test programs. 20/536 subtests failed.

(This error is given when I try to install Moose using the standard cpan
command line also.)


This isn't an error, this is a summary.  No one can help you fix the problem 
if

all you give is the summary instead of the actual error log.  Nopaste, or
attach, or something?
hdp.

I discovered the problem. Moose requires a newer version of Class::MOP than 
the one I had it installed.


I don't know why cpan didn't try to install the newer version, because I've 
seen that the newer version was required in the Makefile.PL.


But now installs fine after manually installing Class::MOP.

Octavian


___
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 do you distribute a catalyst app

2009-06-10 Thread Octavian Râşniţă

From: Tomas Doran bobtf...@bobtfish.net

Patricio A. Bruna wrote:

Maybe i explain wrong.
I did not mean load balance, i meant deployment.
i develop my app on my box, and then i need to deploy it on the 
production server, with the same operating system. downloading all the 
modules from cpan is time consuming, are any better way?


Yes.

Use a self contained local::lib. Bootstrap local::lib (see the docs), 
then, from inside your MyApp directory:


eval 
$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib--self-containted,local_lib)

make installdeps

And you'll then have all the dependencies for your app (given you listed 
them in Makefile.PL) built for you, inside your app directory, where you 
can add them to revision control.


I generally have a per-app local::lib, and a couple of trivial shell 
scripts I put in the scripts/ directory which can give you a shell with 
the environment setup correctly to see this local::lib etc..


Then pushing a new version of your application (and all your dependencies) 
is just a case of rsyncing your app up to your web server :)


Cheers
t0m



I think it could be very helpful to add these details on the Deployment 
page of the wiki.


BTW, regarding local::lib, does anyone know how can I force install a module 
that gives an error under Windows when I use it?


Thanks.

Octavian




___
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 do you distribute a catalyst app

2009-06-10 Thread Octavian Râşniţă
From: Stuart Watt 
  Why would you do that? If the module you're installing fails its tests, you 
should file a bug report. What kind of error? IME you shouldn't ever want to or 
need to force install a module. This should be a *colossal* red flag to you. 

  ...

  /joel 

  It is very possible that the tests fail because the tests are wrong, not the 
module. I use a Perl that does not have fork emulation on Windows, partly for 
performance. Many tests assume fork, even where the modules they are testing do 
not depend on it. Yes, these modules should be reported, but you don't need to 
wait for a new release, nor is the module necessarily compromised. Authors 
cannot always test on a wide range of platforms. I find a good few modules fail 
tests for system/platform reasons rather than because of bugs in the code. 

  Modules I know fail on Windows without fork but generally don't care include: 
DBD::mysql, Test::NoWarnings, WWW::Mechanize, HTTP::Server::Simple, 
Cache::Cache, and DBD::SQLite. Most of these have tests that assume fork. Some 
get caught by file system differences and permissions differences. 

  You might have a wider concern if you are using a standard build (if such a 
thing exists) but it is at least sometimes justifiable to look through the 
tests that fail and make a judgment call. 

  --S

  -- 
  Stuart Watt
  ARM Product Developer
  Information Balance


  Hi,



  Sometimes I see that I can't install some perl modules, but then I found a 
ppm package  that can be installed, and that module has the same version as the 
ones I couldn't install using the cpan shell.



  So probably the tests are done wrong.



  Some tests (like the one for DBD::SQLite) also crash the perl interpreter, 
not only that the tests don't succeed.



  And as you said, most of the tests use fork and then I know why they are not 
working under Windows.



  If we need to deploy a Catalyst app under Linux, is not so hard to install 
modules from CPAN using the cpan shell, but it might be very hard to install 
some modules under Windows, so it would be very good if we could use local::lib 
to pre-install the necessary modules.



  And regarding my question, in local::lib's POD, I read that:



  From the shell -

perl -MCPAN -Mlocal::lib=my_lwp -e 'CPAN::install(LWP)'



  Where in this command line can I add the force parameter, or is there 
another way of installing perl modules in the local directory?



  And, another question:

  Can we deploy an app that uses local::lib without having shell access but 
only ftp access if local::lib is not installed?

  (It would be interesting to know, although I never needed it until now.)



  Thanks.



  Octavian




___
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] Why it is better to use an ORM like DBIx::Class

2009-05-27 Thread Octavian Râşniţă

Hi,

I corrected (re-written) that message in which I tried to show why it is 
better to use DBIC, because it doesn't affect the efficiency. Here it is. I 
hope it could be helpful. Please tell me if you think it needs improvements:


Why it is better to use an ORM like DBIx::Class

There are many advantages of using an ORM, but I won't remember all of them 
here.
I just want to show how clean it could be a code that uses DBIx::Class 
instead of manually adding parts for creating SQL queries.


And I would also like to show that this doesn't affect the efficiency.

DBIx::Class works the same in all apps, but I will show an example using the 
Catalyst framework.


# 1. Create the application named OurApp:

catalyst.pl OurApp

# 2. Go to the application's home dir:

cd OurApp

#3. Create the tables in the ourapp database using the definitions shown 
below:


create table continent(
id int unsigned not null auto_increment primary key,
name varchar(20),
hemisphere varchar(10)
) engine=InnoDB;

create table country(
id int unsigned not null auto_increment primary key,
id_continent int unsigned not null,
name varchar(30),
national_day date,
foreign key(id_continent) references continent(id)
) engine=InnoDB;

create table city(
id int unsigned not null auto_increment primary key,
id_country int unsigned not null,
name varchar(30),
population int unsigned,
foreign key(id_country) references country(id)
) engine=InnoDB;

# 4. Generate the DBIx::Class result classes:

perl script/ourapp_create.pl model DB DBIC::Schema OurApp::Schema 
create=static dbi:mysql:database=ourapp root


# 5. Create a Template-Toolkit view, named TT

perl script/ourapp_create.pl view TT TT

# 6. Create a controller named Continent, and change its content:

perl script/ourapp_create.pl controller Continent

package OurApp::Controller::Continent;

use strict;
use warnings;
use parent 'Catalyst::Controller';

sub index :Path :Args(0) {
 my ( $self, $c ) = @_;

 #Get a variable from a submitted form:
 my $continent_name = $c-req-params-{continent_name};

 #Select the continents from the Northern hemisphere:
 my $continents = $c-model(DB::Continent)-search({
   hemisphere = 'North',
 });

 #Until this point, no query is sent to the database.

 #If the user asked for a certain continent in this hemisphere, add it as a 
filter:
 $continents = $continents-search({name = $continent_name}) if 
$continent_name;


 #Until this point, no query is sent to the DB yet and more such filters 
may be applied.


 #Add the $continents object to the stash, for printing data from it in the 
templates

 $c-stash-{continents} = $continents;

 #This last line of the subroutine also didn't send anything to the 
database.

}

#And here the action subroutine ended, without sending anything to the 
database.


#The default TT template root/continent/index.tt is processed by the TT view 
at this point.


1;

# 7. Create the content of the template file (root/continent/index.tt):

htmlheadtitleContinents/title/headbody

form
 Continent: input type=text name=continent_name
 input type=submitbrbr
/form

h1Print the information for the selected continents:/h1

[% FOREACH continent IN continents.all %]
 Continent name: [% continent.name %]br
 Continent hemisphere: [% continent.hemisphere %]brbr

 h2Print the information for the countries from [% continent.name 
%]:/h2


 [% FOREACH country IN continent.countries %]
   Country name: [% country.name %]br
   Country national day localized: [% 
country.national_day.set_locale('fr').strftime('%e %b %Y') %]brbr


   h3Print here information for the cities from [% country.name %]:/h3

   [% FOREACH city IN country.cities %]
 City name: [% city.name %]br
 city population: [% city.population %]brbr
   [% END %]
 [% END %]
[% END %]

/body/html

# 8. Start the application using the development server:
perl script/ourapp_server.pl -p 80

# 9. And access the controller at the URL:
http://localhost/continent

By default, it will show the whole list of continents from the northern 
emisphere that were inserted in the database, their countries and their 
cities.


If you will filter the results and add the name of a certain continent in 
the form field, it will display only that continent, its countries and their 
cities.


Before starting the development server, set the environment variable 
DBIC_TRACE to 1, for printing the SQL queries that are generated on each 
request.


If you will type the name of the continent NonExistent in the text field 
of the form, the single SQL query that will be generated would be:


SELECT me.id, me.name, me.hemisphere FROM continent me WHERE ( ( name = ? 
AND hemisphere = ? ) ):

'NonExistent', 'North'

It won't find this continent, and it won't send the other SQL queries to the 
DB for getting information about countries and cities.


If the continent Asia is inserted in the DB, but no countries are inserted 
for it, the generated SQL queries will be:


SELECT me.id, me.name, me.hemisphere FROM 

Re: [Catalyst] Run the test server on a different port than 3000

2009-05-23 Thread Octavian Râşniţă

From: Tomas Doran bobtf...@bobtfish.net

Tomas Doran wrote:


and a new 
Catalyst-Devel will be released shortly..


This has now happened, please upgrade so that you don't have this 
problem again.


Thanks
t0m



Thank you t0m! 


Now it works fine.

Octavian


___
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] Run the test server on a different port than 3000

2009-05-21 Thread Octavian Râşniţă

Hi,

I tried:

e:\web\ catalyst Testing

e:\web\ cd Testing

e:\web\Testing\ perl script/testing_server.pl -p 80

But it gave the message that the app can be accessed on the port 3000. I 
have also tried to start it on the port 82, but it started on the port 3000.


I use perl 5.10.0 and Catalyst 5.80004.

Octavian


___
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] Run the test server on a different port than 3000

2009-05-21 Thread Octavian Râşniţă
I have Catalyst::Devel 1.15 and I have also force installed it again, but it 
gives the same error.


It works if I use the parameter -port, but it doesn't work with -p.

Octavian

- Original Message - 
From: Tomas Doran bobtf...@bobtfish.net

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Thursday, May 21, 2009 8:41 PM
Subject: Re: [Catalyst] Run the test server on a different port than 3000


Update Catalyst::Devel to at least 1.15 and regenerate your scripts, 
you're currently using scripts generated by 1.13 or 1.14 which suffered 
from this bug.


Cheers
t0m

___
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] Run the test server on a different port than 3000

2009-05-21 Thread Octavian Râşniţă

From: Hans Dieter Pearcey hdp.perl.catalyst.us...@weftsoar.net
On Thu, May 21, 2009 at 09:23:12PM +0300, Octavian Râşniţă wrote:

I have Catalyst::Devel 1.15 and I have also force installed it again, but
it gives the same error.
You forgot to read the whole message:

Update Catalyst::Devel to at least 1.15 and regenerate your scripts,

   ^^^
Having a newer verion just *installed* doesn't help.
hdp.


In my test I created a new app, so regenerating the scripts isn't helpful. 
Anyway, I have also tried to create a new app, and regenerate the scripts, 
but it still doesn't work with -p.


(Although, I can start an older app that uses older scripts, using -p)

Thanks.

Octavian


___
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] unknown resource

2009-05-02 Thread Octavian Râşniţă

Hi,

I've started to use fastcgi with Apache and after a little fight with it, I 
made it work, but I can't access /server-status anymore.


I've checked and mod_status.so  is loaded in httpd.conf:

LoadModule status_module modules/mod_status.so

and it is also configured to show the server status on /server-status for 
everyone:


Location /server-status
 SetHandler server-status
 Order deny,allow
 Allow from all
/Location

But when I access /server-status the Catalyst app gives the following error:

Unknown resource server-status

(or Unknown resource server-status/ if I add a slash at the end)

I couldn't find anything about this issue anywhere.

Do you have any idea what could be the problem?

I use Apache 2.2.9, Perl 5.10.0 and the latest version of Catalyst under 
Fedora.


Octavian


___
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] unknown resource

2009-05-02 Thread Octavian Râşniţă

From: Ash Berlin ash_c...@firemirror.com
On 2 May 2009, at 09:25, Octavian Râşniţă wrote:


Hi,

I've started to use fastcgi with Apache and after a little fight  with it, 
I made it work, but I can't access /server-status anymore.


I've checked and mod_status.so  is loaded in httpd.conf:

LoadModule status_module modules/mod_status.so

and it is also configured to show the server status on /server- status for 
everyone:


Location /server-status
SetHandler server-status
Order deny,allow
Allow from all
/Location

But when I access /server-status the Catalyst app gives the  following 
error:


Unknown resource server-status

(or Unknown resource server-status/ if I add a slash at the end)

I couldn't find anything about this issue anywhere.

Do you have any idea what could be the problem?

I use Apache 2.2.9, Perl 5.10.0 and the latest version of Catalyst  under 
Fedora.


Octavian



I'm guessing you've got your cat app rooted/deployed on '/' and are  using 
FastGCI (from your other thread)?

If so then I think you need something like this in the config:
Alias /server-status /server-status


Yes, this was the problem. I made some tests and I came to the conclusion 
that Catalyst responds to all those URIs which don't have a distinct Alias 
when it is used with fastcgi, no matter if they are handled by other 
modules.


Octavian





___
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] Bad gateway error

2009-05-02 Thread Octavian Râşniţă
From: J. Shirley 
Then the Cookbook is wrong. I've never seen anything but a 500 error from 
any web server I've used.


   If you have a proxy in front, and the backend is down, you get a 502 error.
   -J

  If mod_perl is used, it is clear that there could be a reverse proxy or a 
load balancer in front, that could be also Apache or something else, and in the 
backend there could be one or more Apache servers using mod_perl.

  But if fastcgi is used... I thought that Apache acts like a reverse proxy 
server and the backend server is the fastcgi external server that runs the 
Catalyst app.
  I don't know how would be possible for that front end Apache to run more 
fastcgi external apps.

  Is it necessary to have a 3-parts system when using fastcgi?
  (the front end reverse proxy or load balancer, the back end server that 
connects to the fastcgi external server and that external fastcgi server?)

  Octavian

___
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] Unknown error

2009-05-01 Thread Octavian Râşniţă

Hi,

I've tried to install Catalyst::Devel with ActivePerl 5.10.0 under Fedora, 
but I received the warning below.


I read that bug ticket and I've seen that this bug was patched in perl 
5.10.1.


Does this mean that if I will compile Perl 5.10.0 from the tarball, it will 
give the same error?
If yes, is Perl 5.10.1 available somewhere and stable enough for beeing 
recommended to install it?

If no, do you have a better suggestion for solving this issue?

Thank you.

The warning:

### WARNING #
#   #
# You are using perl 5.10.0 with the Unknown error bug. This can make #
# developing Catalyst applications much more painful, as it will come   #
# up with no details every time you have a syntax error in a Controller.#
#   #
# For more information see: #
#   #
#  * http://rt.perl.org/rt3/Public/Bug/Display.html?id=49472#
#   #
# It is highly recommended that you use a different version of perl or  #
# compile a patched version for Catalyst development.   #
#   #
# To skip this check, set the CATALYST_DEVEL_NO_510_CHECK environment   #
# variable. #
#   #
#
Do you want to continue? [no]


___
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] Avoid adding InflateColumn::DateTime when using the DBIC::Schema Catalyst helper?

2009-04-26 Thread Octavian Râşniţă

Hi,

Is there a way of avoiding to add the InflateColumn::DateTime component to a 
DBIC class when using the DBIC::Schema catalyst helper?


Or if the component is added, can I add something after do not modify 
anything above to disable it entirely?


I want to do this because I have some classes with many date fields, and 
InflateColumn::DateTime give fatal errors when finding MySQL null dates 
(-00-00).


And maybe a more important reason is that I would need to modify very many 
templates and instead of [% row.date %], I would need to write [% 
row.date.date %].


Octavian


___
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] nmake catalyst_par

2009-04-20 Thread Octavian Râşniţă
From: Tomas Doran bobtf...@bobtfish.netOn 19 Apr 2009, at 17:27, 
Octavian Râşniţă wrote:

With Catalyst 5.8 I've tried:

E:\web\T2 perl Makefile.PL
...
E:\web\T2 nmake
...
E:\web\T2 nmake catalyst_par
...


snip


Could be an error of PAR, or something else?


I guess you're using perl 5.8 rather than 5.10?

If so, then this is as PAR isn't following the fact that MRO::Compat
needs to pull in Class::C3 to do its job on perl 5.8. Try explicitly
saying 'use Class::C3' in your MyApp.pm and this may fix it.

This is just a guess - but one of the major problems with PAR is that
its detection of what to package doesn't work so well with runtime
class loading :/

Cheers
t0m



Thanks and sorry for not giving a complete explanation, but I use Perl 
5.10.0.

I've also added use Class::C3 but it still gives the error below.

I will report this to the PAR mailing list if you think it is a PAR error.

Can't locate mro.pm in @INC (@INC contains: CODE(0x13576bc) 
C:\DOCUME~1\Octavian

\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc\l
ib 
C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4edd
ab5538c327ccea7f2\inc\arch 
C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache
-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc CODE(0x11e6594) 
e:\lucru\catalyst\

support\lib . CODE(0x11e6044)) at MRO/Compat.pm line 38.
BEGIN failed--compilation aborted at MRO/Compat.pm line 44.
Compilation failed in require at Class/MOP.pm line 9.
BEGIN failed--compilation aborted at Class/MOP.pm line 9.
Compilation failed in require at Moose/Exporter.pm line 10.
BEGIN failed--compilation aborted at Moose/Exporter.pm line 10.
Compilation failed in require at Moose.pm line 16.
BEGIN failed--compilation aborted at Moose.pm line 16.
Compilation failed in require at Catalyst/Engine/HTTP.pm line 3.
BEGIN failed--compilation aborted at Catalyst/Engine/HTTP.pm line 3.
Compilation failed in require at ./script/t6_server.pl line 6.
BEGIN failed--compilation aborted at ./script/t6_server.pl line 7.
E:\web\T6

Octavian


___
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] nmake catalyst_par

2009-04-19 Thread Octavian Râşniţă

Hi,

With Catalyst 5.8 I've tried:

E:\web\T2 perl Makefile.PL
...
E:\web\T2 nmake
...
E:\web\T2 nmake catalyst_par
...
Writing PAR t2.par

# Until here is good, because with the previous version it gave an error and 
didn't want to create the par archive.


E:\web\T2 parl t2.par script/t2_server.pl
Can't locate mro.pm in @INC (@INC contains: CODE(0x13572ac) 
C:\DOCUME~1\Octavian

\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc\l
ib 
C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4edd
ab5538c327ccea7f2\inc\arch 
C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache
-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc CODE(0x11e6594) 
e:\lucru\catalyst\

support\lib . CODE(0x11e6044)) at MRO/Compat.pm line 38.
BEGIN failed--compilation aborted at MRO/Compat.pm line 44.
Compilation failed in require at Class/MOP.pm line 9.
BEGIN failed--compilation aborted at Class/MOP.pm line 9.
Compilation failed in require at Moose/Exporter.pm line 10.
BEGIN failed--compilation aborted at Moose/Exporter.pm line 10.
Compilation failed in require at Moose.pm line 16.
BEGIN failed--compilation aborted at Moose.pm line 16.
Compilation failed in require at Catalyst/Engine/HTTP.pm line 3.
BEGIN failed--compilation aborted at Catalyst/Engine/HTTP.pm line 3.
Compilation failed in require at ./script/t2_server.pl line 6.
BEGIN failed--compilation aborted at ./script/t2_server.pl line 7.
E:\web\T2

Could be an error of PAR, or something else?

Thank you.

Octavian


___
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] ModPerl::Registry

2009-04-08 Thread Octavian Râşniţă

Hi,

I know that if possible the mod_perl handlers are recommended and not 
ModPerl::PerlRun and neither ModPerl::Registry, but these options could be 
used to run Catalyst applications in less privileged servers because the 
server doesn't need to be restarted in order to start the application.


I read C::Engine::Apache2::MP20's POD documentation saying that:

   While this method is not recommended, you can also run your Catalyst
   application via a ModPerl::Registry script.

   httpd.conf:

   PerlModule ModPerl::Registry
   Alias / /var/www/MyApp/script/myapp_registry.pl/

   Directory /var/www/MyApp/script
   Options +ExecCGI
   /Directory

   Location /
   SetHandler  perl-script
   PerlResponseHandler ModPerl::Registry
   /Location

   script/myapp_registry.pl (you will need to create this):

   #!/usr/bin/perl

   use strict;
   use warnings;
   use MyApp;

   MyApp-handle_request( Apache2::RequestUtil-request );

Does anyone know why this method is not recommended? Shouldn't it work?

I've tried it and the applications run well the main page (the / URI) but if 
I create another controller and try to access it, it gives a 404 Not Found 
error.


I tried with a pre-made app and with a new MyApp.pm with the same results.

Thanks.

Octavian


___
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] Building a PAR file

2009-02-26 Thread Octavian Râşniţă

Hello,

I've tried to create a PAR archive from a Catalyst app and I've done:

1. Put catalyst_par(); in Makefile.PL.

2. Run perl Makefile.PL

3. Run nmake catalyst_par

But it gave the following error:

Writing PAR acces.par
NMAKE : fatal error U1077: 'E:\perl510\bin\perl.exe' : return code '0x2'
Stop. 


Do you have any idea what could be the problem? PAR? Catalyst?

Can't a PAR archive of a Catalyst app be built under Windows?

Thanks.

Octavian


___
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: decoding in core

2009-02-23 Thread Octavian Râşniţă

From: Peter Karman pe...@peknet.com
Neo [GC] wrote on 02/23/2009 09:41 AM:



Does anyone know a _safe_ method to convert _any_ string-scalar to utf8?
Something like
anything_to_utf8($s)
, regardless if $s contains ascii, latin1, utf8, tasty hodgepodge or hot
fn0rd, utf8-flag is set or not and is neither affected by full moon nor
my horrorscope, _without_ doing double-encoding (there MUST be some way
to determine if it already is utf8... my silly java editor can do it and
perl makes difficult things at least possible).


I would greatly appreciate this philosophers stone and will send my hero
a bottle of finest bavarian (munich!) beer called Edelstoff (precious
stuff - tasty).



Search::Tools::UTF8::to_utf8() comes close. It won't handle mixed
encoding in a single string (which would be garbage anyway) but it does
try to prevent double-encoding and uses the Encode goodness under the 
hood.


--
Peter Karman  .  pe...@peknet.com  .  http://peknet.com/


I understand that there are reasons for not transforming all the encodings 
to UTF-8 in core, even though it seems to be not very complicated, because 
maybe there are some tables that contain ISO-8859-2 chars and other tables 
that contain ISO-8859-1 chars, and when the data need to be saved, it should 
keep its original encoding.


But if somebody wants to create a new Catalyst app, with a new database, new 
templates, controllers, etc, I think it could be very helpful if the 
programmer would only need to specify only once that he wants to use UTF-8 
everywhere - in the database, in the templates, in the configuration files 
of HTML::FormFu, in the controllers, and not in more places in the 
configuration file, or specify UTF8Columns in DBIC classes...

It could be a kind of default.

Octavian








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

2009-02-21 Thread Octavian Râşniţă

Hello,

It is very clear that a Catalyst app can't run on a shared host, but it 
requires either a dedicated server or a VPS.
I am searching for web space providers that offer VPS and I've seen that 
they use to set their tariff plans mainly on the guaranteed memory, but I 
don't know which would be the necessary memory for a VPS that runs an OS 
like Fedora or CentOS, Apache, Perl and Catalyst.


Could be 256 MB of memory enough? Or 512? Or I would need 1 GB or more if I 
would like to run a Catalyst app?


That Catalyst app would use a MySQL database, and it would have around 100 
tables, and 20 - 30 Catalyst controllers.


Can I find this type of information somewhere?

Thanks.

Octavian


___
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: The paradox of choice in web development

2009-02-15 Thread Octavian Râşniţă

From: Dan Dascalescu ddascalescu+catal...@gmail.com

I've just discovered Data::Dump but it appears to beat the crap out of
Data::Dumper. Yet does it say anywhere Hey, if you're getting started
with Perl and need to dump variables, use Data::Dump, and don't waste
your time investigating other modules? If I were the author of
Data::Dumper, I'd somehow retire the module, or plaster a note in the
POD redirecting people to Data::Dump. Imagine a programmer new to Perl
picks up an example that uses Data::Dumper. Will they find out about
Data::Dump? No. Someone picks up the Catbook and learns about
FormBuilder. Does http://www.formbuilder.org/ mention FormFu anywhere?
No. It mentions its last update, March 2007.


I also agree, but unfortunately I don't know what should be the solution for
this kind of problems.

One of the biggest issues for the perl programmers, Catalyst users or not,
is to choose the right module for sending email, because I guess there are
tens of modules for this task.

And to increase the confusion, I have also added one more
(Mail::Builder::Simple) and a helper for Catalyst
(Catalyst::Helper::Model::Email) that helps using it in a Catalyst app.

This is because I wanted to have a perl module that can send email which
automaticly encodes the body and headers to UTF-8, in order to be able to
include special chars in them, to be able to add attachments, inline images,
to create a multipart with a text and html version without needing to create
those parts manually, to be able to create the body of the message and the
attachments by using templates, and I couldn't find a perl module that can
do this.

So a Catalyst beginner will hear that he can send email from Catalyst by
using a View, then he will find that he can also send email by using a
model, and after a few experiences like these, he won't be sure that he uses
the right tool.

I would be very glad to hear that there is a better module for sending email
than the one I wrote, that would be higher level, that would require less
code, that would be able to send email using more types of servers, and when
I'd find it, I would surely specify in the POD documentation of that module
that I recommend the other, and I will surely start using it myself.

Octavian


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