[15682] in Perl-Users-Digest
Perl-Users Digest, Issue: 3095 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 19 06:05:41 2000
Date: Fri, 19 May 2000 03:05:14 -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: <958730714-v9-i3095@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 19 May 2000 Volume: 9 Number: 3095
Today's topics:
Re: $0 doesn't give full path (Villy Kruse)
Re: $0 doesn't give full path <gellyfish@gellyfish.com>
a PS to Perl - MySQL - Notify using sendmail <megan@aracnet.com>
Re: alphabeticalize a perl array <nospam@devnull.com>
Re: alphabeticalize a perl array <uri@sysarch.com>
Re: Check to see if an array value is null <bbostowNObbSPAM@hotmail.com.invalid>
Re: Data Structures (complex) <bmb@dataserv.libs.uga.edu>
Re: Data Structures (complex) <jeff@vpservices.com>
Re: Data Structures (complex) <nospam@devnull.com>
Re: DBI to retrieve table meta data from ms access? <gellyfish@gellyfish.com>
Re: Delay in Perl <gellyfish@gellyfish.com>
Re: Getopt::Std 1 == 0 ??? <aperrin@davis.DEMOG.Berkeley.EDU>
Re: Giving a string the name of a string <thepoet1@arcormail.de>
Re: Giving a string the name of a string <uri@sysarch.com>
Re: glueing a scalar onto a variable <danielxx@bart.nl>
Re: Help on namespaces <gellyfish@gellyfish.com>
Re: How Do I Source a File with Environment Variables? <gellyfish@gellyfish.com>
How do I use substitute from the command line? <shmuelik@netvision.net.il>
Re: How do I use substitute from the command line? <ocschwar@NOSPAM.mit.edu>
Mail attachments: filtering out <apietro@my-deja.com>
Re: Manipulate all *values* using CGI.pm? <thepoet1@arcormail.de>
Re: Manipulate all *values* using CGI.pm? <uri@sysarch.com>
matching question(s) <s0218327@unix1.cc.ysu.edu>
Re: MS Documents to text---help <gellyfish@gellyfish.com>
Re: Newbie CGI/Perl <nospam@devnull.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 May 2000 08:27:01 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: $0 doesn't give full path
Message-Id: <slrn8i9umc.6v5.vek@pharmnl.ohout.pharmapartners.nl>
On 18 May 2000 20:07:40 GMT, Abigail <abigail@foad.org> wrote:
>
>Interesting theory, but it doesn't quite work that way:
>
> $ cat /tmp/foo.pl
> #!/opt/perl/bin/perl -w
> print $0, "\n";
> print $^X, "\n";
> __END__
> $ cat /tmp/bar.pl
> #!/opt/perl/bin/perl -w
> exec {'/tmp/foo.pl'} "barny";
> __END__
> $ /tmp/bar.pl
> /tmp/foo.pl
> /opt/perl/bin/perl
> $
>
>It prints /tmp/foo.pl and /opt/perl/bin/perl, but _not_ barny.
>
>
>I guess that's a bug somewhere.
There sure is, or maybe it is a feature?
More test to find out, if you don't mind.
I am starting three types of program using execv from a compiled
C program. For both perl and shell script the first arguments
are not passed on to the program as it occurs with the compiled
program.
Only the compiled program receives the "program name" from the
argument list passed to execv, and the scripts takes it from
the program name proper which is the first argument to argv.
This I have tested on Linux and AIX systems and wee see the same
behaviour.
Sometimes we have to revise our understanding on how things work.
Villy
::::::::::::::
/tmp/c.c
::::::::::::::
#include <unistd.h>
static char *args[] = {
"Arg0",
"Arg1",
"Arg2",
"Arg3",
0
};
main (int argc, char*argv[])
{
if ( argv[1][0] == '1' ) {
execv ("/tmp/foo.pl", args);
} else if ( argv[1][0] == '2' ) {
execv ("/tmp/xx.sh", args);
} else if ( argv[1][0] == '3' ) {
execv ("/tmp/cc", args);
}
return 0;
}
::::::::::::::
/tmp/cc.c
::::::::::::::
#include <unistd.h>
#include <stdio.h>
main (int argc, char*argv[])
{
int i;
for ( i = 0; i < argc; i++ ) {
printf ("arg%d = %s\n", i, argv[i]);
}
printf ("Exit program\n");
return 0;
}
::::::::::::::
/tmp/foo.pl
::::::::::::::
#!/usr/bin/perl -w
print '$0 = ', $0, "\n";
print '$^X = ', $^X, "\n";
::::::::::::::
/tmp/xx.sh
::::::::::::::
#!/bin/sh
echo $0
for x in "$@"
do
echo $x
done
$ /tmp/c 1 # Running perl script
$0 = /tmp/foo.pl
$^X = perl
$ /tmp/c 2 # Running shell script
/tmp/xx.sh
Arg1
Arg2
Arg3
$ /tmp/c 3 # Running compiled program
arg0 = Arg0
arg1 = Arg1
arg2 = Arg2
arg3 = Arg3
Exit program
------------------------------
Date: 18 May 2000 21:02:10 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: $0 doesn't give full path
Message-Id: <8g1i82$p5f$1@orpheus.gellyfish.com>
On 18 May 2000 12:17:34 GMT Villy Kruse wrote:
> On Thu, 18 May 2000 10:04:55 GMT, Ilja <billy@arnis-bsl.com> wrote:
>
>>
>># looks like when evaluated in a cgi (using CGI.pm), $0 is the fullpath.
>>elsewhere it's the basename. # today on a linux machine i found that even in
>>a cgi $0 is the # basename. how can i get the fullpath? there has to be a
>>way.
>>
>
> The content of $0 would be inherited from the argv[0] variable, which
> again gets its contents from the exec() system call which launched
> the program. The caller could put anything in that value; it usualy is
> the name of the program or the full pathname of the program depending
> on how the programmer felt the day he wrote that part. The argv[0]
> variable can also be totaly unrelated to the name of the program.
>
>
>>So OP asked about full path of script which is executing, which has *nothing*
>>common with current working directory.
>>
>>And even if you need to get current working directory, there is no need to
>>execute an external 'pwd' command. Just use Cwd module.
>>
>
> So there is no good solution to the OP's problem, unfortunately.
>
Yes. The FindBin module ...
/J\
--
The English are always degrading truths into facts. When a truth becomes
a fact it loses all its intellectual value.
--
fortune oscar homer
------------------------------
Date: Fri, 19 May 2000 01:12:25 -0700
From: "Megan Garrison" <megan@aracnet.com>
Subject: a PS to Perl - MySQL - Notify using sendmail
Message-Id: <jD6V4.996$NX3.25916@typhoon.aracnet.com>
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01BFC12F.4AE357A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
PS - I was thinking I could use filehandle MAIL as in:
open MAIL, "| /usr/sbin/sendmail -t -oi";
print MAIL "To: $first_name $last_name <$email>\n";
print MAIL "From: Who The Email is From <email\@email.com>\n";
print MAIL "Subject: Subject of Message\n\n";
print MAIL "this is the message\n";
print MAIL "this is the message\n";
print MAIL "this is the message\n";
print MAIL "This is the messag\n";
print MAIL "\n\n-- \nAn automated update courtesy of The Messenger\n";
close MAIL;
after the submit button is pushed: if(defined $q->param('submit'))=20
but I just can't seem to get it right.=20
Hoping someone will take pity on a struggling newbie, Thanks, ~Megan
"Megan Garrison" <megan@aracnet.com> wrote in message =
news:kE2V4.995$NX3.25715@typhoon.aracnet.com...
Hello~=20
I have just recently gotten a MySQL database up and running and =
connecting to the tables via a set of generic Perl scripts. Everything =
is working great, but I would really like to modify the add.pl script so =
that it emails me whenever someone adds a record (or possibly creat a =
notify.pl script). Ditto the update.pl when someone updates a record. I =
looked through some guestbook & formmail scripts that do this type of =
thing, but I do not know perl (have only installed a few scripts) and I =
can tell from my investigations that doing this by myself is beyond my =
capability. Can anyone either offer constructive suggestions of what I =
need to do or point me in the direction of some online instruction/help. =
~Thanks, Megan
------=_NextPart_000_000A_01BFC12F.4AE357A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3013.2600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>
<P>PS - I was thinking I could use filehandle MAIL as in:</P>
<P>open MAIL, "| /usr/sbin/sendmail -t -oi";</P>
<P>print MAIL "To: $first_name $last_name <$email>\n";</P>
<P>print MAIL "From: Who The Email is From =
<email\@email.com>\n";</P>
<P>print MAIL "Subject: Subject of Message\n\n";</P>
<P>print MAIL "this is the message\n";</P>
<P>print MAIL "this is the message\n";</P>
<P>print MAIL "this is the message\n";</P>
<P>print MAIL "This is the messag\n";</P>
<P>print MAIL "\n\n-- \nAn automated update courtesy of The =
Messenger\n";</P>
<P>close MAIL;</P>
<P>after the submit button is pushed: if(defined $q->param('submit')) =
</P>
<P>but I just can't seem to get it right. </P>
<P>Hoping someone will take pity on a struggling newbie, Thanks,=20
~Megan</P></FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV>"Megan Garrison" <<A=20
href=3D"mailto:megan@aracnet.com">megan@aracnet.com</A>> wrote in =
message <A=20
=
href=3D"news:kE2V4.995$NX3.25715@typhoon.aracnet.com">news:kE2V4.995$NX3.=
25715@typhoon.aracnet.com</A>...</DIV>
<DIV><FONT size=3D2>Hello~=20
<P>I have just recently gotten a MySQL database up and running and =
connecting=20
to the tables via a set of generic Perl scripts. Everything is working =
great,=20
but I would really like to modify the add.pl script so that it emails =
me=20
whenever someone adds a record (or possibly creat a notify.pl script). =
Ditto=20
the update.pl when someone updates a record. I looked through some =
guestbook=20
& formmail scripts that do this type of thing, but I do not know =
perl=20
(have only installed a few scripts) and I can tell from my =
investigations that=20
doing this by myself is beyond my capability. Can anyone either offer=20
constructive suggestions of what I need to do or point me in the =
direction of=20
some online instruction/help. ~Thanks,=20
Megan</P></FONT></DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_000A_01BFC12F.4AE357A0--
------------------------------
Date: 19 May 2000 06:46:49 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: alphabeticalize a perl array
Message-Id: <8g2o0p$4l8$0@216.155.33.69>
In article <8F35860F7wfeidthiscom@207.126.101.97>, wfeidt@cpcug.org (Bill)
wrote:
| awd@seol.net.au (Andrew) wrote in <si0dc7dmrj045@corp.supernews.com>:
|
| >hi I need to make an array (over 100 entries) in alphabetical order.
| >Would anyone have an idea on how to do this.
| >it's perl 5.
|
| perldoc -f sort
| perldoc perlfaq4 (see under: "How do I sort an array by (anything)?")
|
| Also very useful is:
|
| http://www.sysarch.com/perl/sort_paper.html
|
| Bill Feidt
| wfeidt@cpcug.org
|
it's too bad there's no -w and 'use strict' for html parsers.. that page has
over 1100 html errors in it. =:o
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 19 May 2000 07:31:37 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: alphabeticalize a perl array
Message-Id: <x766sbgfmu.fsf@home.sysarch.com>
>>>>> "TW" == The WebDragon <nospam@devnull.com> writes:
TW> | Also very useful is:
TW> |
TW> | http://www.sysarch.com/perl/sort_paper.html
TW> it's too bad there's no -w and 'use strict' for html
TW> parsers.. that page has over 1100 html errors in it. =:o
care to elaborate? my coauthor also rewrote the demoronizer which fixes
many of redmond's html blunders so he knows legal html. i would think
his html output would not be as broken as you claim.
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: Fri, 19 May 2000 01:51:44 -0700
From: Ben Bostow <bbostowNObbSPAM@hotmail.com.invalid>
Subject: Re: Check to see if an array value is null
Message-Id: <06a58763.1cc7d584@usw-ex0109-070.remarq.com>
Thank you. Your code has really helped me understand some
more about perl that I did not know.
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Fri, 19 May 2000 00:11:23 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: Data Structures (complex)
Message-Id: <Pine.GSO.4.21.0005190004000.11977-100000@dataserv.libs.uga.edu>
On 19 May 2000, The WebDragon wrote:
...
> foreach (@database) {
> my($type, $reviewer, $map) = split /\|/;
> $masterlist{$type}{$reviewer} = $map;
> }
...
> $masterlist{$type}{$reviewer} .= [$map]; # would this work?
I think what you're after is this:
push @{$masterlist{$type}{$reviewer}}, $map;
Looks like you're on the right track to me.
--
Brad
------------------------------
Date: Thu, 18 May 2000 21:54:09 -0700
From: Jeff Zucker <jeff@vpservices.com>
To: The WebDragon <nospam@devnull.com>
Subject: Re: Data Structures (complex)
Message-Id: <3924C8F1.977527E6@vpservices.com>
The WebDragon wrote:
>
> working with a CGI form script that creates a database of the form:
> gametype|reviewername|mapname|
>
> that as it fills will resemble something like this:
>
> utassault|FuzzBuster|AS-Infiltrator|
> utdm|FuzzBuster|DM-Test123|
> utdomination|Nacher|DOM-Query|
>
> my problem is that I am not exactly certain which type of complex hash I requre.
> :)
Well you seem to be having fun with hashes so don't let me stop you if
that is the route you want to go. But since you have a database, why
not treat it like a database and use DBD::CSV or DBD::RAM? With those
you could build arrayrefs and dump those into CGI.pm. Here are just a
few examples:
# GET A LIST OF ALL GAME TYPES
#
my $types = $dbh->selectcol_arrayref(qq{
SELECT DISTINCT type
FROM games
ORDER BY type
});
# GET A LIST OF ALL REVIEWERS FOR A GIVEN TYPE
#
my $reviewers = $dbh->selectcol_arrayref(qq{
SELECT DISTINCT reviewer
FROM games
WHERE type = '$current_type'
ORDER BY reviewer
});
# GET A LIST OF ALL AVAILABLE MAPS FOR A GIVEN
# REVIEWER FOR A GIVEN GAME TYPE
#
my $maps = $dbh->selectcol_arrayref(qq{
SELECT map
FROM games
WHERE type = '$current_type'
AND reviewer = '$current_reviewer'
AND available = 'y'
ORDER BY map
});
And many other such searches. Each returns an arrayref of the answers
which you could use to build CGI.pm pop-up menus or a table of the
entire info. Other searches could return hashes instead and could be
searched and sorted on mulitple criteria at once. You can also create
and update the database with similar commands. If absolute speed is
what you need, your hashes are probably better, but if clarity of
programming is what you need, this might serve you well.
--
Jeff
------------------------------
Date: 19 May 2000 07:24:04 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Data Structures (complex)
Message-Id: <8g2q6k$4tp$1@216.155.33.69>
In article <3924C8F1.977527E6@vpservices.com>, Jeff Zucker
<jeff@vpservices.com> wrote:
| Well you seem to be having fun with hashes so don't let me stop you if
<grin> yeah, now that I finally grok how to handle them :D
| that is the route you want to go. But since you have a database, why
| not treat it like a database and use DBD::CSV or DBD::RAM? With those
Hmm.. not part of the current MacPerl build .. Assuming these are on CPAN, I
wonder if they have been tested for compatibility on Macs? I'll have to peek
around <http://testers.cpan.org/> to be sure.
| you could build arrayrefs and dump those into CGI.pm. Here are just a
| few examples:
[examples snipped for brevity. Thanks!]
| And many other such searches. Each returns an arrayref of the answers
| which you could use to build CGI.pm pop-up menus or a table of the
| entire info. Other searches could return hashes instead and could be
| searched and sorted on mulitple criteria at once. You can also create
| and update the database with similar commands. If absolute speed is
| what you need, your hashes are probably better, but if clarity of
| programming is what you need, this might serve you well.
It might indeed. This 'database' will never get very large, as it will be
deleted and re-created from week to week, with new submissions, so speed isn't a
complete issue, however, it really depends on how easily I can wrap my brain
around the problem. simple and elegant is always a good thing. :)
I'll look into it, and thanks for the tip.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 19 May 2000 07:30:36 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBI to retrieve table meta data from ms access?
Message-Id: <8g2n2c$84n$1@orpheus.gellyfish.com>
On Thu, 18 May 2000 13:50:11 GMT Johann wrote:
> Has anyone been able to get the table meta data out of an ms access db?
>
> I need to get each columns' datatype and length, but to no avail. I
> assume the problem is that access won't or can't disclose such info,
> and not that DBI:DBD can't ascertain it.
>
I think thats probably the case because on, say, Informix I can do
select * from systables
and get back the appropriate information. You will probably be better off
asking in comp.databases.ms-access to find if there is some query you can
do to obtain this information.
/J\
--
We're gonna get a new TV. Twenty-one inch screen, realistic flesh tones,
and a little cart so we can wheel it into the dining room on holidays.
--
fortune oscar homer
------------------------------
Date: 19 May 2000 07:20:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Delay in Perl
Message-Id: <8g2mfd$66v$1@orpheus.gellyfish.com>
On Thu, 18 May 2000 16:03:55 GMT Bart Lateur wrote:
> Mike Coffin wrote:
>
>>> How can I set a time delay or sleep (5 or 10 seconds) in Perl?
>>
>>sleep(5) or sleep(10)
>
> sleep 5; sleep 5;
>
> Ah, it was too tempting... :-)
No what was tempting was :
for ( $now = time(); (time() - $now) < 10 ; ){}
/J\
--
Remember that postcard Grandpa sent us from Florida of that alligator
biting that woman's bottom? That's right, we all thought it was
hilarious. But it turns out we were wrong. That alligator was sexually
harrassing that woman.
--
fortune oscar homer
------------------------------
Date: 18 May 2000 22:23:44 -0700
From: Andrew Perrin - Demography <aperrin@davis.DEMOG.Berkeley.EDU>
Subject: Re: Getopt::Std 1 == 0 ???
Message-Id: <u5kya579kpr.fsf@davis.DEMOG.Berkeley.EDU>
gregsptl1962@my-deja.com writes:
> >
> Someone else replied to this indicating "defined" as my problem i.e.
>
> $Getopt::Std::opt_c = '1' unless defined $Getopt::Std::opt_c;
> so when run as
> ./xx.pl -c 0 ## c actually yields zero
>
> This solved my original post. However I'm still stumped as to why this
> below is evaluated false on -c 0
>
> $Getopt::Std::opt_c = '1' unless $Getopt::Std::opt_c;
>
> This will yield the default "1" if run as ./xx.pl -c 0 AND MORE
> importantly -1 !! if run as
>
>
> ./xx.pl -c -1 ## Is false only 0 ? i.e. are "1" AND!!! "-1" True????
> In summary
>
> ./xx.pl -c -1 ## yields c = -1
> ./xx.pl -c 0 ## yields c = 1
> ./xx.pl -c 1 ## yields c = 1
>
perldoc perldata:
A scalar value is interpreted as TRUE in the Boolean sense if it
is not the null string or the number 0 (or its string
equivalent, "0"). The Boolean context is just a special kind of
scalar context.
--
---------------------------------------------------------------------
Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support
Department of Demography - University of California at Berkeley
2232 Piedmont Avenue #2120 - Berkeley, California, 94720-2120 USA
http://demog.berkeley.edu/~aperrin --------------------------SEIU1199
------------------------------
Date: Fri, 19 May 2000 06:08:16 +0200
From: Christian Winter <thepoet1@arcormail.de>
Subject: Re: Giving a string the name of a string
Message-Id: <gne2g8.iu9.ln@usenet-autoren.de>
Penpal International <ppi@searchy.net> schrob:
> I tought this question could be found I the faq's, but I couldn't find
> any which even looks like it:
> How can I give a string a name from the contents of an other string.
Indeed there are possibilites to let perl substite var names
by other vars contents. But those are very dirty programming and
big security riscs. IMHO this is the reason why they aren't mentioned
in the documentation.
Also there should be no need to do so.
If you really need to create dynamic naming, for whatever reason,
modularize your code and use perl's AUTOLOAD function.
HTH
Christian
------------------------------
Date: Fri, 19 May 2000 07:40:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Giving a string the name of a string
Message-Id: <x7zopnf0nu.fsf@home.sysarch.com>
>>>>> "CW" == Christian Winter <thepoet1@arcormail.de> writes:
CW> Indeed there are possibilites to let perl substite var names
CW> by other vars contents. But those are very dirty programming and
CW> big security riscs. IMHO this is the reason why they aren't mentioned
CW> in the documentation.
symrefs may be dirty but they a fully documented. and they have a useful
purpose which is not for newbies who don't know better. my rule applies:
if you don't know when not to use symrefs, you don't know enough to use
them.
CW> If you really need to create dynamic naming, for whatever reason,
CW> modularize your code and use perl's AUTOLOAD function.
huh? AUTOLOAD only deals with undefined functions, not symbolic variable
refs.
that is 2 'huh' followups in a row. you are not batting well today.
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: Fri, 19 May 2000 08:33:02 GMT
From: "Daniel van den Oord" <danielxx@bart.nl>
Subject: Re: glueing a scalar onto a variable
Message-Id: <2%6V4.2198$Kk2.28454@Typhoon.bART.nl>
I know should be
> damn got it thanks
> using an array
> $count[$number] = "selected"
------------------------------
Date: 19 May 2000 07:38:43 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help on namespaces
Message-Id: <8g2nhj$9me$1@orpheus.gellyfish.com>
On Thu, 18 May 2000 14:36:22 GMT Jim Stout wrote:
> Hello,
>
> I'm somewhat of a Perl rookie with a question regarding namespaces and
> subroutine/function call semantics when using the 'package' declaration.
> Note that I'm am not referring to Perl modules here, just subroutines
> inside packages. If I have the following:
>
> package foo;
> sub bar{
> does whatever;
> }
>
> I "require" the package 'foo' elsewhere. I know to access variables in
> foo I need to qualify them - that is,
>
> $something = $foo::variable;.
>
> Are the same semantics required to call a subroutine in a package? That
> is, should subroutine 'bar' be called as,
>
> &foo::bar();
>
> or as,
>
> &bar();
>
> or are both correct.
>
You will need to use the fully qualified form if you simply 'require' the
file. If you want to use the unqualified form then you will need to
create a module that can be 'use'd and has an export() subroutine or
inherits one from Exporter - if you let h2xs create the stub module for
you then it will have all of that stuff in it already and you can just
cut and paste your subroutines in and add them to @EXPORT or @EXPORT_OK.
/J\
--
When I look at the smiles on all the children's faces,,...I just know
they're about to jab me with something.
--
fortune oscar homer
------------------------------
Date: 19 May 2000 07:27:50 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How Do I Source a File with Environment Variables?
Message-Id: <8g2mt6$7k0$1@orpheus.gellyfish.com>
On Thu, 18 May 2000 15:45:57 GMT Rafael Garcia-Suarez wrote:
> Cory Phillips wrote in comp.lang.perl.misc:
>>Unfortunately the environment file is not that clean. Here is why.
>>
>>if [ "$ORACLE_HOME" != "" ] ; then
>> new_path=`echo $PATH | sed s@$ORACLE_HOME/bin@@g | sed s/::/:/g`
>> export PATH=$new_path
>>fi
>>
>>export PATH=`echo $PATH | sed s/::/:/g`
>>if [[ -z $LOCALHOST ]]; then
>> export LOCALHOST=$(uname -n).jsc.nasa.gov
>>fi
>>if [[ -z $HTTP_HOST ]]; then
>> export HTTP_HOST=$(uname -n).jsc.nasa.gov
>>fi
>>
>>It would be dificult to parse a file that has a bunch of conditional
>>elements in it.
>>Is there any other way?
>
> Yes, there is one: filter it through a programmer :-)
> Additionally, this may improve the efficiency of your script because
> no new processes (such as 'sed') will be needed.
>
> Alternatively, you can try to parse and filter the result of
> `sh -c '/path/to/envfile && set'`
> (untested) (notice ticks and backticks) but this is not a very
> clean method indeed.
>
Someone posted a solution using a similar technique a few weeks (or months)
ago - it can be found through Deja News .
/J\
--
Dandyism is the assertion of the absolute modernity of Beauty.
--
fortune oscar homer
------------------------------
Date: Fri, 19 May 2000 08:32:41 +0300
From: "shmuelik" <shmuelik@netvision.net.il>
Subject: How do I use substitute from the command line?
Message-Id: <8g2k7d$3kl$1@news.netvision.net.il>
I need a simple command to substiute exprestions in a file,
using the perl command s/// , and get the changes at the original file.
thanx
------------------------------
Date: Fri, 19 May 2000 06:27:08 +0000
From: Omri <ocschwar@NOSPAM.mit.edu>
Subject: Re: How do I use substitute from the command line?
Message-Id: <3924DEBC.A8E118C9@NOSPAM.mit.edu>
shmuelik wrote:
>
> I need a simple command to substiute exprestions in a file,
> using the perl command s/// , and get the changes at the original file.
>
> thanx
perl -pi.bak -e 's/foo/bar/' filename
your file will be backed up in filename.bak and the changes
will be applied to filename.
------------------------------
Date: Fri, 19 May 2000 09:54:35 +0100
From: "A Pietro" <apietro@my-deja.com>
Subject: Mail attachments: filtering out
Message-Id: <8g2vgk$jsq$1@sshuraac-i-1.production.compuserve.com>
I have been using Mail::POP3Client to retrieve mail from a POP mailbox.
But I want to identify mail that has file attachments and filter these large
messages out somewhere.
Any code around that does this?
Maybe I could write a simple script -- do I look for a header field in the
email message?
Thanks
AP
------------------------------
Date: Fri, 19 May 2000 05:52:02 +0200
From: Christian Winter <thepoet1@arcormail.de>
Subject: Re: Manipulate all *values* using CGI.pm?
Message-Id: <2pd2g8.iu9.ln@usenet-autoren.de>
Trent <trent@jps.net> schrob:
> Question- The CGI.pm docs explain how to
> return *all input keys*(@names = $new_query->param;), and get
> the values for specific keys, but I'm not clear on how to
> grab and modify *all input values* in a single stroke...
> Any help or productive tounge lashing appreciated :)
Maybe something like
my %paramhash;
map { ($paramhash{$_} = $_) =~ tr/[0-9]/[A-J]/ } $new_query->param;
may be adopted to what you have in mind.
HTH
Christian
------------------------------
Date: Fri, 19 May 2000 07:36:50 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Manipulate all *values* using CGI.pm?
Message-Id: <x73dnfgfe5.fsf@home.sysarch.com>
>>>>> "CW" == Christian Winter <thepoet1@arcormail.de> writes:
CW> map { ($paramhash{$_} = $_) =~ tr/[0-9]/[A-J]/ } $new_query->param;
huh? you are storing the param name as the value AND the key. and map in
a void context is a no-no around here. this would be better on both
counts:
( $paramhash{$_} = param($_) ) =~ tr/[0-9]/[A-J]/ for param() ;
or (values now returns lvalues):
%paramhash = map { $_, param($_) } param() ;
tr/[0-9]/[A-J]/ for values %paramhash ;
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: Fri, 19 May 2000 02:55:26 -0400
From: NagaPutih <s0218327@unix1.cc.ysu.edu>
Subject: matching question(s)
Message-Id: <Pine.A41.4.20.0005190239110.51126-100000@unix1.cc.ysu.edu>
1. i have the following statements:
$_="@all_keys";
@valid_keys=grep(!/\b$badkey\b/,m/\b[a-z]{$len}\b/g);
what i want to do is take all keys that are 3-letter strings
while excluding the bad key (assume it is also a 3-letter string);
and the above statements works just fine.
but, is there any better way to do this? (other than do the
matcing m// first; loop through the matched keys and compare each one
to the bad key)
2. what matching algorithm is used in grep()? what about regexp too?
any help would be appreciated. thank's!
------------------------------
Date: 18 May 2000 20:54:22 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: MS Documents to text---help
Message-Id: <8g1hpe$nkv$1@orpheus.gellyfish.com>
In comp.lang.perl.misc JB Goss <jgoss@goss-com.com> wrote:
> "Lynn Killingbeck" <killbeck@pointecom.net> wrote in message
> news:39220560.7A65@pointecom.net...
>> JB Goss wrote:
>> >
>> > I am looking for something simple to strip the crud out of MS
>> > documents and just leave the text... any ideas?
>> >
>>
>> "SaveAs" a *.txt file. (Via File - SaveAs menus).
>>
>> Lynn Killingbeck
>>
>> P.S. That 'crud' is a lot of formatting, so make sure that you really do
>> want to get down to a plain-vanilla ASCII (or MSDOS) format!
>
>
> Well, since I posted this is lang.perl, I thought one would understand
> I wanted something in Perl to do this... I shall be more explicit... I
> am looking for a Perl script for a Unix machine that will strip the
> crud out of a MS Word document and just leave the text (all text).
Yeah. Except you posted in a microsoft group which indicates something
else altogether. I would go with the OLE::Storage or would implement
'strings' myself ....
/J\
--
Don't eat me. I have a wife and kids. Eat them.
--
fortune oscar homer
------------------------------
Date: 19 May 2000 07:11:47 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Newbie CGI/Perl
Message-Id: <8g2pfj$4tp$0@216.155.33.69>
In article <39217C73.B92BE699@xchain.com>, pinin <pinin@xchain.com> wrote:
| DEDSRD wrote:
|
| > I've followed the install of Mac Perl.
| > I'm trying to build a comboform cgi script (i think)
| > Never used Perl or MPW
| > Q: Where do I start?
| > Q: Can I run a form on my own machine(Mac) before uploading to simulate
| > how the
| > form will work in the browser?
| > Q: Is the .cgi and .pl extensions interchangeable does it matter which?
| >
| > Darrell
|
| Hi Darrel,
|
| If you want to run your CGI scripts on your PC you need to install some
| web server
| on your Mac, you can get some free web servers from internet ( apache,
| sambar, ...
| ), read helps and go on.
ALso on the Mac, you can use the Web Sharing control panel that comes with MacOS
8.5 and up.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
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 3095
**************************************