Tabari has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
In an attempt at code clean up which was long overdue, I wanted to separate data form logic in my module and therefore tried to apply the <DATA> filehandle in the BEGIN section, putting the data neatly at the end of the file.
To no avail , however, although the same code worked well in a normal subroutine . I finally reverted to a here document instead.
This begs the folowing questions, in order of ascending vagueness :
1/ Is the DATA handle not initialized in BEGIN?
2/ Can I force such an initialization somehow, be it via another package?
3/ Is there a cleaner way for all this?
Tabari
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: __DATA__ used in BEGIN
by moritz (Cardinal) on Nov 06, 2007 at 11:27 UTC | |
by Tabari (Monk) on Nov 06, 2007 at 13:40 UTC | |
by GrandFather (Saint) on Nov 06, 2007 at 20:42 UTC | |
by mrpeabody (Friar) on Nov 07, 2007 at 19:06 UTC | |
by Tabari (Monk) on Nov 12, 2007 at 17:05 UTC | |
Re: __DATA__ used in BEGIN
by shmem (Chancellor) on Nov 06, 2007 at 12:08 UTC | |
by ikegami (Patriarch) on Nov 06, 2007 at 12:36 UTC | |
Re: __DATA__ used in BEGIN
by KurtSchwind (Chaplain) on Nov 06, 2007 at 13:18 UTC |
Back to
Seekers of Perl Wisdom