[15831] in Perl-Users-Digest
Perl-Users Digest, Issue: 3244 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 3 18:05:29 2000
Date: Sat, 3 Jun 2000 15:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960069911-v9-i3244@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 3 Jun 2000 Volume: 9 Number: 3244
Today's topics:
Re: "system" and output flush <bmb@ginger.libs.uga.edu>
aliendomain db braccobaldo.xyz@hotmail.com
Annoying message when opening files <stan@typhoon.ocis.temple.edu>
Re: Annoying message when opening files <tony_curtis32@yahoo.com>
Re: Any function to include a HTML file into the Perl s <keegan@millerwebsiteservices.com>
Anyone use win32::IPROC - help <pmudundi@sunny.zp>
Re: Execute perl code in a variable <michael_roper@hotmail.com>
Re: How do I update records in a file? (cgi & perl) <bwalton@rochester.rr.com>
Re: How do I update records in a file? (cgi & perl) <jeff@vpservices.com>
Re: How do I update records in a file? (cgi & perl) (Joe Smith)
Re: How to find out height and width of a PNG graphic <randeg@alum.rpi.edu>
IP/port check help wanted <helza@planet.nl>
Re: Limits on $ENV{} hash ? <bwalton@rochester.rr.com>
Re: Limits on $ENV{} hash ? (Philip Taylor)
Newbie in need of help... <tabs_paradise@yahoo.com>
Re: Perl to write to a text file <bwalton@rochester.rr.com>
Re: Perl unusable as a programming language (Jonadab the Unsightly One)
Re: Predicted generation of ID numbers <webmaster@beautiful-ladies.com>
Re: Predicted generation of ID numbers <webmaster@beautiful-ladies.com>
Re: Problems with MakeMaker om Win32 (ActiveState) <Greg.Thomas@iname.com>
reading sizes of large files in Win32 <wendlc@cims.nyu.edu>
Require statement kills script <nayler@SPAMOFFses.curtin.edu.au>
Re: Require statement kills script <bwalton@rochester.rr.com>
Re: Require statement kills script <red_orc@my-deja.com>
Seattle Perl Talks by Damian Conway <spug@halcyon.com>
Re: the end of perl? <hyagillot@tesco.net>
Re: the end of perl? <erebus@hushmail.com>
Re: using 'exists' in a program to test for keys in a h <bwalton@rochester.rr.com>
Viewing HTTP Requests <mikula@students.uiuc.edu>
Re: Web Based E-mail Sorting System Required (David H. Adler)
Re: Web-based email solutions (David H. Adler)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 3 Jun 2000 17:52:02 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: "system" and output flush
Message-Id: <Pine.A41.4.21.0006031751390.8314-100000@ginger.libs.uga.edu>
On 3 Jun 2000, feng chen wrote:
> I have a perl script which uses several "system" calls
> to run other perl script such as:
> system "perl p1.pl ......";
> system "perl p2.pl ......";
> system "perl p3.pl ......";
>
> The problems I have are that the outputs from those
> system calls are interleaved. How to make sure that
> the output from p2.pl appears after the output of p1.pl?
Try
perldoc -q flush
--
Brad
------------------------------
Date: Sat, 03 Jun 2000 15:32:37 +0200
From: braccobaldo.xyz@hotmail.com
Subject: aliendomain db
Message-Id: <j32ijsg6rsodvld0ohuam0dgepldd6s81d@4ax.com>
Hi, I have tried a nice perl script
(http://www.cgi.tj/scripts/aliendomain.html)
But I can't add more domains.
I tried, for example, whois.nic.it. It works by telnet, but not adding
the text in the database file.
Can someone help me?
Thanks in advance,
Andres
________
remove .xyz to reply
________
http://baravalle.co.uk
------------------------------
Date: 3 Jun 2000 18:29:46 GMT
From: Stan Horwitz <stan@typhoon.ocis.temple.edu>
Subject: Annoying message when opening files
Message-Id: <8hbiqq$636$1@cronkite.temple.edu>
In many of the Perl programs I have written, I an annoying message on the
screen whenever file is opened for input or output. The programs all work
properly and fairly quickly, but I want to fix them so that this message
goes away. I searched in vain through this newsgroup and through the docs
on the CPAN web site for an answer to this question, but I apologize if
this is a FAQ.
The message I am talking about looks like:
Value of <HANDLE> construct can be "0"; test with defined() at ./xxx line 65535.
and there is no line 65535 in any of my programs so I assume this is a
reference to a built in Perl module somewhere. My open statements are
pretty simple and taken from examples out of the O'Reilly books. For
example, the following statement elecits this type of error:
open(LICENSE_FILE, "< $lic_file") or die "Cannot find file ".$lic_file."\n";
even though the program in which this statement appears runs correctly.
The file in question is just a simple text file that's maybe about two
pages long. This script is run under Perl version 5.004_004 on a Compaq
AlphaServer system.
By the way, I could sware that I saw the answer to this problem somewhere
on the CPAN web site a few months ago when I was looking for other Perl
information, but damned if I can't find that information there now!
So does anyone know what this error means and how I can get rid of it? If
so, please let me know.
------------------------------
Date: 03 Jun 2000 13:37:32 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Annoying message when opening files
Message-Id: <87pupyvcer.fsf@limey.hpcc.uh.edu>
>> On 3 Jun 2000 18:29:46 GMT,
>> Stan Horwitz <stan@typhoon.ocis.temple.edu> said:
> Value of <HANDLE> construct can be "0"; test with
> defined() at ./xxx line 65535.
> So does anyone know what this error means and how I can
> get rid of it? If so, please let me know.
You're doing something like:
while ($line = <FILEHANDLE>) {
...
}
when you mean
while (defined ($line = <FILEHANDLE>)) {
...
}
since a line which contains just "0" will evalute to
false.
Using $_ via
while (<FILEHANDLE>) {
...
}
is the more usual idiom, this contains an implicit
defined() test.
It's explained in "perldoc perldiag"
Value of %s can be ""0""; test with defined()
hth
t
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Sat, 03 Jun 2000 16:42:45 GMT
From: Keegan at Miller Website Services <keegan@millerwebsiteservices.com>
Subject: Re: Any function to include a HTML file into the Perl script
Message-Id: <3939378C.BACFD647@millerwebsiteservices.com>
Sure, just read the file like any other:
open(HTMLFILE,"<$fileName");
@lines = <HTMLFILE>;
close(HTMLFILE);
$htmlContent = join('',@lines);
Then you can do whatever you want with it.
Keegan
Chu wrote:
> Dear all Perl specialist,
>
> In the PHP, you can include a HTML file inside the script.
>
> Can the Perl do that? If can, how?
>
> Best Rgds,
> Eddie Chu
> chus@netvigator.com
------------------------------
Date: Sat, 03 Jun 2000 15:21:50 -0400
From: prasanth <pmudundi@sunny.zp>
Subject: Anyone use win32::IPROC - help
Message-Id: <39395ACE.A604234B@sunny.zp>
Below is the code from win32::IProc documentation from the author
use win32::IProc;
my($obj)=new Win32::IProc || die;
$obj->EnumProcesses(\@EnumInfo,NOPATH);
my($size)=scalar(@EnumInfo);
for($i=0;$i<$size1;$i++)
{
print "\n Name : $EnumInfo[$i]->{ProcessName}
Id : $EnumInfo[$i]->{ProcessId}
Handle: $EnumInfo[$i]->{ProcessHandle} \n" ;
}
i was never able to get the $EnumInfo[$i]->{ProcessHandle} to have a
value.
the handle never is printed. Is there some thing i am missing.
I intend to use a $obj->getstatus
($EnumInfo[$i]->{ProcessHandle},\$Info,DIGITAL)
using the above handle for CPU Times.
is there any other module for process control like iproc
thanks
prasanth mudundi
p m u d u n d i @ g i s . n e t
------------------------------
Date: Sun, 4 Jun 2000 04:36:34 +1000
From: "Michael Roper" <michael_roper@hotmail.com>
Subject: Re: Execute perl code in a variable
Message-Id: <8hbj3l$dg7$1@metro.ucc.usyd.edu.au>
> I want to execute code that resides in a variable. The code is fetched
> into the variable from a database. How do I execute this code and still
> have access to the resources in my script(the script that runs the code
> in the variable).
>
> So far I have used `perl -e $code_from_database`. But doing this don't
> give the code in $code_from_database access to variables declared in my
> script that runs the command listed above. Also using this command
> starts another instance of perl which takes time and resources.
eval $code_from_database;
> Another question:
> In C you have #define statements. Is there a similiar data type in perl?
Perl doesn't have a separate pre-processor. What did you want to do with a
#define statement?
> Thanks,
> Ole Christian Eidheim
>
------------------------------
Date: Sat, 03 Jun 2000 18:18:02 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: How do I update records in a file? (cgi & perl)
Message-Id: <39394ADB.41932AE7@rochester.rr.com>
Thaddeus wrote:
...
> Ok, great, how do i actually update this file when it is open for reading?
...
> I also need to sort the record by the value of the second field (highest ->
> lowest) as you can see I was trying to do.
...
> Thad.
Thad, for this task, you will be by far best off to use a real database,
not an ASCII flat file (I assume you are talking about a significant
number of records, like hundreds or thousands, not something where you
could just suck the whole thing into memory and rewrite the whole file
for each update). mysql would be good, with Perl's DBI module for an
interface. Maybe even just a tied DBM-style hash would be OK -- check
out DB_File for one that will keep the records sorted as it goes.
With an ASCII flat file, you would need to extend the length of the
field you want to update to be as long as the longest value that will
ever be stored in it, since there is no ability to insert extra
characters in the middle of the file short of rewriting the rest of the
file. Then you can seek to that point in the file and write that many
bytes of information to accomplish the update. Sorting, and even just
finding the record you want to update, will be a problem -- you'll
probably have to search through the entire file just to find a record.
You could make the records fixed-length, which might speed things up.
But even then, inserting a new record in the middle so you can keep it
in sorted order will require rewriting at least the rest of the file.
Or you could add an index file -- but then the rest of it would have to
be rewritten. That stuff is what databases are made for. Let them do
the hard stuff.
--
Bob Walton
------------------------------
Date: Sat, 03 Jun 2000 15:18:30 -0400
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do I update records in a file? (cgi & perl)
Message-Id: <39395A06.B3E5C899@vpservices.com>
Bob Walton wrote:
>
> Thaddeus wrote:
> ...
> > Ok, great, how do i actually update this file when it is open for reading?
> ...
> > I also need to sort the record by the value of the second field (highest ->
> > lowest) as you can see I was trying to do.
> ...
> > Thad.
>
> Thad, for this task, you will be by far best off to use a real database,
> not an ASCII flat file
Or use DBI with one of the drivers that support pipe "delimited" flat
files like yours and handle things like sorting, file locking,
inserting, and updating with premade SQL/DBI commands -- both DBD::CSV
and DBD::RAM will support all that.
--
Jeff
------------------------------
Date: 03 Jun 2000 20:18:50 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: How do I update records in a file? (cgi & perl)
Message-Id: <3939682a$0$2970@nntp1.ba.best.com>
>Thaddeus wrote:
>...
>> Ok, great, how do i actually update this file when it is open for reading?
>...
>> I also need to sort the record by the value of the second field (highest ->
>> lowest) as you can see I was trying to do.
>...
>> Thad.
Use "perldoc DB_File" to read the docs on DB_File.pm; check out the
section on RECNO.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sat, 03 Jun 2000 19:36:29 GMT
From: Glenn Randers-Pehrson <randeg@alum.rpi.edu>
Subject: Re: How to find out height and width of a PNG graphic
Message-Id: <8hbmns$tn5$1@nnrp1.deja.com>
In article <39390780$0$41652@SSP1NO17.highway.telekom.at>,
"Mösl Roland" <founder@pege.org> wrote:
> > >
> > > But I want to change all my sites to PNG
> > > because of this idiotic patent threat with GIF
> [...]
> And after all was done, I found out that
> PNG does not support animated graphics :-(
>
PNG does. The files are called MNG instead of PNG but the individual
images inside are PNGs (or could be JNGs which are JPEGs wrapped
in PNG-style chunks, possibly with alpha-transparency).
Browsers aren't supporting MNG now, though.
Complain to the browser makers about that.
Vote for MNG support in Mozilla at
http://bugzilla.mozilla.org/show_bug.cgi?id=18574
Read more about MNG at
See http://www.libpng.org/pub/mng
and http://www.libmng.com/
--
Glenn Randers-Pehrson
PNG/MNG Development Group
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 3 Jun 2000 22:31:31 +0200
From: "Helza" <helza@planet.nl>
Subject: IP/port check help wanted
Message-Id: <8hbq3i$85vhp$1@reader1.wxs.nl>
Hi,
I really need some help here. I'm building a program which gets information
from Servers which are running. (cgi)
Which goes perfect as long as the server is up.
But as soon as a invalid IP/port is entered or the server is down the
program will load like crazy but nothing happens for a long time, until
after a long time it finally gives any form of error.
And because the program will have to load a number of ip's entered by
visitors and loads these i'm pretty sure always a couple of those ip's will
be offline :(
How do i make a quick ip/port check to see if the server is online?
Currently i use this code:
--------------------
#!/usr/bin/perl
use Socket;
$host = shift || "130.89.225.137";
$port = shift || 63881;
$request =
"\xE0\x69\x88\xCF\x10\x10\x14\x00\x00\xFC\x43\xE2\x35\x6B\xD1\x11\x87\x87\x0
0\xC0\xF0\x16\xAF\x25";
@Type = ( "COOPERATIVE","DEATHMATCH","TEAM DEATHMATCH","KING OF THE
HILL","TEAM KING OF THE HILL","CAPTURE THE FLAG","SEARCH AND DESTROY","ATACK
AND DEFEND","TEAM FLAGBALL" );
@Server = ( "Serve & Play", "Dedicated" );
$iaddr = inet_aton("0.0.0.0");
$proto = getprotobyname('udp');
$paddr = sockaddr_in(3568, $iaddr);
socket(SOCKET, PF_INET, SOCK_DGRAM, $proto) || die "socket: $!";
bind(SOCKET, $paddr) || die "bind: $!";
$| = 1;
$hisiaddr = inet_aton($host) || die "unknown host";
$hispaddr = sockaddr_in($port, $hisiaddr);
defined(send(SOCKET, $request, 0, $hispaddr)) || die "send $host: $!";
$rin = 0;
vec($rin, fileno(SOCKET), 1) = 1;
if( select($rout = $rin, undef, undef, 2) == 0 ) {
print "Content-type: text/html\n\n<font class=R>Server is down</font>\n";
exit;
}
($hispaddr = recv(SOCKET, $responce, 512, 0)) || die "recv: $!";
($type,$dedicated,@ver) = (unpack("C260",
$responce))[248,252,259,258,257,256];
( $mask, @data ) = unpack( "V C36", $responce );
for( $i=0; $i < 32; $i++ ) {
$data[$i] = $data[$i] & ~1 | $mask & 1;
$mask = $mask >> 1;
}
etcetc..and goes on here with the information it got from server :)
------------------------------
Date: Sat, 03 Jun 2000 18:43:01 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Limits on $ENV{} hash ?
Message-Id: <393950B5.9083787E@rochester.rr.com>
Philip Taylor wrote:
>
> I have been using the $ENV hash to set system wide parameters such as
> file names and other system constants. For some reason some of the
> values being set during the initialisation of my program are not being
> set. I have about set about 30 $ENV parameters abd it's seems to be
> the ones set last which are not acccessible from the program.
>
> Is there a limit on the size of $ENV content or on the number of
> entries possible?
You don't say what your OS is. Some braindead OS's that start with W
have limits on the size of their environment space. You may need to
increase that space if you are using one of those OS's. There is a way
to do that, but I don't recall what it is.
>
> If there is a limit, how do I create a global variable with the same
> scope?
I assume you are attempting to communicate these values from one Perl
program to another which runs later? If so, you might try a tied
DBM-style hash. That would reduce your recoding to just changing ENV to
something else and adding a tie statement to the start of each program
and an untie to the end.
>
> Any help appreciated
>
> Phil
--
Bob Walton
------------------------------
Date: Sat, 03 Jun 2000 18:43:06 GMT
From: phil.taylor@bigfoot.com (Philip Taylor)
Subject: Re: Limits on $ENV{} hash ?
Message-Id: <39394ee1.24559903@news.demon.co.uk>
On Sat, 03 Jun 2000 17:54:39 GMT, Dan Sugalski <dan@tuatha.sidhe.org>
wrote:
>Philip Taylor <phil.taylor@bigfoot.com> wrote:
>> I have been using the $ENV hash to set system wide parameters such as
>> file names and other system constants. For some reason some of the
>> values being set during the initialisation of my program are not being
>> set. I have about set about 30 $ENV parameters abd it's seems to be
>> the ones set last which are not acccessible from the program.
>
>What OS, and where aren't the elements of %ENV not being seen? In your
>program? In children your process spawns? In the shell after your program
>exits?
The server s/w is Apache/1.3.9 (Unix) mod_perl/1.21 .
My top level CGI program loads the system globals as follows:-
do "sysconfig.pl";
the above perl script is placed in the cgi-bin directory. a sample of
it is below:-
$ENV{'RZ_DB_CONFIG'} = $ENV{'RZ_DATA_PATH'} . 'config.dat';
$ENV{'RZ_DB_DIVISION'} = $ENV{'RZ_DATA_PATH'} . 'division.dat';
$ENV{'RZ_DB_SEASON'} = $ENV{'RZ_DATA_PATH'} . 'season.dat';
$ENV{'RZ_DB_TABLE'} = $ENV{'RZ_DATA_PATH'} . 'table.dat';
$ENV{'RZ_DB_TEAM'} = $ENV{'RZ_DATA_PATH'} . 'team.dat';
$ENV{'RZ_DB_FIXTURE'} = $ENV{'RZ_DATA_PATH'} . 'fixture_DIV.dat';
.........
other similar lines removed for clarity
........
# this bit loads user specific config daa by reading a data file
my $fname = $ENV{'RZ_DB_CONFIG'};
my $fname = '/home/taylorp/cgi-files/nwcsl/config.dat';
open (CONFIG, "< $fname");
while (<CONFIG>) {
chomp; # no new line
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length; # anything left;
my ($var,$value) = split(/\s*=\s*/, $_, 2);
$ENV{$var} = $value;
}
close (CONFIG);
The $ENV{} variables that are not loaded are those loaded by the WHILE
loop above. I believe this is co-incidence and that it is something to
do with a limit.
------------------------------
Date: Sat, 3 Jun 2000 22:51:01 +0100
From: "MetSeed" <tabs_paradise@yahoo.com>
Subject: Newbie in need of help...
Message-Id: <39397df3@212.18.160.197>
Hello,
I want to test some cgi and perl scripts on my pc without logging on to the
net. So, I downloaded apache for win98 and installed it, and what I want to
know is if I need to have perl on my pc too for that to work ok?
Thanks for your help.
------------------------------
Date: Sat, 03 Jun 2000 18:32:04 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl to write to a text file
Message-Id: <39394E24.F21B14BD@rochester.rr.com>
Rodney Engdahl wrote:
>
> In article <8hb325$d26$1@newssvr03-int.news.prodigy.com>,
> "Navneet Behal" <navneetbehal@bigfoot.com> wrote:
...
> open (FH, "/full/path/to/file/text.txt") || die "Cannot open text file\n";
You need a > in front of the filename to open it for writing.
> print FH "Name=Blah, Blah, Blah &Email=Blah, Blah";
> close FH;
...
-- Bob Walton
------------------------------
Date: Sat, 03 Jun 2000 18:15:44 GMT
From: jonadab@bright.net (Jonadab the Unsightly One)
Subject: Re: Perl unusable as a programming language
Message-Id: <39393783.20404978@news.bright.net>
Russell Bornschlegel <kaleja@estarcion.com> wrote:
> > OTOH I would rather trust my life on a Perl script than on something
> > running on Windows. :-)
>
> How about a Perl script running on Windows?
How about a Perl script running in ActivePerl on Windows '95
in Virtual PC on a Mac emulator designed for Windows running
under WINE on a Linux box?
- jonadab
------------------------------
Date: Sat, 03 Jun 2000 19:06:19 GMT
From: Andrej <webmaster@beautiful-ladies.com>
Subject: Re: Predicted generation of ID numbers
Message-Id: <8hbkv4$shn$1@nnrp1.deja.com>
Thank you very much! It works under Linux!
However I should test and finish script under Windows (Really it will
work under Linux, Windows just for testing)
You could give the code without flock?
Thank you again,
Andrej
http://www.beautiful-ladies.com/
In article <slrn8ji4su.225.efflandt@efflandt.xnet.com>,
efflandt@xnet.com wrote:
> >I need to generate ID number in a range 400-999(I have already IDs
less
> >than 400)
> >
> >Other way, if ID numbers will be generated not chaotically but
> >sequentially, like 400 then 401, 402...(we can write last ID in the
> >file here)
>
> I don't know if this is the most efficient way to do it, but this is
one
> way to safely generate consecutive numbers without getting messed up
by
> multiple hits at once:
>
> #!/usr/bin/perl -w
> $idfile = "id_num";
> if (open(ID,"+<$idfile")) {
> flock ID,2; seek ID,0,0;
> $id = <ID>; chomp($id);
> seek ID,0,0; print ID ++$id,"\n";
> close ID;
> } elsif (open(ID,">$idfile")) {
> $id = 400;
> flock ID,2; seek ID,0,0;
> print ID "$id\n";
> } else {
> print "Can't open $idfile: $!\n";
> exit;
> }
> print "Do something useful with $id.\n";
>
> I also posted an earlier message about how to find the last line in
the
> data file that contains a digit and increment that.
>
--
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 03 Jun 2000 21:00:15 GMT
From: Andrej <webmaster@beautiful-ladies.com>
Subject: Re: Predicted generation of ID numbers
Message-Id: <8hbrkp$10a$1@nnrp1.deja.com>
No problems, I have found a way to remove flock :-)
Just
ID,2; seek ID,0,0;
Now I should add this code to basic script
and use $id as
$ENV{'RAND'} = $id;
I tried
--------------------------------
sub Rnd {
$idfile = "id_num";
if (open(ID,"+<$idfile")) {
flock ID,2; seek ID,0,0;
$id = <ID>; chomp($id);
seek ID,0,0; print ID ++$id,"\n";
close ID;
} elsif (open(ID,">$idfile")) {
$id = 400;
flock ID,2; seek ID,0,0;
print ID "$id\n";
} else {
print "Can't open $idfile: $!\n";
exit;
}
}
$ENV{'RAND'} = $id;
---------------------------------
But it does not work...
However if I do not use "sub"
-------------------------------------
#sub Rnd {
$idfile = "id_num";
if (open(ID,"+<$idfile")) {
flock ID,2; seek ID,0,0;
$id = <ID>; chomp($id);
seek ID,0,0; print ID ++$id,"\n";
close ID;
} elsif (open(ID,">$idfile")) {
$id = 400;
flock ID,2; seek ID,0,0;
print ID "$id\n";
} else {
print "Can't open $idfile: $!\n";
exit;
}
#}
$ENV{'RAND'} = $id;
--------------------------
it works without problems
Please help me!!!
Thank you in advance!
Andrej
http://www.beautiful-ladies.com/
In article <slrn8ji4su.225.efflandt@efflandt.xnet.com>,
efflandt@xnet.com wrote:
> On Sat, 03 Jun 2000, Andrej <webmaster@beautiful-ladies.com> wrote:
> >I need to generate ID number in a range 400-999(I have already IDs
less
> >than 400)
> >
> >Other way, if ID numbers will be generated not chaotically but
> >sequentially, like 400 then 401, 402...(we can write last ID in the
> >file here)
>
> I don't know if this is the most efficient way to do it, but this is
one
> way to safely generate consecutive numbers without getting messed up
by
> multiple hits at once:
>
> #!/usr/bin/perl -w
> $idfile = "id_num";
> if (open(ID,"+<$idfile")) {
> flock ID,2; seek ID,0,0;
> $id = <ID>; chomp($id);
> seek ID,0,0; print ID ++$id,"\n";
> close ID;
> } elsif (open(ID,">$idfile")) {
> $id = 400;
> flock ID,2; seek ID,0,0;
> print ID "$id\n";
> } else {
> print "Can't open $idfile: $!\n";
> exit;
> }
> print "Do something useful with $id.\n";
>
> I also posted an earlier message about how to find the last line in
the
> data file that contains a digit and increment that.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 03 Jun 2000 22:32:01 +0100
From: Greg Thomas <Greg.Thomas@iname.com>
Subject: Re: Problems with MakeMaker om Win32 (ActiveState)
Message-Id: <39397951.A70A18DB@iname.com>
Greg Thomas wrote:
> C:\temp> perl makefile.pl
>
> on everything I've downloaded, the procedure fails to find the
> installation of Perl:
>
> Unable to find a perl 5 (by these names: C:\Perl\bin\Perl.exe miniperl
> perl perl5 perl5.6.0, in these dirs: C:\WINDOWS C:\WINDOWS\COMMAND
> C:\PERL\BIN C:\Perl\bin)
Well, I've done a bit more digging. the problem appears to be in
ExtUtils::MM_Win32.pm, and in particular in the area of:
print "Executing $abs\n" if ($trace >= 2);
$val = `$abs -e "require $ver;" 2>&1`;
if ($? == 0) {
print "Using PERL=$abs\n" if $trace;
return $abs;
} elsif ($trace >= 2) {
print "Result: `$val'\n";
}
It turns out that although the backticks cause perl to executing
"require $ver;" with no problems, $? is always set to -1. A further test
shows that using backticks on just about any command results in $? eq
-1.
Unfortunately, that's about the limit of my knowledge. Any pointers
gratefully received.
TIA,
Greg
------------------------------
Date: Sat, 03 Jun 2000 15:24:08 -0400
From: Chris Wendl <wendlc@cims.nyu.edu>
Subject: reading sizes of large files in Win32
Message-Id: <39395B58.1F33C8B6@cims.nyu.edu>
hello all,
i wonder if anyone has encountered the following: i need a Perl script
running on NT to read the size of a file that may be very, very large.
problem is when the file is larger than 2GB, the OS returns the size as
a 32-bit integer with the 32nd bit activated, and Perl wants to
interpret this as a negative sign; the result is that both stat and the
-s test return a negative file size. now, we can get around this by
doing a little math and converting the negative number into an
appropriate large integer, but i'm also worried about what might happen
if the file ever reaches 4GB (so that the number needs more than 32
bits). is there a more elegant work-around for this... a Win32 module,
or some such thing?
-Chris
------------------------------
Date: Sun, 4 Jun 2000 02:51:03 +0800
From: "Thaddeus" <nayler@SPAMOFFses.curtin.edu.au>
Subject: Require statement kills script
Message-Id: <8hbk39$ffp$1@ftp.curtin.edu.au>
I've only just tried using the require statement, since it seems pretty
handy, ie:
require "common_functions.cgi"; # at the top of the file.
&proc1; #called from "required" file
&proc2;
etc.
Problem is, it kills my script. Debugging doesnt find a problem with it, I
just get a 500 error when it tried to run.
When I take the procedures out of the library and insert them directly into
the script, it works fine... what could be the problem? Variable scope?
Thad.
------------------------------
Date: Sat, 03 Jun 2000 19:47:27 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Require statement kills script
Message-Id: <39395FCC.B6E8188@rochester.rr.com>
Thaddeus wrote:
>
> I've only just tried using the require statement, since it seems pretty
> handy, ie:
>
> require "common_functions.cgi"; # at the top of the file.
>
> &proc1; #called from "required" file
> &proc2;
>
> etc.
>
> Problem is, it kills my script. Debugging doesnt find a problem with it, I
> just get a 500 error when it tried to run.
>
> When I take the procedures out of the library and insert them directly into
> the script, it works fine... what could be the problem? Variable scope?
>
> Thad.
Thad, does your require script end with the line:
1;
? Note that the last line of the require'd code must leave a true value
or require generates an error.
Also, you need to be sure your CGI script can find the file (you did
specify its path from root, right? -- oh, I see from your code you
*didn't*) and that it can read it (it does have world read permission so
the browser can read it, right?).
If you are using the CGI module (you are, aren't you?), try setting the
"fatalsToBrowser" thing in CGI::Carp. That way you can see why your
script died.
--
Bob Walton
------------------------------
Date: Sat, 03 Jun 2000 19:53:28 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Require statement kills script
Message-Id: <8hbnnk$u6r$1@nnrp1.deja.com>
In article <8hbk39$ffp$1@ftp.curtin.edu.au>,
"Thaddeus" <nayler@ses.curtin.edu.au> wrote:
>
> I've only just tried using the require statement, since it seems pretty
> handy, ie:
>
> require "common_functions.cgi"; # at the top of the file.
>
> &proc1; #called from "required" file
> &proc2;
>
> etc.
>
> Problem is, it kills my script. Debugging doesnt find a problem with it, I
> just get a 500 error when it tried to run.
>
> When I take the procedures out of the library and insert them directly into
> the script, it works fine... what could be the problem? Variable scope?
>
> Thad.
>
chances are that your required file does not have a
1;
as its last line?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 3 Jun 2000 21:42:01 GMT
From: Seattle PERL Users Group <spug@halcyon.com>
Subject: Seattle Perl Talks by Damian Conway
Message-Id: <8hbu39$5do$1@brokaw.wa.com>
Keywords: Damian Conway SPUG Seattle meetings seminars talks user groups
Dr. Damian Conway, Perl Guru and author of "Object Oriented Perl", will
be visiting the Seattle, WA area in July from his home in Australia,
thanks in part to a sponsorship arrangement with NeoInformatics
(http://www.neoinformatics.com).
He'll be giving free talks on the evenings of July 5th and 6th, with
the latter being another presentation of his "Quantum Superpositions
and the First Virtue" talk from the June YAPC. Brief outlines follow
below.
Dr. Conway will also be presenting two fee-based training seminars from
July 6-7 entitled "ADVANCED OBJECT ORIENTED PERL" and "BEYOND REGEXES:
TEXT PARSING with PERL MODULES".
For complete details on all the Seattle presentations by Dr. Conway,
see the SPUG (Seattle Perl Users Group) web page,
http://www.halcyon.com/spug
and the Consultix web page
http://www.consultix-inc.com
==============================================================
| Tim Maher, Ph.D. Tel: (206) 781-UNIX |
| SPUG Founder & Leader Email: spug@halcyon.com |
| Seattle Perl Users Group: http://www.halcyon.com/spug |
==============================================================
Seattle Perl Users Group (SPUG) Meetings, July 2000
Sponsored by SPUG and NeoInformatics, www.neoinformatics.com
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
MULTIMETHODS: Polymorphism Gone Mad
Dr. Damian Conway, Monash University, Australia
SPUG Meeting, Union Bank of California., 5th and Madison, Seattle
July 5, 6:45pm
Abstract
<RIGHT_LOBE>
A world gone crazy, as method calls throw off their shackles and
start telling objects "Who ya gonna call?" Plus the secret shame
of subroutine overloading. In Perl!
</RIGHT_LOBE>
<LEFT_LOBE>
A sober and serious talk discussing the technique of multiple
dispatch of object methods, and its implementation in Perl. Ad
hoc approaches will be described and dismissed, and use of the
Class::Multimethods module advocated and explained. The implications
of the multimethod construct as a mechanism for signature-based
subroutine overloading will also be pondered.
</LEFT_LOBE>
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Quantum Superpositions and the First Virtue
Dr. Damian Conway, Monash University, Australia
E-SPUG Meeting, Lucent Technologies, Redmond WA
July 6, 7:00pm
Abstract
Take two quantized disjunctive/conjunctive equiprobable scalar
datastructures, add a dash of multidimensional polymorphism, a
handful of redefined operators, and a pinch of breadth-first optree
evaluation. Simmer gently in the Principle of Least Effort. Decant
into a grandiosely named module. Now serve vector operations (prime
generation, list membership, list extrema, etc.) without loops
or recursion.
(Tim asked me if it's meant to be a parody lecture. I know it looks
that way, but actually it's just like my Coy paper at last year's
TPC: serious science and useful Perl techniques smuggled into
unsuspecting brains hidden behind a dazzlingly stupid idea - Damian)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Damian Conway Professional Seminars, presented by Consultix (7/6,7/7)
Dr. Damian Conway of Monash University, Australia, will be presenting
two one-day seminars from July 6-7 in the Seattle USA area entitled
"ADVANCED OBJECT ORIENTED PERL" and "BEYOND REGEXES: TEXT PARSING
with PERL MODULES".
These fee-based full-day training seminars teach programming professionals
how to accomplish important tasks using Perl. For further details, see
the Consultix web site (www.consultix-inc.com).
------------------------------
Date: Sat, 3 Jun 2000 20:51:27 +0100
From: "B Kemp" <hyagillot@tesco.net>
Subject: Re: the end of perl?
Message-Id: <8hbnur$s4j$1@barcode.tesco.net>
>Boy, is that a blast from the past. That is how twiddle (~) printed on the
>line printers when I was at Cambridge University.
I use the word 'twiddlything' for 'tilde' (~) on purpose because I haven't
got a good formal training in computing (slightly on purpose).
Does this mean that Cambridge educated types use the word 'twiddle'
------------------------------
Date: Sat, 3 Jun 2000 21:20:29 +0100
From: "Alex Gough" <erebus@hushmail.com>
Subject: Re: the end of perl?
Message-Id: <8hbpae$1qc$1@news.ox.ac.uk>
"W Kemp" <bill.kemp@wire2.com> wrote in message
news:959937509.19427.0.nnrp-12.c3ad6973@news.demon.co.uk...
> There was a nine minute delay between your two postings.
>
> Were you wondering whether there could be perl 5.7 with the use of
> $EURO_SIGN that now appears on some keyboards, which would be nice as its
on
> the same key as $.
>
> by the way, what is the shift and backquote thingy (¬) supposed to be
> anyway. I have read that it is 'not' , something that I have never come
> across before.
It gets used by some of my comp-sci friends as a logical not symbol. It's
very useful for writing confusing code as @¬, $¬ and %¬ look like they
should do something special but really act like normal variables.
(I don't know how many people can read the $EURO_SIGN $€ , but perl written
in unicode should support it admirably).
--
Alex Gough
------------------------------
Date: Sat, 03 Jun 2000 19:33:47 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: using 'exists' in a program to test for keys in a hash
Message-Id: <39395C9B.BF5215C7@rochester.rr.com>
RGW303 wrote:
>
> Hello, I've just started learning Perl a few weeks ago and have gone through
> 2 books and for hours I've tried to successfully implement a method for
> storing a retrieving keys and values in a hash DBM database. I'm using
> ActivePerl 5.6. Anyhow my latest problem is testing for keys with the
> 'exists' keyword after loading a hash from a DBM file with the dbmopen()
> function. If I do the following anywhere in my code:
>
> while(exists $hash{"$key_$num"}) { <code...> }
>
> --or something just as similar with an if statement.--
>
> I get the error:
>
> "AnyDBM_File doesn't define an EXISTS method at myprog.pl line xx".
You're not using uppercase for "exists", are you?
>
> Any help would be greatly appreciated.
>
> -RGW303
Well, it works for me using ActiveState Perl build 613. Test code:
use SDBM_File;
use POSIX;
tie(%h,'SDBM_File','junk136',O_RDWR|O_CREAT,0640) or die "Oops, $!\n";
$h{one}=1;
$h{two}=2;
if(exists $h{one}){print "exists\n"}else{print "doesn't exist\n"}
This prints "exists".
You should note that SDBM won't work reliably on FAT or FAT32 file
systems (a percentage of records written are not retrievable). That
means you'll have to use DB_File on Windows 9x if you want it to work
reliably. Besides, it saves four characters when typing the program:
use DB_File;
use POSIX;
tie(%h,'DB_File','junk136',O_RDWR|O_CREAT,0640) or die "Oops, $!\n";
$h{one}=1;
$h{two}=2;
if(exists $h{one}){print "exists\n"}else{print "doesn't exist\n"}
Oh! I see ActiveState changed their dbmopen default to DB_File for
version 5.6 . That's cool! Never mind about the SDBM stuff then.
--
Bob Walton
------------------------------
Date: Sat, 3 Jun 2000 13:41:27 -0500
From: Scott Mikula <mikula@students.uiuc.edu>
Subject: Viewing HTTP Requests
Message-Id: <Pine.GSO.4.10.10006031336330.29029-100000@ux5.cso.uiuc.edu>
I was told this might be a good place to ask this question:
I am trying to write a perl script to automate some of my online activity,
including reading and parsing web pages. Unfortunately I think the HTTP
requests are more than just simple GETs because that doesn't work from my
script; I assume they include more information, whether it be about cookies
or something else.
Is there a way to see the exact request that Netscape is sending out. If
there is an easy way, great, or can someone give me a hint as to how I
might write a script to do that?
Any help or ideas would be greatly appreciated. Thanks!
------------------------------
Date: 3 Jun 2000 19:35:38 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Web Based E-mail Sorting System Required
Message-Id: <slrn8jinga.p50.dha@panix6.panix.com>
On Sat, 03 Jun 2000 14:31:50 GMT, sg@sia.nu <sg@sia.nu> wrote:
>We are an all-online travel agency, dealing with reservation of
>accommodations in Charming Castels, Villas, Hotels, Cottages and
>Farmhouses in Italy.
>
>We have an "urgent" need of implementing a web-based e-mail client in
>order to manage the huge flow of e-mails we are receiving for our
>Website www.Tuscany.net .
You appear to wish to hire a programmer. This, unfortunately is not
an appropriate forum in which to do so. You might wish to as in a
newsgroup that has the word 'jobs' in its name, or post to the
perl-jobs-announce mailing list (details can be found at
www.perl.com).
good luck,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Dealing with problems is only for people too weak to run away from
them. - Phillip, www.goats.com/comix/0002/goats000211.gif
------------------------------
Date: 3 Jun 2000 19:33:10 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Web-based email solutions
Message-Id: <slrn8jinbm.p50.dha@panix6.panix.com>
On Fri, 2 Jun 2000 19:00:56 +0100, A Pietro <apietro@my-deja.com> wrote:
>>A) This newsgroup is not a search engine<
>
>I know that. A newsgroup is an open forum where people are allowed to ask
>questions isn't it?
Not quite. A newsgroup is a forum devoted to the discussion of a
particular topic. Off-topic questions are *not* appropriate, and if
someone wants to tell you so, they're more on topic
than you were.
No offence intended, but you will get more help (and more *correct*
help) by posting in the appropriate forums.
best,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"In my opinion, there's nothing in this world beats a '52 Vincent and
a red headed girl" - James Adie
------------------------------
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 3244
**************************************