Re: [Catalyst] error handling (Chain where ajax and non-ajax actionschain off)

2010-11-10 Thread Octavian Rasnita
Hi,

From: Eden Cardim edencar...@gmail.com
 in Controller::Artist:
 
 sub error_404 :Action {


Can I find more information about the :Action dispatch type?

Is it just a replacement for :Private? Or it is something different?

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] Accessing DB from external model

2010-11-05 Thread Octavian Rasnita

From: Mike Raynham catal...@mikeraynham.co.uk

Hi,

I am fairly new to all things Perl and Catalyst, and would like to know if 
what I am attempting to do is correct.


I've recently finished reading 'The Definitive Guide to Catalyst', which 
has been very helpful, but I am still a little confused about separating 
my business logic from my Catalyst application, and accessing the database 
connection from my non-Catalyst application.


At the moment, I have my external class in the lib/MyApp directory.  It 
uses the connection info found in MyApp::Model::DB, like so:


---

# lib/MyApp/MyExternalClass.pm
MyApp::MyExternalClass

use MyApp::Model::DB;
use MyApp::Schema;

my $connect_info = MyApp::Model::DB-config-{connect_info};
my $schema = MyApp::Schema-connect( $connect_info );

# Do stuff with $schema...

---

That works, and I can connect to the database.  However, I have searched 
this mailing list, and found this:


http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg00817.html

Here, the connection information is moved from MyApp::Model::DB to 
MyApp::DB, and then Catalyst::Model::Adaptor is used to glue 
MyApp::Model::DB to MyApp::DB.  Is it a good idea?  MyApp::Model::DB 
appears to be part of the Catalyst application, so if I want to access the 
database from an external model, it makes sense to me to move the 
connection code outside of the Catalyst application.



Regards,

Mike



The best idea would be to put the connection information in the 
application's config file like in the example below. (This example uses a 
Perl data structure, but you can use any configuration type accepted by 
Config::Any).


'Model::DB' = {
 schema_class = 'MyApp::Schema',
 connect_info = {
   dsn = 'dbi:Oracle:host=10.10.10.10;port=1521;sid=ora8',
   user = 'user',
   password = password,
   #name_sep = '.',
   LongReadLen = 100*1024*1024,
   LongTruncOk = 1,
   on_connect_call = 'datetime_setup',
   on_connect_do = [
 alter session set NLS_COMP='LINGUISTIC',
 alter session set NLS_SORT='BINARY_AI',
   ],
 },
},

The model will access the connection information directly if it is defined 
in the config file, and you can use the data from this config file in any 
other external program.
You can use the module Config::JFDI for using the Catalyst config file 
easier.


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] Accessing DB from external model

2010-11-05 Thread Octavian Rasnita
From: Darren Duncan dar...@darrenduncan.net
 For any configuration details that might vary either per application or per 
 deployment, make these user-configurable parameters of MyDBLib, with then 
 each 
 of your applications would supply arguments to it when instantiating a 
 MyDBLib 
 object; in the Catalyst app's case, said arguments would be in your Catalyst 
 app 
 config file as is normal for MyApp::Model::DB.
 
 For any configuration details that are unlikely to vary per application or 
 per 
 deployment, especially if they are details for which your actual code would 
 vary, then put these directly in your MyDBLib code instead.


Yes you are right.

 Octavian Rasnita wrote:
 The best idea would be to put the connection information in the 
 application's config file like in the example below. (This example uses a 
 Perl data structure, but you can use any configuration type accepted by 
 Config::Any).
 
 'Model::DB' = {
  schema_class = 'MyApp::Schema',
  connect_info = {
dsn = 'dbi:Oracle:host=10.10.10.10;port=1521;sid=ora8',
user = 'user',
password = password,
#name_sep = '.',
LongReadLen = 100*1024*1024,
LongTruncOk = 1,
on_connect_call = 'datetime_setup',
on_connect_do = [
  alter session set NLS_COMP='LINGUISTIC',
  alter session set NLS_SORT='BINARY_AI',
],
  },
 },
 
[snip]

 Now some of this looks wrong to me; a lot of those details should be in your 
 MyDBLib code instead of the config file.  Your config file should instead 
 look 
 more like this:
 
 'Model::DB' = {
  schema_class = 'MyApp::Schema',
  connect_info = {
host = '10.10.10.10',
port = 1521,
user = 'user',
password = password,
  },
 },
 
 These are more details that a non-programmer user would set.


I agree and yes, that sample code could give bad ideas.
In my case I am the app designer, coder, maintainer, site admin, everything but 
the web designer and I've done it so for not specifying these settings in more 
places.

Is there another place where I could put these settings for a certain DBIC 
schema?
For example, can I put them in the MyApp/Schema.pm, orsomewhere else? Can you 
give an example?

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] myapp_test.pl - running code from the command line

2010-11-03 Thread Octavian Rasnita

From: Jonathon Soong j...@investmentscience.com.au
Yes I realise now it might make more sense in the Model, but at the moment 
it is in the Controller (it is someone else's code, so more difficult for 
me to refactor).


There are two questions I have then:
1. How do you call a Model's function from the command line?
2. Is there no way to call controller methods that require authentication?

Thanks


Jon



The model can be just a thin wrapper for your non-catalyst modules like 
MyApp::Model::DB could be for your DBIC schema.
And you can use your non-catalyst module from a non-catalyst script that can 
be ran by a cron job.


If the code is in the controller and you can access it by web only, you can 
create a script that accesses your running Catalyst application, does the 
login (submits the login form with the necessary username and password), 
saves the cookie and resends that cookie for all the requests you need to do 
after logging in.


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] Creating HTML docs from POD

2010-11-03 Thread Octavian Rasnita
From: Rippl, Steve 

  I use Pod::Simple::HTMLBatch and a simple script that points to 
.../Controller ../Model .../Schema/ResultSet etc and dumps the resulting html 
in a subfolder under root/pod which I set to be server statically be the 
application itself.



  Thanks. I have successfully created the documentation with it.

  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] Creating HTML docs from POD

2010-11-03 Thread Octavian Rasnita
From: Michael Brutsch 
   Try pod2html

  I have tried it with many options, but it just sits and doesn't do anything 
for a long time.

  Do you have a sample command line that works?

  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] Has anyone read the book Catalyst 5.8 : The Perl MVCFramework yet?

2010-10-26 Thread Octavian Rasnita
IMHO the dispatching is a very important chapter for a web framework, 
especially for Catalyst that has so many things to offer in this field.


And another important thing is to show how Catalyst works alone, without an 
ORM, without a templating system, without a form processor, with the warning 
that this not the right way to do it, but it is very important for the 
beginners to see which are the things that depend on Catalyst and which are 
those that depend on the ORM or templating system.


And another important thing is to use a lot of warnings that This is not 
the right way when DBIC code is used in the controllers for beeing easier 
to understand by the beginners, but to let them know that that way of doing 
things should be avoided.


And it should be very helpful to show examples of models that get data and 
save data, but models that don't use an ORM like DBIC.


--Octavian

- Original Message - 
From: Kieren Diment dim...@gmail.com

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Tuesday, October 26, 2010 7:57 AM
Subject: Re: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl 
MVCFramework yet?



Wrong book.  The discussion was about the new edition of the Packt book. 
You appear to be referring to the Apress book The Definitive Guide to 
Catalyst


With the Apress book, we assumed that you could read the freely available 
tutorial already, so our aim wasn't to duplicate that.


Should we ever go to second edition I'd like to significantly expand the 
cookbook chapter (which I must respectfully disagree is of great usefulness 
to the beginner - I'm also strongly of the opinion that the Chained dispatch 
type chapter is also of great use to the beginner, although the point may 
not be immediately apparent until you start designing your own application's 
dispatch structure).


On 25/10/2010, at 11:23 AM, John Karr wrote:


It came out just as I was trying to learn catalyst. From a beginner
perspective it wasn't of any value -- thankfully Kennedy Clark has been
doing an excellent job with the Tutorial on CPAN, because that's how I
figured most things out. I was severely disappointed with the book, and 
not
the least concerned with LOLCats and Kitty Pidgin. The people who wrote 
the

book are a very knowledgeable group and sometimes their book works as a
reference, but overall doesn't seem add a lot to what's already in the
documentation, while being of no value to beginners whatsoever.



It would be nice to have a good beginner book and a more advanced book. If
any of the more advanced programmers on this list would like someone to 
help

with writing the beginner book, don't hesitate to get in touch!




From: Philip Medes [mailto:pmedes_2...@yahoo.com]
Sent: Friday, October 01, 2010 5:33 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl
MVC Framework yet?



I actually read the first 2 chapters and tried the examples.   I haven't 
had

time to finish the book.
I haven't read any other books on Catalyst, but I do like the Sitepoint
books better (Build Your Own Ruby On Rails Web Applications).

 _

From: Kiffin Gish kiffin.g...@planet.nl
To: catalyst@lists.scsys.co.uk
Sent: Fri, October 1, 2010 3:15:47 PM
Subject: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl MVC
Framework yet?

I recently received a copy of the book Catalyst 5.8 : The Perl MVC
Framework for review, have read it and tried out the examples.

Before I make my judgments public, I'd first be curious to hear from
others in the Catalyst Community about what their views are on the
book.

Those that have actually read the book, that is. I've already seen a
couple blog entries and they tend to be fairly negative (we sure prefer
to rant).

--
Kiffin Gish kiffin.g...@planet.nl
Gouda, The Netherlands



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

Dev site: http://dev.catalyst.perl.org/



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

Dev site: http://dev.catalyst.perl.org/



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



___
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] Returning to referer - which action to take?

2010-09-26 Thread Octavian Rasnita
From: Ekki Plicht (DF4OR) e...@plicht.de
 Hi.
 
 In my app I use I18N, so the visitor should be able to select his or her 
 language at will. The available languages are available on all pages for 
 selection. Once selected the preferred language is stored in a session 
 cookie, 
 otherwise the automatic mechanism of I18N uses the preferred language set in 
 the request header (if any)

Can't you use I18N's mechanism for detecting the current's page language?

For example, you can have urls like:

www.site.com/en/dir1/dir2
www.site.com/ro/dir1/dir2

In this case you may store the chosen language in the cookie only for 
displaying the first page of that site in that language the next time the 
visitor accesses your site.

Of course, you don't need to create a En or Ro controller for doing this.
You can override prepare_path() or you can use the module:

http://search.cpan.org/~mendel/Catalyst-Plugin-I18N-PathPrefix-0.02/lib/Catalyst/Plugin/I18N/PathPrefix.pm

There is another example that uses the chained dispatching mechanism you can 
find at:

http://www.catalystframework.org/calendar/2006/18


 Imagine that currently page 
 http://localhost:3000/foo/1/bar/2 
 is displayed in english. Now visitor clicks on 
 http://localhost:3000/sellang/de ,
 the internal variable for language is set. This normally involves per-user 
 session management and cookies. Now I want to display the very same page 
 (/foo/1/bar/2) but in german.

It is not a good idea to use the same URL for pages in different languages, 
because they won't be probably all indexed by the search engines.
You can add a query_string like lang=en but it is not nice and it requires too 
many changes if your app is already half-built.

 Serving the pages in different languages works fine with C::P::I18N, but I 
 can't figure out how to return the visitor to the refering page. Simply 
 redirecting to the referer does not work, because a prepared cookie isn't 
 preserved over a redirect (isn't it?). 

A redirect is nothing else than a HTTP header that tells the browser to what 
URL it should visit immediately.
So the cookie already set by the first request should be sent by the next 
request too.

Ideally, the link to each language-changer on each page should display the same 
page in the chosen language, and not the first page of the site or another 
default page.

So if the visitor is on the page:

www.site.com/ro/dir1/dir2

and clicks on the English link, it should see immediately the page:

www.site.com/en/dir1/dir2

The referrer page is the one in Romanian so if the user clicks on the back 
button, the /ro/dir1/dir2 page will be re-displayed.

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] best practices for handling forms?

2010-09-21 Thread Octavian Rasnita

Hi,

A clean example that uses HTML::FormFu is:

package MyApp::Controller::Foo;

use Moose;
extends 'Catalyst::Controller::HTML::FormFu';
# or just  use parent 'Catalyst::Controller::HTML::FormFu' if you don't use 
Moose


sub edit : Local FormConfig {
 my ($self, $c, $id) = @_;

 my $form = $c-stash-{form};
 my $foo = $c-model(DB::Foo)-find($id);

 if ($form-submitted_and_valid) {
   $form-model-update($foo);
   $c-flash(notice = Foo was updated successfully.);
   $c-res-redirect($c-uri_for_action('/foo/index'));
 }
 else {
   $form-model-default_values($foo);
 }
}


