[7241] in Perl-Users-Digest
Perl-Users Digest, Issue: 866 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 14 12:17:43 1997
Date: Thu, 14 Aug 97 09:00:27 -0700
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 Aug 1997 Volume: 8 Number: 866
Today's topics:
Re: %ENV doesn't work with PerlIS on NT S <andi@team-konzept.de>
[newbie] Problem with Serial I/O <jzavala@gama.fime.uanl.mx>
Re: any SMTP servers require domain name <valdis.kletnieks@vt.edu>
CPAN module and UNINST=1 (Tony Bowden)
excel on the net <c-borto@students.uiuc.edu>
HELP: Search and replace question (Vinit Carpenter)
HELP: Search and replace!! <vscarpenter@qgraph.com>
incredibly simple question (Philip A. Viton)
Java or CGI password protect a web <marcan@notes.nu.com>
Re: Large Data Base question (Tony Bowden)
Re: Macperl and server errors (Chris Nandor)
Re: Need help accessing tty modem devices within perl!! (Aaron Sherman)
Re: Need help! (Sami Sandqvist)
Net::FTP example (I R A Aggie)
Re: Novice scratches head (Aaron Sherman)
Re: passwords? <perrella@ehsn23.cen.uiuc.edu>
Re: Perl 5 permanently loaded (Aaron Sherman)
Perl and HTML <laurent@syntem.eerie.fr>
Perl interpreter and WIN 95 and Microsoft Internet info <Admin@iani.com>
perl output destroys hard drive ? (Thaddeus Wakefield Batt)
perl question (+jeff)
Re: Possible in Perl? Do it, I'll Pay ya! (brian d foy)
Problem with CPAN module and MD5? (Tony Bowden)
Re: Problems with split (M.J.T. Guy)
Re: random numbers (Mike Stok)
Simple question on s/// operator in expressions <garyo@oberbrunner.com>
Sorting Dates <perrella@ehsn23.cen.uiuc.edu>
Re: Sorting Dates (Bennett Todd)
Re: sorting... <bsugars@sunpub.com>
Re: sorting... <ptrainor@aura.title14STOPSPAM.com>
Why doesn't sort take a reference any more? (Bernard Cosell)
Re: Year 2000 compliant? (Mike Stok)
Re: Year 2000 compliant? (I R A Aggie)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 14 Aug 1997 17:50:30 +0200
From: Andreas Schmidt <andi@team-konzept.de>
To: pegit.swedmap@mbox300.swipnet.se
Subject: Re: %ENV doesn't work with PerlIS on NT S
Message-Id: <33F32945.90C54F9B@team-konzept.de>
Pinne wrote:
> But there's one big problem, there's no info in the
> %ENV-array.
I'm not shure if I can help you. I've recognized, that %ENV is available
with PerlIS if you know which hashentry you want (eg.
$ENV{SERVER_NAME}), but that you cann't get all available entries with
keys %ENV or each %ENV.
Andi
------------------------------
Date: Thu, 14 Aug 1997 10:23:27 -0600
From: "J. Edgar Zavala" <jzavala@gama.fime.uanl.mx>
Subject: [newbie] Problem with Serial I/O
Message-Id: <33F330FE.DB050915@gama.fime.uanl.mx>
Hello everyone,
I4m new in this, please be patient.
I4ve a problem with the serial comunication in Perl, we are
using perl 5.003 in
a Linux Box.
We are making a new project in Mexico, the problem is with
the serial I/O, we use the next code to read and write to the serial
line:
#--- code begins here --------
#!/usr/bin/perl
use IO;
# More code here ....
$puerto = "+</dev/ttyS0";
open (SERIAL,$puerto) or die("ERROR");
while(1){
vec($rin,fileno(SERIAL),1)=1;
if (select($rout=$rin,undef,undef,1)){
$fh->sysread($temp,1024);
print STDOUT "Recepcion: [$temp]\n";
}
else{
$token = 'T'.$token;
$token = $SOT.$token;
$token = $token.Crc($token).$EOT;
$l = length($token);
$rin=$rout='';
$fh->syswrite($token,length($token));
}
}
fh->close();
#--- code end ---------
Now, the problem is with the time ... this code hangs every time, we
have time delays betwen the data transfer
and the resception and the response time is critical.
If someone have more afordable or better solution, please help me ...
Thanks, J. Edgar Zavala
S.
Linea Solucione
Internet, Monterrey, Mexico.
jzavala@gama.fime.uanl.mx
------------------------------
Date: 14 Aug 1997 09:55:29 -0400
From: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Subject: Re: any SMTP servers require domain name
Message-Id: <uebu303m3y.fsf@black-ice.cc.vt.edu>
--pgp-sign-Multipart_Thu_Aug_14_09:54:52_1997-1
Content-Type: text/plain; charset=US-ASCII
Kevin Johnson <kjj@pobox.com> writes:
> Whether you can use a fake domainname with the SMTP HELO command
> depends on whter the SMTP server allows it. Some servers require that
> the domainname specified be correct.
Even further afield, but.. ;)
*BAD*, *BAD*, *NAUGHTY* SMTP server!! <thwaps with newspaper>
Quoting RFC1123:
5.2.5 HELO Command: RFC-821 Section 3.5
The sender-SMTP MUST ensure that the <domain> parameter in a
HELO command is a valid principal host domain name for the
client host. As a result, the receiver-SMTP will not have to
perform MX resolution on this name in order to validate the
HELO parameter.
The HELO receiver MAY verify that the HELO parameter really
corresponds to the IP address of the sender. However, the
receiver MUST NOT refuse to accept a message, even if the
sender's HELO command fails verification.
DISCUSSION:
Verifying the HELO parameter requires a domain name lookup
and may therefore take considerable time. An alternative
tool for tracking bogus mail sources is suggested below
(see "DATA Command").
Note also that the HELO argument is still required to have
valid <domain> syntax, since it will appear in a Received:
line; otherwise, a 501 error is to be sent.
IMPLEMENTATION:
When HELO parameter validation fails, a suggested
procedure is to insert a note about the unknown
authenticity of the sender into the message header (e.g.,
in the "Received:" line).
--pgp-sign-Multipart_Thu_Aug_14_09:54:52_1997-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
Version: 2.6.2
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface
iQCVAwUBM/MOUdQBOOoptg9JAQEC3QP/U+uFhVv0Cu8U4TiZuF6yiYZkumQCm7uv
viYyEWVc0CzWffHjJ5yN53SsPtW9spQiaYlNLaTGpwgprFZ2EgPH7wJJZ+sXfQgA
J08/6YMOh+uMB/PAW6U6f50olktMxtMmHHKd8zbDUrc9KGX/jvqRSdw63TJ1hhAP
BVdQmdQJRA8=
=+GO+
-----END PGP MESSAGE-----
--pgp-sign-Multipart_Thu_Aug_14_09:54:52_1997-1--
------------------------------
Date: 13 Aug 1997 16:50:51 GMT
From: tony@niweb.com (Tony Bowden)
Subject: CPAN module and UNINST=1
Message-Id: <5ssolb$4bs$1@sparc.tibus.net>
I _really_ love the CPAN module - especially the interactive shell ...
however, every so often when updating a module for which there is a newer
version it gives me a series of :
## Differing version of Net/POP3.pm found. You might like to
rm /usr/lib/perl5/./Net/POP3.pm
## Differing version of Net/SMTP.pm found. You might like to
rm /usr/lib/perl5/./Net/SMTP.pm
type errors follwed by a:
## Running 'make install UNINST=1' will unlink all those files for you.
Is there a way, from within the CPAN shell to specify this? I've looked
through the docs and can't see anything, but surely there must be an
easier way than going to the source dir and re-installing it with that?
Tony
--
-----------------------------------------------------------------------------
Tony Bowden | tony@tmtm.com / t.bowden@qub.ac.uk / http://www.tmtm.com/
Belfast, NI | life is a sleazy stranger - and this is his favourite bar
-----------------------------------------------------------------------------
------------------------------
Date: Thu, 14 Aug 1997 10:31:26 -0500
From: Clecio Dias <c-borto@students.uiuc.edu>
Subject: excel on the net
Message-Id: <33F324CD.CEFA376B@students.uiuc.edu>
Hi all!
I am trying to know if under a DOS window, I can run an Excel macro
without calling the graphical interface.
The problem I am trying to solve is the following:
I have a workbook that, given hypothetical income and tax rates,
calculates tax revenues for the state of Illinois. I would like to make
that workbook available on the net. Ideally, people would send their
numbers; those would be fed into the workbook and the results would be
send back to the researcher.
I would appreciate any suggestions.
------------------------------
Date: 14 Aug 1997 09:44:35 -0500
From: carpente@earth.execpc.com (Vinit Carpenter)
Subject: HELP: Search and replace question
Message-Id: <5sv5kj$qhc$1@earth.execpc.com>
Hi there. I've got a quick question about searching and replacing in
Perl. Here's what I want my script to do. Go thru a file and find every
occurance of a particular word. If it finds that word, I want it to
delete that line and replace it with another word that I specify. Here's
what I'm doing right now.
perl -e 's/Internet/Intranet/gi' -p -i.bak file.html
This works fine and replaces every occurance of Internet with Intranet.
Now I want it to replace the whole line with simply the word Intranet.
perl -e 's/Internet * /Intranet/gi' -p -i.bak file.html
But that doesn't work... Can someone help?? Thanks in advance.
--Vinny
------------------------------
Date: Thu, 14 Aug 1997 09:35:39 -0500
From: Vinny Carpenter <vscarpenter@qgraph.com>
Subject: HELP: Search and replace!!
Message-Id: <33F317BA.5A3E3290@qgraph.com>
Hi there. I've got a quick question about searching and replacing in
Perl. Here's what I
want my script to do. Go thru a file and find every occurance of a
particular word. If
it finds that word, I want it to delete that line and replace it with
another word that I specify.
Here's what I'm doing right now.
perl -e 's/Internet/Intranet/gi' -p -i.bak file.html
This works fine and replaces every occurance of Internet with Intranet.
Now I want it to
replace the whole line with simply the word Intranet.
perl -e 's/Internet * /Intranet/gi' -p -i.bak file.html
But that doesn't work... Can someone help?? Thanks in advance.
--Vinny
------------------------------
Date: Thu, 14 Aug 1997 11:35:13
From: pviton@magnus.acs.ohio-state.edu (Philip A. Viton)
Subject: incredibly simple question
Message-Id: <pviton.417.000B9699@magnus.acs.ohio-state.edu>
I'm embarassed to ask this, but I've been working with it for an hour, and
can't see what's wrong. The fragment below is designed to say one thing if
you type Y or y and another if you type anything else. The anything-else
branch doesn't seem to get taken no matter what you type.
print STDERR "\nPlease answer Y or N: ";
$resp=<STDIN>;
if ($resp = ~ /^[yY]+/)
{ print STDERR "Your response was Y\n" }
else
{print STDERR "Your response wasn't Y\n" }
Can ayone tell me what I'm doing wrong? THANKS!
Philip A. Viton
------------------
City Planning, Ohio State University
pviton@magnus.acs.ohio-state.edu
------------------------------
Date: Thu, 14 Aug 1997 09:41:46 -0400
From: Nick Marcantonio <marcan@notes.nu.com>
Subject: Java or CGI password protect a web
Message-Id: <33F30B1A.34B0@notes.nu.com>
I've been looking for a way to password protect a highly confidential
web that I've done. I've played with many self-written and downloadable
Java and CGI scripts, but none seem to be truly effective. If you know
of a sure fire way to password protect a web, it would be greatly
appreciated if you would share that with me. Please e-mail:
marcan@nu.com with any info. I extend my thanks in advance.
------------------------------
Date: 13 Aug 1997 15:48:46 GMT
From: tony@niweb.com (Tony Bowden)
Subject: Re: Large Data Base question
Message-Id: <5ssl0u$srl$1@sparc.tibus.net>
Tim Smith (trs@azstarnet.com) wrote:
: I would say, use PostgreSQL or mSQL or something for the
: database, use Perl for the wrapper program that queries the database
: and handles the input and output from the user.
For databases of the size mentioned I would think that MySQL [1] would
be better than mSQL. It's a lot faster, is multi-threaded, and uses the
superset of the API as mSQL, so any mSQL-Perl code should work just be
changing a use Msql to use Mysql.[2]
It's also free.
Tony
[1] http://www.tcx.se/
[2] reasonably complex code might take slighlty more tweaking, but not much
--
-----------------------------------------------------------------------------
Tony Bowden | tony@tmtm.com / t.bowden@qub.ac.uk / http://www.tmtm.com/
Belfast, NI | they speak a different language, it's never been happy to me
-----------------------------------------------------------------------------
------------------------------
Date: Thu, 14 Aug 1997 10:30:14 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Macperl and server errors
Message-Id: <pudge-ya02408000R1408971030140001@news.idt.net>
In article <33F194A2.497D@grn.es>, Alfonso Aijsn <aijon@grn.es> wrote:
# hi everybody,
# I'm trying to run the free machintosh server Quidpro quo with Macperl
# scripts.
# The problem is I allways get server errors.
# I've saved my scripts as Droplets AND cgi Scripts, same thing.
# Should Macperl be in the cgi-bin or not?Where should it be?
# Anyone knows about that?
# Thanks
You should look at your server logs and find out what the server error is.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: 14 Aug 1997 09:03:06 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: Need help accessing tty modem devices within perl!!!
Message-Id: <5suvma$5ra@lorien.ajs.com>
In article <01bca860$f4fbca00$6dab9cce@Pnreit00>,
Nick Reitman <nreit00@mail.gpbx.net> wrote:
>Is there anyway to use the open command to open a connection to a modem. I
>need to write a program that send some characters to the modem like
>at&b0
>atz
>at&b1
>when I try a command like
>open (MODEM, ">/dev/ttyA00");
>the program stops.
>If anyone can help I would really apprreciate it!
You'll want to check out the POSIX module. Specifically, you want to look
at POSIX::open and POSIX::fcntl. These will be needed to talk to the modem
correctly.
However, my first guess is that you want to open the modem read/write
and read back the modem's output, like so:
open(M,"+</dev/ttyA00")||die("modem: $!");
print M "at\&b0\n";
$reply = <M>;
This will likely work, unless the modem is configured to be speaking to
a different set of tty parameters than you have set.
------------------------------
Date: 14 Aug 1997 14:43:49 GMT
From: sami@d246a.mtalo.ton.tut.fi (Sami Sandqvist)
Subject: Re: Need help!
Message-Id: <slrn5v66f1.2pu.sami@d246a.mtalo.ton.tut.fi>
On 14 Aug 1997 02:37:53 GMT, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <slrn5v3vmf.2sk.sami@d246a.mtalo.ton.tut.fi>,
> sami@d246a.mtalo.ton.tut.fi (Sami Sandqvist) writes:
>: Have you considered that the users should only be able to read their
>: own mailboxes? In that case, check out $ENV{MAIL} and $ENV{LOGNAME}
>: etc. You may find something useful if the users have a default shell
>: on your ISP.
>
>If the permissions on their mailbox aren't sufficiently private, what's
>to stop someone from invoking a Useful Use of Cat? :-)
>
>Greg
>--
>open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
>f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
>d2ac158c84c4ece4d22d1000118a8d5491000000
>EOF
Yes. My point was that since they can't read other users' mailboxes,
why should one ask them for a username? Of course it is good that he
now knows how to read from STDIN even though he may not have to do it
for this script.
Sami
--
#################################################
#Sami Sandqvist #Finger for PGP key #
#samiss@cc.tut.fi # #
#################################################
------------------------------
Date: Thu, 14 Aug 1997 09:50:51 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Net::FTP example
Message-Id: <fl_aggie-ya02408000R1408970950510001@news.fsu.edu>
I keep seeing "how do I FTP in perl", so here's a small, very *simple*
example of what one can do. As written, the program presumes that one
has some foreknowledge of the target_site's structure and file names.
Comments welcome,
James
#!/your/path/to/perl
# a module making life easier
use Net::FTP;
# for debuging: $ftp = Net::FTP->new('site','Debug',10);
# open a connection and log in!
$ftp = Net::FTP->new('target_site.somewhere.xxx');
$ftp->login('username','password');
# set transfer mode to binary
$ftp->binary();
# change the directory on the ftp site
$ftp->cwd('/some/path/to/somewhere/');
foreach $name ('file1', 'file2', 'file3') {
# get's arguments are in the following order:
# ftp server's filename
# filename to save the transfer to on the local machine
# can be simply used as get($name) if you want the same name
$ftp->get($name,$name);
}
# ftp done!
$ftp->quit;
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 14 Aug 1997 08:54:58 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: Novice scratches head
Message-Id: <5suv72$5p2@lorien.ajs.com>
Stuart Cooper <stuartc@ind.tansu.com.au> wrote:
>mccurdy@rohan.sdsu.edu (Mike McCurdy) writes:
>
>> My understanding was that perl would treat these variables as integers
>> when used like this. Given that $x's value is not equal to 100000, why is
>> $x being printed? TIA ...
>>
>>
>> #!/usr/local/bin/perl
>> $x = system "/usr/bin/sar -r 1 | tail -1 | cut -c26-32";
>> if ($x == 100000) {
>> print $x;
>> }
>>
> $x isn't being printed. You're seeing the output of the command you're
>systeming. What you should do is this:
Also, consider the more portable version (as if sar is portable ;-):
open(PIPE,"/usr/bin/sar -r 1 |") || die("fork: $!");
while(<PIPE>) {
$last = $_;
}
close PIPE;
$x = substr($last,25,7);
This will, at least, reduce the number of external programs you have to use.
And, perl will see that there are no special characters in the command
(other than the trailing |, which it strips for its own use) and avoid
using a sub-shell to run the command. This can be a big win on a slow
box, or if you are executing this command often.
-AJS
------------------------------
Date: Thu, 14 Aug 1997 09:04:08 -0500
From: perrella andrew c <perrella@ehsn23.cen.uiuc.edu>
To: IRZ Consulting <irz@eonet.com>
Subject: Re: passwords?
Message-Id: <Pine.SOL.3.95.970814085739.3698B-100000@ehsn23.cen.uiuc.edu>
Hi,
I have a simple subroutine that I used for a phonebook script.
The entire phonebook script is going to be available at
http://www.meadownet.com/shareware
by the end of the summer, I hope. If you want the whole thing you can get
it there. If not just use the sub routines below. I keep the password
file in a text document called admin.pha (Phone Book Admin). And the
individual user pages in that same directory (everyone has a different
phonebook).
The condensed version is given below:
sub parse_data{
read(STDIN, $save_string, $ENV{CONTENT_LENGTH});
@list = split(/&/, $save_string);
foreach $_ (@list){
local($name, $value) = split(/=/, $_);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
hex($1))/eg;
$name_array{$name} = $value;
}
@value_list = values (%name_array);
@key_list = keys (%name_array);
##########################define Important variables###########
$login = $name_array{'login'};
$password = $name_array{'password'};
$user_page = $login . ".phb";
}
#login the user
sub login_user{
open(ADMIN_INFO, "./phonebooks/admininfo.pha");
undef $/;
$admin_data = <ADMIN_INFO>;
$/ = "\n";
close(ADMIN_INFO);
@admin_list = split(/\n/, $admin_data);
foreach $_(@admin_list){
local($user, $passwd) = split(/=/, $_);
$admin_array{$user} = $passwd;
@user_list = keys (%admin_array);
@passwd_list = values (%admin_array);
}
if($admin_array{$login} == $password){
$authorization = 1;
}
}
#retreive the users information from his phonebook file
sub retreive_data{
open(USER_INFO, "./phonebooks/$user_page");
undef $/;
$user_data = <USER_INFO>;
$/ = "\n";
close(USER_INFO);
}
On Tue, 12 Aug 1997, IRZ Consulting wrote:
> I would like to implement a site with password protection, but unlike
> most others, I want each user to go to a different page. Sort of like a
> personal directory for each user. I need a password script which will
> check the username and password and will then redirect the user to the
> correct location, depending on their username. If anyone can help,
> please mail me.
>
> Robin Ziari
> irz@eonet.com
>
>
>
------------------------------
Date: 14 Aug 1997 09:21:21 -0400
From: ajs@lorien.ajs.com (Aaron Sherman)
Subject: Re: Perl 5 permanently loaded
Message-Id: <5sv0oh$5tv@lorien.ajs.com>
Pinne <pegit.swedmap@mbox300.swipnet.se> wrote:
>
>I've read that some NT web-servers can keep Perl 5
>in memory permanently.
The only server I know of that does anything like this is apache (though
I don't know if apache has been ported to NT). Is there some particular
reason that you need to use NT for your web server. You do hinder yourself
pretty badly by doing so....
-AJS
------------------------------
Date: Thu, 14 Aug 1997 17:03:13 +0200
From: Laurent Bailleux <laurent@syntem.eerie.fr>
Subject: Perl and HTML
Message-Id: <33F31E31.2F1C@syntem.eerie.fr>
I want to run a perl script thanks to a html link,
in order to create an always "up-to-date" web page.
My script is "OK" in a shell, but I am not able to
make it run in my browser.
What are the steps to reach this aim ?
Regards
laurent
------------------------------
Date: Thu, 14 Aug 1997 11:23:51 -0400
From: Auto by Internet <Admin@iani.com>
Subject: Perl interpreter and WIN 95 and Microsoft Internet info server
Message-Id: <33F32307.5105@iani.com>
In order to execute my perl scripts do i need to run the interpreter on
a server or can I just have the interpreter installed and test them like
that? I currently run win95 and would like to run Microsoft Internet
Information Server on it, is that possible or do i need NT?
Thank you for any feedback.
Dan
AutoByInternet
equi@herald.infi.net
------------------------------
Date: Thu, 14 Aug 1997 10:55:28 -0500
From: thaddeus@activework.com (Thaddeus Wakefield Batt)
Subject: perl output destroys hard drive ?
Message-Id: <thaddeus-ya023180001408971055280001@news.mdc.net>
greetings, i'm hoping someone can shed some light on the following behavior:
running perl 5.002 under RedHat Biltmore 4.2 on a 166 MHz P-Pro w/ 128 MB
RAM (kernel is only using 64 MB)
i have a script that looks to a very large raw file for it's source and
from that file it parses out approximately 100,000 separate files and puts
them in a directory structure based on the last 2 digits of the file name.
So there is a main directory under which 100 directories reside named 00,
01, 02, 03 ... 98, 99. Within each of these directories files are written
out based on their record number within the raw file, so in directory 01
all files ending in 01.tag are located (01.tag, 101.tag, 201.tag, 301.tag,
etc.) it mostly works, and the file permissions on 95% of the files are as
follows:
-rw-r--r-- 1 prodmgr users 681 Aug 13 18:03 100333.tag
however, a *few* files show up with very bizare permissions such as:
?--x--Sr-T 10 sync games 655380 Jan 1970 296601.tag
br-xr-s--t 5 root root 30658 103, 97 Oct 8 2031 296701.tag
drwxr-xr-x 2 prodmgr users 15360 Aug 13 14:18 295636.tag
these files cannot be removed by root and when fsck is run it reports bad
superblocks on the drive. the only way (i've found) to use the drive again
is to manually mount it, rescue what data i can, then run mkfs.ext2
/dev/hdb1 (i am using a 3 gig drive with only one partition for the data).
memory problems perhaps?
any help in direction is much appreciated.
cheers,
--thad
thaddeus wakefield batt
thaddeus@activework.com | thaddeus@panix.com
http://thadsbox.activework.com
------------------------------
Date: 14 Aug 1997 15:39:16 GMT
From: gt5146c@acmey.gatech.edu (+jeff)
Subject: perl question
Message-Id: <5sv8r4$4g@catapult.gatech.edu>
I've got a script that does three things, set a variable $cheese = "foo",
and open up file handle FILE for reading, and print the contents of this
file to standard output. The file that has been opened has, somewhere in
int, a string that looks like this: $cheese. When I output to stdout, why
won't the $cheese in the file be interpolated into "foo"? The code looks
like this:
$cheese = "foo";
open( FILE, "$file" );
while( <FILE> ) { print "$_"; }
and the contents of $file are as follows:
=======
this is just $cheese for me
======
Any ideas?
+jeff
------------------------------
Date: Thu, 14 Aug 1997 11:05:22 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Possible in Perl? Do it, I'll Pay ya!
Message-Id: <comdog-ya02408000R1408971105220001@alice.walrus.com>
In article <malp-ya02408000R0508971437330001@nntp.ne.mediaone.net>, malp@ilesa.com (Mal Paine) wrote:
>Is it possible to write a perl script that establishes a raw connection to
>a host (not http:// or ftp:// or any other protocol), on port 1787, sends
>one line(the contents of a query string), gets the results, and writes them
>to the web page?
it's certainly possible and almost already completely written on page
349 of Programming Perl, 2nd Edition not to mention the perlipc man page.
if you are doing this as a CGI script, you only need to wrap the normal
CGI sorts of things around those examples.
good luck :)
--
brian d foy <comdog@computerdog.com>
------------------------------
Date: 13 Aug 1997 16:44:56 GMT
From: tony@niweb.com (Tony Bowden)
Subject: Problem with CPAN module and MD5?
Message-Id: <5ssoa8$3t8$1@sparc.tibus.net>
I upped my installation of Perl from 5.003 to 5.004, and managed to screw up
the path @INC liked (It used to have lots of /usr/local/lib variants, and
now it's /usr/lib), so rather than trying to recompile with different paths,
I thought, why not just move all the modules to the relevant place. This
seems to have worked reasonably fine with most things, but messed up MD5.
Now, this isn't much of a problem, since I was able to just reinstall that
one, however the CPAN interactive shell got very confused by this. If
it _thinks_ that it should be using MD5 but MD5 won't load, rather than
defaulting back to not using it, it just barfs out. Is this a feature or
a bug?
Tony
--
-----------------------------------------------------------------------------
Tony Bowden | tony@tmtm.com / t.bowden@qub.ac.uk / http://www.tmtm.com/
Belfast, NI | I play it cool and keep my thoughts in a jar marked dangerous
-----------------------------------------------------------------------------
------------------------------
Date: 14 Aug 1997 14:25:34 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problems with split
Message-Id: <5sv4gu$10r$1@lyra.csx.cam.ac.uk>
In article <871456849.23391@dejanews.com>, <crr026@email.mot.com> wrote:
>
>I want to store the pattern part of split into a variable. However, the
>following try
>
>#!perl
>$Line = "one|two|three";
>print "$Line\n";
>$sep = "\|";
>@Atoms = split (/$sep/, $Line);
>foreach (@Atoms) {
> print "$_\n";
>}
>
>gives me this output
[...]
Various respondents have suggested setting $sep to '\|', which deals
with your particular example. But for a general solution, it's
better to quote $sep, so you don't have to worry about whether particular
characters are or are not metacharacters:
@Atoms = split (/\Q$sep/, $Line);
Almost always when you substitute a variable in a regexp, you want it
quoted like that. It's a good habit to always quote unless you
specifically want otherwise. (And it's a pity that it's not the perl
default.)
------------------------------
Date: 14 Aug 1997 14:28:53 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: random numbers
Message-Id: <5sv4n5$oqd@news-central.tiac.net>
In article <5ssmo1$lm4@chile.earthlink.net>,
David Cheitel <david1@earthlink.net> wrote:
>I am writing a test generation script in perl. The questions that are given
>are random.
>
>I am familiar with the rand function but I need to generate 15 random numbers
>from a range of 1 to 30 that are unique from each other. The rand function
>does not guarantee this.
{
my @source = (1 .. 30);
for (@list = ();
@list < 15 && @source;
push @list, splice @source, rand (@source), 1) {
;
}
}
might do what you want with just 15 calls to rand.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Thu, 14 Aug 1997 11:09:36 -0400
From: Gary Oberbrunner <garyo@oberbrunner.com>
Subject: Simple question on s/// operator in expressions
Message-Id: <33F31FB0.FC124FC@oberbrunner.com>
Sorry for a question that's so simple I should be able to figure it out, but
I can't for the life of me.
I often want to do a substitution on a string and use the result 'in-line',
without having to create a new variable just to hold the result (or modify the
original string). The only way I have found is to substitute into another
variable with this hack:
$foo = "my string\n";
$tempfoo = $foo;
$tempfoo =~ s/my/my new/;
print $newfoo;
when all I really want is something like this:
$foo = "my string\n";
print s/my/my new/ ($foo); # Syntax error, s/// is not a unary operator.
There must be some clever perl way to do this kind of thing. I'm using
perl5.004, if it makes any difference...
Thanks for any advice you might have;
--
Gary Oberbrunner Genetic Arts, Inc.
email: garyo@oberbrunner.com 8 Clinton St.
phone/fax: (617) 492-2852 Cambridge, MA 02139
------------------------------
Date: Thu, 14 Aug 1997 08:54:31 -0500
From: perrella andrew c <perrella@ehsn23.cen.uiuc.edu>
Subject: Sorting Dates
Message-Id: <Pine.SOL.3.95.970814084710.3698A-100000@ehsn23.cen.uiuc.edu>
Hi,
I have written a simple program that helps us manage our list of
IP addresses.
Data is stored in the form
ip#=Fname=Lname=date=index#
where date is in the form 8-14-97, and index# is just the number
associated with when it was entered (it never is output to the screen).
Anyway I am trying to sort by dates, fname, lname or ip#. The last three
work fine, however the date sort doesn't seem to make sense. This is the
routine I use:
#sort by date
sub sort_date{
&switch(3);
@ip_data = sort { $a <=> $b} @ip_data;
&switch(3);
}
#this is the switching sub routine. It switches the first piece of
#data for each element of the list array @ip_data with the given
#spot. It works with the switching routines.
sub switch{
local($from) = $_[0];
for($i=0; $i < @ip_data; $i++){
local(@tmp) = split(/=/, $ip_data[$i]);
local($place1) = $tmp[0];
local($place2) = $tmp[$from];
$tmp[0] = $place2;
$tmp[$from] = $place1;
$ip_data[$i] = join('=', @tmp);
}
}
The switching sub routine is used for the other three sorts and works
fine.
I think the problem is in the line that says:
@ip_data = sort { $a <=> $b} @ip_data;
I think I need something else besides { $a <=> $b}
------------------------------
Date: 14 Aug 1997 14:22:05 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: Sorting Dates
Message-Id: <slrn5v654b.4h9.bet@waltz.rahul.net>
On Thu, 14 Aug 1997 08:54:31 -0500, perrella andrew c <perrella@ehsn23.cen.uiuc.edu> wrote:
>Data is stored in the form
>
>ip#=Fname=Lname=date=index#
>
>where date is in the form 8-14-97, [...]
Yuck. Do yourself a big favour; encode that date
1997-08-14
and all of a sudden you've made a couple of wins:
1) You can use a simple ascii text sort to put them into chronological order,
and
2) You don't need a special-case exception to make sure things keep working
after December 31, 1999.
Let's say you had recoded the date that way. Then all you need to do is pluck
out the fourth column and sort on it; using the Schwarz Transform (explained
in detail in [1]) that comes out to:
@sorted = map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, (split /=/)[3] ] } @data;
If on the other hand you keep the data in that format, then you need to
convert it to something that can be sorted every time you want to look at it.
Perhaps split it into the three values; then you could have something like
@sorted =
map { $_->[0] }
sort { $a->[3] <=> $b->[3] or $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] }
map { [ $_, split /-/, (split /=/)[3] ] } @data;
or thereabouts, for the next two years and a few months. After that you get to
add more code. Is 8-14-00 supposed to be 1900-08-14 or 2000-08-14? How about
8-14-37? Of course, if you use the same encoding as ctime(3) (and hence
Perl's localtime() and friends) then August 14, 2037 would end up encoded
8-14-137, which is unambiguous, and the above code will continue to work with
it even if it bugs people:-).
-Bennett
[1] Either of <URL:http://perl.com/CPAN/doc/FMTEYEWTK/sort.html>
or <URL:http://perl.org/CPAN/doc/FMTEYEWTK/sort.html>,
whichever is faster. Until recently it seemed like perl.org was quicker;
of late it's been pretty slow and perl.com has been snappier. YMMV.
------------------------------
Date: Thu, 14 Aug 1997 09:52:41 -0400
From: Benjamin Sugars <bsugars@sunpub.com>
Subject: Re: sorting...
Message-Id: <33F30DA9.5102@sunpub.com>
Anagrams of the Word wrote:
> foreach (sort values %MAIN_CHOICES){
> print "$MAIN_CHOICES{$_} has a value of $_\n <br>";
> }
>
> That sorts alphabetically by values.
Only kind of. It does *sort* the values, but it doesn't print out the
keys containing those values. $MAIN_CHOICES{$_} prints out the *value*
in %MAIN_CHOICES corresponding to the key $_. Moreover, since in this
loop $_ actually a value and not a key, $MAIN_CHOICES{$_} is likely to
not even exist!
I think what you want is something like
foreach $key (sort {$MAIN_CHOICES{$a} cmp $MAIN_CHOICES{$b}}
keys %MAIN_CHOICES) {
$value = $MAIN_CHOICES{$key};
print "$key has a value of $value\n";
}
The use of explicit term like $key and $value is more intuitive and
leads to easier debugging, IMHO.
--
Ben Sugars <bsugars@canoe.ca>
Senior Webmaster,
CANOE Canadian Online Explorer,
http://www.canoe.ca/
------------------------------
Date: Thu, 14 Aug 1997 11:29:02 -0400
From: Pat Trainor <ptrainor@aura.title14STOPSPAM.com>
To: Anagrams of the Word <jefpin@bergen.org>
Subject: Re: sorting...
Message-Id: <Pine.LNX.3.95.970814111817.3919D-100000@aura>
On Thu, 14 Aug 1997, Anagrams of the Word wrote:
> foreach (sort keys %MAIN_CHOICES){
> print "$_ has a value of $MAIN_CHOICES{$_}\n <br>";
> }
>
> That sorts alphabetically by keys.
This works really well!:
0001 has a value of This is the value for key 0001
0002 has a value of This is the value for key 0002
0003 has a value of The value for key 0003, silly!
> foreach (sort values %MAIN_CHOICES){
> print "$MAIN_CHOICES{$_} has a value of $_\n <br>";
> }
>
> That sorts alphabetically by values.
Quizically, though, this yields:
has a value of The value for key 0003, silly!
has a value of This is the value for key 0001
has a value of This is the value for key 0002
What did I miss? My keys are 0001,0002,etc.. Should the key have been output at
the beginning of each line in the second snip? Thanks!!
pat
:)
###
### to reply, remove STOPSPAM from the email address ***
###
ptrainor@aura.title14 .com
"While it's true winning isn't everything-LOSING IS NOTHING!" -Ed Bighead
------------------------------
Date: Thu, 14 Aug 1997 14:53:10 GMT
From: bernie@rev.net (Bernard Cosell)
Subject: Why doesn't sort take a reference any more?
Message-Id: <33f318e9.526978643@news.rev.net>
On Perl 5.003 on Linux, I have a routine that has a really complicated
set of sorting criteria, and so what I tried to do is:
my $compsub; # I also tried local $compsub
if (lots of tests)
{ $compsub = sub {first sort criteria} ; }
elsif (lots of tests)
{ $compsub = sub {second sort criteria} ; }
...
sort $compsub (keys %hash) { ...}
I'd been struggling a bit to try to understand what this error meant:
not a GLOB reference at ./call_logs.pl line 96.
which didn't seem to make much sense. But upon looking at the
perlfunc man page, I discovered an interesting change from Camel 2.
Camel 2 says "SUBNAME may be a scalar variable name (unsubscripted) in
which case the value provides the name of (or a reference to) the
actual subroutine to use" That has been -removed- from perlfunc.
So it appears that my problem is that i'm trying to do something that
is no longer supported, but I'm left with wondering WHY it was
removed. It would seem that the original functionality would be handy
for a situation like the above and I don't see a really an as-clean
way to do it. Thanks!!
/Bernie\
--
Bernie Cosell mailto:bernie@rev.net
Roanoke Electronic Village
------------------------------
Date: 14 Aug 1997 14:46:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Year 2000 compliant?
Message-Id: <5sv5ob$pvu@news-central.tiac.net>
In article <33F30287.56BA@transquest.com>,
Arwen Mullikin <arwen.mullikin@transquest.com> wrote:
>I am doing a research project and one of the questions was to find out
>if the latest version of Perl was Year 2000 compliant. Does anyone know
>where I can get that information?
It's in the FAQ. Perl is as Y2K compliant as the OS it runs on, but you
can't guarantee that people who write applications write them safely!
Section 4 of the new perl faq says:
Does Perl have a year 2000 problem?
Not unless you use Perl to create one. The date and time
functions supplied with perl (gmtime and localtime) supply
adequate information to determine the year well beyond
2000 (2038 is when trouble strikes). The year returned by
these functions when used in an array context is the year
minus 1900. For years between 1910 and 1999 this happens
to be a 2-digit decimal number. To avoid the year 2000
problem simply do not treat the year as a 2-digit number.
It isn't.
When gmtime() and localtime() are used in a scalar context
they return a timestamp string that contains a fully-
expanded year. For example, $timestamp =
gmtime(1005613200) sets $timestamp to "Tue Nov 13 01:00:00
2001". There's no year 2000 problem here.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Thu, 14 Aug 1997 11:12:55 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Year 2000 compliant?
Message-Id: <fl_aggie-ya02408000R1408971112550001@news.fsu.edu>
In article <33F30287.56BA@transquest.com>, Arwen Mullikin
<arwen.mullikin@transquest.com> wrote:
+ I am doing a research project and one of the questions was to find out
+ if the latest version of Perl was Year 2000 compliant. Does anyone know
+ where I can get that information?
Perl doesn't know about time, per se.
Under unix, it does know about things like time(), gmtime() and
localtime(). time() returns epoch time (seconds since 00:00:00 UTC
1 Jan 1970), while gmtime() and localtime() returns years elapsed
since 1900 (and other things, too). In the year 2000, these functions
will return "100".
Under other systems, it is up to the perl porter to make these functions
behave properly, or to document the differences.
In either case, it is then up to the programmer to do the Right Thing:
$year = $year + 1900;
The non-trivial question is: is my perl program y2k compliant?
James
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 866
*************************************