[13445] in Perl-Users-Digest
Perl-Users Digest, Issue: 855 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 20 12:22:04 1999
Date: Mon, 20 Sep 1999 09:05:12 -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: <937843511-v9-i855@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 20 Sep 1999 Volume: 9 Number: 855
Today's topics:
Re: A question about some functions from CGI.pm. (Steve van der Burg)
Anomymous Hash <anders.wallin@sebank.se>
Changing Default directories on a fresh install <bcole@hnt.com>
Re: Changing Default directories on a fresh install <rra@stanford.edu>
Re: Cleaning up lots of filenames.... <alweston@netcene.com>
Re: CONTEST: Range Searching (Neko)
Re: CRAPware (now SOAPware) (Kragen Sitaker)
Edit ns-user&passwd with CGI franck.chevalier@cegetel.fr
Re: Error in "Learning Perl, 2nd Edition" or Error in P <uri@sysarch.com>
Re: how to change order files from readdir (Kragen Sitaker)
Re: how to change order files from readdir <tchrist@mox.perl.com>
Re: how to change order files from readdir <j_breedveld@hotmail.com>
Re: how to change order files from readdir <uri@sysarch.com>
Re: how to change order files from readdir <dan@tuatha.sidhe.org>
Re: How to create files from CGI script? (Kragen Sitaker)
Re: list of lists (Kragen Sitaker)
NEW @ PERL CGI - ASSOCIATATIVE ARRAY PROBLEM <g-preston1@ti.com>
Re: NEW @ PERL CGI - ASSOCIATATIVE ARRAY PROBLEM (Kragen Sitaker)
Re: OT: deja.com alters posts <gellyfish@gellyfish.com>
Re: passing hashes around in multi-screen cgi (?) (Kragen Sitaker)
PB opening access .mdb <olivier.maas@at-lci.com>
Re: Perl HTTP Post issue <mgrady@progress.com>
Perl script nadk@my-deja.com
Re: Perl script (Kragen Sitaker)
Re: Printing Hex output (elephant)
Re: Printing Hex output (Kragen Sitaker)
Re: Programmer Needed <sariq@texas.net>
Re: Programming Modules for Perl (Kragen Sitaker)
Re: s/// conditional substitution <jerrad@networkengines.com>
SSH <matilda@crt.se>
Re: SSH (Kragen Sitaker)
Re: System Call only works on 4K of input (Kragen Sitaker)
Re: target frame in URL redirection <rasmusr@online.no>
use re 'debug' interpretation <ltl@rgsun5.viasystems.com>
Win32 and sybperl <nettriprNOxmSPAM@hotmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Sep 1999 15:38:20 GMT
From: steve.vanderburg@lhsc.on.ca (Steve van der Burg)
Subject: Re: A question about some functions from CGI.pm.
Message-Id: <8E477665Estevevanderburglhsco@newshost.uwo.ca>
zzhang@bayou.uh.edu (zzhang) wrote in
<7ru9em$m7u$1@Masala.CC.UH.EDU>: [ snip ]
>
> %labels = ('eenie'=>"<font color='red'>please</font>",
> 'meenie'=>'stop',
> 'minie'=>'that');
>
>It didn't work, since everything between the double quotation marks
>was taken as a part of the label to
>be displayed (means '<' will be changed to '<' and so on). Is
>there a simple trick to do this while still
>using CGI.pm function radio_group()? Thanks.
There's a simple trick -- look in CGI.pm's documentation for
autoEscape().
...Steve
--
Steve van der Burg
Technical Analyst, Information Services
London Health Sciences Centre
London, Ontario, Canada
Email: steve.vanderburg@lhsc.on.ca
------------------------------
Date: Mon, 20 Sep 1999 14:49:57 GMT
From: Anders Wallin <anders.wallin@sebank.se>
Subject: Anomymous Hash
Message-Id: <7s5hig$i5k$1@nnrp1.deja.com>
Hi !
I need to build a structure that looks as follows while processing a
text file:
Country
City
Street
Example:
SWEDEN
STOCKHOLM
street1
street2
LUND
street1
street3
NORWAY
OSLO
street 1....
It seemed that the concept of anonymous hashes could be useful. I am
however stuck getting this to work (both creating the hashes and
printing them). I would greatly appreciate any help.
Thanks in advance
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 20 Sep 1999 10:59:30 -0400
From: Ben Cole <bcole@hnt.com>
Subject: Changing Default directories on a fresh install
Message-Id: <37E64BD2.5F4DE3CC@hnt.com>
I am wondering what kind of problems I could run into if I change the
default directories for the following;
$archlib /usr/local/lib/perl5/5.005/archname
$privlib /usr/local/lib/perl5/5.005
$sitearch /usr/local/lib/perl5/site_perl/5.005/archname
$sitelib /usr/local/lib/perl5/site_perl/5.005
Also why are so many library directories needed?
--
Ben Cole
------------------------------
Date: 20 Sep 1999 08:12:43 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Changing Default directories on a fresh install
Message-Id: <ylvh95bor8.fsf@windlord.stanford.edu>
Ben Cole <bcole@hnt.com> writes:
> I am wondering what kind of problems I could run into if I change the
> default directories for the following;
> $archlib /usr/local/lib/perl5/5.005/archname
> $privlib /usr/local/lib/perl5/5.005
> $sitearch /usr/local/lib/perl5/site_perl/5.005/archname
> $sitelib /usr/local/lib/perl5/site_perl/5.005
Very little provided that you install things in the expected places. I do
that all the time, usually to add more directories.
> Also why are so many library directories needed?
Because they're all for different purposes. $archlib is architecture-
dependent whereas $privlib isn't, which matters for installations that
span architectures using, e.g., NFS. The site directories are for locally
installed modules rather than the stuff that comes with Perl, and are
split for similar reasons.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Mon, 20 Sep 1999 15:38:58 GMT
From: Al Weston <alweston@netcene.com>
Subject: Re: Cleaning up lots of filenames....
Message-Id: <7s5kef$khp$1@nnrp1.deja.com>
Wow! This has been very educational. Thanks for the assist.
Now I just have to figure out how to make this work in multiple
directories at once.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 20 Sep 1999 08:43:32 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: CONTEST: Range Searching
Message-Id: <37e5eb7a.735193216@news.supernews.com>
On 16 Sep 1999 08:52:46 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
> 3) Write a "patba" program that prints out up to
> X lines before the match and Y lines after the match.
>
> patba [-A X] [-B T] pattern [files ...]
>
> or both N before and after:
>
> patba [-C N] pattern [files ...]
>
>For Extra Credit:
> Provide alternate solutions that also coalesce with overlapping
> ranges. For example, if you ask for 2 lines before and after, and
> lines 2, 4, and 5 all contain matches, the output should comprise
> lines [1-7] rather three separate output blocks showing lines.
> [1-4], [2-6], and [3-7].
Below is my latest incarnation of 'patba'. The -O switch turns on merging of
overlapping ranges. I did not include a 'patfore' or 'pataft' this time
since 'patba' is a superset (I can selectively delete from 'patba' to get the
other two if necessary). It correctly handles matches (if there are 10 lines
and 10 matches, it returns 10 matches if no -O), overlaps, and file
boundaries.
It uses Abigail's "circular buffer" because I know a good idea when I see
one. I've used the scalar comma operator here more than I usually would -- I
get the feeling others will find it more obscure than clear (anyone have an
opinion on this?). There's also a goto() instead of if/else because this was
originally two programs that got pushed together -- I also think the goto()
labels add clarity that if/else wouldn't.
#!/usr/bin/perl -w
#
# patba [ [ [-A X] [-B Y] ] | [-C N] ] [ -O ] pattern [files ...]
use strict;
my ($a, $b); # Number of lines to print after and before each match.
my $o; # Merge overlaps.
my $c = 0; # Current state: + => after, - => before, 0 => normal
my $i = 0; # Count number of matches.
while (@ARGV && $ARGV[0] =~ /-([ABCO])/) {
$1 eq 'O' and $o = shift, next;
$1 eq 'A' ? ($a) :
$1 eq 'B' ? ($b) :
($a, $b) = (shift) x 2 for shift;
}
defined && /^\d+$/ or $_ = 3 for $a, $b;
@ARGV or die <<USAGE;
Usage: patba [ [ [-A X] [-B Y] ] | [-C N] ] [ -O ] pattern [files ...]
-A X print X lines after match
-B Y print Y lines before match
-C N print N lines before and after match
-O merge overlapping matches together
USAGE
my $re = shift; # Pattern to match against.
my @lines = ('') x $b; # Store last $b lines.
goto $o ? 'OVERLAP' : 'SEPARATE';
OVERLAP:
while (<>) {
if (/$re/o) {
print '==== ', ++$i, ' ====', "\n" unless $c;
print @lines[$. % $b .. $b - 1, 0 .. $. % $b - 1] if $b;
print, $c = $a, next;
}
$c = --$c || -$b, print, next if $c > 0;
@lines = ('') x $b if $c < 0 && $c++ == $b;
$lines[$. % $b] = $_ if $b;
} continue {
$c = 0, @lines = ('') x $b, close ARGV if eof;
}
exit;
SEPARATE:
my $n = 0; # Like $. -- current line number.
my @cache; # Lines pushed back into <>.
my @freeze_lines; # Remember @lines.
my @freeze_cache; # Remember lines for new @cache.
while (defined($_ = @cache ? shift @cache : <>)) {
$n++;
unless ($c) {
/$re/o or next;
print "==== ", ++$i, " ====\n";
print @lines[$n % $b .. $b - 1, 0 .. $n % $b - 1] if $b;
print, $c = $a, next;
}
print;
if (@freeze_cache) {
push @freeze_cache, $_;
} else {
@freeze_cache = $_, @freeze_lines = @lines if /$re/o;
}
unless (--$c) {
@cache = splice @freeze_cache, 0 or next;
@lines = @freeze_lines, $n -= @cache, $_ = shift @cache, redo;
}
} continue {
$lines[$n % $b] = $_ if $b;
$c = 0, @lines = ('') x $b, close ARGV if eof;
}
exit;
__END__
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Mon, 20 Sep 1999 14:15:40 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: CRAPware (now SOAPware)
Message-Id: <gkrF3.21928$N77.1759003@typ11.nn.bcandid.com>
In article <Pine.GSO.4.10.9909191741480.7491-100000@crusoe.crusoe.net>,
Jeff Pinyan <japhy@pobox.com> wrote:
>CRAP has been renamed SOAP (Stamp Out Awful Perl)... it's better sounding
>when related to Perl (who'd want to say "crap" and "perl" in the same
>sentence, anyway?)
>
> Ugly programs? Clean them up with SOAP!
> Wash that wretched program's mouth out with SOAP!
> [funny quip here] SOAP!
>
>You get the idea.
>
>http://soap.perl.org/
>
>I'm taking layout ideas. Hoo-ah!
Someone else has something called "Simple Object Access Protocol", a
sort of low-tech XML-based CORBA replacement. Perl is one of the
targeted platforms.
Nothing may come of it . . .
What scripts have you put up on there so far?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 14:44:32 GMT
From: franck.chevalier@cegetel.fr
Subject: Edit ns-user&passwd with CGI
Message-Id: <7s5h8c$i1l$1@nnrp1.deja.com>
I got a web site on Netscape Enterprise Server v3.6. I put restrict
access on some directory and create users/passwords and groups. I need
a CGI where the users can edit their passwords themself. I made a HTML
forms but I don't know how to modify the Netscape's users db.
How can I do it?
Thanks...
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 20 Sep 1999 11:24:02 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Error in "Learning Perl, 2nd Edition" or Error in Perl port specific to Windows or ?
Message-Id: <x7puzd8v3h.fsf@home.sysarch.com>
>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:
BL> /local/pub/files
BL> /local/pub/files.txt
BL> /local/pub/files/alpha.txt
BL> /local/pub/files/beta.txt
sorting file paths is a known issue where plain alphabetic sorts don't
work. you have to do multiple key sorts by the path components. but you
are missing our point. you can simplify things in any problem domain
when you have KNOWN restrictions on the data. sorting a %ENV where you
put = after the key will work since that is not allowed in the key
string. it is a KNOWN restriction. we are not saying you can sort built
up strings in every case.
in the main example, if you make a valid assumption about space sorting
before the rest of the text, then it will work. and again i say, i was
just pointing out how to use each and then sort WHEN POSSIBLE. not in
every case. always using 'sort keys' can be a waste of electrons unless
you know how to speed it up. my idea saves all the hash lookups.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Mon, 20 Sep 1999 14:43:50 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: how to change order files from readdir
Message-Id: <GKrF3.22025$N77.1762375@typ11.nn.bcandid.com>
In article <7s5c7e$evd$1@news1.xs4all.nl>,
jeroen <j_breedveld@hotmail.com> wrote:
>I use readdir to get list of files in a directory. When I do this the files
>seem to be ordered alphabetically. Is there a way to change the way the
>files are ordered, for example on size?
Read the sizes with -s or stat() and sort() by them.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 20 Sep 1999 09:19:09 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how to change order files from readdir
Message-Id: <37e6506d@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"jeroen" <j_breedveld@hotmail.com> writes:
:I use readdir to get list of files in a directory. When I do this the files
:seem to be ordered alphabetically. Is there a way to change the way the
:files are ordered, for example on size?
Normally, you use "ls -S" on the directory.
use strict;
sub get_files_by_size {
die "expected one argument" unless @_ == 1;
my $path = shift;
local *DIR;
opendir(DIR, $path) || die "can't opendir $path: $!";
my @files = map { $_->[0] } # extract basenames
sort { $b->[1] <=> $a->[1] } # sort sizes numeric
map { [ $_, -s "$path/$_" ] } # form (name, size)
grep { -f "$path/$_" } # only plain files
grep { !/^\./ } # dot files don't count
readdir(DIR); # all files
closedir(DIR); # old bug
return @files;
}
for my $dir (@ARGV) {
print "$dir: @{[ get_files_by_size($dir) ]}\n";
}
Chapter 9 of the Perl Cookbook has many examples like this.
--tom
--
echo $package has manual pages available in source form.
echo "However, you don't have nroff, so they're probably useless to you."
--Larry Wall in Configure from the perl distribution
------------------------------
Date: Mon, 20 Sep 1999 17:25:54 +0200
From: "jeroen" <j_breedveld@hotmail.com>
Subject: Re: how to change order files from readdir
Message-Id: <7s5jlp$mi6$1@news1.xs4all.nl>
Thanks!
jeroen
Tom Christiansen <tchrist@mox.perl.com> schreef in berichtnieuws
37e6506d@cs.colorado.edu...
> Normally, you use "ls -S" on the directory.
>
> use strict;
>
> sub get_files_by_size {
> die "expected one argument" unless @_ == 1;
> my $path = shift;
> local *DIR;
> opendir(DIR, $path) || die "can't opendir $path: $!";
> my @files = map { $_->[0] } # extract basenames
> sort { $b->[1] <=> $a->[1] } # sort sizes numeric
> map { [ $_, -s "$path/$_" ] } # form (name, size)
> grep { -f "$path/$_" } # only plain files
> grep { !/^\./ } # dot files don't
count
> readdir(DIR); # all files
> closedir(DIR); # old bug
> return @files;
> }
>
> for my $dir (@ARGV) {
> print "$dir: @{[ get_files_by_size($dir) ]}\n";
> }
>
> Chapter 9 of the Perl Cookbook has many examples like this.
>
------------------------------
Date: 20 Sep 1999 11:34:28 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: how to change order files from readdir
Message-Id: <x7n1uh8um3.fsf@home.sysarch.com>
>>>>> "DS" == Dan Sugalski <dan@tuatha.sidhe.org> writes:
DS> jeroen <j_breedveld@hotmail.com> wrote:
>> I use readdir to get list of files in a directory. When I do this the files
>> seem to be ordered alphabetically. Is there a way to change the way the
>> files are ordered, for example on size?
DS> readdir doesn't guarantee any ordering at all, though alphabetical is
DS> typical. If you want to reorder the list, you'll have to do it yourself
DS> once you've got the filenames.
how would alphabetical be typical? it could be in that order, but it is
more likely to be the order the files were created. if you then delete
and create new files then the order from readdir is whatever.
always assume there is no ordering from readdir.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Mon, 20 Sep 1999 15:50:07 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: how to change order files from readdir
Message-Id: <PIsF3.7993$xg5.146@news.rdc1.ct.home.com>
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "DS" == Dan Sugalski <dan@tuatha.sidhe.org> writes:
> DS> jeroen <j_breedveld@hotmail.com> wrote:
> >> I use readdir to get list of files in a directory. When I do this the files
> >> seem to be ordered alphabetically. Is there a way to change the way the
> >> files are ordered, for example on size?
> DS> readdir doesn't guarantee any ordering at all, though alphabetical is
> DS> typical. If you want to reorder the list, you'll have to do it yourself
> DS> once you've got the filenames.
> how would alphabetical be typical? it could be in that order, but it is
> more likely to be the order the files were created. if you then delete
> and create new files then the order from readdir is whatever.
Well, it's typical on my primary perl platforms (VMS and NT). My linux box
here returns them in some random order, presumably in whatever order the
inodes are stuck in the directory.
> always assume there is no ordering from readdir.
That would be covered by the 'readdir doesn't guarantee any ordering at
all' bit, I'd think. Perhaps it wasn't forceful enough.
Dan
------------------------------
Date: Mon, 20 Sep 1999 14:32:04 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to create files from CGI script?
Message-Id: <EzrF3.21985$N77.1761057@typ11.nn.bcandid.com>
In article <37E4B362.FE1AFE3C@desertigloo.com>,
David P. Schwartz <davids@desertigloo.com> wrote:
>umask 022
>/cgi-bin 711
>/cgi-bin/code_dir1 711
>/cgi-bin/code_dir1/mydatadir 666
This means no one, not even you, can open files in mydatadir. Is that
what you wanted? If not, add +x for everybody, making it 777.
(However, anybody, including you, can get a listing of mydatadir,
delete files from it, etc.)
I'm sorry it took me so long to respond; this didn't click at first.
I suggest you move mydatadir out of your public_html (or equivalent)
tree unless you want the Web server to give your data files to anyone
who asks.
>sysadmins haven't been able to suggest anything yet either. Perms on
>myscript.pl have
>even been set with +s, which doesn't make any difference.
This last is almost certainly a bad idea, although it's not as
dangerous in Perl as in C.
HTH.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 14:46:07 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: list of lists
Message-Id: <PMrF3.22029$N77.1759183@typ11.nn.bcandid.com>
In article <37E63CA4.14C68107@pool.informatik.rwth-aachen.de>,
Andreas Kneifel <kneifan@pool.informatik.rwth-aachen.de> wrote:
>push(@array1,@array2);
>
>pushes every element of array2 as one element on array1, but not the
>hole list/array as one element.
Use references: [@array2] or \@array2, depending on context. (The
first will always work; the second will be faster when it works.)
>I hope this is possible without using references (because I have to puth
>several lists on array1 that way, and build these lists by just one
>loop.)
No, it isn't.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 09:33:31 -0500
From: Jerry Preston <g-preston1@ti.com>
Subject: NEW @ PERL CGI - ASSOCIATATIVE ARRAY PROBLEM
Message-Id: <37E645BB.B2DAAFAF@ti.com>
This is my first program. The following works:
while(($Who_Number, $who_name) = each(%who)) {
print "^ $Who_Number ^ $who_name ^ ";
}
But this does not:
%who = sort %who;
print $query->scrolling_list( -name=>'Who_Number',
-values=> \@{ $Who_Number %who},
-default=>\@{ $Who_Number %who},
-size=>3,
-multiple=>'true' );
I get the following error:
llegal modulus zero.
I believe this is due to %who. But if I put a ',' after $Who_Number. I get
this error:
Can't use an undefined value as an ARRAY reference at
Thanks,
Jerry
------------------------------
Date: Mon, 20 Sep 1999 14:54:15 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: NEW @ PERL CGI - ASSOCIATATIVE ARRAY PROBLEM
Message-Id: <rUrF3.22039$N77.1762686@typ11.nn.bcandid.com>
In article <37E645BB.B2DAAFAF@ti.com>,
Jerry Preston <g-preston1@ti.com> wrote:
>But this does not:
>
> %who = sort %who;
You don't want to do that. Keys turn into values, values turn into
keys, and the pairs get arbitrarily scrambled anyway when you store
them back into %who.
> print $query->scrolling_list( -name=>'Who_Number',
> -values=> \@{ $Who_Number %who},
> -default=>\@{ $Who_Number %who},
> -size=>3,
> -multiple=>'true' );
>
>
>I get the following error:
>
> llegal modulus zero.
>
>I believe this is due to %who. But if I put a ',' after $Who_Number. I get
>this error:
>
> Can't use an undefined value as an ARRAY reference at
I can see why you're getting the errors. (You should be using strict,
by the way, so you'd get more helpful errors.) I can't see what you're
trying to do, so I don't know how to help you.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 20 Sep 1999 15:22:33 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: OT: deja.com alters posts
Message-Id: <37e64329_1@newsread3.dircon.co.uk>
mike cardeiro <mikecard@my-deja.com> wrote:
>
>
> I am sure this is not how the original poster coded the anchor adress.
> It is not ethical to alter data in a usenet post (and if you're going to
> do it the least you could do is make it work). this is alot different
> from putting a tag at the end of somebody's message that was posted
> through their system, that is fine, changing data in the actual message
> is not.
You are able to do 'View original usenet format' of course ...
/J\
--
"You're blowing me off for a monkey?" - Joey, Friends
------------------------------
Date: Mon, 20 Sep 1999 14:21:57 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: passing hashes around in multi-screen cgi (?)
Message-Id: <9qrF3.21945$N77.1759538@typ11.nn.bcandid.com>
In article <7s41ji$de1$1@agate-ether.berkeley.edu>,
Jed Parsons <jed@socrates.berkeley.edu> wrote:
>I'm trying to write a multi-screen cgi script. The Perl Cookbook has
>been extremely helpful. One problem remains: how to pass variables around.
>The Perl Cookbook and the CGI documentaion both recommend using hidden
>fields for this, though the examples they present use only scalar
>variables. Can you pass arrays and hashes around?
No. You can't even pass general scalar variables around; you can only
pass strings. You can turn arrays and hashes into strings (e.g. with
Data::Dumper) and either write them to files or put them in the HTML
form.
HTH.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 17:33:32 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
Subject: PB opening access .mdb
Message-Id: <37E653CB.A785A710@at-lci.com>
Hi
I have an access database and I do not succeed in opening it, I used the
same syntax described in the win32::OLE doc, but it seems that my file
is not found.
(same syntax works with excel)
I tested with "cheminbase" with / instead of \\, with local path, also
by putting the data base in the root, in the cgi-bin,
no way.
Anyone would have an idear
$cheminbase="d:\\InetPub\\wwwroot\\Base\\test.mdb";
$application=Win32::OLE->new('Access.Application') || die "Impossible
de créer un objet OLE";
$Base=$application->OpenCurrentDatabase($cheminbase);
$Recset=$application->CurrentDb->OpenRecordset("Terminology");
$Recset->AddNew;
print "<BR>add new ok<BR>";
$Recset->Fields(1)->{'Value'}=localtime(time);
$Recset->Fields(2)->{'Value'}=$NomFichOrig;
$Recset->Fields(3)->{'Value'}=$NomFichLocal;
$Recset->Fields(4)->{'Value'}=$email;
$Recset->Fields(5)->{'Value'}=$nom;
$Recset->Fields(6)->{'Value'}=$prenom;
$Recset->Fields(7)->{'Value'}=$l_source;
$Recset->Fields(8)->{'Value'}=$l_cible;
$Recset->Fields(9)->{'Value'}=$themes;
$Recset->Update;
$application->CurrentDb->Close(1);
$application->Quit();
DESTROY ($application);
any help welcome,
Blue skies and soft landings
olivier
If possible also send email of answer to maas@ensae.fr
thanks anyway
------------------------------
Date: Mon, 20 Sep 1999 14:29:50 GMT
From: mcg <mgrady@progress.com>
Subject: Re: Perl HTTP Post issue
Message-Id: <7s5gcf$h89$1@nnrp1.deja.com>
In article <bxvE3.16827$N77.1240430@typ11.nn.bcandid.com>,
kragen@dnaco.net (Kragen Sitaker) wrote:
> In article <7rtrft$gqf$1@nnrp1.deja.com>, <m_grady@my-deja.com>
wrote:
> >but not others. It generates a java exception in
> >our code. What should I try to determine if it
> >is Perl causing the exception or a bug in our
> >code.
>
> What's the Java exception, and what does that exception mean,
according
> to the documentation of [whatever generated it]?
> --
> <kragen@pobox.com> Kragen Sitaker
<http://www.pobox.com/~kragen/>
> Fri Sep 17 1999
> 52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
> <URL:http://www.pobox.com/~kragen/bubble.html>
>
Thanks for the inquiry. I actually resolved the issue over the
weekend. Being new to perl and object oriented coding and HTML I found
a simple typo in the url I was using. The exception is now gone.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 20 Sep 1999 15:38:58 GMT
From: nadk@my-deja.com
Subject: Perl script
Message-Id: <7s5kef$kho$1@nnrp1.deja.com>
I have a cgi script ( perl ) for a guest book writen for unix server.
I have an NT server, and I either need script to work with the NT
(for the guest book) or to use my old perl one. Is it possible?
Thank you in addvance
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 20 Sep 1999 16:00:56 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl script
Message-Id: <YSsF3.22149$N77.1772792@typ11.nn.bcandid.com>
In article <7s5kef$kho$1@nnrp1.deja.com>, <nadk@my-deja.com> wrote:
>I have a cgi script ( perl ) for a guest book writen for unix server.
>I have an NT server, and I either need script to work with the NT
>(for the guest book) or to use my old perl one. Is it possible?
Probably. Probably your old perl one will work fine.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Tue, 21 Sep 1999 01:19:03 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Printing Hex output
Message-Id: <MPG.1250df55e8c8f4e3989ce3@news-server>
Zarick Berger writes ..
>Could someone tell me how to print out the Hex representation of a string.
>Somehow i just cant find it. Sorry...
you probably want printf()
perldoc -f printf
and for the format syntax
perldoc -f sprintf
apologies if I've misunderstood your question .. for some reason it's
just not 100% clear to me
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Mon, 20 Sep 1999 14:37:36 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Printing Hex output
Message-Id: <QErF3.22008$N77.1761674@typ11.nn.bcandid.com>
In article <MPG.1250df55e8c8f4e3989ce3@news-server>,
elephant <elephant@squirrelgroup.com> wrote:
>Zarick Berger writes ..
>>Could someone tell me how to print out the Hex representation of a string.
>>Somehow i just cant find it. Sorry...
>
>you probably want printf()
or unpack ("H*", $string);
E.g.
print unpack ("H*", "This is a Tiamat\n"), "\n";
outputs:
546869732069732061205469616d61740a
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 09:17:57 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Programmer Needed
Message-Id: <37E64215.2E6E963A@texas.net>
Uri Guttman wrote:
>
> >>>>> "DW" == Danum Web <webmaster@danum.com> writes:
>
> DW> Experienced programmer URGENTLY needed for several projects.
> DW> Must have experience of all of the following:
> DW> Perl, Mod Perl, C++, MySQL, Java, HTTP Sockets.
>
> what is an http socket? and where can i get one?
>
> :-)
>
> uri
In my set, it's right between '20 mm' and 'Spark Plug'. Just above the
ratchet.
HTH!
- Tom
------------------------------
Date: Mon, 20 Sep 1999 14:39:17 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Programming Modules for Perl
Message-Id: <pGrF3.22014$N77.1761905@typ11.nn.bcandid.com>
In article <37E61F7C.CE9E3AD3@tburg.net>,
Robert W. Byrd <tech@tburg.net> wrote:
>The Perl Resource Kit (which I finally found) contains all
>manner of documentation on modules, including usage and
>programming.
So does the Perl package itself. e.g. perldoc perlmod.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 11:22:40 -0400
From: jerrad pierce <jerrad@networkengines.com>
Subject: Re: s/// conditional substitution
Message-Id: <37E65140.B899D24F@networkengines.com>
use the e option for s
this makes the right side an expression
so you could do:
s/(.)(.)/$2 eq a ? : $1."a" : $1."b"/e;
Peter Icaza wrote:
>
> hi,
> i would like to perform a conditional substitution based on what $2
> matches. is this possible in one stmt?
>
> # this is sorta what i want to do, the results follow:
> if ($subsetCriteria[$X] =~ (s/(.*) +(in|ex)clude +'?(.*)\b'?\s+(.*)/$2 =~
> \/in\/ ?V:^(_RC$Ctr = '1') $4/))
> # results, :
> in =~ /in/ ?V:^(_RC1 = '1') &
> # desired results:
> ^(_RC1 = '1') &
> # or
> V(_RC1 = '1') &
>
> ###################################################################
> # these stmts work but i dont like accessing the string twice
> if ($subsetCriteria[$X] =~ (s/(.*) +(in|ex)clude +'?(.*)\b'?\s+(.*)/(_RC$Ctr
> = '1') $4/))
> {
> if ($2 =~ /ex/)
> {
> $subsetCriteria[$X] =~ s/\(_RC/^\(_RC/;
> }
>
> is there a way to make it do what i want and not what im telling it to do?
> am i niggling this point?
------------------------------
Date: Mon, 20 Sep 1999 16:32:51 +0200
From: Matilda Dahlqvist <matilda@crt.se>
Subject: SSH
Message-Id: <Pine.GSO.4.10.9909201629550.3836-100000@askja.firedoor.se>
How can I run 'ssh -L port:host:port -l user host' in the background in a
perl script?
system() does not work, neither does exec() since I don't want to have to
wait for any child process (or for exec, take over the whole program).
I also want to save som kind of pid for that process so I can kill it
later.
Matilda
Don't criticize a man until you've walked a mile in his shoes,
that way when you criticize him you're a mile away
and have his shoes.
------------------------------
Date: Mon, 20 Sep 1999 14:48:45 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: SSH
Message-Id: <hPrF3.22033$N77.1762795@typ11.nn.bcandid.com>
In article <Pine.GSO.4.10.9909201629550.3836-100000@askja.firedoor.se>,
Matilda Dahlqvist <matilda@crt.se> wrote:
>How can I run 'ssh -L port:host:port -l user host' in the background in a
>perl script?
>system() does not work, neither does exec() since I don't want to have to
>wait for any child process (or for exec, take over the whole program).
system "ssh -L blah blah &" will work.
If you want more control than system with & gives you, you have to fork
and exec. (open with a |, or open2, or open3, might serve your needs
better.)
>I also want to save som kind of pid for that process so I can kill it
>later.
Oo. Ouch.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 14:35:55 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: System Call only works on 4K of input
Message-Id: <fDrF3.21999$N77.1761170@typ11.nn.bcandid.com>
In article <7s4oil$8q2$1@news.netcologne.de>,
Uli Brass <uli.brass@netcologne.de> wrote:
>I have got a problem with a system call in my perl script. The script itself
>modifies the /etc/mail/virtusertable file and changes the sendmail virtual
>users. After the modification I call /usr/sbin/makemap (with sudo as root)
>to generate a hash table from the modified source file. The makmap command
>starts to convert the source but stops after exactly 4096 bytes. The rest of
>the virtusertable file is completely ignored.
My guess is that you're not closing or flushing the filehandle to
virtusertable before you run makemap. Assuming the final virtusertable
is between 4096 and 8192 bytes, and bufsiz is 4096 on your system, that
would produce exactly the behavior you're seeing.
It's hard to guess without the source, though.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 20 Sep 1999 16:10:55 +0100
From: "Rasmus Rimestad" <rasmusr@online.no>
Subject: Re: target frame in URL redirection
Message-Id: <NzrF3.683$1s6.5869@news1.online.no>
This certainly does not work. The target parameter must be put were you are
calling the script.
If you are calling it from a form:
<form method="POST" action="somescript.pl" target="4_display_area">
If you're calling from an anchor tag:
<a href="somescript.pl" target="4_display_area">
------------------------------
Date: 20 Sep 1999 15:33:35 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: use re 'debug' interpretation
Message-Id: <7s5k4f$li$1@rguxd.viasystems.com>
I've been exploring regexp. I ran across something that jangled. I
hate to cry "bug" because most of the time the "bug" is in the model
of Perl I carry in my head and not in perl.
I did "use re 'debug'". I studied the output. I still don't get
it. The writeup in perldebug doesn't explicitly say what to expect
upon success or failure of the match. I thought that 'SUCCEED' as
the last node would mean that the pattern should return true.
The entire program is self contained with the test data and I can
provide it if necessary, but I'm really just looking for confirmation
(or refutation) of my understanding of this.
Here is the code that is bothering me:
# This is wrapped in a while loop with another
# m//g to which the one below is chained
# $pattern eq 'MATCH'
if ($string =~ /\G(?=.*(?s:$pattern))/mgco) {
print STDERR "Pattern returned true\n"
} else {
print STDERR "Pattern returned false\n"
}
My comments should stand out in the trimmed output below with *******:
[snipped]
compiling RE `\G(?=.*(?s:MATCH))'
size 11 first at 2
1: GPOS(2)
2: IFMATCH[-0](11)
4: STAR(6)
5: ANY(0)
6: EXACT <MATCH>(9)
9: SUCCEED(0)
10: TAIL(11)
11: END(0)
anchored(GPOS) GPOS minlen 0
Matching `\G(?=.*(?s:MATCH))' against `and a line 7 MATCH x MATCH
and 8 was the last.
but now ther...'
Setting an EVAL scope, savestack=40
94 <ATCH
> <and a l> | 1: GPOS
94 <ATCH
> <and a l> | 2: IFMATCH[-0]
94 <ATCH
> <and a l> | 4: STAR
ANY can match 26 times out of 32767...
Setting an EVAL scope, savestack=40
115 <CH x > <MATCH
a> | 6: EXACT <MATCH>
120 <MATCH> <
and 8 > | 9: SUCCEED
94 <ATCH
> <and a l> | 11: END
Pattern returned true <--- **********From my program************
<--- true as I would expect
[snipped other matches that moved pos()]
Matching `\G(?=.*(?s:MATCH))' against ` x MATCH
and 8 was the last.
but now there are 9
and yet s...'
Setting an EVAL scope, savestack=40
112 <MATCH> < x MATC> | 1: GPOS
112 <MATCH> < x MATC> | 2: IFMATCH[-0]
112 <MATCH> < x MATC> | 4: STAR
ANY can match 8 times out of 32767...
Setting an EVAL scope, savestack=40
115 <CH x > <MATCH
a> | 6: EXACT <MATCH>
120 <MATCH> <
and 8 > | 9: SUCCEED
112 <MATCH> < x MATC> | 11: END
Pattern returned false <--- **********From my program***********
<--- But why isn't it true?
[snipped]
Matching `\G(?=.*(?s:MATCH))' against `and yet still more is 10
insert some more here
because I nee...'
Setting an EVAL scope, savestack=40
163 <e 9
> <and yet> | 1: GPOS
163 <e 9
> <and yet> | 2: IFMATCH[-0]
163 <e 9
> <and yet> | 4: STAR
ANY can match 24 times out of 32767...
Setting an EVAL scope, savestack=40
Pattern returned false <--- As I would expect
[snipped]
Matching `\G(?=.*(?s:MATCH))' against `'
Setting an EVAL scope, savestack=40
301 <orks. MATCH
> <> | 1: GPOS
301 <orks. MATCH
> <> | 2: IFMATCH[-0]
301 <orks. MATCH
> <> | 4: STAR
ANY can match 0 times out of 32767...
Setting an EVAL scope, savestack=40
Pattern returned false <--- As I would expect
--
// Lee.Lindley /// Programmer shortage? What programmer shortage?
// @bigfoot.com /// Only *cheap* programmers are in short supply.
//////////////////// 50 cent beers are in short supply too.
------------------------------
Date: Mon, 20 Sep 1999 07:35:26 -0700
From: samiam <nettriprNOxmSPAM@hotmail.com>
Subject: Win32 and sybperl
Message-Id: <296ee7ec.d26450fb@usw-ex0106-041.remarq.com>
I am using ActivePerl with a Windows95 system that has
DCOM1.3 I am having problems trying to use sybperl. I have
boiled my problem down to this.
---------------------
C:\perl_scripts>perl -e "use Sybase::CTlib;"
DynaLoader.pm loaded (C:\PERL\lib C:\PERL\site\lib .,
"C:\'Program Files\'DevStudio\'VC\'lib")
DynaLoader::bootstrap for Sybase::CTlib
(auto\Sybase/CTlib\CTlib.dll)
Can't load 'C:\PERL\site\lib/auto/Sybase/CTlib/CTlib.dll'
for module Sybase::CTlib:
load_file:One of the library files needed to run this
application cannot be found
at C:\PERL\lib/DynaLoader.pm line 170.
at -e line 1
BEGIN failed--compilation aborted at -e line 1.
----------------------
Of course this works on NT, but last minute
requirement(during rollout) requests it to run on 95.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
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 855
*************************************