Re: [Catalyst] Documentation on DBIx Class

2008-01-16 Thread Alex Povolotsky

Tobias Kremer wrote:



I need some advice on where to look for documentation specially
the DBIx Class and which methods I can use in here along with Catalyst.
I've already ordered the Catalyst book but until this arrive any hints?



I suggest going through the tutorial application which teaches you all the
basics of Catalyst and DBIx::Class:

http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Tutorial.pod

  


Unfortunately, Tutorial is weak. CRUD section lacks Update at all, and 
it does not deal with any transaction, and it seems to use poor methods 
to create records.


Alex.


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Documentation on DBIx Class

2008-01-16 Thread Ian Tegebo
On 1/16/08, Alex Povolotsky [EMAIL PROTECTED] wrote:
 Tobias Kremer wrote:
 
  I need some advice on where to look for documentation specially
  the DBIx Class and which methods I can use in here along with Catalyst.
  I've already ordered the Catalyst book but until this arrive any hints?
 
 
  I suggest going through the tutorial application which teaches you all the
  basics of Catalyst and DBIx::Class:
 
  http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Tutorial.pod
 
 

 Unfortunately, Tutorial is weak. CRUD section lacks Update at all, and
 it does not deal with any transaction, and it seems to use poor methods
 to create records.
Could you provide an example of richer methods for record creation?

-- 
Ian Tegebo

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Documentation on DBIx Class

2008-01-16 Thread Mike Whitaker

I need some advice on where to look for documentation specially
the DBIx Class and which methods I can use in here along with  
Catalyst.


On top of everyone else's suggestions, DO read the perldocs for  
SQL::Abstract, as that's how DBIC queries are defined.

--
Mike Whitaker - [EMAIL PROTECTED]



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Development environments and performance

2008-01-16 Thread Alex Povolotsky

Ian Docherty wrote:
I would just like to canvas opinion on a good development environment 
and practices for Catalyst since we are starting to have some 
performance issues.


We are running on a managed server (Red Hat Enterprise), Apache2, 
MySql 5.1


We have several people developing on this machine (about 5), each with 
their own sandboxes.


I have set up apache so that each developer runs their Catalyst 
application under fast-cgi.


We are beginning to see some performance issues especially with 
several people testing at the same time on different fast-cgi processes.


The 'top' command shows 'server.pl' and 'perl' taking the bulk of the 
cpu time.
CPU time? Look at paging first of all. How much RAM do you have? How 
much swap is your server using? Look at top, especially at system time 
percentage.


Best case for a simple dynamic page in Catalyst to respond is about 5 
seconds. With several people testing at the same time it can take  30 
seconds or more to respond to a simple page. I would have hoped for 
only a second or so on such a lightly loaded server.



Try catalyst-server, it does some (extremly basic) profiling.


Alex.

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

2008-01-16 Thread Marius Kjeldahl

I've got an application where I do the following:

# Look up last calculated transsum if it exists
my $rsts = $c-model ('MintAppDB::TransSum')-find ({
  category = $c-req-param ('category'),
  sentto = $c-req-param ('sentto'),
  iso = $c-req-param ('iso')
});

sentto contains an url style link, for instance 
email:[EMAIL PROTECTED]. Somewhere when generating SQL for this, it 
becomes:


STH: SELECT me.updated, me.category, me.sentto, me.iso, me.amt FROM 
mm_transsum me WHERE ( email:[EMAIL PROTECTED] = ? AND me.category = ? )


