[7410] in Perl-Users-Digest
Perl-Users Digest, Issue: 1035 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 16 22:07:18 1997
Date: Tue, 16 Sep 97 19:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 16 Sep 1997 Volume: 8 Number: 1035
Today's topics:
Re: apology <rootbeer@teleport.com>
Re: Confusion of passing references into/outof subs... (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Date & Time handling library wanted <rootbeer@teleport.com>
Re: Dereferencing Problem ... (Charles DeRykus)
Re: does \1 \2 \3 work? (my mistake is..where..?) (Gabor Egressy)
Re: How to email text file twod@not.valid
Re: Intermediate Web Page <deepak@panwala.com>
Re: Intermediate Web Page <rootbeer@teleport.com>
Re: Is Perl for Win32 really as brain damaged as it see <rootbeer@teleport.com>
Looking for Report Generator <yaronr@netvision.net.il>
Re: method to calculate the time (Charles DeRykus)
multidimensional arrays <xkn14@dial.pipex.com>
Net::FTP::dataconn <ian@gamespot.com>
Re: Newbie to Perl <rootbeer@teleport.com>
Re: Newbie to Perl <Alan_Poindexter@bmc.com>
Re: Newbie to Perl <Alan_Poindexter@bmc.com>
Re: Perl equivalent to #ifdef in C? <rootbeer@teleport.com>
Re: perl relative path refs w/NT jarmo@arosnet.se
Re: Premature End Of Script Headers (James E. Lee)
SDBM File Usage-Perl for Win32 <kerry@lumber.com>
Re: Submit Using Image <rootbeer@teleport.com>
Re: Submit Using Image (Mike Heins)
Re: Tar question <rootbeer@teleport.com>
Re: To delete a file <jefpin@bergen.org>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 16 Sep 1997 15:11:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: TechMaster Pinyan <jefpin@bergen.org>
Subject: Re: apology
Message-Id: <Pine.GSO.3.96.970916150827.449A-100000@julie.teleport.com>
On Tue, 16 Sep 1997, TechMaster Pinyan wrote:
> It's Jeff, also known as the problem child. I am sorry for giving out
> more bad advice than good advice on this Perl newsgroup.
Speaking only for myself, I appreciate your helpfulness. It's good that
you try so hard to help people. I hope that you can continue to learn
about Perl. When you have better answers and advice to give, those
postings will be very welcome here. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 16 Sep 97 18:30:29 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Confusion of passing references into/outof subs...
Message-Id: <341f09f5$1$ofn$mr2ice@speaker.kf8nh.apk.net>
In <341ECE7E.2781@seymour.chem.ubc.ca>, on 09/16/97 at 11:22 AM,
Richard Moss <rjm@seymour.chem.ubc.ca> said:
+-----
| But, then to pass that reference to another subroutine I was a bit confused
| over how to read it from @_ in the sub, plus how to prototype it.
+--->8
A reference is a scalar, and you pass it as such. The "\@" is used when you
want to pass an actual array; the array is passed as a reference. For
example, a reimplementation of push() would use \@@ as a prototype: the first
grabs the array first argument and passes a reference to it, the second
combines the remaining arguments into an array passed by value.
| So when you send ref's directly to subs you proto them as "$"?
| You only use the "\" on an arg when you want perl to first take a ref to you
| arguement, and then pass that ref?
+--->8
Yes.
| If the reference arg is proto'd as "$" only, how/can you/ stop a normal
| scalar being passed? (ie is there a proto way of saying "this arg is
| _already_ a reference to a whatever, don't re-reference it, but make sure
| it's a reference"
+--->8
You can't. Yet. I think they're working on it.
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) FORZA CREW!
Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
------------------------------
Date: Tue, 16 Sep 1997 15:13:07 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Thomas Arnold <tarnold@access.ch>
Subject: Re: Date & Time handling library wanted
Message-Id: <Pine.GSO.3.96.970916151241.449B-100000@julie.teleport.com>
On Tue, 16 Sep 1997, Thomas Arnold wrote:
> I have trouble finding a good library
> or routine for manipulating and checking dates.
If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-) Hope this helps!
http://www.perl.org/CPAN/
http://www.perl.com/CPAN/
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 16 Sep 1997 20:27:03 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Dereferencing Problem ...
Message-Id: <EGMBH4.59y@bcstec.ca.boeing.com>
In article <341EAC6B.41C@nortel.ca>,
Sylvain St.Germain <sgermain@nortel.ca> wrote:
> Hi,
>
> Here it is:
>
> @ValidValues = (qw/ a b c/);
>
> I do:
> sub new {
> ...
> $self->{Values} = \@ValidValues;
> ...
> }
>
> The question is:
>
> Why the he*l any of the below code work?
>
> With $toto being an instance of the class
>
> foreach $item (@($toto->{Values})) ## BAD
> foreach $item (@{$toto->{Values}}) ## BAD too
> foreach $item (${$toto->{Values}}) ## BAD too
> foreach $item ($($toto->{Values})) ## ERROR
>
Hey, I can tell you were getting desperate on that
last attempt :)
There must be more to your code than meets the eye :)
because the following does work, e.g,
package main;
@ValidValues = qw/a b c/;
package Foo;
sub new {
my $class = shift;
my $self = {};
$self->{ValidValues} = \@::ValidValues; # note scope
bless $self, $class;
}
$foo = new Foo;
foreach $item (@{$foo->{Values}}) {
print "\$item=$item\n";
}
HTH,
--
Charles DeRykus
------------------------------
Date: 16 Sep 1997 21:41:26 GMT
From: gabor@vinyl.quickweb.com (Gabor Egressy)
Subject: Re: does \1 \2 \3 work? (my mistake is..where..?)
Message-Id: <5vmue6$bl3$1@flint.sentex.net>
Matti Kinnunen (matti@universe.pc.helsinki.fi) wrote:
: to count vowels on a line I'd use something like:
: echo "aasdasdasasoiiu" | perl -pe 's/[aieouy]/_/g' | perl -pe 's/[^_]//g' | perl -pe 's/(_*)/length($1)/e'
how about
$cnt = tr/aeiou//;
no need to replace characters to count them
------------------------------
Date: 17 Sep 1997 00:17:16 GMT
From: twod@not.valid
Subject: Re: How to email text file
Message-Id: <5vn7ic$oeg$1@vnetnews.value.net>
Jeff Stampes (stampes@xilinx.com) wrote:
: Aaron (aaron@soltec.net) wrote:
: : I'm curious about this Mail::Send package
: : does it have facilities for including files as attachments?
: Not exactly...As long as you're talking text files, you can
: easily merge them into the mail. If it's a binary, it's probably
: more difficult, and not something i have experience using.
You sometimes have to get creative when adding files as attachments.
In order to get files recognised as attachments when the recipient is using
groupwise, I have to uuencode the file - with the begin name set to something
meaningful (foo.doc as a word attachment and foo.xls as an Excel attachment).
Thus if I send something like the below the user will receive the single
line of text and two attachments that are associated with word and excel (so
when they double-click on the attachments they will be opened in the relevant
application).
Note the use of the word 'pseudo', the .doc and .xls simply kid groupwise into
making the association, but the files are generally either flat text or CSV.
-- snip --
Here is the report output in pseudo MS-Word and MS-Excel format :-
begin 644 foo.doc
....
<uuencoded file>
...
end
begin 644 foo.xls
...
<uuencoded file>
...
end
-- snip --
You could always try and reverse engineer things by looking at the format of
the a mail that has an attachment - view by editing the mailbox or using a
mailreader that doesn't recognise the attachments. It may be that you can
add a few lines of flat text to kid the mail reader into thinking something is
an attachment. I have done similar hacks in the past.
Also have a look at metamail to see if that could be of use.
Hope this helps
IAP
--
In an attempt to reduce junk email I use an invalid 'From' address.
My my correct email address can be be determined by replacing 'not.valid' with
'value.net'
------------------------------
Date: Tue, 16 Sep 1997 15:07:19 -0700
From: Deepak Gupta <deepak@panwala.com>
To: "James H. Blackwell" <jim.blackwell@gsfc.nasa.gov>
Subject: Re: Intermediate Web Page
Message-Id: <341F0317.24BA@panwala.com>
James-
I recommend redirecting immediately to a script which checks if the
calling script has terminated/is done processing (by the presence of an
output file).
If no output file...print page with HTTP-REFRESH HEADER:
<HEAD>
<meta http-equiv="refresh" content="150;
URL=http://blah.nasa.gov/cgi-bin/getresults.cgi>
</HEAD>
Else print the results without the refresh header...and probably `mv
outputfile.tmp outputfile.xxx` so you are ready for another query.
-Deepak
------------------------------
Date: Tue, 16 Sep 1997 15:34:34 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "James H. Blackwell" <jim.blackwell@gsfc.nasa.gov>
Subject: Re: Intermediate Web Page
Message-Id: <Pine.GSO.3.96.970916152930.449G-100000@julie.teleport.com>
On Tue, 16 Sep 1997, James H. Blackwell wrote:
> I have a CGI script which scans files and sometimes takes a bit of time
> to produce output. has anyone out there ever written something to write
> an intermediate page, or something telling the user to "Wait For It" ?
It's not hard to do. There's something similar in several of Randal's Web
Techniques columns.
http://www.stonehenge.com/merlyn/WebTechniques/
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 16 Sep 1997 15:22:35 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: russ@mail.org.uk
Subject: Re: Is Perl for Win32 really as brain damaged as it seems?
Message-Id: <Pine.GSO.3.96.970916152115.449E-100000@julie.teleport.com>
On Tue, 16 Sep 1997, Russell Odom wrote:
> Not necessarily: just run the registry editor (regedit.exe) and search for
> all occurences of 'A:\'. Remove the ones that aren't absolutely necessary
> (usually all of them).
Since Perl can work directly with the registry, couldn't a simple script
do this? I don't have a Windows machine or I'd try writing this script
myself. But if anybody will write a good one, I'll do my best to get it
enshrined in the FAQ.
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 16 Sep 1997 23:58:35 -0700
From: Yaron Ruckenstein <yaronr@netvision.net.il>
Subject: Looking for Report Generator
Message-Id: <341F7F9B.887@netvision.net.il>
Hi
Im looking for a Report Generator Package for relational databases,
that
have some of the capabilities of the commercial products, such as R&R.
* recognize the beginning and end of groups of data according
to a change in field (or fields combination) value,
(from one line to the other).
* print headers and footers at the beginning and end of the groups.
Some very useful features could be:
* ability to define private fields, and have them change their values
according to the table data.
* ability to control the printing of lines and fields according to
values
of other fields.
Of course there are a lot of things that can be done, I will be happy
with the basic things.
(If you know about a commercial product for UNIX, please give me a
pointer).
Thank you.
Yaron.
------------------------------
Date: Tue, 16 Sep 1997 20:34:05 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: method to calculate the time
Message-Id: <EGMBst.5JC@bcstec.ca.boeing.com>
In article <341EC179.3A0F@att.net.hk>,
Bremen Lee <bremenlee@att.net.hk> wrote:
> Hi,
>
> Is there any simple method to check a file is created today, not
> yesterday or other day??
>
> Please send me a mail if you know the answer.
>
created...? no.
But, you can check if modified within the past 24 hour period
for instance,
if ( -M $file <= 1) { # modified in last 24 hrs.
...
HTH,
--
Charles DeRykus
------------------------------
Date: 17 Sep 1997 00:59:30 GMT
From: "Jon Marshall" <xkn14@dial.pipex.com>
Subject: multidimensional arrays
Message-Id: <01bcc304$60f53760$57f382c1@default>
i have written an a script which builds up a number of multidimensional
arrays ( hashes of hashes in the camel book ). the problem i have is how to
construct a loop to go through each one accessing the values within ie.
@groups = qw( ukcns uksns uknns );
each group will have a multidimensional array. within each the values
i want to access are file types and the key is a project name -
@filetypes = qw ( 3dv hzd cgm );
what i want to do is
foreach $group ( @group ) {
foreach $project ( keys %group ) { # this is the problem
foreach $type ( @filetypes ) {
..........................
rest of code
..........................
}
}
}
i have tried ( keys %$group ) but this doesn't work. am i making this too
hard,
is there a better way to do it or am i simply just being stupid
any help would be very much appreciated
jon marshall
------------------------------
Date: Tue, 16 Sep 1997 17:43:44 -0700
From: Ian Kallen <ian@gamespot.com>
Subject: Net::FTP::dataconn
Message-Id: <341F27C0.4BD091E5@gamespot.com>
Any code examples using the read($buffer,$size) method in the Net::FTP
perldoc? I've been fiddling with making a file fetcher that feeds data
into Zlib's gz methods -- I can Net::FTP a file and then employ
Compress::Zlib to compress it but I'd like to have the intermediate
inflated file go away; I'd like to compress on the fly whilst fetching
from a remote FTP source but so far this' eluded me. Net::FTP::dataconn
samples with the read method actually in use would be most appreciated!
thanks,
-Ian
------------------------------
Date: Tue, 16 Sep 1997 15:29:02 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Bill Wehnert <bill.wehnert@cdw.com>
Subject: Re: Newbie to Perl
Message-Id: <Pine.GSO.3.96.970916152500.449F-100000@julie.teleport.com>
On 16 Sep 1997, Bill Wehnert wrote:
> Subject: Newbie to Perl
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I am trying to declare a variable that is going to contain an array.
my @array; # Now it's declared. :-)
> I have to pass this array to a method by reference.
\@array # That's the reference.
> Here is what the function wants:
>
> GroupGetUsers($servername, $groupname, (out) \@userArray)
Looks good...
> Here is what I tried to do:
>
> use Win32::NetAdmin;
>
> $servername = 'MyServer';
> $groupname = 'MyGroup';
> @userArray = [];
You're making a reference to an anonymous array and making that reference
be the only element of @userArray. That's something Perl lets you do, if
you want to, but I don't think you want to. Maybe you meant to use a pair
of empty parens there, instead of brackets.
@userArray = (); # Maybe like this?
> Win32::NetAdmin::GroupGetUsers($servername, $groupname, \@userArray);
That's fine.
> foreach $key (@userarray) {
Do you see that @userarray is differant than @userArray? If you use 'use
strict' (recommended) it will help you to catch these errors.
> print '$key\n';
You can do that if you want, but I think you want this.
print "$key\n";
> }
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 16 Sep 1997 15:55:28 -0500
From: "A. Poindexter" <Alan_Poindexter@bmc.com>
To: Bill Wehnert <bill.wehnert@cdw.com>
Subject: Re: Newbie to Perl
Message-Id: <341EF240.7A87FB09@bmc.com>
posted and emailed...
Bill Wehnert wrote:
>
> I am trying to declare a variable that is going to contain an array.
>
> I have to pass this array to a method by reference.
>
> Here is what the function wants:
>
> GroupGetUsers($servername, $groupname, (out) \@userArray)
>
> Here is what I tried to do:
>
> use Win32::NetAdmin;
>
> $servername = 'MyServer';
> $groupname = 'MyGroup';
> @userArray = [];
you need to say @userArray = ();
@userArray = [] assigns an anonymous array (a pointer, or reference in
perl speak) to the first element of @userArray.
try this:
#!/usr/local/bin/perl
@array = [];
for ($i = 0; $i <= $#array; $i++) {
print "array[$i] = $array[$i]\n";
}
and you'll get:
array[0] = ARRAY(0x80b4570)
which means the zeroth element of @array contains a reference to an
array at mem address 0x80b4570
(the hex number in () will probably be different, as this is the address
in memory of the anonymous array, not likly to me the same as my run :-)
Or you may want to say
$userArray = [];
then pass (..., $userArray)
> Win32::NetAdmin::GroupGetUsers($servername, $groupname, \@userArray);
>
> foreach $key (@userarray) {
> print '$key\n';
> }
also,
$" = "\n";
print "@userArray\n";
will do the same as your foreach loop, just FYI
>
> This is not working. I get an empty array back.
>
> I am using perl nt 5.0 on a Win NT 4.0 platform. (I know, I know - stick
> to UNIX, my company doesn't share the enlightened view :) ).
I know the feeling...
>
> Any Ideas?
>
> Bill Wehnert
> bill.wehnert@cdw.com
I'm on a slow news feed, I apologize if this info is redundant.
------------------------------
Date: Tue, 16 Sep 1997 16:12:57 -0500
From: "A. Poindexter" <Alan_Poindexter@bmc.com>
To: Bill Wehnert <bill.wehnert@cdw.com>
Subject: Re: Newbie to Perl
Message-Id: <341EF659.6791E2DC@bmc.com>
Bill Wehnert wrote:
>
> I am trying to declare a variable that is going to contain an array.
>
posted and emailed:
> I have to pass this array to a method by reference.
>
> Here is what the function wants:
>
> GroupGetUsers($servername, $groupname, (out) \@userArray)
>
> Here is what I tried to do:
>
> use Win32::NetAdmin;
>
> $servername = 'MyServer';
> $groupname = 'MyGroup';
> @userArray = [];
> Win32::NetAdmin::GroupGetUsers($servername, $groupname, \@userArray);
>
> foreach $key (@userarray) {
> print '$key\n';
> }
Um, I noticed a couple of other things...
@userarray should be @userArray in your foreach loop (uppercase A in
Array)
and
print '$key\n'; should be print "$key\n"; (double quotes)
>
> This is not working. I get an empty array back.
>
> I am using perl nt 5.0 on a Win NT 4.0 platform. (I know, I know - stick
> to UNIX, my company doesn't share the enlightened view :) ).
>
> Any Ideas?
>
> Bill Wehnert
> bill.wehnert@cdw.com
------------------------------
Date: Tue, 16 Sep 1997 15:19:49 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: lynn kasdorf <lkasdorf@pressroom.com>
Subject: Re: Perl equivalent to #ifdef in C?
Message-Id: <Pine.GSO.3.96.970916151624.449D-100000@julie.teleport.com>
On Tue, 16 Sep 1997, lynn kasdorf wrote:
> What is an easy way to enable/disable blocks of code in perl.
use constant DEBUGGING => 0;
print "This line does nothing" unless DEBUGGING;
if (DEBUGGING) {
blah blah blah;
}
The compiler reduces the tests to null operations. If the code is not to
be executed, there's no runtime overhead. Requires 5.004, but you're using
that anyway, right?
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 17 Sep 1997 00:44:45 +0200
From: jarmo@arosnet.se
Subject: Re: perl relative path refs w/NT
Message-Id: <341F0BDD.3122@arosnet.se>
lynn kasdorf wrote:
>
> Perl/Windows gurus- I could use a little help...
>
> I have been unable to get my perl scripts to refer to other perl modules
> via relative paths when running on my NT server. When I move the scripts
> to a unix server, relative paths are fine. When on NT, I need to have
> absolute pathnames. And, I need to use backslashes (escaped).
>
> Here are some examples: (i'm using Selena Sol's DB manager code). It is
> trying to access a file in a subdirectory called "Data_files" at the
> same level as the script. This is just one example...
>
I have exactly the same problem, on a server where I installed the
newest version of Perl.
The funny thing is that I have an older version on another server that
works just fine..
Both servers run IIS 3.0
//Jarmo Salminen
------------------------------
Date: 16 Sep 1997 22:12:16 GMT
From: jelee@atlas.ucdavis.edu (James E. Lee)
Subject: Re: Premature End Of Script Headers
Message-Id: <5vn080$prp$1@mark.ucdavis.edu>
Capt. COBOL (slundy@mer.cioe.com) wrote:
> What does this mean and where should I look for the error. It sounds
> like it's not processing the headers correctly, but I'm not sure,
> kinda new to perl and cgi...thanks for any help
If you happen to be using the Apache web server, take a look at this URL:
<URL: http://www.apache.org/docs/misc/FAQ.html#premature-script-headers>
james
_________________________________________________
James E. Lee jelee@ucdavis.edu
------------------------------
Date: Tue, 16 Sep 1997 16:42:37 -0700
From: Kerry Cakebread <kerry@lumber.com>
Subject: SDBM File Usage-Perl for Win32
Message-Id: <341F196D.2DF7@lumber.com>
Hello,
A question since I don't have any other leads on who to contact about
SDBM file usage...using the ActiveWare perl port, how does one tie a
file in a directory other than c:\ ? For example, my perl is installed
in d:\inetpub\intranet\scripts - my current script runs from
d:\inetpub\intranet\xxx\wwwroot\perlscripts ... but when I tie (%hash,
"SDBM_File", "filename", etc.) it creates the file in c:\. If I tie
(%hash, "SDBM_File", "d:\inetpub\data\filename") it doesn't see it - nor
does it see a filename "someDirectory/filename", even when someDirectory
is c:\someDirectory.
How does one make reference to Windows directories (& alternate hard
disks) in the tie command in Perl for Win32?
Thanks much, and regards,
Kerry Cakebread
kerry@lumber.com
------------------------------
Date: Tue, 16 Sep 1997 16:01:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Charles Wyatt <cwyatt@cris.com>
Subject: Re: Submit Using Image
Message-Id: <Pine.GSO.3.96.970916155310.449J-100000@julie.teleport.com>
On Tue, 16 Sep 1997, Charles Wyatt wrote:
> Hmmm, I thought most folks understood that Perl is the language of
> choice for form processing? That's why I'm posting to a perl newsgroup.
An airplane is the method of choice for getting to Hawaii, so if you have
a question about poi, do you ask it in an avation newsgroup? :-)
Sometimes the line isn't so clear as that. But here's the way to fix up
any question so as not to get flamed: Look at the question from Perl's
point of view. As far as Perl knows, your form is just data. It's all bits
coming in and going out. So, simply re-word any question to talk about
what you want to do to those bits specifically. If you can't do that, for
example because you have to refer to a particular part of the CGI spec,
that's a sign that your question isn't Perl specific anyway.
For example, suppose you want to print the date on your web page. If you
ask, "How can I put the date on my web page", that's clearly a web-related
question. But if you investigate the ways in which you can put something
onto a web page and instead ask "How can I print the time and date", you
will have turned it into a Perl question, and you'll be flamed only for
asking something which is easy to find in the Perl docs. :-)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 17 Sep 1997 01:39:42 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: Submit Using Image
Message-Id: <5vnccu$ik4$1@vixen.cso.uiuc.edu>
Tom Phoenix (rootbeer@teleport.com) wrote:
: On Tue, 16 Sep 1997, Charles Wyatt wrote:
:
: > Hmmm, I thought most folks understood that Perl is the language of
: > choice for form processing? That's why I'm posting to a perl newsgroup.
:
: An airplane is the method of choice for getting to Hawaii, so if you have
: a question about poi, do you ask it in an avation newsgroup? :-)
:
This is not an FAQ, at least WRT Perl. And it is so rarely talked about
the search engines don't help much.
But you can get CGI::Imagemap from CPAN and do:
use CGI;
use CGI::Imagemap;
$query = new CGI;
$map = new CGI::Imagemap;
$map->setmap($query->param('submit.map'));
$action = $map->action(
$query->param('submit.x'),
$query->param('submit.y')
);
This would arise from a form something like:
<input type=image name=submit SRC="image.gif">
<input type="hidden" name="submit.map"
value="rect action1 0,0 25,20">
<input type="hidden" name="submit.map"
value="rect action2 26,0 50,20">
<input type="hidden" name="submit.map"
value="rect action3 51,0 75,20">
<input type="hidden" name="submit.map"
value="default action0">
You can also read an NCSA-style map file with:
@map = `cat whatever.map`;
$map->setmap(@map);
A simple task, but I found it nice to have the code, which is why
I adapted Vivek Khera's code into CGI::Imagemap.
--
Regards,
Mike Heins
This post reflects the
opinion of my employer.
------------------------------
Date: Tue, 16 Sep 1997 15:36:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Aaron <aaron@soltec.net>
Subject: Re: Tar question
Message-Id: <Pine.GSO.3.96.970916153534.449H-100000@julie.teleport.com>
On 16 Sep 1997, Aaron wrote:
> I cd into the directory where the tar file is and when I un tar it I get
> an opt directory and then a content directory and then the files I
> wanted.
>
> How should I be doing this?
Just as you're doing it. :-) I can't see where the problem is from
reading your message. How far have you gotten, and where are you stuck?
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 16 Sep 1997 19:09:53 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: RobStone <Stoner3@boat.bt.com>
Subject: Re: To delete a file
Message-Id: <Pine.SGI.3.95.970916190745.24859A-100000@vangogh.bergen.org>
(Here goes... helpful advice!)
>How do I delete a file - or in general - how do I perform disk
>operations in Perl ?
Firstly, assuming you are on UNIX, there are built in functions for file
system manipulation:
unlink - deletes a file
mkdir - makes directory
chdir - changes directory
chmod - chmod(1)'s a directory
and countless more. Check the FAQ or get either Programming Perl or
Learning Perl (I suggest P.P.).
If you're on something other than UNIX, you may need to check CPAN
(http://www.perl.com/CPAN) for modules that may help.
----------------
| Before you think UNIX is family-oriented, note that all children must die.
| - Cross-Platform Perl
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
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 1035
**************************************