binmode clobbers :via

Discussion in 'Perl Misc' started by dearcilla, Aug 1, 2005.

  1. dearcilla

    dearcilla Guest

    I'm new to perl, and tend to find it frustrating. I thought PerlIO
    layers were a neat feature, but I can't do anything with them.

    When I write something like this:

    open(my $fileHandle, ">:via(Base64)", $name . '.txt') or die "$!";
    binmode($fileHandle);
    my $binaryData = "Hi there";
    print $fileHandle $binaryData;

    I get a file with "Hi there", not "SGkgdGhlcmU=". Using the CBC layer
    results in an analogous problem.

    I can go into more detail if necessary, but I'm trying to keep this
    short, since many people don't like to read long posts.
     
    dearcilla, Aug 1, 2005
    #1
    1. Advertising

  2. dearcilla

    Guest

    "dearcilla" <> wrote:
    > I'm new to perl, and tend to find it frustrating. I thought PerlIO
    > layers were a neat feature, but I can't do anything with them.
    >
    > When I write something like this:
    >
    > open(my $fileHandle, ">:via(Base64)", $name . '.txt') or die "$!";


    Hey, I want this to be converted to Base64.

    > binmode($fileHandle);


    Oops, now I want it to be :raw.

    How can it be both? It can't. So it takes the last one you threw at it.


    > my $binaryData = "Hi there";
    > print $fileHandle $binaryData;
    >
    > I get a file with "Hi there", not "SGkgdGhlcmU=". Using the CBC layer
    > results in an analogous problem.
    >
    > I can go into more detail if necessary, but I'm trying to keep this
    > short, since many people don't like to read long posts.


    Patient: "Doc, it hurts when I do this."
    Doc: "Then don't do that."

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Aug 1, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GaryDean

    vs2005 clobbers converted project

    GaryDean, Dec 26, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    389
    Steven Cheng[MSFT]
    Dec 29, 2005
  2. washu
    Replies:
    3
    Views:
    398
    G. S. Hayes
    Jul 30, 2004
  3. Randy
    Replies:
    1
    Views:
    329
    Randy
    Mar 7, 2007
  4. Dmitry Borodaenko

    StringIO#binmode: bug in cgi.rb and yaml.rb

    Dmitry Borodaenko, Aug 20, 2003, in forum: Ruby
    Replies:
    2
    Views:
    185
    Nobuyoshi Nakada
    Aug 23, 2003
  5. Henning Koch

    pstore.rb not operating in binmode

    Henning Koch, Oct 4, 2004, in forum: Ruby
    Replies:
    4
    Views:
    135
    Henrik Horneber
    Oct 5, 2004
Loading...

Share This Page