[19039] in Perl-Users-Digest
Perl-Users Digest, Issue: 1234 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 3 03:10:36 2001
Date: Tue, 3 Jul 2001 00:10:15 -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: <994144214-v10-i1234@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 3 Jul 2001 Volume: 10 Number: 1234
Today's topics:
Perl script (CGI) to automate keying in of pass phrase <fschan@csah.com>
Re: Perl script (CGI) to automate keying in of pass phr (Chris Fedde)
Re: Query: PERL v.s. Perl ==> What's the difference?? <mischief@velma.motion.net>
regular expression for phone numbers (VB)
Re: regular expression for phone numbers <wyzelli@yahoo.com>
require user configuration files (Jared Johnson)
Re: require user configuration files (Tad McClellan)
Re: Selling Scripts <no@spam.net>
Re: SMTP help (Chris Fedde)
Re: Subroutine prototype syntax for passing typeglob? (Rafael Garcia-Suarez)
Using Array and while() loops <cjamblues@qwest.net>
Re: Using Array and while() loops <uri@sysarch.com>
Re: Using Array and while() loops <krahnj@acm.org>
Re: Vapo-Rub <bigrich318@yahoo.com>
Re: Vapo-Rub (Tim Hammerquist)
Re: Vapo-Rub <res04tzu@gte.net>
Re: Website uses frames to call perl scripts -- must I <junk@mytechsolutions.com>
Re: Where I can find BINMODE, any examples ??? <jurgenex@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 3 Jul 2001 13:07:50 +0800
From: "Fook Sheng" <fschan@csah.com>
Subject: Perl script (CGI) to automate keying in of pass phrase
Message-Id: <9hrjk7$ps8$1@clematis.singnet.com.sg>
Hi
I have a program which I want to run using CGI, it will expects a
passphrase, how can I enter the passphrase using the script (i.e. no human
intervention required)?
Interative usage of the program:
-------------------------------
$program -user joyce
Pass phrase:
<enter pass phrase here>
pls reply to fschan@csah.com
Thanks
------------------------------
Date: Tue, 03 Jul 2001 06:16:46 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Perl script (CGI) to automate keying in of pass phrase
Message-Id: <ird07.320$T3.191586304@news.frii.net>
[This note was posted and forwarded to the author]
In article <9hrjk7$ps8$1@clematis.singnet.com.sg>,
Fook Sheng <fschan@csah.com> wrote:
>Hi
>
>I have a program which I want to run using CGI, it will expects a
>passphrase, how can I enter the passphrase using the script (i.e. no human
>intervention required)?
>
>Interative usage of the program:
>-------------------------------
>
>$program -user joyce
>Pass phrase:
><enter pass phrase here>
>
The correct answer has a lot to do with how "program" reads it's
input. It may be as easy as using the "| program" form of open as
described in perlopentut manual page. Or it could be as difficult
as working with the perl Expect module available on CPAN.
The problem is that your description does not provide enough details for us
to draw a conclusion.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Tue, 03 Jul 2001 02:07:46 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Query: PERL v.s. Perl ==> What's the difference???
Message-Id: <tk2a7iel9mu718@corp.supernews.com>
codeslayer <weedmonster_99@yahoo.com> wrote:
> To Whoever Knows the Answer:
> I do not understand why so many of these posts where someone says
> "PERL", end up with some snyd comment to the effect of "its 'Perl' not
> 'PERL'". Firstly, that logic doesn't make sense. Acronyms are
> traditionally written with all capital letters.
Others have explained some basics and given some references about
why Perl is 'Perl'. This is what the Jargon File calls a backronym.
Other names in the field have seen the same fate.
> Some examples: NASA, GERD, NORMAL, DOS, etc...
What's 'NORMAL', BTW? I used to attend meetings for NORML, but
that has no 'A' in the acronym... Also, I've heard rumors that
'BASIC' is a backronym.
The best thing to remember here is, anything you want to know
about in the IT field pprobably has reference in which you can
check. This is moreso true for Perl, because the documentation
is so vast.
Chris
--
People understand instinctively that the best way for computer programs to
communicate with each other is for each of the them to be strict in what they
emit, and liberal in what they accept. The odd thing is that people themselves
are not willing to be strict in how they speak, and liberal in how they listen.
-- Larry Wall, 2nd State of the Onion Address, August 1998
------------------------------
Date: 2 Jul 2001 20:59:54 -0700
From: LSLTd@aol.com (VB)
Subject: regular expression for phone numbers
Message-Id: <5b320546.0107021959.7614e433@posting.google.com>
Hi,
Does someone know how to write a pattern to match phone numbers? It
can be up to 20 characters in length consisting of the items shown
inside the parentheses (0-9 # * and ,) Any help is appreciated.
Thanks.
Virginia
------------------------------
Date: Tue, 3 Jul 2001 13:44:06 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: regular expression for phone numbers
Message-Id: <Pzb07.40$1B2.1331@vic.nntp.telstra.net>
"VB" <LSLTd@aol.com> wrote in message
news:5b320546.0107021959.7614e433@posting.google.com...
> Hi,
>
> Does someone know how to write a pattern to match phone numbers? It
> can be up to 20 characters in length consisting of the items shown
> inside the parentheses (0-9 # * and ,) Any help is appreciated.
m/^[\d#*,]{1,20}$/
matches 1-20 of the specified characters.
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: 2 Jul 2001 19:14:31 -0700
From: jared.johnson@boeing.com (Jared Johnson)
Subject: require user configuration files
Message-Id: <93cb46a.0107021814.7fb07316@posting.google.com>
Trying to include a file I get an error "Can't locate
~username/.include_file in @INC (@INC contains ...)"
Using an HP machine I am able to execue the code
$include_file = `echo ~userid/.defaults`;
and have it return the expanded path to the .defaults file (ie
/drive/user_id/.defaults) so I can include it like this
require $include_file;
We are migrating to the Sun OS and I have found that this no longer
works.
I have also tried
open(INC_FILE, "echo ~userid/.defaults |");
$include_file = join("", <INC_FILE>);
close INC_FILE;
require $include_file;
and
$include_file = `ls ~userid/.defaults`;
require $include_file;
Perl on the Sun OS returns the "~userid/.defaults" without
substituting the ~ for the full path.
Is there any way to return the full path to the file?
------------------------------
Date: Mon, 2 Jul 2001 21:46:48 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: require user configuration files
Message-Id: <slrn9k2908.6vu.tadmc@tadmc26.august.net>
Jared Johnson <jared.johnson@boeing.com> wrote:
>Trying to include a file I get an error "Can't locate
>~username/.include_file in @INC (@INC contains ...)"
>
>Using an HP machine I am able to execue the code
> $include_file = `echo ~userid/.defaults`;
>and have it return the expanded path to the .defaults file
>We are migrating to the Sun OS and I have found that this no longer
>works.
Sun must have a different /bin/sh then.
>I have also tried
> open(INC_FILE, "echo ~userid/.defaults |");
^^^^^^
userids are _numbers_. You are going to end up confusing folks
if you call login names userids.
The above for sure isn't going to work, on any platform.
"tilde means home directory" is a shell thing, if a shell doesn't
see it then it doesn't mean that. Perl is not a shell, so you
cannot use tilde to mean home directory.
>Is there any way to return the full path to the file?
my $homedir = (getpwnam 'login')[7];
Or, from perlop.pod:
-----------------------------
a reasonably portable
way to find out the home directory (assuming it's not "0") might be:
$home = $ENV{'HOME'} || $ENV{'LOGDIR'} ||
(getpwuid($<))[7] || die "You're homeless!\n";
-----------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 03 Jul 2001 06:06:51 GMT
From: "Misanthrope" <no@spam.net>
Subject: Re: Selling Scripts
Message-Id: <%hd07.48$xp1.11358@newsread1.prod.itd.earthlink.net>
"isterin" <isterin@hotmail.com> wrote in message
news:db67a7f3.0107011324.666b146b@posting.google.com...
> "Misanthrope" <no@spam.net> wrote in message
news:<Rbv%6.8953$eL5.958301@newsread1.prod.itd.earthlink.net>...
> > <tsee@gmx.net> wrote in message
news:9hdka5$if2$07$1@news.t-online.com...
> > > "ffg" <john@trumpetweb.co.uk> schrieb im Newsbeitrag
> > > news:8or_6.4277$4i5.341643@news1.cableinet.net...
> > > In order to make it run, you need perms to be 555 or more.
> >
> >
> > Untrue.
>
> What's untrue. Maybe you want to explain why before you flaunt you
ignorance.
>
> Ilya
>
You so funny.
------------------------------
Date: Tue, 03 Jul 2001 06:23:04 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: SMTP help
Message-Id: <cxd07.322$T3.194417664@news.frii.net>
In article <3B40927C.63FAFE1A@yahoo.com>,
syed hussain <syed_altaf@yahoo.com> wrote:
>Im using the SMTP module for sending email... i couldnot find how to add
>the Subject line so that it appears in the email as a subject line..
>
Using the example in the Net::SMTP manual page. Append the line
$smtp->datasend("Subject: Just another Net::SMTP test\n");
Just after the line
$smtp->datasend("To: postmaster\n");
And just before the line
$smtp->datasend("\n");
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: 3 Jul 2001 06:57:27 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Subroutine prototype syntax for passing typeglob?
Message-Id: <slrn9k2r77.kcf.rgarciasuarez@rafael.kazibao.net>
pt wrote in comp.lang.perl.misc:
} What's the "accepted" (ahem.... yes I know.... it's Perl) syntax for
} a subroutine prototype expecting a typeglob? I've noticed that both
} the following work, and don't cause compiler barfage
}
} sub foo1(*) ;
} sub foo2($) ;
Checkout perlsub, section on prototypes :
[...] A "*" allows the subroutine to accept a bareword, constant,
scalar expression, typeglob, or a reference to a typeglob in that
slot. [...] ^^^^^^^^
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 02 Jul 2001 22:59:33 +0000
From: David J Jackson <cjamblues@qwest.net>
Subject: Using Array and while() loops
Message-Id: <3B40FCD5.41AB223@qwest.net>
Am I making this to difficult? What create an array of server info. Grab
the info for one of the servers, and print out indivual fields.
Your suggestion are appriciated
David Jackson
------------------- partial script -------------
open (BOXES,"servers.txt");
print "Enter Server name ->";$server_name=<STDIN>;chomp($server_name);
while (<BOXES>) {
# Parse out server information record
($server,$server_alias,$asset,$serial,$ser_make,$ser_model,
$owner,$location,$dpu_grp,$primary_sa,$os,$os_ver,
$ip_addr,$status,$purchase,$cs_link,$memory,$drives,
$cpus,$ibm_bkup,$bdkup_sw,$ser_func,$cem,$cem_type,$primary_func,
$maint_window,$support_level)=split(/[\t\n]/, $_,9999);
# Grab recored for server in question
if ($server =~/^$server_name/i ) {
@sir_info=("$primary_sa\t$dpu_grp\t$asset\n$serial\t$ser_make\t$ser_model\t$location
\t$support_level");
}
}
print "$server\n";
print "$primary_sa\n"
...
...
...
exit;
------------------------------
Date: Tue, 03 Jul 2001 06:08:15 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Using Array and while() loops
Message-Id: <x7y9q65yup.fsf@home.sysarch.com>
>>>>> "DJJ" == David J Jackson <cjamblues@qwest.net> writes:
DJJ> Am I making this to difficult? What create an array of server info. Grab
DJJ> the info for one of the servers, and print out indivual fields.
DJJ> ($server,$server_alias,$asset,$serial,$ser_make,$ser_model,
DJJ> $owner,$location,$dpu_grp,$primary_sa,$os,$os_ver,
DJJ> $ip_addr,$status,$purchase,$cs_link,$memory,$drives,
DJJ> $cpus,$ibm_bkup,$bdkup_sw,$ser_func,$cem,$cem_type,$primary_func,
DJJ> $maint_window,$support_level)=split(/[\t\n]/, $_,9999);
when you see many variable names that are really part of a single thing,
think hash. records map well onto hashes.
first create the list of field names. using qw will make this easy to
read and to edit
@fields = qw(
server server_alias asset serial ser_make ser_model
owner location dpu_grp primary_sa os os_ver ip_addr
status purchase cs_link memory drives cpus ibm_bkup
bdkup_sw ser_func cem cem_type primary_func maint_window
support_level
) ;
then a simple hash slice:
@record{ @fields ) = split( /[\t\n]/ ) ;
DJJ> # Grab recored for server in question
DJJ> if ($server =~/^$server_name/i ) {
DJJ> @sir_info=("$primary_sa\t$dpu_grp\t$asset\n$serial\t$ser_make\t$ser_model\t$location
use a here doc for long strings. and why are you assigning a single
string to this array?
@sir_info = ( <<EOT ) ;
$record{primary_sa}\t$record{dpu_grp}\t$record{asset}
$record{serial}\t$record{ser_make}\t$record{ser_model}\t$record{location}
EOT
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Tue, 03 Jul 2001 06:48:23 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Using Array and while() loops
Message-Id: <3B416B03.1D5AC652@acm.org>
David J Jackson wrote:
>
> Am I making this to[sic] difficult? What[sic] create an array of server info. Grab
> the info for one of the servers, and print out indivual[sic] fields.
>
> Your suggestion are appriciated[sic]
> David Jackson
>
> ------------------- partial script -------------
>
> open (BOXES,"servers.txt");
You should _allways_ check the return from open.
open BOXES, "< servers.txt" or die "Cannot read from servers.txt: $!";
> print "Enter Server name ->";$server_name=<STDIN>;chomp($server_name);
chomp( my $server_name = <STDIN> );
> while (<BOXES>) {
next unless /^$server_name\t/i;
chomp;
> # Parse out server information record
> ($server,$server_alias,$asset,$serial,$ser_make,$ser_model,
> $owner,$location,$dpu_grp,$primary_sa,$os,$os_ver,
> $ip_addr,$status,$purchase,$cs_link,$memory,$drives,
>
> $cpus,$ibm_bkup,$bdkup_sw,$ser_func,$cem,$cem_type,$primary_func,
> $maint_window,$support_level)=split(/[\t\n]/, $_,9999);
^^^^ ^^^^
Input is line oriented (newline at the end) so there is no point in
using it the regex. The 9999 is not needed as perl will Do The Right
Thing(TM).
( ... ) = split /\t/, $_;
> # Grab recored for server in question
> if ($server =~/^$server_name/i ) {
Not needed now, the test is at the beginning of the loop.
> @sir_info=("$primary_sa\t$dpu_grp\t$asset\n$serial\t$ser_make\t$ser_model\t$location
> \t$support_level");
> }
> }
> print "$server\n";
> print "$primary_sa\n"
> ...
> ...
> ...
> exit;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 2 Jul 2001 20:47:37 -0500
From: "Rich" <bigrich318@yahoo.com>
Subject: Re: Vapo-Rub
Message-Id: <tk291iadte3ad7@corp.supernews.com>
"Ilmari Karonen" <iltzu@sci.invalid> wrote in message
news:994111794.25989@itz.pp.sci.fi...
> In article <3b40ec98_3@anonymous>, Anonymous wrote:
> >I am thinking of using Vapo-Rub as a lubricant when I do the Wild Thing?
> >Anyone know of precautions or tips?
>
> Sure. Always enable warnings and strict mode.
>
> #!/usr/bin/perl -w
> use strict;
>
> If what you're doing might involve people you don't know and trust well,
> also turn on taint checks.
>
> --
> Ilmari Karonen - http://www.sci.fi/~iltzu/
> "/* If you don't understand, don't touch */" -- Abigail in the monastery
>
If the other person doesn't seem to be enjoying it, try:
use diagnostics;
You could also,
use bytes;
if your into that Marv Albert-ish sort of thing.
Rich
------------------------------
Date: Tue, 03 Jul 2001 03:16:00 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Vapo-Rub
Message-Id: <slrn9k2eti.sv.tim@vegeta.ath.cx>
Ilmari Karonen <iltzu@sci.invalid> wrote:
> In article <3b40ec98_3@anonymous>, Anonymous wrote:
> >I am thinking of using Vapo-Rub as a lubricant when I do the Wild Thing?
> >Anyone know of precautions or tips?
>
> Sure. Always enable warnings and strict mode.
>
> #!/usr/bin/perl -w
> use strict;
>
> If what you're doing might involve people you don't know and trust well,
> also turn on taint checks.
Of course, if you _do_ trust them, and you're feeling adventurous,
you might try:
use Carp; # for diagnostic purposes
require Partner; # Partner is, of course, optional
use Bondage qw(whip chain);
@group = (@willing_partners or @your_hands);
foreach $partner (@group) {
while ( $partner->is_game() ) {
whip $partner until $partner->{skin} eq 'red';
...
}
croak if $you->pass_out();
if ( $wife->caught($you) ) {
confess;
}
}
This is, of course, just an example. Use at your own risk!
--
-Tim Hammerquist <timmy@cpan.org>
Disclaimer: If anyone disagrees with anything I
say, I am quite prepared to not only retract it,
but also to deny under oath I ever said it.
-- T. Lehrer
------------------------------
Date: Tue, 03 Jul 2001 03:54:42 GMT
From: Dirk Collins <res04tzu@gte.net>
Subject: Re: Vapo-Rub
Message-Id: <3B414831.7D98E82A@gte.net>
Use rubber::condom instead... much less of a chance of unplanned code leaks
(of the genetic variety). Also good against many viruses...
Anonymous wrote:
> I am thinking of using Vapo-Rub as a lubricant when I do the Wild Thing?
> Anyone know of precautions or tips?
>
> --------== Posted Anonymously via Newsfeeds.Com ==-------
> Featuring the worlds only Anonymous Usenet Server
> -----------== http://www.newsfeeds.com ==----------
------------------------------
Date: Mon, 2 Jul 2001 21:14:42 -0600
From: Jopa <junk@mytechsolutions.com>
Subject: Re: Website uses frames to call perl scripts -- must I use frames?
Message-Id: <AJa07.1611$lQ3.655706@news.uswest.net>
I use ssi (server side includes) and make a dynamic perl header.
check the group alt.html.server-side for how to include perl this way.
Your server needs to support ssi.
So yes it can be done. PHP is ssi on steroids. I think most of those
sites you see that are dynamic without frames use either PHP or
shtml+perl,etc. (server side html mixed with cgi), though there are other
ways as well.
Jopa
~~~~~~`
Carolyn Jean Fairman wrote:
>
> I've inherited a website which uses frames. Generally the left frame
> calls a perl script related to if someone is logged in or not, and
> displays appropriate content (eg logout, show data). These
> dynamically generated links on the left call other scripts to put
> information in the main window.
>
> The frames let the pieces act independently so I don't know if I can
> redo this without frames. Would the entire page have to be
> regenerated each time (rather than just changing the main.html frame)?
> Is this much slower?
>
> I see so many sites which are NOT using frames and I'm sure they are
> doing something interesting and dynamic but of course I just see the
> output.
>
> --Carolyn
>
>
------------------------------
Date: Mon, 2 Jul 2001 22:42:28 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Where I can find BINMODE, any examples ???
Message-Id: <3b415b52$1@news.microsoft.com>
"Peter" <rig01@yahoo.com> wrote in message
news:9lpijtcjrvsj1bg0691j4hjqemh6lanajf@4ax.com...
> Where I can find BINMODE, any examples ???
'binmode' or 'BINMODE'?
The word 'binmode' can be found in e.g this posting as well as in many
scripts which need to read binary data on Windows platforms.
Or are you looking for the implementation of binmode? Or for the
documentation of binmode?
Unfortunately your question is not very clear.
jue
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 1234
***************************************