On 8/13/07, Chris Pax <[EMAIL PROTECTED]> wrote: snip > but I have it so, if you pass it a value like: ./myprog.pl update, it > will update the callbacks file and exit. > otherwise it will run the program. > > what I want to happen is for it to write in the new functions on the > fly while running the code. And I think you all have show me enough to > get me on the right track thanks. > > if you are still interested in helping me, you can help test out this: > https://launchpad.net/gladex > which is a code generator for glade. Written by me an my brother. > it is best to download the latest code through the trunk bzr. > bzr checkout http://bazaar.launchpad.net/~gladex/gladex/trunk gladex > which will download and rename a file as gladex. > then run the file: gladex.py. > the rest is self explanatory. any question, fear not to ask at > launchpad. snip
If you already have code that parses the xml file and finds the missing callbacks, then all you need to do is say my $pkg = "Funcs" my @missing_funcs = get_missing_funcs("$pkg.pm", $gladefile); if (@missing_funcs) { open my $fh, '>>', $module or die "could not open $module:$!"; for my $func (@missing_funcs) { eval qq(package $pkg; sub $func { print "stub func $func\\n"; return 1 }); print "sub $func { print "stub func $func"; return 1 }\n"; } print "\n1;"; } Other ways to create subroutines at runtime include: mucking about with typeglobs and Sub::Install* (which mucks about with typeglobs for you). * http://search.cpan.org/~rjbs/Sub-Install-0.924/lib/Sub/Install.pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/