[30951] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2196 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 9 18:09:46 2009

Date: Mon, 9 Feb 2009 15:09:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 9 Feb 2009     Volume: 11 Number: 2196

Today's topics:
    Re: automating a perl installation on a cluster (or usi <nospam@nospam.invalid>
    Re: Expand Shortended CIDR notation? <antgoodlife@gmail.com>
    Re: File handle to "in memory" file <uri@stemsystems.com>
    Re: good email parser ?? <jack_posemsky@yahoo.com>
    Re: how can i convert my perl script to be a perl modul <tzz@lifelogs.com>
    Re: parse newline <m@rtij.nl.invlalid>
    Re: parse newline <m@rtij.nl.invlalid>
    Re: parse newline <tzz@lifelogs.com>
        perl script open/save for voiceMessage problems paul.hopgood@deathnotify.com
    Re: perl script open/save for voiceMessage problems <smallpond@juno.com>
    Re: perl script open/save for voiceMessage problems <glex_no-spam@qwest-spam-no.invalid>
    Re: programming by evolution? <xahlee@gmail.com>
        should be simple hendedav@gmail.com
    Re: should be simple hendedav@gmail.com
    Re: should be simple <jurgenex@hotmail.com>
        Using vec with very large strings xhoster@gmail.com
    Re: Using vec with very large strings <uri@stemsystems.com>
    Re: Using vec with very large strings <ben@morrow.me.uk>
    Re: win32 perl compiling problem <sisyphus359@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 9 Feb 2009 17:32:50 +0000 (UTC)
From: Rahul <nospam@nospam.invalid>
Subject: Re: automating a perl installation on a cluster (or using non-standard nfs paths)
Message-Id: <Xns9BAD75759332A6650A1FC0D7811DDBC81@85.214.105.209>

Ben Morrow <ben@morrow.me.uk> wrote in news:edq166-a0h.ln1
@osiris.mauzo.dyndns.org:

> Recentish versions of MakeMaker (since 6.31) have an INSTALL_BASE
> parameter which actually does the right thing: INSTALL_BASE=/usr/local
> is probably what you want in this case. PREFIX is rather weird, in that
> it tries to emulate the structure of your system perl installation,
> rather than using a normal layout. 
> 

I tried installing ExtUtils-MakeMaker-6.48, the first step in all my 
dependancies. But I get this error when I try "make" that I can't really 
figure out.

[root@star255 ExtUtils-MakeMaker-6.48]# perl Makefile.PL 
INSTALL_BASE=/usr/local 
Using included version of ExtUtils::Command (1.14) as it is newer than the 
installed version (1.09).
Writing Makefile for ExtUtils::MakeMaker

[root@star255 ExtUtils-MakeMaker-6.48]# make
make: *** No rule to make target `/usr/lib64/perl5/5.8.8/x86_64-linux-
thread-multi/CORE/config.h', needed by `Makefile'.  Stop.


What am I doing wrong here?

-- 
Rahul


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

Date: Mon, 9 Feb 2009 08:36:13 -0800 (PST)
From: Antgoodlife <antgoodlife@gmail.com>
Subject: Re: Expand Shortended CIDR notation?
Message-Id: <aedd3b95-41c7-4583-b2a4-c9e4225bf591@l16g2000yqo.googlegroups.com>

On Feb 9, 11:08=A0am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> Antgoodlife wrote:
> > I'm aware there are a few CIDR modules, however, can any of them
> > expand short CIDR notation? =A0
>
> Why not look at the documentation for the ones you found? It
> should be easy to tell.
>
> =A0>Some of our unix/freebsd boxes print
>
>
>
> > routes in this annoying shortened format and I'd like to expand them
> > for various reasons... =A0(I already written scripts that handle the
> > destination format so I'd like to continue using them once converted
> > to a more familiar format...
>
> > For example :
> > 10/8
> > =A0 =A0Should be re-written as 10.0.0.0 255.0.0.0 =A0 (I'd like both th=
e
> > network and mask written like that)
>
> > Likewise
> > 192.168.50/19
> > =A0 =A0needs to be re-written as 192.168.50.0 255.255.224.0
>
> > I'm slightly familiar with the PACK and UNPACK but need some
> > assistance here.. alternatively some CIDR module might be better
> > suited here. =A0Thanks in advance.
>
> > CIDR is great.. but not when I'm trying to use the expanded formats in
> > other scripts...
>
> See: Net::Netmask

Thank you very much... I missed all of the Netmask module formats...
it can in fact do just this and you've correctly answered my
question... (By the way, I seriously prefer answers like this than
example code.. it forces the OP to learn rather then act)



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

Date: Mon, 09 Feb 2009 14:01:15 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: File handle to "in memory" file
Message-Id: <x7vdrjmo3o.fsf@mail.sysarch.com>

>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:

  FS> Uri Guttman wrote:
  >>>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:
  >> 
  FS> our $Stderr;
  >> no need for out as long as only this module needs to see $Stderr

  FS> Okay, but this is not relevant, I think.

not relevant to the thread but it is better code. no need to expose the
var as a global. my keeps it private to the module.

  FS> [Class for STDERR redirection]

  >> and this is important? and you only have one string var but you asked to
  >> find out WHICH var was opened for a handle. we showed you to how to
  >> determine that the handle is attached to a scalar.

  FS> From the class' point of view someone else could have opend the
  FS> filehandle as an in memory file. The class should redirect in this
  FS> case too.  The suggested test is not sufficient.

who else could or want to do that? modules tend to not manage stderr,
they leave that to the top level program. it is too dangerous to manage
global resources in a module as some other module may conflict. i think
you are worrying too much about this. if you use another module and it
deals with stderr somehow, then you deal with it. in fact this implies
that you should make your module have an option to disable this feature
so someone else could use your code and not need it.

  >> but how could it be connected to any other variable in your code? you
  >> control it.

  FS> Ideally a class is a piece of code that works properly without
  FS> assumptions about the program it is used in.

and you assume that if your module is used then it will always do this
stderr thing. make it an option and just do it when enabled. let the top
level code decide whether to enable it or not. checking to see if the
var is used by some other module is silly. what if that module is loaded
after yours and overrides your stuff? you can't predict this so letting
top level code handle the decision and offering this OPTIONAL service is
the best way.

  >> if you really need more control use a tied handle (which can be attached
  >> to any object reference including a hash). store in that hash the
  >> reference as well and make a method that accesses it. but i still don't
  >> see the need to know which var is attached to the handle if you only
  >> have one global handle/var.

  FS> You missed the point. I can't remember the state by myself, because
  FS> STDERR may change during program execution (under CGI::SpeedyCGI STDERR is
  FS> reopened with every CGI call).

blech. you can always retie it later. and tied is easier to detect.

  >> there are other ways to trap stderr too. assuming you use warn (not
  >> print STDERR) you can use the warning handler in %SIG and then easily
  >> append all warn output to some var or a log file.

  FS> I know this (in my opinon: ugly) concept. I need to capture
  FS> the whole STDERR output.

blech again.

  FS> I use the class in (persistent) CGIs. The class captures STDERR during
  FS> execution and the program puts the output into the HTTP response at
  FS> the appropriate point. It works well. The limitation in Perls
  FS> filehandle API is not a real problem for me: I simply close STDERR
  FS> unconditionally and accept the consequence that output between
  FS> multiple constructor calls is lost.

and that is acceptable vs my suggestions? i think you have painted
yourself into a deep corner. this is definitely an xy problem now. your
bigger problem is solvable without much pain but you have already
chosen a path (and sticking to it) which has much more pain.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Mon, 9 Feb 2009 13:51:38 -0800 (PST)
From: Jack <jack_posemsky@yahoo.com>
Subject: Re: good email parser ??
Message-Id: <1770638c-53d5-4b9b-9057-d664eb9f33b7@n33g2000pri.googlegroups.com>

On Feb 8, 12:08=A0pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2009-02-07 23:59, Jack <jack_posem...@yahoo.com> wrote:
>
> > Hi I havent had any luck with the CPAN email modules, I just want to
> > parse multipart and mime and base64, with all the varieties of email
> > files out there, these modules just dont work...
>
> MIME::Parser works for me. It is a bit slow and tends to use ridiculuous
> amounts of memory if you want to avoid temporary files, but I have yet
> to find a (syntactically correct) email which can't parse.
>
> =A0 =A0 =A0 =A0 hp

Thanks Peter for the posting.. can you provide some guidance then.. I
tried the below code and figured the skeleton would report the base64
image attachments in a MIME message, but isnt picking it up.  I need
to be able to deal with text body, base64 body, and image attachments,
and want to parse them out correctly.  I can do the base64 decoding,
etc. - how do I accomplish this with MIME::Parser ??

Code:
use MIME::Parser;

if (@ARGV[0] eq undef) {
   $filename1=3D"no dest filename" ;
} else {
   $filename1=3D@ARGV[0];
}

### Create a new parser object:
    my $parser =3D new MIME::Parser;

    ### Tell it where to put things:
    $parser->output_under("e:\\tmp");

    ### Parse an input filehandle:
     $entity =3D $parser->parse($filename1);

    ### Congratulations: you now have a (possibly multipart) MIME
entity!
    $entity->dump_skeleton;

####HERES THE OUTPUT
Content-type: text/plain
Effective-type: text/plain
Content-encoding: 7bit
Body-location: (IN CORE)
Body-size: 0
--

####
It appears to not picking up this from the email itself -
Content-Type: image/jpeg; name=3D"cardamage1.jpg"
Content-Disposition: attachment; filename=3D"cardamage1.jpg"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fqzhlhly0


###
Also I tried to build my own parser based on the "boundary" definition
but as you can see from the below example, its not clear why I have >
1 boundary !

Date: Sun, 24 Aug 2008 06:46:48 -0700
From: "Ben Brewster" <benwbrewster@gmail.com>
To: post@postio.org
Subject: car for sale two images
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary=3D"----=3D_Part_13503_152406.1219585608169"

------=3D_Part_13503_152406.1219585608169
Content-Type: multipart/alternative;
	boundary=3D"----=3D_Part_13504_19292996.1219585608169"

------=3D_Part_13504_19292996.1219585608169
Content-Type: text/plain; charset=3DISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi


------=3D_Part_13504_19292996.1219585608169
Content-Type: text/html; charset=3DISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div dir=3D"ltr"></div>

------=3D_Part_13504_19292996.1219585608169--

------=3D_Part_13503_152406.1219585608169
Content-Type: image/jpeg; name=3Dmasertione.jpg
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fk9pr8s20
Content-Disposition: attachment; filename=3Dmasertione.jpg


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

Date: Mon, 09 Feb 2009 14:58:47 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: how can i convert my perl script to be a perl module?
Message-Id: <86r627mins.fsf@lifelogs.com>

On Sun, 08 Feb 2009 09:27:48 -0800 Jürgen Exner <jurgenex@hotmail.com> wrote: 

JE> "georg.heiss@gmx.de" <georg.heiss@gmx.de> wrote:
>> how can i convert my perl script to be a perl module? 

JE> One way: you could follow the suggestions in the FAQ.

JE> perldoc -q module

JE> 	"How do I create a module?"

That doesn't cover the specific case of an existing Perl script.  Is
there something like that in the documentation?  I don't recall it.

In any case, my advice is: avoid globals, pass all your state variables,
and you should be able to make all your script's subroutines exportable
in a namespace.  If you're looking for OOP (and sometimes you must), you
have to examine your script's particular use cases and how you can
abstract state into an object hierarchy.

Ted


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

Date: Mon, 9 Feb 2009 21:27:58 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: parse newline
Message-Id: <pan.2009.02.09.20.27.58@rtij.nl.invlalid>

On Sun, 08 Feb 2009 23:36:39 +0800, ela wrote:


>> Something like:
>>
>> chomp;
>> s/\x0d$//;
>>
>> Should always do the trick. If not, you have something very strange
>> going on.
>>
>>
> Have already tried that before and it doesn't solve...

Funny, did you try hexdumping the files?

M4


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

Date: Mon, 9 Feb 2009 21:29:14 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: parse newline
Message-Id: <pan.2009.02.09.20.29.14@rtij.nl.invlalid>

On Sun, 08 Feb 2009 23:36:39 +0800, ela wrote:


>> Something like:
>>
>> chomp;
>> s/\x0d$//;
>>
>> Should always do the trick. If not, you have something very strange
>> going on.
>>
>>
> Have already tried that before and it doesn't solve...

BTW, I did mean both statements and in that order.

M4


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

Date: Mon, 09 Feb 2009 14:43:47 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: parse newline
Message-Id: <86vdrjmjcs.fsf@lifelogs.com>

On Sun, 8 Feb 2009 23:51:54 +0800 "ela" <ela@yantai.org> wrote: 

e> Well I've tried :

e>            chop $identiy;
e>            chomp ($identiy);
e>             chop $identiy;
e>            $identity =~ s/\x0d$//;

e> All fail. 

Assuming your text is in FILE.TXT:

od -t u1 -t a FILE.txt

What does your text show for the lines that are not correctly processed
by your program?

Ted


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

Date: Mon, 9 Feb 2009 11:43:25 -0800 (PST)
From: paul.hopgood@deathnotify.com
Subject: perl script open/save for voiceMessage problems
Message-Id: <6f91d24b-3453-4334-bde3-0bf8f858f99f@z6g2000pre.googlegroups.com>

I am trying to save a voiceMessage from a voiceXML script transfered
via a BeVocal vxml script to a perl program located in a Yahoo web
server that supports the perl language. I don't know exactly what path
I need to name my file.My test.wav file does not create. Nothing
happens. Any suggestions would be helpful.

Here is my recording.pl file and what is currently coded in it:

#!/usr/bin/perl -w

use CGI qw(:standard);
$|++;

my $pathToRecordings='http://www.deathnotify.com/recordings';
my $newRecording = 'test.wav';

print header;

 open (SAVE, "> $deathnotify.com/recordings");
   binmode(SAVE);
   while (read(param('voiceMessage'),$data,1024))
      { print SAVE $data; }
 close(SAVE);

# CONFIRM RECORDING WAS SAVED

print <<INSERT_VXML;
<?xml version="1.0"?>

<vxml version="1.0">
<form id="acceptInput">
 <block>
   Input was $ENV{'CONTENT_LENGTH'} bytes in length.
   The recording was processed and saved.
  <return/>
 </block>
</form>
</vxml>

INSERT_VXML


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

Date: Mon, 9 Feb 2009 13:30:00 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: perl script open/save for voiceMessage problems
Message-Id: <36332c0e-9eea-4895-b180-f35d0202e07b@t13g2000yqc.googlegroups.com>

On Feb 9, 2:43 pm, paul.hopg...@deathnotify.com wrote:
> I am trying to save a voiceMessage from a voiceXML script transfered
> via a BeVocal vxml script to a perl program located in a Yahoo web
> server that supports the perl language. I don't know exactly what path
> I need to name my file.My test.wav file does not create. Nothing
> happens. Any suggestions would be helpful.
>
> Here is my recording.pl file and what is currently coded in it:
>
> #!/usr/bin/perl -w
>
> use CGI qw(:standard);
> $|++;
>
> my $pathToRecordings='http://www.deathnotify.com/recordings';
> my $newRecording = 'test.wav';
>
> print header;
>
>  open (SAVE, "> $deathnotify.com/recordings");
>    binmode(SAVE);
>    while (read(param('voiceMessage'),$data,1024))
>       { print SAVE $data; }
>  close(SAVE);
>
> # CONFIRM RECORDING WAS SAVED
>
> print <<INSERT_VXML;
> <?xml version="1.0"?>
>
> <vxml version="1.0">
> <form id="acceptInput">
>  <block>
>    Input was $ENV{'CONTENT_LENGTH'} bytes in length.
>    The recording was processed and saved.
>   <return/>
>  </block>
> </form>
> </vxml>
>
> INSERT_VXML


This is going to surprise you.  open, read and close all
return something: namely, the answer to your question.



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

Date: Mon, 09 Feb 2009 16:14:48 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: perl script open/save for voiceMessage problems
Message-Id: <4990aad8$0$87079$815e3792@news.qwest.net>

paul.hopgood@deathnotify.com wrote:
> I am trying to save a voiceMessage from a voiceXML script transfered
> via a BeVocal vxml script to a perl program located in a Yahoo web
> server that supports the perl language. I don't know exactly what path
> I need to name my file.My test.wav file does not create. Nothing
> happens. Any suggestions would be helpful.
> 
> Here is my recording.pl file and what is currently coded in it:
> 
> #!/usr/bin/perl -w
> 
> use CGI qw(:standard);

forgot

use strict;

> $|++;
> 
> my $pathToRecordings='http://www.deathnotify.com/recordings';
> my $newRecording = 'test.wav';

You never use either of these variables.

> 
> print header;
> 
>  open (SAVE, "> $deathnotify.com/recordings");

Where is $deathnotify defined?
What if open() fails?

That's why you 'use strict'.

>    binmode(SAVE);
>    while (read(param('voiceMessage'),$data,1024))
>       { print SAVE $data; }
>  close(SAVE);
> 
> # CONFIRM RECORDING WAS SAVED
> 
> print <<INSERT_VXML;
> <?xml version="1.0"?>
> 
> <vxml version="1.0">
> <form id="acceptInput">
>  <block>
>    Input was $ENV{'CONTENT_LENGTH'} bytes in length.
>    The recording was processed and saved.
>   <return/>
>  </block>
> </form>
> </vxml>
> 
> INSERT_VXML


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

Date: Mon, 9 Feb 2009 08:55:35 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: Re: programming by evolution?
Message-Id: <b0f033d9-62c3-487b-a869-cef5664b0ba5@r15g2000prh.googlegroups.com>

Xah Lee wrote:
> ...
> if you want software engineering books, i suggest try some books that
> are based on statistical survey, as opposed to some dignitary's
> =E2=80=9Copinion=E2=80=9D or current fashion & trends that comes with a j=
argon. These
> type of books are a dime a dozen, every year, they come and go. The
> stastical survey approach takes major understaking and cost. The
> opinion type any motherfucking =E2=80=9Cguru=E2=80=9D can write. e.g. Pau=
l Graham has
> you buy into certain concept of =E2=80=9Chackers=E2=80=9D fucker and clai=
m they are
> like =E2=80=9Cpainters=E2=80=9D. Certain Gabriel wants you to believe in =
poetry and C
> is the last language. (see Book Review: Patterns of
> Software
> http://xahlee.org/PageTwo_dir/Personal_dir/bookReviewRichardGabriel.html
> ) et al. Certain Gosling wants you to believe Java is the last lang on
> earth that'll wipe out Microsoft (circa 1998).
>
> ...
>
> ... what society overwhelmingly asks for is snake oil. Of course, the
> snake oil has the most impressive names =E2=80=94otherwise you would be
> selling nothing=E2=80=94 like =E2=80=9CStructured Analysis and Design=E2=
=80=9D, =E2=80=9CSoftware
> Engineering=E2=80=9D, =E2=80=9CMaturity Models=E2=80=9D, =E2=80=9CManagem=
ent Information Systems=E2=80=9D,
> =E2=80=9CIntegrated Project Support Environments=E2=80=9D =E2=80=9CObject=
 Orientation=E2=80=9D and
> =E2=80=9CBusiness Process Re-engineering=E2=80=9D (the latter three being=
 known as
> IPSE, OO and BPR, respectively).=E2=80=9D =E2=80=94 Edsger W Dijkstra (19=
30-2002), in
> EWD 1175: The strengths of the academic enterprise.
>
> you want to be a good programer? Study math, the math of programing,
> and master the langs and protocols and tools you use. You want to
> climb the tech industry ladder? get better at people, learn politics.
> You want to be rich? Study business. Chances are, you are a coding
> geek, and at heart you dna is not geared to be interested in politics
> or business, and you'll never be rich or big ceo just because of that.
>
> See also:
> =E2=80=A2 Why Software Suck
>  http://xahlee.org/UnixResource_dir/writ/why_software_suck.html
>
> looking at the eXtreme Programing fuckheads's traffic history:
> http://groups.google.com/group/comp.software.extreme-programming/about
>
> for those who are not aware, it was one of the snake oil wildly
> popular in around 2001.

Today, i happened to run across a blog on the eXtreme Programing FUCK.

http://www.yosefk.com/blog/extreme-programming-explained.html

Great article!

  Xah
=E2=88=91 http://xahlee.org/

=E2=98=84


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

Date: Mon, 9 Feb 2009 12:05:35 -0800 (PST)
From: hendedav@gmail.com
Subject: should be simple
Message-Id: <307392ca-1011-4a7b-afce-5f3a4be47ae3@z1g2000yqn.googlegroups.com>

Gang,

     I am trying to add single quotes to the value stored in a scalar,
but it will not let me.  Is this breaking a rule of some sort?  Please
let me know how I can get around this.

Thanks,
Dave


$temp = '1,2,3,4';
$vals = 'asdf';
$vals .= "'$temp',";
system "echo 'vals is: -$vals-' > /tmp/debug.txt";



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

Date: Mon, 9 Feb 2009 12:20:21 -0800 (PST)
From: hendedav@gmail.com
Subject: Re: should be simple
Message-Id: <5ed7fe44-b59d-4793-8ed5-b32584ee9fb7@x9g2000yqk.googlegroups.com>

On Feb 9, 3:05=A0pm, hende...@gmail.com wrote:
> Gang,
>
> =A0 =A0 =A0I am trying to add single quotes to the value stored in a scal=
ar,
> but it will not let me. =A0Is this breaking a rule of some sort? =A0Pleas=
e
> let me know how I can get around this.
>
> Thanks,
> Dave
>
> $temp =3D '1,2,3,4';
> $vals =3D 'asdf';
> $vals .=3D "'$temp',";
> system "echo 'vals is: -$vals-' > /tmp/debug.txt";

Never mind.  The issue was with the system call using single quotes.
Issue resolved.


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

Date: Mon, 09 Feb 2009 12:35:02 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: should be simple
Message-Id: <ld41p41h03hjm4084gdefvroa260qo32g2@4ax.com>

[Please put the subject of your article into the Subject of your
article]
hendedav@gmail.com wrote:
>     I am trying to add single quotes to the value stored in a scalar,
>but it will not let me.  Is this breaking a rule of some sort?  Please
>let me know how I can get around this.
>
>$temp = '1,2,3,4';
>$vals = 'asdf';
>$vals .= "'$temp',";
>system "echo 'vals is: -$vals-' > /tmp/debug.txt";

If you replace the last line with a simple
	print $vals;
then you will notice that $vals does contain the desired single quotes
	asdf'1,2,3,4',
which of course can be print()ed into a file directly, too.

It is your wierd system() call that messes things up for you because the
arguments are passed to your shell and who knows what your shell is
doing to those quotes. You may want to ask in NG that deals with your
command shell.

jue


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

Date: 09 Feb 2009 17:25:29 GMT
From: xhoster@gmail.com
Subject: Using vec with very large strings
Message-Id: <20090209123013.013$nN@newsreader.com>

I'm trying to use a large bitmap, using vec.  It seems that vec limits
itself to (signed) 32 bit integers as the index, even though I am on a 64
bit machine and use64bitall=define.

This is perl, v5.10.0 built for x86_64-linux-thread-multi

$ perl -le '(vec $x, (2**31), 1)=1;'
Negative offset to vec in lvalue context at -e line 1.

Is there some magic flag I can set and recompile to get 64-bit indexes for
vec?

Thanks,

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Mon, 09 Feb 2009 14:05:11 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Using vec with very large strings
Message-Id: <x7r627mnx4.fsf@mail.sysarch.com>

>>>>> "x" == xhoster  <xhoster@gmail.com> writes:

  x> I'm trying to use a large bitmap, using vec.  It seems that vec limits
  x> itself to (signed) 32 bit integers as the index, even though I am on a 64
  x> bit machine and use64bitall=define.

  x> This is perl, v5.10.0 built for x86_64-linux-thread-multi

  x> $ perl -le '(vec $x, (2**31), 1)=1;'
  x> Negative offset to vec in lvalue context at -e line 1.

  x> Is there some magic flag I can set and recompile to get 64-bit
  x> indexes for vec?

a clunky workaround would be to keep a longer string. then take take the
index and mod/divide it by 2**32  (or shift and mask) and lookup the
2**32 bit substring with substr (lvalue) and then vec that. it is only a
couple of lines of extra code. an array of 2**32 bit strings would work
too.

you may need to use 2**31 bits instead to skip the negative index
problem.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Mon, 9 Feb 2009 20:14:52 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Using vec with very large strings
Message-Id: <sef666-0c3.ln1@osiris.mauzo.dyndns.org>


Quoth xhoster@gmail.com:
> I'm trying to use a large bitmap, using vec.  It seems that vec limits
> itself to (signed) 32 bit integers as the index, even though I am on a 64
> bit machine and use64bitall=define.
> 
> This is perl, v5.10.0 built for x86_64-linux-thread-multi
> 
> $ perl -le '(vec $x, (2**31), 1)=1;'
> Negative offset to vec in lvalue context at -e line 1.
> 
> Is there some magic flag I can set and recompile to get 64-bit indexes for
> vec?

No, there isn't. I'd call this a bug, myself: there three different
types used for vec's OFFSET and BITS. First pp_vec has

    register const IV size   = POPi;
    register const IV offset = POPi;

which should give you 64bit (signed) values on your machine. Then, if
it's an lvalue vec(), they are stored in struct xpvlv as

    STRLEN xlv_targoff;
    STRLEN xlv_targlen;

where STRLEN comes out as size_t, which should again be 64bit (unsigned,
now) on your system. Then the actual getting and setting are done by
Perl_do_vec{get,set} in doop.c, both of which use I32 for both
arguments. I can't see any good reason for these not to be IVs again:
you might want to ask p5p.

Ben



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

Date: Mon, 9 Feb 2009 14:14:29 -0800 (PST)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: win32 perl compiling problem
Message-Id: <09e81cfc-e4e6-408d-bfa5-f4549a9e8a81@t39g2000prh.googlegroups.com>

On Feb 10, 1:11=A0am, "Thomas Steinbach" <steinb...@gmx-topmail.de>
wrote:

>
> What else can I do and how can I "debug" this error?

There were initially some problems with Vista and MinGW, and many of
those problems were fixed when I installed Vista Service Pack 1. So,
if you haven't already, I would try installing SP1. (Note that Windows
Update doesn't automatically install SP1 for you - you have to install
it yourself.) I don't know if that's going to help. By the time SP1
arrived, MinGW had been pretty well patched up to work with Vista -
but if you've got one of the earlier versions of 3.4.5, installing SP1
may be the solution.

Or try updating to the latest MinGW components - gcc-3.4.5-20060117-3,
GNU binutils-2.19.1, w32api-3.13, and mingwrt-3.15.2 from
http://sourceforge.net/project/showfiles.php?group_id=3D2435 . (Just
unpack them over the top of your existing installation.)

Of course, now that I've got SP1, I can no longer check up on any of
those original MinGW/Vista issues.

Other than that, I would raise the issue on p5p - where you'll get
some assistance from people who are both passionate and knowledgeable
as regards building perl with MingW. It *should* be trivial to build
perl with MinGW on Windows (including Vista).

Cheers,
Rob


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

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 2196
***************************************


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