[17787] in Perl-Users-Digest
Perl-Users Digest, Issue: 5207 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 27 14:05:36 2000
Date: Wed, 27 Dec 2000 11:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977943909-v9-i5207@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Dec 2000 Volume: 9 Number: 5207
Today's topics:
Re: =~ operator <anmcguire@my-deja.com>
Re: _umask_ <David.Hiskiyahu@alcatel.be>
Re: Any good Perl books? (Randal L. Schwartz)
Re: Any good Perl books? <admingod@stargate.net>
Different handles in a variable <SiStie@nuclear-network.de>
Re: Different handles in a variable <SiStie@nuclear-network.de>
for var aliasing on values %hash <bcaligari@my-deja.com>
Re: Help: modulus problem, docs confusing (Anno Siegel)
Re: Help: modulus problem, docs confusing <joe+usenet@sunstarsys.com>
Re: Help: modulus problem, docs confusing (Anno Siegel)
Re: How to delete items from an array? <uri@sysarch.com>
Re: How to have three dimentional array shwekhaw@my-deja.com
Re: indexing web servers's content (Randal L. Schwartz)
just SELECT * from MSSQL 7.0 ?? <toughiq@i-one.at>
Re: Net::DNS and NT Permissions (Should be IO::Socket a <mrfreeze_2000@my-deja.com>
Re: Open a big text file ( large than 200MB ) ghorghor@my-deja.com
Re: Open a big text file ( large than 200MB ) nobull@mail.com
Re: Open a big text file ( large than 200MB ) nobull@mail.com
Re: Our question - Possible Legacy code question... nobull@mail.com
Re: Parsing gls@byu.edu
Re: random problem <tony_curtis32@yahoo.com>
Re: random problem <usenet@hank.org>
Re: random problem nobull@mail.com
RSH and PING <alesr@siol.net>
Re: RSH and PING <tony_curtis32@yahoo.com>
Re: RSH and PING <David.Hiskiyahu@alcatel.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Dec 2000 16:31:47 GMT
From: Andrew N McGuire <anmcguire@my-deja.com>
Subject: Re: =~ operator
Message-Id: <92d5hk$fie$1@nnrp1.deja.com>
[ sorry for the my-deja followup, but my news server has issues ]
In article <slrn94jo1n.e1u.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> Andrew N. McGuire <anmcguire@ce.mediaone.net> wrote:
> >>>>>> "MC" == Michael Carman <mjcarman@home.com> writes:
> >
> >MC> Martin Schmidt wrote:
> >>>
> >>> What is the =~ operator called?
> >>> I'm reading 'Learning Perl' and they just call it the
> >>> =~ operator.
> >
> >MC> I generally refer to it as the 'binding' operator, as it binds an
> >MC> variable to a regexp.
> >
> > being a bit pedantic, but:
> >
> > s/regexp/pattern/;
>
> Well, if we're going to pull out pedantry, then that doesn't
> really help, and there is yet another part that needs changing.
>
> s/regexp/pattern/ doesn't really get there, because a regular
> expression is just a representation of a pattern. Changing that
> word does not make the statement more valuable for
> teaching/understanding.
The way I understand that Perls pattern matching goes beyond the
scope of "regular expressions" proper, for example the use of \1.
> One thingie being "bound" is the "pattern match _operator_",
> or "pattern match" (with the "operator" understood).
>
> The other thing that needs pedantic attention is "variable". There
> is no requirement that the string to be matched against be in a
variable.
Indeed, perhaps I should have pointed that out as well, sorry.
:-)
> The other thingie being "bound" is the string to match against.
> Strings are scalar values.
>
> So then, we get to:
>
> I generally refer to it as the 'binding' operator, as it binds a
> scalar value to a pattern match operator.
>
> That sounds kinda familiar...
>
> ---------------------------
> =head2 Binding Operators
>
> Binary "=~" binds a scalar expression to a pattern match.
> ---------------------------
>
> We didn't re-answer a FAQ here, but we did end up spending a bit
> of time deriving something that has already been derived :-)
That was not my intention, my intention was simply to point out
that:
pattern != regexp # IIRC.
anm
--
$ENV{PAGER} = 'perl -wpe0';
system perldoc => '-t', '-F', $0;
=head1 Just Another Perl Hacker
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 27 Dec 2000 18:35:43 +0100
From: David Hiskiyahu <David.Hiskiyahu@alcatel.be>
Subject: Re: _umask_
Message-Id: <3A4A286F.2C9636F2@alcatel.be>
davidchew@my-deja.com wrote:
>
> I tried all these but not successful.
> I am trying to change the file permission
> using a cgi script run from a browser
> davidchew
Your script is running under a userid of a user on the server,
probably something like 'www', though could be different.
First find out what that userid is, use for example something like:
# tell me who you are:
$wwwuser = `whoami`;
print "My script is running under user $wwwuser!\n";
Then see if that user has a valid group assign to it in order
to access the file:
# OK, now tell me what you can do:
$groups = `groups $wwwuser`;
print "User $wwwuser has access to groups $groups.\n";
print "I should now check if the group of my file $filename is in this list of groups.\n";
Take care to use backticks as in the above example, not something
like: $wwwuser = system ('whoami');
The latter will not work.
Hope this helps!
-------------
> In article <3A43CF55.43F8F931@mediaone.net>,
> mds@helices.org wrote:
> >
> > You'd do well to consider the current _umask_ or you will *NOT* get
> the
> > results you intend . . .
> >
> > Francis Woodhouse wrote:
> > >
> > > SORRY! A few errors crept in there (getting mixed up with UNIX chmod
> and
> > > Perl chmod)
> > >
> > > Francis Woodhouse wrote:
> > >
> > > > If you want to set permissions, then you could try the UNIX chmod
> command.
> > > > If the server you are using is UNIX (it'd have to be if you're
> > > > changing permissions) then try this:
> > > > system("chmod 0777,$filename");
> > >
> > > Shoud be system("chmod $filename 0777");
> > >
> > > >
> > > > If $filename is getting input by a user somehow then you may want
> to use
> > > > this for
> > > > security reasons:
> > > > system("chmod", "0777", $filename);
> > >
> > > Whoops! That should be
> > > system("chmod", $filename, "0777");
> > >
> > > >
> > > > This bypasses the shell and forces the arguments to be strictly to
> > > > chmod. This stops someone setting $filename (through input) as
> something
> > > > like:
> > > > ; cd /; rm -rf *.*
> > > > resulting in the server getting
> > > > chmod 0777; cd /; rm -rf *.* $filename
> > >
> > > Should be chmod; cd/; rm -rf *.* $filename 0777
> > >
> > > >
> > > > This would delete everything on the server successfully.
> > > >
> > > > Francis Woodhouse
> >
> > --
> >
> > Best Regards,
> >
> > mds
> > mds resource
> > 888.250.3987
> >
>
> Sent via Deja.com
> http://www.deja.com/
--
*** David Hiskiyahu, Alcatel SRD, 1 Fr.Wellesplein, Antwerp ***
*** Phone/Fax: +32 3 240 7965/9820, private +32 3 290 0912 ***
Quote of the day:
"I am a marvelous housekeeper. Every time I leave a man I keep his house."
- Zsa Zsa Gabor
------------------------------
Date: 27 Dec 2000 09:03:09 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Any good Perl books?
Message-Id: <m14rzplrua.fsf@halfdome.holdit.com>
>>>>> "AdminGod" == AdminGod <admingod@stargate.net> writes:
AdminGod> I personally don't like buying "dead trees" but sometimes
AdminGod> that is unavoidable. So to solve that I purchased "The Perl
AdminGod> CD Bookshelf" and put the whole thing on my HD. Start up
AdminGod> the web server and #! I have my 6 book reference without
AdminGod> deleting a few trees.
Yes, but think of all those electrons you killed in the process!
Trees are recyclable. Electrons, we gotta work to make!
:-)
--
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, 27 Dec 2000 12:21:58 -0500
From: AdminGod <admingod@stargate.net>
Subject: Re: Any good Perl books?
Message-Id: <3A4A2536.898ECD7@stargate.net>
--------------7807F01105E1253C482718AB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Since this morning, I have opened my Perl CD Bookshelf for people to
check out and see if it would be something for them to have as a
reference. But it appears that people only want to download everything
for free. (ie logs show index then the first book, second book, etc all
in sequential order and scrolling fairly fast) So, to my dismay, I
have pulled the Perl CD Bookshelf and turned off my apache. I guess you
will have to purchase it on your own and hope that it suites you.
Sorry to those who have looked at it and hopefully gained a little
benefit from it.
"Nothing in life is free, but every now and then we can make
concessions." -- Abe Lincoln
--
"The box said 'Windows 95 or better,' so I wrote my own OS in one line of Perl"
--------------7807F01105E1253C482718AB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Since this morning, I have opened my Perl CD Bookshelf for people to check
out and see if it would be something for them to have as a reference.
But it appears that people only want to download everything for free.
(ie logs show index then the first book, second book, etc all in sequential
order and scrolling fairly fast) So, to my dismay, I have pulled
the Perl CD Bookshelf and turned off my apache. I guess you will
have to purchase it on your own and hope that it suites you.
<p>Sorry to those who have looked at it and hopefully gained a little benefit
from it.
<p>"Nothing in life is free, but every now and then we can make concessions."
-- Abe Lincoln
<pre>--
"The box said 'Windows 95 or better,' so I wrote my own OS in one line of Perl"</pre>
</html>
--------------7807F01105E1253C482718AB--
------------------------------
Date: Wed, 27 Dec 2000 17:23:19 +0100
From: Simon Stiefel <SiStie@nuclear-network.de>
Subject: Different handles in a variable
Message-Id: <Pine.LNX.4.31.0012271710340.2257-100000@server.stiefel.priv>
Hi,
I'm writing a perl-script which allows to choose whether to print the
result on the STDOUT or in a file.
If the user want to print it on STDOUT, the script shall use:
print STDOUT "Something...";
And if the user want to write it in a file it uses a file-handle:
print FILEXYZ "Something...";
I don't want to write this twice, becaue the output is a lot.
I thought about somethinfg like this
print $wheter_STDOUT_or_FILEXYZ "Something...";
How can I say to Perl to interpret the variable
"$wheter_STDOUT_or_FILEXYZ" as a handle?
I hope everybody can understand my question...
Mit freundlichen Gr=FC=DFen, .~. Open Minds.
with best regards /V\ Open Sources.
// \\ Open Future!
Simon Stiefel /( )\_ I N U X
^ ~ ^
--=20
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.de | http://www.nuclear-network.de |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |
------------------------------
Date: Wed, 27 Dec 2000 17:46:15 +0100
From: Simon Stiefel <SiStie@nuclear-network.de>
Subject: Re: Different handles in a variable
Message-Id: <Pine.LNX.4.31.0012271731090.2318-100000@server.stiefel.priv>
On Wed, 27 Dec 2000, Simon Stiefel wrote:
> Hi,
Hi again,
> I'm writing a perl-script which allows to choose whether to print the
> result on the STDOUT or in a file.
[...]
> print $wheter_STDOUT_or_FILEXYZ "Something...";
>
> How can I say to Perl to interpret the variable
> "$wheter_STDOUT_or_FILEXYZ" as a handle?
IGNORE IT!!
I got it, it was:
print { $whether } "Something...";
> I hope everybody can understand my question...
> Simon Stiefel
Mit freundlichen Gr=FC=DFen, .~. Open Minds.
with best regards /V\ Open Sources.
// \\ Open Future!
Simon Stiefel /( )\_ I N U X
^ ~ ^
--=20
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.de | http://www.nuclear-network.de |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |
------------------------------
Date: Wed, 27 Dec 2000 18:39:01 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: for var aliasing on values %hash
Message-Id: <92dd05$lpl$1@nnrp1.deja.com>
consider the following snippet
use strict;
my %h = (
0 => ' zero',
1 => ' one',
2 => ' two',
);
foreach (values %h) { s/^\s*// }
print ':', join(':', values %h), ":\n";
exit 0;
Using the ActivePerl 623 build for linux I get:
:zero:one:two:
However, using the build that ocmes with linux 6.2,
(5.005_3) I got:
: zero: one: two:
Chopping off left white space off array values worked on both...am I
missing something?
Brendon
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 27 Dec 2000 16:26:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help: modulus problem, docs confusing
Message-Id: <92d58b$dbi$2@mamenchi.zrz.TU-Berlin.DE>
Chris Fedde <cfedde@fedde.littleton.co.us> wrote in comp.lang.perl.misc:
>In article <977599047.656@itz.pp.sci.fi>,
>Ilmari Karonen <usenet11314@itz.pp.sci.fi> wrote:
>>In article <922rf9$g2m$1@nnrp1.deja.com>, richardstands@my-deja.com wrote:
>>>
>>>given code:
>>>print( ( 100.123 % 23 ), "\n" );
>>>
>>>I get:
>>>8
>>
>>I'd classify this as a misfeature in perl. The modulus operator could
>>be well defined for all reals, but in the current implementation it
>>only works for integers. Sorry.
>>
>
>I'm a bit confused. I might not have enough higher math but I
>understand that the modulus operation is not undefined for reals.
>Modulus, as I understood from abstract algebra returns the remainder
>after integer division.
You are quite right, that is the standard definition (for non-negative
numerator and positive denominator, to be exact). The confusion begins
as soon as we consider signed operands. Mathematics has rarely had a
need to consider these cases[1], so there is no standard, and various
hardware does all sorts of things. An extension to the reals is rarely
even considered, though Knuth has shown (very probably not originally)
that such an extension is possible for all real x, y by letting
x mod y = x - floor( x/y), if y != 0; x mod 0 = x.
That definition preserves all the good properties of the mod operator.
For details, see _TAOCP_ 1.2.4.
> What is the remainder after integer division
>of real arguments?
See above. Or don't, some authors make a difference between remainder
and the mod operation.
Anno
[1] Mathematicians did work on mod operations on (integer) complex
numbers, but the extension to reals wasn't considered interesting.
------------------------------
Date: 27 Dec 2000 11:47:27 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Help: modulus problem, docs confusing
Message-Id: <m3r92tak0w.fsf@mumonkan.sunstarsys.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> An extension to the reals is rarely even considered, though Knuth
> has shown (very probably not originally) that such an extension is
> possible for all real x, y by letting
>
> x mod y = x - floor( x/y), if y != 0; x mod 0 = x.
I think there's a "y" missing:
x mod y = x - y floor(x/y), if y != 0; x mod 0 = x.
--
Joe Schaefer
------------------------------
Date: 27 Dec 2000 16:53:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help: modulus problem, docs confusing
Message-Id: <92d6ps$dbi$3@mamenchi.zrz.TU-Berlin.DE>
Joe Schaefer <joe+usenet@sunstarsys.com> wrote in comp.lang.perl.misc:
>anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>
>> An extension to the reals is rarely even considered, though Knuth
>> has shown (very probably not originally) that such an extension is
>> possible for all real x, y by letting
>>
>> x mod y = x - floor( x/y), if y != 0; x mod 0 = x.
>
>I think there's a "y" missing:
>
>x mod y = x - y floor(x/y), if y != 0; x mod 0 = x.
You are absolutely right. Thanks for catching that.
Anno
------------------------------
Date: Wed, 27 Dec 2000 17:58:15 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How to delete items from an array?
Message-Id: <x78zp1bvbc.fsf@home.sysarch.com>
>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:
BL> Uri Guttman wrote:
>> well, since you always use map in a void context, here is a solution
>> using map in a list context:
>>
>> my $i ;
>> @array = map { $i++ % 2 ? $_ : () } @array ;
BL> That's a grep.
at 4am, map and grep look the same.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Dec 2000 18:25:16 GMT
From: shwekhaw@my-deja.com
Subject: Re: How to have three dimentional array
Message-Id: <92dc64$l1m$1@nnrp1.deja.com>
In article <slrn94jqgh.e1u.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> shwekhaw@my-deja.com <shwekhaw@my-deja.com> wrote:
> >I have having newbie trouble, I just testiong simple script from book
>
> What book? What page?
>
> >which is basically not working
> >It is the script which search through a papragraph for a word and
print
> >out the location of that word under Line and Column.
> >The problem is if there are two same words ,which are being
searched ,
> >in same line, it print out only last word as it overwrite the array
> >content with same line.
> >Let's see the code
> ^^^^^^^^^^^^
>
> >#!/usr/local/bin/perl
>
> If you want more people to see your code, then:
>
> #!/usr/local/bin/perl -w
> use strict;
>
> It is rather silly to ask people to help find mistakes before
> seeing if a machine can find them first.
>
> Enabling warnings and strictures will find many common mistakes.
>
> Take all the help you can get! Turn them on.
>
> >chop ($word);
> ^^^^
>
> Your book is about 5 *years* old then?
>
> Or is it just one of the crappy Perl books? (there are *lots* of
those)
>
> Books that speak Perl 4 are suspect. I would not be depending
> very heavily on such old advice, a lot has changed in the
> 5 years since Perl 4 was superceded.
>
> Modern Perl programmers use chomp() to remove line endings.
>
> > $finds{"$count"} = "$nextpos"; ##$count is line number but it
> ^ ^ ^ ^
>
> If your book has those double quotes in it, then you can be
> pretty sure that you got one of the crappy ones.
>
> That code will work fine without any of the 4 double quote chars.
>
> What book are you talking about?
>
> >is overwrite when there is another word found.##
>
> >I THINK I CAN SOLVE BY USING THREE DIMENTIONAL ARRAY.
>
> Why are you shouting at us?
>
> Since you think a multilevel data structure might help, you
> have probably already read the standard Perl docs dealing with
> multilevel data structures. Right?
>
> perldoc perlreftut
> perldoc perlref
> perldoc perllol
> perldoc perldsc
>
> What part are you unclear on?
>
> --
> Tad McClellan SGML consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
I am just starting with Perl 5
U N L E A S H E D
by Kamran Husain and Robert F. Breedlove
got from library.
The code is not wrong. Only it doesn't work the way it should. I
paragraph is mentioned under input which I used to test. I have no idea
where to look for how to make three dimentional array or if it is
possible. The script doesn't work to store different columns for same
line in array.
I just asking for how can i overcome? if I have to use multidimentional
array, how to learn.
But I got some idea to start from your previous reply
Thak you for that.
If you want to recommend something I appreciate.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 27 Dec 2000 09:05:30 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: indexing web servers's content
Message-Id: <m1wvclkd5x.fsf@halfdome.holdit.com>
>>>>> "Joseph" == Joseph <-nancy-@libero.it> writes:
Joseph> Does anyone have a perl script that
Joseph> allows to browse the content of another server ?
No. None. It's never been done.
If it had been done, www.lycos.com would exist.
Ooops.
Nevermind. :)
In particular, you may want to look at my "link-checkers"
redone repeatedly (as I think of new technologies) at
http://www.stonehenge.com/merlyn/WebTechniques/
and
http://www.stonehenge.com/merlyn/LinuxMag/
They can be fairly rapidly adapted to indexing the content as well.
print "Just another Perl hacker,"
--
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, 27 Dec 2000 19:14:56 +0100
From: Christian Tawfik <toughiq@i-one.at>
Subject: just SELECT * from MSSQL 7.0 ??
Message-Id: <c3ck4tg2t2dd58q4osum91iotlf4mlprdr@4ax.com>
hi,
i just want to execute a SELECT * in a perl script!
perl is running on Solaris 2.6 and a MSSQL 7.0 server should be
accessed.
is there a possibility without installing DBD::Sybase module??
(and setting up a workaround to get to this damn MS product?)
or is there a direct way to connect to a MSSQL server??
thx chris
------------------------------
Date: Wed, 27 Dec 2000 17:36:17 GMT
From: Stephen Leavitt <mrfreeze_2000@my-deja.com>
Subject: Re: Net::DNS and NT Permissions (Should be IO::Socket and NT Permissions)
Message-Id: <92d9ah$ij8$1@nnrp1.deja.com>
Ok, it's officially a permissions problem. I added the IUSR user to the
Administrators group and the script works fine. So now I need to know
what permissions are necessary in NT to allow Perl to open a socket
using IO::Socket::INET (or IO::Socket). Again, any in-site would be
appreciated. Thanks!
In article <92b3n0$p6$1@nnrp1.deja.com>,
mrfreeze_2000@my-deja.com wrote:
> I don't think the module problem lies with Net::DNS anymore, and
> instead lies with IO::Socket and/or IO::Socket::INET, as the following
> script also fails:
>
> print "Content-type: text/html\n\nHello!\n<BR>\n";
> use IO::Socket;
> my $sock = new IO::Socket::INET (
> PeerAddr => '209.119.96.2',
> PeerPort => '53',
> Proto => 'tcp',
> );
> print "Could not create socket: $!\n" unless $sock;
> print $sock "Hello there!\n";
> close($sock);
>
> It outputs the following:
>
> Hello!
> Could not create socket: Unknown error
>
> So it looks like creating a socket is possibly having an issue with NT
> permissions...I'm open to suggestions...Thanks!
>
> In article <92adjj$fdi$1@nnrp1.deja.com>,
> mrfreeze_2000@my-deja.com wrote:
> > Anyone now what permissions are necessary to
> > allow this module to work properly under Windows
> > NT 4 Workstation w/SP6a? If I am logged in on the
> > machine as an admin, my script returns the
> > expected output, but if I attempted to access it
> > via the web server running on my machine (PWS
> > 4.0), I get something like the following:
> >
> > ;; query(bluestar.net, MX, IN)
> > ;; send_tcp(209.119.96.2:53) (src port = 0)
> > ;; ERROR: send_tcp: connection failed: Unknown
> > error
> > ;; send_tcp(209.119.96.3:53) (src port = 0)
> > ;; ERROR: send_tcp: connection failed: Unknown
> > error
> >
> > Since this script is run as the IUSR user on my
> > machine by PWS, that is the only difference I can
> > think of, since when I am logged into my machine,
> > I have admin rights and can run the script
> > normally. This is driving me up a wall... I'm
> > pretty sure this is a permissions issue, would
> > appreciate any insight anyone can provide.
> >
> > Stephen Leavitt
> > stephen(underscore)j(underscore)
> > leavitt@nospam.hotmail.com
> >
> > Sent via Deja.com
> > http://www.deja.com/
> >
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 27 Dec 2000 15:57:49 GMT
From: ghorghor@my-deja.com
Subject: Re: Open a big text file ( large than 200MB )
Message-Id: <92d3hq$e0q$1@nnrp1.deja.com>
In article <slrn94jqvo.e1u.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> ghorghor@my-deja.com <ghorghor@my-deja.com> wrote:
>
> >i have a pb with a big txt file large than 200MB,
> ^^
>
pb = problem :)
> How did Peanut Butter get into your file?
>
> Please use real words instead of cutsie non-standard abbreviations.
>
> >With small files ( less than ram )
> >it's ok and quick
> >with a large file ( more than ram )
> >my hdd swap and it's slow
> >
> >here is my code :
> >open(fic,"<toto.txt");
>
> You should use UPPERCASE filehandles. Your Perl program will stop
> working when you upgrade to a perl that has defined a fic() function.
>
> You should always, yes *always*, check the return value from open():
>
> open(FIC, 'toto.txt') || die "could not open 'toto.txt' $!";
>
> >while(<fic>)
> >{
> > #read $_ and do traitement
> >}
> >close(fic);
> >
> >the system load the file in ram
>
> No, that code does not load the file into memory.
>
> There is only one line at a time in memory.
>
> I expect the memory hogging part got snipped and replaced with
> "#read $_ and do traitement" :-)
>
> >can i just load part of file in ram to increase speed ?
>
> I dunno, it depends on what you are trying to accomplish.
>
> --
> Tad McClellan SGML consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
in fact here is my real code :
while(<fic>)
{
$liste=$_;
$liste=~ s/\s+/ /g;
@coupe=split(' ',$liste);
if((@coupe[0]>=$debut)&&(@coupe[0]<=$fin))
{
if($admin =~ /\w/)
{
if($victime =~/\w/ )
{
if((@coupe[2]=~ /$admin/i)&&
(@coupe[4] =~ /$victime/i))
{
@tab[$compteur]=$liste;
$compteur++;
}
}
else
{
if(@coupe[2]=~ /$admin/i)
{
@tab[$compteur]=$liste;
$compteur++;
}
}
}
else
{
if($victime =~ /\w/ )
{
if(@coupe[4]=~ /$victime/i)
{
@tab[$compteur]=$liste;
$compteur++;
}
}
else
{
@tab[$compteur]=$liste;
$compteur++;
}
}
}
if($compteur==$NB_max_pages)
{
close(fic);
affiche();
exit();
}
}
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 27 Dec 2000 18:15:59 +0000
From: nobull@mail.com
Subject: Re: Open a big text file ( large than 200MB )
Message-Id: <u9ito5k9wg.fsf@wcl-l.bham.ac.uk>
ghorghor@my-deja.com writes:
> In article <slrn94jqvo.e1u.tadmc@magna.metronet.com>,
> tadmc@metronet.com (Tad McClellan) wrote:
[ ghorghor then quotes the whole of Tad's post - including the sig
even though only one line is relvant. Please, ghorghor, do not be so
rude. ]
> > I expect the memory hogging part got snipped and replaced with
> > "#read $_ and do traitement" :-)
> in fact here is my real code :
> @tab[$compteur]=$liste;
> $compteur++;
So @tab is growing and eating your memory.
BTW: You should replace the above with:
push @tab, $liste;
[ This won't stop it compiling but it will prevent vilent retching
when people read your code, and will get rid of one compiler warning ]
Why are you not using Perl's safety features? Do you find they make
programming harder?
This is analagous to a newbie rock-climber saying "I can't cope with
all these ropes and things, I'll just climb unaided since it's a lot
easier".
This is true right up to the first point where you fall.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 27 Dec 2000 18:18:01 +0000
From: nobull@mail.com
Subject: Re: Open a big text file ( large than 200MB )
Message-Id: <u9g0j9k9t2.fsf@wcl-l.bham.ac.uk>
nobull@mail.com writes:
> BTW: You should replace the above with:
>
> push @tab, $liste;
>
> [ This won't stop it compiling
Brain fart! s/compiling/eating all your memory/
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 27 Dec 2000 17:59:41 +0000
From: nobull@mail.com
Subject: Re: Our question - Possible Legacy code question...
Message-Id: <u9n1dhkanm.fsf@wcl-l.bham.ac.uk>
"Joel Ricker" <joejava@dragonat.net> writes:
> Is the our function a construct of perl higher than v5.004_04?
5.6
> If this is the case and I can't convince my ISP to upgrade (doubtful), what
> suggestions are there for redoing the template for creating modules found in
> the Perl FAQ, located here:
> http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfaq7/How_do_I_create_a_module
> _.html and many other places.
Have you considered looking a version of the FAQ contemporary with the
version of Perl that you find does not support our()? (D'oh!)
> Can I just change our to my?
No, but you can change to "use vars". The semantics of our() are
different from use vars but for all but the most obfuscated code that
isn't going to matter.
> Take off strict?
Swtiching off strict vars and removing all the our() function will
have the same effect as changing all our() to "use vars" (with, of
course, the added disadvantage of not having the beniefit of strict
vars).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 27 Dec 2000 09:30:17 -0700
From: gls@byu.edu
Subject: Re: Parsing
Message-Id: <u4rzpg73a.fsf@SNOW.i-did-not-set--mail-host-address--so-shoot-me>
abigail@foad.org (Abigail) writes:
[snip]
> Or could you give a correct, understandable, regex to split on? Look
> careful at the third line of the example.
#!perl -w
while (<DATA>) {
print join "><", split( /\s{2,}/, $_ );
}
__DATA__
root root 1 1 Mon 20:10
root root 2 - Mon 20:10
sistie Simon Stiefel *3 - Mon 20:12
--end Perl--
This regex works for the data given (Is that sufficient to be
correct?), It looks understandable to me (and should be for for most
people familiar with regex's), and it is a regex.
This will only work if you are certain that there will never be more
than single spaces inside a field and at least 2 spaces between fields
(\s{2,}|\t+) may be even more general. But I agree that unpack is
probably better for this case.
--
---------------------------------------------------------------------
Dr. Gregory L. Snow | Inertia makes the world go round,
(Greg) | Love makes the trip worth taking.
gls@byu.edu |
---------------------------------------------------------------------
------------------------------
Date: 27 Dec 2000 11:46:39 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: random problem
Message-Id: <87hf3piwow.fsf@limey.hpcc.uh.edu>
>> On Wed, 27 Dec 2000 15:51:55 +0100,
>> "Maarten" <wo@mtvwebdesign.hypermart.net> said:
> sub Rand { my($n) = @_; my ($string,$i); my(@array);
> srand;
You're invoking srand every time you enter this subroutine.
> What am I doing wrong here? I need a script wich can produce more
> than 1 random numbers in 1 run.
perldoc -f srand:
...
Do not call `srand' multiple times in your program
unless you know exactly what you're doing and why
you're doing it. The point of the function is to
"seed" the `rand' function so that `rand' can
produce a different sequence each time you run
your program. Just do it once at the top of your
program, or you won't get random numbers out of
`rand'!
"perldoc -f srand" for much more on this topic and other pitfalls.
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Wed, 27 Dec 2000 08:55:26 -0800
From: Bill Moseley <usenet@hank.org>
Subject: Re: random problem
Message-Id: <MPG.14b3bed74b0e6cbc98978f@news.newsguy.com>
On Wed, 27 Dec 2000 15:51:55 +0100 Maarten
(wo@mtvwebdesign.hypermart.net) remarked...
> Please have a look at the following:
> ############BEGIN##############
> #!c:/perl/bin/perl
>
> print "Content-type: text/html\n\n";
>
> print &Rand(7);
> print "<br>";
> print &Rand(7);
>
> sub Rand {
> my($n) = @_;
> my ($string,$i);
> my(@array);
>
> srand;
...
I only see what you are seeing on Win32, not under unix (both 5.6).
To fix your problem read: perldoc -f srand
--
Bill Moseley
------------------------------
Date: 27 Dec 2000 18:01:16 +0000
From: nobull@mail.com
Subject: Re: random problem
Message-Id: <u9lmt1kakz.fsf@wcl-l.bham.ac.uk>
"Maarten" <wo@mtvwebdesign.hypermart.net> writes:
> When I use srand...
> What am I doing wrong here?
Going to a newsgroup to asking a question about how to use specific
Perl function without first consulting at the manual page of the
function in question.
In particular you are failing to note the bits where it says...
"Do not call srand() multiple times in your program unless you know
exactly what you're doing and why you're doing it"
...and...
"In fact, it's usually not necessary to call srand() at all..."
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 27 Dec 2000 18:36:25 +0100
From: marvin <alesr@siol.net>
Subject: RSH and PING
Message-Id: <3A4A2898.7528@siol.net>
Hi !
I am using Perl 5.005 on Sun/Unix machines. I have plenty of scripts,
which scan over intranet specific servers via $output=`rsh ...` command.
Now, if I switch one of those servers off, rsh hangs into infinite loop.
The solution would be to ping before issue rsh command. My question is,
do I have to do ping using system or `` command, or there is one of
module I can use to check if host is alive or not.
Regards
------------------------------
Date: 27 Dec 2000 11:41:05 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: RSH and PING
Message-Id: <87lmt1iwy6.fsf@limey.hpcc.uh.edu>
>> On Wed, 27 Dec 2000 18:36:25 +0100,
>> marvin <alesr@siol.net> said:
> Hi ! I am using Perl 5.005 on Sun/Unix machines. I have plenty of
> scripts, which scan over intranet specific servers via $output=`rsh
> ...` command. Now, if I switch one of those servers off, rsh hangs
> into infinite loop. The solution would be to ping before issue rsh
> command. My question is, do I have to do ping using system or ``
> command, or there is one of module I can use to check if host is
> alive or not.
http://search.cpan.org/
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Wed, 27 Dec 2000 18:54:05 +0100
From: David Hiskiyahu <David.Hiskiyahu@alcatel.be>
Subject: Re: RSH and PING
Message-Id: <3A4A2CBD.77BFC597@alcatel.be>
Both can work if handled correctly, but there is a difference:
Case 1, using 'system':
# ...
$pingcheck = system ("ping $some_server");
# ...
here you will get a '0' in $pingcheck for a good ping, a non zero value for a bad ping.
You can check the value and then do the `rsh stuff`;
Case 2, using backticks:
# ...
$pingcheck = `ping $some_server`;
# ...
here you will get the text from stdout of the ping command, something like
'btm4nn is alive' or
'no answer from cnn.com'.
Then you can parse the text and go on with the `rsh ` logic.
The difference is due to the fact that with 'system' a child process is forked,
it gets control of the i/o of the 'ping' (stdin, stderr, stdout) and the exit
status is returned to your (parent) process.
In the case of backticks, the control of stdin/out/err remains in your process,
and whatever 'ping' will say via stdout will be stored in the return value of `ping $some_server`;
Does this help?
marvin wrote:
>
> Hi !
>
> I am using Perl 5.005 on Sun/Unix machines. I have plenty of scripts,
> which scan over intranet specific servers via $output=`rsh ...` command.
> Now, if I switch one of those servers off, rsh hangs into infinite loop.
> The solution would be to ping before issue rsh command. My question is,
> do I have to do ping using system or `` command, or there is one of
> module I can use to check if host is alive or not.
>
> Regards
--
*** David Hiskiyahu, Alcatel SRD, 1 Fr.Wellesplein, Antwerp ***
*** Phone/Fax: +32 3 240 7965/9820, private +32 3 290 0912 ***
Quote of the day:
"I am a marvelous housekeeper. Every time I leave a man I keep his house."
- Zsa Zsa Gabor
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 5207
**************************************