sub edit : Local FormConfig {

You can use Path or the chaining dispatch type or something else, not only 
Local.
If you use the attribute FormConfig, it will search for the form placed by 
default in

root/forms/foo/edit.conf

If you want to use another specified form, you can use something like:

sub edit : Local FormConfig('path/to/another/form') {


 my $form = $c-stash-{form};

If you use the FormConfig attribute, it will place the form in the stash 
automaticly so you just need to get it from there.



 my $foo = $c-model(DB::Foo)-find($id);

This uses DBIx::Class result class DB::Foo for getting the $foo record.


if ($form-submitted_and_valid) {

This will be true only if the form past all the validation and constraints.

$form-model-update($foo);

This will update the $foo record in the database. In order to work this way, 
you need to have defined the database schema in myapp.conf like:


'Controller::HTML::FormFu' = {
 model_stash = {
   schema = 'DB',
 },
},

And in the edit.conf form configuration file (defined below using 
Config::General) you will need to have defined the resultset like:


model_config
resultset Foo
/model_config


$c-res-redirect($c-uri_for_action('/foo/index'));

$c-uri_for_action is prefered because /foo/index is not a URI but an 
internal path to the index action from the Foo controller and this code 
doesn't need to be changed even if the public URI to that action changes.


$form-model-default_values($foo);

This fills the form with the values from $foo record when the form is 
displayed.


HTH.

--Octavian

- Original Message - 
From: E R pc88m...@gmail.com

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Tuesday, September 21, 2010 12:48 AM
Subject: [Catalyst] best practices for handling forms?



Hi,

I am curious what everyone thinks as being the best practices for
handling forms in Catalyst. Are there any Catalyst applications you
have run across which are good examples of how to use Catalyst's
features to handle forms?

To illustrate what I am getting at, below is typical Rails (v2)
controller code which implements updating the attributes of an object:

  def edit
 @book = Book.find(params[:id])
 @subjects = Subject.find(:all)
  end
  def update
 @book = Book.find(params[:id])
 if @book.update_attributes(params[:book])
flash[:notice] = 'Book successfully updated.'
redirect_to :action = 'show', :id = @book
 else
@subjects = Subject.find(:all)
render :action = 'edit'
 end
  end

In Catalyst, this would be appear something like (and please correct
me if I have made any errors here):

sub edit  :Args(1) {
 my ($self, $c, $id) = @_;
 ... set up $c-stash for template 'edit' ...
 # no need to set $c-stash-{template} - will be set from the current 
action

}

sub update :Args(1) {
 my ($self, $c, $id) = @_;
 ...process form...
 if (form is valid) {
   ...perform updates...
   $c-flash-{notice} = 'Book successfully updated.';
   $c-res-redirect('show', $id);
 } else {
   ... set up $c-stash for 'edit' template ...
   $c-stash-{template} = 'edit';
 }
}

Any comments on this architecture? Is there a better way? My main problems 
are:


1. The code ... set up $c-stash for 'edit' template ... is duplicated
in both edit and update (which is also true for the Rails code).

2. Having the template name defaulted from the current action is nice,
but that means we have to explicitly set it in the update method. Is
it better to always explicitly set the template name in a controller
method? Then update could perform a $c-detach('edit', $id) or would
you use $c-go('edit', $id)?

Thanks,
ER

___
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] Defining ARRAY in Config::General config

2010-09-21 Thread Octavian Rasnita
The problem appears when the array should have just a single item, because 
in that case Config::General reports it as a scalar value.


I don't know if there is a better way of defining a single-item array with 
Config::General, but I found a workaround that may work. We can use 
something like:


foo bar
foo

This creates an array with 2 elements and the last one is undef.

--Octavian

- Original Message - 
From: Kamen Naydenov pa...@kamennn.eu

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Tuesday, September 21, 2010 9:05 AM
Subject: Re: [Catalyst] Defining ARRAY in Config::General config


On Tue, Sep 21, 2010 at 07:29, Pavel A. Karoukin hipp...@gmail.com 
wrote:

Hello,
I am using Catalyst::Plugin::Mail and want to define email config in
myapp.conf. But C::P::Mail expects email config variable to be array ref.
How I can assign array value to config variable in myapp.conf?

Multiple rows with same name and different values form array in myapp.conf

For example:
room 7
room 9
room 13

Example is in Config::General syntax

best regards
Kamen

___
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] Defining ARRAY in Config::General config

2010-09-21 Thread Octavian Rasnita

Hi Andrew,

I tried:

C:\Documents and Settings\Teddy perl -MConfig::General -e print 
$Config::General::VERSION

2.49

#The program:

use Config::General;
use Data::Dumper;

my $conf = Config::General-new('config.conf');
my %conf = $conf-getall;

print Dumper \%conf;

#The configuration file:

array2
foo [ bar ]
/array2

foo [ bar ]

#The result:

$VAR1 = {
 'foo' = '[ bar ]',
 'array2' = {
   'foo' = '[ bar ]'
 }
   };

So it seems it doesn't work as it should because it creates a scalar that 
contains [ bar ].


Am I missing something?

Thanks.

--Octavian

- Original Message - 
From: Andrew Rodland and...@cleverdomain.org

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Tuesday, September 21, 2010 11:27 AM
Subject: Re: [Catalyst] Defining ARRAY in Config::General config



On Tuesday, September 21, 2010 02:52:52 am Octavian Rasnita wrote:
The problem appears when the array should have just a single item, 
because

in that case Config::General reports it as a scalar value.

I don't know if there is a better way of defining a single-item array 
with

Config::General, but I found a workaround that may work. We can use
something like:


With Config::General = 2.47 and Config::Any = 0.20, you can use the 
syntax

foo [ bar ] or foo = [ bar ] to set the key foo to an arrayref
containing the single value bar. The latest version of
Catalyst::Plugin::ConfigLoader will ensure that you're up to date.

Andrew

___
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] Defining ARRAY in Config::General config

2010-09-21 Thread Octavian Rasnita
From: Emanuele Zeppieri ema...@gmail.com
 To obtain single value arrays with the syntax in question, the above
 line should be:
 
 my $conf = Config::General-new( -ConfigFile = 'config.conf',
 -ForceArray = 1 );
 


Aa, 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] best practices for handling forms?

2010-09-21 Thread Octavian Rasnita
You don't need to do the redirect if you don't want it, but it is the 
recommended way.

Instead of the redirect, you can forward to another method that prints the page 
you want:

$c-forward('foo/success_method', ['possible', 'parameters']);

In that case after the data is stored in DB, the specified method is called.

But after doing a POST request it is a good idea to do a redirect because if 
the user would refresh the page, he might send the posted data again.

Octavian

- Original Message - 
From: E R pc88m...@gmail.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Tuesday, September 21, 2010 8:25 PM
Subject: Re: [Catalyst] best practices for handling forms?


 Hernan, Octavian - thanks for your replies.
 
 Both of you have given examples where the display of the form and the
 processing of the form are handled by the same method. In that case in
 order to go from one page to the next you always need to use a
 redirect. Doing this is very clean, but it involve another
 communications round trip.
 
 If the form display and form processing are handled by separate
 methods, you can avoid the redirect if you're careful.
 
 Any thoughts on this issue?
 
 Thanks,
 ER
 
 ___
 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] Working with project configurationfileoutsideofCatalyst directory

2010-09-05 Thread Octavian Rasnita
Hi Leandro,

Have you tried to use in your main configuration file something like:

MyDB
include db.conf
/MyDB

and in your Catalyst configuration file something like:

Model::DB
include db.conf
/Model::DB

and in the db.conf:

   schema_class ...
   connect_info
   dsn ...
   username ...
   password ...
   AutoCommit 1
   /connect_info

Octavian

- Original Message - 
From: Leandro Hermida soft...@leandrohermida.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Sunday, September 05, 2010 2:14 AM
Subject: Re: [Catalyst] Working with project configurationfileoutsideofCatalyst 
directory


 Hi there,
 
 But none of these solutions solve the problem I mentioned in my
 earlier email.  If for example you have your database connection
 information in the parent project configuration file which would be
 common since many things outside of Catalyst need to access the
 database and in this file you would have it look like this:
 
 MyDB
   schema_class ...
   connect_info
   dsn ...
   username ...
   password ...
   AutoCommit 1
   /connect_info
 /MyDB
 
 And in the Catalyst configuration file if you include the parent
 config it won't work since Catalyst::Model::DBIC::Schema seems to need
 the enclosing tags to start with Model:: i.e. Model::MyDB
 /Model::MyDB.  Of course it doesn't make sense to use such tags in
 the parent configuration.
 
 Does anyone know of a way to have Catalyst::Model::DBIC::Schema look
 for a different set of tags in the Config::General file?
 
 best,
 Leandro
 
 ___
 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] Deleting the expired session files?

2010-09-05 Thread Octavian Rasnita
From: Peter Karman pe...@peknet.com

 Octavian Rasnita wrote on 9/4/10 8:39 AM:
 Hello,
 
 I am trying to create a script that will be executed by a cron job which 
 will delete all the expired session files, but without success.
 I use the Session::Store::File plugin.
 
 
 can't you just use the mtime of the file to determine whether it should be 
 deleted?
 
 -- 
 Peter Karman  .  http://peknet.com/  .  pe...@peknet.com

Yes, finally I've done it so.

Thanks all.

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] Working with project configurationfileoutsideofCatalystdirectory

2010-09-05 Thread Octavian Rasnita
Please tell us if it works, because I haven't tried it.

Octavian

- Original Message - 
From: Leandro Hermida soft...@leandrohermida.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Sunday, September 05, 2010 7:53 PM
Subject: Re: [Catalyst] Working with project 
configurationfileoutsideofCatalystdirectory


Hi Octavian,

That makes a lot of sense thank you, I had mistakenly thought that you
had to include an entire Config::General block if you wanted to
include it in something else.  Will try that

best,
Leandro

On Sun, Sep 5, 2010 at 8:58 AM, Octavian Rasnita orasn...@gmail.com wrote:
 Hi Leandro,

 Have you tried to use in your main configuration file something like:

 MyDB
 include db.conf
 /MyDB

 and in your Catalyst configuration file something like:

 Model::DB
 include db.conf
 /Model::DB

 and in the db.conf:

 schema_class ...
 connect_info
 dsn ...
 username ...
 password ...
 AutoCommit 1
 /connect_info

 Octavian

 - Original Message -
 From: Leandro Hermida soft...@leandrohermida.com
 To: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Sent: Sunday, September 05, 2010 2:14 AM
 Subject: Re: [Catalyst] Working with project 
 configurationfileoutsideofCatalyst directory


 Hi there,

 But none of these solutions solve the problem I mentioned in my
 earlier email. If for example you have your database connection
 information in the parent project configuration file which would be
 common since many things outside of Catalyst need to access the
 database and in this file you would have it look like this:

 MyDB
 schema_class ...
 connect_info
 dsn ...
 username ...
 password ...
 AutoCommit 1
 /connect_info
 /MyDB

 And in the Catalyst configuration file if you include the parent
 config it won't work since Catalyst::Model::DBIC::Schema seems to need
 the enclosing tags to start with Model:: i.e. Model::MyDB
 /Model::MyDB. Of course it doesn't make sense to use such tags in
 the parent configuration.

 Does anyone know of a way to have Catalyst::Model::DBIC::Schema look
 for a different set of tags in the Config::General file?

 best,
 Leandro

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

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


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

___
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] DBIC mailing list?

2010-09-03 Thread Octavian Rasnita
First, sorry for offtopicness.

From: Bill Crawford billcrawford1...@gmail.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Friday, September 03, 2010 3:07 PM
Subject: Re: [Catalyst] DBIC mailing list?


 2010/9/3 Octavian Rasnita octavian.rasn...@ssifbroker.ro:
 Hi,

 Has anyone any idea why I can't send messages to the DBIC mailing list
 anymore?

 When I used to send messages from home they used to be rejected as SPAM.
 I've subscribed with another email address from office and I send messages
 from the office but now the messages don't reach on the list and don't come
 back as spam.
 
 When you say don't reach the list is it possible you're not seeing
 it because your mail client sees it as a duplicate of the sent message
 which it's already stored elsewhere?
 


Nope, it is not possible, because it doesn't happend with other mail messages 
sent to other mailing lists, like the current one, for example and my messages 
just don't come back.

(And my office email address is hosted on our server and it doesn't block self 
messages).

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] DBIC mailing list?

2010-09-03 Thread Octavian Rasnita
Hi Chris and all,

Thank you for your help.

I've re-subscribed with my gmail address and I've seen that now the messages 
from both email addresses reached on the list.

Thanks.

Octavian

- Original Message - 
From: Chris Jackson c.jack...@shadowcat.co.uk
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Friday, September 03, 2010 6:52 PM
Subject: Re: [Catalyst] DBIC mailing list?


 Dave Howorth wrote:
 
 Octavian Rasnita wrote:
 From: Bill Crawford billcrawford1...@gmail.com
 2010/9/3 Octavian Rasnita octavian.rasn...@ssifbroker.ro:
 Has anyone any idea why I can't send messages to the DBIC mailing list
 anymore?
 [...]
 
 Octavian, I suggest you contact the DBIC list admin. The address is at
 the bottom of the mailman page listed at the end of al messages.
 
 
 Unfortunately that's an address of Matt Trout's which I don't think is 
 currently monitored. I don't see any posts arriving at lists.scsys.co.uk 
 from you except to Catalyst. The same blacklist config is used for both 
 catalyst and dbix-class.
 
 Octavian, I can confirm the dbix-class knows about 
 octavian.rasn...@ssifbroker.ro, but not about orasn...@gmail.com, if 
 that helps. Can you try again, perhaps, and let me know the time at 
 which you did it? It'd help me narrow the logs down a bit.
 
 (If you don't know, I'm the system admin for Shadowcat ;)
 
 --
 Chris Jackson
 Shadowcat Systems Ltd.
 
 
 ___
 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/


[Catalyst] DBIC mailing list?

2010-09-02 Thread Octavian Rasnita
Hi,

Has anyone any idea why I can't send messages to the DBIC mailing list anymore?

When I used to send messages from home they used to be rejected as SPAM.
I've subscribed with another email address from office and I send messages from 
the office but now the messages don't reach on the list and don't come back as 
spam.

Thank you.

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5419 (20100902) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

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


Re: [Catalyst] Working with project configuration file outside ofCatalyst directory

2010-09-01 Thread Octavian Rasnita
There may be other ways, but you could create a separate configuration file 
that contains the database connection settings only and include that 
configuration file in both the master configuration and Catalyst configuration 
files.
If you'll want to change the database connection settings, you will need to 
change it in a single place.

Octavian

- Original Message - 
From: Leandro Hermida soft...@leandrohermida.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, September 01, 2010 7:49 PM
Subject: [Catalyst] Working with project configuration file outside ofCatalyst 
directory


 Dear all,
 
 My apologies if I haven't seen the post with the answer, I've looked
 all over and get explanations for not exactly the same thing. I have a
 big project of which the Catalyst application is only a part.  I want
 a master configuration file for the project which has configuration of
 things independent of Catalyst (e.g. the database connection and
 related info) and of course this configuration file lives outside of
 the Catalyst application directory.  Catalyst will have its
 configuration file in the application directory e.g. my_app.conf and
 this file with have only configuration related to Catalyst and I
 Catalyst to be able to draw from the master project configuration file
 outside to get for example onfiguration for connecting to the database
 because this shouldn't be in my_app.conf.
 
 Configuration shouldn't be anywhere twice and project code outside the
 Catalyst sub-project shouldn't have any knowledge of Catalyst at all
 and shouldn't go get configuration inside Catalyst, it should be the
 other way around (the only explanations I've seen take the former
 approach).  Is there a way to do this?
 
 best,
 Leandro
 
 ___
 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] Working with project configuration file outsideofCatalyst directory

2010-09-01 Thread Octavian Rasnita
Hi Leandro,

If you use Config::General style configuration files, search for include 
string in the POD documentation of Config::General module and you will find the 
syntax used for including another config file.

For example, if you want to include the file external.conf in a certain place 
in another configuration file, you can use:

include external.conf

Octavian

- Original Message - 
From: Leandro Hermida soft...@leandrohermida.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, September 01, 2010 9:51 PM
Subject: Re: [Catalyst] Working with project configuration file 
outsideofCatalyst directory


Hi Octavian,

Thank you for the information, I am a bit confused how to implement it
though, what do you mean include that configuration file in both the
master configuration and Catalyst configuration files?

Suppose I have my master project directory:

myproject/
lib/
... other dirs...
myproject.conf
web/   Catalyst application directory
inc/
lib/
myproject_web.conf
script/
t/

