Re: [Catalyst] advent calendar/2009/3

2009-12-04 Thread Marcello Romani

Kiffin Gish ha scritto:

svn url might be handier to announce.


Look closer:

svn co 
http://dev.catalystframework.org/repos/Catalyst/trunk/examples/Advent09FormHandlerBlog


:-)




On Thu, 2009-12-03 at 10:55 +0100, Ulf Lenski wrote:

Hi everyone.
Has one of you tested the blog example from advent calender - day 3 ?

()

I tried that but I got this error message ??
<<
Couldn't instantiate component "Blog::Model::DB", "Cannot load schema
class 'Blog::Schema': "abs2rel" is not exported by the File::Spec module
Can't continue after import errors at
/home/lenski/temp/Advent09FormHandlerBlog/Blog/script/../lib/Blog/Schema.pm
line 7
BEGIN failed--compilation aborted at
/home/lenski/temp/Advent09FormHandlerBlog/Blog/script/../lib/Blog/Schema.pm
line 7.
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.8/Catalyst/Model/DBIC/Schema.pm line 271.
 at script/blog_server.pl line 66" at script/blog_server.pl line 66
Compilation failed in require at script/blog_server.pl line 66.
I'm wondering how that example should work without any model? What I'm
doing wrong?

Thanks in advance - cheers, Ulf.


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






--
Marcello Romani

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] advent calendar/2009/3

2009-12-04 Thread Marcello Romani

Ulf Lenski ha scritto:

Hi everyone.
Has one of you tested the blog example from advent calender - day 3 ?



Hi, I have been able to run it after manually installing all the 
dependencies (AFAIKT they're not listed in the makefile).


What I'm trying to do now is deploy the schema to the db.
I have manually created the (so far empty) database and the role 'blog', 
and properly setup the permissions, but when I try to run 
script/blog_deploy.pl I get the error "load_schema" not defined.


Looking at the source, there's in fact no such method in Blog/Schema.pm

Any advice would be appreciated.

Thanks.

--
Marcello Romani

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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-20 Thread Marcello Romani

Lyle ha scritto:

Kiffin Gish wrote:

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.
  


TBH if I really found the need for the DB to match up to objects, then 
I'd use an Object Database, not a Relational one. The only real argument 
for using a relational one instead, in that situation, is the 
performance benefits. When you want top performance from a relational 
database, you won't be using an ORM anyway.


But the question is: do you need raw dbi performance all over the place 
? Just as you can write some critical functions in assembly and wrap 
them up in a C function or C++ class method, you can use an ORM to speed 
up development and have easier code maintenance, and use dbi+raw sql 
where you find a performance bottleneck.


Also, as someone has mentioned earlier in this thread, DBIC requires a 
well-designed db schema, so in some way it prevents bad design decisions 
at the "raw-sql" level, thus helping to acheive good performance right 
from the start.





Lyle


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



Just my 2 (euro) cents.

--
Marcello Romani

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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-27 Thread Marcello Romani

J. Shirley ha scritto:

On Tue, Apr 27, 2010 at 2:39 AM, Oleg Pronin  wrote:


Why can't nobody understand, the question is not why someone should
use "$c->req->{params}". Of course that is an evil. Problem is that if
i could get ->{parameters}{name} at a speed 100x there can't be no
reason for ->params to work as a turtle and i see a good reason to use
wrappers around Request to provide normal, fast method of acessing
parameters. Use Class::XSAccessor, Fast::XS, i dont now, use
something!!! Many people ask me why most of catalyst accessors working
so slow ? i dunno what to answer except for writing our own wrapper
accessors getting values directly with massive speedup.



The response you are getting, and having a hard time understanding
apparently, is that the worrying about overhead of accessors is
premature optimization that has no benefit to the scope of your real
application.

Unless you provide a NYTProf of your application showing Catalyst is
the bottleneck, nobody is going to care what you are saying.

I'm not sure why you think Catalyst accessors are so slow... on 5.10+
they are faster than Class::Accessor::Fast.  Startup time is slower,
but runtime is faster.  I'd prefer that.

Oleg, seriously, what are you trying to accomplish here?  You aren't
saying anything helpful and you really aren't good at trolling.  I'm
genuinely curious about your goals and the only reason I (and others)
are bothering to respond to you because your history on the mailing
list.

-J

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


But the question arises: is he the _real_ Oleg Pronin... ?

--
Marcello Romani

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


Re: [Catalyst] New catalystframework.org

2012-03-14 Thread Marcello Romani

Il 13/03/2012 13:59, Tobias Kremer ha scritto:

Dear list,

it is with great pleasure that I can announce a redesign of the old
Catalyst framework front page. Some of you may remember the draft from
a couple of years back when I first came up with it here on the list.
I tweaked a couple of things (e.g. everything links to MetaCPAN) and
t0m++ pushed it live this morning. I'd like all of you to take a
minute to check it out and give me some (constructive!) feedback:

http://www.catalystframework.org/beta

For now it's just one static page, but we should definitely aim at
bringing more content (e.g. the docs) into the new design. dpetrov++
suggested using the excellent MetaCPAN API to grab the POD, which I
think is a fantastic idea I'm currently experimenting with.
Nevertheless, as it stands now it's already an enormous improvement
over the old site IMHO.

Looking forward to hearing your thoughts!

Cheers,
--Toby

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


FWIW, I think it's an excellent work.
T0m's photo might be a bit frightening for newcomers, though ;-)

--
Marcello Romani

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Serving html pages

2008-01-11 Thread Marcello Romani

Emmanuel Quevillon ha scritto:

Hi,

I am quite new with catalyst and I'd like to know how I could serve some 
html pages (actually documentation) e.g.:

www.myapp.com/docs/index.html ?

When I try to integrate such link in my template page, Pages are not 
served and as mentioned in the C::P::Static::Simple it does not serve 
.html file.


Is there any magic thing to do without changing 
MyApp->config->{static}->{ignore_extensions} ?


Thanks a lot

Regards



If I recall correctly, the default is to serve as static files only the 
ones under root/static, so try to put doc/ there.


P.S.: Please don't start a new thread under an existing one.

HTH

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] warning

