[18297] in Perl-Users-Digest
Perl-Users Digest, Issue: 465 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 11 14:05:40 2001
Date: Sun, 11 Mar 2001 11:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984337510-v10-i465@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 11 Mar 2001 Volume: 10 Number: 465
Today's topics:
ANNOUNCE: cpan-upload 1.9 <neilb@cre.canon.co.uk>
ANNOUNCE: DDL::Oracle v1.05 <rvsutherland@yahoo.com>
ANNOUNCE: Locale-Codes 1.06 <neilb@cre.canon.co.uk>
Re: CGI NNTP Client? (Randal L. Schwartz)
Re: cgi redirect not working (Paul Tomblin)
Re: cgi redirect not working <replytogroup@nowhere.com>
Re: cgi redirect not working <replytogroup@nowhere.com>
Re: cgi redirect not working <flavell@mail.cern.ch>
Re: Convert dates in format "3/1/2001" to dd-Month-yy (Garry Williams)
Re: dbm hashes : Operation not permitted (Garry Williams)
How do I delete (ignore) part of a string? <pigpen@easynews.com>
Re: How do I delete (ignore) part of a string? <thelma@alpha2.csd.uwm.edu>
Re: Macbeth and Perl threads <djberg96@hotmail.com>
Re: Maintaining the number format and not exponential <uri@sysarch.com>
Re: Maintaining the number format and not exponential <galen.menzel@mail.utexas.edu>
Re: multidimensional arrays (Steven Smolinski)
Re: multidimensional arrays (Garry Williams)
Navigation Tools - Directory Tree <paanwa@hotmail.com>
Re: newbie Q : problems with using 'use lib qw(....' to <c_clarkson@hotmail.com>
Re: Perl CGI.pm RESET problem (Alan Barclay)
Re: Perl download problem with default link (BUCK NAKED1)
Re: Perl download problem with default link (BUCK NAKED1)
Re: POP3 Password Change <galen.menzel@mail.utexas.edu>
Print Format <blnukem@hotmail.com>
Re: Reading and Writing to Files <abe@ztreet.demon.nl>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 11 Mar 2001 17:39:00 GMT
From: Neil Bowers <neilb@cre.canon.co.uk>
Subject: ANNOUNCE: cpan-upload 1.9
Message-Id: <tanhdior9nno9f@corp.supernews.com>
A new, working(!), version of cpan-upload is now on CPAN:
http://www.cpan.org/authors/id/NEILB/cpan-upload-1.9.tar.gz
cpan-upload is a script for lazy people uploading files to CPAN via PAUSE.
For example to upload it, I ran:
% cpan-upload -verbose cpan-upload-1.9.tar.gz
[... verbose progress reports deleted...]
What it does:
* ftp's the file to the incoming directory on PAUSE
* POSTs a message to the PAUSE web server to register the upload
To use it you must be registered with PAUSE, and have the following
modules/distributions installed:
libnet
LWP
AppConfig::Std
I hope others find it useful.
Neil
------------------------------
Date: Sun, 11 Mar 2001 13:00:02 -0500
From: "Richard Sutherland" <rvsutherland@yahoo.com>
Subject: ANNOUNCE: DDL::Oracle v1.05
Message-Id: <tanhdrjglkn7a8@corp.supernews.com>
===========================================================================
Release of DDL::Oracle, Version 1.05
===========================================================================
CHANGES
In version 1.04, use by users without SELECT privileges on V$ views was
facilitated by adding attributes to the 'configure' method. By setting
the 'heading' attribute to "0" and supplying values for 'blksize' and
'version' attributes, a non-privileged user could bypass the queries to
V$DATABASE, V$PARAMETER and V$VERSION, respectively.
Andy Duncan (author of Perl module Orac) supplied queries which any user
could execute to SELECT the values for version and block size. Thus, the
configure attributes 'blksize' and 'version' are now deprecated, and
privileges on V$PARAMETER and V$VERSION are no longer required. The
'heading' attribute remains in use as previously described. THANKS, Andy.
Added configure method attribute 'prompt'. Set this attribute to "0" to
elimate the "PROMPT blah..." syntax normally produced for the benefit of
SQL*Plus command scripts.
DESCRIPTION
Designed for Oracle DBA's and users, for Oracle versions 7.3, 8.0
and 8i. Reverse engineers database objects (tables, indexes, users,
profiles, tablespaces, roles, constraints, etc.). Generates DDL to
*resize* tables and indexes to the provided standard or to a user
defined standard. Can reorganize/defragment tablespaces.
SYNOPSIS
use DBI;
use DDL::Oracle;
my $dbh = DBI->connect(
"dbi:Oracle:dbname",
"username",
"password",
{
PrintError => 0,
RaiseError => 1
}
);
# Use default resizing and schema options.
# query default DBA_xxx tables (could use USER_xxx for non-DBA types)
DDL::Oracle->configure(
dbh => $dbh,
);
# Create a list of o
ne or more objects
my $sth = $dbh->prepare(
"SELECT
owner
, name
FROM
dba_tables
WHERE
tablespace_name = 'MY_TBLSP' -- your millage may vary
"
);
$sth->execute;
my $list = $sth->fetchall_arrayref;
my $obj = DDL::Oracle->new(
type => "table",
list => $list, );
);
my $ddl = $obj->create; # or $obj->resize; or $obj->drop; etc.
print $ddl; # Use STDOUT so user can redirect to desired file.
AUTHOR
Richard V. Sutherland
rvsutherland@yahoo.com
COPYRIGHT
Copyright (c) 2000, 2001 Richard V. Sutherland. All rights reserved.
This module is free software. It may be used, redistributed, and/or
modified under the same terms as Perl itself. See:
http://www.perl.com/perl/misc/Artistic.html
===========================================================================
AVAILABILITY
===========================================================================
DDL::Oracle is available from the CPAN, and from:
http://sourceforge.net/projects/ddl-oracle/
------------------------------
Date: Sun, 11 Mar 2001 16:40:50 GMT
From: Neil Bowers <neilb@cre.canon.co.uk>
Subject: ANNOUNCE: Locale-Codes 1.06
Message-Id: <tanb839mha2qf9@corp.supernews.com>
Locale-Codes 1.06 adds support for multiple codesets to Locale::Country:
$CPAN/authors/id/NEILB/Locale-Codes-1.06.tar.gz
As of this release, Locale::Country supports all three codesets defined
by ISO 3166:
alpha-2
The two-letter country codes (eg 'bo' for Bolivia).
This is the most widely used, and was previously the only
one supported.
alpha-3
Three-letter country codes (eg 'tkl' for Tokelau).
numeric
Numeric country codes (eg 776 for Tonga)
The module is backwards compatible - if no codeset is specified,
then alpha-2 is assumed. An additional function allows you to convert
codes between the codesets.
At the moment Locale::Language and Locale::Currency still support
a single codeset - this addition was prompted by Keith Wall,
who needed this functionality in Locale::Country.
WHAT ARE THESE MODULES?
This distribution contains three modules which can be used to
process ISO codes for identifying languages, countries,
and currencies & funds:
Locale::Country - country codes, defined by ISO 3166
Locale::Language - language codes defined by ISO 639
Locale::Currency - currency/fund codes defined by ISO 4217
Each module provides conversion between {country,language,currency}
names and codes, and routines for getting a list of all codes
or all {country,language,currency} names.
Neil
------------------------------
Date: 11 Mar 2001 08:22:47 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: CGI NNTP Client?
Message-Id: <m1r904gtrc.fsf@halfdome.holdit.com>
>>>>> "Mikko" == Mikko Jussilainen <mjj@pp.fi> writes:
Mikko> I am looking for a good CGI or PHP web based news client. It can be
Mikko> commercial or free as long as it works. I am not interested in having one
Mikko> written from scratch or writing one myself. It should have the following
Mikko> features:
The problem between NNTP and CGI is one of impedence. NNTP is a
stateful connection-based protocol, where CGI is stateless and
connectionless.
Each separate CGI invocation would have to re-login and
re-authenticate itself to the NNTP server, perform one simple action,
and then disconnect. Very expensive.
One way around this is to fork off a HTTP mini-server as I have done
in a few of my past columns:
<http://www.stonehenge.com/merlyn/WebTechniques/col11.html>
<http://www.stonehenge.com/merlyn/WebTechniques/col23.html>
<http://www.stonehenge.com/merlyn/WebTechniques/col24.html>
<http://www.stonehenge.com/merlyn/WebTechniques/col34.html>
<http://www.stonehenge.com/merlyn/WebTechniques/col56.html>
Then the NNTP connection can be started and held open while the browser
chats with this mini-server, bypassing the usual fork-launch in a normal
server.
I don't believe I've seen any pre-written code to do this. Maybe I should
do it as one of my next columns. :)
print "Just another Perl column hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 11 Mar 2001 16:31:48 GMT
From: ab401@freenet.carleton.ca (Paul Tomblin)
Subject: Re: cgi redirect not working
Message-Id: <98g99k$jug$1@freenet9.carleton.ca>
In a previous article, Tony Curtis <tony_curtis32@yahoo.com> said:
>>> On Sun, 11 Mar 2001 15:42:00 -0000,
>>> "st" <replytogroup@nowhere.com> said:
>> print $q->redirect('http://www.google.com');
>
>Correct.
Just as a stylistic point, one should generally include the trailing slash
in URLs that don't specify a specific file name, because otherwise you're
generating an additional set of communications between the browser and the
server. If your browser says "give me http://www.google.com/foobar", the
server replies "You mean http://www.google.com/foobar/, don't you", and
your browser says "quite right, give me http://www.google.com/foobar/ then".
Not as important with bare domain names, but a good habit to get into.
For example:
ptomblin@allhats:~ > telnet xcski.com 80
Trying 192.168.1.1...
Connected to xcski.com.
Escape character is '^]'.
GET /~ptomblin HTTP/1.0
HTTP/1.1 301 Moved Permanently
Date: Sun, 11 Mar 2001 16:27:52 GMT
Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) PHP/3.0.16 mod_perl/1.23
Location: http://allhats.xcski.com/~ptomblin/
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>301 Moved Permanently</TITLE>
</HEAD><BODY>
<H1>Moved Permanently</H1>
The document has moved <A HREF="http://allhats.xcski.com/~ptomblin/">here</A>.<P>
<HR>
<ADDRESS>Apache/1.3.14 Server at allhats.xcski.com Port 80</ADDRESS>
</BODY></HTML>
Connection closed by foreign host.
I asked the web server for /~ptomblin, and all it sent back was a "Moved
Permanently" to tell me I really should have asked for /~ptomblin/. If
I'd asked for /~ptomblin/ directly, I would have gotten it immediately.
Maybe not a big deal for you, but not everybody has a fast net connection.
--
Paul Tomblin <ptomblin@xcski.com>, not speaking for anybody
There is no substitute for good manners, except, perhaps, fast reflexes.
------------------------------
Date: Sun, 11 Mar 2001 16:46:23 -0000
From: "st" <replytogroup@nowhere.com>
Subject: Re: cgi redirect not working
Message-Id: <98ga6o$8kt$1@newsg3.svr.pol.co.uk>
I want one script to redirect to another website or script these methods
are not working
print $q->redirect( -uri => 'http://www.google.com');
or
print $q->redirect('http://www.google.com');
its displays this message
status: 302 Moved Location: http://google.com
i understand that this is a http response header for redirection but how do
you get it to transfer to that page
Is there any methods of redirecting to another script
Many Thanks
------------------------------
Date: Sun, 11 Mar 2001 16:48:17 -0000
From: "st" <replytogroup@nowhere.com>
Subject: Re: cgi redirect not working
Message-Id: <98gaab$cbi$1@newsg2.svr.pol.co.uk>
its me again
yes i have print the headers etc
it compiles correctly
st <replytogroup@nowhere.com> wrote in message
news:98g6e2$1q6$1@news5.svr.pol.co.uk...
> I want one script to redirect to another website or script these methods
are
> not working
>
>
> print $q->redirect( =>uri 'http://www.google.com');
>
> or
>
> print $q->redirect('http://www.google.com');
>
> Is there any methods of redirecting to another script
>
> Many Thanks
>
>
>
>
------------------------------
Date: Sun, 11 Mar 2001 18:26:59 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cgi redirect not working
Message-Id: <Pine.LNX.4.30.0103111811590.15920-100000@lxplus003.cern.ch>
[please note xpost and f'ups]
On 11 Mar 2001, Paul Tomblin wrote:
> >> print $q->redirect('http://www.google.com');
> Just as a stylistic point, one should generally include the trailing slash
> in URLs that don't specify a specific file name,
You have the details confused. With a URL that contains a trailing
slash, it would be an error to omit the trailing slash. This is not a
mere stylistic point: technically it's a functional requirement,
although in a large proportion of cases the server will silently
correct the error. But that isn't what is going on here.
> because otherwise you're
> generating an additional set of communications between the browser and the
> server.
Possibly. The server would have every right to issue an error 404, or
to deliver a different document.
Redirecting to an adjusted URL with the trailing slash supplied is
only a rather commonly-used convention. There's nothing fundamental
about it.
> If your browser says "give me http://www.google.com/foobar", the
> server replies "You mean http://www.google.com/foobar/, don't you",
It might do that (or it might do something else); but that isn't what
was going on here.
See RFC1738 section 3.3, for example. Observe particularly the final
sentence of this quote:
An HTTP URL takes the form:
http://<host>:<port>/<path>?<searchpart>
where <host> and <port> are as described in Section 3.1. If :<port>
is omitted, the port defaults to 80. No user name or password is
allowed. <path> is an HTTP selector, and <searchpart> is a query
string. The <path> is optional, as is the <searchpart> and its
preceding "?". If neither <path> nor <searchpart> is present, the "/"
may also be omitted.
ttfn
------------------------------
Date: Sun, 11 Mar 2001 17:01:40 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Convert dates in format "3/1/2001" to dd-Month-yy
Message-Id: <UbOq6.112$by1.9928@eagle.america.net>
On 05 Mar 2001 13:09:58 +0100, Peter J. Acklam <jacklam@math.uio.no> wrote:
>John Smith <creafin1998@yahoo.com> wrote:
>
>> Does anyone know the most efficient way to convert dates in the
>> format "m/d/yyyy" to dd-Month-yy using pattern matching?
>
>garry@zvolve.com (Garry Williams) writes:
>
>> Don't know about efficiency, but this is short:
>>
>> my @m = qw(January February March April
>> May June July August September
>> October November December);
>>
>> s!(\d+)/(\d+)/\d\d(\d\d)!$2-$m[$1-1]-$3!;
>
>It doesn't pad with leading zeros though.
Oh okay... I think that others have already addressed this but, if
you insist:
s!(\d+)/(\d+)/\d\d(\d\d)!sprintf("%02d", $2) . "-$m[$1-1]-" .
sprintf("%02d", $3)!e;
--
Garry Williams
------------------------------
Date: Sun, 11 Mar 2001 17:28:01 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: dbm hashes : Operation not permitted
Message-Id: <BAOq6.117$by1.10496@eagle.america.net>
On 4 Mar 2001 03:42:17 GMT, Joe Smith <inwap@best.com> wrote:
>In article <GlGg6.720$Ld2.4018@eagle.america.net>,
>Garry Williams <garry@zvolve.com> wrote:
>>Many DBM files are *unmovable*. That's because of hardware
>>differences or disk information embedded in them, etc.
>
>Huh? The problem with embedded cylinder/track/sector values in DBM
>files went away when IBM mainframes changed from ISAM to VSAM thirty
>years ago. DBM files can be moved from one directory to another on
>the same machine with no problems.
That actually may depend on the DBM library. I believe it is a
problem for ndbm on Solaris 2.5. Unfortunately, I no longer have such
a system to test my recollection. Moving such a file from one file
system to another on the same system clobbered data.
Encountering the problem and reading the admonishments to not do that
in the AnyDBM_File manual page from an earlier perl, led me to the
conservative position above.
Okay, my memory's fuzzy, so it may have been something like
non-serialized updates. (I just read a Solaris 7 version of the
dbm_clearerr(3) manual page and there are no admonitions about
anything except architecture incompatibilities.)
You probably don't want to take copies of an ndbm file, even if it can
be done reliably, because the sparse file format will consume a lot of
unnecessary disk space in the target.
--
Garry Williams
------------------------------
Date: Sun, 11 Mar 2001 16:45:48 GMT
From: "Nancy" <pigpen@easynews.com>
Subject: How do I delete (ignore) part of a string?
Message-Id: <0ZNq6.7188$G7.357660@news.easynews.com>
Forgive me if I didn't look hard enough for the answer (approx. 2 hrs.).
I'm working with some variables that may or may not include a price, always
preceded by a $ dollar sign.
I need to find, and delete (or ignore) the dollar sign, and anything in the
string after it while returning the first part of the string.
IT
Nan
------------------------------
Date: 11 Mar 2001 17:49:33 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Re: How do I delete (ignore) part of a string?
Message-Id: <98gdrd$2er$1@uwm.edu>
Nancy <pigpen@easynews.com> wrote:
: Forgive me if I didn't look hard enough for the answer (approx. 2 hrs.).
: I'm working with some variables that may or may not include a price, always
: preceded by a $ dollar sign.
: I need to find, and delete (or ignore) the dollar sign, and anything in the
: string after it while returning the first part of the string.
$string =~ s/\$.+//;
This will fail if there is a $ *not*
attached to a price early in the string,
and if you don't want that deleted.
--thelma
: IT
: Nan
------------------------------
Date: Sun, 11 Mar 2001 18:54:51 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: Macbeth and Perl threads
Message-Id: <%RPq6.2115$fb3.101631@typhoon.mn.mediaone.net>
> "Peter van den Hamer" <vdhamer@msn.com> wrote in message
news:98ebie$le2$1@news.IAEhv.nl...
> Dan Sugalski <dan@tuatha.sidhe.org> wrote
> Whence will Perl threading evolve?
> What time scale till a decision?
> And till a release?
>
> Peter van den Hamer
>
I would say that, if you're determined to use a scripting language and
threads, use Ruby or Python.
Dan
------------------------------
Date: Sun, 11 Mar 2001 18:05:22 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Maintaining the number format and not exponential
Message-Id: <x7r904b2qm.fsf@home.sysarch.com>
>>>>> "FR" == FORM Rookie <m0rejunkmail@home.com> writes:
FR> Okay, I really didn't want to start anything in here. But okay, I take
FR> it that GODZILLA has went too far in performing a simple function that I
FR> needed to create.
don't worry about moronzilla as long as yo ignore her advice and code.
FR> Now, URI suggested, "use Math::BigInt to keep it as a long integer."
FR> Okay, my question is: How do you exactly do that?
well, you start by looking at the docs for it. try typing
perldoc Math::BigInt
and reading that. it is fairly straightforward and easy to use. you just
make simple object calls to do your math but the results are accurate to
any length.
FR> I kinda new to PERL and just starting out. Can we all please stay with
FR> the subject? :-)
it was on subject. moronzilla is always on subject but with almost
always wrong answers. that is different.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 11 Mar 2001 12:09:29 -0600
From: Galen Menzel <galen.menzel@mail.utexas.edu>
Subject: Re: Maintaining the number format and not exponential
Message-Id: <3AABBF59.CAF7F7CF@mail.utexas.edu>
> Now, URI suggested, "use Math::BigInt to keep it as a long integer."
> Okay, my question is: How do you exactly do that?
perldoc Math::BigInt
Note that all of the standard operators are overloaded for BigInts, so even
though the methods like badd() are available, you don't have to use them. You
can use + (or whatever) instead.
galen
------------------------------
Date: Sun, 11 Mar 2001 16:15:56 GMT
From: sjs@linux.ca (Steven Smolinski)
Subject: Re: multidimensional arrays
Message-Id: <slrn9ane15.hf.sjs@ragnar.stevens.gulch>
Edward Glamkowski <eglamkowski@worldnet.att.net> wrote:
> @multidimarray = (
> [ 100, 149, 237, "description" ],
> [ 72, 61, 139, "description" ],
> [ 0, 191, 255, "description" ],
> [ 135, 206, 235, "description" ],
> );
Note that @multidimarray is full of references to arrays. That's what
the braces do. man perlref.
> for $i (0 .. $#multidimarray) {
> @one_array = @multidimarray[$i];
You don't need the iterator in this example, and it's usually better not
to use one unless you must.
foreach my $arrayref ( @multidimarray ) {
> # Normalize the values:
> $elem1 = $one_array[0] / 255;
> $elem2 = $one_array[1] / 255;
> $elem3 = $one_array[2] / 255;
I ususally shy away from multiplying scalars beyond necessity in this
way, since that is what arrays and hashes are for. And especially since
$elem1 is really element 0, it's asking for maintenance problems. But
for the sake of keeping this post about array references:
$elem1 = $arrayref->[0] / 255;
...
If you're going to use references, you have to understand the level of
indirection you're invoking, and the syntax to derefence it. The
perlref manpage is about "References and Nested Data Structures," and is
right up your alley. See perlreftut for a gentler introduction.
Steve
--
Steven Smolinski => http://www.steven.cx/
------------------------------
Date: Sun, 11 Mar 2001 18:29:50 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: multidimensional arrays
Message-Id: <yuPq6.145$by1.10784@eagle.america.net>
On Sun, 11 Mar 2001 15:44:49 GMT, Edward Glamkowski
<eglamkowski@worldnet.att.net> wrote:
>I can't make the leap of logic from the "access and printing" examples
>for multidimensional arrays to what I want to do:
>
>
>@multidimarray = (
> [ 100, 149, 237, "description" ],
> [ 72, 61, 139, "description" ],
> [ 0, 191, 255, "description" ],
> [ 135, 206, 235, "description" ],
>);
Okay, @multidimarray has been initialized to an array of four
elements. The values of these four elements are references to four
anonymous arrays, each containing four elements.
>for $i (0 .. $#multidimarray) {
> @one_array = @multidimarray[$i];
^
^
This should have produced a warning. You are running with warnings
enabled, aren't you?
Now you have assigned the contents of the $i'th element of
@multidimarray to the array @one_array. (Actually, the RHS is an
array slice of only one element. You seem to have meant
$multidimarray[$i] instead of @multidimarray[$i] like the warning
said.) But what is the content of the $i'th element of
@multidimarray? It happens to be a reference to an anonymous array
containing four values.
At this point, @one_array contains a single element which is a
reference to an anonymous array or four elements.
You probably meant to _dereference_ the reference to the anonymous
array. That means you probably meant to say this instead:
@one_array = @{ $multidimarray[$i] };
This will copy the elements of the array referenced by
$multidimarray[$i] to the array @one_array.
> # Normalize the values:
> $elem1 = $one_array[0] / 255;
> $elem2 = $one_array[1] / 255;
> $elem3 = $one_array[2] / 255;
>
> $elem4 = $one_array[3]; # text string!
Yup, those elements of the array @one_array have never been assigned a
value, hence the uninitialized value warning.
If you copy the array referenced in the $i'th element of
@multidimarray (see above), those values _will_ be initialized.
But your code above doesn't need a copy (since it doesn't modify the
original). Just access the original array directly like this and
avoid the intermediate copy:
$elem3 = $multidimarray[$i]->[2] / 255;
or just:
$elem3 = $multidimarray[$i][2] / 255;
Now, I guess we could rewrite your version to what I think you were
trying to do:
#!/usr/bin/perl -w
use strict;
my @multidimarray = (
[ 100, 149, 237, "description" ],
[ 72, 61, 139, "description" ],
[ 0, 191, 255, "description" ],
[ 135, 206, 235, "description" ],
);
for my $i (0 .. $#multidimarray) {
# Normalize the values:
my $elem1 = $multidimarray[$i][0] / 255;
my $elem2 = $multidimarray[$i][1] / 255;
my $elem3 = $multidimarray[$i][2] / 255;
my $elem4 = $multidimarray[$i][3]; # text string!
print "($elem1, $elem2, $elem3, $elem4)\n";
}
Fortunately, help is available. Take a look at the perlreftut manual
page. Once you master that, you can refer to the more complete
perlref manual page.
Good luck!
--
Garry Williams
------------------------------
Date: Sun, 11 Mar 2001 16:06:40 GMT
From: "paanwa" <paanwa@hotmail.com>
Subject: Navigation Tools - Directory Tree
Message-Id: <koNq6.166389$446.8178569@typhoon.kc.rr.com>
I was wondering if any of you could recommend a good method in PERL to build
a directory tree navigation tool bar which would appear at the top (and
bottom) of HTML pages....the idea is to make surfing easier by reducing
dependency on the Back button.
Thanks for your suggestions!!
PAW
------------------------------
Date: Sun, 11 Mar 2001 13:04:28 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: newbie Q : problems with using 'use lib qw(....' to point to modules
Message-Id: <7A2FA62CA1A2D5FB.3C127C57FBA68942.8F2131F71171236A@lp.airnews.net>
null <nospamplease@thankyou.com> wrote:
: Thank you again for your help
:
: Here's my script :
:
[SNIP - thanks]
: If I comment out the line that tries to wire in the newer GD.pl
: and the use Config line and uncomment the use GD line, I will
: get a broken image icon. Then, if I also change the last two
: lines to :
:
: print "Content-type: image/gif\n\n";
: print $im->gif;
:
: I get a gif image a-ok.
Unfortunately, my linux virtual host displays the png format
if I uncomment the #use GD line. I don't have a CGI server
setup on my PC, though. I assume from the binmode that you
are running on an operating system like DOS.
BTW, I didn't need the Config module.
:
: Thank you for the hint about the CGI::Carp line - it gives me
: the following additional info along with the 500 error:
:
: Software error:
: Can't locate object method "new" via package "GD::Image" at
: maydaytest.pl line 17.
:
I couldn't duplicate this error. Maybe someone else has an idea
what's going wrong.
Sorry I couldn't be of more help,
Charles K. Clarkson
: Changing the path specified for the newer GD module (from the
: path to directory containing GD.pm to the path to GD.pm itself)
: doesn't change the result...
:
: Does the error message clarify things?
:
------------------------------
Date: 11 Mar 2001 15:23:17 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Perl CGI.pm RESET problem
Message-Id: <984324190.973313@elaine.furryape.com>
In article <idontreadthis56-1247DD.02002708032001@newsrump.sjc.telocity.net>,
Keep it to Usenet please <idontreadthis56@hotmail.com> wrote:
>FACT that they are completely unrelated and that you (Select one or
>more of the following):
>
>1) Didn't know what you were talking about.
I'll have Door number 1 please Monty.
Monty Hall: Do you want to change your door?
>4) Knew the difference, but wanted to perpetuate the confusion,
> intentionally mislead Buck, etc..
Ooh! I'll have Door number 4 instead please Monty!
------------------------------
Date: Sun, 11 Mar 2001 11:24:04 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perl download problem with default link
Message-Id: <17202-3AABB4B4-5@storefull-248.iap.bryant.webtv.net>
mnc@admin.u.nu (Miguel=A0Cruz) wrote:
> The tripod server is looking at the Referer header.
> I was able to get it this way:
>=A0=A0=A0=A0curl -H 'Referer: http://members.tripod.com/~Mys
> tiqal/Fonts.zip' \ =A0 http://members.tripod.co
> m/~Mystiqal/Fonts.zip
> (don't type this, or at least redirect it somewhere, > unless you want
to watch an awful lot of binary data > fly by) miguel
I'd be happy to see it all fly by as long as it worked. :)
What is "curl"? I looked it up, and it looks like another language. Is
there a way to do this with the regular distributon of perl?
--Dennis
------------------------------
Date: Sun, 11 Mar 2001 11:08:37 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perl download problem with default link
Message-Id: <6799-3AABB115-201@storefull-247.iap.bryant.webtv.net>
mnc@admin.u.nu (Miguel=A0Cruz) wrote:
> The tripod server is looking at the Referer header.
> I was able to get it this way:
>=A0=A0=A0=A0curl -H 'Referer: http://members.tripod.com/~Mystiqal/Font>
s.zip' \ =A0 http://members.tripod.com/~Mystiqal/Fonts.zip
> (don't type this, or at least redirect it somewhere, unless you
> want to watch an awful lot of binary data fly by)
> miguel
I'd be happy to see it all fly by as long as it worked. :)
What is "curl"? I looked it up, and it looks like another language. Is
there a way to do this with the regular distributon of perl?
--Dennis
------------------------------
Date: Sun, 11 Mar 2001 12:31:24 -0600
From: Galen Menzel <galen.menzel@mail.utexas.edu>
Subject: Re: POP3 Password Change
Message-Id: <3AABC47C.E4CB334B@mail.utexas.edu>
I'm not sure of your whole set up there, but it sounds like the easiest thing to
do (for the programmer and the users) is to write a CGI script that runs on the
machine that hosts the pop accounts. Have it change the password via forking a
passwd process. There are a couple of sticky issues with this process:
1. You have to run a web server on the machine. Unless one is already running,
this could be a lot of work to compile, set up securely, etc...
2. You need to get certificates for SSL connections (as well as a web server
that supports SSL, like Apache) for the password changes or else the passwords
will be sent plain text across the network.
3. The passwd program always expects to talk to a terminal, so you will probably
need to use the IO::Pty package to allocate a pseudo terminal through which you
talk to passwd. Alternately you could fork off an expect script to do the
actual password changing, since expect allocates pseudo terminals automatically.
Good luck.
galen
Anton Bawab wrote:
>
> Hi,
>
> Twice a year we create some 150 POP accounts for our new students. These are
> created with a default password. Since Microsoft Outlook Express does not
> offer the feature of password change we revert to an old version of Eudora
> to do that.
>
> I am trying to put this functionality in a Perl script that would prompt for
> a user name, old password and a new one and then do the change... the change
> password procedure however is not in any of the POP modules I have seen,
> neither is it mentioned in any of the POP related RFC standards.
>
> Has anybody done this before or found it mentioned in any documentation?
>
> Thank you,
> AB.
------------------------------
Date: Sun, 11 Mar 2001 18:38:04 GMT
From: "blnukem" <blnukem@hotmail.com>
Subject: Print Format
Message-Id: <gCPq6.140160$Vj5.21278214@news02.optonline.net>
Hi All
How do set a print format with my script. I what it to print $name three
line across and as may lines now that are needed.
foreach $name (@WORDS){
chomp($name);
print "$name";
Thanks
------------------------------
Date: Sun, 11 Mar 2001 19:15:27 +0100
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Reading and Writing to Files
Message-Id: <hfenat4v75rmk7pqm7ssqt5rh8ttuc2o25@4ax.com>
On Fri, 9 Mar 2001 23:52:01 -0000, "Milliwave"
<milliwave@rfengineering.freeserve.co.uk> wrote:
> Hello,
>
> I was hoping someone could spend some time and explain why I am unable to
> initially read from a given file and then write to it at the same time?
> using the
> +> operator?
>
> open(FILE , ">+name.txt"); does not work!
Please (re)read:
perldoc -f open
It states:
You can
put a `'+'' in front of the `'>'' or `'<'' to indicate that you
want both read and write access to the file; thus `'+<'' is
almost always preferred for read/write updates--the `'+>'' mode
would clobber the file first.
It also has a bit on checking if that open() was successful.
> secondly I am looking for the best way of transfering a set of variables
[ different questions deserve different posts ]
[ list of vars that look like an array snipped ]
> I need to feed these variable as a pair into $xn and $yn. For example I
> would start off
> with $xn =$x1 and $yn=$y1, and cycle through until I reach $x4 $y4
>
> $Pxmin = $Pxmin < $xn? $Pxmin : $xn;
> $Pymin = $Pymin < $yn ? $Pymin : $yn;
>
> $Pxmax = $Pxmax > $xn ? $Pxmax : $xn;
> $Pymax = $Pymax > $yn ? $Pymax : $yn;
>
I'd use arrays to hold those x and y values and sort() to find the
extremes:
my @x = (3, 4, 1, 2);
my @y = (19, 4, 3, 7);
my($Pxmin, $Pxmax) = ( sort { $a <=> $b } @x )[0, -1];
my($Pymin, $Pymax) = ( sort { $a <=> $b } @y )[0, -1];
--
Good luck,
Abe
perl -e '$_=sub{split//,pop;print pop while@_};&$_("rekcah lreP rehtona
tsuJ")'
------------------------------
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 V10 Issue 465
**************************************