In myproject.conf I would have the database connection info amongst
other configuration used by the overall project:

DB
schema_class ...
connect_info
dsn ...
username ...
password ...
AutoCommit 1
/connect_info
/DB

In the Catalyst configuration myproject_web.conf I would have things
specific to Catalyst:

name MyApp::Web
default_view HTML


How would I have Catalyst be able to include the configuration
automatically from myproject.conf outside the Catalyst app dir?

best,
Leandro


On Wed, Sep 1, 2010 at 7:25 PM, Octavian Rasnita orasn...@gmail.com wrote:
 There may be other ways, but you could create a separate configuration file 
 that contains the database connection settings only and include that 
 configuration file in both the master configuration and Catalyst 
 configuration files.
 If you'll want to change the database connection settings, you will need to 
 change it in a single place.

 Octavian

 - Original Message -
 From: Leandro Hermida soft...@leandrohermida.com
 To: The elegant MVC web framework catalyst@lists.scsys.co.uk
 Sent: Wednesday, September 01, 2010 7:49 PM
 Subject: [Catalyst] Working with project configuration file outside 
 ofCatalyst directory


 Dear all,

 My apologies if I haven't seen the post with the answer, I've looked
 all over and get explanations for not exactly the same thing. I have a
 big project of which the Catalyst application is only a part. I want
 a master configuration file for the project which has configuration of
 things independent of Catalyst (e.g. the database connection and
 related info) and of course this configuration file lives outside of
 the Catalyst application directory. Catalyst will have its
 configuration file in the application directory e.g. my_app.conf and
 this file with have only configuration related to Catalyst and I
 Catalyst to be able to draw from the master project configuration file
 outside to get for example onfiguration for connecting to the database
 because this shouldn't be in my_app.conf.

 Configuration shouldn't be anywhere twice and project code outside the
 Catalyst sub-project shouldn't have any knowledge of Catalyst at all
 and shouldn't go get configuration inside Catalyst, it should be the
 other way around (the only explanations I've seen take the former
 approach). Is there a way to do this?

 best,
 Leandro

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

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


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

___
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] Working with project configuration fileoutsideofCatalyst directory

2010-09-01 Thread Octavian Rasnita

Hi,

If you include a child config file in your main config file, Catalyst will 
see the child configuration as a part of the parent so it shouldn't be any 
diffrence.


--
Octavian

- Original Message - 
From: Leandro Hermida soft...@leandrohermida.com

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, September 01, 2010 10:46 PM
Subject: Re: [Catalyst] Working with project configuration 
fileoutsideofCatalyst directory



Hi there,

Thank you I did not see that!  For others it is here:

http://search.cpan.org/~tlinden/Config-General-2.49/General.pm#INCLUDES

Which brings the second question, now that one includes this
configuration from the parent project, e.g. the database connection
info, how will the Catalyst model for this DB properly pick it up?
Catalyst::Model::DBIC::Schema expects to find it in tags starting with
Model e.g. Model::DB and it won't be like this for the parent
configuration. Is there a way for Catalyst::Model::DBIC::Schema to
read from a different config section?

best,
Leandro

On Wed, Sep 1, 2010 at 9:20 PM, Octavian Rasnita orasn...@gmail.com wrote:

Hi Leandro,

If you use Config::General style configuration files, search for include 
string in the POD documentation of Config::General module and you will 
find the syntax used for including another config file.


For example, if you want to include the file external.conf in a certain 
place in another configuration file, you can use:


include external.conf

Octavian

- Original Message -
From: Leandro Hermida soft...@leandrohermida.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, September 01, 2010 9:51 PM
Subject: Re: [Catalyst] Working with project configuration file 
outsideofCatalyst directory



Hi Octavian,

Thank you for the information, I am a bit confused how to implement it
though, what do you mean include that configuration file in both the
master configuration and Catalyst configuration files?

Suppose I have my master project directory:

myproject/
lib/
... other dirs...
myproject.conf
web/  Catalyst application directory
inc/
lib/
myproject_web.conf
script/
t/

In myproject.conf I would have the database connection info amongst
other configuration used by the overall project:

DB
schema_class ...
connect_info
dsn ...
username ...
password ...
AutoCommit 1
/connect_info
/DB

In the Catalyst configuration myproject_web.conf I would have things
specific to Catalyst:

name MyApp::Web
default_view HTML


How would I have Catalyst be able to include the configuration
automatically from myproject.conf outside the Catalyst app dir?

best,
Leandro


On Wed, Sep 1, 2010 at 7:25 PM, Octavian Rasnita orasn...@gmail.com 
wrote:
There may be other ways, but you could create a separate configuration 
file that contains the database connection settings only and include that 
configuration file in both the master configuration and Catalyst 
configuration files.
If you'll want to change the database connection settings, you will need 
to change it in a single place.


Octavian

- Original Message -
From: Leandro Hermida soft...@leandrohermida.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, September 01, 2010 7:49 PM
Subject: [Catalyst] Working with project configuration file outside 
ofCatalyst directory




Dear all,

My apologies if I haven't seen the post with the answer, I've looked
all over and get explanations for not exactly the same thing. I have a
big project of which the Catalyst application is only a part. I want
a master configuration file for the project which has configuration of
things independent of Catalyst (e.g. the database connection and
related info) and of course this configuration file lives outside of
the Catalyst application directory. Catalyst will have its
configuration file in the application directory e.g. my_app.conf and
this file with have only configuration related to Catalyst and I
Catalyst to be able to draw from the master project configuration file
outside to get for example onfiguration for connecting to the database
because this shouldn't be in my_app.conf.

Configuration shouldn't be anywhere twice and project code outside the
Catalyst sub-project shouldn't have any knowledge of Catalyst at all
and shouldn't go get configuration inside Catalyst, it should be the
other way around (the only explanations I've seen take the former
approach). Is there a way to do this?

best,
Leandro

___
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

Re: [Catalyst] [Beginner] model with MySQL, is many_to_many required?

2010-08-26 Thread Octavian Rasnita

From: Ekki Plicht (DF4OR) e...@plicht.de

Hi.

Just getting around to implement the first user auth stuff, and as usual I 
am

going along with MySQL. I know, I know, please no DB flame wars :-)

As most of the docs are based on SqLite and Cat/MySQL docs are a little 
bit

sketchy, I am unsure if my Schema requires the manual addition of the
many_to_many relationship, or if this is just a requirement for SqLite.



Yes you need to manually add the many_to_many relationship.
Something like:

__PACKAGE__-many_to_many(roles = 'user_roles', 'role');

Octavian


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5400 (20100826) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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


Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Octavian Rasnita

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


On 17 Aug 2010, at 06:27, Octavian Rasnita wrote:


I load and store this object in the stash on each request in the 
Root::auto : Private method with:


$c-stash(menu = $c-model('Menu'));

But this would re-create the menu object on each request, and this  takes 
time.


No, it wouldn't. The adaptor you showed has a lifetime of the 
application, and so it won't be recreated each request.


Thank you all for remembering me this! I used Catalyst::Model::Factory 
somewhere else exactly because it doesn't create just a single object 
instance like C::M::Adaptor, but I have forgotten.



 Also, even if you were creating an object every request (which you
aren't), if you're worrying about this without numbers, then this is 
premature opimisation.


Well, it is not exactly without numbers. I have tried
ab -n 200 -c 5 http://localhost/

The result was... 3 to 4 requests per second.

I commented the line that stores the menu in the stash (for not using the 
menu at all) and the same command line gave a result of around 33 requests 
per second, which is a very big difference.


So I think the buggy part is the module that creates the menu object from 
the data structure loaded in the configuration file.


I will first try to use the data structure directly in the TT template 
without creating an object from it.


If it would be too slow, I will try to draw the menu entirely in the 
template without using an external data structure, although I don't like 
this.


Thank you all very much for your help.

Octavian


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5374 (20100817) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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


Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Octavian Rasnita

Yes, that was the thing I needed to remember.

I have also tried to use a Moose attribute and create the object in its
default, but that way it would really re-create the object on each request.

Thank you.

--
Octavian

- Original Message - 
From: Charlie Garrison garri...@zeta.org.au

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Tuesday, August 17, 2010 9:27 AM
Subject: Re: [Catalyst] Store something in the stash at startup


Good afternoon,

On 17/08/10 at 8:27 AM +0300, Octavian Rasnita
octavian.rasn...@ssifbroker.ro wrote:


$c-stash(menu = $c-model('Menu'));

But this would re-create the menu object on each request, and this takes
time.

The data structure of the menu is loaded only at startup by the do() in the
configuration file, but
then it is used on each request to re-create the menu object.


Are you looking for this:

http://search.cpan.org/perldoc?Catalyst::Model::Adaptor

Specifically:

   Note that NotMyApp::SomeClass is instantiated at application startup
time.


Charlie

--
  Ꮚ Charlie Garrison ♊ garri...@zeta.org.au

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

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

__ Information from ESET NOD32 Antivirus, version of virus signature
database 5371 (20100816) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5374 (20100817) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5374 (20100817) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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


Re: [Catalyst] Finding the memory leaks in a Cat app

2010-08-16 Thread Octavian Rasnita

Hi Tomas,

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

On 13 Aug 2010, at 12:11, Octavian Rasnita wrote:
I have a Catalyst application that occupies 180 MB of RAM if it uses  the 
internal development server. It occupies more than 1 GB of RAM  if it 
uses Apache/mod_perl.


I don't believe that. But never mind..


I have checked the memory by using the top command before and after loading 
the development server and I did it for more times. I've seen that big 
difference so I assume that it is the memory used by my app.


I have moved some modules outside lib because they are used only by some 
scripts which are ran in a cron job, and the memory usage decreased, but it 
is still very high.
Even an empty Cat app started with the development server occupies 36 MB of 
RAM.


It is strange that it occupies so much, because I heard that a Cat app can 
be used even on an VPS with 256 MB RAM. I use Perl 5.10.0 under Ubuntu 
10.04, with the latest Catalyst, latest HTML::FormFu, latest 
Template-Toolkit, latest DBIC and I use Oracle.



[debug] Circular reference detected:
..
| $ctx-{stash}-{__InstancePerContext_158098900}-
{c}   |
| $ctx-{stash}-{__InstancePerContext_158258668}-
{c}   |
| $ctx-{stash}-{__InstancePerContext_158322332}-
{c}   |
''


Whatever component in your application is using InstancePerContext is 
leaking.


Are you using it directly yourself, and if not, what components from  CPAN 
are you using, at what versions?


(Or, look into a debug dump screen, find the things in the stash which 
are in an __InstancePerContext key - these are the candidates to blame)





Thank you for telling where to find that information. I don't use 
InstancePerContext directly, but C::C::HTML::FormFu uses it.


I have tested an empty Cat app (created with catalyst.pl MyApp) and it was 
not leaking.
I have just changed the controller Root.pm and made it subclass 
C::C::HTML::FormFu instead of C::C and CatalystX::LeakChecker started to 
report leaks and those stash elements were closed to C::C::HTML::FormFu.


So C::C::HTML::FormFu or HTML::FormFu or another module it uses might be the 
leak cause.


I reported this to the HTML::FormFu mailing list.

Thanks.

Octavian


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/

__ Information from ESET NOD32 Antivirus, version of virus 
signature database 5363 (20100813) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5368 (20100815) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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/


[Catalyst] Store something in the stash at startup

2010-08-16 Thread Octavian Rasnita
Hi,

I have a module that creates an object (a menu) and I want to store it in the 
stash when the application starts.
Where is the recommended place to create this object and store it in the stash 
if I want that object created just once at app startup?

Should I override a certain method in MyApp.pm and create the object there?

Thanks.

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5368 (20100815) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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/


[Catalyst] Finding the memory leaks in a Cat app

2010-08-13 Thread Octavian Rasnita
Hello,

I have a Catalyst application that occupies 180 MB of RAM if it uses the 
internal development server. It occupies more than 1 GB of RAM if it uses 
Apache/mod_perl.

Even though it is very much, it would be OK if the memory usage wouldn't 
increase on each request.

I have started Apache with the -X parameter to use a single process and I have 
also changed to 1 all the settings for Prefork MPM, but when using the ab 
utility, the memory usage increases and it creates swap.
The memory it occupies also increases if I use the internal development server.

So I am pretty sure my app has some memory leaks and I tried to use 
CatalystX::LeakChecker for finding them.

It gave the following results, but I don't know how to interpret them and find 
the piece of code that create leaks:

[debug] Circular reference detected:
..
| $ctx-{stash}-{__InstancePerContext_158098900}-{c}   |
| $ctx-{stash}-{__InstancePerContext_158258668}-{c}   |
| $ctx-{stash}-{__InstancePerContext_158322332}-{c}   |
''

I've also tried to use C::P::LeakTracker by adding it to the list of plugins 
and creating the Leaks.pm controller:

package BRK::Controller::Leaks;
use Moose;
use namespace::autoclean;
use parent qw(Catalyst::Controller::LeakTracker);

sub index :Path :Args(0) {
my ( $self, $c ) = @_;
$c-forward(list_requests); # redirect to request listing view
}

__PACKAGE__-meta-make_immutable;
1;

But when I access it, it gives the error below.

Please give me some hints for using these 2 modules, or recommend another way 
of finding the code that create memory leaks.

Thank you.

I am using Perl 5.10.1 and Catalyst 5.80025.

Here is the error generated when I access /leaks:

Couldn't load class (MyApp) because: Couldn't instantiate component 
MyApp::Controller::Leaks, Inconsistent hierarchy during C3 merge of class 
'MyApp::Controller::Leaks': merging failed on parent 'Moose::Object' at 
e:/usr/lib/mro.pm line 24.Compilation failed in require at 
e:/usr/site/lib/Class/MOP.pm line 114.
 at e:/usr/site/lib/Class/MOP.pm line 120
 Class::MOP::__ANON__('Couldn\'t instantiate component 
MyApp::Controller::Leaks, In...') called at e:/usr/site/lib/Try/Tiny.pm line 
98
 Try::Tiny::try('CODE(0x2062e54)', 'Try::Tiny::Catch=REF(0x2ae97d4)') called at 
e:/usr/site/lib/Class/MOP.pm line 125
 Class::MOP::load_first_existing_class('MyApp') called at 
e:/usr/site/lib/Class/MOP.pm line 137
 Class::MOP::load_class('MyApp') called at 
e:/usr/site/lib/Catalyst/ScriptRole.pm line 61
 
Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x2b16f9c)')
 called at e:/usr/site/lib/Catalyst/Script/Server.pm line 181
 Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x2b16f9c)') 
called at e:/usr/site/lib/Class/MOP/Method/Wrapped.pm line 48
 