It seems Postgres gets confused with my usage of a variable with colon 
in it, and the default quoting being done on strings somewhere in 
DBD::Pg or DBIx::Class doesn't seem to pursuade Postgres from 
interpreting the string with the colon in as a special variable field 
(or whatever, I haven't looked to deep into this functionality of Postgres).


I've tried calling quote manually and use:

  sentto = \ $myquotedstring

instead, hoping that manually calling quote from the dbh driver from 
DBD::Pg would take care of it, but no such luck.


The error message being generated by Catalyst/DBIx::Class is:

Cannot mix placeholder styles :foo and ?

Does anybody have an idea how I can pursuade Postgres into accepting 
this as just a simple string and that Postgres shouldn't try to 
interpret anything in it?


Thanks,

Marius K.

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

2008-01-16 Thread Joshua D. Drake

Marius Kjeldahl wrote:

I've got an application where I do the following:


It seems Postgres gets confused with my usage of a variable with colon 
in it, and the default quoting being done on strings somewhere in 
DBD::Pg or DBIx::Class doesn't seem to pursuade Postgres from 
interpreting the string with the colon in as a special variable field 
(or whatever, I haven't looked to deep into this functionality of 
Postgres).


This doesn't have anything to do with PostgreSQL. This appears to be a 
driver issue.


instead, hoping that manually calling quote from the dbh driver from 
DBD::Pg would take care of it, but no such luck.


The error message being generated by Catalyst/DBIx::Class is:

Cannot mix placeholder styles :foo and ?

Does anybody have an idea how I can pursuade Postgres into accepting 
this as just a simple string and that Postgres shouldn't try to 
interpret anything in it?


Yeah, quote the string. You can't submit an unquoted string to PostgreSQL.

Sincerely,

Joshua D. Drake

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

2008-01-16 Thread Marius Kjeldahl

Joshua D. Drake wrote:
Does anybody have an idea how I can pursuade Postgres into accepting 
this as just a simple string and that Postgres shouldn't try to 
interpret anything in it?


Yeah, quote the string. You can't submit an unquoted string to PostgreSQL.


As my original post demonstrated, that was not the issue at all. But I 
found the reason for the bug. It seems IF in the following expression:


my $rsts = $c-model ('MintAppDB::TransSum')-find ({
  category = $c-req-param ('category'),
  sentto = $c-req-param ('sentto'),
  iso = $c-req-param ('iso')
});

if category and iso pointed to undefined values, the bug I struggled 
with was triggered. Making sure that they were defined took care of the 
problem. I guess the sql generating stuff didn't like being fed 
undefined values.


Thanks anyway,

Marius K.


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

2008-01-16 Thread Carl Johnstone

my $rsts = $c-model ('MintAppDB::TransSum')-find ({
  category = $c-req-param ('category'),
  sentto = $c-req-param ('sentto'),
  iso = $c-req-param ('iso')
});


This is broken! Simply try requesting a URL such:

?category=cat1category=cat2

Carl


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Development environments and performance

2008-01-16 Thread Wade . Stuart
John Goulah [EMAIL PROTECTED] wrote on 01/16/2008 11:13:06 AM:




 Why wouldn't you just use the standalone server bundled with
 Catalyst?  Fcgi is great for production, but the processes are
 fairly thick memory wise, so having instances for each developer
 could be an issue.   We use the cat server for development and works
 fine for about 5-10 people at any given time on a modest box (4G ram)

Could be a massive assumption,  but usually when you go through the cost
(time, cap) of building out a dev server environment you want it to mirror
your production servers as much as possible so that you spend time
squishing bugs that may exist in your production environment -- not some
other different environment.  If they are using FCGI in prod it makes
perfect sense to do so in dev.  Why battle bugs that may be introduced on
the standalone server, or worse miss bugs that _do_ affect your production
environment because you are developing on a different environment?

-Wade


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Development environments and performance

2008-01-16 Thread Ash Berlin


On Jan 16, 2008, at 5:51 PM, [EMAIL PROTECTED] wrote:


John Goulah [EMAIL PROTECTED] wrote on 01/16/2008 11:13:06 AM:





Why wouldn't you just use the standalone server bundled with
Catalyst?  Fcgi is great for production, but the processes are
fairly thick memory wise, so having instances for each developer
could be an issue.   We use the cat server for development and works
fine for about 5-10 people at any given time on a modest box (4G ram)


Could be a massive assumption,  but usually when you go through the  
cost
(time, cap) of building out a dev server environment you want it to  
mirror

your production servers as much as possible so that you spend time
squishing bugs that may exist in your production environment -- not  
some

other different environment.  If they are using FCGI in prod it makes
perfect sense to do so in dev.  Why battle bugs that may be  
introduced on
the standalone server, or worse miss bugs that _do_ affect your  
production

environment because you are developing on a different environment?

-Wade



No, thats a testing environment. Dev is usually very different  
process. At least at every place I've worked at.


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Help with Cwd Error

2008-01-16 Thread Angel Kolev
after some upgrades of my perl modules:
[EMAIL PROTECTED]:~/progs/MyApp$script/myapp_server.pl
/usr/bin/perl: symbol lookup error:
/usr/local/lib/perl/5.8.8/auto/Cwd/Cwd.so: undefined symbol: strlcpy

Can you help me please
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] PostgreSQL quoting issues

