[28359] in Perl-Users-Digest
Perl-Users Digest, Issue: 9723 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 14 03:05:42 2006
Date: Thu, 14 Sep 2006 00:05:05 -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 Thu, 14 Sep 2006 Volume: 10 Number: 9723
Today's topics:
Re: Boolean Regexp with perlre <abigail@abigail.be>
Re: Boolean Regexp with perlre <xicheng@gmail.com>
Re: localtime is now wrong after server change anno4000@radom.zrz.tu-berlin.de
Re: Maximum number of sockets <sisyphus1@nomail.afraid.org>
new CPAN modules on Thu Sep 14 2006 (Randal Schwartz)
perlembed reentrancy <dlamber45@comcast.net>
Replace a line <vedpsingh@gmail.com>
Re: Replace a line <aukjan@vanbelkum.no.spam.nl>
Re: Replace a line <klaus03@gmail.com>
Re: String buffer instead of file handle? <danparker276@yahoo.com>
Re: String buffer instead of file handle? <noreply@invalid.net>
Re: String buffer instead of file handle? <tadmc@augustmail.com>
Re: String buffer instead of file handle? <mumia.w.18.spam+nospam.usenet@earthlink.net>
Re: Taint and memory usage anno4000@radom.zrz.tu-berlin.de
Re: Taint and memory usage <klaus03@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Sep 2006 00:12:33 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Boolean Regexp with perlre
Message-Id: <slrnegh7jh.r0.abigail@alexandra.abigail.be>
A. Sinan Unur (1usa@llenroc.ude.invalid) wrote on MMMMDCCLXI September
MCMXCIII in <URL:news:Xns983D90B46BFC6asu1cornelledu@127.0.0.1>:
:) Kevin Crosbie <caoimhinocrosbai_at@yahoo.com> wrote in news:45083f01$0
:) $19201$88260bb3@news.teranews.com:
:)
:) > I'm not sure if this is appropriate for this group, it's related to
:) > perlre rather than perl,
:)
:) It all depends on what you mean perlre. If you referring to regular
:) expressions as implemented in Perl, then it is the right group. However,
:) if somehow you are referring to some library that implements a regular
:) expression facility similar to Perl's, it is probably not.
:)
:) > if so, apologies and I'd appreciate a pointer
:) > to the right group.
:)
:) Don't know (see above).
:)
:) > I'm trying to find out if this is possible before I embark upon
:) > implementing a solution to my problem.
:) >
:) > I have a string with comma separated tags:
:) > "a, b, c, d, e, f"
:) >
:) > It's rather easy to write something to express a boolean OR:
:) > a OR b OR c = (^|,(\s)+)(a|b|c)[,$]
:)
:) Wait a second. That is not a valid expression!
:)
:) #!/usr/bin/perl
:)
:) use strict;
:) use warnings;
:)
:) my $s = 'a,b,c';
:)
:) if ($s =~ /(^|,(\s)+)(a|b|c)[,$]/) {
:) print "matched\n";
:) }
:)
:) D:\UseNet\clpmisc> t66
:) Unmatched [ in regex; marked by <-- HERE in m/(^|,(\s)+)(a|b|c)[ <--
:) HERE ,5.008008/ at D:\UseNet\clpmisc\t66.pl line 8.
:)
:) > What I would like to know is if there is a way to express AND or NOT:
:) > 1. (a OR b) AND c
:) > 2. (a OR b) AND NOT c
:) > 3. (a OR b) AND NOT (c OR d)
:)
:) It is more efficient to write
:)
:) if ( /a/ or /b/ or /c/ ) { ... }
:)
:) than to write
:)
:) if ( /a|b|c/ ) { ... }
:)
:) > I imagine there is no nice way to do this without doing something like
:) > writing out your AND clause before and after whatever OR clause you
:) > are using, which would become really messy for more complicated
:) > expressions,
:)
:) I am sure there is way of writing a really complicated, hard-to-read,
:) and inefficient regex one can write to do what you want, but it is not
:) worth the effort.
:)
:) There is a reason Perl has logical operators.
Now you are assuming you can use logical operators; it's more efficient
(usually) if you can, but you cannot always. Perhaps you have to
supply a regex as a parameter - one usually cannot provide an expression
instead.
Some ways of tackling the given questions (none tested):
(a OR b) AND c:
/^(?=.*c).*(a|b)/
/^(?:(?!a|b|c).)*(?:(?:a|b)(?:(?!c).*)c|c(?:(?!a|b).)*(?:a|b))/
(a OR b) AND NOT c
/^(?!.*c).*(a|b)/
/^(?:(?!a|b|c).)*(?:a|b)(?:(?!c).*)$/
(a OR b) AND NOT (c OR d)
As above, just replace each 'c' with (?:c|d)
Abigail
Abigail
--
$=-=4*++$|;{print$"x--$==>"\@\x7Fy~*kde~box*Zoxf*Bkiaox \r"
^
$/x24if!select$,,$,,$,,join+q=.==>$^W=>$|;$=&&redo}sleep$|;
------------------------------
Date: 13 Sep 2006 17:48:43 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: Boolean Regexp with perlre
Message-Id: <1158194923.221110.263890@b28g2000cwb.googlegroups.com>
Kevin Crosbie wrote:
> Hi,
>
> I'm not sure if this is appropriate for this group, it's related to
> perlre rather than perl, if so, apologies and I'd appreciate a pointer
> to the right group.
>
> I'm trying to find out if this is possible before I embark upon
> implementing a solution to my problem.
>
> I have a string with comma separated tags:
> "a, b, c, d, e, f"
>
> It's rather easy to write something to express a boolean OR:
> a OR b OR c = (^|,(\s)+)(a|b|c)[,$]
>
> What I would like to know is if there is a way to express AND or NOT:
If you want to test the whole string instead of its sub-strings, then
> 1. (a OR b) AND c
^(?=.*(a|b))(?=.*c)
> 2. (a OR b) AND NOT c
^(?=.*(a|b))(?!.*c)
> 3. (a OR b) AND NOT (c OR d)
^(?=.*(a|b))(?!.*(c|d))
Assumed your a,b,c,d are strings instead of chars, otherwise change
(a|b) to [ab]. you may also want to change (a|b) to (?:a|b) for
efficiency. do the similar thing to (c|d).
Regards,
Xicheng
------------------------------
Date: 13 Sep 2006 22:45:33 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: localtime is now wrong after server change
Message-Id: <4mrg0dF7i26lU2@news.dfncis.de>
<anno4000@radom.zrz.tu-berlin.de> wrote in comp.lang.perl.misc:
> Jason <jwcarlton@gmail.com> wrote in comp.lang.perl.misc:
> > > "We" used to be helpful?
> > >
> > > You have never once given help to anyone on CLPM. Considering your
> > > coding skills that is a good thing.
>
> [...]
>
> > Yes, I used to be a regular in this NG. ...
> > I posted under a different name;
>
> It would be very easy to name that name. Until you do I don't believe
> you.
[snip]
Sorry, people. I should have recognized that clown earlier and ignored
him. My bozometer needs calibration.
Anno
------------------------------
Date: Thu, 14 Sep 2006 09:37:45 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Maximum number of sockets
Message-Id: <45089738$0$5110$afc38c87@news.optusnet.com.au>
"A Ma" <angusma@attglobal.net> wrote in message
.
.
> perlhost.h:1838: error: invalid conversion from `void*' to `HWND__*'
> dmake: Error code 129, while making 'perllib.o'
>
ActiveState have patched that file (apparently in a way that breaks MinGW
:-)
To get it to build, the exact change I made was to replace:
w32_pseudo_child_message_hwnds[w32_num_pseudo_children] =
(w32_message_hwnd == NULL) ? NULL : INVALID_HANDLE_VALUE;
with:
if (w32_message_hwnd == NULL)
w32_pseudo_child_message_hwnds[w32_num_pseudo_children] = NULL;
else w32_pseudo_child_message_hwnds[w32_num_pseudo_children] =
(HWND__*)INVALID_HANDLE_VALUE;
but it's probably easier to simply replace:
(w32_message_hwnd == NULL) ? NULL : INVALID_HANDLE_VALUE;
with:
(w32_message_hwnd == NULL) ? NULL : (HWND__*)INVALID_HANDLE_VALUE;
After that change, 'dmake' proceeded fine (though I haven't yet run 'dmake
test').
I hope the above change to perlhost.h is correct .... if you prefer to grab
the 5.8.8 source from www.perl.org, then you should be able to build it
without having to make *any* amendments to *any* files :-)
(I'll submit a bug report about this to ActiveState.)
Cheers,
Rob
------------------------------
Date: Thu, 14 Sep 2006 04:42:08 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Sep 14 2006
Message-Id: <J5KFq8.1345@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Bio-MCPrimers-2.5
http://search.cpan.org/~slenk/Bio-MCPrimers-2.5/
----
Bundle-Alphamail-0.02
http://search.cpan.org/~awkay/Bundle-Alphamail-0.02/
Perl extension for blah blah blah
----
Bundle-Alphamail-0.03
http://search.cpan.org/~awkay/Bundle-Alphamail-0.03/
Perl extension for blah blah blah
----
CGI-Application-Plugin-QueryHash-1.00
http://search.cpan.org/~gtermars/CGI-Application-Plugin-QueryHash-1.00/
Get back query params as hash(ref)
----
CGI-Session-Driver-memcached-0.02
http://search.cpan.org/~oinume/CGI-Session-Driver-memcached-0.02/
CGI::Session driver for memcached
----
CPAN-1.87_63
http://search.cpan.org/~andk/CPAN-1.87_63/
query, download and build perl modules from CPAN sites
----
Catalyst-Plugin-FormBuilder-1.06
http://search.cpan.org/~nwiger/Catalyst-Plugin-FormBuilder-1.06/
Catalyst FormBuilder Plugin
----
Catalyst-View-HTML-Template-Compiled-0.12
http://search.cpan.org/~esskar/Catalyst-View-HTML-Template-Compiled-0.12/
HTML::Template::Compiled View Class
----
DBIx-Class-Loader-ADO-0.04
http://search.cpan.org/~bricas/DBIx-Class-Loader-ADO-0.04/
DBIx::Class::Loader ADO Implementation.
----
Data-Dumper-HTML-v0.0.2
http://search.cpan.org/~dmuey/Data-Dumper-HTML-v0.0.2/
Perl extension to dump data in HTML safe format with syntax highlighting
----
Date-Biorhythm-2.2
http://search.cpan.org/~beppu/Date-Biorhythm-2.2/
a biorhythm calculator
----
EasyDBAccess-3.0.7
http://search.cpan.org/~foolfish/EasyDBAccess-3.0.7/
Perl Database Access Interface
----
Filesys-SmbClient-3.1
http://search.cpan.org/~alian/Filesys-SmbClient-3.1/
Interface for access Samba filesystem with libsmclient.so
----
Graph-Easy-0.48
http://search.cpan.org/~tels/Graph-Easy-0.48/
Render graphs as ASCII, HTML, SVG or via Graphviz
----
HTML-Template-Compiled-0.74
http://search.cpan.org/~tinita/HTML-Template-Compiled-0.74/
Template System Compiles HTML::Template files to Perl code
----
IO-Interface-1.00
http://search.cpan.org/~lds/IO-Interface-1.00/
Perl extension for access to network card configuration information
----
IO-Interface-1.01
http://search.cpan.org/~lds/IO-Interface-1.01/
Perl extension for access to network card configuration information
----
IO-Socket-SSL-1.01
http://search.cpan.org/~sullr/IO-Socket-SSL-1.01/
Nearly transparent SSL encapsulation for IO::Socket::INET.
----
Ingres-Utility-IIMonitor-0.1
http://search.cpan.org/~worm/Ingres-Utility-IIMonitor-0.1/
API to IIMONITOR, the Ingres utility for IIDBMS servers control
----
Ingres-Utility-IIName-0.2
http://search.cpan.org/~worm/Ingres-Utility-IIName-0.2/
API to IINAME, the Ingres utility for (un)registering services with IIGCN
----
Linux-Input-1.02
http://search.cpan.org/~beppu/Linux-Input-1.02/
Linux input event interface
----
Locale-Maketext-Utils-v0.0.5
http://search.cpan.org/~dmuey/Locale-Maketext-Utils-v0.0.5/
Adds some utility functionality and failure handling to Local::Maketext handles
----
Mail-DKIM-0.19
http://search.cpan.org/~jaslong/Mail-DKIM-0.19/
Signs/verifies Internet mail using DKIM message signatures
----
Mail-SMTP-Honeypot-0.06
http://search.cpan.org/~miker/Mail-SMTP-Honeypot-0.06/
Dummy mail server
----
Mail-Sender-Easy-v0.0.5
http://search.cpan.org/~dmuey/Mail-Sender-Easy-v0.0.5/
Super Easy to use simplified interface to Mail::Sender's excellentness
----
Module-CPANTS-Analyse-0.67
http://search.cpan.org/~domm/Module-CPANTS-Analyse-0.67/
Generate Kwalitee ratings for a distribution
----
Module-CPANTS-ProcessCPAN-0.63
http://search.cpan.org/~domm/Module-CPANTS-ProcessCPAN-0.63/
Generate Kwalitee ratings for the whole CPAN
----
Module-CPANTS-Site-0.62
http://search.cpan.org/~domm/Module-CPANTS-Site-0.62/
Catalyst based application
----
Net-ISBNDB-0.10
http://search.cpan.org/~rjray/Net-ISBNDB-0.10/
----
Net-ISBNDB-0.11
http://search.cpan.org/~rjray/Net-ISBNDB-0.11/
----
Net-Pcap-0.15_01
http://search.cpan.org/~saper/Net-Pcap-0.15_01/
Interface to pcap(3) LBL packet capture library
----
Net-eBay-0.39
http://search.cpan.org/~ichudov/Net-eBay-0.39/
Perl Interface to XML based eBay API.
----
Net-eBay-0.40
http://search.cpan.org/~ichudov/Net-eBay-0.40/
Perl Interface to XML based eBay API.
----
POE-Component-Win32-Service-1.03
http://search.cpan.org/~bingos/POE-Component-Win32-Service-1.03/
A POE component that provides non-blocking access to Win32::Service.
----
POE-Declare-0.02
http://search.cpan.org/~adamk/POE-Declare-0.02/
A POE abstraction layer for conciseness and simplicity
----
Pugs-Compiler-Rule-0.17
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.17/
Compiler for Perl 6 Rules
----
SNMP-Trapinfo-0.91
http://search.cpan.org/~tonvoon/SNMP-Trapinfo-0.91/
Reading an SNMP trap from Net-SNMP's snmptrapd
----
TAPx-Parser-0.22
http://search.cpan.org/~ovid/TAPx-Parser-0.22/
Parse TAP output
----
TVGuide-NL-0.14
http://search.cpan.org/~bas/TVGuide-NL-0.14/
fetch Dutch TV schedule from http://gids.omroep.nl/
----
Template-Plugin-SumOf-0.01
http://search.cpan.org/~tokuhirom/Template-Plugin-SumOf-0.01/
calcurate the sum with VMETHODS.
----
Template-Process-0.00_01
http://search.cpan.org/~ferreira/Template-Process-0.00_01/
Process TT2 templates against data files
----
Term-Size-Unix-0.204
http://search.cpan.org/~ferreira/Term-Size-Unix-0.204/
Perl extension for retrieving terminal size (Unix version)
----
Term-Size-Win32-0.206
http://search.cpan.org/~ferreira/Term-Size-Win32-0.206/
Perl extension for retrieving terminal size (Win32 version)
----
Text-InHTML-v0.0.3
http://search.cpan.org/~dmuey/Text-InHTML-v0.0.3/
Display plain text in HTML
----
WWW-OpenSearch-0.08
http://search.cpan.org/~bricas/WWW-OpenSearch-0.08/
Search A9 OpenSearch compatible engines
----
mail2nntp-1.0
http://search.cpan.org/~nlidz/mail2nntp-1.0/
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 13 Sep 2006 18:20:10 -0400
From: David Lee Lambert <dlamber45@comcast.net>
Subject: perlembed reentrancy
Message-Id: <pan.2006.09.13.22.20.08.504523@comcast.net>
I'm trying to embed perl in Java via JNI, and I'd like to be able to
instantiate multiple independent perl interpreters. My work so far has
lead to the following questions:
1. What is the purpose of PERL_SYS_INIT3? Will anything happen if I call
it more that once? Do the argc and argv I pass to it need to be the same
as the argc and argv I later pass to perl_parse?
2. How do I give perl_eval a list context? What is the difference
between ENTER and savetmps?
3. Does SvPVutf8_nolen return a '\0'-terminated string? Does it encode
characters from outside the BMP (values greater than U+10000) the same way
Java does? How does it encode an embedded '\0' in a scalar?
--
PGP key posted on website ... http://www.lmert.com/people/davidl/
------------------------------
Date: 13 Sep 2006 23:10:23 -0700
From: "Ved" <vedpsingh@gmail.com>
Subject: Replace a line
Message-Id: <1158214223.032021.115030@i3g2000cwc.googlegroups.com>
Hi all,
I am learning perl and could have done this by myself by taking a few
days. But its needed early.
I have a file which has major chunk contaning samething like show
below:
if ( dat0s0 > dat1s0) then
dat0s1 <= dat0s0 ;
dat1s1 <= dat1s0 ;
else
dat0s1 <= dat1s0 ;
dat1s1 <= dat0s0 ;
end if;
if ( dat2s0 > dat3s0) then
dat2s1 <= dat2s0 ;
dat3s1 <= dat3s0 ;
else
dat2s1 <= dat3s0;
dat3s1 <= dat2s0 ;
end if;
----
if ( dat4s0 > dat5s0) then
dat4s1 <= dat4s0 ;
dat5s1 <= dat5s0 ;
else
dat4s1 <= dat5s0;
dat5s1 <= dat4s0 ;
end if;
..........
.............
......... and so on ........
I have to replace only the lines
if ( dat0s0 > dat1s0) then
with
if ( abs(dat0s0) > abs(dat1s0)) then
Rest of the code has to be as it is.
Please help
Thanks
Ved
------------------------------
Date: Thu, 14 Sep 2006 08:31:06 +0200
From: Aukjan van Belkum <aukjan@vanbelkum.no.spam.nl>
Subject: Re: Replace a line
Message-Id: <e669b$4508f72a$c2abfc64$13499@news2.tudelft.nl>
Ved wrote:
> I have to replace only the lines
>
> if ( dat0s0 > dat1s0) then
>
> with
>
> if ( abs(dat0s0) > abs(dat1s0)) then
>
> Rest of the code has to be as it is.
What have you tried? Can you show a little code/effort? Then we can
comment and give tips instead of writing code for you!
look at 'man perlre' to start!
Aukjan
------------------------------
Date: 13 Sep 2006 23:35:16 -0700
From: "Klaus" <klaus03@gmail.com>
Subject: Re: Replace a line
Message-Id: <1158215716.355683.184050@e63g2000cwd.googlegroups.com>
Ved wrote:
> Hi all,
> I am learning perl and could have done this by myself by taking a few
> days. But its needed early.
There are, obviously, different opinions, but in my view, the quickest
way to learn Perl is by reading the reading books. Have a look at
"perldoc -q books".
------------------------------
Date: 13 Sep 2006 15:31:58 -0700
From: "danparker276@yahoo.com" <danparker276@yahoo.com>
Subject: Re: String buffer instead of file handle?
Message-Id: <1158186718.010704.194820@h48g2000cwc.googlegroups.com>
Tad,
" open($fh, '>', \$variable)" This would work perfect, just not the
right version of perl.
I'm just gonna rewrite the other module to use a string, it's not worth
the trouble of finding another solution.
And your quote:
"> Did you do that?
>
> (obviously not...)"
Makes me want to punch you in the face. Why do you have to be such a
smart a**?
I guess with a name like Tad, you're used to being picked on.
Why does everyone have to always say "read the docs". This is
something simple I thought someone knew off the top of their head.
Maybe I don't have to use the open function.
Oh yeah, and I top-posted on purpose. Everyone on this group is so
stuck up. .NET 2.0 blows everything away anyway. At least on their
formus, people from microsoft will answer questions instead of "Look at
the docs"
Tad McClellan wrote:
> danparker276@yahoo.com <danparker276@yahoo.com> wrote:
> > Paul Lalli wrote:
> >> danparker276@yahoo.com wrote:
> >> > I have to connect to this module, and I usually send it a file handle,
> >> > or stdout. But I want to write it to a string. Is there a string
> >> > buffer or something I can use?
>
>
> >> Check the documentation for the function you're using.
>
>
> Did you do that?
>
> (obviously not...)
>
>
> >> In this case,
> >> that's open:
> >> perldoc -f open
> >> [snip]
> >> File handles can be opened to "in memory" files held
> >> in Perl scalars via:
> >>
> >> open($fh, '>', \$variable) || ..
>
>
> Did _your_ docs say what was quoted above?
>
> If not, then the quote does not apply to the version of perl that you have.
>
>
> > This just opens a file called SCALAR(0x8a09e30)
>
>
> Upgrade to a modern perl.
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Thu, 14 Sep 2006 00:12:00 GMT
From: Ala Qumsieh <noreply@invalid.net>
Subject: Re: String buffer instead of file handle?
Message-Id: <k71Og.609$Ij.404@newssvr14.news.prodigy.com>
danparker276@yahoo.com wrote:
> Oh yeah, and I top-posted on purpose. Everyone on this group is so
> stuck up. .NET 2.0 blows everything away anyway. At least on their
> formus, people from microsoft will answer questions instead of "Look at
> the docs"
Well, they are being paid by Microsoft to do that. If somebody (for example,
you) pays me, I'll answer too. Otherwise, you don't really get to complain.
--Ala
------------------------------
Date: Wed, 13 Sep 2006 21:07:31 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: String buffer instead of file handle?
Message-Id: <slrnegheb3.fop.tadmc@magna.augustmail.com>
danparker276@yahoo.com <danparker276@yahoo.com> wrote:
> .NET 2.0 blows everything away anyway. At least on their
> formus, people from microsoft will answer questions instead of "Look at
> the docs"
That's because Bill's mindless minions _need_ someone to hold their hand.
This programming stuff is pretty scary!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 14 Sep 2006 03:45:44 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: String buffer instead of file handle?
Message-Id: <If4Og.11775$xQ1.6260@newsread3.news.pas.earthlink.net>
On 09/13/2006 05:31 PM, danparker276@yahoo.com wrote:
> Tad,
> " open($fh, '>', \$variable)" This would work perfect, just not the
> right version of perl. [...]
Do you mean that you can't install and use IO::Scalar?
If you haven't tried it, you probably can.
------------------------------
Date: 13 Sep 2006 22:33:26 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Taint and memory usage
Message-Id: <4mrf9mF7i26lU1@news.dfncis.de>
<xhoster@gmail.com> wrote in comp.lang.perl.misc:
> Taint seems to nearly double the amount of memory my program takes. I
> haven't see this side effect discussed in perldoc perlsec. This is
> inconvenient, as sometimes I just don't have that much memory to spare.
> Does anyone know of a work around for this (or of some more detailed
> discussion about why it occurs).
>
> This is under various subversions of 5.8, both 32 and 64 bit, for Linux.
I don't know the answer, but I'd ask that question on p5p. You'd
probably get a very qualified reply.
[snip code]
Anno
------------------------------
Date: 13 Sep 2006 15:38:53 -0700
From: "Klaus" <klaus03@gmail.com>
Subject: Re: Taint and memory usage
Message-Id: <1158187133.090177.251140@d34g2000cwd.googlegroups.com>
xhoster@gmail.com wrote:
> Taint seems to nearly double the amount of memory my program takes. I
> haven't see this side effect discussed in perldoc perlsec. This is
> inconvenient, as sometimes I just don't have that much memory to spare.
> Does anyone know of a work around for this (or of some more detailed
> discussion about why it occurs).
>
> This is under various subversions of 5.8, both 32 and 64 bit, for Linux.
>
>
> $ perl taint_mem.pl
> 6768
>
> $ perl -T taint_mem.pl
> 11884
>
>
>
> $ cat taint_mem.pl
> use strict;
> use warnings;
>
> {
> ## This step is not needed to show effect. if foo already
> ## exists you can skip it.
> open my $fh, ">foo" or die $!;
> foreach (1..10000) { print $fh join (",", ("asdadssdf")x10), "\n"};
> close $fh;
> }
>
>
> my @x;
> open my $fh, "<foo" or die $!;
> while (<$fh>) {
> push @x, [split /,/];
I am not an expert on this, but here are my thoughts anyway:
@x contains the string "asdadssdf" 100,000 times. Even without
tainting, each single variable uses 9 bytes plus the "usual" overhead,
I would guess that this "usual" overhead is significantly higher than 9
bytes.
Now, with tainting, each variable incurs an additonal memory penalty to
cater for the taint-checking. Again, I am no expert, but it would not
surprise me if the memory penalty incurred by tainting is roughly
speaking as high as the "usual" memory overhead.
Under those assumptions, what you see as the amount of memory doubling
with taint-checking really is the doubling of overhead.
If you want this "doubling" effect to be less, I would suggest you
significantly increase the size of each and every variable in @x (lets
say each variable in @x should not contain 9, but 1,009 bytes). That
should significantly lessen the ratio of "real" memory vs "overhead"
memory (be it the "usual overhead" or "taint overhead"). Under those
circumstances, I would expect a less dramatic memory increase after
tainting, maybe by only 10%.
------------------------------
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 V10 Issue 9723
***************************************