# File lib/puppet/provider/package/darwinport.rb, line 9
 9:     def self.eachpkgashash
10:         # list out all of the packages
11:         open("| #{command(:port)} list installed") { |process|
12:             regex = %r{(\S+)\s+@(\S+)\s+(\S+)}
13:             fields = [:name, :ensure, :location]
14:             hash = {}
15: 
16:             # now turn each returned line into a package object
17:             process.each { |line|
18:                 hash.clear
19: 
20:                 if match = regex.match(line)
21:                     fields.zip(match.captures) { |field,value|
22:                         hash[field] = value
23:                     }
24: 
25:                     hash.delete :location
26:                     hash[:provider] = self.name
27:                     yield hash.dup
28:                 else
29:                     raise Puppet::DevError,
30:                         "Failed to match dpkg line %s" % line
31:                 end
32:             }
33:         }
34:     end