Class::MOP::Method::Wrapped::__ANON__('Catalyst::Script::Server=HASH(0x2b16f9c)')
 called at e:/usr/site/lib/Class/MOP/Method/Wrapped.pm line 89
 Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x2b16f9c)') 
called at e:/usr/site/lib/Catalyst/ScriptRunner.pm line 20
 Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'MyApp', 'Server') 
called at script/myapp_server.pl line 8

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5363 (20100813) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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/


[Catalyst] C::P::Unicode::Encoding and C::P::Compress

2010-07-28 Thread Octavian Rasnita
Hi,

I have been using Catalyst::Plugin::Unicode but I read in its POD that 
Catalyst::Plugin::Unicode::Encoding is now recommended.

Can C::P::Unicode::Encoding be used with C::P::Compress::Gzip or C::P::Compress?

I've seen that the HTTP headers seem to be correctly generated, but no page 
content is sent if I use these 2 plugins.

I have used the following settings in the configuration file:

encoding UTF-8
compression_format gzip

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] rich ajax UI component libraries for Catalyst?

2010-07-26 Thread Octavian Rasnita
I understood that Scriptaculous/Prototype has a design problem because it can't 
be used with other JS libraries like jQuery, ExtJS, Dojo because it creates a 
conflict, and that it should be avoided.
Isn't this true?

Octavian

- Original Message - 
From: Dami Laurent (PJ) laurent.d...@justice.ge.ch
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Monday, July 26, 2010 4:09 PM
Subject: RE: [Catalyst] rich ajax UI component libraries for Catalyst?




-Message d'origine-
De : Leandro Hermida [mailto:soft...@leandrohermida.com] 
Envoyé : lundi, 26. juillet 2010 08:31
À : The elegant MVC web framework
Objet : Re: [Catalyst] rich ajax UI component libraries for Catalyst?

Hi Nicolas,

Thanks for the excellent advice, this is very good to know for us new
users!  If I may ask everyone another question, what are peoples
opinions about which libraries are best? most straightforward to use?

Hi Leandro,

For our project at Geneva Courts of Law, we chose prototype.js  + scriptaculous 
+ Prototype Window Class (http://prototype-window.xilinus.com/) + 
Alien::GvaScript (home-made library for autocompleters, Tree navigator, 
keyboard events, form handling, etc., see distrib on CPAN).

We chose that component stack a couple of years ago; maybe the choice would be 
different if starting a fresh project right now -- but anyway we are still very 
happy with the components mentioned above.

Cheers, Laurent Dami

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


[Catalyst] Create a PHP::Session

2010-07-18 Thread Octavian Rasnita
Hi,

I need to make a program that shares the sessions with another program which is 
made in PHP and I thought the easiest way would be to generate the session data 
on the server using PHP::Session.

The PHP session file names are of the form sess_po0nkrgqkjcbx7jb2z1ug17vwn.

I was able to create a CGI script that can share the session files with a PHP 
program, but I find it difficult to do it in a Catalyst app.

Please give me some hints about the modules/methods that should be subclassed.

I first thought that creating a Store plugin would be enough, but then I 
realised that I also need to generate the file names that have a special name. 
I tried to do it by using String::Random and overriding generate_session_id and 
validate_session_id from Catalyst::Plugin::Session but then I've seen that the 
app create a session file for each new request.

I tried to find out how C::P::S::Store::File works, but I couldn't find how 
Catalyst creates and then finds the file names of the session files.
I was sure that the value of the cookie, that SHA-1 signature is also the 
session ID and the name of the file, but I found that it is not true.
The session ID is stored in the session file but I don't know how to reach from 
the cookie value to the session ID (because I am sure Catalyst doesn't reads 
all the session files until it founds the good one).

Can you please tell me (or tell me where to look for) how the Cat app finds the 
file that holds the session data?

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] Best practice for setting up database in a complexproject?

2010-07-16 Thread Octavian Rasnita
I use to create the SQL queries by hand because if they are complicated they 
can be done much better in the DB directly.

I don't use a versioning system because exactly when I wanted to try 
DBIx::Class::Schema::Versioned I wanted to do it for an Oracle database but I 
read that this module doesn't support Oracle.

Octavian

- Original Message - 
From: Matija Grabnar mat...@serverflow.com
To: catalyst@lists.scsys.co.uk
Sent: Friday, July 16, 2010 9:01 PM
Subject: [Catalyst] Best practice for setting up database in a complexproject?


I was wondering what the experienced Catalyst developers use to set up a 
 database in a project.
 Do you write the database definition mysql/postgresql format, and then 
 dump schema to get the Perl classes, or do you write Perl class 
 definitions and use something else to output the table creation 
 statements for the
 database of your choice?
 
 And what do you do when the structure of the database changes (new 
 tables, new columns, new indexes or foreign keys) - do you use a DB 
 versioning thing, or do you do it by hand? If you do use a DB versioning 
 tool,
 which do you recommend?
 
 ___
 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] HOWTO: order_by a field in a related record, for paging

2010-06-12 Thread Octavian Rasnita
From: w...@serensoft.com
 $c-model()-search( {}, {order_by=???, page=$page} )
 
 How do we order_by a field from a related record when pulling a resultset?
 We want to order users by team (then by lastname, firstname) and be able to
 PAGE back and forth...
 
 e.g. a User belongs_to a Team.
 
my $team_name  = $c-user-team-name;
 
my $users = $c-model('My::User')
-search_rs( {}, {
order_by = {
-asc = ???user-team-name???,  ## howto?
-asc = 'lastname',
-asc = 'firstname',
},
page = $page,
} );
 
 We're wanting to order by team-name, then user-lastname, then
 user-firstname.
 
 Here's a perl sort AFTER we have the results:
 
my $user_collection = [
sort {
$a-team-name cmp $b-team-name ||
$a-lastname   cmp $b-lastname   ||
$a-firstname  cmp $b-firstname
}
$users-all
];
 
 But this approach doesn't allow for paging backward and forward over the
 list...?
 
 -- 
 will trillich


Hi,

You can use an order_by block like:

order_by = [
{-asc = 'team.name'},
{-asc = 'me.lastname'},
{-asc = 'me.firstname'},
],

Or, if there is -asc for everyone, you can use:

order_by = ['team.name', 'me.firstname', 'me.lastname'],

In the order_by blocks you need to use the names of the columns as they are 
used in the generated SQL query. For finding those names, use 
$ENV{DBIC_TRACE}++.

HTH.

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] Literal elements in uri_for generated paths

2010-06-08 Thread Octavian Rasnita
Hi,

I have tried to use uri_for() in some parameters of a Java applet, but that URI 
should contain chars like { and } which then should be replaced by the appled 
with something else:

param name=DataSource value=[% c.uri_for('/static/data/eof', 
'{symbol}.txt').path %]

If I do this , { and } are URI encoded and I don't want that.

Is it possible to create URIs that contain literal {symbol} when using 
uri_for() or uri_for_action()?

Thanks.

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5180 (20100607) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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/


[Catalyst] nmake manifest

2010-05-12 Thread Octavian Rasnita
Hello,

I have tried to create a distro for a Catalyst based app, using:

perl Makefile.PL
nmake manifest

(Then I eddited MANIFEST.SKIP, adding ^root as a test), then again:

nmake manifest

But it always returns 'manifest' is up-to-date and the wanted lines from 
MANIFEST  are not deleted.

Do you have any idea what is the problem? nmake or a Perl module?

(I use ActivePerl 5.10.1 under Windows XP Pro with the latest version of 
Catalyst).

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] nmake manifest

2010-05-12 Thread Octavian Rasnita
Thank you. If I first delete the MANIFEST, the MANIFEST.SKIP is taken into 
consideration the next time I run `nmake manifest`.

I was confused by

3. make manifest (edit MANIFEST.SKIP and run make manifest again if you'd like 
to exclude certain file patterns) found on:

http://dev.catalystframework.org/old-wiki/wiki/Faq_ref/

Octavian

- Original Message - 
From: Florian Ragwitz r...@debian.org
To: catalyst@lists.scsys.co.uk
Sent: Wednesday, May 12, 2010 7:15 PM
Subject: Re: [Catalyst] nmake manifest


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


[Catalyst] Can't detect C::V::TT VERSION

2010-05-07 Thread Octavian Rasnita
Hi,

I am trying to install the prerequisites for a Catalyst app using `make 
installdeps` and although I have the required version of C::V::TT, it reports 
that it is not installed:

$ perl Makefile.PL
...
- Catalyst::View::TT   ...missing. (would need 0.34)
== Auto-install the 1 mandatory module(s) from CPAN? [y] 

$ perl -MCatalyst::View::TT -e 'print $Catalyst::View::TT::VERSION'
0.34


In Makefile.PL I have the following line:

requires 'Catalyst::View::TT' = '0.34';

Do you have any idea what could be wrong?

Thanks.

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5093 (20100506) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

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


Re: [Catalyst] Bareword catalyst not allowed while strict subs inuse at Makefile.PL line 90.

2010-05-07 Thread Octavian Rasnita

From: Matt S Trout m...@shadowcat.co.uk

On Mon, May 03, 2010 at 02:57:10PM +0300, Octavian Rasnita wrote:

Hi,

I am trying to install a Catalyst-based app under Debian which has Perl 
5.10.0 installed.
I've installed the latest versions of CPAN, CPANPLUS, 
ExtUtils::MakeMaker, Module::Install, Module::Build and local::lib using 
cpan.


Then I tried to run perl Makefile.PL because I was hoping that it will 
show me the missing Perl modules:


Did you do this properly by building a tarball with 'make dist' ? If so, 
then
inc/Module/Install.pm and inc/Module/Install/Catalyst.pm should already 
exist

in the unpacked tarball, so there was no need to install either.

If you're making a checkout and pretending that's an installation source,
then you're basically installing from a development environment - at which
point, shockingly enough, you need Catalyst::Devel.



That was the problem. I made a clone from the source control repository.

Thanks.

Octavian


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5093 (20100506) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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/


[Catalyst] Bareword catalyst not allowed while strict subs in use at Makefile.PL line 90.

2010-05-03 Thread Octavian Rasnita
Hi,

I am trying to install a Catalyst-based app under Debian which has Perl 5.10.0 
installed.
I've installed the latest versions of CPAN, CPANPLUS, ExtUtils::MakeMaker, 
Module::Install, Module::Build and local::lib using cpan.

Then I tried to run perl Makefile.PL because I was hoping that it will show me 
the missing Perl modules:

ebroker:/srv/BRK1# perl Makefile.PL 
include /srv/BRK1/inc/Module/Install.pm
Bareword catalyst not allowed while strict subs in use at Makefile.PL line 
90.
Execution of Makefile.PL aborted due to compilation errors.
ebroker:/srv/BRK1#  

In the line 90 appears the line:

catalyst;

I have also tried to change it to:

catalyst();

but then it gives the error:

tests_recursive will not work if tests are already defined at 
/usr/local/share/perl/5.10.0/Module/Install/Makefile.pm line 189.

Catalyst::Runtime is not installed because I was hoping that doing `perl 
Makefile.PL` would display all the missing modules, including 
Catalyst::Runtime, because it is listed in Makefile.PL. Is there another 
requirement for using this command?

Thanks.

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5081 (20100503) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

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


Re: [Catalyst] Alternatives to Catalyst ?

2010-04-26 Thread Octavian Rasnita

From: Ævar Arnfjörð Bjarmason ava...@gmail.com
...

Now that it's quietened down, I can ask a question. Does this I mean
it's preferable to use

$c-req-{parameters}-{foo}

rather than

$c-req-param('foo')

Obviously I'd rather use the faster method but if I'm breaking the
encapsulation in some ways that's going to bite me later, I'd steer
clear.



Obviously.

Unless you're doing method calls in a tight loop somewhere in your
code you *shouldn't care about this*. Now I've written code that
actually *did* suffer from method call overhead but since you're just
casually asking it's very unlikely that you're doing the same.

Don't sprinkle premature optimizations around your codebase just
because someone produced a benchmark showing one is faster than the
other. You should be doing *profiling* of your  entire program, not
micro-optimizing something that's likely 0.0001% of its total runtime.



If I remember well $c-req-param() is not recommended, but not for 
performance reasons.


It resembles the method with the same name from CGI.pm, and it can return 
not only a scalar value, but it could also return an array if it is called 
in list context. So it might break the code if multiple values were sent for 
the same variable.


Octavian


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5061 (20100426) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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


Re: [Catalyst] Alternatives to DBIx?

2010-04-17 Thread Octavian Rasnita
From: Kiffin Gish kiffin.g...@planet.nl
 I'd say that rather than spending time studying SQL::DB, which I found
 complicated and hard to tackle, you might as well invest the same time
 and energy anyway in figuring out DBIx::Class.

BTW, is there a comparison among the ORMs in Perl somewhere?
It would be interesting and definitely helpful for the ORM newbies.

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] Alternatives to DBIx?

2010-04-17 Thread Octavian Rasnita
Hi,

From: John Karr brain...@brainbuz.org
 Working in raw DBI is the opposite of the DRY principle which underlies 
 having a framework in the first place, so I am seeking an alternative. 
 Just as Catalyst uses MVC, DBIx chooses ORM, but that paradigm is not the 
 only way to be effective PERL==SQL glue. From the 
 Manpage Fey::SQL looks like what I want: neatly wrapped and sweetened SQL, 
 without the repetition and overhead inherent in working from  DBI. I'm going 
 to spend some time working with it and also with SQL::DB, when I have a more 
 educated opinion I will share it. Both Fey and 
 SQLDB are a nativist approach to SQL (much like TT is to html), and I would 
 argue that in keeping the PERL paradigm of many ways to 
 accomplish a task, the choice between a SQL-native DBI wrapper and an ORM 
 wrapper should be up to the individual, the issue seems to be  finding a 
 worthy SQL-native wrapper.


If the overhead/speed is the most important thing, then DBI is better than DBIC 
(by the way is DBIx::Class or DBIC, not just DBIx).

But in that case you probably shouldn't be interested in using Template-Toolkit 
nor Catalyst, because they also have their overhead, and the other higher level 
modules used for accessing the database have their overhead also and the best 
solution would be DBI.

 In my own analysis the Time and Effort to learn DBIx is greater than the Time 
 wasted writing repetitious DBI code, the time I've already invested  on DBIx 
 has shown that there is a better way than DBI, but for me it isn't DBIx.

Of course that an application that uses just mod_perl handlers and not very 
many objects, templates, form processors, ORMs... is faster than one that use 
them, and for someone who doesn't know the interface of those modules is also 
faster to develop because no aditional learning time is required, but that 
application will be much much harder to maintain on the long term.

