[7817] in Perl-Users-Digest
Perl-Users Digest, Issue: 1442 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 9 15:07:26 1997
Date: Tue, 9 Dec 97 12:00:25 -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 Tue, 9 Dec 1997 Volume: 8 Number: 1442
Today's topics:
Re: [Q] MacPerl Dialog Item Manipulations <neeri@iis.ee.ethz.ch>
best way to find new ora.com releases cheaply (was Re: <Russell_Schulz@locutus.ofB.ORG>
Re: Checking if integer/real <clark@s3i.com>
Re: Checking if integer/real (Matthew Cravit)
Re: Checking if integer/real <tchrist@mox.perl.com>
Re: Dynamic text-to-GIF utility (Andrew Haveland-Robinson)
Re: Filtering out unneeded header files <felscher@innovative-web.com>
Re: Graphing (brian d foy)
Re: Graphing <chawla@corp.home.net>
Re: help for Checking input to match a certain pattern (brian d foy)
Help using Net::FTP... <mgousset@nmhs.net>
Re: how can I fork a process from the Web.. (brian d foy)
Re: how do I make perl script interact with shall comma (Matthew Cravit)
Re: Is Perl V5 available for NT 4.0 (Jonathan Stowe)
Re: multipile comments lines . (brian d foy)
Re: multipile comments lines . (Martin Vorlaender)
Re: multipile comments lines . <chawla@corp.home.net>
Multiple tie/untie on gdbm database failing (Steve van der Burg)
Need help stripping whitespace (Rob Braden)
Perl for Win 32 - please help! <bsnenyprg@global2000.com>
Re: perl stumper (brian d foy)
Re: Perl,select and mrtg <ohp@pyrenet.fr>
Running Perl in "NICE" mode? <ptomsic@pop.pitt.edu>
Re: Sorting huge array (Andrew M. Langmead)
strongly-typed or not? (was Re: Recommended PERL-book?) <Russell_Schulz@locutus.ofB.ORG>
Re: strongly-typed or not? (brian d foy)
translate forms to mail (Denis)
Using FTP.pm with a firewalls (need script examples) <paulo@xilinx.com>
Re: Wildcards <Russell_Schulz@locutus.ofB.ORG>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 09 Dec 1997 20:35:00 +0100
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: [Q] MacPerl Dialog Item Manipulations
Message-Id: <86zpmajonv.fsf@iis.ee.ethz.ch>
alviani@ix.netcom.com (Alviani, Frank) writes:
> For the quicky interface involved, I'm using a dialog with a series of
> buttons to invoke subroutines for the different discrete steps of the
> processing involved (nothing exceptional here, except how compact it is in
> MacPerl!) My problem involves working with the controls in the dialog,
> beyond invoking a routine for a hit. I'd like to be able to enable/disable
> certain buttons during the course of the user interaction, and need to
> maintain at least 1 set of radio buttons. With straight C/Pascal code, this
> is simple - pass a typecast itemHandle to the appropriate control manager
> functions.
Yes.
> My question is simple - how do I do this in MacPerl?
I'm afraid I left out a convenient access to that functionality in current
releases of MacPerl.
> Simply passing the itemHandle of an item to one of the Mac::Controls
> functions doesn't work, as it isn't a CONTROL created within Perl.
As a workaround, try the example below:
Matthias
-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri
"We all enter this world in the same way: naked; screaming; soaked in
blood. But if you live your life right, that kind of thing doesn't
have to stop there." -- Dana Gould
#!perl
=head1 NAME
CheckBox - modal dialog with somewhat more complicated controls
=head1 DESCRIPTION
This script displays a modal dialog with a checkbox.
=cut
use Mac::Windows;
use Mac::Dialogs;
use Mac::Controls;
#
# This function was omitted from current versions of MacPerl, but will
# be added to a future release
#
sub GetDialogItemControl {
my($dlg,$item) = @_;
my($type,$handle,$box) = GetDialogItem($dlg,$item);
return $type & kControlDialogItem ? bless($handle, "ControlHandle") : undef;
}
$dlg =
new MacDialog
new Rect(20, 40, 320, 180), "Hey you!", 1,
kMovableModalDialogVariantCode, 1, (
[ kButtonDialogItem, new Rect( 10, 110, 90, 130),
"OK" ],
[ kButtonDialogItem, new Rect(115, 110, 195, 130),
"Cancel" ],
[ kCheckBoxDialogItem, new Rect( 10, 75, 190, 95), "Let me out"],
[ kStaticTextDialogItem, new Rect( 10, 10, 190, 70),
"I'm trapped in a Perl script" ]
);
$okbutton = GetDialogItemControl($dlg->window, 1);
$check = GetDialogItemControl($dlg->window, 3);
SetDialogDefaultItem $dlg->window, 1;
SetDialogCancelItem $dlg->window, 2;
$dlg->item_hit(1 => sub { $OK = 1; });
$dlg->item_hit(2 => sub { $OK = 0; });
$dlg->item_hit(3 => sub {
SetControlValue $check, !GetControlValue($check);
HiliteControl $okbutton, (GetControlValue($check) ? 0 : 255);
});
SetControlValue $check, 1;
$dlg->modal until defined $OK;
print "You clicked ", ($OK ? "OK" : "Cancel"),
" while the check box was ",
(GetControlValue($check) ? "on" : "off"), ".\n";
dispose $dlg;
------------------------------
Date: Tue, 9 Dec 1997 14:46:54 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: best way to find new ora.com releases cheaply (was Re: Q: Learning perl with no progr. experience)
Message-Id: <19971209.144654.0p9.rnr.w164w_-_@locutus.ofB.ORG>
Randal Schwartz <merlyn@stonehenge.com> writes:
> No, can't say anything in public about content or timeline, but keep
> watching www.ora.com.
or biz.oreilly.announce (moderated).
oh no, wait, they stopped using that in May. gnash.
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: 09 Dec 1997 13:32:48 -0500
From: Clark Dorman <clark@s3i.com>
Subject: Re: Checking if integer/real
Message-Id: <doh2qnz8v.fsf@s3i.com>
"Hans Van Lint" <hvanlint@lodestar.be> writes:
> I check the user's input like this (integer/real or not):
>
> $response = ($veld =~ /^\d+$/) ? "OK" : "NOT INTEGER/REAL";
>
> My problem:
>
> Users can't fill in real numbers like 0.001, 3.35, ...
>
> Somehow my code sees the point in the real number as a part of a string.
>
> I want the user to be able to fill in real numbers,
> how do i change my code to make this possible??
I don't think that this is so hard. Which part was troubling you?
I'll assume that you do not want to accept 3.0E3
The number can be positive or negative so it may or may not have a single "-"
at the beginning (use -?). There may or may not be some numbers before a
decimal point (\d*), may or may not be a single decimal point (\.?), and
numbers after the decimal point ( \d* ). The only hitch I had was that I
didn't want "-." to pass the test so I made sure that there was at least one
number in there.
Try:
$blah = <STDIN>;
if ( $blah =~ /\d/ and $blah =~ /^-?\d*\.?\d*$/) {
print "Yes matched \n";
}
Alternately, you could check dejanews like I did and you can find Mike Stok's
response of a while ago that included the followign from BigInt.pm:
s/\s+//g; # strip white space
if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ && "$2$4" ne '') {
&norm(($1 ? "$1$2$4" : "+$2$4"),(($4 ne '') ? $6-length($4) : $6));
} else {
'NaN';
}
which does test for 3.0E3 and does the 'is there a digit in there someplace'
using the $2$4 ne ''.
_or_ you could see Tom Christiansen's post from the same thread that includes
the following:
----------------------------------------------------------------------
:Does anyone know a good way to test if a variable is a number?
Why yes: the standard perl online {man,web,pod}pages know,
and now you do, too:
% man perldata
...
To find out whether a given string is a valid non-zero
number, it's usually enough to test it against both
numeric 0 and also lexical "0" (although this will cause
-w noises). That's because strings that aren't numbers
count as 0, just as they do in awk:
if ($str == 0 && $str ne "0") {
warn "That doesn't look like a number";
}
That's usually preferable because otherwise you won't
treat IEEE notations like NaN or Infinity properly. At
other times you might prefer to use a regular expression
to check whether data is numeric. See the perlre manpage
for details on regular expressions.
warn "has nondigits" if /\D/;
warn "not a whole number" unless /^\d+$/;
warn "not an integer" unless /^[+-]?\d+$/
warn "not a decimal number" unless /^[+-]?\d+\.?\d*$/
warn "not a C float"
unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
If you'd like more explanation (or at least, longer), read this:
% netscape http://www.perl.com/perl/everything_to_know/is_numeric.html
----------------------------------------------------------------------
and of course the man, pod, and web pages are where you should always check
first.
--
Clark Dorman "Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html -Francis Crick
------------------------------
Date: 9 Dec 1997 10:44:14 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Checking if integer/real
Message-Id: <66k3hu$akv$1@shell3.ba.best.com>
In article <66jte3$68m$1@news2.xs4all.nl>,
Hans Van Lint <hvanlint@lodestar.be> wrote:
>I check the user's input like this (integer/real or not):
>
> $response = ($veld =~ /^\d+$/) ? "OK" : "NOT INTEGER/REAL";
>
>I want the user to be able to fill in real numbers,
Hmm...the regexp I came up with was:
/^-?(0|[1-9]+)(\.\d+)?$/
which seems to work OK for the test cases I tried, and will even do
the right thing if given a number with more than one decimal point in
it. It presently rejects numbers with more than one zero before the
decimal point (like -00000.193, for example), but changing the
"(0|[1-9]+)" part to "(\d+)" would change that if you wanted to treat
-00000.193 as a valid number.
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: 9 Dec 1997 18:44:21 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Checking if integer/real
Message-Id: <66k3i5$f47$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, "Hans Van Lint" <hvanlint@lodestar.be> writes:
:I want the user to be able to fill in real numbers,
:how do i change my code to make this possible??
A mathematician would dispute your use of "real" in this context.
You just mean numbers with decimal points. See perldata(1).
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
There are still some other things to do, so don't think if I didn't fix
your favorite bug that your bug report is in the bit bucket. (It may be,
but don't think it. :-) Larry Wall in <7238@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Tue, 09 Dec 1997 19:09:14 GMT
From: andy@osea.demon.co.uk (Andrew Haveland-Robinson)
Subject: Re: Dynamic text-to-GIF utility
Message-Id: <348f9589.59006947@news.demon.co.uk>
On Fri, 05 Dec 1997 15:10:37 +0100, Gary Howland <ghowland@hotlava.com>
wrote:
>> smanes@nospam.evermagpie.com writes:
>> >I'm looking for a freeware tool which will generate an on-the-fly
>> >GIF given some text, a font style from a local database and, ideally,
>> >a background GIF. Oh yeah, and it has to run on Linux.
>>
>> I do this with an X font server, ImageMagick (a truly excellent product),
>> and PerlMagick. Yes, all of it runs on a Linux box. I am sticking to the
>> "arbitrarily resizable" fonts, because the arithmetic is easier (and I know
>> next to nothing about fonts). Given that, the advantages of this approach
>> are: you can add almost any font you want to; the results are always clean
>> and pleasant; you are not restricted to gifs, etc. We are definitely not
>> going to use GD for this again. The disadvantage is, you can't really do
>> it on the fly.
>
>I agree - ImageMagick/PerlMagick is best used for images created
>offline, and especially for images where fancy effects are required,
>along with proportional fonts and aliasing. GD is more suited for
>simple on the fly image generation, using fixed spaced bitmapped fonts
>(without any aliasing).
I do this using PovRay, but is very time consuming to do, as I have to make
each character as a 3d mesh, calculate my own font metrics and it's very
resource hungry to run...
The bonus is that it gives fantastic reproducible graphics.
I'm going to be launching a grow-your-own raytraced button factory soon.
See my web page for examples of the buttons that it can create from a batch
file in seconds.
Cheers,
Andy.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Haveland-Robinson Associates, 17 Williams Way, Fleet, Hants GU13 9EU England
Tel. +44 (0)1252-811670 ICQ: 1331640 Web: http://www.haveland.com
Register a Domain: http://www.yourname.com/cgi-bin/life-cgi/dnr.cgi?10101010
------------------------------
Date: 9 Dec 1997 18:09:37 GMT
From: "Kris Felscher" <felscher@innovative-web.com>
Subject: Re: Filtering out unneeded header files
Message-Id: <01bd0404$6f9296a0$b2308118@felscher.mediaone.net>
There's not really an easy way to figure out what is needed without knowing
C. However, what you can do is take the files that are matched multiple
times in each C file.
ex:
file a: file b: same:
stdio.h stdio.h stdio.h
stdlib.h breet.h time.h
conio.h time.h conio.h
string.h call.h
time.h cgi.h
assert.h conio.h
then make a new header file called "whatever.h" it would have the files
that match in it. remove all the matching headers in the
C files, and put in the line #include <whatever.h>
that should be easier than having to go through the whole file and figure
out what needs to be dropped or not
Kris Felscher
Tom Phillips <tphillipREMOVETHIS@rogers.wave.ca> wrote in article
<348b03c4.12334024@news.on.rogers.wave.ca>...
> Hi,
>
> I've been given a large number of C files to maintain
> in which every .c file #includes basically EVERY .h file(!).
> There are _hundreds_ of .h files #included in each .c file but
> only a subset of the header files are really needed.
> Does anyone know of an easy (and quick)
> way to figure out what this subset is that does not
> require compiling or linting the file? Can a preprocessor
> be used to determine this perhaps? The platform is Unix (SOLARIS).
>
> For example,
>
> someFile.c:
>
> #include "A.h" <--- required by <someFile.c code>
> #include "B.h" <--- not required
> #include "C.h" <--- required for E.h
> #include "D.h" <--- required for F.h
> #include "E.h" <--- required by <someFile.c code>
> #include "F.h" <--- not required
>
> <someFile.c code>
>
> In this case the subset would be
> #include "A.h"
> #include "C.h"
> #include "E.h"
>
> I am considering writing a perl script to do this but
> I don't want to re-invent the wheel.
>
> Thanks,
> Tom
> tphillip@REMOVETHISrogers.wave.ca
>
------------------------------
Date: Tue, 09 Dec 1997 13:02:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Graphing
Message-Id: <66k0n3$phj@bgtnsc01.worldnet.att.net>
In article <348D817B.E85D6323@starkimages.com>, Chris Schmidt
<chris@starkimages.com> wrote:
> I need a Module that will allow me to do graphs(pie, 3d, line,
> multi-line,...etc)
check CPAN [1] for some nice graphing modules :)
[1]
Comprehensive Perl Archive Network
available through <URL:http:://www.perl.com>
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Tue, 09 Dec 1997 12:03:45 -0800
From: Naren Chawla <chawla@corp.home.net>
Subject: Re: Graphing
Message-Id: <348DA421.2FEF5E20@corp.home.net>
Chris:
You can try GIFGraph module , its quite easy to use (its on CPAN archive)
--Naren
Chris Schmidt wrote:
> I need a Module that will allow me to do graphs(pie, 3d, line,
> multi-line,...etc)
> I can do what I want with GD.pm, but if someone has already writen the
> code for a
> nice grapher that would be great. Also any Ideas that you might have as
> how to go
> about crwating this I would also welcome. I hate it when I reinvent the
> wheel. :)
>
> ---
> Chris Schmidt / Systems Manager
> Stark Images
> Phone / Fax
> 4142262700 / 4142262705
------------------------------
Date: Tue, 09 Dec 1997 13:05:57 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: help for Checking input to match a certain pattern
Message-Id: <66k0t7$phj@bgtnsc01.worldnet.att.net>
In article <348d6d01.429257799@news.cmc.ec.gc.ca>, sjuneau@microtec.net
(Sylvain Juneau) wrote:
> print"What is the product identification name?";
> print"\n\nThe id should not be more than 8 letters\n";
> print"\nThe first letter represent Message source:\n\n";
> print" A is for CWAO CMC\n";
you might want to use a here document for this sort of printing:
print <<"HERE";
What is the product identification name?
The id should not be more than 8 letters
The first letter represent Message source:
A is for CWAO CMC
HERE
and so on. the text is much easier to read and edit this way, and
you don't have to type as much.
good luck :)
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Tue, 09 Dec 1997 13:08:14 -0600
From: Mickey Gousset <mgousset@nmhs.net>
Subject: Help using Net::FTP...
Message-Id: <348D971D.C27141A@nmhs.net>
Hey!
I am trying to use the following script:
#!/usr/local/.bin/perl
#
#
use IO;
use Net::FTP;
$ftp = Net::FTP->new("host_name");
$ftp->login("user_id", "password");
.
.
.
The script crashes on the login line with the following error:
_USER is not a valid IO::Handle macro at
/usr/local/lib/perl5/site_perl/auto/Net/FTP/login.al line 27
Has anyone seen this error, or can anyone tellme what I am doing wrong?
I have been banging against this problem for several days now.
Thanks!
Mickey Gousset
mgousset@nmhs.net
North Mississippi Health Services
------------------------------
Date: Tue, 09 Dec 1997 13:09:55 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: how can I fork a process from the Web..
Message-Id: <66k14l$phj@bgtnsc01.worldnet.att.net>
In article <348D5335.C589EAF4@larc.nasa.gov>, Hazari Syed
<h.syed@larc.nasa.gov> wrote:
> I have written a perl cgi script that runs on the web.. I need to fork
> off a
> process in the background when the user clicks a button.. The user then
> can do
> whatever he wants.. The process that is running in the background will
> eventually
> complete successfully. The cgi script does not need the status of this
> completed
> process. Can this be done..
what happened when you tried using fork()?
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: 9 Dec 1997 11:00:01 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: how do I make perl script interact with shall command?
Message-Id: <66k4fh$h3h$1@shell3.ba.best.com>
In article <66juq3$ssa$1@nntp3.uunet.ca>, Elaine Lu <lu@bratch.com> wrote:
>Hello all:
>
> In my program, I invited user to enter his/her preferred username and
> password. After some security and password validation checking in perl, I
> then want o pass the username and password into Linux shall and use the
> "htpasswd" command to add a new user and his/her corresponding password
Why do you need to use the htpasswd command to do this? If you write the
htpasswd file entry yourself, you save the overhead of spawning off two
processes, plus you don't need to play games to feed input to htpasswd on
a terminal, which is what it expects (and why your example doesn't work).
Try something like this:
print "Enter your username: ";
chomp($username = <STDIN>);
while (1) {
print "Enter your password: ";
chomp($password = <STDIN>);
print "Confirm your password: ";
chomp($passcheck = <STDIN>);
last if ($passcheck eq $password);
print "Passwords do not match. Please re-enter your password\n";
}
$encrypted_pw = crypt $password, substr($username, -2);
open (HTPASSWD, ">>/path/to/htpasswd") or die "Could not open file: $!\n";
print HTPASSWD, "$username:$encrypted_pw\n";
close HTPASSWD;
In practice, you'll want to add more checking to ensure that the user you're
adding does not already exist, and so forth, but that's a good start.
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: 9 Dec 1997 18:41:05 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Is Perl V5 available for NT 4.0
Message-Id: <66k3c1$dml@argon.btinternet.com>
In article <348CB75E.217E7B9@lucent.com>, esmithga@lucent.com says...
...
>Is Perl V5 available for NT 4.0 and if so how do I get a copy?
>
There are several win32 ports available - start at
www.perl.com
Have fun.
Jonathan
------------------------------
Date: Tue, 09 Dec 1997 14:29:21 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: multipile comments lines .
Message-Id: <comdog-ya02408000R0912971429210001@news.panix.com>
In article <66j40n$4ma$1@news.NetVision.net.il>, "canaan.co.il;edris1"@hotmail.com wrote:
>I was wondering if there is any way to turn a few lines of perl to
>comments and that without using the '#' char before every line ?
quite a numbers of opinions on this were voice in a recent thread
"Block comments in Perl?", which you can read through Alta-vista
or Dejanews.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 19:11:49 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: multipile comments lines .
Message-Id: <348d89e5.524144494f47414741@radiogaga.harz.de>
Edris Abzakh (edris@canaan.co.il) wrote:
: I was wondering if there is any way to turn a few lines of perl to
: comments and that without using the '#' char before every line ?
: something like /* bla bla ..
: bla bla
: */ in C .
Whenever the Perl compiler expects the beginning of a new statement,
if it encounters a line that begins with a '=' followed by a word,
then that text and all text up to and through a line beginning with
'=cut' will be ignored. This is the way POD (Plain Old Documentation)
works, but can also be used to quickly comment out a section of code.
See the perlsyn manpage and the perlpod manpage for words to avoid
(because they're POD keywords).
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Tue, 09 Dec 1997 12:01:20 -0800
From: Naren Chawla <chawla@corp.home.net>
Subject: Re: multipile comments lines .
Message-Id: <348DA38F.4176E034@corp.home.net>
one inelegant, cheesy way to do this is:
if (0)
{
place here all the lines that you want commented out...
}
Edris Abzakh wrote:
> Hello ..
>
> I was wondering if there is any way to turn a few lines of perl to
> comments and that without using the '#' char before every line ?
> something like /* bla bla ..
> bla bla
> */ in C .
>
> thanks for your support,
>
> Edris Abzakh
>
> Software Engineer
------------------------------
Date: Tue, 09 Dec 1997 19:21:42 GMT
From: steve.vanderburg@lhsc.on.ca (Steve van der Burg)
Subject: Multiple tie/untie on gdbm database failing
Message-Id: <66k5o0$cvo@falcon.ccs.uwo.ca>
Hi. I'm using perl 5's (5.004_02) GDBM_File module to tie/manipulate/untie
gdbm databases on Solaris 2.4 (Sparc). Perl & gdbm were compiled with Sun's
unbundled C compiler, and they usually work just fine
until now.
I've got a piece of code that does a simple task:
loop until someone kills us {
tie %hash to the gdbm database (in write mode);
...do some stuff...
untie %hash;
sleep 10;
# do the whole thing over again
}
Right now, there are no other processes touching the database.
Every time I run my script, it works fine the first time through the
loop, but the second time it bombs with 'Interrupted system call'.
Does anyone know what's going on? If I go from tie/untie back to the older
dbmopen/dbmclose functions, it works fine (ie. I can open/close/open/close....
just fine).
Truss shows this for the tie/untie version (relevant sections):
[ Here's the first, successful tie ]
open("/opt/lhsc/19971116.gdbm", O_RDWR|O_CREAT, 0640) = 4
fstat(4, 0xEFFFF9B0) = 0
fcntl(4, F_SETLK, 0xEFFFF968) = 0
read(4, "13 W9ACE\0\0 \0\0\0 \0".., 52) = 52
read(4, "\0\0\01D\001 _E3\0\0\01F".., 8140) = 8140
lseek(4, 8192, SEEK_SET) = 8192
read(4, "\0\0 @\0\0\0 @\0\0\0 @\0".., 8192) = 8192
[ Here's the untie }
fdsync(4, O_RDONLY|O_SYNC) = 0
fcntl(4, F_SETLK, 0xEFFFF67C) = 0
close(4) = 0
[ Here's the attempt to tie the second time through the loop... ]
[ The 'result from' and 'can't write' is my code reacting to a $! ne '' (from
the attempt to tie) -- $! is set to 'Interrupted system call' ]
open("/opt/lhsc/19971116.gdbm", O_RDWR|O_CREAT, 0640) = 4
fstat(4, 0xEFFFF9B0) = 0
fcntl(4, F_SETLK, 0xEFFFF968) = 0
read(4, "13 W9ACE\0\0 \0\0\0 \0".., 52) = 52
read(4, "\0\0\01D\001 _E3\0\0\01F".., 8140) = 8140
lseek(4, 8192, SEEK_SET) = 8192
read(4, "\0\0 @\0\0\0 @\0\0\0 @\0".., 8192) = 8192
write(1, " r e s u l t f r o m ".., 43) = 43
write(1, " C a n ' t w r i t e ".., 94) = 94
getcontext(0xEFFFF910)
setcontext(0xEFFFF910)
getcontext(0xEFFFF7B0)
fdsync(4, O_RDONLY|O_SYNC) = 0
fcntl(4, F_SETLK, 0xEFFFF874) = 0
close(4) = 0
lseek(0, 0, SEEK_CUR) = 250720
lseek(3, 0, SEEK_CUR) = 10999
_exit(0)
Help!
..Steve van der Burg
steve.vanderburg@lhsc.on.ca
Steve van der Burg
Technical Analyst, Information Services
London Health Sciences Centre
London, Ontario, Canada
Tel: +1 519 663-3300 x 5559 (work)
+1 519 472-6686 (home)
Email: steve.vanderburg@lhsc.on.ca
WWW: http://www.lhsc.on.ca/~vanderbg/
------------------------------
Date: Tue, 09 Dec 1997 17:06:25 GMT
From: rob@gadgetguru.com (Rob Braden)
Subject: Need help stripping whitespace
Message-Id: <348d78e8.4607544@snews.zippo.com>
Hi!
I've got a problem. We've got some software here that is munging
some data. In particular, it's inserting spaces into URLs, which is a
bad thing, obvioulsy. I don't have the source to this particular
program, and it's critical to our operations, so I just have to wait
patiently for a patch from the vendor.
In the meantiime, I need to write a program that wil identify and
remove any whitespace within the URLs - there may be more than one URL
per line. I'm pretty new to Perl, and this one's got me scratching my
head. I'm sure I could figure it out, but I need it quick! Any
assistance will earn my eternal gratitude, and I'll buy you dinner if
you're ever in the neighborhood.
Thanks!
Rob Braden
rob@gadgetguru.com
------------------------------
Date: 9 Dec 1997 18:07:22 GMT
From: "Glen Kaatz" <bsnenyprg@global2000.com>
Subject: Perl for Win 32 - please help!
Message-Id: <01bd04cd$dfba3090$0e6a020a@isv44778>
I'm trying to use Perl to kick off an Access '97 report. Below is the
program I am
using to do this:
# Test Perl
use OLE;
# ------ Create the Access Object ----------
$access = CreateObject OLE 'Access.Application.8'
or warn "Couldn't create new instance of Access App!!";
# ------ Open the Access Database File ----------
$dbname = 'c:\WINNT\Profiles\kaagle.016\Personal\glen97b.mdb';
$access->OpenCurrentDatabase ('glen97b.mdb')
or warn "Couldn't open DB";
# ------ Run a Macro ----------
$access->DoCmd->RunMacro('glenr')
or warn "Couldn't run macro";
# ------ Close the Database File ----------
$access->CloseCurrentDatabase
or warn "Couldn't close DB";
I can create the Access object $access, but I fail on the next 3 steps.
Does
anyone know what I'm doing wrong? Any sample code someplace?
Thanks,
Glen Kaatz (gkaatz@nycap.rr.com or bsnenyprg@global2000.com)
------------------------------
Date: Tue, 09 Dec 1997 14:34:04 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: perl stumper
Message-Id: <comdog-ya02408000R0912971434040001@news.panix.com>
In article <348D3271.34AC@usa.net>, jones-joe@usa.net wrote:
>1. What is the best way to learn perl in windows, but to use these
>scripts for cgi purposes?
there's more than one way to do it. if by "windows" you mean some
microsoft product rather than any GUI that uses the concept, then
you might want to look for the book "Learning Perl for Win32" or some
such from O'Reilly.
>2. Do I have to load them on server every time to make them work?
they would need to be accessible to the server to work. if you
don't make changes, you won't need to re-upload them.
>3. I've installed perl, on my computer but to make the scripts run I
>have to keep them in the same directory?
depends on your server configuration, which should be explained in
the server documentation. you might also ask in a newsgroup devoted
to your server product.
other CGI questions are better asked in a newsgroup devoted to CGI.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 20:27:17 +0100
From: Olivier PRENANT <ohp@pyrenet.fr>
To: Joe Doupnik <jrd@cc.usu.edu>
Subject: Re: Perl,select and mrtg
Message-Id: <348D9B94.2CDC@pyrenet.fr>
Joe Doupnik wrote:
>
> --------
> Probably you built Perl without select() support, for some reason.
> Best to rebuild it and look at the configuration information it uses. Perls
> here have been built without gcc, thank goodness, so yours can be too. If
> you have gcc try renaming its files to avoid finding gcc and tell gnu
> configure to keep away from /usr/local/* (my solutions). Even though many
> Unix programs have BSD brainwashing, select() is not in libsocket.a but
> rather is in libc.a/.so and ld.so.
> Also scroll back up this list to see my response to another person
> who forgot to use LD_LIBRARY_PATH. There should be no need to tinker with
> anything in system directories (no adding static links etc). Finally, to
> remove remaining abiguity try running with a simple shell such as sh or
> ksh, rather than csh.
> In short, small can be beautiful, simplicity can be a virtue,
> don't tinker in system space, and similar platitudes about surviving Unix.
> Joe D.
I still can't noway having the select statement...
Would you sending your Makefile and config.h file if you succedded?
TIA
--
Olivier PRENANT Tel: +33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou +33-5-61-50-97-01 (Fax)
31190 AUTERIVE +33-6-07-63-80-64 (GSM)
FRANCE Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)
------------------------------
Date: Tue, 09 Dec 1997 13:27:09 -0500
From: Paul Tomsic <ptomsic@pop.pitt.edu>
Subject: Running Perl in "NICE" mode?
Message-Id: <348D8D7D.95F29AA8@pop.pitt.edu>
This is a multi-part message in MIME format.
--------------F64ADED149456866FFF428C0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Assume that you're running a CPU intensive program every X hours. Is
there a way to run this program
in a NICE mode that wouldn't gobble up all the CPU , but rather only use
what's currently available?
I couldn't find any documentation regarding a flag of this nature,
though I'm sure that this isn't the first time
that it's come up.
thanks in advance...
Paul Tomsic
--------------F64ADED149456866FFF428C0
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Tomsic, Paul
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Paul Tomsic
n: Tomsic;Paul
org: University Pittsburgh Medical Center
email;internet: ptomsic@pop.pitt.edu
title: Software Developer
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------F64ADED149456866FFF428C0--
------------------------------
Date: Tue, 9 Dec 1997 18:06:55 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Sorting huge array
Message-Id: <EKxozJ.7yz@world.std.com>
aml@world.std.com (Andrew M. Langmead) writes:
>You could say:
> @arr = ( [0, 0, 0] ) x 10;
decoux@moulon.inra.fr pointed out to me that this construct makes ten
copies of the same anonymous array reference. So this wouldn't work.
--
Andrew Langmead
------------------------------
Date: Tue, 9 Dec 1997 14:49:34 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: strongly-typed or not? (was Re: Recommended PERL-book?)
Message-Id: <19971209.144934.2T6.rnr.w164w_-_@locutus.ofB.ORG>
[ why oh WHY don't people change the Subject: headers?! ]
Randal Schwartz <merlyn@stonehenge.com> writes:
>> * the fact that variables aren't strongly typed
> I never ever understand this comment.
sure you do.
> Perl variables are *very* strongly typed.
> $a can hold *only* scalars
that's not very strongly typed. `scalars' just says `bit patterns'.
I wouldn't even say that's strongly typed. just plain typed, yeah, sure.
the fact that you need to use `-w' to detect when you've used ne instead
of != is a big hint that the computer isn't doing enough work for you,
hoping you'll make it up by being extra careful and not mix up your
strings with your numbers.
I demand that my computers put in more effort than that, personally.
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: Tue, 09 Dec 1997 14:46:18 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: strongly-typed or not?
Message-Id: <comdog-ya02408000R0912971446180001@news.panix.com>
In article <19971209.144934.2T6.rnr.w164w_-_@locutus.ofB.ORG>, Russell Schulz <Russell_Schulz@locutus.ofB.ORG> wrote:
>the fact that you need to use `-w' to detect when you've used ne instead
>of != is a big hint that the computer isn't doing enough work for you,
>hoping you'll make it up by being extra careful and not mix up your
>strings with your numbers.
>
>I demand that my computers put in more effort than that, personally.
i'd rather have the flexibility to decide which context i would like
to use in comparisons. the more work the compiler et alia does for
you, the less flexibility you have. i'd rather not make my tools
guess what i wanted.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 18:41:33 GMT
From: d.rosmi@pd.nettuno.it (Denis)
Subject: translate forms to mail
Message-Id: <66k3d0$48q$5@news.nettuno.it>
I would like to know how i could translate some datas inserted in a html form
to mail (subject, name, address, etc.)
Thank u
Denis
------------------------------
Date: Tue, 09 Dec 1997 11:18:03 -0800
From: Paulo Dutra <paulo@xilinx.com>
Subject: Using FTP.pm with a firewalls (need script examples)
Message-Id: <348D996B.58B7@xilinx.com>
Hi,
I'm having problems using FTP.pm (as part of 5.004_01) with
a firewall. I setup the $ENV{'FTP_FIREWALL'} to the web
proxy to the same extent as I have exposure with J. Friedl's webget
(v. 961120.32). In webget, I have
$ENV{'http_proxy'} = $ENV{'ftp_proxey'} where ftp_proxy is defined,
and that works, however, I'm having mega troubles with FTP.pm
I need a small script sample to illustrate the use of FTP proxies
and firewall useage. Thanks.
--
Paulo //\\\\
| ~ ~ |
( O O )
__________________________________oOOo______( )_____oOOo_______
| . |
| / 7\'7 Paulo Dutra (paulo@xilinx.com) |
| \ \ ` Xilinx hotline@xilinx.com |
| / / 2100 Logic Drive (800) 255-7778 |
| \_\/.\ San Jose, California 95124-3450 USA (408) 879-6797 |
| Oooo |
|________________________________________oooO______( )_________|
( ) ) /
\ ( (_/
\_)
------------------------------
Date: Tue, 9 Dec 1997 15:00:09 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Wildcards
Message-Id: <19971209.150009.8K0.rnr.w164w@locutus.ofB.ORG>
[ not perl-specific; moved to c.u.shell ]
sdinitto@kronos.com (Scott DiNitto) writes:
> How else can I tell perl that a wildcard was used if the shell
> translates the wildcard before perl can even see that a wildcard
> was used!
well, if the shell throws away this information, then you can't get
at it.
there are three approaches:
1. change your input data: quote your arguments. but which quote
does what? which quote leaves $ alone, which doesn't? be prepared
for surprises!
2. change the way you run: `set noglob'. obviously you can't do this
from within YOUR program; the data has already been lost. also,
fundamentally none of the programs out there will work with it
(cp, mv, etc.), so you have to be careful to undo it soon. of
course, the syntax varies from shell to shell.
3. fix your shell: change your shell to NOT THROW AWAY INFORMATION.
I proposed an environment variable for this purpose in comp.unix.shell
long ago, and everyone reponsded by mailing me scripts to rename files
like *.c to *.c.old (why they did this, and why they think this
solves the general problem, I'll never know).
but while you still have a shell that throws away information, you're
somewhat stuck with options 1 and 2.
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
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 1442
**************************************