[13178] in Perl-Users-Digest
Perl-Users Digest, Issue: 588 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 19 13:07:17 1999
Date: Thu, 19 Aug 1999 10:05:14 -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, 19 Aug 1999 Volume: 9 Number: 588
Today's topics:
Re: A prime numbers program. <aqumsieh@matrox.com>
Re: Adding up a Data Variable Completely Lost perl sc (Michel Dalle)
ANNOUNCE: Proc::Processtable 0.18 (Daniel J Urist)
Avoid splitting quoted strings? <arunas@an!m.org>
Re: Bragging about killfiling (Was: New posters to comp <uri@sysarch.com>
Re: CGI FILE UPLOAD <jpeterson@office.colt.net>
Re: CGI FILE UPLOAD <jimmy@blackhole-designs.com>
Re: CGI FILE UPLOAD <jimmy@blackhole-designs.com>
Re: Dynamic File Handles <tchrist@mox.perl.com>
Re: eliminate ',' from a data set... (J. Moreno)
How can I open a new aplication such as InternetExplore <baal@c2i.net>
Re: How can I open a new aplication such as InternetExp (elephant)
Re: learning perl from a book,need help <cassell@mail.cor.epa.gov>
LWP::Parallel::UserAgent efficiency <ryanpc@my-deja.com>
Re: Matching two strings (Larry Rosler)
Re: Matt's cookielib and Unicode <cassell@mail.cor.epa.gov>
Re: Modulo of a string tsreyb@my-deja.com
Re: mystified about Javascript failing in Perl output t <rootbeer@redcat.com>
Net::FTP timeout when host is down (Ideare)
Re: Newbie: How to direct STDOUT & STDERR to file AND t <rootbeer@redcat.com>
Re: OOP in perl - not modules!!! <uri@sysarch.com>
Re: Packages and parent packages <rootbeer@redcat.com>
Re: Perl and DBM file questions <groberts@uow.edu.au>
perl system() <stefftx_no_spam_@yahoo.com>
Re: Python for Perl users: random thoughts <garethr@cre.canon.co.uk>
Re: Python for Perl users: random thoughts <jpeterson@office.colt.net>
Re: Python to Perl Conversions (Alan Curry)
Re: Python to Perl Conversions <tchrist@mox.perl.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Aug 1999 10:30:01 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: A prime numbers program.
Message-Id: <x3ylnb7des6.fsf@tigre.matrox.com>
snowhare@long-lake.nihongo.org (Benjamin Franz) writes:
> No. It is correct. Think about it - How can a number have *both*
> divisors larger than the square root of the number?
Hmmm...
Makes sense. This makes me feel stupid!
Back to grade 4.
Ala
------------------------------
Date: Thu, 19 Aug 1999 15:43:00 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Adding up a Data Variable Completely Lost perl script
Message-Id: <7ph8qt$7f8$1@news.mch.sbs.de>
In article <7pfbhb$78f@newsops.execpc.com>, "E-Z Auction" <Ezjy@execpc.com> wrote:
>Hi,
> I am trying to add up the last field in a data file, and then cause
>another event to occur when it reaches a limit set in the data file. any
>tips, examples, information of a helpful manner are welcome, and encouraged.
>
>the data is arraigned in this manner:
>
>###########################
>field1
>field 2
>field 3
>field 4
>
>data1[]data2[]data3[]data4[]data5 # line 1
>data1[]data2[]data3[]data4[]data5 # line2
>data1[]data2[]data3[]data4[]data5 # line3
>
>#############
>#line is not actually in the data file just put it there for explanation
>purposes
>
>field 4 will be a number
>data 5 will be a number
>
>What I need to do is starting with the most recent line (in this example it
>would be line three) take the data5 variable and compare it against field 4.
>If data5 is less than field 4 then I need it to go to the line above it (in
>this example it would be line two) and add that lines data5 to the other
>(line3 again) data 5 and compare again against field 4. and continue on up
>until field4 is met or exceeded
>
>
>when data 5 meets the amount then I need to increase another variable thats
>in the script but not in the data (this part I figured out already but for
>the sake of this I will call it $inc
>
>Heres the really tricky part lets say
>Line3 data5 =2
>Line2 data5 =4
>field4 = 4
>
>Ok,
> reads line 3 data5 gets amount of 2 compares against field 4 value is not
>met, goes back and reads line 2 data 5 ads that value(4) with line3 value(2)
>making the total 6 compares against field4. oops amount is higher than what
>it is suppose to be. Line 3 we want to leave alone because it is most
>current. I want to decrease the value of line 2 data5 to the amount that
>makes line 3 and line 2 data 5 fields equal to field 4 in this case line2
>data 5 would become 2 (I would have it make a new data field but that will
>mess up the next time this is run) oy once again I will need to increase the
>other variable $inc.
>
>
>Tia,
>
>Michael Bruce
Here's a dirty hack that does what you want :
#!/usr/local/bin/perl -w
@fields = ();
@data = ();
while (<DATA>) {
chomp;
if (1 .. /^$/) {
push(@fields, $_);
}
else {
push(@data, [ split(/\[\]/) ]);
}
}
print "Original data (reversed) :\n";
foreach $record (reverse @data) {
print join('-',@$record),"\n";
}
$sum = 0;
$inc = 0;
foreach $record (reverse @data) {
$sum += $$record[4];
if ($sum >= $fields[3]) {
$$record[4] -= $sum - $fields[3];
$inc++;
last;
}
}
print "New data (reversed) :\n";
foreach $record (reverse @data) {
print join('-',@$record),"\n";
}
exit;
__DATA__
field1
field 2
field 3
4
data11[]data21[]data31[]data41[]1
data12[]data22[]data32[]data42[]4
data13[]data23[]data33[]data43[]2
Output :
Original data (reversed) :
data13-data23-data33-data43-2
data12-data22-data32-data42-4
data11-data21-data31-data41-1
New data (reversed) :
data13-data23-data33-data43-2
data12-data22-data32-data42-2
data11-data21-data31-data41-1
Don't try this on huge files, because we gobble up the
whole thing in memory before starting to calculate the
running total.
And don't use this at school, because the style is so
ugly you'll get bad scores :-)
I still think this is the wrong way to handle your problem,
though. Changing the data set for the next run seems to
be pretty weird !?!
Michel.
------------------------------
Date: 19 Aug 1999 16:22:29 GMT
From: world!durist@uunet.uu.net (Daniel J Urist)
Subject: ANNOUNCE: Proc::Processtable 0.18
Message-Id: <7phb05$ef3$1@play.inetarena.com>
Proc::ProcessTable is a perl module to provide a consistent interface
to the process table on Unix and Unix-like systems. This version
contains new support for NETBSD provided by Peter Reich, as well as
support for linux, solaris, dec-osf, bsdi, aix, hpux, freebsd and
irix. This version also (hopefully) fixes a bug that was introduced
with the last release that caused builds to fail on some systems.
--
Dan Urist
durist@world.std.com
http://www.world.std.com/~durist
------------------------------
Date: Thu, 19 Aug 1999 11:00:35 -0600
From: "Arunas Salkauskas" <arunas@an!m.org>
Subject: Avoid splitting quoted strings?
Message-Id: <37bc3841@news.cadvision.com>
Hi,
A minor regexp question, largerly due to a (personal) lack of regexp
documentation and experience.
I want to parse an HTML <INPUT> tag, and replace the Value with a value from
a hash, based on the Name as a Key. There's probably a module that does
this (any pointers would be appreciated).
I have it fundamentally working, unless the tag already contains a value,
and that value is actually a quoted string with spaces.
I'm trying to keep it simple (as few lines as possible). After finding that
a tag begins with "<input" (case insensitive), I try:
($input, $rest) = split(/[\s>]+/, $tag, 2);
$OutPage .= "<$input ";
@nvpairs = split(/[\s>]+/,$rest);
as you can see, this also splits on spaces in any quoted strings. Is there
a straight forward way of not matching spaces that appear after an odd
number of quotes?
I'm not too concerned about having to deal with any other unusual attributes
in the tags, ideally I simply ignore anything that I don't recognize, and
spit it back out when I reconstruct the Tag.
Any help would be appreciated!
Thanks
--
- Arunas Salkauskas
High Point Designs
www.highpointdesigns.com
------------------------------
Date: 19 Aug 1999 12:39:20 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Bragging about killfiling (Was: New posters to comp.lang.perl.misc)
Message-Id: <x7d7wjwwqv.fsf@home.sysarch.com>
>>>>> "RA" == Russ Allbery <rra@stanford.edu> writes:
RA> ("Larry Wall" 800 nil s)
RA> ("Gurusamy Sarathy" nil nil s)
RA> ("Malcolm Beattie" nil nil s)
too bad none of those folks ever post here anymore. i read p5p almost
just to see larry's stuff.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 19 Aug 1999 15:24:32 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: CGI FILE UPLOAD
Message-Id: <QkVu3.186$u07.1487@news.colt.net>
Jimmy Humphrey <jimmy@blackhole-designs.com> wrote:
> Does anybody know of a PM or some script that will allow people to
> upload an image to wherever I let them via a HTML Form and the image has
> to be a paticular file size (and maybe even deminsion?). Also, a bonus
> would be if it would automatically compress the image if it's too big to
> get to a paticular file size.
No.
However, Image::Size will check the dimensions of images.
-s will check the size of [image] files.
Compress::Zlib will compress things (as will opening a pipe to gzip...), but
most commonly used graphics formats are compressed these days already.
------------------------------
Date: Thu, 19 Aug 1999 16:12:24 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Re: CGI FILE UPLOAD
Message-Id: <37BC2D87.42280B75@blackhole-designs.com>
Thanks. Well, the people that will be uploading images to the site are not web
developers.
Jimmy
Jon Peterson wrote:
> Jimmy Humphrey <jimmy@blackhole-designs.com> wrote:
> > Does anybody know of a PM or some script that will allow people to
> > upload an image to wherever I let them via a HTML Form and the image has
> > to be a paticular file size (and maybe even deminsion?). Also, a bonus
> > would be if it would automatically compress the image if it's too big to
> > get to a paticular file size.
>
> No.
>
> However, Image::Size will check the dimensions of images.
> -s will check the size of [image] files.
> Compress::Zlib will compress things (as will opening a pipe to gzip...), but
> most commonly used graphics formats are compressed these days already.
------------------------------
Date: Thu, 19 Aug 1999 16:15:32 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Re: CGI FILE UPLOAD
Message-Id: <37BC2E43.BD5156F5@blackhole-designs.com>
Also, where do I get these mod's Image and Compress? I looked up in my
programming perl book and could not find them listed.
Jimmy
Jon Peterson wrote:
> Jimmy Humphrey <jimmy@blackhole-designs.com> wrote:
> > Does anybody know of a PM or some script that will allow people to
> > upload an image to wherever I let them via a HTML Form and the image has
> > to be a paticular file size (and maybe even deminsion?). Also, a bonus
> > would be if it would automatically compress the image if it's too big to
> > get to a paticular file size.
>
> No.
>
> However, Image::Size will check the dimensions of images.
> -s will check the size of [image] files.
> Compress::Zlib will compress things (as will opening a pipe to gzip...), but
> most commonly used graphics formats are compressed these days already.
------------------------------
Date: 19 Aug 1999 09:07:32 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Dynamic File Handles
Message-Id: <37bc1db4@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"joneill" <joneill@pgicompanies.com> writes:
:How can I dynamically create filehandles at runtime, and write to them
:based on input file contents?
Read up on "How can I use a filehandle indirectly?" in perlfaq5.
In general, you'll want:
$name2fh{ $path } = do {
local *FH;
open(FH, "> $path") || die "can't write $path: $!":
*FH;
};
and then
print { $name2fh{$path} } "data here\n";
--tom
--
Comments on data are usually much more helpful than on algorithms. --Rob Pike
------------------------------
Date: Thu, 19 Aug 1999 11:29:29 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: eliminate ',' from a data set...
Message-Id: <1dws5gi.zjd5utnd4ecjN@roxboro0-0061.dyn.interpath.net>
Abigail <abigail@delanet.com> wrote:
> J. Moreno (planb@newsreaders.com) wrote
> > Andrew Weller <p8e77@keele.ac.uk> wrote:
> >
> > > Unfortunately it is also reading in the ',' (comma) in the final field
> > > - when I perform a calculation on this Z value it screws up
> > > (obviously)!! Is there any way to loop around and eliminate the ','
> > > (comma) before performin calculations??
> >
> > If that's an accurate representation of your data set then it's really
> > easy -- set the record separator to ",\n".
>
> Really? The record separator is still present when you read in lines.
> You would have to chomp it.
Which he is probably already doing...but you're right, I should have
mentioned it.
--
John Moreno
------------------------------
Date: Thu, 19 Aug 1999 15:16:36 GMT
From: "[L] Vicious!" <baal@c2i.net>
Subject: How can I open a new aplication such as InternetExplorer from within a perlprogram?
Message-Id: <odVu3.308$nd.30487@juliett.dax.net>
How can I open a new aplication such as InternetExplorer. I have made a
search engine using Tk (Win GUI), and when I double click on a filename in
the results of the search engine, I want to open the document within for
example Internet Explorer or Netscape. Most preferable would be if I could
open the program asigned to the specific filetype (in this case .HTM-files).
Thnx... Sigmund!
------------------------------
Date: Fri, 20 Aug 1999 02:15:06 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: How can I open a new aplication such as InternetExplorer from within a perlprogram?
Message-Id: <MPG.1226d89140f8c65e989c5d@news-server>
[L] Vicious! writes ..
>How can I open a new aplication such as InternetExplorer. I have made a
>search engine using Tk (Win GUI), and when I double click on a filename in
>the results of the search engine, I want to open the document within for
>example Internet Explorer or Netscape. Most preferable would be if I could
>open the program asigned to the specific filetype (in this case .HTM-files).
although it's a fairly safe assumption - I'll assume that you're on a
Win32 system .. and not one of the other Operating Systems that have
both Internet Explorer and Netscape on them
system( 'start', 'filename.htm');
will open the file in the associated program .. two warnings
a) it doesn't open a new application for most programs - rather it will
use an existing application that's open on the user's machine
b) if there's no association then you will get a rather unfriendly
message from windows telling you that you need to create an association
(ie. you don't see the same Open With dialogue that you see if you were
to double-click on an un-associated file in Windows Explorer)
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Thu, 19 Aug 1999 09:28:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: learning perl from a book,need help
Message-Id: <37BC30C4.27A98F90@mail.cor.epa.gov>
Ben Horowitz wrote:
>
> i need help, i dont understand the jargan?,what is a string?,when do you use
> double postrophies",and when do you use single postrophies'?is it possiable
> to learn only from a book,i just started and am a real newbie,?
Well, I think that "Learning Perl" or "Learning Perl on Win32
Systems" would be your best bet as an intro Perl text. But
you may want to start with this tutorial:
http://www.netcat.co.uk/rob/perl/win32perltut.html
which, despite its name, is not win32-centric. Perl is,
for the most part, OS-independent.
A string is just a bunch of characters stuck together, like
a word or phrase or sentence.
"Strings in double quotes can have $variable1 and $variable2
in them, so that when Perl uses the string the variable names
get substituted for the values of the variables."
'Strings in single quotes do not go through the substitution
that strings in double quotes do, so these variables:
$scalar1 $scalar2 would not go through that substitution.'
Good luck,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 19 Aug 1999 16:31:52 GMT
From: Ryan PC Gibson <ryanpc@my-deja.com>
Subject: LWP::Parallel::UserAgent efficiency
Message-Id: <7phbho$3nn$1@nnrp1.deja.com>
Retrieving a single HTTP request using LWP::Parallel::UserAgent
takes *longer* than with just plain, old LWP::UserAgent. Would anyone
have any idea why? Even a "simple_request", of a single, non-
redirecting page takes longer. I am using the latest version of all
modules involoved.
Originally, I thought Parallel::UserAgent was just a forking
wrapper to LWP::UserAgent, but after poking around the modules some, I
see that the parallel useragent uses it's scheme for requests. My
suspicions are that the socket call subroutines are at fault for the
difference in speed.
Has anyone else experienced these problems before? Anyone out
there successfully using LWP::Parallel::UserAgent?
-=ryan*(pc)=-
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 19 Aug 1999 07:57:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Matching two strings
Message-Id: <MPG.1225bb374bf8ad4c989e76@nntp.hpl.hp.com>
In article <S9Uu3.3263$1B5.211663@monger.newsread.com> on Thu, 19 Aug
1999 14:04:34 GMT, Darren Janisse <djanisse@northrock.bm> says...
> I have a statement in one of my scripts that would read:
>
> write if $raduserid eq $userid;
>
> however this does not work. $raduserid is the username from a radius log,
> and $userid is the username from local user input. I have done extensive
> testing, and for example $raduserid equals "testuser" and $userid equals
> "testuser" however it does not run the write command.
>
> Any suggestions would be appreciated.
Make sure both variables are chomped if they may have trailing newlines.
Test with length() to make sure there are no hidden control characters.
Use unpack 'H*' to look at the bits.
Offer a suitable sacrifice to the Perl gods.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 19 Aug 1999 09:22:40 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Matt's cookielib and Unicode
Message-Id: <37BC2F50.9547FDC5@mail.cor.epa.gov>
Matthew O. Persico wrote:
>
> David Huggins-Daines wrote:
> >
> > BTW, it's a generally accepted fact that learning Perl via Matt's
> > Scripts is a bad idea :)
>
> Gee. I thought I wrote decent scripts. My employer thinks so anyway. :-)
>
> Well you can imagine my chagrin at having my name (even if it is only my
> first!) tarnished on what seems to be a weekly basis. I've never seen these
> scripts. Anyone have a URL? I'd like to see just how bad it is for the fun
> of it.
At least Uri hasn't gotten to the point where he's shouting
"Death to all Matts!!" :-)
I see no problem with giving the home of these things as
http://www.worldwidemart.com/scripts/
when in the same sentence I am telling people *not* to
go there unless they are prepared to re-write the code
to deal with any deficiencies in speed, effectiveness,
Y2K-compliance, error-checking, non-portability, and/or
security that might be there.
HAND,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 19 Aug 1999 16:03:39 GMT
From: tsreyb@my-deja.com
Subject: Re: Modulo of a string
Message-Id: <7ph9sh$2a6$1@nnrp1.deja.com>
Ok guys, thanks for all the feedback. Larry & Bart,
I couldn't get your suggestions to work the way I
want - but that's probably because I'm still new to
perl rather than any other factor.
I did come up with my own solution (see below). Thanks
for all the suggestions! -TR, Boston, MA
--- start ------------------------
#!/usr/local/bin/perl -w
sub string2num {
$leng=length($_[0]);
$val=0;
for ( $j=0 ; $j<$leng ; ++$j ) {
$char = substr($_[0],$j,1);
$val += ord($char) * 128*$j;
}
##zz print "you passed: @_\n";
##zz print "length: $leng computed number: $val\n";
return($val);
}
sub doit {
$modval = 7;
$bigval = string2num(@_);
$smallval = $bigval % $modval;
print "string: @_\n\tbigval: $bigval\tsmallval: $smallval\n\n";
}
doit("joe");
doit("Joe");
doit(" Joe");
doit("Sally");
doit("Bobo 23");
doit("networkmanagementnetworkmanagement");
doit("networkmanagfmentnetworkmanagement");
doit("this is an extremely long string to convert to a single number");
--- end --------------------------
Produces the following output:
string: joe
bigval: 40064 smallval: 3
string: Joe
bigval: 40064 smallval: 3
string: Joe
bigval: 76672 smallval: 1
string: Sally
bigval: 143488 smallval: 2
string: Bobo 23
bigval: 169472 smallval: 2
string: networkmanagementnetworkmanagement
bigval: 7703168 smallval: 4
string: networkmanagfmentnetworkmanagement
bigval: 7704704 smallval: 0
string: this is an extremely long string to convert to a single number
bigval: 23136384 smallval: 5
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 19 Aug 1999 08:35:33 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: mystified about Javascript failing in Perl output to file for html
Message-Id: <Pine.GSO.4.10.9908190833160.17303-100000@user2.teleport.com>
On 18 Aug 1999, 99% Energy wrote:
> Subject: mystified about Javascript failing in Perl output to file for html
It sounds as if your Perl code is working as it's supposed to. Maybe you
need to check with the docs, FAQs, and newsgroups about JavaScript and
related issues. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 19 Aug 1999 18:10:22 +0200
From: "Antonio Gulli (Ideare)" <gulli@ideare.com>
Subject: Net::FTP timeout when host is down
Message-Id: <37BC2C6E.1AD06582@ideare.com>
Hello,
I'm using Net::FTP to do my ftp session. It works very well.
But what happens when i try to connect an host which is down?
It seems to hang regardless of time-out. The default value of
time-out is 120, but it is exceeded. I can't use ICMP ping
or traceroute because it can be stopped by some firewall
and this is not a solution.
I don't know if i can use eval{} block and alarm().
Are they used internally by Net::FTP ??
I'm using Linux 2.2.5 and standard perl 5.005_03
I saw the code and noticed that Net::FTP->new()
is calling the new method of the super class
IO::Socket::INET ... but i can't understand how
time-out is handled in this case.
--
Antonio Gulli' Ideare S.r.l
whois: AG2-ORG http://www.ideare.com
------------------------------
Date: Thu, 19 Aug 1999 08:54:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Newbie: How to direct STDOUT & STDERR to file AND terminal
Message-Id: <Pine.GSO.4.10.9908190851070.17303-100000@user2.teleport.com>
On Thu, 19 Aug 1999, Henry I. Widman wrote:
> Subject: Newbie: How to direct STDOUT & STDERR to file AND terminal
>
> Ok, people, I did my newbie best to find out the answer to this almost
> certainly super simple question, but didn't come across anything in the
> archives.
You may have missed section five of the FAQ: "How do I print to more than
one file at once?" Even thought it's talking about files, one such "file"
is often the standard output stream, which can go to your terminal.
Cheers!
> [To send e-mail: Remove *XSPAM* from my e-mail address]
[To get e-mail: Remove *XSPAM* from your e-mail address]
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Aug 1999 12:42:50 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: OOP in perl - not modules!!!
Message-Id: <x79077wwl1.fsf@home.sysarch.com>
>>>>> "JW" == James Williamson <james.williamson@bbc.co.uk> writes:
JW> prasad@chetana.com wrote in message <7pg3g9$6ik$1@nnrp1.deja.com>...
>> Hello,
>>
>> I want to write completely object oriented programs in perl. I read the
>> PERLTOOT several times. I have done few small programs in C++ in my
>> programming class. But it still seemed to be confusing to start writing
>> OO perl programs.
JW> As far as I'm aware a big limitation within Perl in attempting to
JW> fully embrace OOP is you can't inherit class variables.
do you mean values in the object created by parent classes? if so you
are wrong. check out the new book "OO perl" by damian conway which shows
you how to do that. it is being released right now.
and i think it is possible to do stuff to inherit class level variables
too. i will ask him this week in monterey.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 19 Aug 1999 08:42:13 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Packages and parent packages
Message-Id: <Pine.GSO.4.10.9908190838250.17303-100000@user2.teleport.com>
On 19 Aug 1999, Donovan Rebbechi wrote:
> I am interested in getting packages
> that refer to their constructing package somehow.
You seem to think that there's some relationship between
Grandmother::Mother::Daughter and Grandmother::Mother. Actually, although
they may look similar, there's nothing connecting them.
> The problem I am trying to solve
> is that I want to use methods from foo in foo::bar.
Import them with the standard mechanism: use foo;
Have fun with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 20 Aug 1999 02:48:10 +1000
From: Geoff Roberts <groberts@uow.edu.au>
To: Malcolm Ray <M.Ray@ulcc.ac.uk>
Subject: Re: Perl and DBM file questions
Message-Id: <37BC354A.FB3B5CDC@uow.edu.au>
Malcom,
Thanks very much for the pointer. Does a tie with DB_RECNO load the
whole database file into the array? If I reference a particular record
number, is only that record loaded into memory? If I then reference
another record, is the previous one written out to the database file and
purged from memory?
Thanks again.
Geoff
> On Thu, 19 Aug 1999 03:10:05 +1000, Geoff Roberts <groberts@uow.edu.au> wrote:
> >Hi,
> >
> > I would like to have a DBM file that has fixed sized records - these
> >will simply be indexed by their record number (no sorting or
> >anything). Each record would be around the 1/2k mark in size.
> >Records will need to be added and deleted.
> >
> > Would Perl's DBM files be able to handle around 300,000 to 500,000 of
> >these records? How will perl deal with accessing records - I'm just
> >concerned about memory. If I get perl to retrieve record 200,000 does
> >perl simply go to that record directly and retrieve it, or does it need
> >to load much more into memory to access that record.
> >
> > Are there good examples on DBM files of this size and how to use them
> >efficiently?
> >
> > Thanks for any help
>
> This sounds like it may be a good application for a tied array rather than
> a hash, using DB_File's DB_RECNO interface method. If you have DB_File,
> see its documentation: it includes an example of using DB_RECNO.
> --
> Malcolm Ray University of London Computer Centre
------------------------------
Date: Thu, 19 Aug 1999 11:53:35 -0500
From: "stefan" <stefftx_no_spam_@yahoo.com>
Subject: perl system()
Message-Id: <7phcpo$mf5@nntpb.cb.lucent.com>
Hello,
I have a small Perl-script which I need to run with nohup like :
nohup script.pl &
After this command the process is started, but it doesn't do anything,
nothing is written in the nohup.out either.
The script has some system calls using:
system(unix_command);
When I try the same script with nohup, but I remove the system command
everything is just fine.
Does anyone had this problem ? BTW, I am using Solaris 2.6 and I tried
executing the command in ksh, csh, sh with no luck.
Thanks,
Stefan
PS: For the sake of argument here is the script:
#!/usr/local/bin/perl
$ii=0;
while($ii < 100)
{
system("sleep 3");
$ii++;
print("I'm alive $ii \n");
}
------------------------------
Date: Thu, 19 Aug 1999 15:15:05 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Python for Perl users: random thoughts
Message-Id: <sik8qryf7q.fsf@cre.canon.co.uk>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> I had hoped that having *only* reference semantics would spare the
> beginner from having to keep in mind the difference between a
> reference and its referent as we have in C or Perl.
In languages which have only reference semantics it is helpful to think
of the language as manipulating "objects with identity" rather than
"anonymous values". When you carry out an assignment in such a
language, say y = x, the intention is to make y refer to "the same
object" as x, not to another object that happens to have "the same
value". If you want to build a new object with "the same value" as x,
you generally have to issue an explicit instruction to copy the object,
for example y = copy(x).
However, the idea of "the same value" is problematic, because the
"value" of an object depends on the meaning the programmer gives to that
object. For example, I might represent a tree as an array of arrays:
@tree = ([1,2],[3,4]);
but if I try to copy this tree using Perl's assignment operator, I get a
new tree that shares structure with the old tree:
@copy = @tree;
$tree[0][0] = 5;
print $copy[0][0]; # prints "5"
So Perl's meaning of "value" (i.e., the top-level of the array) differs
from my meaning of "value" (i.e., the full tree) for this data
structure.
There's much more on the same subject in Kent Pitman's article "The Best
of Intentions: EQUAL rights and wrongs in Lisp" (Lisp Pointers VI 4,
October-December 1993, http://world.std.com/~pitman/PS/EQUAL.html).
--
Gareth Rees
------------------------------
Date: Thu, 19 Aug 1999 15:49:17 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Python for Perl users: random thoughts
Message-Id: <1IVu3.187$u07.1487@news.colt.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> COOLNESS:
> You can "foreach" across multiple items.
> a = [ [1,2], [3,4], [5,6] ]
> for (i,j) in a:
> print i+j
> 3
> 7
> 11
Hmmm, I like it, and it seems very perl-esque to me. Any chance of Perl
supporting this in the future?
BTW, thanks for this and the other recent Python post. Good stuff.
------------------------------
Date: Thu, 19 Aug 1999 16:35:11 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Python to Perl Conversions
Message-Id: <3nWu3.11054$x04.646013@typ11.nn.bcandid.com>
>s[i:j] @array[ $i .. ($j - 1) ] for arrays, but
> substr($s, $i, $j - 1) for strings. Yes,
If s[i:j] really means substr($s, $i, $j - 1) then python is really goofy.
This would make sense: substr($s, $i, $j - $i)
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: 19 Aug 1999 10:44:38 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Python to Perl Conversions
Message-Id: <37bc3476@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
pacman@defiant.cqc.com (Alan Curry) writes:
:>s[i:j] @array[ $i .. ($j - 1) ] for arrays, but
:> substr($s, $i, $j - 1) for strings. Yes,
:
:If s[i:j] really means substr($s, $i, $j - 1) then python is really goofy.
:This would make sense: substr($s, $i, $j - $i)
Whoops, you're nearly right.
>>> (i,j) = (5,10)
>>> s = "long_string_goes_here"
>>> print s[i:j]
strin
Whereas in Perl:
DB<1> ($i,$j)=(5,10)
DB<2> $s = "long_string_goes_here"
DB<3> print substr($s, $i, $j - 1)
string_go
DB<4> print substr($s, $i, $j - $i)
strin
--tom
--
floccinaucinihilipilification humorous. [f. L. flocci, nauci, nihili, pili
words signifying `at a small price' or `at nothing' enumerated in a
well-known rule of the Eton Latin Grammar + -fication] The action or habit
of estimating as worthless.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu.
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 588
*************************************