Hi Shlomi, Thank you for the pointers. I do want to learn Python as well when I get a chance. This "framework" I'm writing now will automate things to a great extend eventually freeing up loads of my daily operations time so I can focus on more interesting things.
I'm really not expecting the code to be written for me, mere pointers as you did (with some examples would be a plus) is all that's needed for me to look into that and take it further. The example here: http://perl-begin.org/uses/text-parsing/ already helps quite a bit. Regards, Wernher On Mon, Mar 3, 2014 at 12:33 PM, Shlomi Fish <shlo...@shlomifish.org> wrote: > Hello Wernher, > > On Sun, 2 Mar 2014 21:42:00 +0200 > Wernher Eksteen <crypt...@gmail.com> wrote: > > > Hi Everyone, > > > > I need your help with this one please. > > > > I have a config file that is written/updated with a Python based web > front > > end tool. I would like to add/remove hosts to/from this config file using > > Perl. > > > > The idea I have is for Perl to read this config file, and instead of > > adding/replcing values to the original config file, to re-write the > config > > file with the > > latest hostname that was added or removed to a new config file in the > same > > format so that the Python based web tool can read it. > > > > This exceeds my knowledge of Perl at the moment and hope I can learn the > > ways from the Perl Masters :-) > > Hi, I'm going to share several possible approaches for writing such a code > which you can study and implement on your own. What I'm not going to do is > write your code for you - for me to do that, you'll need to hire me and pay > me for my time. > > In any case, here are some approaches you can take: > > 1. Write the whole thing in Python instead of Perl. > > 2. Call to a Python program from the perl program using a different > process. > > 3. Use Inline::Python ( https://metacpan.org/release/Inline-Python ) to > embed > Python code inside Perl. > > 4. Parse the file using the parsing techniques described in > http://perl-begin.org/uses/text-parsing/ - including the description of > parser > generators here - > http://perl-begin.org/uses/text-parsing/#parser-generators > (*Note*: perl-begin.org is a site I originated and maintain), modify its > intermediate representation and output it again. Note that parsing can be > quite > errorprone. > > Regards, > > Shlomi Fish > > -- > ----------------------------------------------------------------- > Shlomi Fish http://www.shlomifish.org/ > First stop for Perl beginners - http://perl-begin.org/ > > If you have the same ideas as everybody else, but have them one week > earlier > than everyone else -- then you will be hailed as a visionary. But if you > have > them five years earlier, you will be named a lunatic. ( Barry Jones ) > > Please reply to list if it's a mailing list post - http://shlom.in/reply . > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > >