Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > binmode clobbers :via

Reply
Thread Tools

binmode clobbers :via

 
 
dearcilla
Guest
Posts: n/a
 
      08-01-2005
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.

 
Reply With Quote
 
 
 
 
xhoster@gmail.com
Guest
Posts: n/a
 
      08-01-2005
"dearcilla" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Excel clobbers browser history (sometimes) Randy ASP .Net 1 03-07-2007 03:05 AM
vs2005 clobbers converted project GaryDean ASP .Net 5 12-29-2005 07:25 AM
pstore.rb not operating in binmode Henning Koch Ruby 4 10-05-2004 09:07 AM
read() or readline() clobbers my variable washu Python 3 07-30-2004 05:58 PM
StringIO#binmode: bug in cgi.rb and yaml.rb Dmitry Borodaenko Ruby 2 08-22-2003 11:46 PM



Advertisments