Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > setting perlio layers (e.g., utf8) on "magic" ARGV file handle

Reply
Thread Tools

setting perlio layers (e.g., utf8) on "magic" ARGV file handle

 
 
Dave
Guest
Posts: n/a
 
      06-11-2005
I was able to find a few references to similar dilemmas by searching
Google Groups, but none of them fully satisfied my question.

When processing one or more files that have been passed to one's Perl
program from the command line, how does one achieve an effect equivalent
to calling "binmode(FH, ":layer")"? Using "binmode(ARGV)" does not seem
to work for this purpose, because binmode() cannot be called before the
file is open.

As a practical matter, I can use the "C" option on the command line to
workaround this limitation in my present situation, but I would like to
know how to manipulate the layers on the files in @ARGV from within my
program. In addition, the "C" option only controls some of Perl's
Unicode behavior, so it will not always be a viable workaround,
depending on what I'm doing.

I realize that I can of course explicitly open the files myself, but I
can't help but to think that there must exist a more elegant solution
than that.

Dave
 
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
perlio 'unix' layer file descriptor handling Rainer Weikusat Perl Misc 0 01-20-2013 07:16 PM
Subnets between core and access/distribution layers & routing between layers J Cisco 0 12-13-2006 08:38 PM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM
difference(s) between char** argv and char* argv[] David C Programming 10 09-15-2003 06:58 AM
char **argv vs. char* argv[] Bret C Programming 21 09-03-2003 03:24 AM



Advertisments
 



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