[11259] in Perl-Users-Digest
Perl-Users Digest, Issue: 4859 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 9 23:07:14 1999
Date: Tue, 9 Feb 99 20:00:23 -0800
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, 9 Feb 1999 Volume: 8 Number: 4859
Today's topics:
Re: CGI.pm and radio_group in here doc <dbc@tc.fluke.com>
Re: CGI.pm and radio_group in here doc (Andre L.)
Re: Converting CSV to LDIF <palincss@his.com>
Re: Cynamic Variable Naming <jdf@pobox.com>
Does Perl restrict regular expressions? (Mike)
Re: Does Perl restrict regular expressions? (Mike G)
fun with strings... <alves@webmetro.com>
Re: HELP on assoc. array <g200@my-dejanews.com>
Re: HELP on assoc. array <g200@my-dejanews.com>
help with https programming? <hlu@hcv.lanl.gov>
Re: help with https programming? (Kelly Hirano)
Help: serial port communications mikeh@pmel.noaa.gov
Re: Helpdesk script <emschwar@mail.uccs.edu>
Re: How to get the size of a directory in Active Perl (Martien Verbruggen)
irc and chanserv problems <glowder@bayou.com>
Is there another way <rlally1@nycap.rr.com>
Re: Is there another way <jdf@pobox.com>
lwp && netscape autoproxy troubles ... norton@alum.mit.edu
Re: Matching elements in arrays or hashes? <jdf@pobox.com>
Re: Perl 'zine <mpersico@erols.com>
perl -T results in @INC not getting $PERL5LIB <jbossert@dazel.com>
Re: perl cgi script for win95 <xanadu@icehouse.net>
Re: Perl search string problem <jboyd99@hotmail.com>
Re: please,please,please help me for my sanity. SSI exe <jjarrett@ecpi.com>
Re: please,please,please help me for my sanity. SSI exe <jjarrett@ecpi.com>
shift multi-dimension array <cchui6@ie.cuhk.edu.hk>
Simple win32 questions from an unlearned Perl novitiate (Scott Carpenter)
Re: Simple win32 questions from an unlearned Perl novit <ludlow@us.ibm.com>
Re: Source to web-based newsgroup <jjarrett@ecpi.com>
Re: Speed of Python (Ilya Zakharevich)
Re: Understanding my <chad@vcn.net>
Re: use/require question? <jdf@pobox.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 9 Feb 1999 16:27:52 -0800
From: Dan Carson <dbc@tc.fluke.com>
Subject: Re: CGI.pm and radio_group in here doc
Message-Id: <Pine.LNX.3.95.990209160531.17212A-100000@dbc-pc>
On Tue, 9 Feb 1999, Bill Moseley wrote:
> print <<EOF;
>
> ---------------------------------
> ${\CGI::radio_group(-name=>'second',
> -values=>["one", "two"],
> )}
> EOF
Scalar context gives the last item of the returned list:
sub z {(2, 4, 6)}
print "${\z}"; # prints "6"
Give it list context:
print "@{[z]}"; # prints "2 4 6"
-Dan
------------------------------
Date: Tue, 09 Feb 1999 19:49:32 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: CGI.pm and radio_group in here doc
Message-Id: <alecler-0902991949320001@dialup-579.hip.cam.org>
In article <MPG.112a62bf599b1ee19896ac@206.184.139.132>, moseley@best.com
(Bill Moseley) wrote:
> I'm using a lot of CGI's functions within here docs, but I'm having a
> problem with radio group only returning the last option.
[...]
> #! perl -w
> use strict;
> use CGI qw/-no_debug/;
>
> print CGI::radio_group(-name=>'first',
> -values=>["one", "two"],
> );
>
> print <<EOF;
>
> ---------------------------------
> ${\CGI::radio_group(-name=>'second',
> -values=>["one", "two"],
> )}
> EOF
Oops. You're using a ${\ } construct to expand the expression, thus
giving it a scalar context, so you only get the last element of the list.
To evaluate in a list context, you would want to write:
print <<EOF;
---------------------------------
@{[ CGI::radio_group(-name=>'second',
-values=>["one", "two"]) ]}
EOF
(You could also write
@{[ CGI::radio_group( 'second', ["one", "two"] ) ]}
)
HTH,
Andre
------------------------------
Date: Tue, 09 Feb 1999 20:37:42 -0500
From: Steve Palincsar <palincss@his.com>
Subject: Re: Converting CSV to LDIF
Message-Id: <36C0E2E6.78F0488B@his.com>
CSV stands for "commas separated value" and there
is a perl module in CPAN to help you parse it.
What is LDIF?
Aaron Tavistock wrote:
>
> What is a CSV file?
>
> I've done alot of scripts for converting other formats into LDIF, but I
> have no idea what CSV is.
>
> Aaron Tavistock
>
> Martin Lvnnar wrote:
> >
> > Hi,
> >
> > Is there a script/module to quickly convert CSV files to LDIF files?
> >
> > /martin lvnnar
------------------------------
Date: 10 Feb 1999 04:52:25 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: hojo <hojo@i-tel.com>
Subject: Re: Cynamic Variable Naming
Message-Id: <m3ogn2lxty.fsf@joshua.panix.com>
hojo <hojo@i-tel.com> writes:
Subject: Re: Cynamic Variable Naming
^^^^^^^
Cynical/Dynamic Variables.
local $you_probably_wont_understand_this = 42;
local @whats_the_point = ('yadda') x 3;
local %this_job_sucks;
> I looked through the faqs for this but could not find an exact
> example.
The faq is only one part of the documentation that accompanies every
perl distribution.
> I want to create the handle like this: $dbh_{user} such that each
> user has a unique db handle scott = $dbh_scott ...
You only *think* you want to do this. What you *really* want to do is
to use a hash, as documented in perldata (and in the excellent
O'Reilly book _Learning Perl_).
my %dbh = ();
$dbh{moe} = new DBI::ODBC ...
$dbh{larry} = new DBI::Sybase ...
> I am thinking about creating an array of handles indexed by the user
> %dbh[scott] as well.
Get _Learning Perl_! Read perldata!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 9 Feb 1999 21:15:06 -0600
From: pmiker@mindspring.com (Mike)
Subject: Does Perl restrict regular expressions?
Message-Id: <36c0f84d.10641430@news2.newscene.com>
I'm just a beginner in Unix and Perl but this one has stumped some of
my co-workers also. Here's the scene:
I have a log file with many records. The last field in each record
should contain a text message. Some records only have blanks in this
field. I need to know how many records have a blank last field. Each
field starts and ends with a doulble-quote and fields are comma
delimited. Here is a command prompt statement that works
egrep '.*\"[ ]+\"$' filename | wc -l
In the perl code I have done this
$unknown = `egrep '.*\"[ ]+\"$' filename | wc -l`;
When the program runs, I get the following error, 'unexpected EOF
while looking for matching `'' '
I have substituted a \n for the $, no good. (wrong answer)
I have substituted a .* for the $, no good. (wrong answer)
I have tried adding m/to the beginning (prior to the dot) and a /
after the $. No good.
Any suggestions?
Mike
P.S. The field in question appears to be 150 characters in length. I
have read that egrep strips the EOL so the $ won't work (but it did on
the command line). I have also tried putting 150 after the + or
instead of it. I'm lost.
Mike
------------------------------
Date: 10 Feb 1999 03:46:07 GMT
From: mike.golvach@peapod.com (Mike G)
Subject: Re: Does Perl restrict regular expressions?
Message-Id: <36c10078.13667553@netnews.worldnet.att.net>
You should just backslash the $ . What you've got written into your
code is the $' variable, which is the POSTMATCH special variable.
Since it thinks $' means something, it never finds the corresponding '
to the ' at the beginning of your egrep statement. If you backslash
it then perl shouldn't imbue it with any special meaning.
,Mike
mgolvach@peapod.com
On 9 Feb 1999 21:15:06 -0600, pmiker@mindspring.com (Mike) wrote:
>I'm just a beginner in Unix and Perl but this one has stumped some of
>my co-workers also. Here's the scene:
>
>I have a log file with many records. The last field in each record
>should contain a text message. Some records only have blanks in this
>field. I need to know how many records have a blank last field. Each
>field starts and ends with a doulble-quote and fields are comma
>delimited. Here is a command prompt statement that works
>
>egrep '.*\"[ ]+\"$' filename | wc -l
>
>In the perl code I have done this
>
>$unknown = `egrep '.*\"[ ]+\"$' filename | wc -l`;
>
>When the program runs, I get the following error, 'unexpected EOF
>while looking for matching `'' '
>
>I have substituted a \n for the $, no good. (wrong answer)
>I have substituted a .* for the $, no good. (wrong answer)
>I have tried adding m/to the beginning (prior to the dot) and a /
>after the $. No good.
>
>Any suggestions?
>Mike
>
>P.S. The field in question appears to be 150 characters in length. I
>have read that egrep strips the EOL so the $ won't work (but it did on
>the command line). I have also tried putting 150 after the + or
>instead of it. I'm lost.
>Mike
------------------------------
Date: Wed, 10 Feb 1999 03:53:27 GMT
From: Marcos <alves@webmetro.com>
To: Tunejunkie <tunejunkie@tunejunkie.com>
Subject: fun with strings...
Message-Id: <36C104ED.F4B2903C@webmetro.com>
Hey folks,
I am forced to deal with a scalar variable $this_is_given that was set
to a string
constant with '\n' or '\t' (not "\n" or "\t"). I need to be expand the
\n and \t sequences to
actual newlines and tabs. I tried using print and sprintf on the
variable, but these simple
attempts did not work. Why not?
I was able to loop through each character, unpacking, packing and
evaling to get the desired
result, but I would prefer a more elegant solution. Any
recommendations?
BTW, I need a solution general enough to work for something like
$this_is_given = 'howdy\nfriends\tetc...';
Cheers,
Marcos
P.S. - LET ME REPHRASE MY QUESTION:
#!/usr/bin/perl
my $this_is_given = '\n';
my $this_is_what_i_want = tooMuchCode($this_is_given);
my $this_is_what_i_dont_want = sprintf "$this_is_given";
print "\n\$this_is_given: <<\'$this_is_given\'>>\n";
print "\$this_is_what_i_want: <<$this_is_what_i_want>>\n";
print "\$this_is_what_i_dont_want: <<$this_is_what_i_dont_want>>\n";
print "\nWHY IS THIS SO???\n";
print "\nIS THERE A BETTER WAY TO GET \$this_is_what_i_want FROM
\$this_is_given???\n\n";
#
# I DON'T LIKE THIS, BUT IT WORKS!!!
#
sub tooMuchCode
{
my @tmp = split (//, $_[0]);
my $tmp;
my $code = 'sprintf "';
foreach (@tmp)
{
$tmp = unpack('c', $_);
$code .= pack('c', $tmp);
}
$code .= '";';
eval $code;
}
1;
------------------------------
Date: 10 Feb 1999 01:47:50 GMT
From: Q <g200@my-dejanews.com>
To: Jay Glascoe <jglascoe@giss.nasa.gov>
Subject: Re: HELP on assoc. array
Message-Id: <8D68CAC98ahqbigfootcom@newshost.cc.utexas.edu>
[posted and mailed]
Hi, Jay:
Thanks you very much for helping me so promptly,
the program works great!!!
It's a project from from my boss, but the company
is not willing to buy a perl book for me to
study, so i use online help file and all other
sources i could find... :)
You really help me a lots, Thanks again.
May God bless you.
Q
------------------------------
Date: 10 Feb 1999 01:49:08 GMT
From: Q <g200@my-dejanews.com>
Subject: Re: HELP on assoc. array
Message-Id: <8D68C7471ahqbigfootcom@newshost.cc.utexas.edu>
"" g200@my-dejanews.com wrote in <79pgub$6sd$1@nnrp1.dejanews.com>:
> Hi, All:
>
> I've got a problem in using the asso. array, I have a data file, looks
like:
Hi, All:
Thank you all for all the helping.
Happy perling...
Q
------------------------------
Date: 10 Feb 1999 00:44:21 GMT
From: Henry Lu <hlu@hcv.lanl.gov>
Subject: help with https programming?
Message-Id: <79qkp5$66s$1@newshost.lanl.gov>
I want to write perl program to check enscripted https web site and
download the site with my own passwd and userID. I know how to
program http with perl/LWP but I have no clue how to do
https programming.
Can someone help me? which book should I buy? (I have
book "web client programming with perl")
Henry
------------------------------
Date: 9 Feb 1999 17:06:35 -0800
From: hirano@Xenon.Stanford.EDU (Kelly Hirano)
To: hlu@hcv.lanl.gov
Subject: Re: help with https programming?
Message-Id: <79qm2r$qak@Xenon.Stanford.EDU>
try:
perldoc LWP::UserAgent
you can use the credentials method to set the username and password of the
user agent.
In article <79qkp5$66s$1@newshost.lanl.gov>,
Henry Lu <hlu@hcv.lanl.gov> wrote:
>
>
>I want to write perl program to check enscripted https web site and
>download the site with my own passwd and userID. I know how to
>program http with perl/LWP but I have no clue how to do
>https programming.
>
>Can someone help me? which book should I buy? (I have
>book "web client programming with perl")
>
>Henry
--
Kelly William Hirano Stanford Athletics:
hirano@cs.stanford.edu http://www.gostanford.com/
hirano@alumni.stanford.org (WE) BEAT CAL (AGAIN)! 101st BIG GAME: 10-3
------------------------------
Date: Wed, 10 Feb 1999 00:07:26 GMT
From: mikeh@pmel.noaa.gov
Subject: Help: serial port communications
Message-Id: <79qijm$71c$1@nnrp1.dejanews.com>
Hello,
I'm trying to set up a program to receive data from a satellite
receiver we have in the lab through a com port. I've looked at
it coming in through minicom, so I know what port and such, I'm just
not having any luck writing my own program. I'm using Perl and termios
on a PC Linux box...
I need to figure out how to watch the port and recieve the messages as
they come in randomly. I have the message format - unfortunately the are
not terminated by any charatcter in particular (no eol, etc.) and are of
variable length (always <67 bytes, though). It's being sent out on an
asynchronous UART at 9600 baud, 8 data bits, no parity, 1 stop bit.
Right now, my code freezes at the 'sysread' command. When a message comes
in, nothing happens.
Is there a better way to watch the port than the pooling loop I'm currently
trying to do?
What settings should I use when setting up the port? These are copied from
another program, and I really don't know what they all mean. Is there a good
resource anywhere? (I've read the serial-programming-HOWTO, the Linux FAQ
sec. 8, the termios man page)
Please respond via email as well. Thanks for the help.
Mike Hamilton
Here's my code so far. I copied the init_serial mostly from
another program: http://www.hitchhiker.org/dss/dss_control, and modified
some of the setting with guesses...so, it may have a lot of extranious
stuff.
#!/usr/bin/perl
# filename: iodecode.pl
# Mike Hamilton
# PMEL/OCRD/EPIC date: 1999-Feb-08
# Description:
# Decodes data coming from the MUX on the DRGS.
# Opens port to get the data
use POSIX qw(:termios_h);
use FileHandle;
$mydev = "/dev/ttyS0";
$baudrate = "9600";
$MAXSIZE = 70; #--Max size in bytes of message
$MAXSIZE = 5; #--Max size in bytes of message - small to get it to work
print "initializing...\n";
my $serial=init_serial($mydev, $baudrate);
#-----Read in the data - later on this will be a polling loop
$numread = 0;
print "entering the watch loop... \n";
while (! $numread) {
$numread = sysread($serial,$data,$MAXSIZE);
if( $numread ) { interpretmessage( $data ); }
}
print "exit the watch loop... \n";
close( PORT );
#-----------------------------------------------------------------------------
#----- Interprets the data in the message recieved. For now, just screen dump
#-----------------------------------------------------------------------------
sub interpretmessage {
my ($data) = @_;
print "got something:\n";
print "$data\n";
}
#-----------------------------------------------------------------------------
#----- Initialize the serial interface ---------------------------------------
#-----------------------------------------------------------------------------
sub init_serial {
my($port,$baud)=@_;
my($termios,$cflag,$lflag,$iflag,$oflag);
my($voice);
print "Getting new filehandle.\n";
my $serial=new FileHandle("<$port") || die "Could not open $port: $!\n";
print "Create new termios\n";
$termios = POSIX::Termios->new();
print "Get file's termios data\n";
$termios->getattr($serial->fileno()) || die "getattr: $!\n";
$cflag= 0 | CS8 | CRTSCTS | CREAD | CLOCAL;
$lflag= 0 | ICANON;
$iflag= 0 | IGNBRK | IGNPAR | ICRNL;
$oflag= 0;
print "SETTING FLAGS\n";
$termios->setcflag($cflag);
$termios->setlflag($lflag);
$termios->setiflag($iflag);
$termios->setoflag($oflag);
print "Activating flags\n";
$termios->setattr($serial->fileno(),TCIOFLUSH) || die "setattr: $!\n";
$termios->setattr($serial->fileno(),TCSANOW) || die "setattr: $!\n";
print "SETTING BAUD RATE\n";
$termios->setospeed(POSIX::B9600) || die "setospeed: $!\n";
$termios->setispeed(POSIX::B9600) || die "setispeed: $!\n";
print "Activating baud rate flags\n";
$termios->setattr($serial->fileno(),TCIOFLUSH) || die "setattr: $!\n";
$termios->setattr($serial->fileno(),TCSANOW) || die "setattr: $!\n";
# This sets all the special characters
print "SETTING SPECIAL CHARACTERS\n";
$termios->getattr($serial->fileno()) || die "getattr: $!\n";
for (0..NCCS) {
if ($_ == NCCS) { last; }
if ($_ == VMIN) { termios->setcc($_,1); next; }
$termios->setcc($_,0);
}
print "Activating special char flags\n";
$termios->setattr($serial->fileno(),TCIOFLUSH) || die "setattr: $!\n";
$termios->setattr($serial->fileno(),TCSANOW) || die "setattr: $!\n";
return $serial;
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 09 Feb 1999 17:52:57 -0700
From: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: Helpdesk script
Message-Id: <xkfvhhbhyfq.fsf@valdemar.col.hp.com>
abigail@fnx.com (Abigail) writes:
> Esben Fjord (efn@aakb.bib.dk) wrote on MCMLXXXVIII September MCMXCIII in
> <URL:news:36C0696B.BBC10526@aakb.bib.dk>:
> == Does anyone know a good helpdesk script writen in perl and easy to
> == implement on a Windows NT server?
^^^^^^^^^^
Tsk, tsk, Abigail. And you're usually so reliable, too.
> print "Click-kedy-click\n";
> system "rm -rf /home/$user";
ITYM 'system "deltree \home\$user";'.
-=Eric
------------------------------
Date: Wed, 10 Feb 1999 02:07:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to get the size of a directory in Active Perl
Message-Id: <KR5w2.358$Uh.3493@nswpull.telstra.net>
In article <79plaa$egd$1@diana.bcn.ttd.net>,
"Xavier Batlle" <xevi@itfintersoft.com> writes:
> Can I get the size of a directory with Active Perl 5.0.(and subdirectories).
First, you will need to define what you mean with 'the size of a
directory'. The sum of the sizes of all the files in a certain
directory? The sum of the actual size that they use on disk? Do you
want to inlcude the size of the directories themselves? Etc. etc.
Once you have done that, type at your prompt:
# perldoc File::Find
or use the html documentation that came with ActiveState's stuff. Use
that module.
Martien
--
Martien Verbruggen |
Interactive Media Division | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd. | am.
NSW, Australia |
------------------------------
Date: Tue, 09 Feb 1999 20:02:19 -0600
From: Gary Lowder <glowder@bayou.com>
Subject: irc and chanserv problems
Message-Id: <36C0E8AB.94BF82C8@bayou.com>
I'm having problems receiving messages back from chanserv. I'm able to
properly make a connection to Dalnet, join a channel and ident myself (I
know because chanserv then ops me, and it won't unless you've properly
id'd in this channel). The problem is I'm now trying to send a message
to chanserv to list the ops in the channel, and capture the reply for
further processing (I'm trying to manage lots of op's seperate ip's, and
will be looking for inconsistencies later in the program).
sub on_connect {
my $self = shift;
print "Sending xxxx's password...\n";
$self->privmsg("nickserv","identify xxxx_password\n");
print "Joining #channel ...\n";
$self->join("#channel");
print "Sending Chanserv msg (aops)...\n";
$self->privmsg("chanserv","aop #channel list\n");
}
#This properly idents me and joins the channel. I'm now waiting for a
reply from chanserve. I've tried the following without success:
sub on_public {
.
.
.
.
if ($arg =~ /\+ChanServ\+/i) {
print "$arg\n"; #as a test to see if it works
}
I got the pattern "+ChanServ+" (probably incorrectly) by looking at the
standard output of my tkirc/epic, which probably munges the chanserv
reply anyway. (By the way, if I format a test message to myself with
"+ChanServ+" it does work. I know it's watching because the previous
'if' statement to this watches for the signal to leave, and it works.
I then tried the following, assuming after a while that the chanserv
reply was a private message:
sub on_msg {
my ($self, $event) = @_;
my ($nick) = $event->nick;
print "*$nick* ", ($event->args), "\n";
}
This works, and prints out all private messages to me, but alas, no
chanserv messages.
My handler routines are as follows, mostly lifted from 'irctest'.
print "installing handler routine(s)...";
$conn->add_handler('public', \&on_public);
$conn->add_handler('msg', \&on_msg);
$conn->add_global_handler([ 251, 252, 253, 254, 302, 255], \&on_init);
$conn->add_global_handler(376, \&on_connect);
I think what I'm missing here is the format that ChanServ sends it's
messages back to me as, and what type of sub-routine I'd include that
in. (heh, excuse the horrible sentence structure) I'm sure I'm missing
something simple. Any help would be appreciated.
Thanks,
Gary.
------------------------------
Date: Wed, 10 Feb 1999 03:35:09 GMT
From: "Bob Lally" <rlally1@nycap.rr.com>
Subject: Is there another way
Message-Id: <N77w2.3491$YL3.211972@typhoon.nycap.rr.com>
Hi:
I have a variable that contains an ISO country code. I want to output text
depending on which country is coming in. I realize that not all domain names
conform. I have it currently designed with IF statements. Does perl have a
"switch" type statement? Should I use else's for every statement after the
first? What method would be best to save time?
Also, what would be the statement to get the last few characters in a
variable up to but not including a period. For instance:
ineedhelp.com.ca
How can I get the ca into another variable?
Thanks alot.
Bob
------------------------------
Date: 10 Feb 1999 04:59:46 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Bob Lally" <rlally1@nycap.rr.com>
Subject: Re: Is there another way
Message-Id: <m3lni6lxhp.fsf@joshua.panix.com>
"Bob Lally" <rlally1@nycap.rr.com> writes:
> Does perl have a "switch" type statement?
This is a FAQ. perlfaq7, " How do I create a switch or case statement?"
> Also, what would be the statement to get the last few characters in
> a variable up to but not including a period.
You might want to check out the O'Reilly book _Learning Perl_ which
features a gentle introduction to Perl regular expressions. Then you
should read perlre and perlop which are thorough and definitive
references to same.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Wed, 10 Feb 1999 00:49:14 GMT
From: norton@alum.mit.edu
Subject: lwp && netscape autoproxy troubles ...
Message-Id: <79ql26$9d2$1@nnrp1.dejanews.com>
I'm having difficulty using lwp to fetch documents from the internet via my
companies proxy server. My netscape browser is configured to use the
autoproxy feature. The proxy server is also not asking for any passwords ...
it seems to be based on ip address checks.
Any suggestions on how to configure a UserAgent for such a situation?
thanks,
- joe n.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Feb 1999 04:42:57 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: mattd@ukcc.uky.edu
Subject: Re: Matching elements in arrays or hashes?
Message-Id: <m3r9ryly9q.fsf@joshua.panix.com>
mattd@ukcc.uky.edu writes:
> Can the following be used to find matching elements in arrays or
> hashes?
>
> @matching = grep { /@some_array/ } @data;
No.
> I have tried the following. I know that it isn't the best way to go
> about this. What would work better, be more efficient?
Perhaps you'll get some ideas from perlfaq6, "How do I efficiently
match many regular expressions at once?"
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Tue, 09 Feb 1999 21:51:37 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Perl 'zine
Message-Id: <36C0F439.90AA7EBB@erols.com>
Oh yes. I second the motion. I mean, have you picked up TPJ? Have you
backorderd all the existing editions? What is the point of another perl
mag? Why not simply contribute to what exists?
Uri Guttman wrote:
>
> >>>>> "JTJ" == John T Jarrett <jjarrett@ecpi.com> writes:
>
> JTJ> Also, when it came in print, we could have a page for Perl Monger
> JTJ> groups and their activities; a page for the Perl Institute with
> JTJ> current projects, a project highlight, and request for project
> JTJ> leaders; a sidebar on the future of perl. As far as Perl
> JTJ> Institute's trying to get Perl better recognized, I think an
> JTJ> effort like this would go a tremendous way toward doing that.
>
> you guys are asking for a mess o'trouble. i know the publisher of tpj
> and how much work he puts in for just a quarterly. also tpj does cover
> all platforms, perl news, perl institute stuff and much more. he doesn't
> want to issue it more often because of the work load. if you all
> volunteered to help him then tpj could come more often (say bimonthly at
> first and later monthly) but publishing a glossy linux journal type rag
> is a major fulltime enterprise with big bucks needed and many
> advertisers.
>
> be careful what you ask for as you might need to produce it!
>
> uri
>
> --
> Uri Guttman Hacking Perl for Ironbridge Networks
> uri@sysarch.com uri@ironbridgenetworks.com
--
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2
------------------------------
Date: Wed, 10 Feb 1999 11:38:54 +0800
From: John Bossert <jbossert@dazel.com>
Subject: perl -T results in @INC not getting $PERL5LIB
Message-Id: <36C0FF4E.C18E7593@dazel.com>
I note that when I execute perl (5.004 on a HP/UX system) with -T, the
value of $PERL5LIB doesn't get into the @INC list. Thus, things like
"use strict;" fail. :-(
What's the best way of addressing this? I can think of a few:
1) #!/usr/bin/perl -wTI/location/of/my/PERL5LIB as the first line of my
script
2) adding 'unshift(@INC, $ENV{'PERL5LIB'});' to the top of my script.
Style mavens, any thoughts? Buehler? Buehler?
Thanks in advance.
--
====================================================================
John Bossert email: jbossert@dazel.com
Systems Engineer voice: 425.462.2060
Dazel Corporation fax: 425.462.2064
800 Bellevue Way NE, Suite 400 pager: 800.SKY.PAGE pin 1454252
Bellevue, WA 98004 URL: http://www.dazel.com
------------------------------
Date: Tue, 09 Feb 1999 17:08:10 -0800
From: Myke Folkes <xanadu@icehouse.net>
Subject: Re: perl cgi script for win95
Message-Id: <36C0DBEC.B7CD0853@icehouse.net>
It would seem to me that you would need to set up a web server on the Win95
machine, and refer to the website using the localhost IP address
(127.0.0.1).. of course, I could be wrong.. but I would like to know what
worked for you, I may need to do this myself in the near future..
ttyl
-Myke
steven farris wrote:
> Hello, Can someone tell me how to set up a perl cgi script on a win95
> machine. I want to write a cgi to be used in offline mode (local file)
> but the browser (nestscape) won't recognize the output of the script.
> The specific problem is that the output goes to a dos window spawned by
> the
> browser. Thanks, Steve Farris
------------------------------
Date: Tue, 09 Feb 1999 23:03:53 -0500
From: Jason Boyd <jboyd99@hotmail.com>
Subject: Re: Perl search string problem
Message-Id: <36C10528.DBF56142@hotmail.com>
Jason (my name too),
Without knowing what you've got in $abc, its hard to know what might be wrong,
but the statement:
$abc =~ tr/\D//;
ought to remove all non-digit characters in the string stored in $abc, as will
the more appropriate:
$abc =~ s/\D//g;
Perhaps your problem lies in the value of either of the above when evaluated aas
expressions. I'm not sure what ($abc =~ s/\D//g) evals as. Are you?
Jason Boyd
lamj@softhome.net wrote:
> I am trying to find a way to find if there are any non number characters in a
> string. Can anyone tell me the way to do it.
>
> I have tried the following but without success
>
> if ($abc =~ tr/\D//) {}
>
> \D suppose to be same as [^0-9], the above statement would not find any non
> numeric char in $abc.
>
> Jason Lam
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 09 Feb 1999 19:02:22 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
Subject: Re: please,please,please help me for my sanity. SSI execing?
Message-Id: <36C0CC8E.336D22F9@ecpi.com>
per Apache XSSI docs (http://www.apache.org/docs/mod/mod_include.html)
< start-quote >
Include virtual
The value is a (%-encoded) URL relative to the current document being
parsed.The URL cannot contain a scheme or hostname, only a path and
an optional query string. If it does not begin with a slash (/) then it is
taken to be relative to the current document.
< end quote >
so... <!--#include virtual="/cgi/headlines.pl?county=devon" --> i think.
You've also tried both .html and .shtml extensions?
John T. Jarrett
el_pollo_diablo wrote:
> Right i type this into navagators url bar and it works!
>
> http://www.arc-interactif.com/cgi/headlines.pl?county=devon
>
> How do i put this into a web page?
>
> --
> ---
> Ben
------------------------------
Date: Tue, 09 Feb 1999 21:37:58 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
Subject: Re: please,please,please help me for my sanity. SSI execing?
Message-Id: <36C0F106.FA571963@ecpi.com>
More data:
1. <!--#include virtual="/cgi-bin/headlines.pl?county=devon" --><br>
2. <!--#include
virtual="/data1/hypermart.net/giveaway/cgi-bin/headlines.pl?county=devon" --><br>
3. <!--#include
virtual="http://giveaway.hypermart.net/cgi-bin/headlines.pl?county=devon" --><br>
4. <!--#exec cgi="/cgi-bin/headlines.pl?county=devon" --><br>
5. <!--#exec cgi="/data1/hypermart.net/giveaway/cgi-bin/headlines.pl?county=devon"
--><br>
6. <!--#exec cgi="http://giveaway.hypermart.net/cgi-bin/headlines.pl?county=devon"
--><br>
Above are six ways you could write your call with the url. Tested, #1, the top one,
is the only one that works on hypermart.net servers using your original program
included below. Please see the Apache docs and clear up what you may not
understand.
John T. Jarrett
#!/usr/local/bin/perl
use CGI;
$query = new CGI;
$county = $query->param('county');
print $query->header();
print $query->start_html('TITLE_GOES_HERE');
print $county;
print "hejkllo";
print $query->end_html();
------------------------------
Date: 10 Feb 1999 02:26:49 GMT
From: hui chi chun <cchui6@ie.cuhk.edu.hk>
Subject: shift multi-dimension array
Message-Id: <79qqp9$smc$1@eng-ser1.erg.cuhk.edu.hk>
Hi,
I have some question above perl command. I would be very appreciated if
you answer my question.
Could you tell me how to shift a multi-dimension array? shift seems to
work only on single dimemsion array.
My way is to write a subroutine:
sub shiftslice{
local(*someary) = @_;
shift(@someary);
}
$a[1][1][1]=1;
$a[1][1][2]=2;
$a[1][1][3]=3;
do shiftslice(*ptr=$a[1][1]);
Since $a[1][1] is an array when I print it, i think i can shift $a[1][1]
in the subroutine as a single dimension array. It appears to work but I
am worried if it may overwrite other memory. Would it? Could you suggest
some other way to do it?
I would prefer you email to me if you know the answer. Thank you very
much.
Ronald
------------------------------
Date: Wed, 10 Feb 1999 01:05:44 GMT
From: Sorry@No.Reply.Due.To.Spam (Scott Carpenter)
Subject: Simple win32 questions from an unlearned Perl novitiate (Can't find the win32 FAQ)
Message-Id: <36c0ce6b.106374563@enews.newsguy.com>
Hello,
Thanks in advance for any advice. I would have checked the win32 FAQ
but it seems to be unavailable right now. I'm working through
"Learning Perl" - not the Win32 edition - on ActiveStates Perl 5.3,
and while most things work fine, there are a few things I can't get to
work in Win32.
Most importanty, something like:
@a = <STDIN>;
or
while (<STDIN>) {
}
works for entering line after line, but then CTRL-D doesn't work, and
CTRL-Z causes strange results. Can anyone tell me how to indicate
EOF?
Another thing that isn't a big deal: -w doesn't seem to work the same
in Win32. "Learning Perl" says you should get a warning if you use
something that's undef. I'm not getting that in Win32 (I did see it
on a Linux box so I believe the truth of it).
Desperately Seeking Enlightenment,
Scott Carpenter
------------------------------
Date: Tue, 09 Feb 1999 20:55:11 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Simple win32 questions from an unlearned Perl novitiate (Can't find the win32 FAQ)
Message-Id: <36C0F50F.CA1FB7FF@us.ibm.com>
Scott Carpenter wrote:
> Thanks in advance for any advice. I would have checked the win32 FAQ
> but it seems to be unavailable right now. I'm working through
The FAQ should have been installed on your system.
\perl\html\perl-win32
There is also the online version:
http://www.activestate.com/support/
> Most importanty, something like:
> @a = <STDIN>;
> works for entering line after line, but then CTRL-D doesn't work, and
> CTRL-Z causes strange results. Can anyone tell me how to indicate
> EOF?
ctrl-z should work. Please elaborate on "strange results".
> Another thing that isn't a big deal: -w doesn't seem to work the same
> in Win32. "Learning Perl" says you should get a warning if you use
> something that's undef. I'm not getting that in Win32 (I did see it
> on a Linux box so I believe the truth of it).
-w is a big deal. It should also be working on you Win32 system. What
does the following give you?
perl -we "print $foo"
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: Tue, 09 Feb 1999 21:42:49 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
To: gibsonc@aztec.asu.edu
Subject: Re: Source to web-based newsgroup
Message-Id: <36C0F229.78615F70@ecpi.com>
[comp cc to author]
I just saw one while looking for a perl mailing list management script at
http://www.cgi-resources.com.
John T. Jarrett
gibsonc@aztec.asu.edu wrote:
> Can someone tell me where to get the source for a web-based news group similar
> to dejanews?
>
> Thanks for your time.
>
> gip_123@yahoo.com
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Feb 1999 01:06:39 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Speed of Python
Message-Id: <79qm2v$erm$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Jay Glascoe
<jglascoe@giss.nasa.gov>],
who wrote in article <36C08D85.58DDF19E@giss.nasa.gov>:
> > @x=<>; from sys import stdin
> > a=stdin.read()
>
> not quite right here. Python should read "a = stdin.readlines()".
> That way both objects, "x" and "a", are lists.
Quite true.
> (BTW, I would be
> extremely surprised if either language is much faster here: all
> the action is taking place at the C level for both.)
Nope. On reasonable systems (this probably excludes Linux - and maybe
some Win* ports) Perl's read is implemented *below* the C level (Perl
peaks inside the I/O buffers).
Ilya
------------------------------
Date: Wed, 10 Feb 1999 03:31:54 GMT
From: Chad M. Townsend <chad@vcn.net>
Subject: Re: Understanding my
Message-Id: <79quja$hav$1@nnrp1.dejanews.com>
yong@shell.com wrote:
> Programming Perl says "Subroutines called from within the scope of such a
> private variable cannot see the private variable unless the subroutine is also
> textually declared within the scope of the variable." But why does the code
> below print a my variable correctly?
>
> #!/usr/shell/bin/perl -w
>
> { my $a="TEST";
> &mysub($a);
> }
>
> sub mysub
> { print "This is a test of ", shift, ".\n";
> }
>
> It prints "This is a test of TEST." But mysub is declared outside of $a's
> private block. Thanks.
>
Yes, '$my' is a 'my', but you pass it as a argv to 'mysub', therefor
being this argv of 'mysub' which 'shift' glady prints.
--cut
#!/usr/bin/perl
{ my $a = "TEST";
&mysub(); # don't pass $my to mysub
}
sub mysub {
print "$my\n"; # prints nothing
}
--cut
You can pass 'my' declared variables to other subroutines if you
use them as a argv when calling the subroutine.
-chad
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
--------------------------------------------------------
Chad M. Townsend Virtual Community Network, Inc.
Chief Technical Officer Your Local Community Online!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Feb 1999 04:28:42 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Chad Lawson <cdlawson@xnet.com>
Subject: Re: use/require question?
Message-Id: <m3u2wvkkd1.fsf@joshua.panix.com>
Chad Lawson <cdlawson@xnet.com> writes:
> Instead of maintaining one large perl script, I would like to break down
> the file into pieces with each file containing the routines related to
> one type of function.
You'll want to read perlmod. It's challenging, but well worth the
effort. There's a handy template therein, which you can simply copy
and paste and modify, though it's best to understand the docs rather
than to blindly mimic the sample code.
While you're at it, check out perlsub and perlmodlib. Good luck.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4859
**************************************