On Aug 14, 2008, at 4:12 AM, Udo Waechter wrote:
>
> Hi there,
> just to be sure:
>
> http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions says
> that "The file name is derived from the name of the function that
> Puppet
> is trying to run."
>
> Is this still true?
>
> I ask because I currently write a set of math functions (min,max,
> plus,
> minus and so). My first try was to create a math.rb, where I had:
>
> module Puppet::Parser::Functions
> newfunction(:min, :type => :rvalue) do |args|
> ....
> end
> newfunction(:max, :type => :rvalue) do |args|
> ....
> end
> ....and so on...
> end
>
> This of course did not work, so I split the whole thing up in
> multiple:
> min.rb, max.rb, .... files.
>
> This works now quite well. Nevertheless it would be somewhat nicer to
> have these functions in one file.
> Is this possible? If yes how? If not, never mind the question.
Well, you could put them all into one file, and immediately use the
function that that file is named after. This will load all of the
functions in the file, so when you go to use the other functions,
they''ll be available.
Note that this is more hack than feature, though, so don''t be
surprised if its behaviour changes a bit over time.
--
The trouble with the world is that the stupid are cocksure and the
intelligent are full of doubt. -- Bertrand Russell
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---