If the long term development process is important, then with very few 
exceptions, the applications should not be optimized prematurely because there 
may be found other more elegant optimizations than manipulating SQL code 
directly.

Learning the interface of DBIC takes some time, but you shouldn't learn it 
again and again for each new project, so on the long term the development 
process will be much faster.

If what you don't like at all is the DBIC syntax, then yes, in that case you 
have a good reason for using something else, but a good idea would be to learn 
it a little and try to use it in order to see its benefits.

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] Catalyst Redirect to https

2010-03-26 Thread Octavian Rasnita
From: Bill Moseley 
   2010/3/25 Octavian Rasnita orasn...@gmail.com

  The back end servers don't know if the current request is an http or an 
https one and on each redirect,   they do the redirection using the http 
scheme.
  (I have also set the configuration option using_frontend_proxy to true.)
  
  Also, because the back end servers receive only http requests, 
$c-req-secure is always equal to 0.
  I have read that I can set the HTTPS environment variable to On and I 
put the following line in the 
  configuration file of the load balancer Apache server in the 
virtualhost that handles SSL requests:
  
  SetEnv HTTPS On



   Does that header get to Catalyst?  Obviously, check that first.
   

   I have this in  a after 'prepare_headers':
   

  $res-secure( 1 ) if lc( $req-header( 'Https' ) || '' ) eq 'on';
   
   The load balancer sends all traffic to the same port.  The load balancer 
sets that header for SSL traffic.


  I didn't know that HTTPS should be an HTTP header and not an environment 
variable so I have also added as a header.

  I have put in the configuration file of the back end servers (to be sure that 
it will reach the app):

  SetEnv HTTPS On

  and in the configuration file of the load balancer server:

  RequestHeader set HTTPS On

  And in a test action I have done:

  my $body;
  $body .= HTTPS environment variable: $ENV{HTTPS}br /\n;
  $body .= HTTPS header:  . $c-req-header('HTTPS') . br /\n;
  $body .= secure:  . $c-req-secure . br /\n;;
  $c-req-secure(1); #Force it to be true
  $body .= secure:  . $c-req-secure . br /\n; # Check if it is set 
correctly
  $body .= uri_for_action:  . $c-uri_for_action('/user/login2') . br /\n;
  $c-res-body($body);

  And the result is:

  HTTPS environment variable: On
  HTTPS header: On
  secure: 0
  secure: 1
  uri_for_action: http://site.testsite.com:/en/user/login2

  So it seems that both the environment variable HTTPS and the header HTTPS are 
seen by Catalyst, but $c-req-secure is still equal to 0.

  Do I need to add a certain plugin in order to be able to use $c-req-secure 
or what could be the problem that it is not set correctly?

  I have read in Catalyst::Request:

  the URI scheme (eg., http vs. https) must be determined through heuristics; 
depending on your server configuration, it may be incorrect. See $req-secure 
for more info.

  And more info:
  Note that the URI scheme (eg., http vs. https) must be determined through 
heuristics, and therefore the reliablity of $req-secure will depend on your 
server configuration. If you are serving secure pages on the standard SSL port 
(443) and/or setting the HTTPS environment variable, $req-secure should be 
valid.

  I am accessing the site using SSL by the  port so I need the HTTPS 
environment variable (or HTTP header) but I don't know why $c-req-secure is 
still not set.

  And finally, even though I forced $c-req-secure to be true, 
$c-uri_for_action still uses the http scheme and not https so in the entire 
application the redirects won't be done correctly and this is the big problem.

  Thanks.


  Octavian


  -- 
  Bill Moseley
  mose...@hank.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/



  __ Information from ESET NOD32 Antivirus, version of virus signature 
database 4975 (20100325) __

  The message was checked by ESET NOD32 Antivirus.

  http://www.eset.com




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4975 (20100325) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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/


[Catalyst] Catalyst Redirect to https

2010-03-25 Thread Octavian Rasnita
Hi,

In a catalyst action accessed using https I do:

if ($c-authenticate({username = $username, password = $password, active = 
1})) {
  $c-res-redirect($c-uri_for_action(/index));
}

It redirects to / URI of the site, but using http, not https as in the request 
for the current page.

Isn't $c-uri_for_action() able to see that the current URI uses https and 
continue to use it or this revert to http is intentional?

Thanks.

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4973 (20100325) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

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


Re: [Catalyst] Catalyst Redirect to https

2010-03-25 Thread Octavian Rasnita
Hi,

Sorry but I haven't provided the correct information.
The problem is that I use a load balancer (Apache mod_proxy_balancer) and it 
gets the https request, however it passes the request to the backend Apache - 
mod_perl based servers using http.

How do you do $c-res-redirect in cases like this?

The front end server listens to the ports 80 and 443 and the back end servers 
to the ports 81 and 82 (they are on the same machine for the moment).

The back end servers don't know if the current request is an http or an https 
one and on each redirect, they do the redirection using the http scheme.
(I have also set the configuration option using_frontend_proxy to true.)


Also, because the back end servers receive only http requests, $c-req-secure 
is always equal to 0.
I have read that I can set the HTTPS environment variable to On and I put the 
following line in the configuration file of the load balancer Apache server in 
the virtualhost that handles SSL requests:

SetEnv HTTPS On

But nothing changes and $c-req-secure is still equal to 0, and the redirects 
are still done using the https scheme, so I am doing something wrong for sure.

Do I need to have special virtualhosts on the back end servers that handle the 
requests that came using https and set the HTTPS environment variable on those 
virtualhosts? Or how can I let the Catalyst app know if the requests to the 
load balancer were using https?

Please tell me what should I do or where can I find more information about 
using a load balancer with https and Catalyst.

Thanks.

Octavian

From: Christiaan Kras c.k...@pcc-online.net
 You can use Catalyst::Plugin::RequireSSL to force https.
 
 Although I think https should be used by your method if that's what the 
 user access the app with.
 
 
 Christiaan
 
 
 
 Octavian Rasnita schreef:
 Hi,
  
 In a catalyst action accessed using https I do:
  
 if ($c-authenticate({username = $username, password = $password, 
 active = 1})) {
   $c-res-redirect($c-uri_for_action(/index));
 }
 It redirects to / URI of the site, but using http, not https as in the 
 request for the current page.
  
 Isn't $c-uri_for_action() able to see that the current URI uses https 
 and continue to use it or this revert to http is intentional?
  
 Thanks.
  
 --
 Octavian


 __ Information from ESET NOD32 Antivirus, version of virus 
 signature database 4973 (20100325) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.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/


___
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] [DBIx::Class::ResultSet ] not equal in where clause

2010-03-11 Thread Octavian Rasnita
From: David 
  Hi,

  is not possible to set 'not equal' using ResultSet search method? I can't 
make it with 'search_literal' method because I need to use a join clause too.
  I would like to do something like:

  $c-model('DB::Test')-search({-and = [ 'me.name' = 'name', -not = { 
'users.id' = 'id'}]},
  { join = 'users' });

  If you want to use -and, you can skip it. If you'll want to use the same 
table/column in 2 expressions you can add it back.

  Try something like:

  $c-model('DB::Test')-search({
'me.name' = 'name',
'users.id' = {'!=' = 'id'},
  },{
join = 'users',
  });

  Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4933 (20100310) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

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


Re: [Catalyst] uri_for and unicode

2010-03-09 Thread Octavian Rasnita

From: Bernhard Graf cataly...@augensalat.de
Am 09.03.2010 14:30, schrieb Alex Povolotsky:



After adding Catalyst::Plugin::Unicode::Encoding, it became MUCH worse.
What was readable, became unreadable. What was unreadable, remained so.
Replacing C::P::Unicode by C::P::Unicode::Encoding did not yield any
difference.


Then you are probably doing it wrong!

I suspect that you want to use cyrillic characters. The problem is, that
most software components (also Perl) default to latin1 or similar.

A good start is always to use utf-8 encoding everywhere: your source
code, your web pages encoding and your database charset.

Always

 use utf8;

in your Perl file!
(unless you are absolutely sure, you are not using any non-ASCII chars)

Explicitly set your databases encoding to utf-8 on connect (see the
appropriate DBD::*/DBIC manpages how to do that) and don't use
DBIx::Class::UTF8Columns.


Is this a general recommendation? (For not using DBIx::Class::UTF8Columns)

Thanks.

Octavian


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4929 (20100309) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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


Re: [Catalyst] Which C::View::PDF should I use?

2010-03-08 Thread Octavian Rasnita

Hi Charlie,

From: Charlie Garrison garri...@zeta.org.au
Good evening,

On 8/03/10 at 8:41 AM +0200, Octavian Rasnita
orasn...@gmail.com wrote:

Do you know if there is a way of creating PDFs in the same way the HTML 
templates are created, by just putting a variable name in a certain place 
and render that pdf file by replacing that variable with its value? 
(Without needing to specify the position where those variables will be 
placed)


I don't. That's exactly what I was hoping to do, but I couldn't
find a way to do it (without expensive commercial solutions, or
without using hand-crafted PDF 'forms').

I've got a form config which $customer can change (add fields,
etc) and I've included X/Y coords as part of the config. That
was the only way I could get it working in limited time I've got.

I can share code with you if it will help (maybe offlist would
be better).
Charlie


Unfortunately I don't know if it can help me, because I am blind and I can't 
see if the manually configured positions are displayed correctly. That's why 
I was hoping that there is a solution that works like the common TT 
templating system.


Thank you.

Octavian





__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4923 (20100307) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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


Re: [Catalyst] Which C::View::PDF should I use?

2010-03-07 Thread Octavian Rasnita

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Hi Charlie,




Thanks for that. I've looked at various html 2 pdf tools (I used html2ps 
for
a project about 10 years ago). But lack of even basic CSS support makes 
the

them useless for creating pretty PDFs.

In reality, this project doesn't really need PDF output (HTML would work
fine), but $customer says it's a requirement, so I've got to make it work
for creating pretty PDFs.



I've found that a simple way to put values into a PDF is to use PDF
forms - position the form fields in the appropriate location in the
template doc, and to generate the output update the form fields and
write a 'flattened' version of the doc. This means you can use visual
tools to layout the doc, and your code doesn't need to know anything
except the field names.




Do you know if there is a way of creating PDFs in the same way the HTML 
templates are created, by just putting a variable name in a certain place 
and render that pdf file by replacing that variable with its value? (Without 
needing to specify the position where those variables will be placed)


Thanks.

Octavian


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4923 (20100307) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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/


[Catalyst] Create a session after login only?

2010-02-24 Thread Octavian Rasnita

Hi,

I use the following Catalyst plugins in my app:
Session, Session::Store::File, Session::State::Cookie
Authentication, Authorization::Roles

The problem is that on each request of the main page, the app creates 2 
session files before even logging in.


Is it possible to make it generate session files only for the logged-in 
users?


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] Requiring a certain module version in Makefile.PL

2010-02-21 Thread Octavian Rasnita

From: J. Shirley jshir...@gmail.com
On Sun, Feb 21, 2010 at 9:54 AM, Octavian Rasnita orasn...@gmail.com 
wrote:

Hi,

In Makefile.PL I have the following line:

requires 'DBIx::Class::Schema::Loader' = '0.05003';

When I do
perl Makefile.PL

shouldn't that line require and install this version of
DBIx::Class::Schema::Loder?

I have a 0.04... version, but after `perl Makefile.PL` the new version 
was

not installed and it happened the same with other modules.

I use Perl 5.10.0 under Debian.

Thanks.




What's the output of 'perl Makefile.PL'?  It certainly should, and
I've never seen it not correctly listing deps.

-J


After I do
perl Makefile.PL it ends without asking me if I want to install some 
required modules, exactly as when it is all right.


But I've just discovered:

r...@ebroker:~# perl -MDBIx::Class::Schema::Loader -e 'print 
$DBIx::Class::Schema::Loader::VERSION\n'

0.04005
r...@ebroker:~# su www-data
www-d...@ebroker:~$ perl -MDBIx::Class::Schema::Loader -e 'print 
$DBIx::Class::Schema::Loader::VERSION\n'

0.05003
www-d...@ebroker:~$

So the user www-data sees a newer version of this module because it has the 
following PERL5LIB:

/srv/perl5/lib/perl5:/srv/perl5/lib/perl5:/srv/perl5/lib/perl5/x86_64-linux-gnu-thread-multi
while the user root has no PERL5LIB environment variable defined.

I have installed most of the modules using local::lib, but I couldn't 
install some of them because they give an error telling that they can't 
create the directory

/home/t1
where it tries to install the modules, (t1 was an old user that doesn't 
exist anymore). This error is given by the module ExtUtils::Install but even 
though I searched in many places I couldn't find where it gets that t1 
from.


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] Requiring a certain module version in Makefile.PL

2010-02-21 Thread Octavian Rasnita

From: Florian Ragwitz r...@debian.org

Of course that Makefile.PL contains auto_install() at the end.

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] Multiple chaining to same action ...

2010-02-15 Thread Octavian Rasnita

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

In my application, users are allowed to edit only their own settings
like this:

/account/id/client/settings/edit