2008-01-16 Thread Marius Kjeldahl
Thank you for all the hints about the security issues with using the 
param call. I will replace those calls with accessing the 
parameters/params hash instead, which should solve the list context 
issues in the hash that my example was suffering from.


Marius K.

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

2008-01-16 Thread Dave Rolsky

On Wed, 16 Jan 2008, kevin montuori wrote:


DR == Dave Rolsky [EMAIL PROTECTED] writes:


DR * dev is one box per dev, with the best hardware affordable - nowadays
DR * that means at least a dual core machine with 4GB of ram and decent
DR * disks.

at least 4 GB of ram?  crikey.


I'm thinking that a sane budget is $2,500 per developer machine (with 
monitor). Is that unreasonable? Do you really need to save a few hundred 
bucks on ram?



i'd have to disagree.  if you have a bunch of junior developers
writing code, a shared (to some extent) development environment can
aid in enforcing good development habits.  it also allows them to work
more on development than systems or database administration.  never
mind that it's asking a lot to make programmers (of any skill level)
DBA their own oracle instances, LDAP servers, or, god forbid,
siteminder installations.


This is what automation was invented for. At several past positions, I've 
set things up so that development consisted of checking out the source and 
running a set up my dev env script that created/updated the database, 
inserted test data, set up any servers needed, etc.


This doesn't require much of the individual dev, and if you have packages 
for your app, the installation part is pretty simple.


That said, I think good developers should have some minimal sysadmin 
skills, and should be comfortable setting up a DBMS or LDAP server on 
their own machine, and difficult installations can be scripted.



my suspicion is that in shops with poor shared development
environments, the systems administration is more to blame for the
suitability issues than the fact that the environment is shared.


Well, not if there's a _resource_ issue. If, as J Rockway described, you 
have 40 people sharing one machine, you're probably screwed no matter how 
good your sysadmins are.



catalyst allows for a particularly nice sandbox though, using the
devlopment httpd.  we're having a lot of luck providing a (robust, but
not 4GB per devloper!) shared dev/sandbox environment with each of 8
or so developers running a dev httpd.  we then releasing code to
integration for regression testing.  i'm certainly not seeing the
performance problems that have been reported on this list.


Presumably that depends on how many devs you have. However, I'd be going 
nuts if I had to deal with other devs changing the database schema, or 
even just changing the state of the data while I'm trying to develop 
against it.


I stand by my position that any place not providing individual 
environments is backwards.



-dave

/*===
VegGuide.Orgwww.BookIRead.com
Your guide to all that's veg.   My book blog
===*/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Help with Cwd Error

2008-01-16 Thread Bob McClure Jr
On Wed, Jan 16, 2008 at 03:04:59PM -0600, Jonathan Rockway wrote:
 
 On Wed, 2008-01-16 at 20:41 +0200, Angel Kolev wrote:
  after some upgrades of my perl modules:
  [EMAIL PROTECTED]:~/progs/MyApp$script/myapp_server.pl
  /usr/bin/perl: symbol lookup
  error: /usr/local/lib/perl/5.8.8/auto/Cwd/Cwd.so: undefined symbol:
  strlcpy
 
 This bug bit Andreas' smoker also.  I don't know of the fix yet, but
 I'll reply to this message if I find anything.  (The dist in question is
 PathTools; try downgrading that.)
 
 Regards,
 Jonathan Rockway

I just got bit by the same thing when I installed
HTML::Template and its dependencies on my file server.  A cron job
that runs mrtg started kicking out the error every five minutes.

A web search finds this:

http://rt.cpan.org/Public/Bug/Display.html?id=32296

part of which recommends (as one solution) downgrading PathTools to
v3.25*.  And of course you can get it here:

http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/PathTools-3.2501.tar.gz

That fixes it.

Cheers,
-- 
Bob McClure, Jr. Bobcat Open Systems, Inc.
[EMAIL PROTECTED] http://www.bobcatos.com
Make sure that nobody pays back wrong for wrong, but always try to be
kind to each other and to everyone else.  1 Thessalonians 5:15 (NIV)

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Help with Cwd Error

2008-01-16 Thread Angel Kolev
Thanks, Dave. This helps
PathTools-3.26_01http://search.cpan.org/%7Ekwilliams/PathTools-3.26_01/

