[11723] in Perl-Users-Digest
Perl-Users Digest, Issue: 5323 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 7 19:17:28 1999
Date: Wed, 7 Apr 99 16:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 7 Apr 1999 Volume: 8 Number: 5323
Today's topics:
Announcement: SanDiego.pm.org is available! (Garrett Casey)
Re: Autoresponder (Bill Moseley)
Re: buggy counter? <jonz@rmi.nospam.net>
Re: convert IP to country of origin (Abigail)
Re: convert IP to country of origin <baliga@synopsys.com>
Re: Date function question <steves@wco.com>
Re: Dyn-IP "wanna be" 1-liner (Andrew Allen)
Re: Dyn-IP "wanna be" 1-liner (Matthew Bafford)
Re: embedded Perl and Borland C++ Builder 4 <fsg@newsguy.com>
Re: Enclosing a binary within perl (Larry Rosler)
Re: File Upload in Internet Explorer (Martin Ackermann)
How do you pass cmd line parameter? <swett@ncats.net>
Re: How do you pass cmd line parameter? <swett@ncats.net>
How to close all file descriptors ? (RJ)
Re: How to close all file descriptors ? (Abigail)
How to load modules that use dynamic libraries <ekabjm@eka.ericsson.se>
Re: Perl as a first programming language - suitability, <jonathan@meanwhile.freeserve.co.uk>
Problem passing variables to NT command file <rperez2@gte.net>
Re: Problem passing variables to NT command file <baliga@synopsys.com>
proxy server error (EME888)
Re: random number ( -w ) (Larry Rosler)
Re: Trouble with DBI and Oracle raymond_ali@my-dejanews.com
Re: Typeglobs broken by threaded perl??? (Andrew Allen)
unexpected file test behaviour <steves@wco.com>
Re: unexpected file test behaviour (Larry Rosler)
Re: unexpected file test behaviour <baliga@synopsys.com>
Re: Using a variable in pattern matching operator <mlefevre@cadence.com>
Re: Using a variable in pattern matching operator (Larry Rosler)
Re: Using a variable in pattern matching operator (Abigail)
Re: Using Perl For ErrorDocuments vpulver@my-dejanews.com
Re: verifying programs can execute <baliga@synopsys.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Apr 1999 21:07:17 GMT
From: remove_this_prefix_adms1@cts.com (Garrett Casey)
Subject: Announcement: SanDiego.pm.org is available!
Message-Id: <370bc8bb.82212875@nntp.cts.com>
http://SanDiego.pm.org
The San Diego group of Perl Mongers was established in late Jan, 1999.
We are a group of Perl enthusiasts (newbies - gurus) that get together
in San Diego on the 2nd Wed of every month.
If you live in San Diego (or plan to be in San Diego) and are
interested in meeting with other Perl people, join us on April 14th,
1999, 7:30pm Starbucks 4227 Genesee Avenue, San Diego, CA 92117.
Visit http://SanDiego.pm.org for more information.
-Garrett Casey
------------------------------
Date: Wed, 7 Apr 1999 15:40:47 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Autoresponder
Message-Id: <MPG.11757ecb72be94c9989717@206.184.139.132>
In article <LrAO2.478$nb3.65940@ptah.visi.com>, oscoord@visi.com says...
> Iam looking for an e-mail autoresponder script. I have been looking
> everywhere without any luc. I see autoresponders everywhere on the
> internet but I cannot seem to find a script anywhere. If you know of such
> a script please let me know... it will be GREATLY appreciated!
Sounds like you don't want to do any programming. If that's the case,
I'd recommend using procmail if running UNIX. Search the web, and you
will find it.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: 7 Apr 1999 22:18:24 GMT
From: Jonesy <jonz@rmi.nospam.net>
Subject: Re: buggy counter?
Message-Id: <7egljg$eqr$1@news1.rmi.net>
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
: You will find a buggy counter in Mothercare ....
: <sorry I just couldnt resist ...>
Yeah, I was wondering how toll road operators counted buggies
back in the horse-and-carriage days...
Jonesy
------------------------------
Date: 7 Apr 1999 22:06:51 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: convert IP to country of origin
Message-Id: <7egktr$cq2$1@client2.news.psi.net>
nguyen.van@imvi.bls.com (nguyen.van@imvi.bls.com) wrote on MMXLV
September MCMXCIII in <URL:news:7eg8g3$gnk$1@nnrp1.dejanews.com>:
,,
,, I just wonder there is any way to convert IP address to country of origin.
No.
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
------------------------------
Date: Wed, 07 Apr 1999 15:35:23 -0700
From: Yogish Baliga <baliga@synopsys.com>
To: nguyen.van@imvi.bls.com
Subject: Re: convert IP to country of origin
Message-Id: <370BDDAB.E2457FE7@synopsys.com>
IP address has nothing to do with the country or any other place. The IP adress
doesnot
encapsulate the country name within it...
-- Baliga
nguyen.van@imvi.bls.com wrote:
> Hello everyone,
>
> I just wonder there is any way to convert IP address to country of origin. Is
> there any perl script to do that. Please give me some hints. By the way, is
> there any company doing this kind of work ? Please give me some names of
> companies.
>
> Thanks
> Van Nguyen
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 07 Apr 1999 14:31:59 -0700
From: Steven Smith <steves@wco.com>
Subject: Re: Date function question
Message-Id: <370BCECF.B37378F4@wco.com>
Look at Time::Local
nkaiser@my-dejanews.com wrote:
> Thanks, that helps. However, another thing I'll need to be able to do is this:
>
> $time = 'Mar 24 12:00:00';
>
> This is the exact format which I will get a date. It is basically the same as
> localtime(time), except it doesn't have the day of the week, year, or
> timezone.
>
> Now, I need to convert this to a number (similar to time()) so I can compare
> dates. And then be able to change it back to a string.
>
> Is this possible?
>
> Thanks again.
> Neal
>
> In article <MPG.11621adfdac5adc99896e6@206.184.139.132>,
> moseley@best.com (Bill Moseley) wrote:
> > In article <7d9qt2$8n6$1@nnrp1.dejanews.com>, nkaiser@my-dejanews.com
> > says...
> > > Is there a way to get the current date in as a large number, rather than
> > > localtime(time). Then, convert it back to localtime(time) format for
> > > displaying.
> >
> > This what you mean?
> >
> > $time = time();
> >
> > $later = $time + 12 * 3600;
> >
> > $string_date = scalar localtime( $later );
> >
> > print "And the time was: $string_date\n";
> >
> > The docs on localtime are enjoyable.
> >
> > --
> > Bill Moseley mailto:moseley@best.com
> >
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 7 Apr 1999 22:25:17 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Dyn-IP "wanna be" 1-liner
Message-Id: <7egm0d$e2p$2@fcnews.fc.hp.com>
Matthew Bafford (dragons@scescape.net) wrote:
: Wed, 7 Apr 1999 13:09:43 -0500 -- Jay J <SpamMeNOT.3pound@iname.com>:
: -> Half jokingly, but - can someone think of a way to get rid of the seperate
: -> 'my' line, and still be strict compliant?
: ->
: -> #!/usr/bin/perl -wl
: -> my %seen = (); ## thanks Perl-Cookbook, cool dedupe
: -> print (my $ip = [ grep { ! $seen{$_}++ } grep !/255.255.255.255/, map
: -> /([1-9]\d+\.\d+\.\d+\.\d+)/ } grep /ppp/, map { split /s+/ }
: -> `/sbin/route -n` ]->[0]);
: or:
: #!/usr/bin/perl -wl -Mstrict
: print+(grep{!$_{$_}++}grep{!/(255\.){3}255\./x}map{/([1-9]\d+\.
: \d+\.\d+\.\d+)/x}grep{/ppp/}map{split/s+/}`/sbin/route -n`)[0];
: Woah! 1 char less than the one before! :-)
Hmmm... I'm confused. Why do you need to "de-dupe" if you're going to
use the first element anyways... looks like another '\.' crept in after
the final "255". Also, couldn't the IP start with a single 1-9
digit, needing '[1-9]\d*' instead of '[1-9]\d+'?
Unfortunately, I don't any 'route' output available, but it seems like
you should be able to replace
map{/([1-9]\d*\.\d+\.\d+\.\d+)/}grep{/ppp/}map{split/s+/}
with something like
/ppp[^s]*([1-9]\d*(?:\.\d+){3})/g
(or maybe the 'ppp' is after, I don't know--are you really splitting
on the letter 's'???). I guess these suggestions yield:
#!/usr/bin/perl -wl -Mstrict
print+(grep{!/(255\.){3}255/}`/sbin/route -n`=~/ppp[^s]*([1-9]\d*(?:\.\d+){3})/g)[0];
Andrew
------------------------------
Date: Wed, 07 Apr 1999 22:35:38 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Dyn-IP "wanna be" 1-liner
Message-Id: <slrn7gnil6.4le.dragons@dragons.duesouth.net>
Wed, 7 Apr 1999 15:59:50 -0500 -- Jay J <SpamMeNOT.3pound@iname.com>:
-> I dunno why I find both posts completely helarious, but I do..
:-)
-> But you lost me: print+ , +[ .. huh? what gives??
Ok, it's misleading on the first one, a space would have worked fine.
On 2 and 3 you have to use the + or -w complains.
$ perl -w-
#!/usr/bin/perl -wl
use strict;print (grep{!$_{$_}++}grep{!/(255\.){3}255\./}map{/([1-9]
\d+\.\d+\.\d+\.\d+)/x}grep{/ppp/}map{split/s+/}`/sbin/route -n`)[0];
^D
print (...) interpreted as function at - line 2.
Can't use subscript on print at - line 3, near "0]"
$
It all has to do with 'If it looks like a function, it is a function' rule.
The + trick was, IIRC, a slight alteration of what I read in the bCamel
(page 78, near the bottom). I've seen it used here before, so who knows...
-> point me to perldoc perlcryptic 'er something :) .. never see that before,
-> but not surprised.
:-)
-> > #!/usr/bin/perl -wl
-> > use strict;print+[grep{ !$_{$_}++}grep{!/(255\.){3}255\./x}map{/([1-9]
-> > \d+\.\d+\.\d+\.\d+)/x}grep{/ppp/}map{split/s+/}`/sbin/route -n`]->[0];
In this case the + is just an extra character.
#!/usr/bin/perl -wl
use strict;print[grep{ !$_{$_}++}grep{!/(255\.){3}255\./x}map{/([1-94]
\d+\.\d+\.\d+\.\d+)/x}grep{/ppp/}map{split/s+/}`/sbin/route -n`]->[0];
Hope This Amuses!
--Matthew
------------------------------
Date: Wed, 7 Apr 1999 14:39:32 -0700
From: "Felix S. Gallo" <fsg@newsguy.com>
Subject: Re: embedded Perl and Borland C++ Builder 4
Message-Id: <7egj8j$1cpq@enews2.newsguy.com>
I wrote a TPerl, several months ago, that let you use
a Perl interpreter as a native VCL object under
C++Builder. I don't have it any more, but it's trivial
to do.
Felix
David Christensen wrote in message <370a5c91@news2.newsfeeds.com>...
>I am wondering if anybody else has ideas for embedding Perl in
>Builder?
------------------------------
Date: Wed, 7 Apr 1999 14:47:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Enclosing a binary within perl
Message-Id: <MPG.1175723f33bb8de598985c@nntp.hpl.hp.com>
In article <x3y3e2cntoz.fsf@tigre.matrox.com> on Wed, 7 Apr 1999
14:58:55 -0400 , Ala Qumsieh <aqumsieh@matrox.com> says...
...
> Perl isn't really that slow. My benchmarks on a 6.7 MB file show that
> grep takes around 2.6 seconds to find a work that occurs 562
> times. The equivalent Perl one-liner:
>
> perl -ne 'print if /pattern/' filename
>
> took around 3.2 seconds.
> Moreover, if the file is already open in your script, I would say it
> would be faster to use Perl's internal grep() function, rather than
> spawning a child process via system() to run grep and take the results
> back in.
>
> print "Success" if grep { /Pattern/ } <FH>;
>From perlfaq4:
Please do not use
$is_there = grep $_ eq $whatever, @array;
or worse yet
$is_there = grep /$whatever/, @array;
> If you simply want to know if a pattern exists in a file, a better
> solution might be something along the lines of:
>
> $success = 0;
> while (<FH>) {
> if (/Pattern/) {
> $success = 1;
> last;
> }
> }
>
> print "SUCCESS" if $success;
>
> This exits the loop once a match is done.
If anyone plans to do any further time comparisons with the 'grep'
command, keep in mind that this faster 'print SUCCESS and quit'
functionality is available via the 'grep -l' (ell) option.
Also, the faster 'match a fixed string' algorithm (also used by perl's
grep function) is available via the 'grep -F' option.
Experience tells me that this is faster than the corresponding Perl
programs. But, as Ala said, not necessarily to the point of being
worthwhile to spawn a process to run it from within Perl.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 07 Apr 1999 23:16:56 +0200
From: Surferman@t-online.de (Martin Ackermann)
Subject: Re: File Upload in Internet Explorer
Message-Id: <370BCB47.5DB7DF9A@schmetterling.nu>
Toggweiler Mike schrieb:
> Das ist der Source zum uploaden
> In Netscape funktionert es:
>
> open(WRITEFILE,">$link_file");
> binmode(WRITEFILE);
> PrintV(1,"Data:\n");
> #Read the file from the HD
> while(read($open_file,$buffer,1024)){
> PrintV(2,"$buffer\n");
> print WRITEFILE $buffer;
> }
> PrintV (1,"Upload done\n");
> close $open_file;
> close WRITEFILE;
Hallo,
Wo ist der Datei Header ?
Sowas wie Content type ...
Bye
--
Homepage : http://www.schmetterling.nu
ICQ-UIN : 9559861
------------------------------
Date: 6 Apr 1999 20:31:35 -0500
From: "Steve Swett" <swett@ncats.net>
Subject: How do you pass cmd line parameter?
Message-Id: <01be8091$1a3bea20$68e4b0c7@bcs.newaygo.mi.us>
How do you pass a command line parameter from one program to another?
My real situation goes something like this:
1. CGI program "suggestionlist.cgi" displays a form on a browser. When
the form is submitted, it runs a program called "importance.cgi".
2. CGI program "importance.cgi" updates database records. I would like
this program then to automatically return to the "suggestionlist.cgi"
program, but I would like to pass it a couple values -- a product ID and a
customer ID.
I can successfully return to the "suggestionlist.cgi" program by using the
EXEC function at the end of the "importance.cgi" program, but I can't
figure out how to pass parameters.
So, I decided to simplify this whole deal and just test 2 programs -- one
program "calling" the other program and passing it parameters. I can't
figure out how to do it. Here are the 2 test programs:
LINK1.CGI:
------------------
#!/usr/bin/perl -w
use diagnostics;
exec("./link2.cgi","fish");
LINK2.CGI:
-------------------
#!/usr/bin/perl -w
use diagnostics;
$parm1=$argv[0];
print "$parm1";
I'm expecting the word "fish" to be printed, but I can't figure out how to
do this.
Any help would be greatly appreciated. Thanks.
------------------------------
Date: 7 Apr 1999 07:59:30 -0500
From: "Steve Swett" <swett@ncats.net>
Subject: Re: How do you pass cmd line parameter?
Message-Id: <01be80f1$3536a580$68e4b0c7@bcs.newaygo.mi.us>
Nevermind. I figured it out by using the Getopt::Long module.
------------------------------
Date: Wed, 07 Apr 1999 21:07:30 GMT
From: raymondj@removethis.raleigh.ibm.com (RJ)
Subject: How to close all file descriptors ?
Message-Id: <370cc7b1.24538875@mdnews.btv.ibm.com>
I am having a problem when I fork a new process from a CGI. The web
client does not end the connection until the newly created process
ends (the newly created process does not end so the client's
connection never ends.)
With a little bit of debugging I see that the web server has access to
the newly created process through file handle 7 (as seen by the new
process)
Question: How in perl can you close all file handles? (or even a
particular one without having a perl FILEHANDLE reference.
In C you could use fcntl(0, F_CLOSEM, 1); but F_CLOSEM does not
appear to be available in perl.
raymondj@removethis.raleigh.ibm.com
------------------------------
Date: 7 Apr 1999 22:08:51 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to close all file descriptors ?
Message-Id: <7egl1j$cq2$2@client2.news.psi.net>
RJ (raymondj@removethis.raleigh.ibm.com) wrote on MMXLV September
MCMXCIII in <URL:news:370cc7b1.24538875@mdnews.btv.ibm.com>:
^^
^^ Question: How in perl can you close all file handles?
exit;
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: Wed, 07 Apr 1999 23:26:16 +0200
From: "Bjvrn Medin" <ekabjm@eka.ericsson.se>
Subject: How to load modules that use dynamic libraries
Message-Id: <370BCD78.3BF3FF9@eka.ericsson.se>
Hi,
I am coding a module that uses a dynamic library. I have tried both XS
and SWIG but they
both complain about the same thing. I have no problems building the
thing but when I try
to load it I fail with an error like this:
DB<1> use admin;
Can't load './admin.so' for module admin: ld.so.1: /usr/bin/perl: fatal:
relocation error: symbol not found: ciSys: referenced in ./admin.so at
/opt/perl/lib/5.00502/sun4-solaris/DynaLoader.pm line 168, <IN> chunk 1.
I have the directory where the so library is located in my
LD_LIBRARY_PATH and if I build a test
program using the shared module (admin.so) I have no problems, it seems
to find my legacy module
libprim.so (containing sybmol ciSys etc).
What to do. It must be possible to use modules using dynamic libraries!
Thanks!
/Bjvrn Medin
I am using a Sun ultrasparc with SunOS 5.5.1 and /usr/bin/perl -V says:
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=solaris, osvers=2.5.1, archname=sun4-solaris
uname='sunos wips 5.5.1 generic_103640-18 sun4u sparc sunw,ultra-30
'
hint=previous, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under solaris
Compiled at Oct 15 1998 23:05:05
@INC:
/opt/perl/lib/5.00502/sun4-solaris
/opt/perl/lib/5.00502
/opt/perl/lib/site_perl/5.005/sun4-solaris
/opt/perl/lib/site_perl/5.005
.
------------------------------
Date: Wed, 7 Apr 1999 23:55:34 +0100
From: "Jonathan" <jonathan@meanwhile.freeserve.co.uk>
Subject: Re: Perl as a first programming language - suitability, good books ?
Message-Id: <7egnpv$nqm$1@news8.svr.pol.co.uk>
That's certainly a lot of replies. I'm surprised that no one seems to have
read the Perl For Dummies book or commented on it. I've had a good look at
it myself and I think it's quite good for its market. I certainly wouldn't
point a non-programmer at the Llama book - it takes far too much for granted
about the basics (what an array is, etc.) Llama would be good for a student
in the first year of university, or someone with a little exposure to any
language. On the other hand, I don't think it goes as far as references ?
And Dummies does.
The Cookbook is an excellent book, but it's pretty scary looking for a
beginner (and doesn't address the language at all.)
Regarding suggestions to learn other languages - my own first programming
language was Basic, the second was Awful - sorry I mean Eiffel. I wouldn't
inflict a toy or an academically designed purist language on anyone.
Programming is about all sorts of subtle linguistic textures, idioms, and
cues that these languages generally don't provide, and Perl does. That's
certainly why all the talented programmers I know who have worked with
Eiffel - several of us before using C++ or C, so there was no question of
rejecting it merely because we used to those very opposite languages
irst - shudder at its name. (I have a strict rule on condeming languages. I
don't say that you should never do it, but you only have the right to
criticise them if you had to use them for at least half a year and were good
enough to correct the work of whoever made everyone else use the damn thing
in the first place.)
Maybe Python doesn't belong to that club. *Probably* it doesn't. But I do
understand that it's "verbose" and that it has a high ratio of people
writing research papers about it to people using it for solving real
problems. These I take as bad signs. Oh, and I just junk email from some
silly ass (no one who posted here) telling me that Perl is "good for
nothing" and that my friend should learn Python instead. This doesn't
reflect badly on Python at all, but this sort of over defensiveness normally
means a language is an economic dead goose, and hey, we've all got to eat.
And I *know* Perl is good. And Larry Wall certainly meant it as a language
for people like my friend - look at the intro to the Camel book.
Perl can be used to write useful real world programs with only knowledge of
the basic variable types and functions. It can encompass the idea of "many"
effectively and simply with its powerful, simple to use arrays and hashes.
It can provide data types (using hashes) too. There's no equivalent of the
pointer or the copy constructor to learn (you know what I mean) and it has
has an incredible expressive power - in Perl you say what you mean, not what
the language forces you to say (unlike Eiffel - and Pascal looks like Eiffel
to me.) It handles "unusual" conditions (eg trying to print undefs) with
human-ish sense, in my book making it a far natural language than any other
I've seen - the Perl computational model includes the computer behaving with
common sense behaviour, the first time I've heard of such a thing. Normally
it's this lack of "common-sense" from a PC that causes more problems for a
non-programmer starting out than anything else. And come to think of it,
that anti-"say what you mean" thing is often obstacle number two.
( I'd even say that Perl might make an excellent children's language, if a
book was written to use just a simple subset and it shipped with a nice
turtle graphics package - my one worry here would be the lurking presence of
the special variables. They are too confusing to explain to a 12 year old,
but if you don't what happens when one of the kids decides to call a
variable $_ ? )
Thanks for all replies,
Jonathan Coupe.
------------------------------
Date: Wed, 7 Apr 1999 15:59:16 -0500
From: "Turbo" <rperez2@gte.net>
Subject: Problem passing variables to NT command file
Message-Id: <7egg0b$eki$1@news-1.news.gte.net>
I am trying to pass a perl variable to a NT command file. The command file
is not taking the variable, does anybody know if this is possible and how?
thanks
rp
------------------------------
Date: Wed, 07 Apr 1999 15:17:26 -0700
From: Yogish Baliga <baliga@synopsys.com>
To: Turbo <rperez2@gte.net>
Subject: Re: Problem passing variables to NT command file
Message-Id: <370BD975.29C9D9F@synopsys.com>
I didn't get the question correctly. Are you trying to call the NT command file
from the
perl program or from the DOS prompt?
-- Baliga
Turbo wrote:
> I am trying to pass a perl variable to a NT command file. The command file
> is not taking the variable, does anybody know if this is possible and how?
>
> thanks
> rp
------------------------------
Date: 7 Apr 1999 21:06:28 GMT
From: eme888@aol.com (EME888)
Subject: proxy server error
Message-Id: <19990407170628.13105.00004903@ng-cg1.aol.com>
Hello,
Yesterday I posted question about perlshop error #6. Since yesterday I have
realized the cause but do not know how to fix it. Perlshop takes the order and
customer info flawlessly but displays a transmission error #6 when the final
confirmed order is processed. This is being caused by customers using a proxy
server(like aol). I need to know the subroutine in perlshop for checking for
the "machine number" of the user. If anything other than a number of the format
"xxx.xxx.xxx.xxx" is given by the server, perlshop rejects the order. Does
anyone know what the hell I'm talking about? If anyone can help I would
appreciatre it.
If convenient, feel free to call me(randy) at 1-888-741-EDPS or just reply to
the group. Also, I have seen interest in starting a perlshop newsgroup. I
wouldn't mind helping to get this started.
Thanks in advance!!
------------------------------
Date: Wed, 7 Apr 1999 13:49:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: random number ( -w )
Message-Id: <MPG.117564b56aec53ce98985b@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7egel9$i1g$2@newsflash.concordia.ca> on 7 Apr 1999 20:19:53
GMT, Rich Lafferty <rich@vax2.concordia.ca >says...
> Bart Lateur <bart.lateur@skynet.be> wrote:
> > Abigail wrote:
> >
> > ><> What does the "-w" do?
> > >
> > >It does what the manual says it does!
> >
> > That's good! Otherwise, it would have been a bug.
>
> But -w *is* a bug. Or so perl(1) tells me.
No. I think you know this. But for those who might not:
perl(1) tells you that the default of 'warnings off' is a design bug in
the Perl language. So now, omitting to use it is an implementation bug
in a Perl program.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 07 Apr 1999 22:02:56 GMT
From: raymond_ali@my-dejanews.com
Subject: Re: Trouble with DBI and Oracle
Message-Id: <7egkma$ruq$1@nnrp1.dejanews.com>
Darren,
Try using this:
my $dbh = DBI->connect('dbi:Oracle:','drgreer','drgreer@QTI');
or
my $dbh = DBI->connect('dbi:Oracle:','drgreer/drgreer@QTI');
this:
drgreer/drgreer@QTI
means drgreer is your user name
and drgreer@QTI is your password.
Respectfully,
RMA
In article <370aaea0.84462871@news.qgraph.com>,
drgreer@qtiworld.com (Darren Greer) wrote:
> Sorry for the repost: I had the subject in the wrong field:
>
> Howdy all....I am having problems with DBI and Oracle. Below is my
> code, to access our Database, and perform a simple query. Following
> the code, is the error I get.
>
> --------------------- CODE ----------------------
> #!/usr/bin/perl -w
>
> use DBI;
>
> $ENV{ORACLE_HOME} = '/usr/oracle/7.3.4';
> $ENV{TWO_TASK} = 'T:homer:QTI';
>
> my $dbh = DBI->connect('dbi:Oracle:','drgreer/drgreer@QTI','');
>
> $query = "SELECT partnumber FROM partmaster WHERE partno = '108755'";
>
> my $sth = $dbh->prepare($query) || die "Cant execute prepare
> statement";
> my $rc = $sth->execute || die "Cant execute statment: $DBI::errstr";
>
> print "$sth->{NAME}->[0]\n";
>
> while (@row = $sth->fetchrow_array) {
> print "$row[0]\n";
> }
>
> $sth->finish;
> $dbh->disconnect || warn $sth->errstr;
> --------------- END CODE --------------
>
> This is not much of an error, as it is more of a lock-up. This was
> run from the debugger, and below, is the point where it locks up. The
> debugger never gets past the "connect" line in the code. The
> following is where my code locks up, and sites there eating a TON of
> cpu. The process eventually has to be killed, to stop it. Any help
> or insight would be greatly appreciated.
>
> ------------------ ERROR -----------------
> DB<1>
> DBD::Oracle::dr::connect(/opt/perl5/lib/site_perl/DBD/Oracle.pm:206):
> 206: DBD::Oracle::db::_login($dbh, $dbname, $user, $auth)
> 207: or return undef;
> DB<1>
> ---------------------------------------------------
>
> Darren
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 7 Apr 1999 22:40:48 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Typeglobs broken by threaded perl???
Message-Id: <7egmtg$e2p$3@fcnews.fc.hp.com>
Bruce R Miller (miller@altaira.cam.nist.gov) wrote:
: Is there any workaround (other than recompiling perl w/o threads) to
: recover the local $_?
: Wrapping a
: { local($_)=('');
: ... }
: around everything doesn't seem to help.
I don't have threaded perl to try this on, but does pounding $_ into
the namespace work?, i.e.
local *_=\$_;
at the beginning of your code? Of course, only one thread's $_ would
become the "global" $_, but it sounds like you're uni-thread anyways.
$_ has always been semi-magical anyways, so I don't think lexicalizing
it for threads is _that_ big of a deal, and _something_ was necessary
for threads to get, say, two simultaneously-running greps to work
properly.
Andrew
------------------------------
Date: Wed, 07 Apr 1999 14:30:13 -0700
From: Steven Smith <steves@wco.com>
Subject: unexpected file test behaviour
Message-Id: <370BCE65.301E2E5F@wco.com>
The following gives "Use of uninitialized value at line 4." error if
file doesn't exist. What gives?
1 #!/usr/local/bin/perl -w
2 foreach $file (@ARGV) {
3 print "$file:";
4 print int (-e $file);
5 print ((-e $file) ? "yes\n" : "no\n");
6 }
7
> t.pl x y z
x:1yes
Use of uninitialized value at .//t.pl line 4.
y:0no
Use of uninitialized value at .//t.pl line 4.
z:0no
Thanks
Steve S.
Alcatel -- petaluma , CA.
------------------------------
Date: Wed, 7 Apr 1999 15:06:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: unexpected file test behaviour
Message-Id: <MPG.117576bcb341810998985e@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <370BCE65.301E2E5F@wco.com> on Wed, 07 Apr 1999 14:30:13 -
0700, Steven Smith <steves@wco.com> says...
> The following gives "Use of uninitialized value at line 4." error if
> file doesn't exist. What gives?
> 1 #!/usr/local/bin/perl -w
> 2 foreach $file (@ARGV) {
> 3 print "$file:";
> 4 print int (-e $file);
> 5 print ((-e $file) ? "yes\n" : "no\n");
> 6 }
> 7
Read the documentation, dude!
>From "-X filetest operators" in perlop:
Unless otherwise documented, it returns 1 for TRUE and '' for FALSE, or
the undefined value if the file doesn't exist.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 07 Apr 1999 15:10:20 -0700
From: Yogish Baliga <baliga@synopsys.com>
To: Steven Smith <steves@wco.com>
Subject: Re: unexpected file test behaviour
Message-Id: <370BD7CC.E86192C2@synopsys.com>
THe file testing operators returns 1 for true and
returns "" or undefined value for false, which is implementation
dependent.
So when you are trying to print the value of the testing output, it is
trying to
print the undefined value.
-- Baliga
Steven Smith wrote:
> The following gives "Use of uninitialized value at line 4." error if
> file doesn't exist. What gives?
> 1 #!/usr/local/bin/perl -w
> 2 foreach $file (@ARGV) {
> 3 print "$file:";
> 4 print int (-e $file);
> 5 print ((-e $file) ? "yes\n" : "no\n");
> 6 }
> 7
> > t.pl x y z
> x:1yes
> Use of uninitialized value at .//t.pl line 4.
> y:0no
> Use of uninitialized value at .//t.pl line 4.
> z:0no
>
> Thanks
> Steve S.
> Alcatel -- petaluma , CA.
------------------------------
Date: Wed, 07 Apr 1999 17:28:54 -0400
From: "Mark B. Lefevre" <mlefevre@cadence.com>
Subject: Re: Using a variable in pattern matching operator
Message-Id: <370BCE16.AB626BD@cadence.com>
The answer lies in the interpolative context of "".
A "\b" will be interpolated as a backspace.
A '\b' will not be interpolated.
If you are getting a string from somewhere and want to match it as a
word, you can
$var = '\b' . $string . '\b\;
if (/$var/){...
Thanks to Jay and Umesh!
"Mark B. Lefevre" wrote:
> Jay,
>
> Thank you. That was a typo on my part.
>
> $pat = "cell";
> if (/\b$pat\b/) {.....
>
> versus
>
> $pat = "\bcell\b";
> if (/$pat/) {....
>
> What I am trying to do is use a -w command line option for the perl
> script to match the argument
> as a word. I'd like to modify the pattern to include the \b's.
>
> Mark
>
> Jay J wrote:
>
> > The first one's broken, that's why..
> > Perl should complain: Search pattern not terminated
> >
> > Cuz it's not - if (/\b$pat\b/) ... however, would work fine.
> >
> > -Jay J
> >
> > Mark B. Lefevre <mlefevre@cadence.com> wrote in message
> > news:370BC16A.EAF1E973@cadence.com...
> > > I am using a variable in a pattern matching operator and I don't
> > > understand why the following two
> > > code snippets behave differently:
> > >
> > > $pat = "cell";
> > > if (/\b$pat\b) {.....
> > >
> > > versus
> > >
> > > $pat = "\bcell\b";
> > > if (/$pat/) {....
> > >
> > > Why the different behavior ?
> > >
------------------------------
Date: Wed, 7 Apr 1999 14:58:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Using a variable in pattern matching operator
Message-Id: <MPG.117574f02819d5d798985d@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <370BC57C.94E0384C@cadence.com> on Wed, 07 Apr 1999 16:52:13
-0400, Mark B. Lefevre <mlefevre@cadence.com> says...
> $pat = "cell";
> if (/\b$pat\b/) {.....
>
> versus
>
> $pat = "\bcell\b";
> if (/$pat/) {....
>
> What I am trying to do is use a -w command line option for the perl
> script to match the argument
> as a word. I'd like to modify the pattern to include the \b's.
Even though a regex is similar to a double-quoted string, it is not
identical. In particular, in a regex "\b" means 'word boundary', but in
a double-quoted string "\b" means 'backspace'. If you replace the line
$pat = "\bcell\b";
by
$pat = '\bcell\b';
everything will work as you want.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 7 Apr 1999 22:10:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Using a variable in pattern matching operator
Message-Id: <7egl58$cq2$3@client2.news.psi.net>
Mark B. Lefevre (mlefevre@cadence.com) wrote on MMXLV September MCMXCIII
in <URL:news:370BC16A.EAF1E973@cadence.com>:
** I am using a variable in a pattern matching operator and I don't
** understand why the following two
** code snippets behave differently:
**
** $pat = "cell";
** if (/\b$pat\b) {.....
**
** versus
**
** $pat = "\bcell\b";
** if (/$pat/) {....
**
** Why the different behavior ?
Because of interpolation by different operators. "" interpretes \b
different than //.
Try: $pat = '\bcell\b';
or: $pat = "\\bcell\\b";
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
------------------------------
Date: Wed, 07 Apr 1999 21:15:32 GMT
From: vpulver@my-dejanews.com
Subject: Re: Using Perl For ErrorDocuments
Message-Id: <7eghtc$p9p$1@nnrp1.dejanews.com>
In article <37090194.11674826@news.iaw.on.ca>,
hutcheon@iaw.on.ca wrote:
> I am experienced in perl and unix, but I can't figure out how to get a
> script of mine to work. It is supposed to, among other things, report
> on errors.
>
> Simulated Error: works fine
> Real Error: 404 screen with 500 on the errordocument
>
> I checked the script through, there are no errors in it..
>
> Questions:
> Is there anything special needed for responding to the error? HTML
> headders, etc?
> Can I use a 1; at the end of the file? will this effect the run?
> Can Full Query Strings be used in the .htaccess? ie:
> ErrorDocument 404 error.cgi?err=404
> ..or does it have to be..
> ErrorDocument 404 error.cgi?404
> ..or can I use them?
> ErrorDocument 404 error.cgi
> ..is there a variable that says the errorcode, like
> $ENV{'REQUEST_REASON'}?
>
> Any help is appreciated, please CC this to hutcheon@iaw.on.ca, my
> email address. Thanks in advance.
>
> Tyler Hutcheon
> hutcheon@iaw.on.ca
>
Apache provides a whole set of environment variables to an ErrorDocument
script. The one which has the error reason is $ENV{'REDIRECT_STATUS'}. The
URL of the missing document (in the case of a 404 error) is in
$ENV{'REDIRECT_URL'}.
I suspect you are missing the HTTP header on what you are writing out. I use
CGI.pm and do a print header() before providing the data. Alternatively, you
can do something like print "HTTP/1.0 200 OK\n\n" prior to the data you are
returning.
I use an ErrorDocument script to attempt to correct typos (wrong case,
backslashes instead of forward slashes, etc.) and to redirect to documents
which have moved from our current day newspaper into our archives. If I can
correct the url, I return a 301 or 302 Document moved and a location:
HTTP/1.0 301 Moved permanently
Location: http://somewhere.else.com/whatever.html
Otherwise, I return an error page giving clues on how to search for the
document on our site:
HTTP/1.0 404 Not found
Content-Type: text/html
<HTML>.....
Note that the HTTP header must be followed by a blank line (even if no
document follows).
As I said above, I actually use CGI.pm; for redirects, I use the redirect()
function; otherwise, I print the header() data followed by my content.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 07 Apr 1999 15:28:53 -0700
From: Yogish Baliga <baliga@synopsys.com>
To: "Christian M. Aranda" <christianarandaOUT@OUTyahoo.com>
Subject: Re: verifying programs can execute
Message-Id: <370BDC24.5F8B4E23@synopsys.com>
Here you are telling you want the check the validity of the program. But I
am not able
to get why you have used -X condition to check the validity of the
program. It checks
if the file has executable permission or not. But when you refer to
validity it means
the validity of the program, i.e. the Syntax is Ok...
-- Baliga
"Christian M. Aranda" wrote:
> I have a script which has to system() at various points. Well, we
> don't want the script to system() and execute something that isn't
> working properly, so I wrote this sub to check the validity of the
> executables:
>
> #########################
> sub verify_programs {
> my ($program);
>
> $Tar = "/bin/tar";
> $Rsh = "/bin/rsh";
> $Ftp = "/bin/ftp";
>
> foreach $program ($Tar, $Rsh, $Ftp) {
> if ( ! -X $program ) {
> die "Program $program is not where I thought it would be:
> $!";
> }
> }
> }
>
> Now, there are obvious problems with this: first of all, every time I
> add a new program, I'll need to put a new variable in the foreach
> line. There must be a better way to accomplish this. Or perhaps I've
> found the best way, and no one will have any suggestions <j/k> :)
>
> All feedback is appreciated and welcomed!
>
> ---------------------------------
> Christian M. Aranda
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5323
**************************************