[Dbix-class] How can the cookbook Data::Dumper recipe possibly work?

Eden Cardim edencardim at gmail.com
Wed Jul 20 09:28:26 GMT 2011


>>>>> "Peter" == Peter Valdemar Mørch <peter at morch.com> writes:

    Peter> How is modifying $_[0] going to do anything for the caller?

,----[ perldoc perlsub ]
| The array @_ is a local array, but its elements are aliases for the
| actual scalar parameters. In particular, if an element $_[0] is
| updated, the corresponding argument is updated
`----

This means that assigning to $_[0] modifies the scalar within the caller
scope. It's done that way so you get a new object in the Data::Dumper
scope without stomping your original object.

-- 
   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://blog.edencardim.com/            http://www.shadowcat.co.uk/servers/
http://twitter.com/#!/edenc



More information about the DBIx-Class mailing list