File: destroy.sh

package info (click to toggle)
shoop 0.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 328 kB
  • ctags: 41
  • sloc: sh: 1,138; makefile: 209; perl: 44
file content (30 lines) | stat: -rw-r--r-- 980 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh -e
#
# Destroy module for shoop. Expands the OBJECT class with a destroy method
# that completly whipes out any object it is called on (if that object has
# children, they stick around, so use with caution.
#
# LGPL copyright 2000 by Joey Hess <joey@kitenet.net>

# Enable introspection inside _shoop
_shoop_introspect=1


## This module allows one to destroy a shoop object.  It also erases the
## entire cache.

IFS=" " OBJECT . destroy :p '
	eval local A DEFINES=\$_shoopdefines_$THIS METH TRUEMETH
	for A in $DEFINES; do
		METH=$A TRUEMETH=${THIS}_$A
		if [ -z "$_shoopnocache_" ]; then
			eval $_shoopcacheclear_
		fi
		unset _shooptype_$TRUEMETH _shoopfinal_$TRUEMETH _shoop_TRUEMETH
	done
	# Unfortunately, destroying an object can have really weird side
	# effects to the cache tree.  It is best just to erase the whole
	# thing, then attempting to figure out which parts need to be
	# erased.
	eval unset _shoopdefines_$THIS $THIS _shoopcache_ \$_shoopcache_
'