[CDBI] Scope of autoupdate/update?

[prev] [thread] [next] [Date index for 2005/08/02]

From: Christopher H. Laco
Subject: [CDBI] Scope of autoupdate/update?
Date: 19:36 on 02 Aug 2005
This is a cryptographically signed message in MIME format.

--===============1305030614==
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature";
	micalg=sha1; boundary="------------ms050303040003010701030104"

This is a cryptographically signed message in MIME format.

--------------ms050303040003010701030104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

First, a little background. While working on the AxKit taglib for 
Handel, I made the decision that when updating multiple fields in the 
xml, it would be best to turn off autoupdates until all of the updates 
have been assembled and the parent tag was closed.

	<cart:cart> <!-- turn off autoupdate -->
		<cart:name>My Cart Name</cart:name>
		<cart:description>My Cart Description</cart:description>
		<cart:comments>Hey look at me!</cart:comments>
	</cart:cart> <!-- call update() manually -->

This is in contrast to how the classes themselves work in normal perl:

	package Handel::Cart;
	...

	__PACKAGE__->autoupdates(1);
	...elsewhere....
	my $cart = Handel::Cart->new;
	$cart->name('My Cart Name'); # DB updated..
	$cart->description('My Cart Description'); # DB updated..
	$cart->comments('Hey look at me'); # DB updated..

Lately, I've had the urge to take that a step further. Turn off 
autoupdates for the has_a items in the cart instance....this has led me 
to a few questions for which I don't know the answer.

First, is autoupdate() scoped to the package namespace, or to the 
package instance, or Does The Right Thing? If the package is set to 
__PACKAGE__->autoupdate(1), that applies to all instances created from 
that package in an apache mod_perl child process right?

So, when I call __PACKAGE__->new->autoupdate(1), are autoupdates turned 
on for that blessed instance, or did I just flip the autoupdates bit for 
every instance of that package in the mod_perl apacke child process 
namespace for __PACKAGE__?

And the last question is of course, if I turn off an instances 
autoupdate bit, is there any chance that that propogates to the child 
objects returned by has_a relationships?

I think it should be possible to create a custom HAS_A relationship 
class that automatically flips the autoupdate bit based on the parents 
autoupdate bit, but that of course assumes that autoupdate is scoped 
correctly.

Thoughts?

-=Chris

--------------ms050303040003010701030104
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIII8TCC
AtMwggI8oAMCAQICAw37vjANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UE
ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv
bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0EwHhcNMDUwMjA3MTc0NDM3WhcNMDYwMjA3MTc0NDM3
WjBFMR8wHQYDVQQDExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSIwIAYJKoZIhvcNAQkBFhNj
bGFjb0BjaHJpc2xhY28uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwOzj
4xFQtv4Fjr44h4AmlOTqOYw4PM80JgQrIhCQpJlQQgr+gltu+HqCdkU+8nO+MjTOSgDH98Vx
t0GK7Y7uZkwPkYM+av/RQf37y7QMPlrQiBJcKb1TYa1yWijjdvwOpEB1RSnEBtKKXN/Yc6WF
kV/mRGpCKoaxCC6YeBr4uWXXduz6KOR4RLBE3+EmxzUeGwPulHmS/evmPkt2Z7O/AVx2y1zW
zng76M1mftCw9dI7nob1F9xhIjdHEbjivysFNFmqqH0HDwkcM/VgXoU5pQNNzkglwN22MlDH
6ZylE6fCLHzzIh+1t5wdFmN+YtvemhuxO6puVuSsngJaQXBHvwIDAQABozAwLjAeBgNVHREE
FzAVgRNjbGFjb0BjaHJpc2xhY28uY29tMAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEEBQAD
gYEAaxPn+huyClyf0rU/gPmK9pqb9TSWPjxSpXhXDA9rweZiDM7kapY+s+gYQWsN2aS0Aeaz
ugPigDLVcFejf4ZxZKIKfuj05rIFC0HYg9mE6rQE8PPJP1y8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yFJcAmIfrPQgDGP5JrGzbsjdjzAcsvFa3FX
jZacu3gJqDY16PEbbm9q4ZrJwj8hU6FinEqMz151NTdt4ke2406SRQAAAAAAAA==
--------------ms050303040003010701030104--


--===============1305030614==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

--===============1305030614==--

[CDBI] Scope of autoupdate/update?
Christopher H. Laco 19:36 on 02 Aug 2005

Re: [CDBI] Scope of autoupdate/update?
Christopher H. Laco 19:54 on 02 Aug 2005

Re: [CDBI] Scope of autoupdate/update?
William Ross 20:42 on 02 Aug 2005

Re: [CDBI] Scope of autoupdate/update?
Christopher H. Laco 20:48 on 02 Aug 2005

Re: [CDBI] Scope of autoupdate/update?
Christopher H. Laco 23:49 on 08 Aug 2005

Generated at 09:40 on 09 Aug 2005 by mariachi v0.52