2008-01-24 Thread Marcello Romani

Octavian Rasnita ha scritto:

From: <[EMAIL PROTECTED]>


 Try setting the cookie to a more reasonable second count (1 day) and
see if that resolves your issue.  All of the browsers handle extended
cookies a bit differently and while one setting may work on IE, the smae
may cause a nocookie on firefox.  I really believe your problem is one of
cookie expiration (or content length) and not one where you have to mess
around setting the domain again (that problem is solved for you -- stop
looking for zebras).


But if I do that and a client will close the browser without logging 
off, somebody else could open the browser and the app will recognize him 
as the owner of the account, so it could be a big security issue.
That's why I need to have cookies which are not saved and used after the 
browser was closed.


Can I set the expiry date and avoid that security risk?

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/



I'm not 100% sure, but probably you could achieve that by setting the 
expiry date in the past.


HTH

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] warning

2008-01-24 Thread Marcello Romani

Octavian Rasnita ha scritto:

From: "Marcello Romani" <[EMAIL PROTECTED]>

But if I do that and a client will close the browser without logging 
off, somebody else could open the browser and the app will recognize 
him as the owner of the account, so it could be a big security issue.
That's why I need to have cookies which are not saved and used after 
the browser was closed.


Can I set the expiry date and avoid that security risk?

Thank you.
I'm not 100% sure, but probably you could achieve that by setting the 
expiry date in the past.


HTH


Thanks for the idea. I will try it, although I think it might invalidate 
the cookie.


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/



That should be the bit that will do the trick: being invalid, it will be 
discarded as soon as the browser is closed, but it should remain valid 
until that point.


--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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 test server response times.

2008-01-30 Thread Marcello Romani

Andrew Payne ha scritto:

On Jan 30, 2008 9:14 AM, Ian Docherty <[EMAIL PROTECTED]> wrote:

It is frequently (but not always) taking 20 seconds or so to display a
page in my browser


The only times I've had this happen, it's been DNS issues -- in my
case, dhcpd putting a duff entry in resolv.conf

YMMV, but worth checking.

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/



I had similar problems once or twice in the past year, and I remember 
having played with -k (keep alive flag). If my memory is right, -k was 
causing delays. I think it's also worth trying with and without -r flag.


HTH

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] how many RAM used is normal

2008-06-06 Thread Marcello Romani

Fayland Lam ha scritto:
we are using Catalyst under mod_perl2. and every httpd is costing 
130-200M. `top` shows:


