[8015] in Perl-Users-Digest
Perl-Users Digest, Issue: 1639 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 14 17:17:39 1998
Date: Wed, 14 Jan 98 14:00:29 -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 Wed, 14 Jan 1998 Volume: 8 Number: 1639
Today's topics:
[Help] Can't seem to access GLOBALS across package modu (Tarang K. Patel)
Re: alphabetical subset of hash keys <joseph@5sigma.com>
Re: ANNOUNCE: FREE LINKS LIST -- FREE!! (brian d foy)
Re: basename with NT (Steve Linberg)
Re: Comparing strings (Matthew Cravit)
Re: Create file (brian d foy)
Re: elegant way to compare two arrays (Mick Farmer)
Re: elegant way to compare two arrays (Charles DeRykus)
Ever modified Win NT registry with Perl? <rxst50@email.sps.mot.com>
Re: Finding bits in a string (Greg Bacon)
Re: getting charecters from a variable (Mick Farmer)
help a beginner with search string (Dave Ekhaus)
Re: Help with my code please (Greg Bacon)
Re: Help with my code please (brian d foy)
Help! with dbmopen and hash evaluation Perl 5.002 <fbjackes@hudsonwilliams.com>
Re: Help: sending HTML by email from Perl/CGI (brian d foy)
Re: Help: sending HTML by email from Perl/CGI <orangutan@grungyape.com>
How to "build" variablenames ? (Calle ]sman)
Re: How to "build" variablenames ? (brian d foy)
IIS on NT and perl32 <bob.trieger@fmr.com>
Re: IIS on NT and perl32 (Steve Linberg)
Module Installation for Perl 5.004_04 under AIX <ddreed@rs6000.cmp.ilstu.edu>
Re: Multi-line input: fastest way? <joseph@5sigma.com>
Re: opening text file (brian d foy)
Re: Perl advanced graphics processing (Caius van Nouhuys)
Perl issues with Win32 & IIS (Steve Linberg)
Re: Perl not Y2K compliant (I R A Aggie)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Jan 1998 17:33:56 GMT
From: fruitbat@nas.nasa.gov (Tarang K. Patel)
Subject: [Help] Can't seem to access GLOBALS across package modules !!!!
Message-Id: <69isu4$pj$1@cnn.nas.nasa.gov>
Keywords: Perl5 I am having problems with accessing GLOBAL variables across package modules. Best to show a noddy code that fails to work as I expect it to.
file: A.pm
----------
package A;
use Exporter ();
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw($a);
use English;
use Vis::B;
# use vars qw($a);
$a="c{}";
print "This is main module in package A, and \$a= $a\n";
$d=&c();
print "Back in package A and \$a = $a, returned from \&c\(\) with $d\n";
file: Vis/B.pm
--------------
package Vis::B;
use Exporter ();
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(&c);
use English;
use lib "../";
use A;
sub c {
my $module = ref bless[];
print "This is module $module \$a= $a\n";
$a .= $module;
return 1;
}
---------------------------------------
to run :
perl -e 'use A;'
Results:
---------
This is main module in package A, and $a= c{}
This is module Vis::B $a=
Back in package A and $a = c{}, returned from &c() with 1
-------------------------------------------
Notice Line 2 is printed from calling &c(), however
the global variable $a appears to have no value. Also
on return the global remains unchanged ?
[Q] So why doesn't this work outside of main:: ?
Really, as I have the statement "use A;" in Vis/B.pm there
shouldn't be a need to Fully qualify the global variable "$a" as
$A::a. I mean this defeats the purpose of having an
@Export = qw($a); # in A.pm
and
use A; # in Vis/B.pm
Your help in this matter would be appreciated. Please email me any
reponse as I do not often get a chance to catch up on news on this group.
Many thanks,
Tarang
--
Tarang Kumar Patel. WWW home:http://www.nas.nasa.gov/
NASA Ames Research Center, MS 258-1, Moffett Field, CA 94035-1000
Email: maumau@nas.nasa.gov, Tel:(650) 604-4721 fax: (650) 604 2238
Stated views are my own IDEA, as I'm another I.D.E.A man "I Didn't Explain All"
------------------------------
Date: Tue, 13 Jan 1998 13:44:57 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: alphabetical subset of hash keys
Message-Id: <34BBD248.173D404C@5sigma.com>
Am I missing something, or is there some reason why you can't
just seek to the first entry in the B-tree after, say, 'C',
and continue (using the each operator) until keys no longer
start with 'C'? It is a B-tree, after all. I don't have the
Berkeley DB man pages in front of me so I don't know what call
you use to seek prior to sequential access, but ....
-joseph
John Capell wrote:
>
> If I have a large hash, how can I run a routine on just the keys that
> start with a certain letter? I want something that looks like:
>
> foreach $key (keysthatstartwithA %myhash) {
> print "$myhash{$key}\n";
> }
>
> to work like:
>
> foreach $key (keys %myhash) {
> if ( substr($key,0,1)=="A" ) { print "$myhash{$key}\n" };
> }
>
> but without having to bang through every key in the hash to see if it
> starts with 'A' (that just seems inefficient to me)
>
> BTW - this hash is tied to a BTREE Berkely DB, so the hash keys will
> be returned in alphabetical order. What I'm trying to do is allow the
> user to 'query' the database by letter.
------------------------------
Date: Wed, 14 Jan 1998 15:58:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: ANNOUNCE: FREE LINKS LIST -- FREE!!
Message-Id: <comdog-ya02408000R1401981558240001@news.panix.com>
Keywords: from just another new york perl hacker
In article <884751137.717160449@dejanews.com>, iguana@one.net posted:
> Be sure to check out Iguana's link list... I tend to think that it is
>one of the most stable and configurable perl links lists out there. It
>can be downloaded for free at:
my definition of free doesn't include a $10 donation.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 15:39:36 -0500
From: slinberg-bitme@crocker.com (Steve Linberg)
Subject: Re: basename with NT
Message-Id: <slinberg-bitme-1401981539360001@projdirc.literacy.upenn.edu>
In article <01bd20d9$d3243740$0c07000a@dns1.filnet.fr>, "Olivier"
<PAYS@FILNET.fr> wrote:
> I would like to use the same command as basename (UNIX)
>
> to obtain with a path like
> c:\folderA\folderB\file.txt -->file.txt
>
> This expression is not good why ???
>
> $base=($File=~m|.*/([^/]+)$|)
>
> P.S:I dont want to use cgi.pm
How about:
$File = 'c:\folderA\folderB\file.txt'; # <- note single quotes
$File = "c:\\folderA\\folderB\\file.txt"; # <- or double quotes and slashes
$File =~ /.*\\(.*)/;
$base = $1;
Bonne chance.
--
*********************************************************************
Steve Linberg
Systems Programmer and Technology Specialist (general) 215-898-2100
National Center on Adult Literacy (tech lab) 215 898-0668
Graduate School of Education (fax) 215-898-9804
University of Pennsylvania
3910 Chestnut Street linberg@literacy.upenn.edu
Philadelpia, PA 19104
*********************************************************************
------------------------------
Date: 14 Jan 1998 11:32:02 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Comparing strings
Message-Id: <69j3ri$6bc$1@shell3.ba.best.com>
In article <34BD063B.52A4@min.net>, John Porter <jdporter@min.net> wrote:
>Kyle wrote:
>Sure it's legal, but it's still wrong. To compare strings, you should
>use cmp, not ==
Looking at the perlop man page, I'm not clear what the advantage would be
for using cmp to compare strings, instead of eq. The perlop man page says:
Binary "eq" returns true if the left argument is stringwise
equal to the right argument.
[Snip]
Binary "cmp" returns -1, 0, or 1 depending on whether the
left argument is stringwise less than, equal to, or greater
than the right argument.
So, it seems to me that cmp is better suited to sorting rather than to
equality. Using the Benchmark module, there's no appreciable performance
difference that I can see between the two. So, under what circumstances
would using cmp be better (or worse) than using eq to test string equality?
/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: Wed, 14 Jan 1998 16:22:01 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Create file
Message-Id: <comdog-ya02408000R1401981622010001@news.panix.com>
Keywords: from just another new york perl hacker
In article <Pine.BSF.3.91.980113165259.2600A-100000@Descartes.tdl.ee>, Kitse / Phoenix Bird Coders <mart@Descartes.tdl.ee> posted:
>I didn't find out, how could one create file in perl.
>Ok, one way is open(SomeHandle,">SomeFile"); --- that's not working (and
>man says that) when filename is in some variable, say,
>open(SomeHandle,">$FileNameVariable"); # <- not OK
use open() and check for return values.
open FILE, "> $filename" or die "$!";
print FILE "just another new york perl hacker";
close FILE;
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 17:52:19 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: elegant way to compare two arrays
Message-Id: <EMsCB8.LC9@mail2.ccs.bbk.ac.uk>
Dear Tobi,
If you know that one character (say a period) didn't
appear in your array elements, you could try something
like this.
if ( join('.', @arrayone) eq join('.', @arraytwo) ...
Regards,
Mick
------------------------------
Date: Wed, 14 Jan 1998 19:54:17 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: elegant way to compare two arrays
Message-Id: <EMsHyI.5Bx@bcstec.ca.boeing.com>
In article <34BCD1A9.1D13@swol.de>,
Tobias Bugala <TobiasBugala@swol.de> wrote:
> Hi,
>
> what would be the most elegant way to compare two different arrays?
>
> if (@arrayone == @arraytwo) {..}
>
> doesn't work...
>
>
> while (($arrayone[$i] == $arraytwo[$1]) && ($arrayone[$i] != "")) {
> i++;
> }
>
> would no be to elegant....
>
> do you know a better way?
>
If the arrays aren't inordinately large, you can use this.
This'll work in most cases even if array members are
numeric.
if ( @arrayone == @arraytwo and "@arrayone" eq "@arraytwo") {
.... # arrays are same
HTH,
--
Charles DeRykus
------------------------------
Date: Wed, 14 Jan 1998 13:54:31 -0700
From: Andrew Cowan <rxst50@email.sps.mot.com>
Subject: Ever modified Win NT registry with Perl?
Message-Id: <34BD2607.4C2E1060@email.sps.mot.com>
This is a multi-part message in MIME format.
--------------C148D4E448BFD99AE23F697F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Anyone ever modified the Windows registry on NT 4.x using
a perl script?
If so, please post or send an example.
-Thanks,
-AC
--------------C148D4E448BFD99AE23F697F
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Andy Cowan
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Andy Cowan
n: Cowan;Andy
org: ECommerce Engineering
email;internet: rxst50@email.sps.mot.com
title: Snr, Software Developer
tel;work: 602.413.8124
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------C148D4E448BFD99AE23F697F--
------------------------------
Date: 14 Jan 1998 19:56:33 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Dan Peterson <pete@spry.com>
Subject: Re: Finding bits in a string
Message-Id: <69j59h$71g$1@info.uah.edu>
[Posted and mailed]
In article <Pine.GSO.3.96.980112173553.10236q-100000@gort>,
Dan Peterson <pete@spry.com> writes:
: I need to grab a list of bits out of a string, and interpret the result,
: but I'm having a hard time getting my packs and unpacks straight.
:
: For example, given the following:
:
: $LEN = 16; # (any number evenly divisible by 4. ie. 4, 8, 16, 32)
: @BITS = (14,11,8,2); # (any number of bits from high to low.
.-^
.----------------'
Should be 1 for your example.
: $STR = '012345abcdefABCDEF2c5a';
: # ^ ^^ ^
: # | || |
: # | | --- This part is $LEN / 4 chars.
: # | |
: # | |
: # ----------------- This part is from 0 to 100 chars.
:
: # split $STR into it's 2 parts so...
: # str_1 is '012345abcdefABCDEF' and str_2 is '5'
: ($str_1, $str_2) = magic_split($STR);
:
: Now how did I get 5 for str_2... well, that's the magic part... the part
: I'm hoping someone will help me with.
sub magic_split {
my $str = shift;
my $len = shift;
my @bits = @_;
## test for valid input
return if @bits > 32;
my $bytes = $len / 4;
return unless (int($bytes) * 4) == $len;
return if @bits > $len;
return if length($str) <= $bytes;
## grab data
my($a,$b) = unpack "A". (length($str) - $bytes) .
"A" . $bytes,
$str;
## extract bits
$str = unpack "B*", pack "H*", $b;
my $bits = join "", (reverse split //, $str)[@bits];
## return data of interest
($a, unpack("N", pack("B32", substr("0" x 32 . $bits, -32))));
}
As you can see, it will work for values of $LEN up to and including 128,
but beyond that, you'll have to write your own bin2dec.
Hope this helps,
Greg
--
open G,"|gzip -dc";$_=<<EOF;s/([0-9a-f]+)/print G pack"h*",$1/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Wed, 14 Jan 1998 17:54:43 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: getting charecters from a variable
Message-Id: <EMsCF7.LFC@mail2.ccs.bbk.ac.uk>
Dear Mat,
Something like this should work.
@letters = split //, $variable;
Regards,
Mick
------------------------------
Date: Wed, 14 Jan 1998 16:44:46 -0500
From: dse@gist.com (Dave Ekhaus)
Subject: help a beginner with search string
Message-Id: <MPG.f26fbd8fe75a4bc989697@news.idt.net>
hi
i need some help with perl. i'm writting a java program that needs
to parse a data file. i've never done any perl, and would like to know
if this is possible before i spend too much time trying to figure it out.
the text file contains an arbitrary number of the following ....
<!FIELD [tagname]>
[tagvalue]
<!/FIELD>
for example ....
<!FIELD url>
http://www.comp.lang.perl.misc
<!/FIELD>
i need to be able to extract just the 'tagname' and the 'tagvalue'
from the input - which will contain hundreds of these name/value pairs,
with varying degrees of complexity (tagvalues may contain, html, plain
text, etc...).
so is this possible - and if so, can some kind soul please tell me
what the search string would be :-). please respond via email.
thanks
dave ekhaus
------------------------------
Date: 14 Jan 1998 20:03:20 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: Help with my code please
Message-Id: <69j5m8$71g$2@info.uah.edu>
[Posted and mailed]
In article <34BCF104.714E0833@ixl.com>,
Dan Boorstein <dboorstein@ixl.com> writes:
: seeing this makes me loop-y, try:
:
: for $field ($sitename, $type, $name) { # et cetera
: $field =~ s/,|\n//g;
: }
Better yet
foreach $field ($sitename, $type, $name, ...) {
$field =~ s/[,\n]+//g;
}
Greg
--
open G,"|gzip -dc";$_=<<EOF;s/([0-9a-f]+)/print G pack"h*",$1/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Wed, 14 Jan 1998 16:28:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help with my code please
Message-Id: <comdog-ya02408000R1401981628290001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BB772E.6934@builders-connection.com>, Webmaster@builders-connection.com posted:
>#!/user/bin/perl
># Program to do the obvious
it isn't obvious to me. you're going to be more explicit if
you want help.
>#checking for any comma's
>#Can I combined the substitute statement and have it chek for both at
>one time
>$sitename =~ s/,//;
this removes the first comma in the data. is that waht you wanted?
do you want to simply verify that commas are in the data? you could
use tr/// to count them without replacing them.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 16:35:25 -0800
From: Burris Jackes <fbjackes@hudsonwilliams.com>
Subject: Help! with dbmopen and hash evaluation Perl 5.002
Message-Id: <34BD59CD.F63E1640@hudsonwilliams.com>
All,
I am new to perl and am trying to manage some files using dbmopen. I
run something like this:
> dbmopen %HASH, "/path/filename", 0666;
Now, I would like to find out if there are any entries in this database,
and if not, show a message to that effect. The O'Reilly book states
that, when evaluating a hash *in a scalar context*, it should return
false if there are no entries. However, the code:
> unless ($HASH) {
print "Nothing in database";
} else {
something else....
}
doesn't work. I also tried >>
unless (%HASH)
unless ($HASH == 0)
etc....
How can I make this test? does this just not work with dbm?
Reply to e-mail or NG.
Thanks in advance,
Burris Jackes
fbjackes@hudsonwilliams.com
------------------------------
Date: Wed, 14 Jan 1998 16:17:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help: sending HTML by email from Perl/CGI
Message-Id: <comdog-ya02408000R1401981617380001@news.panix.com>
Keywords: from just another new york perl hacker
In article <69ifgf$4jt@examiner.concentric.net>, grover@northwood.edu posted:
>However, when it is received by some users of Netscape mail, after they call up the email, they see all the HTML
>code rather than a formatted Web-type page (as I intended).
how are you sending the content? is it plain text or MIME stuff?
the trick is to send yourself some mail from a Netscape mail client
to see what Netscape is doing, then do that.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 16:25:06 -0500
From: "Franklin L. Petersen" <orangutan@grungyape.com>
Subject: Re: Help: sending HTML by email from Perl/CGI
Message-Id: <69jadr$4hf$1@cletus.bright.net>
One of the biggest problems you have here is the uncontrolables....
the older, and I speak possibly Netscape 3-, does not support html in e-mail
(don't quote me on the version).
Also, in html e-mail, the way I found I had to do it was not put the html
code in the message body, but to attach the html file as an attachment to
the mail message.
You can easily test this by just using Netscape and sending letters to
yourself.
First open a new message and write html code int the body and send it to
yourself. Does it work? if so...then have your perl send the same
stuff.... print MAIL "<html>\n"; and so on.....
If it doesn't work, try sending yourself a letter, and attaching a html page
to the message. When you get the mail, does Netscape display it inline?
it should....
If so, then in your perl, have it attach the html page as an attachment.
I use Eudora, and the light version will not do html, so all my html mail
comes in as code. In my pro 4 version however, it's as good as gold.
Frank
orangutan@grungyape.com
grover@northwood.edu wrote in message
<69ifgf$4jt@examiner.concentric.net>...
>I have written a Perl CGI script which, among other things, sends an
HTML-encoded document via Sendmail.
>
>However, when it is received by some users of Netscape mail, after they
call up the email, they see all the HTML
>code rather than a formatted Web-type page (as I intended).
>
>Somehow I get the impression it has something to do with the "To" "From"
"Subject" etc. headers, (since they show
>up at the top of the document) but I may be wrong about this.
>
>Can someone tell me how to modify my Perl script (or how to have them
reconfigure their Netscape mail program?) so
>that the HTML tags are interpretted, not shown?
>
>Many thanks!
>
>
>===========================================================================
=
> Grover B. Proctor, Jr. Northwood University
> --------------------------------------------------------------------------
> Personal: Professional:
> gproctor@concentric.net grover@northwood.edu
> http://www.concentric.net/~gproctor http://www.northwood.edu
>===========================================================================
=
>
------------------------------
Date: 14 Jan 1998 21:31:07 +0100
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: How to "build" variablenames ?
Message-Id: <w7phg76pzlg.fsf@fraggel40.mdstud.chalmers.se>
Hello, I would like to create hashes of an unknown number, basically this is the loop:
$tmp = $a{$t};
$cnt=0;
while($tmp ne ""){
$cnt++;
$tmp = eval('$a'.$cnt.'{$t}');
}
and that works fine, it will find an hash where $t isn't occupied.
Now the problem is; how do I assign something to this hash?
Sat that I get $cnt=4 when the while loop is over, that means that
$a4{$t} == ""
put how do i assign something to this value?
all best,
/Calle
**************************************************************************
* * My homepage about the author Tom Holt: *
* /_\ http://www.mdstud.chalmers.se/~md4calle/holt/ *
* { ~._.~ } *
* ( Y ) other things like OnLine Guitar Archive linkpage *
* ( )~*~( ) and heaps of musiclinks can be found at *
* (__)-(__) http://www.mdstud.chalmers.se/~md4calle/ *
**************************************************************************
------------------------------
Date: Wed, 14 Jan 1998 16:55:49 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to "build" variablenames ?
Message-Id: <comdog-ya02408000R1401981655490001@news.panix.com>
Keywords: from just another new york perl hacker
In article <w7phg76pzlg.fsf@fraggel40.mdstud.chalmers.se>, md4calle@mdstud.chalmers.se (Calle ]sman) posted:
>while($tmp ne ""){
> $cnt++;
> $tmp = eval('$a'.$cnt.'{$t}');
>}
>Sat that I get $cnt=4 when the while loop is over, that means that
>$a4{$t} == ""
>
>put how do i assign something to this value?
perhaps you wanted something like
#!/usr/bin/perl -w
use strict;
use vars qw( %nypm $n);
my $n = 'quote';
my $tmp = eval("\$nypm{$n} = 'just another perl hacker'");
print $nypm{$n}, "\n";
$nypm{$n} = 'just another new york perl hacker';
print $nypm{$n}, "\n";
__END__
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 14:53:24 -0500
From: Bob Trieger <bob.trieger@fmr.com>
Subject: IIS on NT and perl32
Message-Id: <34BD17B4.7E5C@fmr.com>
I am writing a simple perl search engine on my NT website and can't find
a resolution to my problem. NT and the web server have been configured
for perl32 and working ok for over a year.
Here is the code I have tried and it works fine from a command line but
I get no results or error when run through the web. I tried it 2
separate ways and neither works. I know I can do it via the READDIR but
that would make it a real pain.
1. ------------------------------------------
$search_directory = "C:\\ps";
chdir ($search_directory);
@files = `dir *.htm* /B /S|`;
print "@files\n";
foreach $file (@files) {
chop($file);
print "$file<BR>\n";
}
2.-------------------------------------------
$search_directory = "C:\\ps";
open(FILES,"dir $search_directory*.*/B/S|") || die "damn dir is not
working";
print "$search_directory";
while ($file = <FILES>) {
chop($file);
print "$file<BR>\n";
}
close(FILES);
---------------------------------------------
I have added CreateWithNewConsole to the system registry as I found it
on activestate's page. But still no luck.
Any assistance will be appreciated.
------------------------------
Date: Wed, 14 Jan 1998 15:42:34 -0500
From: slinberg-bitme@crocker.com (Steve Linberg)
Subject: Re: IIS on NT and perl32
Message-Id: <slinberg-bitme-1401981542340001@projdirc.literacy.upenn.edu>
In article <34BD17B4.7E5C@fmr.com>, Bob Trieger <bob.trieger@fmr.com> wrote:
> I am writing a simple perl search engine on my NT website and can't find
> a resolution to my problem. NT and the web server have been configured
> for perl32 and working ok for over a year.
>
> Here is the code I have tried and it works fine from a command line but
> I get no results or error when run through the web. I tried it 2
> separate ways and neither works. I know I can do it via the READDIR but
> that would make it a real pain.
>
>
> 1. ------------------------------------------
> $search_directory = "C:\\ps";
> chdir ($search_directory);
> @files = `dir *.htm* /B /S|`;
> print "@files\n";
> foreach $file (@files) {
> chop($file);
> print "$file<BR>\n";
> }
>
> 2.-------------------------------------------
> $search_directory = "C:\\ps";
> open(FILES,"dir $search_directory*.*/B/S|") || die "damn dir is not
> working";
> print "$search_directory";
> while ($file = <FILES>) {
> chop($file);
> print "$file<BR>\n";
> }
> close(FILES);
>
> ---------------------------------------------
>
> I have added CreateWithNewConsole to the system registry as I found it
> on activestate's page. But still no luck.
>
> Any assistance will be appreciated.
Um, maybe this is dumb of me, but did you include:
print "Content-type: text/html\n\n";
so you can see your output over the web?
(Gratuitous null text so my dumb news server will post this: sorry, I
don't want to clip the original post. Blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah )
--
*********************************************************************
Steve Linberg
Systems Programmer and Technology Specialist (general) 215-898-2100
National Center on Adult Literacy (tech lab) 215 898-0668
Graduate School of Education (fax) 215-898-9804
University of Pennsylvania
3910 Chestnut Street linberg@literacy.upenn.edu
Philadelpia, PA 19104
*********************************************************************
------------------------------
Date: Wed, 14 Jan 1998 15:02:48 -0600
From: "Daniel D. Reed" <ddreed@rs6000.cmp.ilstu.edu>
Subject: Module Installation for Perl 5.004_04 under AIX
Message-Id: <34BD27F8.BECC1913@rs6000.cmp.ilstu.edu>
Does anyone know how you can install multiple modules in one run under
AIX? We're trying to install a whole bunch of the modules from the
resource kit, and it didn't come with an installer under AIX. So, since
it's sort of a pain to have to install over a hundred modules one at a
time, does anyone know any other options? Perhaps an installer for AIX
is out there that we couldn't find?
Thanks in advance.
Daniel Reed
ddreed@ilstu.edu
------------------------------
Date: Tue, 13 Jan 1998 13:36:47 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Multi-line input: fastest way?
Message-Id: <34BBD05E.5902F86B@5sigma.com>
Not without getting cute:
print "> ";
$_ = <>;
1 while s/\\\s*\n/" " . <>/e;
print "The line: $_";
I like yours better, except that I would tend to substitute rather
than chop the trailing \.
-joseph
http://www.effectiveperl.com
Kevin Reid wrote:
>
> Is there a better way to implement line continuations?
>
> $U_prompt = eval(qq|"$U_config{prompt}"|);
> print $U_prompt, "> "; # display prompt
> chomp($U_code = <STDIN>); # get line
> while ($U_code =~ /\\$/) { # if backslashed...
> chop $U_code; # remove backslash
> print " " x length($U_prompt), "> "; # print cont. prompt
> chomp($U_code .= "\n".<STDIN>); # append string
> }
------------------------------
Date: Wed, 14 Jan 1998 16:32:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: opening text file
Message-Id: <comdog-ya02408000R1401981632250001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BAB84D.3972@builders-connection.com>, Webmaster@builders-connection.com posted:
>How can I have perl open a text file that is a comma delimited database
>file
use open() and check the return value for an error
>and then check to see if the name is there
read in a record, break the record into fields, and test the name
field for a defined value. a module or some other abstract
interface helps.
>and if so not add the
>entree?
modify the name field, then write the record to file. how you do
this depends on the format of your file (fixed length records or so
on). the Perl FAQ [1] has pointers to this sort of thing though.
>I already have a form and a database scripted put together but
>I can't figure out how to do this checking. If I can just be pointed
>the right I'm sure I can figure it out I hope.
[1] pointer: <URL:http://www.perl.com>
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 14 Jan 1998 19:18:49 GMT
From: caius@well.com (Caius van Nouhuys)
Subject: Re: Perl advanced graphics processing
Message-Id: <69j32p$gge$1@was.hooked.net>
seems like you could use gd creatively to do the fill
part by creating a brush with your image. The blur is waht's
got me scratching my head though.
--
------------------&&&&&&&&&%$#_______----------------
And the beast shall come forth surrounded by a roiling cloud of vengeance.
The house of the unbelievers shall be razed and they shall be scorched to
the earth. Their tags shall blink until the end of days.
from The Book of Mozilla, 12:10
------------------------------
Date: Wed, 14 Jan 1998 15:33:52 -0500
From: slinberg-bitme@crocker.com (Steve Linberg)
Subject: Perl issues with Win32 & IIS
Message-Id: <slinberg-bitme-1401981533520001@projdirc.literacy.upenn.edu>
Folks,
A Mac and UNIX Perl hacker getting used to coding for NT finds his hair
straight-out exclamation points at regular intervals. I have searched
high and low for an answer to the following question, through every FAQ,
deja news, and the web, to no avail. Any clues would be most appreciated.
Is there any way to safely identify the path of the root level of the web
directory from a Perl script? NT/IIS Perl hackers have probably figured
out that it sets the directory to /cgi-bin, no matter where the script
being called actually resides (that info courtesy of a $195 support call
to the Perl Institute, who explained that this non-standard behavior was
an IIS 'feature'). I use the following code at the beginning of each
script to set the path to the directory containing the script:
BEGIN {
$dir = $0;
$dir =~ s/\\/\//g;
$dir =~ /(.*)\/(.*).pl/; # not completely robust, but good enough
chdir $1;
}
but I have had to resort (for now) to storing the web root path in a text
file in the same directory. I don't know if it's safe to assume that IIS
always sets the path to /cgi-bin; what if there is no /cgi-bin? Is there
either any defined bahavior that I can count on and counter-code, or a
safer way to determine the web root? I hate having to hard-code NT/IIS
exceptions into my scripts.
This wouldn't even be an issue if I could just reliably access the web
root in some other way; I want to read a file in the root and do something
with it, but if I use "/foo.txt" as a pathname in Perl, I get "foo" from
the root of the drive the web server is running on, as in "D:\foo.txt",
instead of "D:\inetpub\wwwroot\foo.txt", which is what I want. I'm
surprised this is even possible; I didn't think it was allowable for a
cgi-bin script to access anything outside the web directory. Maybe it's
something about NT that I don't understand?
Thanks for any clues or insights.
--
*********************************************************************
Steve Linberg
Systems Programmer and Technology Specialist (general) 215-898-2100
National Center on Adult Literacy (tech lab) 215 898-0668
Graduate School of Education (fax) 215-898-9804
University of Pennsylvania
3910 Chestnut Street linberg@literacy.upenn.edu
Philadelpia, PA 19104
*********************************************************************
------------------------------
Date: Wed, 14 Jan 1998 16:20:56 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl not Y2K compliant
Message-Id: <fl_aggie-1401981620560001@aggie.coaps.fsu.edu>
In article <EMrupz.1IF@ig.co.uk>, Jacqui Caren <Jacqui.Caren@ig.co.uk> wrote:
+ In article <pudge-0501980901290001@ppp-9.ts-1.kin.idt.net>,
+ Chris Nandor <pudge@pobox.com> wrote:
+ >In article <68hppo$99g@flatland.dimensional.com>, mfuhr@dimensional.com
+ >(Michael Fuhr) wrote:
+ >
+ >perl -le 'print scalar localtime 2**32'
+ >Mon Feb 6 06:28:15 2040
+ >
+ >
+ >Hm. I retire (turn 65) in July 2038. If I am using Macs, then I can
+ >retire before the problem hits. Score one for Apple. ;-)
+
+ As long as your pension fund is managed on a mac - otherwise you may find
+ your pension fund "dissapears" with many others :-)
One's pension funds may disappear _anyway_, depending on the honesty
of the investment managers... :(
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
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 1639
**************************************