晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 sh-3ll

HOME


sh-3ll 1.0
DIR:/opt/alt/ruby18/share/ri/1.8/system/Net/POP3/
Upload File :
Current File : //opt/alt/ruby18/share/ri/1.8/system/Net/POP3/cdesc-POP3.yaml
--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: The address to connect to.
  name: address
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: Seconds to wait until a connection is opened. If the POP3 object cannot open a connection within this time, it raises a TimeoutError exception.
  name: open_timeout
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: Seconds to wait until reading one block (by one read(1) call). If the POP3 object cannot complete a read() within this time, it raises a TimeoutError exception.
  name: read_timeout
  rw: R
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: APOP
- !ruby/object:RI::MethodSummary 
  name: auth_only
- !ruby/object:RI::MethodSummary 
  name: certs
- !ruby/object:RI::MethodSummary 
  name: create_ssl_params
- !ruby/object:RI::MethodSummary 
  name: default_pop3_port
- !ruby/object:RI::MethodSummary 
  name: default_pop3s_port
- !ruby/object:RI::MethodSummary 
  name: default_port
- !ruby/object:RI::MethodSummary 
  name: delete_all
- !ruby/object:RI::MethodSummary 
  name: disable_ssl
- !ruby/object:RI::MethodSummary 
  name: enable_ssl
- !ruby/object:RI::MethodSummary 
  name: foreach
- !ruby/object:RI::MethodSummary 
  name: new
- !ruby/object:RI::MethodSummary 
  name: ssl_params
- !ruby/object:RI::MethodSummary 
  name: start
- !ruby/object:RI::MethodSummary 
  name: use_ssl?
- !ruby/object:RI::MethodSummary 
  name: verify
comment: 
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Net::POP3
- !ruby/struct:SM::Flow::H 
  level: 2
  text: What is This Library?