2008/1/16, Dave Rolsky [EMAIL PROTECTED]:

 On Wed, 16 Jan 2008, Jonathan Rockway wrote:

 
  On Wed, 2008-01-16 at 20:41 +0200, Angel Kolev wrote:
  after some upgrades of my perl modules:
  [EMAIL PROTECTED]:~/progs/MyApp$script/myapp_server.pl
  /usr/bin/perl: symbol lookup
  error: /usr/local/lib/perl/5.8.8/auto/Cwd/Cwd.so: undefined symbol:
  strlcpy
 
  This bug bit Andreas' smoker also.  I don't know of the fix yet, but
  I'll reply to this message if I find anything.  (The dist in question is
  PathTools; try downgrading that.)

 There's a fixed version of PathTools on CPAN (3.26_01 IIRC).


 -dave

 /*===
 VegGuide.Orgwww.BookIRead.com
 Your guide to all that's veg.   My book blog
 ===*/

 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/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] Re: Development environments and performance

2008-01-16 Thread kevin montuori
 DR == Dave Rolsky [EMAIL PROTECTED] writes:


 DR I'm thinking that a sane budget is $2,500 per developer machine
 DR (with monitor). Is that unreasonable? Do you really need to save a
 DR few hundred bucks on ram?

it's not so much that it's unreasonable (though the extra $700 apple
charges for 4 instead of 2 GB certainly is) as unnecessary.  actually,
the at least part made me chuckle.  i've honestly never felt
constrained by 2 GB, but whatever.

  i'd have to disagree.  if you have a bunch of junior developers
  writing code, a shared (to some extent) development environment can
  aid in enforcing good development habits.

 DR This is what automation was invented for. At several past positions,
 DR I've set things up so that development consisted of checking out the
 DR source and running a set up my dev env script that created/updated
 DR the database, inserted test data, set up any servers needed, etc.

so resources should not be shared in a development environment at all?
everyone gets their own oracle server *instance* (not database)?  it's
one thing to crank up a new database and slap in a schema, something
else entirely to maintain a separate instance of oracle.  i've seen
grown men cry trying to install it (and get the instantclient libs,
tnsnames.ora, c working).  

 DR That said, I think good developers should have some minimal sysadmin
 DR skills, and should be comfortable setting up a DBMS or LDAP server on
 DR their own machine, and difficult installations can be scripted.

that's naive.  not that i don't agree (i do, very much so).  the sad
reality is that we're having a difficult enough time finding developers
(for a $75k/year, 2-4 years experience position) who can even discuss
what LDAP is, never mind try to configure it.  maybe everyone in your
shop is a reasonable sysadmin, but that's not what i've seen.

  my suspicion is that in shops with poor shared development
  environments, the systems administration is more to blame for the
  suitability issues than the fact that the environment is shared.

 DR Well, not if there's a _resource_ issue. If, as J Rockway described,
 DR you have 40 people sharing one machine, you're probably screwed no
 DR matter how good your sysadmins are.

of course you're right, but a good sysadmin wouldn't try to put 40
people on one machine.  and i wouldn't say that machine equals
environment.  whenever possible it's nice to develop (yes, actually
develop, not just test) on an environment similiar to what production
looks like.  if that's distributed fast CGI across more than one
machine, having developer access to a similiar environment will save on
having unplesant surprises later.

  catalyst allows for a particularly nice sandbox though, using the
  devlopment httpd.  we're having a lot of luck providing a (robust, but
  not 4GB per devloper!) shared dev/sandbox environment with each of 8
  or so developers running a dev httpd.  we then releasing code to
  integration for regression testing.  i'm certainly not seeing the
  performance problems that have been reported on this list.

 DR Presumably that depends on how many devs you have. However, I'd be
 DR going nuts if I had to deal with other devs changing the database
 DR schema, or even just changing the state of the data while I'm trying
 DR to develop against it.

presently, development (database and LDAP) schema changes are managed by
the release manager (which makes sense if the changes are going to end
up in integration, test, and production).  developers have access to
their own copies of the schema and data that can be refreshed at their
leisure, but DBA services are provided centrally, so backups (and
restores) just happen on sandbox databases.

 DR I stand by my position that any place not providing individual
 DR environments is backwards.

and i'd maintain that i've seen very successful setups that provided
centralized services for development.  i wouldn't advocate that everyone
try to share a working directory, or a database, or an apache instance,
but having decent administrators provide a reliable and consistent
dev environment has benefited us in a number of ways:

  -- code that's been tested by the developer in development will almost
 always run in integration because the versions of the libraries are
 consistent.  furthermore, there's a good understanding of what's
 required to deploy code that's been written against the development
 environment.  less so when people tell me that it runs on my
 machine, i don't konw why it doesn't run in integration.  

  -- experienced developers new to the environment waste almost no time
 trying to futz around getting all the working parts configured
 correctly.  we run a setup script and volia, their databases, ldap
 instances, apache sandbox, SSO configuration, firewall
 configuration, c. are complete and correct.  when upgrades are
 done to any of the software, these are mostly transparent to the
 