1566 apache16   0  147m 136m 6188 S  0.0  1.7   0:23.97 httpd
1567 apache16   0  147m 136m 6200 S  0.0  1.7   0:28.51 httpd
1568 apache16   0  143m 132m 6192 S  0.0  1.6   0:23.45 httpd
1569 apache16   0  144m 133m 6192 S  0.0  1.6   0:24.36 httpd
1570 apache15   0  152m 141m 6196 S  0.0  1.7   0:23.45 httpd
1571 apache16   0  141m 130m 6192 S  0.0  1.6   0:24.57 httpd
1572 apache16   0  143m 131m 6196 S  0.0  1.6   0:22.13 httpd
1581 apache16   0  148m 137m 6184 S  0.0  1.7   0:22.56 httpd
1582 apache16   0  142m 131m 6188 S  0.0  1.6   0:22.12 httpd
1583 apache16   0  144m 133m 6192 S  0.0  1.6   0:21.89 httpd
1584 apache16   0  141m 130m 6184 S  0.0  1.6   0:23.20 httpd
1587 apache16   0  151m 139m 6184 S  0.0  1.7   0:23.87 httpd
1588 apache16   0  140m 129m 6180 S  0.0  1.6   0:21.76 httpd
1589 apache16   0  142m 131m 6188 S  0.0  1.6   0:20.75 httpd
2128 apache16   0  138m 127m 6176 S  0.0  1.6   0:09.76 httpd

is it normal under Catalyst+DBIx::Class+Template? or there is something 
wrong?

What's your Catalyst App costs? Thanks.



I suppose that's a 'top' output; memory columns should be: virtual, 
resident, shared.


memory usage is thus between 120 and 130 MB for each httpd instance
(e.g. 1360MB resident - 6M shared).

For example, on one of my servers I have vmware server running:

 4615 root 5 -10  365m 307m 296m S0 15.2  81:57.93 vmware-vmx
 3905 root 5 -10  381m 304m 291m S2 15.0  85:41.40 vmware-vmx

resident: 307MB, 296 of which are shared among the two processes.

If all those httpd processes run the same app I think they have should 
have more shared memory.

You could probably check if you preload your app in your apache config file.
Something like:


use lib qw(/path/to/MyApp/lib);

PerlModule MyApp;

etc.


HTH

Just my 2 eurocents.


--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] Re: how many RAM used is normal

2008-06-06 Thread Marcello Romani

Aristotle Pagaltzis ha scritto:

* Fayland Lam <[EMAIL PROTECTED]> [2008-06-06 04:55]:

we are using Catalyst under mod_perl2. and every httpd is
costing 130-200M. `top` shows:


But I expect that much of that memory is shared with other
httpd instances. F.ex. see
http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html

Regards,


Thanks for mentioning that article, I found it very nice and informative.

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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 site design drafts feedback thread

2008-06-13 Thread Marcello Romani

Christopher H. Laco ha scritto:

Dave Rolsky wrote:

On Wed, 11 Jun 2008, Matt S Trout wrote:


Simon Elliott:

(1) http://www.browsing.co.uk/cat


Overall my favorite. The white text against the bottom of the grey 
gradient starts to fade, but I'm sure that's easily fixed. I wouldn't 
mind making all the non-tab text a little larger, but maybe my eyes 
are a little older than our target audience ;)




Speaking of gradient... I'd much rather see a footer more like this one:

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


Wow, that's a nice design!

While I like #1 the most, and I'd really like to see the crop-circle 
thingy of #2 integrated into it, I think designers should take 
movabletype.org design as a source of inspiration.



--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] Re: Catalyst site design drafts feedback thread

2008-06-16 Thread Marcello Romani

Tobias Kremer ha scritto:

Quoting Tobias Kremer <[EMAIL PROTECTED]>:

The other proposed layouts are making fundamental mistakes regarding
color scheme choice and/or distribution of elements. I'm not a professional
web
designer but a blue box with a thick light green frame below a dark red
header
and everything blurred into oblivion by shadows, makes me wanna scream :)


I couldn't resist it ... Here's something I whipped up in the last hour or so:

http://www.funkreich.de/catalystorg.png

It's nothing revolutionary. Of course, the content needs quite a bit of work and
the graphics are not very polished but you get the idea ... Oh yeah, the logo is
too small - I couldn't find a high(er) resolution version (preferably vectorized
not as a bitmap) of it ...