- !ruby/struct:SM::Flow::P 
  body: This library provides functionality for retrieving email via POP3, the Post Office Protocol version 3. For details of POP3, see [RFC1939] (http://www.ietf.org/rfc/rfc1939.txt).
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Examples
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Retrieving Messages
- !ruby/struct:SM::Flow::P 
  body: This example retrieves messages from the server and deletes them on the server.
- !ruby/struct:SM::Flow::P 
  body: Messages are written to files named 'inbox/1', 'inbox/2', .... Replace 'pop.example.com' with your POP3 server address, and 'YourAccount' and 'YourPassword' with the appropriate account details.
- !ruby/struct:SM::Flow::VERB 
  body: "    require 'net/pop'\n\n    pop = Net::POP3.new('pop.example.com')\n    pop.start('YourAccount', 'YourPassword')             # (1)\n    if pop.mails.empty?\n      puts 'No mail.'\n    else\n      i = 0\n      pop.each_mail do |m|   # or "pop.mails.each ..."   # (2)\n        File.open("inbox/#{i}", 'w') do |f|\n          f.write m.pop\n        end\n        m.delete\n        i += 1\n      end\n      puts "#{pop.mails.size} mails popped."\n    end\n    pop.finish                                           # (3)\n"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Call Net::POP3#start and start POP session.
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Access messages by using POP3#each_mail and/or POP3#mails.
  - !ruby/struct:SM::Flow::LI 
    label: "3."
    body: "Close POP session by calling POP3#finish or use the block form of #start."
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Shortened Code
- !ruby/struct:SM::Flow::P 
  body: The example above is very verbose. You can shorten the code by using some utility methods. First, the block form of Net::POP3.start can be used instead of POP3.new, POP3#start and POP3#finish.
- !ruby/struct:SM::Flow::VERB 
  body: "    require 'net/pop'\n\n    Net::POP3.start('pop.example.com', 110,\n                    'YourAccount', 'YourPassword') do |pop|\n      if pop.mails.empty?\n        puts 'No mail.'\n      else\n        i = 0\n        pop.each_mail do |m|   # or "pop.mails.each ..."\n          File.open("inbox/#{i}", 'w') do |f|\n            f.write m.pop\n          end\n          m.delete\n          i += 1\n        end\n        puts "#{pop.mails.size} mails popped."\n      end\n    end\n"
- !ruby/struct:SM::Flow::P 
  body: "POP3#delete_all is an alternative for #each_mail and #delete."
- !ruby/struct:SM::Flow::VERB 
  body: "    require 'net/pop'\n\n    Net::POP3.start('pop.example.com', 110,\n                    'YourAccount', 'YourPassword') do |pop|\n      if pop.mails.empty?\n        puts 'No mail.'\n      else\n        i = 1\n        pop.delete_all do |m|\n          File.open("inbox/#{i}", 'w') do |f|\n            f.write m.pop\n          end\n          i += 1\n        end\n      end\n    end\n"
- !ruby/struct:SM::Flow::P 
  body: And here is an even shorter example.
- !ruby/struct:SM::Flow::VERB 
  body: "    require 'net/pop'\n\n    i = 0\n    Net::POP3.delete_all('pop.example.com', 110,\n                         'YourAccount', 'YourPassword') do |m|\n      File.open("inbox/#{i}", 'w') do |f|\n        f.write m.pop\n      end\n      i += 1\n    end\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Memory Space Issues
- !ruby/struct:SM::Flow::P 
  body: All the examples above get each message as one big string. This example avoids this.
- !ruby/struct:SM::Flow::VERB 
  body: "    require 'net/pop'\n\n    i = 1\n    Net::POP3.delete_all('pop.example.com', 110,\n                         'YourAccount', 'YourPassword') do |m|\n      File.open("inbox/#{i}", 'w') do |f|\n        m.pop do |chunk|    # get a message little by little.\n          f.write chunk\n        end\n        i += 1\n      end\n    end\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Using APOP
- !ruby/struct:SM::Flow::P 
  body: "The net/pop library supports APOP authentication. To use APOP, use the Net::APOP class instead of the Net::POP3 class. You can use the utility method, Net::POP3.APOP(). For example:"
- !ruby/struct:SM::Flow::VERB 
  body: "    require 'net/pop'\n\n    # Use APOP authentication if $isapop == true\n    pop = Net::POP3.APOP($is_apop).new('apop.example.com', 110)\n    pop.start(YourAccount', 'YourPassword') do |pop|\n      # Rest of the code is the same.\n    end\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Fetch Only Selected Mail Using 'UIDL' POP Command
- !ruby/struct:SM::Flow::P 
  body: If your POP server provides UIDL functionality, you can grab only selected mails from the POP server. e.g.
- !ruby/struct:SM::Flow::VERB 
  body: "    def need_pop?( id )\n      # determine if we need pop this mail...\n    end\n\n    Net::POP3.start('pop.example.com', 110,\n                    'Your account', 'Your password') do |pop|\n      pop.mails.select { |m| need_pop?(m.unique_id) }.each do |m|\n        do_something(m.pop)\n      end\n    end\n"
- !ruby/struct:SM::Flow::P 
  body: The POPMail#unique_id() method returns the unique-id of the message as a String. Normally the unique-id is a hash of the message.
constants: 
- !ruby/object:RI::Constant 
  comment: 
  name: Revision
  value: "%q$Revision: 29903 $.split[1]"
full_name: Net::POP3
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: active?
- !ruby/object:RI::MethodSummary 
  name: apop?
- !ruby/object:RI::MethodSummary 
  name: auth_only
- !ruby/object:RI::MethodSummary 
  name: command
- !ruby/object:RI::MethodSummary 
  name: delete_all
- !ruby/object:RI::MethodSummary 
  name: disable_ssl
- !ruby/object:RI::MethodSummary 
  name: do_finish
- !ruby/object:RI::MethodSummary 
  name: do_start
- !ruby/object:RI::MethodSummary 
  name: each
- !ruby/object:RI::MethodSummary 
  name: each_mail
- !ruby/object:RI::MethodSummary 
  name: enable_ssl
- !ruby/object:RI::MethodSummary 
  name: finish
- !ruby/object:RI::MethodSummary 
  name: inspect
- !ruby/object:RI::MethodSummary 
  name: logging
- !ruby/object:RI::MethodSummary 
  name: mails
- !ruby/object:RI::MethodSummary 
  name: n_bytes
- !ruby/object:RI::MethodSummary 
  name: n_mails
- !ruby/object:RI::MethodSummary 
  name: on_connect
- !ruby/object:RI::MethodSummary 
  name: port
- !ruby/object:RI::MethodSummary 
  name: read_timeout=
- !ruby/object:RI::MethodSummary 
  name: reset
- !ruby/object:RI::MethodSummary 
  name: set_debug_output
- !ruby/object:RI::MethodSummary 
  name: start
- !ruby/object:RI::MethodSummary 
  name: started?
- !ruby/object:RI::MethodSummary 
  name: use_ssl?
name: POP3
superclass: Protocol