| /role/*/settings/edit | /auth (0)   |
|   | - /role/base (1)   |
|   | - /role/settings/crud/base (0) |
|   | = /role/settings/crud/edit |

# Controller::Role
sub base : Chained('/auth') PathPart('role') CaptureArgs(1) {
   my ( $self, $c, $id ) = @_;

   # Get the user if possible.
   my $user = $c-model('DB::User')-find($id);

   # Make sure that the user is indeed this user.
   $c-detach('/error_403') unless $c-user-id == $id;

   # Save the user in the stash.
   $c-stash( user = $user );
}


Why do you need this subroutine?
It should be reached only by the authenticated users, and if somebody 
reached here, you can just get his/her user id from $c-user-get('id') and 
you can get this information in the other subroutines 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] datetime formatting ...

2010-02-13 Thread Octavian Rasnita

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

That worked, thanks. Only weird thing now is that the time is one hour
behind.


Use something like:

-last_modified-set_time_zone('America/Chicago')-strftime('%F %T')

Or add the time_zone parameter as an option in your Result class (after do 
not modify this or anything above) , using something like:


__PACKAGE__-add_column(last_modified, {
data_type = DATETIME,
default_value = undef,
is_nullable = 1,
size = 19,
time_zone = 'America/Chicago',
locale = 'en', # If you want...
});

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] datetime formatting ...

2010-02-13 Thread Octavian Rasnita

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

Well actually I want to relate it to the timezone of the current user or
if that is not set in the user preferences, the browser time.


After you get the user time zone from users preferences, you can send it as 
a parameter to set_time_zone() method of DateTime.


You can do it in the templates:

[% row.last_modified.set_time_zone(c.user.get('time_zone')).strftime('%F 
%T') %]


(not tested, but it should work)

Don't know how to get the time zone of the user from browser, but I think it 
is not possible. You might need to get the visitor's IP and use a service 
that can tell you his/her country or even city, and maybe there is a module 
that can translate that into DateTime time_zone rformat...


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] datetime formatting ...

2010-02-13 Thread Octavian Rasnita

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

Thanks. You're right about the timezone thing, I was confused with
javascript and now realize that the tz is not passed via HTTP headers.
Could save it in a cookie.

Is $c-user-get(x) the same as $c-user-x ?

mvg
Kiffin


Yes it is the same thing if the authentication is made using DBIC, but the 
prefered way is to use the get() method, because you might want to change 
the authentication to LDAP or something else later, and in that case the 
get() method could return the same thing, but there may be no x() method 
offered by the new authentication.


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] Please beta test new DBIx::Class::Schema::Loader(create=static)

2010-02-07 Thread Octavian Rasnita

From: Rafael Kitover rkito...@io.com

Release candidate for DBIx::Class::Schema::Loader 0.05000 is now
available as a dev release:

http://search.cpan.org/~rkitover/DBIx-Class-Schema-Loader-0.04999_14/

The schemas it now generates are incompatible with the output of
0.04006, but there is an automatic backward compatibility mode.

Please try it out to make sure it doesn't break your code.

On running myapp_create.pl you will see the backcompat warnings.

To upgrade (while preserving and rewriting your custom content) set the
'naming' and/or 'use_namespaces' attributes.



I have installed DBIx::Class::Schema::Loader 0.05001 and the latest 
Catalyst::Model::DBIC::Schema and I have generated a new scheme (not updated 
an older one).


I have tried to use InflateColumn::Markup::Unified and UTF8Columns 
components, but the text from the UTF-8 columns is not encoded correctly.


After # You can replace this text with custom content, and it will be 
preserved on regeneration, I added the text below. Is it correct with the 
new DBIx::Class::Schema::Loader, or there is a bug in the new module?


__PACKAGE__-load_components(InflateColumn::Markup::Unified, 
UTF8Columns);

__PACKAGE__-add_columns(
answer, {
 data_type = TEXT,
 default_value = undef,
 is_nullable = 1,
 size = 65535,
 is_markup = 1,
});
__PACKAGE__-utf8_columns(qw/domain question answer/);
1;


I have also tried to specify UTF8Columns component using 
`components=UTF8Columns` parameter when I used the Catalyst DBIC::Schema 
helper, but it gave the following warning:


Class::C3::Componentised::load_components(): Incorrect loading order of 
DBIx::Class::UTF8Columns by BRK::Schema::Result::Aga will affect other 
components overriding store_column (BRK::Schema::Result::Aga, 
DBIx::Class::UTF8Columns). Refer to the documentation of 
DBIx::Class::UTF8Columns for more info at 
E:\web\BRK\lib/BRK/Schema/Result/Aga.pm line 11


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] Please beta test new DBIx::Class::Schema::Loader(create=static)

2010-02-07 Thread Octavian Rasnita

From: Rafael Kitover rkito...@io.com

Release candidate for DBIx::Class::Schema::Loader 0.05000 is now
available as a dev release:

http://search.cpan.org/~rkitover/DBIx-Class-Schema-Loader-0.04999_14/

The schemas it now generates are incompatible with the output of
0.04006, but there is an automatic backward compatibility mode.

Please try it out to make sure it doesn't break your code.


I guess the encoding errors of columns that use UTF8Columns are not 
generated by DBIx::Class::Schema::Loader (because they still appear after 
downgrading this module), but by DBIx::Class itself (unless the new version 
of DBIx::Class requires a syntax change for using UTF8Columns that I 
couldn't find).


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] action_for with user_id removed ...

2010-02-01 Thread Octavian Rasnita

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

I have a number of user-defined actions which are described with the
user id like this:

settings/user_id/(view|edit)

Where user_id is the primary key into the users resultset. However, I do
not want this to be visible to the end-user for security reasons (if I'm
admin it's alright).

Is it possible to retain these, but for users who are logged in
the /user_id/ is removed to get this visible instead:

settings/(view|edit)

Thanks alot in advance.


--
Kiffin Gish kiffin.g...@planet.nl
Gouda, The Netherlands


If your users have an ID, they're probably logged in. If they are logged in, 
you can get and use that ID in your app by getting it with:


my $user_id = $c-user-obj-id
or
my $user_id = $c-user-get('id');

(And the second way is recommended).

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] Users, roles, HTML::FormFu::DBIx::Class::Model - complete example?

2010-01-27 Thread Octavian Rasnita

From: Alex Povolotsky tark...@over.ru

Hello!

Maybe someone can provide the community with complete example of 
users/roles editor with HTML::FormFu::DBIx::Class::Model?


Are you sure this module exists?

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-26 Thread Octavian Rasnita

From: Charlie Garrison 

garri...@zeta.org.au


One of the reasons I found IC::FS so much better, was the extra
control for things like how files are named/stored on disk. From
the POD:

fs_file_name
  Provides the file naming algorithm. Override this method to
change it.
  This method is called with two parameters: The name of the
column and the column_info object.

_fs_column_dirs
  Returns the sub-directory components for a given file name.
Override it to provide a deeper directory tree or change the algorithm.


That's true, but I still don't know how can I store the path to the file.

If in the file field I store just the file name, I need to create a second
column just for storing the random path for each file upload field.

If I will store the random path and the file name in the same column like
/e3/e3434ae1b/The original file name.pdf

then each time I would need to create a subroutine that takes this file name
and gets only the original file name for printing it on the page, but I 
think this is the most simple way though.


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

2010-01-24 Thread Octavian Rasnita

Hi,

After sending a form with a file upload field, that field is lost if no file
was attached, just like when the form doesn't contain that file upload field
at all.

I have tried to check Catalyst, Catalyst::Request, Catalyst::Engine,
HTTP::Body and HTTP::Body::MultiPart in order to find where are the file 
upload fields lost, but I

couldn't find it.

I need to know if the form didn't have a file upload field, or if it had it
but no file was uploaded.

I have printed Dumper $request-_body in Catalyst::Engine::prepare_uploads,
and when a file is uploaded, it looks like:

$VAR1 = bless( {
'content_length' = '1727',
'tmpdir' = 'C:\\DOCUME~1\\Octavian\\LOCALS~1\\Temp',
'part' = {},
'buffer' = '',
'state' = 'done',
'chunk_buffer' = '',
'body' = undef,
'content_type' = 'multipart/form-data;
boundary=---7da8c3070458',
'length' = 1727,
'boundary' = '---7da8c3070458',
'chunked' = '',
'upload' = {
  'file' = {
  'headers' = {
 'Content-Type' =
'text/plain',
 'Content-Disposition'
= 'form-data; name=file; filename=E:\\_cool.txt'
   },
  'tempname' =
'C:\\DOCUME~1\\Octavian\\LOCALS~1\\Temp\\PrJ0ruNzzR',
  'name' = 'file',
  'size' = 44,
  'filename' = 'E:\\_cool.txt'
}
},
'param' = {},
  }, 'HTTP::Body::MultiPart' );


If no file was uploaded, it prints:

$VAR1 = bless( {
'content_length' = '1699',
'tmpdir' = 'C:\\DOCUME~1\\Octavian\\LOCALS~1\\Temp',
'part' = {},
'buffer' = '',
'state' = 'done',
'chunk_buffer' = '',
'body' = undef,
'content_type' = 'multipart/form-data;
boundary=---7da1573870458',
'length' = 1699,
'boundary' = '---7da1573870458',
'chunked' = '',
'upload' = {},
'param' = {},
  }, 'HTTP::Body::MultiPart' );

So the 'upload' key doesn't contain anything, not even the name of the file
upload field.

Can you give me a hint where I should look for finding where the empty file
upload field is skipped if it is empty?

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

2010-01-24 Thread Octavian Rasnita

Hi Bill,

From: Bill Moseley mose...@hank.org
On Sun, Jan 24, 2010 at 7:03 AM, Octavian Rasnita 
orasn...@gmail.comwrote:


I need to know if the form didn't have a file upload field, or if it had 
it


but no file was uploaded.


Give your upload field(s) a name like upload_1  and then see if it 
exists

in uploads.


I gave it the name file, but if the file is not uploaded, it doesn't 
appear in uploads(). (I hope file is OK as a name, no?)


Can you give me a hint where I should look for finding where the empty 
file

upload field is skipped if it is empty?



That's how HTTP::Body works.   If there's a filename, which there is with
upload fields, but the file name is empty, then it's skipped.


Aha, so I should look better in HTTP::Body.
Is there a reason it does that? (Leaves alone all other empty form fields 
but deletes the empty file upload fields?)



   if ( exists $part-{filename} ) {
   if ( $part-{filename} ne  ) {
   $part-{fh}-close if defined $part-{fh};

   delete @{$part}{qw[ data done fh ]};

   $self-upload( $part-{name}, $part );
   }
   }

BTW -- I think that delete of fh should not happen (and the temp file
should be set to unlink on destroy).  Otherwise you can end up with 
orphaned

temp files.


And I think it should also returned the empty file upload field as an empty 
upload field, and not delete it at all.

I think this change cannot cause errors in other places.

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 Rasnita

Hi Stephen,

From: Stephen Howard step...@enterity.com
I believe your problem lies in the browser itself.  I know, for  example, 
that browsers do not send empty values for checkboxes that  remain 
unchecked - they simply eliminate that field from the form  submission 
altogether. Sounds like file fields might be the same way.   Your best bet 
is to use a bit of scripting on the browser side to mark  a hidden field to 
stand in for the empty file field.


- Stephen


I have verified that, and the browser sends the empty upload field, with no 
content, like:


-7da3d8a106ce

Content-Disposition: form-data; name=file; filename=

Content-Type: application/octet-stream



-7da3d8a106ce



So after the MIME header there is no content, but the header with the name 
of the field (file) is sent to the 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/


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

2010-01-24 Thread Octavian Rasnita

From: Bill Moseley mose...@hank.org
On Sun, Jan 24, 2010 at 8:31 AM, Octavian Rasnita 
orasn...@gmail.comwrote:




Give your upload field(s) a name like upload_1  and then see if it
exists
in uploads.



I gave it the name file, but if the file is not uploaded, it doesn't
appear in uploads(). (I hope file is OK as a name, no?)



Why do you need to know that a field existed on the form but was submitted
empty?  Checkboxes don't submit if not checked.  You get what's included 
in

the post and have to work from that.  Either you have an upload or not,
right?


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


The files can be uploaded by just using:

sub add : Local FormConfig {
 my ($self, $c) = @_;

 my $form = $c-stash-{form};

 if ($form-submitted_and_valid) {
   $form-model-create;
   #Print the success message and redirect here
 }
}

And the existing record that contains file uploads can be also modified by 
using:


sub edit : Local FormConfig {
 my ($self, $c, $id) = @_;

 my $form = $c-stash-{form};
 my $record = $c-model(DB::TableName)-find($id);

 if ($form-submitted_and_valid) {
   $form-model-update($record);
   # Here print the success message and redirect
 }
 else {
   $form-model-default_values($record);
 }
}

In the Result::TableName there should be:

# If the user might need to replace the existing uploaded file with another 
one:

__PACKAGE__-mk_group_accessors(simple = 'file_replace_validator');

__PACKAGE__-load_components(InflateColumn::FileUpload);

__PACKAGE__-add_columns(
file, {
data_type = VARCHAR,
default_value = undef,
is_nullable = 1,
size = 255,
is_file_upload = 1,
file_upload_path = $ENV{the_directory_where_the_files_will_be_stored},
});

The form used to add new records will contain a common HTML::FormFu File 
element (and other elements needed).


The form used for editing can contain a checkbox with the name 
file_replace_validator, or if the name of the file upload field would be 
foo, that checkbox will be named foo_replace_validator. I created an 
accessor for it because there should be no column with this name in the db 
table (although I may find a solution to not need it at all).


When the user will use the form for creating a new record, it will upload 
the file if a file is loaded in the form, or it will send the form without 
that field so here there is no problem.


When the user will use the editing form, he or she will have the option of 
choosing if she wants to replace the existing file.
If she doesn't check that checkbox, it doesn't matter if she uploads a file 
in that field, because the original file won't be changed.
If she checks it, it means that she wants to replace the existing file with 
the new file uploaded. If she checks it but she doesn't upload any file, it 
means that she wants to replace the existing file with nothing, so she just 
wants to delete the existing file.


So with this inflator one can upload a new file, delete an existing file, 
and replace an existing file with another one by using just 2 forms which 
are the same, but the editing form may have that aditional checkbox for 
confirming the replacement.


If the user will delete the record, the file attached will be also deleted 
from the disk.
If the user will access the record, it will get a hashref with 2 elements - 
the filename, and the IO::File handle to that file so she will be able to 
use the same syntax as the InflateColumns::File does it:


a href=[% c.uri_for('/static/path_to_dir', row.id, row.file.filename).path 
%][% row.file.filename | html %]/a


The problem is that if DBIC doesn't find any file upload field, the inflator 
is not used at all, so it doesn't do anything, although it should see that 
there is an empty  file upload field that has the is_upload_file attribute, 
see that the user has chosen to replace the existing file with it,

so it should delete the existing file.

For making it work, I need to add the following ugly code in the edit 
action:


if ($form-submitted_and_valid) {
 #Set a hashref for the empty file field because otherwise FileUpload 
inflator ignores it

 unless ($form-param('file')) {
   $c-req-params-{file} = {};
   $form-process;
 }
 $form-model-update($anunt);
 #...
}

I didn't want to load this inflator to CPAN until I solve this issue, but if 
you or somebody else wants, I can send you the source code.


Without commends in the code or documentation can't really know the 
author's

reasoning.   I guess it assume uploads go to temp files and no need to do
that if there's no content.


If the file is an empty one, I guess there shouldn't be a big issue if the 
file would go to the temp directory. I think it could get deleted as the 
other non-empty files which are uploaded there.

Octavian


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo

Re: [Catalyst] modules for conditional GET ?

2010-01-14 Thread Octavian Rasnita

From: Dami Laurent (PJ) laurent.d...@justice.ge.ch

Hi Catalysters,

For some actions of a Catalyst app, I would like to implement
conditional GET (using If-Modified-Since HTTP header), where the
timestamp of one config file decides whether the page should be
refreshed or not  --- this is because that page is quite expensive to
compute.

This scenario sounds like a common thing to do, so I expected to find
some Catalyst plugins/extensions in CPAN to do that, but didn't find
any. Did I just miss some CPAN modules, or should I really start from
scratch ?

Thanks in advance for any hints,

Laurent Dami




Try Catalyst::Plugin::Cache::HTTP.



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] Various ways to use c.uri_for

2010-01-09 Thread Octavian Rasnita

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


I noticed that in certain examples depending on the coder, sometimes the
following format is used:

   c.uri_for(c.controller('Users').action_for('list'))

and other times this fomat:

   c.uri_for('/users/list')

What's the difference and is there an advantage of using one or the
other?

Thanks alot in advance.

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



In the first case you can provide the name of the action and not the URL 
that dispatches to it.


The advantage of the first one is that you may want to change the way the 
URL looks like and in that case those links will work.


For example, say that you have the following action:

package MyApp::Controller::Users;

sub lst : Path('list' {}

You can access the lst action by using the following:

c.uri_for('/users/list')
and
c.uri_for(c.controller('users').action_for('lst')

In the future, if you will want to change some things and access the list of 
users with an URL like


/users/something-else

the first way won't work, and you will need to check all the templates and 
change it, while the second will work fine, and it will generate the correct 
URL to the action lst.


It could be helpful to have shortcuts for the second way of creating URLS, 
something like...


c.url_query('controller_name', 'action_name', param1, param2)

We can put a url_query subroutine in MyApp.pm that looks like the one below 
(although I don't know if it works in all the cases - chains), but it could 
be helpful to have such a thing in the core:


sub url_query {
 my ($c, $controller, $action, @params) = @_;
 return $c-uri_for($c-controller($controller)-action_for($action), 
@params)-path_query;

}

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: Various ways to use c.uri_for

2010-01-09 Thread Octavian Rasnita

From: Aristotle Pagaltzis pagalt...@gmx.de

* Octavian Rasnita orasn...@gmail.com [2010-01-09 15:20]:

It could be helpful to have shortcuts for the second way of
creating URLS, something like...

c.url_query('controller_name', 'action_name', param1, param2)


Already exists, although it uses the internal path instead of
separately passing the controller package and the action name:

   c.uri_for_action('/controller/action', param1, param2)



Great! Thank you Aristotle for telling me about this. I knew about 
c.uri_for_action, but from its syntax I was sure it uses a hard coded URI, 
not a path to an action.
(Maybe the docs could be a little more clear, because this is a great 
feature.)


Thanks for the explanation.

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: Various ways to use c.uri_for

2010-01-09 Thread Octavian Rasnita

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


On 9 Jan 2010, at 20:35, Octavian Rasnita wrote:
(Maybe the docs could be a little more clear, because this is a  
great feature.)


Please supply a doc patch?

Cheers
t0m



I was sure you will say this. :-)

I attached a unified diff for the version 5.80017.

I hope it is OK (made under Windows...)

Octavian




patch
Description: Binary data
___
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] datetime formatting ...

2010-01-06 Thread Octavian Rasnita

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



I've got a datetime column defined:

__PACKAGE__-add_columns(
 ...
 last_modified,
 {
   data_type = DATETIME,
   default_value = undef,
   is_nullable = 1,
   size = undef,
 },
);

For some reason it's being displayed like this:

2010-01-05T20:35:14

How can I get that 'T' out of there, replacing it with the usual space?

--
Kiffin Gish kiffin.g...@planet.nl
Gouda, The Netherlands


That column is automaticly inflated by the component InflateColumn::DateTime 
which is loaded above by:


__PACKAGE__-load_components(InflateColumn::DateTime, Core);

so that column is a DateTime object and you can use the DateTime methods 
like:


$row-last_modified-ymd
$row-last_modified-set_locale('fr')-strftime('%e %b %Y')
...

If you want, you can disable the inflation by adding (after do not modify 
this or anything above'):


 __PACKAGE__-add_columns(
   last_modified = { data_type = 'datetime', inflate_datetime = 0 }
 );

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] Recommended OS for Catalyst?

2009-08-06 Thread Octavian Rasnita

Hi,

Can you recommend a Linux distribution for production for Catalyst apps?

...and a version of Perl?

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] 10 Catalyst Models in 10 Days wrapping up-ish

2009-07-28 Thread Octavian Rasnita

From: Tomas Doran bobtf...@bobtfish.net
On 28 Jul 2009, at 18:21, Octavian Râsnita wrote:


MooseX::TheSchwartz


I haven't even looked at this, other than to note that it wins the
worst named module EVAR prize (as MooseX:: is a namespace for Moose
extensions, which this blatantly isn't).

Cheers
t0m

Well, yes, but unlike TheSchwartz... it can be installed under Windows.

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] Catalyst::Plugin::Captcha example ...

2009-06-17 Thread Octavian Rasnita

From: Kieren Diment kie...@diment.org


On 17/06/2009, at 7:52 PM, Kiffin Gish wrote:

Is there some example code out there using the Captcha plugin so I  
could

learn a bit better how to use it?




Use Catalyst::Controller::reCAPTCHA instead.  It's better in quite a  
few ways.




Catalyst::Controller::reCAPTCHA++

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] Potential query string pollution vulnerability?

2009-06-16 Thread Octavian Rasnita

From: Tobias Kremer tobias.kre...@gmail.com

Hi all,

I just experienced a nasty case of query string pollution
vulnerability in one of my Catalyst/DBIC apps. I think that the
circumstances under which this applies are not _that_ rare, so I
figured it'd be best to inform the world.

Imagine the following code in one of your actions:

sub crashme :Local {
   my( $self, $c ) = @_;
   my $result = [ $c-model( 'Foo' )-search( {
   -or = [
   name = $c-req-param( 'name' )


Try:

name = $c-req-params-{name}

I think this was the recommended way, exactly for the reason you described.

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 Rasnita

From: Hans Dieter Pearcey hdp.perl.catalyst.us...@weftsoar.net
On Thu, Jun 11, 2009 at 10:46:49PM +0300, Octavian Râşniţă wrote:

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.


CPAN.pm using CPAN::SQLite had some inconsistent behavior with following
dependencies until the last version or so.  Maybe you got bit by this?
hdp.

Aha, that might be the problem because I installed that plugin for CPAN that
uses a local database.

I tried for more times to install the newer version  of CPAN, but each time
I've done this, CPAN gave errors when trying to install a module with it, so
I let the version that came with the ActivePerl distribution.

Anyway, I found another problem that disallow me to install some modules
with CPAN. Some tests stop the execution and wait forever.
In cases like this I used to install the ppm version of those modules, but
now if I want to use local::lib I need to manually install those modules and
specify the prefix when doing perl Makefile.PL.

Could it be possible to use local::lib and specify that I want to skip the
tests for the current module?

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] DBIx::Class::Schema::Loader catalyst helper

2009-05-29 Thread Octavian Rasnita

Hi,

I made a Catalyst app (under Windows) and I put it run under Linux.

Under both OSes I use the same version (latest) of:

Catalyst::Runtime
Catalyst::Devel
Catalyst::Helper::Model::DBIC::Schema
DBIx::Class

If I generate the DBIC result classes using DBIC::Schema under Windows and I 
upload them under Linux, then I try to re-generate them under Linux, even 
though they are created by the same helper and based on the same database, 
it gives an error when running the Catalyst helper:


DBIx::Class::Schema::Loader::make_schema_at(): Cannot not overwrite 
'/oct/TB/script/../lib/TB/Schema.pm' without 'really_er
ase_my_files', it does not appear to have been generated by Loader at 
/usr/lib/perl5/site_perl/5.8.8/Catalyst/Helper/Model/

DBIC/Schema.pm line 173

Is this way of re-generating the result classes wrong?
Can I do something to be able to use the helper for re-generate the result 
classes under different platforms?


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] DBIx::Class::Schema::Loader catalyst helper

2009-05-29 Thread Octavian Rasnita
From: Ivan Wills 
  2009/5/29 Octavian Rasnita orasn...@gmail.com

 Hi,
 I made a Catalyst app (under Windows) and I put it run under Linux.
 
 If I generate the DBIC result classes using DBIC::Schema under Windows 
and I upload them under Linux, then I try to re-generate them 
 under Linux, even though they are created by the same helper and based on 
the same database, it gives an error when running the Catalyst 
 helper:

 DBIx::Class::Schema::Loader::make_schema_at(): Cannot not overwrite 
'/oct/TB/script/../lib/TB/Schema.pm' without 'really_er
 ase_my_files', it does not appear to have been generated by Loader at 
/usr/lib/perl5/site_perl/5.8.8/Catalyst/Helper/Model/
 DBIC/Schema.pm line 173

At a quick guess it might be that the files generated on windows use \r\n 
line endings when trying to update those files on linux it expects just \n. You 
could try using dos2unix on the files and see if you still get the same error.

Ivan

#

Thank you! That was the problem. I have forgotten about the line endings 
because I use to save the perl files with Unix line endings under Windows 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] Looking for a working example using DBIC and Authentication

2009-05-28 Thread Octavian Rasnita
From: J. Shirley 
   Trusting Google to give you the latest version is probably a pretty bad 
idea :)
   To derail this conversation a little bit, perhaps the canonical meta tag 
pointing to the most recent release would do well on older versions still 
sitting on  CPAN?  I'm not sure how else to coerce Google into always linking 
to the most recent version of whatever it finds.
   That, and the Latest Release on CPAN is busted.  It points to 5.7003 
which then goes to a Not Found page.  Ick.

  There could be a permalink to the latest version on CPAN, and a program that 
handles the 404 Not Found errors which could get the module name (without 
version) and redirect to that permalink.

  This way, if the older versions are removed from CPAN, the Google always 
would return the latest version of the found module.

  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] Mason + DBI + Catalyst?

2009-05-27 Thread Octavian Rasnita
From: Marcello Romani mrom...@ottotecnica.com Octavian Râsnita ha 
scritto:

On Tue, May 26, 2009 at 01:37:40AM +0200, Daniel Carrera wrote:

Being able to chain resultsets makes it much much easier than using
straight SQL, and you write less code.  If you have a query you've
constructed called $query, and lets say you now only want active
records
you can do $query = $query-search({ active = 1 });  In this way you
can filter many things incrementally.

But is that efficient? It looks like you are getting MySQL to return 
the
entire data set and then making Perl filter it. That can't be 
efficient.


Here it is a short code example that might appear in a controller:

sub author : Local {

[snip]

I think this example is very interesting and should end up into the wiki 
somewhere!


I think it can be a good selling point for DBIC, but I've not seen it 
explained so well until now (but I admit I've not looked up the docs in a 
while...)


Thank you.

--
Marcello Romani


Ok, I will correct it (because I remember at least an error in it), test it 
and put it in a wiki.


Can anyone recommend a good place for a thing like this?

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] Slow fastcgi

2009-05-04 Thread Octavian Rasnita

Hi,

I have started using fastcgi with a Catalyst app, using it as an external 
server, but I've seen that it works very slow and many requests give a 
timeout error and display a 500 error because of this.


I started the Catalyst app using:

/oct/TB/script/tb_fastcgi.pl -l /tmp/tb.socket -n 5 -p /tmp/tb.pid -d

(I have also tried to start more processes using -n 10, but it works the 
same.)


I use Apache as a front server and in httpd.conf:

FastCgiExternalServer /tmp/tb.fcgi -socket /tmp/tb.socket
Alias / /tmp/tb.fcgi/

Here is the configuration for the worker MPM which I use now. I used it when 
I was using mod_perl too, but it worked much more faster (without using 
another front-end server).


IfModule prefork.c
StartServers   8
MinSpareServers5
MaxSpareServers   10
ServerLimit  56
MaxClients   56
MaxRequestsPerChild  1000
/IfModule

Please give me some hints about what I could configure to make fastcgi work 
better.


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] website member urls

2009-04-30 Thread Octavian Rasnita
From: Merlyn Kline 

  It could be also helpful if we could find a way to create urls like

  http://user.hostname.com/

  dynamicly as Google blogger site does. 
  We do this with a wildcard A record in the DNS and an Apache URL rewriting 
rule that moves the hostname into the path. When I started writing my app (in 
Catalytic pre-history) there wasn't any support (that I could see) in Catalyst 
for using the hostname in the rules that decide when an action is invoked and 
what parameters to pass to it. Things have moved on a lot since then though so 
perhaps the URL rewriter could be replaced with a better action description now.
  Merlyn



  If others don't know more about a newer and better way as you suggested, can 
you give some hints about the way you told about?



  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] Using path_to()

2009-04-29 Thread Octavian Rasnita

Hi,

In which components of a Catalyst app can I use __PACKAGE__-path_to()?

I've seen that if I use in a MyApp/View/TT.pm module

__PACKAGE__-config(
COMPILE_DIR = __PACKAGE__-path_to('templates'),
);

it gives an error like:

Can't locate object method path_to via package MyApp::View::TT at 
D:/web/MyApp/scr

ipt/../lib/MyApp/View/TT.pm line 7.

It works if I use MyApp-path_to() instead...

Generally, it would be also very helpful if we could find which methods are 
offered by a certain $c object in a certain place. Is there a way for doing 
this?


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] Using mysql_enable_utf8

2009-04-29 Thread Octavian Rasnita

Hi,

I need to use C::M::DBI for a fulltext index with MySQL, and the tables 
contain UTF-8 data.


I found that I can use mysql_enable_utf8 but I couldn't find how to use this 
option.


I've tried to use it in the model in 2 places as:

__PACKAGE__-config(
   dsn   = 'dbi:mysql:database=intranet',
   user  = 'root',
   password  = undef,
   options   = {
mysql_enable_utf8 = 1,
},
mysql_enable_utf8 = 1,
);

And I also tried to use it in the controller as

$dbh-{mysql_enable_utf8} = 1;

But with no success. The data still appears not encoded to UTF-8.

What am I doing wrong? Or do I need to make some other configurations?

---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] website member urls

2009-04-29 Thread Octavian Rasnita
From: Charles 
  technically, you're correct in that I should consider placing the usernames 
under /user. But I'm thinking of the fuzzy (to me) usability issues involved 
and the   http://website.com/ meme is what hundreds of millions non-developer 
users have come to expect.  Also, fwiw,  http://website.com/ is the user's 
profile which is publically viewable while http://website.com/member/ is the 
users url when they are logged in.


  Thanks so much for your input.


  Catalyst Rocks.


  -Charles
  **
  It could be also helpful if we could find a way to create urls like

  http://user.hostname.com/

  dynamicly as Google blogger site does.

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

2009-04-28 Thread Octavian Rasnita

From: Simon Wilcox sim...@digitalcraftsmen.net
Actually, it's mostly the inconsistency that's bad. I'm on several lists 
that work just fine with top posting.


I fully agree with this.
The netiquette's scope is to make everyone happy, but this is not possible.

As an example, a blind person can't use Linux as easy as Windows, because 
Linux is not as accessible as Windows, and it is very hard for a blind 
person to skip tens of lines in every message, just for beeing able to read 
a line or 2 with the current message (if bottom-posting is used).
I have also tried to find a better email client than Outlook Express, but I 
couldn't because of accessibility issues.


But...
The mailing lists are not democracies. They are places where most of the 
users ask for help, and if some guys that give most of the help, it wouldn't 
be very helpful for anyone to tell them to follow a standard they don't 
like, because they might prefer to go away.


For this reason, I bottom-post on the mailing lists where most of the users 
are Linux users and top-post on the other lists.

It is not so hard.

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] setting the locale with DBIx::Class::InflateColumn::DateTime

2009-04-24 Thread Octavian Rasnita

Hi,

(Sorry for asking on this list, but my messages are rejected from DBIC 
mailing list.)


Is it possible to set the locale for a certain date field if 
DBIx::Class::InflateColumn::DateTime is used when using that date, and not 
in the class definition?


I don't think it is OK to hard code the locale for a certain column in the 
class definition, because the data from that column might be presented in 
different languages, for different locales.


In the POD documentation of DBIx::Class::InflateColumn::DateTime I've 
learned how to set the locale for the date columns, but only by setting it 
in the class definition.


I've tried to set it when I used it, like

$class-date_field-month_name(locale = 'ro_RO')
or
$class-date_field-month_name({locale = 'ro_RO'})

with no luck, of course.

Thank you for any hints.

--
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] setting the locale withDBIx::Class::InflateColumn::DateTime

2009-04-24 Thread Octavian Rasnita

From: Moritz Onken on...@houseofdesign.de


Am 24.04.2009 um 10:53 schrieb Octavian Rasnita:


Hi,

(Sorry for asking on this list, but my messages are rejected from  DBIC 
mailing list.)


Is it possible to set the locale for a certain date field if 
DBIx::Class::InflateColumn::DateTime is used when using that date,  and 
not in the class definition?


I don't think it is OK to hard code the locale for a certain column  in 
the class definition, because the data from that column might be 
presented in different languages, for different locales.


In the POD documentation of DBIx::Class::InflateColumn::DateTime  I've 
learned how to set the locale for the date columns, but only by  setting 
it in the class definition.


I've tried to set it when I used it, like

$class-date_field-month_name(locale = 'ro_RO')
or
$class-date_field-month_name({locale = 'ro_RO'})

with no luck, of course.

Thank you for any hints.


IMHO this is something the view should handle. The model's output  should 
stay the same regardless of which locale the user has.


What view classes are you using? I usually write a TT macro which sets 
the locale and/or timezone to the user's preferences.



moritz


I found that I can use

$class_name-date_field-set_locale('ro')-month_name

I found that the last version of the Catalyst DBIC::Schema helper adds 
InflateColumn::DateTime component by default, and until now I was using a 
raw date like


[% row.date %]

and it printed a date like 2009-04-24.

Now it prints it as 2009-04-24T00:00:00.

I wanted to correct this and this is how I became interested about also 
localizing the dates.


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: Sample press release and announcement homepage

2009-04-23 Thread Octavian Rasnita

From: John Napiorkowski jjn1...@yahoo.com


... the revolutionary Moose Object system, the most
advanced Object
Oriented framework for any major scripting language

I would change that to 'one of the most advanced' - less
flame
igniting (and by the way Perl 6 probably does have a more
advanced
Object system).


I really want to agree but then I read some of the crazy hype coming out 
of pretty much every other system and I ask myself if our modesty hurts  
us?  I mean I'd rather go to the mat and try to argue Moose is the best 
thing ever and stir some controversy than to keep being ignored as we

have been.

Any other thoughts or feelings?  My first version of this was even more 
strongly worked, but I toned it down a bit.  Still, I figured at least one
person would call me out on one or two bits.  I'll mellow it out if people 
think I should.


You can say that Moose is the best, but in that case I think it would be 
elegant (and helpful) to also say why.
If we don't even know if it (and why) it is the best... I think you should 
not tell that.


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] Using JSON

2009-04-14 Thread Octavian Rasnita

Ok, thank you all for your recommendations.

So C::V::JSON would be the way to go for creating JSON and C::C::REST for 
creating/parsing.


I don't know yet if I would need to parse JSON if I use JQuery because I've 
seen that it can get the data in JSON format, but it sends the requests to 
the server in the standard CGI format using var1=valu1var2=value2... so I 
might not need to parse JSON but just to create it.


Anyway, now I know which would be the right way of creating JSON too if I 
would need it.


Thank you.

--
Octavian

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

To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, April 15, 2009 12:12 AM
Subject: Re: [Catalyst] Using JSON



On 14 Apr 2009, at 16:05, Octavian Râşniţă wrote:


What's the recommended module for getting a JSON request and  creating a 
JSON response in a Catalyst app?

(I want to use them with JQuery.)



I'm using Catalyst::Controller::REST to go to/from JSON.

HTH
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] How to detect if the current form request is a post?

2009-04-01 Thread Octavian Rasnita

From: kakim...@tpg.com.au

Thank you:)
Yep, and I am aware of GET as a form request method and yes, i hate it.


Why? I knew that it should be the prefered method for the forms that don't 
change anything on the server, like a search form. Isn't this true?


I ask this because I've seen many search forms that use POST and it is 
impossible to bookmark the found pages, or also seen forms that use 
Javascript with POST.


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] Thoughts On GeoIP Modules?

2009-03-12 Thread Octavian Rasnita
From: Andy Dorman ador...@ironicdesign.com
 The problem so far is manual sign ups for accounts that are then abused.  And 
 in 
 analyzing what happened we have noticed that many of the abused accounts were 
 signed up from one or two countries.  We think that geoIP restrictions could 
 cut 
 our abused account sign ups in half at least.

This would also ban the good users, but those who want to continue abusing 
would be able to use an anonymous  proxy from another country.

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: New to Catalyst questions

2009-02-20 Thread Octavian Rasnita
From: Kieren Diment kie...@diment.org

 On 20/02/2009, at 8:49 PM, Octavian Rasnita wrote:
 
 From: Dan Dascalescu ddascalescu+catal...@gmail.com
 Regarding wiki questions:

 The Catalyst wiki runs on MojoMojo (http://mojomojo.org),

 Too bad that it doesn't run under Windows.

 
 Why not?  I can't think of any practical reason why it wouldn't.
 

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.

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: New to Catalyst questions

2009-02-20 Thread Octavian Rasnita
From: Rodrigo rodrigol...@gmail.com
 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

I've just tried to do the same thing using ActivePerl, but without success. 
Cache::memory can't be installed with cpan, and I also couldn't find a ppm 
distribution for it.

I don't know if Strawberry can be used with Active State's Perl Developer Kit 
and I think it might appear some conflicts if I would have 2 perl distributions 
installed in the same time...

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: New to Catalyst questions

2009-02-20 Thread Octavian Rasnita
From: Dan Dascalescu ddascalescu+catal...@gmail.com
 I didn't have a problem with File::NFSLock compiling with the latest 
 Strawberry version.
 
 I did, and I'm not the only one:
 http://rt.cpan.org/Public/Bug/Display.html?id=40185
 
 PS: Cache::Memory is a bogus dependency. I just removed it.
 

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


___
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-17 Thread Octavian Rasnita
From: Ali M. tclwarr...@gmail.com
 When Catalyst is not chosen I personally believe it the combination of
 two things
 1. Perl is no longer perceived as an easy language, or language that
 make development easier.

More exactly,, Perl is considered a language hard to learn, that creates a code 
hard to maintain, a language that uses a strange OOP style (because I guess 
there are no books for Perl beginners that teach about Moose or Mouse), a 
language which is too flexible and because of this it is not prefered by the 
large teams of programmers because each of them could have a different style.

 2. Catalyst perceivably doesn't offer enough added value for
 developers who are not that much into Perl
to make the sacrifice and use Perl anyway.

If the programmers are not that much into perl, this means that they don't 
know how to use DBIx::Class and Catalyst and possibly other few modules which 
are usually used by Catalyst developers, and in that case they can't understand 
the power of Catalyst.

If Catalyst wants to compete with RoR or other frameworks, it should be as easy 
to install as those frameworks, and the simple apps should be also very easy to 
create.

The comparisons between web frameworks are not based on the number of the 
requests they serve, or on the number of database tables they manage, or on the 
number of backend servers they are installed on, but on the number of web sites 
that use those frameworks, so those comparisons might show that there are 100 
sites that use RoR and only 5 that use Catalyst, but don't tell that 3 from 
those 5 sites that use Catalyst have 3 times more visitors than all those 100 
sites that use RoR.
And of course, the conclusion is that RoR is much better.

I think that the success of other languages, especially Python is also due to 
the fact that they support better Windows than Perl.
WxPython is better developed than WxPerl, there are even screen readers that 
interact with the GUI of the OS in Windows and Linux, and finally... the number 
of programmers for Windows is bigger than the number of programmers for Linux.
Most Perl programmers use to consider good to publicly despise Windows and 
those who use Windows, and also consider that Perl is a language for the web, 
while those who use Python or even Ruby consider them very good languages for 
creating programs with a desktop GUI.

PerlScript as a client language, or one which is used in .hta applications or 
Windows Scripting Host, is pretty hard to use if we compare it with VBScript or 
JScript, and even if we can say that Perl can be used in places where other 
languages can't be used, practicly it can't be used really successfully. Of 
course, there are no manuals or training materials for using PerlScript, which 
are newer than 7 or 8 years.

Even on Symbian, Python is better developed than Perl, which practicly I don't 
think it is really used on the mobile phones.
I've seen a few persons that say that yes, there are many perl developers that 
create modules for CPAN, which is great, but the core Perl development team is 
probably very thin, Perl 6 is not ready yet, while Python 3 was launched and it 
has a great and powerful core team.

Python is sustained by Gmail and Sun, which create programs that use it, but 
Perl, even though it is used by big companies like Oracle, just use it, and 
don't seem to sustain its development.

I think these disadvantages also influence the potential users to think that 
even the Python frameworks are better, which is not true.

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] HTML::FormFu form elements

2009-02-11 Thread Octavian Rasnita
From: Greg Coates gcoa...@csuchico.edu
 I've run into a scenario where I need to be able to build an 
 HTML::FormFu form and then only display portions of it in my template. 
 (So, the typical [% form %] in the template will be replaced by 
 something else, at least in my ideal world.)
 
 I tried doing this in the template:
 [% form.get_element('name' = 'element_name') %]
 
 I didn't get an error, but it didn't display.
 
 Does anyone know if what I'm trying to do is possible, and if so, how to 
 do it?
 
 Thanks,
 Greg Coates

Can't you just split the form configuration file in more files, and create 
another configuration file that loads all those parts?

When you will need the entire form you could load the form configuration file 
that loads all the parts, and when you need just a part of the form, you could 
load the configuration file that contains that part 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] Proper ngettext with Catalyst

2009-02-02 Thread Octavian Rasnita
From: Felix Antonius Wilhelm Ostmann ostm...@websuche.de
i run into the same problem with german phrases
 [quant,_1,message has,messages have]  been sent.
 
 but in german:
 
 singular: Es wurde 1 Nachricht gesendet.
 plural: Es wurden 10 Nachrichten gesendet.
 
 So i cant build that with normal quant ... and i was thinking about a 
 quantf :)
 
 
 Es [quantf,_1,wurde %d Nachricht,wurden %d Nachrichten] gesendet.
 
 That would also fit for other languages where words get shuffled for 
 different counts, right?
 
 And you can use quantf only in that languages that need that. Others can 
 still use normal quant.

In Locale::Maketext I read that for more complex cases, the quant() method 
could be overriden.
But making a quantf() method could be very helpful and it could also allow 
commify the number using the tools offered by Locale::Maketext.

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] Proper ngettext with Catalyst

2009-02-01 Thread Octavian Rasnita

On Sat, Jan 31, 2009 at 8:29 AM, Nikolai Prokoschenko

b. is wrong semantically, since plural form count is different in
different languages and the position of a word can differ depending on
the number (this is one reason why gnu recommends translating complete
sentences)


I didn't know that. Do you say that in some languages they say something 
like:


I have 1 apple.
and
I have apples 10. (or 10 apples I have.)

If this is true, then yes, maketext's way is not good.

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] Proper ngettext with Catalyst

2009-02-01 Thread Octavian Rasnita

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

Most east-Asian languages don't have the same concept of plurals.  You
don't add the s, so it would just be I have 1 apple or I have 10
apple.


This is not an issue, because for the japanese translation, the string could 
be something like:


I have [quant,_1,apple,apple]

But the problem would appear if the position of the words is different 
depending on plural/singular.


So if we would need to write:
singular: I have 1 apple.
plural: I have apples 10.
then we can't use maketext.

Or maybe in certain languages we need to use:
I have apple 1.
I have apples 10.
and then I don't know how maketext could deal with this.

It could use something like:

I have [quant,_1,apple,apples,,reverse]

Or another keyword than reverse could be used, for example rtl and the 
default could be ltr.


So a poe file for a rtl language could contain something like:

msgid I have [quant,_1,apple,apples].
msgstr I have [quant,_1,apple,apples,,rtl].

Of course, between those 2 commas, we can put no apples if we need.

If gettext allows using msgid_plural (I didn't know about it), it is more 
flexible than maketext, but it requires some more to type.


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] Proper ngettext with Catalyst

2009-02-01 Thread Octavian Rasnita

From: Kieren Diment dim...@gmail.com
In indonesian, to pluralise you just say the word twice, or in writing 
put a 2 after it.


I have two apples:
Saya ada dua appel appel.
or:
Saya ada dua appel2



Saya ada [quant,_1,appel,appel appel].

But it doesn't do a perfect translation this way, because instead of dua 
it just puts 2, which is not very nice in some languages.


For example, in Romanian some numerals depend if the noun is masculine or 
feminine:

1 is unu for masculine and una for feminine nouns.
2 is doi for masculin and doua for feminine nouns.
And it also depends for 21, 22, 31, 32, and so on, but these bigger numbers 
are usually written as numbers because they are too longer otherwise.


For 1 and 2 however, in many cases they are written as words because it is 
much clear.


Another problem is the case of 0 because in English is easy but in other 
languages the structure of the sentence is totally different.


For example:
I have seen 1 boy.
I have seen 2 boys.
I have seen no boys.

But in Romanian it should be:
Am vazut 1 baiat.
Am vazut 2 baieti.
Nu am vazut nici un baiat.

Of course, in English works but it is not very nice either. It should have 
been I haven't seen any boy or something like that.


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/


<    1   2   3   >