Shall I continue my effort or is this too little too late? :)

--Tobias

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



I like this one, but I think the "download now!" should be replaced with 
something like "get started!": a web framework is not something you 
"download & install" like e.g. Firefox.


To "get started" I would put up a simple page with a bullet list where 
in a few points the reader has to learn: what is catalyst, what benefits 
it brings to web developement, how to install it, then point to the 
first, simple tutorial which will get its feet wet.


Just 2 cents.


--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] Re: Catalyst site design drafts feedback thread

2008-06-17 Thread Marcello Romani

Aristotle Pagaltzis ha scritto:

* Marcello Romani <[EMAIL PROTECTED]> [2008-06-17 08:50]:

To "get started" I would put up a simple page with a bullet
list where in a few points the reader has to learn: what is
catalyst, what benefits it brings to web developement, how to
install it, then point to the first, simple tutorial which will
get its feet wet.


Isn’t that the purpose of the home page…? A Getting Started page
is more the place to put an example app download, a screencast
link, a whole bunch of tutorials… stuff like that.

Regards,


Hmmm you're probably right, but it depends on how long that content 
will be. On the home page one could put that content in very few words, 
then descrbie the points in more detail in a "getting started" page.


--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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 site design drafts feedback thread

2008-06-18 Thread Marcello Romani

Drew Taylor ha scritto:

On Wed, Jun 11, 2008 at 8:54 PM, Matt S Trout <[EMAIL PROTECTED]> wrote:

Simon Elliott
(1) http://www.browsing.co.uk/cat


I liked this one the most of the original designs.

However, I now prefer Tobias' version at http://www.funkreich.de/catalyst/.

One suggestion, I suggest incorporating a list of recent blogs/news as
in Simon's design. To me, that indicates the "freshness", for lack of
a better word, of the project and its community.

And to everyone, keep up the good work!

Drew


I put my vote to this new design!

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] Re: Catalyst site design drafts feedback thread

2008-06-19 Thread Marcello Romani

Tobias Kremer ha scritto:

Quoting Aristotle Pagaltzis <[EMAIL PROTECTED]>:

* Tobias Kremer <[EMAIL PROTECTED]> [2008-06-17 08:40]:

I've incorporated some of the suggestions into the next version
of the mockup which can be found here:

Awesome. There are still nits, but you have already made those
clear yourself, and it’s a huge improvement over the promising
first draft, so I’m confident you’ll get there.


I've started to code the site and the ongoing process is available at
http://www.funkreich.de/catalyst. It's currently known to look good in Mozilla
Firefox and Safari. MSIE (as always) still looks a bit odd but I think we're
far from browser-optimizing the site :)


Some nits: [...]


Thanks! :)


• The text in the left column: I don’t have a good suggestion off
  hand, but if you want, I can spend some time thinking about it.
  (Are you on IRC? We might confer/brainstorm a bit.)


Good idea! My nick is "soulchild" but I'm currently at work and can't promise
that I'll make it into the room.

--Tobias

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



It looks great on FF3.0
I think the cat logo could be enlarged and made transparent, so that the 
lower "arm" of the crop circle overlaps a little with the red bar below. 
This way the logo could be enlarged without the need to add more white 
space to the top of the page (which would be a waste of space), and 
would also add a bit of "special effect" to the page, without being, 
IMHO, too intrusive.


Just my .2 cents.

Keep up the good work!

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] connecting to more than one database

2008-07-03 Thread Marcello Romani

Oleg Pronin ha scritto:
How do you imagine yourself a request with join beetween 2 tables in 
different databases?

This is the reason you can't make relationships between different schemas.


If it's not a typo, the two schemas connect to the same database on the 
mysql side...


Anyway, I think DBIC sees them as two different databases, even if their 
connections strings are the same...




