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

Discussion in 'Perl Misc' started by Dave, Jun 11, 2005.

  1. Dave

    Dave Guest

    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
    Dave, Jun 11, 2005
    #1
    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. Bret

    char **argv vs. char* argv[]

    Bret, Aug 31, 2003, in forum: C Programming
    Replies:
    21
    Views:
    4,575
    Richard Heathfield
    Sep 3, 2003
  2. David
    Replies:
    10
    Views:
    5,943
    Richard Heathfield
    Sep 15, 2003
  3. Giles Bowkett
    Replies:
    9
    Views:
    399
    Giles Bowkett
    Dec 17, 2007
  4. gry
    Replies:
    2
    Views:
    718
    Alf P. Steinbach
    Mar 13, 2012
  5. Rainer Weikusat

    perlio 'unix' layer file descriptor handling

    Rainer Weikusat, Jan 20, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    180
    Rainer Weikusat
    Jan 20, 2013
Loading...

Share This Page