in reply to __DATA__, seek, and tell

I think you are fine as long as you make sure not to move the DATA line in the file. If in editing the file you move that line then you are going to be in trouble. If there is a chance this could happen you probably want to open the file and scan down to __DATA__ then read everything after it in. I would highly recommend building any code that might update like this as a plugin, then you can reload the plugin and the plugin can have specific hooks for being unloaded and reloaded.


___________
Eric Hodges

Replies are listed 'Best First'.
Re^2: __DATA__, seek, and tell
by gamache (Friar) on Oct 16, 2007 at 16:19 UTC
    First, thank you for trying to answer my question rather than dissuade me from doing what I'm doing. :)

    I realized that moving the __DATA__ line would cause problems, and posted another snippet deep in my stack of replies to ikegami above:

    my $code = join '', <DATA>; seek DATA, 0, 0; while (<DATA> !~ /^__DATA__$/) {}
    This code does what I want. I feel a little better about whether I'm stomping on internals, too. I'm going to use it.

    As you identified, this approach is going to be used on plugin-style code.