[16012] in Perl-Users-Digest
Perl-Users Digest, Issue: 3424 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 19 18:10:38 2000
Date: Mon, 19 Jun 2000 15:10:22 -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: <961452622-v9-i3424@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 19 Jun 2000 Volume: 9 Number: 3424
Today's topics:
Formatting question? <rvanoni@e-estimating.com>
Re: Formatting question? <aqumsieh@hyperchip.com>
Re: Formatting question? <lr@hpl.hp.com>
Re: Getting an absolute path from a (potentially) relat <Jonathan.L.Ericson@jpl.nasa.gov>
help creating directories with perl <colonial@tcac.net>
Re: help creating directories with perl <sariq@texas.net>
How can I open the same file ? <nic.alagna@tiscalinet.it>
Re: How can I open the same file ? <care227@attglobal.net>
Re: How can I open the same file ? (Craig Berry)
Re: How to determine a fake email address (John Stanley)
Re: IDE for perl? <dt@area.com>
Internet Programmers Wanted! <xirocco@jps.net>
Re: Need regexp pattern to verify a password is strong (Brandon Metcalf)
Re: Need regexp pattern to verify a password is strong (Craig Berry)
Re: Need regexp pattern to verify a password is strong <danielreadNOdaSPAM@excite.com.invalid>
Re: Need regexp pattern to verify a password is strong <uri@sysarch.com>
Re: Need regexp pattern to verify a password is strong (Abigail)
Re: Need regexp pattern to verify a password is strong (Craig Berry)
Re: Need regexp pattern to verify a password is strong (Craig Berry)
Re: Outputting a page bit by bit... <sbanks99NOsbSPAM@yahoo.com.invalid>
Re: Passing 'undef' TO an XSUB <dan@tuatha.sidhe.org>
Re: Passing a database handles to subs.... <david@dbillingham.demon.co.uk>
Re: Perl code for unzip <Luc-Etienne.Brachotte@wanadoo.fr>
Perl Timer help felrodian@my-deja.com
Piping output from JAVAC to a file. s_m_campbell@my-deja.com
Re: question about flock. (Eric Bohlman)
Re: Simple Question ~ How to perform a directory recurs <dmeyers@panix.com>
Re: starting default cgi file on server <danielxx@bart.nl>
UNIX Mail -> Firewall -> Web? <syrag@my-deja.com>
Re: UNIX Mail -> Firewall -> Web? <care227@attglobal.net>
Re: URL Redirection <hedim@hta-bi.bfh.xxx>
web link checker <Luc-Etienne.Brachotte@wanadoo.fr>
Re: web link checker <rootbeer@redcat.com>
Re: web link checker <Luc-Etienne.Brachotte@wanadoo.fr>
Re: web link checker <rootbeer@redcat.com>
Re: What the... (Eric Bohlman)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Jun 2000 14:36:26 -0400
From: "Rich" <rvanoni@e-estimating.com>
Subject: Formatting question?
Message-Id: <8ilp6i$lf2$1@slb6.atl.mindspring.net>
If $x = 45.123456789 and I wanted to only show 2 decimal places I would use
the following command:
printf("x=%.2f", $x);
Is there any way to do this type of formatting inside the print<< statement?
Or is there a way to change the value of $x from 45.123456789 to 45.12
before I use the print<< statement?
And how do I print the "$" inside the print<< statement without Perl trying
to interpret it as a variable?
I would appreciate any help. Thanks. Rich.
------------------------------
Date: Mon, 19 Jun 2000 19:37:58 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Formatting question?
Message-Id: <7a66r5xy0a.fsf@merlin.hyperchip.com>
"Rich" <rvanoni@e-estimating.com> writes:
> If $x = 45.123456789 and I wanted to only show 2 decimal places I
> would use the following command:
>
> printf("x=%.2f", $x);
Yes.
> Is there any way to do this type of formatting inside the print<< statement?
Not that I know of.
> Or is there a way to change the value of $x from 45.123456789 to 45.12
> before I use the print<< statement?
Yes. You use sprintf():
$x = sprintf "%.2f", $x;
> And how do I print the "$" inside the print<< statement without Perl
> trying to interpret it as a variable?
The same way you do it inside double-quoted strings; you backwack it:
print "\$";
--Ala
------------------------------
Date: Mon, 19 Jun 2000 14:41:10 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Formatting question?
Message-Id: <MPG.13b8335289738b1798ab9d@nntp.hpl.hp.com>
In article <8ilp6i$lf2$1@slb6.atl.mindspring.net> on Mon, 19 Jun 2000
14:36:26 -0400, Rich <rvanoni@e-estimating.com> says...
> If $x = 45.123456789 and I wanted to only show 2 decimal places I would use
> the following command:
>
> printf("x=%.2f", $x);
>
> Is there any way to do this type of formatting inside the print<< statement?
> Or is there a way to change the value of $x from 45.123456789 to 45.12
> before I use the print<< statement?
There is no such thing as a 'print<<' statement. There is a print()
function; the notation << introduces a quoted string, that may be used
as the argument for print(), or elsewhere.
Within the quoted string ('here-doc'), you can interpolate variables, or
even expressions:
print <<EOT;
some text \$ ${\sprintf '%.2f' => $x} some more text
EOT
> And how do I print the "$" inside the print<< statement without Perl trying
> to interpret it as a variable?
See above.
See perlop for more on quoting and interpolation.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Jun 2000 13:21:49 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Getting an absolute path from a (potentially) relative one
Message-Id: <394E80DD.2500327A@jpl.nasa.gov>
Wayne Plummer wrote:
> Well to reply to my own post... I found that the File::Spec package should
> do what I want (but not before I'd written my own anyway!).
>
> Sadly, this seems:
> A) to be a recent addition (so not all of the systems I am looking at have
> the module as standard)
As time goes on, this will be less of a problem.
> B) seems to be broken (at least in ActivePerl 5.6.0.613 where I'm testing
> it).
>
> The following script, xxx.pl:
>
> #/usr/local/bin/perl -w
> use Strict;
Do you mean 'use strict;'? You really should copy and paste code.
> use File::Spec::Functions qw(rel2abs canonpath);
>
> my $relPath = "..\\fred\\foo";
> # my $relPath = "../fred/foo"; # My first try
File::Spec recognizes forward slashes on my NT machine.
> my $absPath = canonpath (rel2abs($relPath));
> # my $absPath = rel2abs($relPath); # My first try
>
> print "Rel: $relPath Abs: $absPath\n";
>
> When run thus on an X86, NT 4.0 box, displays:
>
> D:\Users\wayne>perl xxx.pl
> Rel: ..\fred\foo Abs: D:\Users\wayne\..\fred\foo
>
> IMHO, the answer should definitely be D:\Users\fred\foo
>
> I think I'll deploy the cheap and cheerful version I wrote myself!
You should also contact the authors of File::Spec.
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Mon, 19 Jun 2000 13:54:04 -0500
From: "Jubilee Prescott" <colonial@tcac.net>
Subject: help creating directories with perl
Message-Id: <sksrag6je7f91@corp.supernews.com>
How can I create directories with perl? I'm on a redhat 6 machine.
thanks
------------------------------
Date: Mon, 19 Jun 2000 14:02:02 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: help creating directories with perl
Message-Id: <394E6E2A.425D624E@texas.net>
Jubilee Prescott wrote:
>
> How can I create directories with perl? I'm on a redhat 6 machine.
Perl's base functions are documented in the 'perlfunc' page of the
manual.
Type 'perldoc perlfunc' at your command prompt, and perhaps you'll find
something similar to Linux's 'mkdir' in there.
Good luck with it!
- Tom
------------------------------
Date: Mon, 19 Jun 2000 19:45:28 +0200
From: nik <nic.alagna@tiscalinet.it>
Subject: How can I open the same file ?
Message-Id: <394E5C38.1B28F234@tiscalinet.it>
Hi,
I have to access in write-mode a file, but I need to be sure the
file is not
already opened by anothe process in write-mode.
How can I get that?
Thank you vm,
Nicolo'
------------------------------
Date: Mon, 19 Jun 2000 16:33:03 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: How can I open the same file ?
Message-Id: <394E837F.D695C693@attglobal.net>
nik wrote:
>
> Hi,
> I have to access in write-mode a file, but I need to be sure the
> file is not
> already opened by anothe process in write-mode.
> How can I get that?
>
lock the file when you open it. Simple enough.
$ perldoc -f flock
------------------------------
Date: Mon, 19 Jun 2000 21:24:13 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How can I open the same file ?
Message-Id: <skt3rtlse7f159@corp.supernews.com>
nik (nic.alagna@tiscalinet.it) wrote:
: I have to access in write-mode a file, but I need to be sure the
: file is not
: already opened by anothe process in write-mode.
: How can I get that?
perldoc -f flock
Note well that flock is cooperative; that is, all processes using the file
need to use flock voluntarily for the locking scheme to work. My favorite
analogy is a traffic light controlling an intersection; all it takes is a
single driver who doesn't follow the 'red = stop' convention to create
havoc.
Note that on some OSs, file system features extrinsic to perl and flock()
enforce stronger locking behavior.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: 19 Jun 2000 21:02:30 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: How to determine a fake email address
Message-Id: <8im1p6$8po$1@news.NERO.NET>
In article <henry-8C288D.05052319062000@news.metropolis.net.au>,
Henry <henry@penninkilampi.net> wrote:
>In article <slrn8kq8vh.ojo.abigail@alexandra.delanet.com>,
>abigail@delanet.com wrote:
>>> ($theirUserName,$theirMailServer) = split /@/, $emailAddress;
>>
>> But that is *wrong*.
>It's not _wrong_ Abigail.
It is pathetically and fatally wrong. You understand less about mail
than you do about news.
Or are you trying to claim that the "mail server" for the address
<@somewhere.example:user@elsewhere.example> really is the system
"somewhere.example:user"? That's what your 'not wrong' code would say.
>Depending on how you configure your forward
>zone file it is perfectly functional and correct. Nothing _wrong_ about
>it whatsoever!
It has nothing to do with how one configures your 'forward zone file'.
It has everything to do with a complete failure to understand legal
email addressing.
------------------------------
Date: Mon, 19 Jun 2000 21:30:24 GMT
From: Dave Turner <dt@area.com>
Subject: Re: IDE for perl?
Message-Id: <skt47gkbe7f162@corp.supernews.com>
Alvin Stroyny wrote:
>
> Hi
>
> Can anyone recommend me a good integrated development environment (i.e.
> editor+debugger)
> for perl? I am interested in both commercial and shereware products.
As a novice user, I like DZSoft's perl editor as it catches my bugs and
compiles so that I can see what is going on. You do need Active perl to
work with it, but that's a freebie...
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Mon, 19 Jun 2000 21:34:35 GMT
From: Kevin McElligott<xirocco@jps.net>
Subject: Internet Programmers Wanted!
Message-Id: <Llw35.8139$zp6.440520@nntp3.onemain.com>
CGI / Perl / Java / C++ (and more) Programmers Wanted!
Get "free" exposure for your scripts online. Have you written
web scripts and would like a forum where you can have your
scripts "used online"? We can help.
i-tech developers is in the process of building a website that will
cater to the needs of web designers. The site will be completely
free to all who use its resources. We will run scripts designed by
people like you.
We have been successful in affiliating ourselves with many
programmers on the Internet, and in return our programmers get
advertising space on the site, as well as referral business and
personal bio's listed by their scripts (with links to their site). What
does this mean for you? Exposure and lots of business!
The scripts we seek will actually be setup to run on the website,
hence we are only looking for scripts that have "web design" in
mind. We have found several scripts that help with such things
as choosing colors and converting those colors to hex, setting up
framesets, submitting your web pages to search engines and
much more.
While the i-tech developers site is not yet live we would like to
hear from you if you are interested in giving your scripts this kind
of exposure.
Please contact us directly by email to see how we can help you.
Thanks.
Kevin McElligott
xirocco@jps.net
due to the spamming on newsgroups, our primary internet email
address is not used here.
DO NOT SPAM. IT HURTS ALL OF US
------------------------------
Date: 19 Jun 2000 17:50:07 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <8ilmgf$kf6$1@bcrkh13.ca.nortel.com>
danielreadNOdaSPAM@excite.com.invalid writes:
> What I need to do is come up with a pattern to match on to
> ensure that a password that a user is creating for himself is
> strong. For example, we have rules such as "must be at least
> six characters", "must contain at least one number", "must
> contain at least one lower case letter", "must contain at least
> one upper case letter", and "must contain at least one special
> character (e.g. #, %, $, *)". What has been difficult for me is
> finding a way to make the pattern not be dependent upon the
> order of the characters. For example, I need to make sure
> there's at least one number, but I don't care where in the
> string it is. Same for the other rules: I don't care about the
> order that the characters are in, just that a certain number,
> character, etc. is somewhere in the string. How is this done?
You want to use a character class in your regexp. However, there
are passwd replacement programs that will do the job much better.
Brandon
------------------------------
Date: Mon, 19 Jun 2000 18:16:59 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <sksosrv3e7f177@corp.supernews.com>
Daniel Read (danielreadNOdaSPAM@excite.com.invalid) wrote:
: What I need to do is come up with a pattern to match on to
: ensure that a password that a user is creating for himself is
: strong. For example, we have rules such as "must be at least
: six characters", "must contain at least one number", "must
: contain at least one lower case letter", "must contain at least
: one upper case letter", and "must contain at least one special
: character (e.g. #, %, $, *)". What has been difficult for me is
: finding a way to make the pattern not be dependent upon the
: order of the characters.
Sometimes, getting fixated on doing it with one regex can lead you astray.
Why not just use several patterns, combined with &&? Assuming the
candidate password is in $_:
$is_strong = length >= 6 &&
/\d/ && /[a-z]/ && /[A-Z]/ && /[#%$*]/;
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Mon, 19 Jun 2000 11:32:40 -0700
From: Daniel Read <danielreadNOdaSPAM@excite.com.invalid>
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <1112c27c.c580dbdb@usw-ex0102-015.remarq.com>
Thanks to all of the very helpful replies. I am very
appreciative. It is now apparent to me that my mistake was
looking for some kind of super pattern to cover all of my
rules. Using a series of checks using more focused patterns
makes perfect sense. Thanks again.
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 19 Jun 2000 19:31:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <x78zw15uyn.fsf@home.sysarch.com>
>>>>> "CB" == Craig Berry <cberry@cinenet.net> writes:
CB> Sometimes, getting fixated on doing it with one regex can lead you astray.
CB> Why not just use several patterns, combined with &&? Assuming the
CB> candidate password is in $_:
CB> $is_strong = length >= 6 &&
CB> /\d/ && /[a-z]/ && /[A-Z]/ && /[#%$*]/;
or you can combine those with lookaheads into one large regex. the logic
is the same, check for each feature individually (untested):
/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[#%$*])/;
/\d/&&/[a-z]/&&/[A-Z]/&&/[#%$*]/;
i won't say that is better or faster but it is one regex. and it even
loses in golf by a lot as i show.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 19 Jun 2000 15:37:44 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <slrn8ksumd.3a7.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCDLXXXIV September MCMXCIII in
<URL:news:x78zw15uyn.fsf@home.sysarch.com>:
'' >>>>> "CB" == Craig Berry <cberry@cinenet.net> writes:
''
'' CB> Sometimes, getting fixated on doing it with one regex can lead you astr
'' CB> Why not just use several patterns, combined with &&? Assuming the
'' CB> candidate password is in $_:
''
'' CB> $is_strong = length >= 6 &&
'' CB> /\d/ && /[a-z]/ && /[A-Z]/ && /[#%$*]/;
''
''
'' or you can combine those with lookaheads into one large regex. the logic
'' is the same, check for each feature individually (untested):
''
'' /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[#%$*])/;
'' /\d/&&/[a-z]/&&/[A-Z]/&&/[#%$*]/;
'' i won't say that is better or faster but it is one regex. and it even
'' loses in golf by a lot as i show.
And you can do without a regex too:
y/0-9/0-9/ && y/a-z/a-z/ && y/A-Z/A-Z/ && y/#%$*/#%$*/;
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: Mon, 19 Jun 2000 20:00:36 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <sksuv472e7f185@corp.supernews.com>
Uri Guttman (uri@sysarch.com) wrote:
: >>>>> "CB" == Craig Berry <cberry@cinenet.net> writes:
:
: CB> Sometimes, getting fixated on doing it with one regex can lead you astray.
: CB> Why not just use several patterns, combined with &&? Assuming the
: CB> candidate password is in $_:
:
: CB> $is_strong = length >= 6 &&
: CB> /\d/ && /[a-z]/ && /[A-Z]/ && /[#%$*]/;
:
: or you can combine those with lookaheads into one large regex. the logic
: is the same, check for each feature individually (untested):
:
: /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[#%$*])/;
: /\d/&&/[a-z]/&&/[A-Z]/&&/[#%$*]/;
:
: i won't say that is better or faster but it is one regex. and it even
: loses in golf by a lot as i show.
Exactly. I almost pointed this out but the example was just too ugly for
me to be willing to post it. :)
Note that you could also satisfy the length >= 6 requirment within that
already overstuffed regex by adding
.{6}
at the end.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Mon, 19 Jun 2000 20:03:52 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <sksv58uce7f14@corp.supernews.com>
Abigail (abigail@delanet.com) wrote:
: And you can do without a regex too:
:
: y/0-9/0-9/ && y/a-z/a-z/ && y/A-Z/A-Z/ && y/#%$*/#%$*/;
Oooh oooh oooh! I get to out-golf Abigail! :) You can remove the
contents of each replacement clause above and get identical (no-op, count
only) semantics.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Mon, 19 Jun 2000 11:41:27 -0700
From: sbanks <sbanks99NOsbSPAM@yahoo.com.invalid>
Subject: Re: Outputting a page bit by bit...
Message-Id: <0b7d2348.eb3c37b3@usw-ex0105-036.remarq.com>
Thanks alot, that's been really helpful!
I thought it would probably be something quite simple, but I'm
fairly new to Perl!
I tried what you said and added '$|=1;' to my program and it
does indeed work as I hoped!! :o)
And thanks for the reminder about '-w' and 'use strict'! As I
said, I'm fairly new to Perl, but have read 'Learning Perl' (and
am about to order 'Programming Perl') so I should know better!
Regards,
SBanks!!
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 19 Jun 2000 18:24:46 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Passing 'undef' TO an XSUB
Message-Id: <Ozt35.4055$Zg4.17707@news1.rdc1.ct.home.com>
Vikas Aggarwal <vikas@navya.com> wrote:
> I have a perl routine that is invoking an XSUB function.
> test(arg1, undef);
> and the XSUB (XS) function is:
> test(arg1, arg2)
> int arg1;
> int arg2;
> CODE:
> ....
> How can I test if arg2 is set to 'undef' in the xsub?
You can't with the code you posted. You've thrown away too much
information in the conversion to an int to know if one of the args was
undef.
If you need to check, take SV * parameters instead and check them for
undefness, and extract the IV bit once you've done so.
Dan
------------------------------
Date: Sun, 18 Jun 2000 22:41:10 +0100
From: "David" <david@dbillingham.demon.co.uk>
Subject: Re: Passing a database handles to subs....
Message-Id: <961450893.12571.0.nnrp-03.c2deb140@news.demon.co.uk>
Abigail <abigail@delanet.com> wrote in message
news:slrn8kmau2.mlf.abigail@alexandra.delanet.com...
> David (david@dbillingham.demon.co.uk) wrote on MMCDLXXXI September
> MCMXCIII in
<URL:news:961222466.15154.0.nnrp-08.c2deb140@news.demon.co.uk>:
> ^^ Hi
> ^^
> ^^ I am writing as set of cgi scripts that use the Perl DBI to connect to
a
> ^^ database. I want to connect to to the database and then call a sub,
passing
> ^^ the sub the database handle or a handle returned by a prepare
statement.
> ^^ I've tried to pass it by reference but can't find the right syntax -
any
> ^^ suggestions?
>
> Arguments to subs in Perl *are* passed by reference:
>
> sub inc ($) {$_ [0] ++}
> my $n = 1;
> inc $n;
> print $n; # Prints 2.
>
> There is no choice of passing by reference or value.
>
> But I fail to see why you want to change the database or statement
> handle in the sub.
>
> ^^
> ^^ Does anybody outhere know how to do this - or whether there is better
> ^^ approach?
> ^^
> ^^ For instance:
> ^^
> ^^ use strict;
> ^^ my $dbh = DBI->connect('dbi:ODBC:driver=Microsoft Access Driver
> ^^ (*.mdb);dbq=h:\db\Products.mdb') or die $DBI::errstr;
> ^^
> ^^ if ($FormData{search_button} eq 'Show Groups')
> ^^ {
> ^^ my $sql = "SELECT * FROM groups ORDER BY group_description";
> ^^ my $tbh = $dbh->prepare($sql) || &HandleError($DBI::errstr);
> ^^ You probably want "or" here.
>
> ^^ #Pass handle returned by $dbh->prepare - except it doesn't work....
> ^^ &ShowGroups($tbh);
Thanks for your reply.
I want to pass a handle to a sub so that I can declare variables with 'my',
use 'strict', and use the handle elsewhere in my code.
Any ideas
Thanks
David
------------------------------
Date: Mon, 19 Jun 2000 21:51:34 +0200
From: Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
To: Randy Kobes <randy@theory.uwinnipeg.ca>
Subject: Re: Perl code for unzip
Message-Id: <394E79C6.BE497CEC@wanadoo.fr>
Randy Kobes a écrit :
> Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
> wrote in message news:394BD7C8.66AE4F49@wanadoo.fr...
>
> > I'm looking for Perl code/module for unziping (also for zipping) files,
> > mainly to a Perl scalar variable. unzipping to a file will also do.
>
> Sounds like you want the Archive::Zip module - see, for example,
> http://theoryx5.uwinnipeg.ca/CPAN/data/Archive-Zip/Archive/Zip.html
> for documentation on its use and how to get it.
>
> best regards,
> randy kobes
I downloaded and tested it, it seems good... except for the CRC algorithm. It
prints the same CRC I see in winzip, but winzip tests all files OK, where
testzip.pl computes an erroneous different one?
Thanks,
LEB
------------------------------
Date: Mon, 19 Jun 2000 21:30:06 GMT
From: felrodian@my-deja.com
Subject: Perl Timer help
Message-Id: <8im3cg$429$1@nnrp1.deja.com>
I have hacked the following program and am wondering why it isn't
working. It seems to stop after a few times. I believe that it is
getting back to 00 in the time, then doesn't want to work anymore. I
have tried fixing the problem with the two if statements just before the
while statement. Please submit ideas.
__BEGIN__
#!/usr/bin/perl
use Time::localtime;
$lt = localtime();
$sec = $lt->sec;
$timer = 2;
$exectime = $sec + $timer;
$print = "Cool!";
&timer;
sub timer
{
if($sec < 1)
{
$lt = localtime();
$sec = $lt->sec;
}
if($exectime < 1)
{
$lt = localtime();
$exectime = $lt->sec + $timer;
}
while($sec < $exectime)
{
$lt = localtime();
$sec = $lt->sec;
}
print "$print\n";
$exectime = $exectime + $timer;
&timer;
}
__END__
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 19 Jun 2000 21:40:34 GMT
From: s_m_campbell@my-deja.com
Subject: Piping output from JAVAC to a file.
Message-Id: <8im40h$4fd$1@nnrp1.deja.com>
I am trying to pipe the output from a JAVAC.EXE compile to a file so I
can then parse it for errors, etc. I have tried the following with no
success.
Attempt 1:
==========
$Status = `$Exe $RelType $Memory \@$Filelist -d $ClassDir`;
open (LOGFILE, '>', $TempOut) or return;
print LOGFILE, $Status;
close (LOGFILE);
Attempt 2:
==========
open (LOGFILE, '>', $TempOut) or return;
pipe STDERR, LOGFILE;
$Status = `$Exe $RelType $Memory \@$Filelist -d $ClassDir`;
close (LOGFILE);
Attempt 2 seem to do something. I did not get any output to the
screen, but I also didn't get any in the log file. Not sure where it
went.
Any help is appreciated.
-Shawn
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 19 Jun 2000 20:53:18 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: question about flock.
Message-Id: <8im17u$pld$3@slb0.atl.mindspring.net>
Nico Zigouras (zigouras@mail.med.upenn.edu) wrote:
: I am a little confused about flock(). I have tried both on Solaris and
: RedHat 5.2 to lock a file. While the lock is on the file I open a
: separate handle to the file and try to write to it. If the lock worked I
: would assume that I would not be able to write to the file
: simultaneously. However, I can write to it. Can anyone explain to me
[oversimplified] Unix file locking is advisory, not mandatory. It's like a
traffic light, not a gate. A red light doesn't physically stop traffic
from going through it; a lock on a file doesn't prevent another process
from accessing the file, just from locking it. File locking works only
when all the processes that access a file agree to play by the rules
(requesting a lock on a file before using it, and waiting until that
request is successful), just as traffic lights work only when all the
drivers agree to stop at red lights.
------------------------------
Date: 19 Jun 2000 17:39:33 -0400
From: David Meyers <dmeyers@panix.com>
Subject: Re: Simple Question ~ How to perform a directory recursive search ?
Message-Id: <yobog4xpcyy.fsf@panix3.panix.com>
"Kenny Lim" <kennylim@techie.com> writes:
> (i) The only reason as to why I am using different methods to search the
> directory
> is because I am not too sure how to actually use the find:file
> utilities to search
> for only a given extension and not all the files in the entire
> directories and subdirectories.
>
> ie.
>
> Use File::Find;
> find sub {print "Found One: $File::Find::name\n" if !-d}, '.';
File::Find is your friend. The examples in the docs have,
perhaps, slightly less obvious "wanted" subroutines.
Is this a little easier to follow? It generates a list
of the *.txt files in all the subdirectories of /some/directory.
(I actually used my home directory to test it out and turned
up a couple of files I'd forgotten about.)
#!/usr/local/bin/perl -w
use strict;
use File::Find;
find ( \&wanted, "/some/directory");
sub wanted {
print "$File::Find::dir/$_\n" if (/.*\.txt$/);
}
------------------------------
Date: Mon, 19 Jun 2000 20:57:17 GMT
From: "Daniel van den Oord" <danielxx@bart.nl>
Subject: Re: starting default cgi file on server
Message-Id: <NOv35.2630$%h3.39848@Typhoon.bART.nl>
Sorry for my poor english what I mean is that I saw on a server that they
didn't have to put the script file name in the command bar anymore just
.../cgi-bin/?command=string&blabla
instead of
.../cgi-bin/scriptname.cgi?command=string&blabla
So I thought maybe they are using the script as being the default opening
page for that directorie
When I tried that it didn't work it did start the script right but it didn't
read the command string !!!
Hope I made myself better understandable ?!? And hope somebody can help me
!!
------------------------------
Date: Mon, 19 Jun 2000 19:21:38 GMT
From: Syrag <syrag@my-deja.com>
Subject: UNIX Mail -> Firewall -> Web?
Message-Id: <8ilrrm$uv5$1@nnrp1.deja.com>
I am looking for a way to get my alpha pager (which has no e-mail
address but has a web interface) to receive e-mail.
The plan is to have a script running on a UNIX machine that will look
for a keyword in the subject and will send the message (or part of it)
through the web. My company has a firewall (where the e-mail will be
received), so that is also something I need to consider.
If anyone has any suggestions on where to look or what I will need to
do, I would appreciate any direction. The form the pager company uses
uses the POST method to get data. I have included sample code from
their page.
Thanks very much,
Syrag
--
Please reply to the group so that everyone can benefit.
You may reply to me by e-mail as well.
<div align="center"><center>
<table border="2">
<tr>
<td><form action="http://www.xxx.com/cgi-bin/sendpage.cgi"
method="POST" name="SendAlphaPage">
<input type="hidden" name="MapId" value="YOUR_ID_NUMBER_HERE">
<div align="center"><center><table
border="0">
<tr>
<td align="left"><font size="2" face="Arial">Message:</font></td>
</tr>
<tr>
<td><textarea name="MapMsg" rows="3" cols="40"></textarea> </td>
</tr>
<tr>
<td align="center"><font size="1" face="Arial">Message Cannot Exceed 120
Characters.</font></td>
</tr>
<tr>
<td align="center"><input type="submit" name="sendit" value="Send Page">
<input type="reset" name="clearit"
value="Clear Page"></td>
</tr>
</table>
</center></div>
</form>
</td>
</tr>
</table>
</center></div>--
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 19 Jun 2000 15:36:47 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: UNIX Mail -> Firewall -> Web?
Message-Id: <394E764F.FFB7B773@attglobal.net>
Syrag wrote:
>
> I am looking for a way to get my alpha pager (which has no e-mail
> address but has a web interface) to receive e-mail.
>
Perl -> question -> USENET?
I don't see one. Sorry.
------------------------------
Date: Mon, 19 Jun 2000 21:09:59 +0200
From: Markus Hediger <hedim@hta-bi.bfh.xxx>
Subject: Re: URL Redirection
Message-Id: <394E7007.D1B9EFD8@hta-bi.bfh.xxx>
hi there
write a script like this:
--
#!/usr/bin/perl
print "Location: http://this-is.not/a-perl/specific/question.html\n\n";
# note the two \n at the end, that's important
# and note what the url says :)
--
regards
------------------------------
Date: Mon, 19 Jun 2000 22:12:27 +0200
From: Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
Subject: web link checker
Message-Id: <394E7EAB.B2573A87@wanadoo.fr>
All,
Being a web site admin, I build the site on my win98 PC, then put it on
the web.
Of course I developped a link checker for checking carefully all
internal links. But having an internet connection open, I would like to
test tags like
<a href="http://www.yahoo.com">
to find if the site exists, or more precisely
<a href="http://www.perl.com/pub/language/info/software.html">
for a given page, to automatically tracks for changes in the sites I
point to.
Now my checker extracts and prints the "http://www..." but with the
"can't test" message.
Any help appreciated.
LEB
------------------------------
Date: Mon, 19 Jun 2000 13:46:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: web link checker
Message-Id: <Pine.GSO.4.10.10006191344550.29843-100000@user2.teleport.com>
On Mon, 19 Jun 2000, Luc-Etienne Brachotte wrote:
> Subject: web link checker
> Any help appreciated.
Get a better link checker; there are some good ones available for free
from, among other places, Randal's WebTechniques column archive.
http://www.stonehenge.com/merlyn/WebTechniques/
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 19 Jun 2000 22:55:26 +0200
From: Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
Subject: Re: web link checker
Message-Id: <394E88BE.8546215A@wanadoo.fr>
Tom Phoenix a écrit :
> On Mon, 19 Jun 2000, Luc-Etienne Brachotte wrote:
>
> > Subject: web link checker
>
> > Any help appreciated.
>
> Get a better link checker; there are some good ones available for free
> from, among other places, Randal's WebTechniques column archive.
The checker I wrote is perfect for my site, in fact it is more than a link
checker but a site checker: it checks not only the links but a lot of
other points, including some specific to my site, and prints the results
as an easy-to-read web page with a summary table.
The only point is that I don't know how to write Perl code checking
external links. I want to stop doing this job manually.
------------------------------
Date: Mon, 19 Jun 2000 14:12:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: web link checker
Message-Id: <Pine.GSO.4.10.10006191411070.29843-100000@user2.teleport.com>
On Mon, 19 Jun 2000, Luc-Etienne Brachotte wrote:
> The only point is that I don't know how to write Perl code checking
> external links. I want to stop doing this job manually.
You'll know how to write that code if you read what Randal wrote. That's
at the URL I included. Are you asking for something more?
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Jun 2000 20:44:29 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: What the...
Message-Id: <8im0nd$pld$2@slb0.atl.mindspring.net>
Agentkhaki (altavistaNOalSPAM@agentkhaki.com.invalid) wrote:
: One more thing. I made some modifications (so that the
: script didn't require anything incoming from the browser to
: run) and ran it on my system and it worked fine. So the
: error lies somewhere in the transfer of data between
: browser and script (?) but I'm too dumb to figure out
: why...
No, almost certainly that suggests that the script is being affected by
who it runs as. It seems to work when you're running it as you, but not
when you're asking the Web server to run it as whatever user the server
runs as. perlfaq9 has a few things to say about such issues.
------------------------------
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 3424
**************************************