[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01936] BUG???

From: "David Douthitt" <DDouthitt@...>
Date: 2000-03-16 23:45:06 UTC
List: ruby-talk #1936
[..... I received this output today......]

# ./others.rb sys1 sys2 sys3 sys4 sys5 sys6 | less
./others.rb:29: [BUG] obj_free() called for broken object
    Mar 12 17:19:36 172.16.17.31  printer: offline or intervention needed
    Mar 12 17:19:36 172.16.17.31  printer: paper out
    Mar 12 17:20:10 172.16.17.31  printer: error cleared
    Mar 12 18:31:10 172.16.17.31  printer: toner/ink low
Abort
#

[..... this output was generated when I ran this script .....]

#!/usr/bin/ruby

# Interesting problem reached here...
#
# ARGV is [ "arg1", "arg2", "arg3" ]
# results from a scan are [ [ "str1" ] ]
#
# Thus, ARGV.each is "arg1" ... "arg2" ... "arg3" ...
# scanXX.each is [ "str1" ] ... [ "str2 ] ...
#
# Thus ARGV[0] is "arg1" ; scanXX[0] is [ "str1" ] ;
# and scanXX[0][0] is "str1"
#
# This explains a lot.

systems = Array.new

class String
   def systemName
      self.scan("^... .. ..:..:.. ([^ ]*)")
   end
end

File.open("/var/log/messages").each { |line|
   line.chomp!
#  sys = line.scan("^... .. ..:..:.. ([^ ]*)")
   sys = line.systemName

   systems = systems | sys

   if not ARGV.include?(sys[0][0])
      print("    ", line, "\n")
   end
   }

# (systems.sort!).each { |sys|
#    print("   ", sys, "\n")
#    }

[....snip!.......]

Note my comment about ARGV[0] and scan().each[0][0]   (!)



In This Thread

Prev Next