Professional Web Applications Themes

has /foo/../bah/ changed? - Ruby

So on my old machine, this code seems to work differently from on the new: def procfile (input, output) printfile = true while input.gets if /<header/../<\/header/ procline(input, $_, output) end end end On the old machine, only lines between a line that containing "<header" and one containing "</header" are processed. On the new machine, running ruby 1.8.1, all the lines in the whole file (input) are processed. What up with that, any clues? Thanks! -- Ron Jeffries www.XProgramming.com I'm giving the best advice I have. You get to decide if it's true for you....

  1. #1

    Default has /foo/../bah/ changed?

    So on my old machine, this code seems to work differently from on the
    new:

    def procfile (input, output)
    printfile = true
    while input.gets
    if /<header/../<\/header/
    procline(input, $_, output)
    end
    end
    end

    On the old machine, only lines between a line that containing
    "<header" and one containing "</header" are processed.

    On the new machine, running ruby 1.8.1, all the lines in the whole
    file (input) are processed.

    What up with that, any clues?

    Thanks!

    --
    Ron Jeffries
    www.XProgramming.com
    I'm giving the best advice I have. You get to decide if it's true for you.
    Ronald Guest

  2. #2

    Default Re: has /foo/../bah/ changed?

    On Mon, 2004-02-16 at 16:04, Ronald E Jeffries wrote: 

    Change it to (untested):

    def procfile (input, output)
    printfile = true
    while l = input.gets
    if l =~ /<header/ .. l =~ /<\/header/
    procline(input, l, output)
    end
    end
    end

    The flipflop operator may/will disappear in the next revision of Ruby.
    Do a search on ruby-talk for lengthy discussions on wether or not to
    save flipflop.

    Guillaume.
     




    Guillaume Guest

  3. #3

    Default Re: has /foo/../bah/ changed?

    On Tue, 17 Feb 2004 07:54:10 +0900, Guillaume Marcais
    <fr> wrote:
     

    Thanks!

    In what way are these improvements?

    Thanks again,

    --
    Ron Jeffries
    www.XProgramming.com
    I'm giving the best advice I have. You get to decide if it's true for you.
    Ronald Guest

  4. #4

    Default Re: has /foo/../bah/ changed?


    "Ronald E Jeffries" <org> schrieb im Newsbeitrag
    news:com... 
    >
    > Thanks!
    >
    > In what way are these improvements?[/ref]

    The meaning of "<expr>..<expr>" changes when in the context of "if",
    "unless", "while" etc. This is not obviuos. For further reference see
    the lengthy discussion.

    robert

    Robert Guest

Similar Threads

  1. Everything I changed is gone
    By BJKNJ in forum Macromedia Contribute General Discussion
    Replies: 2
    Last Post: November 20th, 01:07 AM
  2. The server name has been changed?
    By Cavatino in forum Windows Server
    Replies: 1
    Last Post: June 28th, 03:52 AM
  3. $name getting changed to $_
    By Brian in forum PERL Miscellaneous
    Replies: 2
    Last Post: August 5th, 11:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139