2008/7/3 jagdish eashwar <[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>>:


I am working on two Catalyst applications and had earlier set up
separate Mysql databases for each of them. Since some of the tables
that these two applications use, are the same, I put the common
tables in a third database and created two models in each of the
Catalyst applications. I am, however, unable to set up 
relationships between  tables in the common and specific databases.


I used myapp_create.pl to create the two models:

perl script/hardware_create.pl model MyhardwareDB DBIC::Schema
Myhardware::Schema::MyhardwareDB create=static dbi:mysql:hardware
'jag' 'passwd' '{ AutoCommit => 1 }'

perl script/hardware_create.pl model CommonDB DBIC::Schema
Myhardware::Schema::CommonDB create=static dbi:mysql:hardware 'jag'
'passwd' '{ AutoCommit => 1 }'

and then put in the relationships between the employee and hardware
tables as under:

# in Emp.pm
#employee has many hardware
__PACKAGE__->has_many(emp_hm_hw =>
'Myhardware::Schema::MyhardwareDB::Hardware', 'hw_emp_id');

# in Hardware.pm
#hardware belongs to employee
__PACKAGE__->belongs_to(hw_bt_emp_id =>
'Myhardware::Schema::CommonDB::Emp','hw_emp_id');

When I use these accessors in the tt2 templates, i get an undef error.

undef error - DBIx::Class::Relationship::Accessor::__ANON__(): Can't
find source for Myhardware::Schema::MyhardwareDB::Hardware at
/home/jag/catalyst_trials/Myhardware/root/src/usr_fragment.tt2 line 8

What am I doing wrong?

Jagdish

___
List: Catalyst@lists.scsys.co.uk <mailto:Catalyst@lists.scsys.co.uk>
Listinfo: http://lists.scsys.co.uk/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/



--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] connecting to more than one database

2008-07-03 Thread Marcello Romani

jagdish eashwar ha scritto:


Hi,
The first Catalyst application of mine deals with the leave records of 
employees. The second one deals with the hardware that they have been 
given. Both these applications require details about the employees like 
their name and employee_no. So I put the employee details in one 
database called 'common', and the leave particulars in another database 
called 'leave' , and the hardware details in a third database called 
'hardware'.


I was able to put in the foreign key constraints at the time of table 
creation. And these are working. I cannot, for example, insert an 
emloyee_no in either the 'leave' or the 'hardware' database if it is not 
existing in the 'common' database.


So when I was able to do what I had in mind at the database level, I 
thought it would be possible to do the same with Catalyst and 
DBIx::Class also. I still haven't lost hope.  It would be painful and 
inelegant to have to replicate the employee details for each  of the web 
applications in the respective databases.


I think you are using the word 'database' to refer to both the DBIC 
schema and the mysql database, which is confusing.


Since the two dsn in the previous post were the same, I assume your 
setup is as follows:


- all the data in a mysql database

- multiple Cat apps, each one with its own DBIC schema, all pointing to 
the sama mysql database, but dealing with a subset of tables


If this is the case, then the fact that the fk constraints at the 
database level work is to be expected (if you use InnoDB for example).

DBIC, on the other hand, thinks you have multiple databases.



jagdish
On Thu, Jul 3, 2008 at 6:10 PM, Marcello Romani <[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>> wrote:


Oleg Pronin ha scritto:

How do you imagine yourself a request with join beetween 2
tables in different databases?
This is the reason you can't make relationships between
different schemas.


If it's not a typo, the two schemas connect to the same database on
the mysql side...

Anyway, I think DBIC sees them as two different databases, even if
their connections strings are the same...


2008/7/3 jagdish eashwar <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
<mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>>:


   I am working on two Catalyst applications and had earlier set up
   separate Mysql databases for each of them. Since some of the
tables
   that these two applications use, are the same, I put the common
   tables in a third database and created two models in each of the
   Catalyst applications. I am, however, unable to set up  
 relationships between  tables in the common and specific databases.


   I used myapp_create.pl to create the two models:

   perl script/hardware_create.pl model MyhardwareDB DBIC::Schema
   Myhardware::Schema::MyhardwareDB create=static dbi:mysql:hardware
   'jag' 'passwd' '{ AutoCommit => 1 }'

   perl script/hardware_create.pl model CommonDB DBIC::Schema
   Myhardware::Schema::CommonDB create=static dbi:mysql:hardware
'jag'
   'passwd' '{ AutoCommit => 1 }'

   and then put in the relationships between the employee and
hardware
   tables as under:

   # in Emp.pm
   #employee has many hardware
   __PACKAGE__->has_many(emp_hm_hw =>
   'Myhardware::Schema::MyhardwareDB::Hardware', 'hw_emp_id');

   # in Hardware.pm
   #hardware belongs to employee
   __PACKAGE__->belongs_to(hw_bt_emp_id =>
   'Myhardware::Schema::CommonDB::Emp','hw_emp_id');

   When I use these accessors in the tt2 templates, i get an
undef error.

   undef error -
DBIx::Class::Relationship::Accessor::__ANON__(): Can't
   find source for Myhardware::Schema::MyhardwareDB::Hardware at
 
 /home/jag/catalyst_trials/Myhardware/root/src/usr_fragment.tt2

line 8

   What am I doing wrong?

   Jagdish

   ___
   List: Catalyst@lists.scsys.co.uk
<mailto:Catalyst@lists.scsys.co.uk>
<mailto:Catalyst@lists.scsys.co.uk
<mailto:Catalyst@lists.scsys.co.uk>>

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







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

2009-01-08 Thread Marcello Romani

Terence Monteiro ha scritto:

[snip]


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


afaict, you should let dbic / cat-model handle the connection to the 
database. I usually use something like this: a


MyApp/Model/Main.pm

package which inherits from e.g.

Catalyst::Model::DBIC::Schema

and calls

__PACKAGE__->config(
schema_class => 'MyApp::Schema',
connect_info => [ $dsn, $user, $pass, $options ],
);

This way I don't explicitly connect at startup, but let the framework 
perform the actual connection when needed (i.e. at first db access, with 
something like $c->model('Main')->resultset('Users')->find($id))


[snip]

HTH

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.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] controller subclass and :Local actions

