[10484] in Perl-Users-Digest
Perl-Users Digest, Issue: 4076 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 26 19:17:27 1998
Date: Mon, 26 Oct 98 16:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 26 Oct 1998 Volume: 8 Number: 4076
Today's topics:
Re: *Why* does clpm attract non-perl posts? <ljz@asfast.com>
Re: [OFF TOPIC] Should I use GPL or The Artistic ? (Ilya Zakharevich)
Re: encryption questions again (Martien Verbruggen)
Re: File download script? (Martien Verbruggen)
Re: Forcing perl to garbage collect (Ilya Zakharevich)
Re: Forcing perl to garbage collect (Michael J Gebis)
Re: getting the date & time directly from perl (Martien Verbruggen)
Re: Help: Multi-dimensional arrays & such <jdf@pobox.com>
Re: Help: Multi-dimensional arrays & such <jdf@pobox.com>
Re: lack of flock() for Win95/98? fix? (Andrew M. Langmead)
Re: Loop problems <m.v.wilson@erols.com>
Re: Not to start a language war but.. <jdporter@min.net>
Re: Not to start a language war but.. <jdf@pobox.com>
Re: Not to start a language war but.. <jdporter@min.net>
Re: Opendir and Readdir not working as expected <geddes@pavlov.col.hp.com>
Re: Opendir and Readdir not working as expected <jdf@pobox.com>
Please Help ! Web Site Maintenance Question <baldyscone@deathsdoor.com>
Re: programing fun: trees: Part... (Martien Verbruggen)
Re: Semephore Help <csutton@att.net>
Size of JPEG and GIF parab0la@my-dejanews.com
Re: web baseed email <jconley@pharmacy.com>
Re: web baseed email (Jason Spears)
Re: What isn't Perl good for? (David Adler)
Re: What isn't Perl good for? <jdporter@min.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Oct 1998 16:57:11 -500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <ltu30rj8aw.fsf@asfast.com>
birgitt@my-dejanews.com writes:
> In article <ltzpajj49z.fsf@asfast.com>,
> Lloyd Zusman <ljz@asfast.com> wrote:
>
> [snipping reason 1 - 4]
>
> >
> > After a suitable amount of deliberation, I rejected reasons 1, 2, and
> > 3, and I settled on number 4 as the most likely case, by far.
>
> Is it possible the answer is much more simple ?
>
> How about: "because all these non-perl posts, even if they are annoying
> to many, produce quite amusing reactions and apparently a lot of people
> like to read through them.
>
> Just imagine how boring clpm would be if all of you just would ignore
> non-perl, FAQ and cgi-questions. :-)
Good point! And where would people like me be able to set up our
soapboxes and pontificate if there weren't all those anti-"newbie"
posts on c.l.p.misc to feed our indignation? :)
--
Lloyd Zusman ljz@asfast.com
perl -le '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'
------------------------------
Date: 26 Oct 1998 22:20:42 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: [OFF TOPIC] Should I use GPL or The Artistic ?
Message-Id: <712sjq$3jb$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Koos Pol
<koos_pol@nl.compuware.com.NO_JUNK_MAIL>],
who wrote in article <711ru1$gce@news.nl.compuware.com>:
>
> I want to release a Perl script soon in the spirit of Open Source. Are there
> good reasons why I shoud choose the GPL or the Artistic License ?
> (For the sake of argument: "...under the same license as Perl..." is no
> reason). After reading the licenses carefully, most significant
> difference is that the Artistic license seems less strict.
>
> I couldn't find comparing threads in gnu.discuss.misc. Also in clpm, the
> only relevant thread I could find was on licensing documentation.
There were many threads about this lately. My (subjective) summary:
a) GPL-only is often frowned upon in the Perl world;
b) Artistic-only does not invoke that warm-and-fuzzy feeling in
some people (who know implications of GPL, but not of AL).
Conclusion: just distributite your code "under the same conditions as
Perl": GPL or artistic, whatever they choose.
Ilya
------------------------------
Date: Mon, 26 Oct 1998 23:14:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: encryption questions again
Message-Id: <5n7Z1.106$z05.132585@nsw.nnrp.telstra.net>
In article <3634aa96.358401163@193.74.210.130>,
Frook@mail.dma.be (Orlando Frooninckx) writes:
> Hi Everyone,
>
> for some crypting of personal files I was trying to put some crypting
> source I found into a procedure. this procedure goes wrong after a
> while though. Does anyone have any notice on how to correct this? Is
> this a safe method or not?
After a while? What does that mean? Goes wrong? How does it go wrong?
You'll need to be more specific than that.
> sub EnDeCrypt {
> # Localize variables and assign subroutine input.
> local( $CryptString, $Password ) = @_;
> local( $Crypted ) = '';
> local($crypt_array_item) = '';
> local($for_couter_255) = 0;
> local($arrayloop) = 0;
> local(@crypt_array) = ();
> local(@s) = ();
> local(@k) = ();
> local($unpacked)='';
> local($i) = 0;
> local($x) = 0;
> local($y) = 0;
I am pretty certain that my would be a lot better on all these
declarations, and that that will actually do what you mean it to do.
You know that you can declare variables when you want to use them? No
need to put them at the top of the block. it won't hurt either.
If you use my, and use strict, it'll help you a bit, keeping track of
what is declared and what isn't. If you use -w, it'll also keep track
of other things for you.
> (@k=unpack('C*',pack('H*',$Password)))||die"script
> miss-used\n";
>
> for($for_couter_255=0; $for_couter_255<256; $for_couter_255++)
> {
> $s[$for_couter_255] = $for_couter_255;
> }
# You could have of course done this in the above declaration.
@s = (0 .. 255);
> for($for_couter_255=0; $for_couter_255<256; $for_couter_255++)
Why do you terminate the loop above, and start and identical one here?
> {
> $y=($k[$i]+$s[$for_couter_255]+$y)%256;
$s[$for_couter_255] of course is just equal to $for_couter_255
I can't see anything much wrong with this, but then, I don't have the
original algorithm you're working with. So it's hard to compare that.
The rest of it is a bit cryptic (no pun intended), and you make it
even harder to read by not using any spacing anywhere.
Anyway, Since you mention that it 'goes wrong after a while', maybe
the scoping of your variables with my might help. Unless you tell us
what exactly goes wrong, it's hard to tell.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 26 Oct 1998 23:03:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: File download script?
Message-Id: <ed7Z1.104$z05.132585@nsw.nnrp.telstra.net>
In article <1998Oct26.151643.21697@relay.nswc.navy.mil>,
wmorgan@nswc.navy.mil (Bill Morgan) writes:
> I am looking for a way to download files from my web server to my
> local PC without using standard http links. Is this possible? I
> have a Perl script to upload files from my PC to the server, and I
> am looking for something similar for downloads.
It depends on what you mean with 'without using standard http links'.
Do you want to use a non-standard http protocol? Do you not want to
use HTTP at all? If it's a _web_ server, that may be the only protocol
available to you. Otherwise you might want to have a look at things
like FTP or rcp.
I can't imagine at all why you wouldn't want to use HTTP though. HTTP
is meant for traffic in this direction. It's uploads that are normally
done through other protocols.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 26 Oct 1998 22:25:03 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Forcing perl to garbage collect
Message-Id: <712srv$3r1$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Michael J Gebis
<gebis@fee.ecn.purdue.edu>],
who wrote in article <712i4p$k14@mozo.cc.purdue.edu>:
> I also think that 1) you can't force perl to garbage collect without
> exiting
Perl does not collect garbage. At all. (Except primitive refcounting.)
Hope this helps,
Ilya
------------------------------
Date: 26 Oct 1998 23:23:48 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Forcing perl to garbage collect
Message-Id: <7130a4$3k0@mozo.cc.purdue.edu>
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
}[A complimentary Cc of this posting was sent to Michael J Gebis
}<gebis@fee.ecn.purdue.edu>],
}who wrote in article <712i4p$k14@mozo.cc.purdue.edu>:
}> I also think that 1) you can't force perl to garbage collect without
}> exiting
}Perl does not collect garbage. At all. (Except primitive refcounting.)
I was talking about whatever the man page was talking about when it
said to me:
When an interpreter thread finally shuts down (usually when
your program exits), then a rather costly but complete
mark-and-sweep style of garbage collection is performed, and
everything allocated by that thread gets destroyed.
That actually sounds like perl does collect garbage using something
other than primitive refcounting. It just doesn't do it at a
convenient time: it only does it when the program exits (well, thread
shuts down,...). Not useful for reclaiming memory, but it still sounds
like garbage collection.
Obviously, you are more familiar with the internals: did I mis-read
the man page, or misinterpret something?
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Mon, 26 Oct 1998 23:36:36 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: getting the date & time directly from perl
Message-Id: <8I7Z1.120$z05.132585@nsw.nnrp.telstra.net>
In article <3634FCCA.E731B76C@worldnetcorp.com>,
Chintan Adhyapak <ChintanA@worldnetcorp.com> writes:
> Not really native Perl equivalent but....
>
> ($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
> $mon++;
> if (length($mday)==1) { $mday="0".$mday } # pad a 0 if 1 digit
> same for other vars
> $sysdate=$mday$mon$year;
^^^^^ Y2K bug
That zero padding can more easily be done by using sprintf, and
incrementing $mon can also be done in that same line, and since
localtime returns the number of years since 1900, you'll have to deal
with years larger than 2000 the right way:
my ($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
my $sysdate = sprintf( "%02d%02d%02d", $mday, $mon+1, $year%100 );
(Note: The original question was a strftime format of "+%d%m%y")
Of course, if you need more flexibility and don't want to reinvent the
wheel, look at the strftime function in the POSIX module.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 26 Oct 1998 23:27:21 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Ralph <rweaver@raex.com>
Subject: Re: Help: Multi-dimensional arrays & such
Message-Id: <m3sogbvu0m.fsf@joshua.panix.com>
Ralph <rweaver@raex.com> writes:
> @arr3 = \(@arr1,@arr2);
This is equivalent to
@arr3 = (\@arr1, \@arr2);
Is that what you meant?
> Also if someone has a good multidimensional array/hash/vect/etc/etc
> faq and would point me that direction i would really appreciate it.
% perldoc perlref
% perldoc perllol
% perldoc perldsc
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 26 Oct 1998 23:31:22 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Ralph <rweaver@raex.com>
Subject: Re: Help: Multi-dimensional arrays & such
Message-Id: <m3pvbfvttx.fsf@joshua.panix.com>
Ralph <rweaver@raex.com> writes:
> @arr4 = @arr3[0];
While much of my last post still stands, I see what you're looking for
now. You want:
@arr4 = @{$arr3[0]};
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Mon, 26 Oct 1998 22:26:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: lack of flock() for Win95/98? fix?
Message-Id: <F1GGzz.1xD@world.std.com>
danbeck@eudoramail.com (Daniel Beckham) writes:
>If you need to open a file named myfoo for read or write, first create a
>file named myfoo.lock. When you are finished reading or writing to the
>file, delete the foo.lock file. At the same time, before you begin to
>read or write to a file, check to make sure there isn't already a
>myfoo.lock file and if there is, sleep for a few seconds, check again,
>and if the myfoo.lock file has been deleted, create your lock file and
>then read or write to the file.
This opens yourself up to race conditions. You are better off using
the suggestions in <URL:http://www.perl.com/CPAN-local/doc/manual/
html/pod/perlfaq5.html#What_can_t_I_just_open_FH_fil> if you can't
successfully flock().
>You can even have a preset time that if the lock file doesn't go away in
>say, 5 seconds, you just go ahead and read or write to the file, assuming
>that the other process has bombed, etc. Not the most elegant way, but
>very workable and easy to implement...
A similar system is for a process to write its PID into the lock file
after it creates it, and when a program finds a potentially used lock
file, it should look for a currently running process with that PID. If
it finds a process with that PID, the resouce is still locked. If it
can't find a process with that PID, the process must not have cleaned
up after itself, and the lockfile can be removed. It can create some
false positives (what if a the process that had the PID goes away, the
process IDs wrap around back to the beginning again, but the new
process that gets the PID is a long running process like a shell) but
is better than assuming that a particluar process can not run for more
than X amount of time.
--
Andrew Langmead
------------------------------
Date: Tue, 27 Oct 1998 00:03:38 +0000
From: WMWilson <m.v.wilson@erols.com>
Subject: Re: Loop problems
Message-Id: <36350DDA.41062EB9@erols.com>
baillie@my-dejanews.com wrote:
>
> I'm trying to loop through the following program so as to re-display the menu
> after each action is complete, here's the script:
>
> Someone Please tell me what I'm doing wrong here, I'd really rather not limit
> this to one iteration.
>
<snip>
> print <<End_Of_Menu; <- if i assign "$choice = 0" and put an
> \nPlease choose a menu item:\n until($choice ==4 ) {
> \t\t1) Add a record the program will iterate through
> \t\t2) View a record once and re-display the menu,
> \t\t3) Edit a record but when another $choice is
> \t\t4) Quit\n supplied, it just hangs there.
> End_Of_Menu this also happens with a while($choice != 4)...
>
> print "Enter Choice: ";
> chomp($choice = <STDIN>);
>
> if($choice == 1) {
> &add_entry;
> } elsif($choice == 2) {
> &view_entry;
> } elsif($choice == 3) {
> &edit_entry;
> } elsif($choice == 4) {
> exit;
> } else {
> print "\nNot a valid choice, exiting\n";
> }
> <- closing brace here..........
<snip>
> open(LOG, $logfile) or die "Couldn't open file: $!";
>
> $/ = '';
> while(<LOG>) {
> print if /\Q$keyword/s;
> }
> close(LOG) or die "Couldn't close file: $!";
<snip>
You were on the right track, the problem here is that you never reassign
$/ to "\n" and therefore, when you make your next selection, if it
happens to be 2, it's waiting for paragraph like input (2 newlines),
rather than a newline. I would just stick with the if($choice ==4)
{exit;} and do something like
while(1) {
menu
if/else stuff
}
That way it stays real simple and the user still maintains control.
I bet if you were to choose 1 or 3 on the second loop it would work,
just remember that you want to leave things the way you found them.
--
\||/
(..)
+---oOOo-----(_)-----oOOo-----+
| mailto:m.v.wilson@erols.com |
| WMWilson |
|__USCS Data Center Sysadmin__|
------------------------------
Date: Mon, 26 Oct 1998 17:06:49 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3634F279.BBAA9138@min.net>
Klaus Schilling wrote:
>
> Cool syntaxes like Scheme's don't need curly braces or indentation for
> delimiting blocks, so there's no advantage in using either.
Best answer I've heard yet.
But it still begs another (related) question:
If Scheme's syntax is so cool, why is it used even less than Python,
not to mention Perl?
Clearly the extent to which programmers pick up (and make long-term
use of) a language depends on more than how it sets off blocks.
I believe a combination of subtle human factors has contributed
to Perl's popularity. They stem (IMHO) from Perl's fundamental
philosophy of being highly non-orthogonal. It is acceptable and
encouraged, both by the design of the language and by the Perl
community, to be productive at every stage of the learning
process, regardless (almost) of one's programming background.
Perl is "multi-paradigm"; and by paradigm I mean not just OO,
structured, and functional, but language-specific mindsets like
C, sh, awk, Basic, Pascal, Fortran.
--
John Porter
Please Don't "Courtesy CC" me.
I read clpm fanatically. You know that!
("Emailed only" is fine, though.)
------------------------------
Date: 26 Oct 1998 23:19:20 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Not to start a language war but..
Message-Id: <m3u30rvudz.fsf@joshua.panix.com>
wlfraed@ix.netcom.com (Dennis Lee Bieber) writes:
> Dropping out the prosecutors role: I have had the last two
> variants of the Camel book and have been unable to even make sense
> of "Hello World". A weekend with the Python docs and I managed to
> write an SMTP email sending program for my Amiga.
This is less evidence of anything concerning the legibility of Perl
than it is evidence of your particular response to these two
languages. When *I* first opened the blue camel, I felt like I'd
found a home.
Larry Wall is a linguist by trade, and an erudite fellow by nature.
Perl is suffused by his personality. It's a rich language. I love
it. It's fun.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Mon, 26 Oct 1998 17:29:58 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3634F7E6.84E99667@min.net>
Carey Evans wrote:
>
> I'm not even sure if I prefer Perl's {...} over Rexx's Do .. End.
I don't know about Rexx, but I sure don't like sh's requirement
to separate keywords with semicolons if on the same line.
> Perl definitely beats Rexx almost everywhere else though. (Maybe I
> should crosspost this to comp.lang.rexx and see what they think?)
Hmm, is there anyone reading that newsgroup? ;-)
> $x && y(); # or should that be "and"?
I would use and.
> And sometimes I prefer:
>
> pw = open("/etc/passwd")
> while 1:
> line = pw.readline()
> if line == "": break
> do_something(line)
> pw.close()
>
> over:
>
> open(PW, "/etc/passwd") || die "open failed: $!";
> while (<PW>) {
> do_something($_);
> }
> close(PW) || die "close failed: $!";
>
> especially when written by someone who forgets to check return values.
I'm sorry, I didn't realize you were talking about what you would
prefer to *read*. With the exception of exceptions, the Perl
code is surely more concise. That is to say,
while (<PW>) {
do_something($_)
}
is more concise than
while (1) {
my $line = <PW>;
defined $line or last;
do_something($line);
}
> BTW, I've always wanted to know this: what happens in the Perl example
> if the read returns an error (e.g. an I/O error), as opposed to an
> end of file?
Good question. Maybe it sets $!, which you could test if this
is a serious concern. It's not something I've ever been bitten by.
--
John Porter
Please Don't "Courtesy CC" me.
I read clpm fanatically. You know that!
("Emailed only" is fine, though.)
------------------------------
Date: 26 Oct 1998 15:14:56 -0700
From: Bill Geddes <geddes@pavlov.col.hp.com>
Subject: Re: Opendir and Readdir not working as expected
Message-Id: <x97sogbrmvz.fsf@fat-tire.col.hp.com>
In your 'readdir' invocation, put something like the following:
@files = grep( ! /^\./, readdir(DIR));
it just works.
--
Bill Geddes
------------------------------
Date: 26 Oct 1998 23:37:33 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Opendir and Readdir not working as expected
Message-Id: <m3n26jvtjm.fsf@joshua.panix.com>
smithw@nospam.spam.com (Walter Smith) writes:
^^^^^^^^^^^^^^^^^^^^^^
What the frig is your actual address, so that I might cc: you?
> chdir "/etc/lvmconf/";
Oops, forgot to check the success of chdir(). (Not related to your
bug, though.)
> @files = readdir(DIR) || die "cant readdir";
You've been bitten by precendence: the precedence of || is higher than
that of =, and forces readdir() into scalar context. Either use "or"
or use parens:
@files = readdir(DIR) or die "$!";
(@files = readdir(DIR)) || die "$!";
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Mon, 26 Oct 1998 23:27:50 -0000
From: "Baldy Scone" <baldyscone@deathsdoor.com>
Subject: Please Help ! Web Site Maintenance Question
Message-Id: <7130i8$o34$1@newnews.global.net.uk>
Please help,
I have a very large web site to administer, and now i need to change a few
lines on every page on the site, reflecting some recent changes. This
wouldn't be a problem if the site was locally hosted, but it is hosted on an
ISP some 500 miles from my place of work.
The server is unix, running perl 5.
My question is, does anyone know of a script that will allow me to globally
search and replace a text string on every .htm document on the site. I need
this badly, and am even prepared to pay.!!
Again, please help.
Regards
Baldy Scone
------------------------------
Date: Mon, 26 Oct 1998 22:46:27 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: programing fun: trees: Part...
Message-Id: <7Z6Z1.96$z05.132585@nsw.nnrp.telstra.net>
In article <36321af5$0$6383@nntp1.ba.best.com>,
"Xah" <xah@best.com> writes:
> Long lines in my post or email are intentional. I'll be posting my code
> tomorrow or comment on Rick Delaney's (if any).
That's a *plonk*able remark.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 26 Oct 1998 17:09:52 -0500
From: "Lynxus News" <csutton@att.net>
Subject: Re: Semephore Help
Message-Id: <br6Z1.2788$Gh.1258559@news2.randori.com>
Here is some code I have used (on HP-UX)
#
# Try and Get the Semaphore ID if it exists
# If it does not exists then this is the first time and
# we will create the semaphore with our key. After we
# create it we must release it so that when we try to take
# it later we will not hang
#
$semid = semget ("12345", 1, 0666);
if ( $semid eq "" ) {
$semid = semget ("12345", 1, 01666);
$semnum = 0;
$semflag = 0;
$opstring = pack ("sss", $semnum, $semop = 1, $semflag);
semop ($semid, $opstring);
}
#
# Take the Semaphore to lock the Shared Memory while we
# are processing and updating it
#
$semnum = 0;
$semflag = 0;
$opstring = pack ("sss", $semnum, $semop = -1, $semflag);
semop ($semid, $opstring);
.....Do stuff here.....
#
# Release the semaphore
#
$opstring = pack ("sss", $semnum, $semop = 1, $semflag);
semop ( $semid, $opstring );
Hope this helps,
Chip Sutton
Bob Mariotti wrote in message <3635905e.18631103@news.tiac.net>...
>Can someone help, please:
>
>We have scoured the FAQ's and come up empty. We are trying to control
>access to a serial port with a CGI script. To prevent interlacing by
>multi-taking we would like to use a semaphore to control access.
>We have spent the last several days trying to implement this logic
>with no luck (on our IBM AIX box)
>
>Can someone please provide a snipit of code as an example of
>setting/waiting then releasing these semephores?
>
>Thanks in advance.
>
------------------------------
Date: Mon, 26 Oct 1998 21:03:27 GMT
From: parab0la@my-dejanews.com
Subject: Size of JPEG and GIF
Message-Id: <712o2v$tb7$1@nnrp1.dejanews.com>
Hi all,
I'm writing a small HTML generator in PERL, and wants to find out the size of
GIF and JPEG images. So that I can write the HEIGHT= and WIDTH= options in
the <IMG> tag. What is the most suitable way to do it? Should I use PERL to
parse the header of those files? Or is there any external command that I can
call?
Thx!
--
Parabola - the famous curve.
URL: http://parabola.home.ml.org/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 26 Oct 1998 16:26:20 -0500
From: Jordan Conley <jconley@pharmacy.com>
Subject: Re: web baseed email
Message-Id: <3634E8FC.EA8418F0@pharmacy.com>
James King wrote:
>
> My company is looking into providing web-based email for our clients and we
> have not been able to find a program that can allow our users to just type
> in their login name and password and have it check their mail. All the
> programs that we have found are NT based and don't look directly to the mail
> server to verify login and password. IS there any perl programs that you
> know of that will provide us with the service we need.
>
> Any comments or advice would be appreciated
> --
>
> ----------------------------------------------------------------------------
> -----------
> Sent via TFBnet - Your Connection to the world!
> ----------------------------------------------------------------------------
> -----------
Not perl based, but a program called Mailspinner will do exactly what
you want.
Jordan
--
Jordan Conley
RoTech Medical
Location 9995
------------------------------
Date: 26 Oct 1998 22:56:56 GMT
From: jspears@usit.net (Jason Spears)
Subject: Re: web baseed email
Message-Id: <712uno$lu4$1@us3.usit.net>
In article <3634E8FC.EA8418F0@pharmacy.com>,
Jordan Conley <jconley@pharmacy.com> writes:
> James King wrote:
>>
>> My company is looking into providing web-based email for our clients and we
>> have not been able to find a program that can allow our users to just type
>> in their login name and password and have it check their mail. All the
>> programs that we have found are NT based and don't look directly to the mail
>> server to verify login and password. IS there any perl programs that you
>> know of that will provide us with the service we need.
>>
You might check out Mailman, http://www.endymion.com/
Jason Spears
------------------------------
Date: 26 Oct 1998 22:32:38 GMT
From: dha@panix.com (David Adler)
Subject: Re: What isn't Perl good for?
Message-Id: <712ta6$rp1@news1.panix.com>
On Wed, 21 Oct 1998 18:00:49 GMT, Elaine -HappyFunBall- Ashton
<eashton@bbnplanet.com> wrote:
>Uri Guttman wrote:
>
>> hey we should do this. if all pm members were to invest, we could create
>> a geek pub. i am tired of all the irish pubs here. we have had pm
>> meetings in most of the brewpubs and nothing works out well for us (some
>> combination of good food, beer, service and privacy (less outside noise
>> so we can make our own).
>
>Actually, I've already hired someone to do a business plan over the
>weekend. It will be here in Boston, of course. Now to find the perfect
>location. :) Good food, folks and fun and Perl. I've always wanted to do
>this.
Cool! And I *like* the name "Foo-Bar". :-) Thanks, Joergen!
Darts, anyone?
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Hey you! Don't watch dat! Watch thees! This is the heavy, heavy
monster sound!" - Madness
------------------------------
Date: Mon, 26 Oct 1998 18:09:33 -0500
From: John Porter <jdporter@min.net>
Subject: Re: What isn't Perl good for?
Message-Id: <3635012D.196BFAB4@min.net>
Michael Lewchuk wrote:
>
> Perhaps you'd like to hire someone to write a 3DFX card device driver
> in PERL for you, then be forced to maintain it.
Obviously C, and other assembly-language variants, are good for something.
After all, the Perl interpreter is written in C.
BTW, Perl is not an all-uppercase word. Maybe you've been hanging around
C/C++ too long.
> From my POV, it depends on what you're doing. If you're playing with UNIX
> commands all day, PERL takes a real load off the old keyboard (and the fingers
> thereby).
If you mean Perl makes a satisfactory shell language, useful for gluing
together calls to sed, awk, grep, sort, ps, ls, and so on, then Yes, you're
right; but that's not nearly as efficient (99.9% of the time) as performing
the equivalent tasks with Perl's built-in functions.
And if you mean Perl's built-in functions make satisfactory replacements
for their equivalent Unix commands, then Yes, you're right.
> If you're busy doing something that can't be explained as a simple
> set of UNIX commands, then it's time to go for the old C/C++ manual.
Um, Perl is a complete, full-featured programming language.
Sure, it's much higher-level than C; that doesn't make it *less* of a
language.
What, I suppose Lisp isn't a programming language, from your POV?
> If it's a batch job, use PERL, if it's a program, use C/C++.
I object to the imperative tone of this proverb.
It's author has seriously underestimated the power of Perl.
Either that or grievously overstimated the power of C.
> Also, from my POV, PERL is treated as a programming language, which it's not.
So much for your credibility. (Not that you had any to begin with.)
People treat it as a programming language because it *is*.
> If you try to treat it like one, you will fail miserably in producing good
> code.
Before you go spouting such uninformed nonsense, take a trip through
the real world. I and many others treat Perl with the respect it
deserves -- as a programming language -- and it has not let us down,
enabling to consistently deliver good code.
> Either it'll be illegible, unmaintainable, buggy, incomprehensible, or
> all of the above.
Speaking for yourself, I'm sure. I'm more inclined to think you're
simply in the wrong line of work.
> You'll try to turn a program into a batch job, thereby
> producing a botch job instead.
Even if all your previous (incorrect) assertions were true, this last
does not follow. Nice try, though.
> The only reason to move from C/C++ to PERL is that you can do many high-level
> useful things easily. PERL is not better than C/C++, it's just easier on the
> brain and fingers for high-level tasks.
Well "better" is a pretty subjective qualification; if "goodness" is being
able to do high-level tasks easily, then Perl is better than C/C++.
--
John "Throbblefoot" Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
"The people at the Grey Hotel
Are either aged or unwell." -- EG
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4076
**************************************