Professional Web Applications Themes

Dumb Mail::Header question: getting the header - PERL Modules

I'm using Mail::Header to set up the headers for a usenet posting [that'll be fed to Net::NNTP->post]. Post's doc says it wants an array [I assume one line per entry, each terminated by a newline, as for 'article'] My problem is extracting the header-array from Mail::Header. I see ->as_string, but I can't believe that the best/only way to do it is: my hdrs = join("\n", split(/\n/, $hdr->as_string()); [I can do that easily, enough, of course, I was just wondering if I'm missing something obvious about how to get the header-array *out* of ::Header. THanks!! /Bernie\ -- Bernie Cosell Fantasy Farm ...

  1. #1

    Default Dumb Mail::Header question: getting the header

    I'm using Mail::Header to set up the headers for a usenet posting
    [that'll be fed to Net::NNTP->post]. Post's doc says it wants an array
    [I assume one line per entry, each terminated by a newline, as for
    'article'] My problem is extracting the header-array from
    Mail::Header. I see ->as_string, but I can't believe that the best/only
    way to do it is: my hdrs = join("\n", split(/\n/, $hdr->as_string());
    [I can do that easily, enough, of course, I was just wondering if I'm
    missing something obvious about how to get the header-array *out* of
    ::Header. THanks!!

    /Bernie\
    --
    Bernie Cosell Fantasy Farm
    com Pearisburg, VA
    Bernie Guest

  2. #2

    Default Re: Dumb Mail::Header question: getting the header

    On 12/03/2008 12:12 PM, Bernie Cosell wrote: 

    A perusal of the POD for Mail::Header suggests that you might call
    tags() followed by multiple calls to get() in array context.

    Mumia Guest

  3. #3

    Default Re: Dumb Mail::Header question: getting the header

    On Dec 3, 2:05pm, "Mumia W." <paduille.4061.mumia.w
    +net> wrote: [/ref]
     

    I thought about that but that still seems to be a bit tricky [compared
    with the join/split on as_string.] It'd have to be something like:

    my hdr = map "$_: ".$hdr->get($_), $hdr->tags

    Although I don't think the docs are real clear on how I'd get that
    properly refolded ['get' explicitly unfolds the header and I didn't
    see how to fix that].

    /Bernie\
    bernie@fantasyfarm.com Guest

Similar Threads

  1. PHP Mail Header and New Lines
    By Josh Johnson in forum Dreamweaver AppDev
    Replies: 4
    Last Post: March 16th, 02:01 AM
  2. mail.send - dumb question
    By Tom Petersen in forum ASP
    Replies: 4
    Last Post: October 21st, 05:27 PM
  3. Using PHP to p mail header
    By Faisal Humayun in forum PHP Development
    Replies: 3
    Last Post: September 30th, 03:22 AM
  4. manipulate mail header
    By Klaus Linzner in forum PHP Development
    Replies: 1
    Last Post: August 6th, 03:02 PM
  5. Dumb question about networking and Mail
    By Paul Fuchs in forum Mac Applications & Software
    Replies: 3
    Last Post: July 22nd, 05:41 AM

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