Re: [Catalyst] Documentation on DBIx Class

2008-01-16 Thread Matt S Trout
On Wed, Jan 16, 2008 at 08:54:35AM +0100, Peter Sørensen wrote:
 Hi,
 
 I've been using perls for years and when dealing with web -  CGI and DBI.
 
 Now I've come across Catalyst and DBIx. This is fantastic. Now I can
 get back to the code I've written and actually understand what I wrote 2 
 weeks back :-)
 
 I need some advice on where to look for documentation specially
 the DBIx Class and which methods I can use in here along with Catalyst.

http://search.cpan.org/dist/DBIx-Class/

http://search.cpan.org/perldoc?Catalyst::Model::DBIC::Schema

There's no 'which methods I can use', Model::DBIC::Schema exposes your
(Catalyst-independent) DBIx::Class::Schema fairly directly so anything you
can do with DBIC outside of Catalyst you can do inside, too.

Note also that DBIx::Class is a separate project with its own list you can
ask questions on, and 'DBIx' is the namespace for DBI extensions, of which
there are lots, so just saying 'DBIx' when you mean DBIx::Class is wrong
(and will potentially confuse people :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

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

2008-01-16 Thread Matt S Trout
On Wed, Jan 16, 2008 at 03:17:58PM +0100, Marius Kjeldahl wrote:
 I've got an application where I do the following:
 
 # Look up last calculated transsum if it exists
 my $rsts = $c-model ('MintAppDB::TransSum')-find ({
   category = $c-req-param ('category'),
   sentto = $c-req-param ('sentto'),
   iso = $c-req-param ('iso')
 });

Never use $c-req-param. You're not competent to do so without screwing
it up, and neither am I :)

$c-req-params-{category}

will, I think, turn out to be much safer all round (or better still RUN USER
INPUT THROUGH A VALIDATOR BEFORE YOU LET IT ON THE SAME SUBNET AS YOUR
PRODUCTION DATABASE DAMMIT :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Two ways to create record

2008-01-16 Thread Matt S Trout
On Tue, Jan 15, 2008 at 04:38:36PM +0300, Alex Povolotsky wrote:
 Matt S Trout wrote:
 
 Neither of these are standard DBIx::Class methods; the standard approach
 is to do
 
 my $obj = $rs-new(\%data);
 
 maybe use $obj-column_name($value) to set more data
 
 $obj-insert;
   
 
 ... I see. It does not depend on model implementation.
 
 Ok than, assume I'm using DBI connection without AutoCommit (AutoCommit 
 is often a very bad practice).

Don't do that. Turn AutoCommit on and use DBIC's txn_do method.

If you leave AutoCommit off DBIC can't manage transaction depth properly
and you have to handle everything manually- which is *always* a very bad
practive.

Also, once again there's a dbix-class list and this discussion would be
more appropriate there.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/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] Problem with TT view and form.field

2008-01-16 Thread Peter Sørensen
Hi,

I am trying to get hold of the Template Toolkit views.

If I make a .tt2 file like

[% form.render %]

all form fields are showing up - OK.

Now I want do my own layout and as I understood the DOCS all
fields are saved in a hash field or array fields.

All my fields are  defined in a .fb file

If I do:

[% FOREACH field IN form.fields %]
tr
td[% field.label %]/td
td[% field.name %]/td
td[% field.field %]/td
/tr
[% END %]

The output is OK but as I understood the docs it should also
be possible to access this directly.
 
 [% fields %]  -  List of fields
 [% field  %]  -  Hash of fields (for lookup by name)


Lets say I have a field named 
firstname then it should be possible to do:

[% form.fields.firstname.label %]

BUT NOTHING SHOWS UP.


I have tried to create a testhash in the controller like:

my %testhash;
$testhash{firstname} = myname;
$c-stash-{testhash} = \%testhash;

and I have no problem using:

[% testhash.firstname %]

in the .tt2 file

What am i missing or what have I overlooked??


Regards 


Peter Sørensen/University of Southern Denmark/email: [EMAIL PROTECTED]

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