[29609] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 853 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 15 14:09:42 2007

Date: Sat, 15 Sep 2007 11:09:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 15 Sep 2007     Volume: 11 Number: 853

Today's topics:
    Re: $string =~ /$pattern/i sln@netherlands.co
    Re: $string =~ /$pattern/i <tadmc@seesig.invalid>
        `command 2>&1 > file` without the shell? <socyl@987jk.com.invalid>
    Re: `command 2>&1 > file` without the shell? <peter@makholm.net>
    Re: `command 2>&1 > file` without the shell? <mina86@tlen.pl>
    Re: Challenge: CPU-optimized byte-wise or-equals (for a <zaxfuuq@invalid.net>
    Re: Challenge: CPU-optimized byte-wise or-equals (for a <zaxfuuq@invalid.net>
    Re: Challenge: CPU-optimized byte-wise or-equals (for a <bik.mido@tiscalinet.it>
    Re: Challenge: CPU-optimized byte-wise or-equals (for a <zaxfuuq@invalid.net>
    Re: Challenge: CPU-optimized byte-wise or-equals (for a <m@rtij.nl.invlalid>
        checbox problem <Bond@james.bond>
    Re: checbox problem <tadmc@seesig.invalid>
    Re: checbox problem <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: Displaying utf8 text in perl -d <nospam-abuse@ilyaz.org>
        Get unlimited visitors to your website  ashishmundhara108@gmail.com
        how to remove parentheses from a line in a file - need  <pauls@nospam.off>
    Re: menu replacing <mina86@tlen.pl>
        Need a guitar?  nutsbreaker1@gmail.com
    Re: Need a guitar? <jwkizer@yahoo.com>
    Re: Oneliner problem with < and > in variable <mina86@tlen.pl>
    Re: parallel computing in perl? <bik.mido@tiscalinet.it>
        strange behaviour with 'use open IN => ":byte" <wernbag@gmail.com>
    Re: strange behaviour with 'use open IN => ":byte" <paduille.4061.mumia.w+nospam@earthlink.net>
        World's most popular traveling destinations  nutsbreaker4@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 15 Sep 2007 09:04:45 -0700
From: sln@netherlands.co
Subject: Re: $string =~ /$pattern/i
Message-Id: <qdvne3ln9ddhdrusjf669n5cqgkgeot53c@4ax.com>

On Wed, 12 Sep 2007 16:53:09 -0700, cracraft@cox.net wrote:

>Hi,
>
>I am attempting to find out if a $string contains $pattern.
>
>  $string =~ /$pattern/i
>
>normally solves it.
>
>However, I noticed that if $pattern contains something like
>
>   (4)
>
>and $string contains something like
>
>   ABC(4)
>
>then
>
>  $string =~ /$pattern/i
>
>does not work, because of the parenthesis.
>
>I want a flat-out literal match where $string can contain any
>occurrence of $pattern regardless of parenthesis.
>
>In other words, I don't want the special characters of regular
>expressions interpreted.
>
>I could write my own pattern matcher but resist it and would
>think Perl could provide the above feature.
>
>Anybody?
>
>--Stuart

Quote meta doesen't work for everything.
However, this does:

use strict;
use warnings;

my ($pat_convert);

$pat_convert  = convertPatternMeta ( 'Hello...?' );
showMatchResult ($pat_convert, 'Hello...? this is a big string x');
showMatchResult ($pat_convert, 'Oh Hello x');

$pat_convert  = convertPatternMeta ( '*?+' );
showMatchResult ($pat_convert, 'Hello...? this (*?+) is a big string x');
showMatchResult ($pat_convert, '*?+ and so is this');

## ------------------------------------
## Helpers
##
sub convertPatternMeta
{
    my ($pattern) = shift;
    my @regx_esc_codes =
    (
    "\\", '/', '(', ')', '[', ']', '?', '|',
    '+', '.', '*', '$', '^', '{', '}', '@'
    );
    foreach my $tc (@regx_esc_codes) {
        # code template for regex
        my $xxx = "\$pattern =~ s/\\$tc/\\\\\\$tc/g;";
        eval $xxx;
        if ($@) {
            # the compiler will show the escape char, add
            # it char to @regx_esc_codes
            $@ =~ s/^\s+//s; $@ =~ s/\s+$//s;
            die "$@";
        }
    }
    return $pattern;
}
##
sub showMatchResult
{
    my ($pattern, $string) = @_;
    my $result_txt = '';
    my ($result) = $string =~ /$pattern/;
    if ($result) { $result_txt = 'DOES match'}
    else { $result_txt = 'Does NOT match' }
    print "\nString:      $string\n$result_txt\nPattern:     $pattern\n";
}




------------------------------

Date: Sat, 15 Sep 2007 16:27:33 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: $string =~ /$pattern/i
Message-Id: <slrnfeo1sg.fh.tadmc@tadmc30.sbcglobal.net>

sln@netherlands.co <sln@netherlands.co> wrote:


> Quote meta doesen't work for everything.


Yes it does.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Sat, 15 Sep 2007 15:10:31 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: `command 2>&1 > file` without the shell?
Message-Id: <fcgsl7$c51$1@reader1.panix.com>




If I wanted to execute an external (unix) command X such that X's
normal output went to some file, but any error messages from X were
saved to an array, I could, for example, do this:

  my @err = `X 2>&1 > some_file`;

How could I achieve the same results without using the shell?

TIA!

kj
-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.


------------------------------

Date: Sat, 15 Sep 2007 15:17:19 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: `command 2>&1 > file` without the shell?
Message-Id: <874phwot4w.fsf@hacking.dk>

kj <socyl@987jk.com.invalid> writes:

> If I wanted to execute an external (unix) command X such that X's
> normal output went to some file, but any error messages from X were
> saved to an array, I could, for example, do this:
>
>   my @err = `X 2>&1 > some_file`;
>
> How could I achieve the same results without using the shell?

You could use IPC::Open3 and then save the error messages youself.

//Makholm


------------------------------

Date: Sat, 15 Sep 2007 17:20:31 +0200
From: Michal Nazarewicz <mina86@tlen.pl>
Subject: Re: `command 2>&1 > file` without the shell?
Message-Id: <87r6l0dkg0.fsf@erwin.mina86.com>

kj <socyl@987jk.com.invalid> writes:

> If I wanted to execute an external (unix) command X such that X's
> normal output went to some file, but any error messages from X were
> saved to an array, I could, for example, do this:
>
>   my @err = `X 2>&1 > some_file`;
>
> How could I achieve the same results without using the shell?

create a pipe, fork, play with opened files and execute X.  Not tested
and lacking error checking:

#v+
pipe RD, WR;
if ($pid = fork) {
    close WR;
    @err = <RD>;
    waitpid $pid, 0;
    close RD;
} else {
    close RD;
    open STDOUT, '>', 'some_file';
    open STDERR, '>&', \*WR;
    exec 'X' 'X';
}
#v-

-- 
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86*tlen.pl>---<jid:mina86*chrome.pl>--ooO--(_)--Ooo--


------------------------------

Date: Sat, 15 Sep 2007 03:06:28 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <EdednVIFtY4_PXbbnZ2dnUVZ_uiknZ2d@comcast.com>



"brian d foy" <brian.d.foy@gmail.com> wrote in message 
news:130920072350495491%brian.d.foy@gmail.com...
> In article <ri8je3t355us9d8tbc37rdue2e6knqvbpu@4ax.com>, Michele Dondi
> <bik.mido@tiscalinet.it> wrote:
>
>> On 13 Sep 2007 11:39:28 -0400, Charlton Wilbur
>> <cwilbur@chromatico.net> wrote:
>>
>> >If Perlmonks is lacking in competent and knowledgeable posters, then
>> >perhaps it's time to reexamine their choice of interfaces.  And if
I can see that there's a political situation with Perlmonks; you must 
believe me when I say it doesn't concern me; me, your garden perl-learner in 
c.l.p.misc.

>> Well, of course if I see that many people agree with you and Abigail,
>> then I will stop doing so. Not that I do it *routinely* nor that I've
>> done that so many times...
>
> I agree with them. It's a lame thing to do, reposting other people's
> stuff (heh, from the guy who runs the perlfaq server :).
>
> Posting your own stuff is fine, or your own thoughts on someone else's
> ideas is fine, but just reposting something with no transformative
> effect is a pillar of copyright infringement, and it's rude to the
> author.
It serves as scaffolding to persons who are newer to the syntax.  As far as 
I'm concerned, I solved the posed problem instantaneously, because I never 
got the question within this 24-hr. period that ends in the middle of the 
day, Italian time.

-- 
Wade Ward
wade@zaxfuuq.net
'If they took all the "And it came to pass's" out
of the Book of Mormon, it would be a pamphlet.'
--Mark Twain 




------------------------------

Date: Sat, 15 Sep 2007 03:33:05 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <6PGdnZnAE_Z9O3bbnZ2dnUVZ_jednZ2d@comcast.com>




"brian d foy" <brian.d.foy@gmail.com> wrote in message 
news:140920070001324076%brian.d.foy@gmail.com...
> In article <ri8je3t355us9d8tbc37rdue2e6knqvbpu@4ax.com>, Michele Dondi
> <bik.mido@tiscalinet.it> wrote:
>
>> Honestly, I don't want to bother anyone. Do you think that
>> occasionally posting here interesting stuff from PM with a suitable
>> tag in the Subject for you and others to easily filter it out would be
>> so bad?
>
> How about posting original content of which you are the author? Talking
> about a problem that you think is interesting, expounding on it, and so
> on would be a lot better.
>
> Otherwise, let the original authors decide where to post their own work.
http://www.zaxfuuq.net/perl1.htm
-- 
Wade Ward
wade@zaxfuuq.net
'If they took all the "And it came to pass's" out
of the Book of Mormon, it would be a pamphlet.'
--Mark Twain 




------------------------------

Date: Sat, 15 Sep 2007 12:44:46 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <lrdne3p4gvaq88pa3h6pfds5l1gl87ohhv@4ax.com>

On Fri, 14 Sep 2007 21:55:34 -0700, "Wade Ward" <zaxfuuq@invalid.net>
wrote:

>> *PLONK*
>Tough crowd.

Funnily enough I have occasionally been "accused" of being one of the
toughest myself.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Sat, 15 Sep 2007 05:44:23 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <jp6dneKWdMk6WHbbnZ2dnUVZ_vumnZ2d@comcast.com>


"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
news:lrdne3p4gvaq88pa3h6pfds5l1gl87ohhv@4ax.com...
> On Fri, 14 Sep 2007 21:55:34 -0700, "Wade Ward" <zaxfuuq@invalid.net>
> wrote:
>
>>> *PLONK*
>>Tough crowd.
>
> Funnily enough I have occasionally been "accused" of being one of the
> toughest myself.
Did I merit beer up to my knees?  If not, I can see whence the criticism 
comes.
-- 
Wade Ward
wade@zaxfuuq.net
'If they took all the "And it came to pass's" out
of the Book of Mormon, it would be a pamphlet.'
--Mark Twain




------------------------------

Date: Sat, 15 Sep 2007 11:48:30 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Message-Id: <pan.2007.09.15.09.44.54@rtij.nl.invlalid>

On Thu, 13 Sep 2007 18:46:55 +0000, xhoster wrote:

> For my own effort, I perhaps cheated by using Inline C, and depending on
> the C representations of both strings being null terminated.

But s1 contains null characters, so this won't work.

M4


------------------------------

Date: Sat, 15 Sep 2007 11:14:32 +0200
From: "Bond" <Bond@james.bond>
Subject: checbox problem
Message-Id: <fcg7og$76s$1@ss408.t-com.hr>

How to select checkbox form perl with www::mechanize, what value is for
true?
I tray with OK, true, Yes, Selected, and get that is false value for button.

<form action="/pc/index.pl" method="post" name="payment" id="payment">
<input class="loginTextBox" type="checkbox" id="ok" name="user_agreed" />
<label for="ok">I agree</span></label>

Help me to solve this problem.

Thanks




------------------------------

Date: Sat, 15 Sep 2007 12:14:49 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: checbox problem
Message-Id: <slrnfengdr.sbi.tadmc@tadmc30.sbcglobal.net>

Bond <Bond@james.bond> wrote:
> How to select checkbox form perl with www::mechanize, what value is for
> true?

><input class="loginTextBox" type="checkbox" id="ok" name="user_agreed" />


   $mech->tick('user_agreed', 'on');


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Sat, 15 Sep 2007 08:54:26 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: checbox problem
Message-Id: <13enpr7r09dje44@corp.supernews.com>

On 09/15/2007 04:14 AM, Bond wrote:
> How to select checkbox form perl with www::mechanize, what value is for
> true?
> I tray with OK, true, Yes, Selected, and get that is false value for button.
> 
> <form action="/pc/index.pl" method="post" name="payment" id="payment">
> <input class="loginTextBox" type="checkbox" id="ok" name="user_agreed" />
> <label for="ok">I agree</span></label>
> 
> Help me to solve this problem.
> 
> Thanks
> 
> 

The documentation for WWW::Mechanize says to use the 'tick' method. If 
you installed the module using ActiveState, the documentation for that 
module should be in the ActiveState help menu system.




------------------------------

Date: Sat, 15 Sep 2007 09:17:35 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Displaying utf8 text in perl -d
Message-Id: <fcg7vf$14d3$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to

<lbova99@yahoo.com>], who wrote in article <1189807050.617329.307160@50g2000hsm.googlegroups.com>:
> binmode $DB::OUT, ':utf8';

Yes, as expected.

> Eureka!  Now the utf8 data is visible when I "p" or "x".  This is a
> great improvement.  However, now the utf8 literals in my code are
> mangled.  They display with some form of "^_" instead of displaying as
> "themselves".

Under debugger, the code is stored in special arrays, see the docs.
You need to find out in which format it is stored.  I expect that
internally (as accessible from C) it is stored in utf8 C strings; but
the code which translates these C strings to Perl strings does not
mark them with HAVE-UTF8 flag.

Please report,
Ilya

P.S.  You need something like

  print join q( ), map ord, split //, $string;

to get the understandable info.


------------------------------

Date: Sat, 15 Sep 2007 10:10:45 -0700
From:  ashishmundhara108@gmail.com
Subject: Get unlimited visitors to your website
Message-Id: <1189876245.330107.62280@50g2000hsm.googlegroups.com>

Is your website getting very less no. of visitors .If so, then post
your website to http://goodtolove.com to get unlimited visitors for
lifetime...No need to pay a penny.



------------------------------

Date: Sat, 15 Sep 2007 10:50:56 -0700
From: pauls <pauls@nospam.off>
Subject: how to remove parentheses from a line in a file - need help!
Message-Id: <LtKdnVEpJdBThnHbnZ2dnUVZ_gednZ2d@seanet.com>

Hi,
I have a line of text like this:

m1 (d g s b) en (w=wdnfing l=l as=1e-20 ad=1e-20 ps=1e-20 pd=1e-20)


I am reading-in  the file in using $_ and I tried to do the following 
(without success):

s/)//g;
s/)//g;

I also tried:

s')''g;
s'(''g;

Why do both of these attempts fail? And, could someone show me the right 
way (or one possible way) to get the job done?!

Thanks

P.


------------------------------

Date: Sat, 15 Sep 2007 11:34:56 +0200
From: Michal Nazarewicz <mina86@tlen.pl>
Subject: Re: menu replacing
Message-Id: <878x78ff0f.fsf@erwin.mina86.com>

> On Sep 14, 2:35 pm, jimmy <hugsa...@gmail.com> wrote:
>> this is what i intend to do there is a menu on about 25 lines inside
>> the tags
>>
>> <div id="menu"><!--This is the navigation menu-->
>>         -
>>         -
>>         -
>>         -
>>         -
>> <!-- End Navigation--></div>
>>
>> only the starting and endline lines (shown here) are constant thru all
>> the files in all the directories
>> now i believe these can be used as regular expressing and i can do a
>> search replace in all the files on all the lines inside these tags
>> with new lines i have

Brian McCauley <nobull67@gmail.com> writes:
> If you are happy to simply treat the files as plain (not HTML) this is
> easy. But it won't cope unless the file format is strictly controlled.
>
> while (<>) {
>    if (/<!-- End Navigation-->/) {
>       $in_menu = 0;
>    print unless $in_menu;
>    if ( /<!--This is the navigation menu-->/ ) {
>      print "First new line\n";
>      print "Second new line\n";
>      $in_menu = 1;
>  }

The code is missing some "}".  Here's fixed version with some more
possible modification examples:

#v+
my $in_menu = 0;
while (<>) {
    if ($in_menu) {
        if (/<!-- End Navigation-->/) {
            $in_menu = 0;
            print "First new line at the end\n";
            print "Second new line at the end\n";
        } else {
            next if /line you want to delete/;
            next if /another line you want to delete/;
            s/something you want to replace/with something else/;
        }
     } elsif (/<!--This is the navigation menu-->/) {
         $in_menu = 1;
         print;
         print "First new line\n";
         print "Second new line\n";
         next;
     }
     print;
}      
#v-

-- 
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86*tlen.pl>---<jid:mina86*chrome.pl>--ooO--(_)--Ooo--


------------------------------

Date: Sat, 15 Sep 2007 16:27:30 -0000
From:  nutsbreaker1@gmail.com
Subject: Need a guitar?
Message-Id: <1189873650.133698.164440@19g2000hsx.googlegroups.com>

Free guitars here!!!!!!

http://freeguitars.blogspot.com/



------------------------------

Date: Sat, 15 Sep 2007 09:53:46 -0700
From:  Killfile Victim #847238 <jwkizer@yahoo.com>
Subject: Re: Need a guitar?
Message-Id: <1189875226.543698.294670@r29g2000hsg.googlegroups.com>

On Sep 15, 12:27 pm, nutsbreak...@gmail.com wrote:
> Free guitars here!!!!!!
>
> http://freeguitars.blogspot.com/

Let me guess... NO STRINGS ATTATCHED?



------------------------------

Date: Sat, 15 Sep 2007 11:22:00 +0200
From: Michal Nazarewicz <mina86@tlen.pl>
Subject: Re: Oneliner problem with < and > in variable
Message-Id: <87d4wkfflz.fsf@erwin.mina86.com>

Ansim <antosim@gmail.com> writes:

> Hello,
>
> I have this oneliner
> $_PERL -ni -we 'BEGIN{@content='$_new_start'} if(/'$_start'/){s//
> @content/;print}else{print}' SMOinfo.xml

How about:

$_PERL -pi -we 'BEGIN{$from = shift @ARGV; $to = shift @ARGV; }
s/$from/$to/o;' "$_start" "$_new_start" SMOinfo.xml

-- 
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86*tlen.pl>---<jid:mina86*chrome.pl>--ooO--(_)--Ooo--


------------------------------

Date: Sat, 15 Sep 2007 13:04:49 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: parallel computing in perl?
Message-Id: <v0ene31868tdocebu44jvv16juok9or32e@4ax.com>

On Fri, 14 Sep 2007 07:27:12 -0700, Jie <jiehuang001@gmail.com> wrote:

>I think below would be the code to do it.
>I don't know if I used the right syntax to open a temporary file...
[snip]
>    open TEMP_FILE, tempfile();

Usual recommendations:

1. use lexical filehandles;
2. use three-args form of open();
3. check for success.

  open my $tempfile, '+>', tempfile or die badly;

I changed the mode open because I suppose that you want to create the
tempfile for writing and then read back stuff out of it. If you don't
need the file to have a name, or to know it, then you can avoid
File::Temp and let perl do it easily for you:

  open my $tempfile, '+>', undef or die badly;


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Sat, 15 Sep 2007 12:06:30 -0000
From:  loopology <wernbag@gmail.com>
Subject: strange behaviour with 'use open IN => ":byte"
Message-Id: <1189857990.470670.75470@19g2000hsx.googlegroups.com>

If I run this script:

#!/usr/bin/perl
use open IN  => ":byte";
use constant A => 1;

on a MacBook Pro (Intel)

With perl version 5.8.6 (the pre-installed)

I get this error:
Can't locate constant.pm in @INC (@INC contains: /sw/lib/perl5 /sw/lib/
perl5/dar
win /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/
Library/Perl/5
 .8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/
5.8.6 /Library
/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/
Library/Pe
rl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/
darwin-thread-m
ulti-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .)
at ./tst.pl
 line 3.

if I change the line to:
use open IN  => ":encoding(UTF16-BE)";
I get this error:
Unrecognized character \xE0 at /System/Library/Perl/5.8.6/constant.pm
line 1.

In both cases:
If I swap the lines, everything runs smoothly.

Anyone seen this behaviour?
What to do about it?

Thanks
Bernhard

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=darwin, osvers=8.0, archname=darwin-thread-multi-2level
    uname='darwin b19.apple.com 8.0 darwin kernel version 8.3.0: mon
oct 3 20:04
:04 pdt 2005; root:xnu-792.6.22.obj~2release_ppc power macintosh
powerpc '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags=-
Dman3ext=3
pm -Duseithreads -Duseshrplib'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=de
fine
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN -no-cpp-
precomp -fno-s
trict-aliasing -I/usr/local/include',
    optimize='-O3',
    cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-
cpp-precomp
 -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build
5363)', gccosand
vers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16

    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize
=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/usr/local/
lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true,
libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup -L/
usr/local/li
b'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_
CONTEXT
  Locally applied patches:
        23953 - fix for File::Path::rmtree CAN-2004-0452 security
issue
        33990 - fix for setuid perl security issues
        SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962
  Built under darwin
  Compiled at Nov  1 2006 17:07:31
  %ENV:
    PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
  @INC:
    /sw/lib/perl5
    /sw/lib/perl5/darwin
    /System/Library/Perl/5.8.6/darwin-thread-multi-2level
    /System/Library/Perl/5.8.6
    /Library/Perl/5.8.6/darwin-thread-multi-2level
    /Library/Perl/5.8.6
    /Library/Perl
    /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
    /Network/Library/Perl/5.8.6
    /Network/Library/Perl
    /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.8.6
    /Library/Perl/5.8.1
    .



------------------------------

Date: Sat, 15 Sep 2007 09:07:53 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: strange behaviour with 'use open IN => ":byte"
Message-Id: <13enprakk5g3246@corp.supernews.com>

On 09/15/2007 07:06 AM, loopology wrote:
> If I run this script:
> 
> #!/usr/bin/perl
> use open IN  => ":byte";
> use constant A => 1;
> 
> on a MacBook Pro (Intel)
> 
> With perl version 5.8.6 (the pre-installed)
> 
> I get this error:
> Can't locate constant.pm in @INC (@INC contains: /sw/lib/perl5 /sw/lib/
> perl5/dar
> win /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/
> Library/Perl/5
> ..8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/
> 5.8.6 /Library
> /Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/
> Library/Pe
> rl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/
> darwin-thread-m
> ulti-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .)
> at ./tst.pl
>  line 3.
> 
> if I change the line to:
> use open IN  => ":encoding(UTF16-BE)";
> I get this error:
> Unrecognized character \xE0 at /System/Library/Perl/5.8.6/constant.pm
> line 1.
> 
> In both cases:
> If I swap the lines, everything runs smoothly.
> 
> Anyone seen this behaviour?
> What to do about it?
> [...]

I'm able to reproduce this behavior on Debian Linux with Perl 5.8.4 and 
Perl 5.9.4.

Note, ":byte" is not correct. The correct layer is ":bytes"; however, 
Perl's reaction to the incorrect layer doesn't produce much clarity for 
the programmer.


------------------------------

Date: Sat, 15 Sep 2007 11:04:49 -0700
From:  nutsbreaker4@gmail.com
Subject: World's most popular traveling destinations
Message-Id: <1189879489.008351.66940@57g2000hsv.googlegroups.com>

http://world-traveling-destinations.blogspot.com/



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 853
**************************************


home help back first fref pref prev next nref lref last post