2009-01-16 Thread Marcello Romani

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


In MyApp::Controller::Base:

use base qw( Catalyst::Controller );

sub list : Local {
do stuff
}

In MyApp::Controller::CD:

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

sub list : Local {
do other stuff
}


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

Can someone give me a hint ?

Thank you.

--
Marcello Romani


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


Re: [Catalyst] controller subclass and :Local actions

2009-01-19 Thread Marcello Romani

Rodrigo ha scritto:



On Fri, Jan 16, 2009 at 6:13 PM, Marcello Romani 
mailto:mrom...@ottotecnica.com>> wrote:


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

In MyApp::Controller::Base:

use base qw( Catalyst::Controller );

sub list : Local {
   do stuff
}

In MyApp::Controller::CD:

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

sub list : Local {
   do other stuff
}


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

Can someone give me a hint ?

Thank you.

-- 
Marcello Romani



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


It should look something like this:

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

-rodrigo




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


It works fine for me too, today :-)

I always use the dev server with -r, so it could be that the thing was 
not picked up until I CTRL-C'ed the server and restarted manually...


Sorry for the noise.

--
Marcello Romani


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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 Marcello Romani

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 {
 my ($self, $c) = @_;

#Variables you might get after the user submits a form:

 my $name = $c->req->params->{name};
 my $country = $c->req->params->{country};

#Search the database for all fiction authors:

 my $authors = $c->model("DB::Authors")->search({
   style => 'fiction',
 });

#Until this point DBIC doesn't touch the database.

#Add filters based on what the user searched using the form:

 $authors = $authors->search({name => {-like => "%$name%"}) if $name;

 $authors = $authors->search({country => $country}) if $country;

#Until this point, DBIC also didn't touch the database.

#Add the $authors object to the stash, to be able to print it in a 
template:

 $c->stash->{authors} = $authors;

#Until here, DBIC didn't touch the database
}

#And the subroutine ended.

And then you can print some things using a Template-Toolkit template 
(authors.tt):


[% IF some_variable = 1 %]
 [% FOREACH author = authors.next %]
   Name: [% author.name %]
   Country: [% author.country %]
   Localized birthday month: [% 
author.birthday.set_locale('fr').month_name %]


   The books of this author:
   [% FOREACH book = author.books %]
 [% book.title %] - [% book.editor %]
   [% END %]
 [% END %]
[% END %]


And at this point, DBIC still doesn't touch the database if the variable 
"some_variable" is not equal to 1 so the code below the IF line 
shouldn't be executed.


But if the variable is 1, only at this point DBIC executes the necessary 
queries and get the data. And you have seen that due to the relations 
that were created in the DBIC result classes, it would be very simple to 
access not only data about the authors, but about his books or data that 
can be found in other related tables, without needing to define a new 
query.


I wrote this code in Outlook Express and it might have bugs because I 
didn't test it, but I hope it helps to make an idea about what DBIC can do.


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/



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

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