[9389] in Perl-Users-Digest
Perl-Users Digest, Issue: 2984 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 25 18:17:25 1998
Date: Thu, 25 Jun 98 15:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 25 Jun 1998 Volume: 8 Number: 2984
Today's topics:
'print reverse <>' question <peapod@nojunk.rahul.net>
Re: 'print reverse <>' question (Matt Knecht)
Re: 'print reverse <>' question <*@qz.to>
Re: A Script for checking emails valid? uunet!netcom.com!bobmacd+062598Nclpm
Re: Array trouble - severe newbie Grehom@my-dejanews.com
Re: Can someone explain the arrow operator ? (Greg Bacon)
cookie and redirect (Allan M. Due)
Re: Date calculation formula needed (Greg Bacon)
Re: first language - last language Grehom@my-dejanews.com
Re: first language - last language (Jonathan Stowe)
Re: Flames.... (Chip Salzenberg)
format with multiple headers <prl2@lehigh.edu>
Re: help! : Arrays in Perl Grehom@my-dejanews.com
How do I get a system call to write it's information in <bth@acsu.buffalo.edu>
how do I parse a certain structured text? (Michael Wang)
if statement, legal? markf@acuityinc.com
Re: if statement, legal? <hminter@herc.com>
Linked list <bbelang1@eccms1.dearborn.ford.com>
MacPerl and odd filenames (Bob MacDowell)
msqlperl and windows 95 <josri@postoffice.pacbell.net>
Mysterious error with Perl DBM (Tom O'Neil)
Re: NEwbie question: how do I find string length? Grehom@my-dejanews.com
perl on windows 95 <josri@postoffice.pacbell.net>
Re: Questions I'd like answered (was: Re: Flames....) (Ron Pero)
Re: regex error <*@qz.to>
Re: Regexp/Email header problem (Greg Bacon)
Re: Sending mail through another server? (Neil Briscoe)
Re: Sending mail through another server? (Greg Bacon)
socket programming in perl ? sabhay@my-dejanews.com
TCL string trimright/trimleft equivalent <mark@satch.markl.com>
TCL string trimright/trimleft equivalent <mark@satch.markl.com>
Re: TCL string trimright/trimleft equivalent <tchrist@mox.perl.com>
Re: TCL string trimright/trimleft equivalent (Matt Knecht)
Re: Testing perl knowledge (John Stanley)
Re: Testing perl knowledge <*@qz.to>
Re: The return status from system()? <tchrist@mox.perl.com>
Use socket question <jperkins@mail.wtamu.edu>
Re: What a Crappy World (oh, yes!) <mdkersey@hal-pc.org>
Re: What a Crappy World (Jonathan Stowe)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 Jun 1998 20:46:24 GMT
From: "Jennie Van Heuit" <peapod@nojunk.rahul.net>
Subject: 'print reverse <>' question
Message-Id: <6mucv0$cug$1@samba.rahul.net>
With this file:
(mozart) jennie 13% cat file
first
second
third
fourth
fifth
If I do this, I lose the first line:
(mozart) jennie 8% perl -ne 'print reverse <>' file
fifth
fourth
third
second
and it hangs. I can kill it with two EOTs (^D) or a break
(^C).
If I leave out the "-n" flag, it does what I want:
(mozart) jennie 12% perl -e 'print reverse <>' file
fifth
fourth
third
second
first
So I understand what to do right, but I'm not clear on what
it's doing in the first case. Can anyone explain?
Thanks.
-Jennie
--
<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>
Jennie Van Heuit, Alameda, CA http://www.rahul.net/peapod/
(return address is not munged; reply should work just fine)
"Wear sunscreen." -Mary Schmich (*not* Kurt Vonnegut)
------------------------------
Date: Thu, 25 Jun 1998 20:59:39 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: 'print reverse <>' question
Message-Id: <%Syk1.55$u05.634898@news3.voicenet.com>
Jennie Van Heuit <peapod@nojunk.rahul.net> wrote:
>If I do this, I lose the first line:
>(mozart) jennie 8% perl -ne 'print reverse <>' file
perldoc perlrun states:
-n causes Perl to assume the following loop around your
script, which makes it iterate over filename arguments
somewhat like sed -n or awk:
while (<>) {
... # your script goes here
}
...
So, "perl -ne 'print reverse <>' file" ends up looking like:
while (<>) {
print reverse <>;
}
Yikes! Not what you had intended at all!
>(mozart) jennie 12% perl -e 'print reverse <>' file
Which just gives you:
print reverse <>;
Exactly right! :)
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: 25 Jun 1998 21:47:50 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: 'print reverse <>' question
Message-Id: <eli$9806251721@qz.little-neck.ny.us>
In comp.lang.perl.misc, Jennie Van Heuit <peapod@nojunk.rahul.net> wrote:
> With this file:
> (mozart) jennie 13% cat file
[five lines: "first" to "fifth"]
> If I do this, I lose the first line:
> (mozart) jennie 8% perl -ne 'print reverse <>' file
[four lines: "fifth" to "second"]
> and it hangs. I can kill it with two EOTs (^D) or a break
> (^C).
>
> If I leave out the "-n" flag, it does what I want:
> (mozart) jennie 12% perl -e 'print reverse <>' file
....
> So I understand what to do right, but I'm not clear on what
> it's doing in the first case. Can anyone explain?
If you examine the explaination of -n in perlrun you see that
it states that it puts the following loop around your code:
while (<>) {
... # your script goes here
}
So in your -ne script, here's what happens:
1. The <> in the while loop assigns the first line of file to $_
2. The <> in for the reverse statement reads the rest of the file
and reverses it, then that gets printed.
3. The loop repeats and this time the <> attempts to read from
stdin, so you must send the tty end of file code (^D by default).
<> is rather special. Normally it means "<$foo>". But in a while loop,
all alone, it means "defined($_=<$foo>)". In both cases $foo is either
$ARGV[0] or STDIN. Upon reaching the end of the file, a "shift @ARGV;"
operation will occur, and $foo will be reset to either $ARGV[0] or
STDIN. $foo only becomes STDIN when $ARGV[0] is undefined or when
$ARGV[0] is (eq) '-'. So when you read from <> after getting an EOF,
you have moved on from the argument list to standard input.
Does that make things clear?
Elijah
------
<> often confuses new perl people
------------------------------
Date: Thu, 25 Jun 1998 21:08:11 GMT
From: uunet!netcom.com!bobmacd+062598Nclpm
Subject: Re: A Script for checking emails valid?
Message-Id: <bobmacdEv4LDo.A0u@netcom.com>
"Mr. Guy Gershoni" <oxygene@yoyo.cc.monash.edu.au> writes:
>I am just wondering if anyone knows where I might be able to get a script
>that will go through a list of emails and check that they still exsist.
Depends. How big a list?
-Bob
------------------------------
Date: Thu, 25 Jun 1998 20:43:22 GMT
From: Grehom@my-dejanews.com
Subject: Re: Array trouble - severe newbie
Message-Id: <6mucpb$5so$1@nnrp1.dejanews.com>
> >
> > Basically, how do I print to an array?
> >
I'm fairly new to this too but you could have a look at this
#!/usr/bin/perl -w use diagnostics; # split the string into bits (at comma
white spaces) and load into array. @mytab = split(/,\W+/,"fred, jim, bob,
jill"); # print array contents out, one element per line (don't even need a
subscript!) foreach (@mytab) { print $_, "\n"; }
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 25 Jun 1998 20:22:45 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Can someone explain the arrow operator ?
Message-Id: <6mubil$hfn$2@info.uah.edu>
In article <MPG.ffc3de2d7a2b53e9896d3@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) writes:
: I'll never forget my shock when writing a hash like a => 'foo', b =>
: 'bar', ... to get warnings on m, s and y. Ouch. But quotes or capital
: letters solved the problem.
Fixed in the next release.
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 25 Jun 1998 20:27:45 GMT
From: due@murray.fordham.edu (Allan M. Due)
Subject: cookie and redirect
Message-Id: <6mubs1$9rj$0@206.165.146.72>
Hi Folks,
Today I took a lame test for a lame job that I don't really want
but there was a question on it that is bugging me. The question asked
to generate a cookie and then redirect the person to a new site, all in
one script. Hmm, cookies. Anyway, my answer is below but it doesn't
work well in the sense that if there are pictures on the site they are
not displayed if they do not have complete paths. I have tried messing
about with LWP but even with my more elaborate versions I still don't
achieve the desired results. I am sure I am missing something obvious
but it has been a long day and I can't see it.
Now I know this is kind of not a Perl question in that the problem
is really a CGI type issue but if someone could just point me in the
correct direction I would appreciate it. Thanks.
AmD
-------------------------8<------------------
#!/usr/local/bin/perl
use strict;
use CGI;
use LWP::Simple;
my $q = new CGI();
my $cookie = $q->cookie(-name=>'Userid',-value=>'something');
print $q->header(-type=>'text/html',-cookie=>$cookie,-expires => '+3d');
getprint('http://www.amazon.com');
--
Allan M. Due
Due@Murray.Fordham.edu
The beginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: 25 Jun 1998 21:16:16 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Date calculation formula needed
Message-Id: <6muen0$hfn$5@info.uah.edu>
In article <3592822A.B806DC0D@mc0115.mcclellan.af.mil>,
Derek Romeyn <romeyde@mc0115.mcclellan.af.mil> writes:
: I have this set of data which I am extracting dates from. The dates are
: in a annoying format like so: 8013
:
: That stands for the 13th day of 1998. So the largest number would be
: 8365 and then it would roll to 9001.
I'd use something like this:
use Date::Calc 'Add_Delta_Days';
my $annoying = 8013;
## I'm assuming the last three numbers are the day of the year and
## everything else is to be added to 1990, so Jan 1, 2000 would be
## 10001
my($year,$day) = $annoying =~ /^(\d+)(\d\d\d)$/;
$year += 1990;
my $nice = sprintf "%04d-%02d-%02d",
Add_Delta_Days($year, 1, 1, $day - 1);
This is with version 4.2 of Date::Calc from CPAN--the interface changed
dramatically since the last time I used this module, and the old code is
no longer on CPAN. :-(
: What I need to be able to do is calculate if the extracted date is
: within a certain range. IE: 30,90,180 days of the current date.
The Date::Calc manpage gives an example of this:
2) How do I check wether a given date lies within a
certain range of dates?
use Date::Calc qw( Date_to_Days );
$lower = Date_to_Days($year1,$month1,$day1);
$upper = Date_to_Days($year2,$month2,$day2);
$date = Date_to_Days($year,$month,$day);
if (($date >= $lower) && ($date <= $upper))
{
# ok
}
else
{
# not ok
}
Of course, you'd have to get year, month, and day as above.
: The only methods I can think of involve some pretty simple but time
: consuming processes. IE: convert every date back to readable format
: (1998, 01, 13) then use date_difference (part of Date::Datecalc) to get
: the result. But seems pretty durn inefficient and I will be dealing
: with a 500k+ file.
Hmm.. the problem would come on year boundaries. You could use the
Days_in_Year sub to calculate how far into the next year you can go.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Thu, 25 Jun 1998 20:26:10 GMT
From: Grehom@my-dejanews.com
Subject: Re: first language - last language
Message-Id: <6mubp3$4u3$1@nnrp1.dejanews.com>
In article <6mrfv3$2p7$1@nnrp1.dejanews.com>,
birgitt@my-dejanews.com wrote:
>
> In article <3588E674.50B81564@nortel.co.uk>,
> "F.Quednau" <quednauf@nortel.co.uk> wrote:
>
> > Perl is the first laguage that I am trying to explore in depth. And that is
> > because Perl is what it is, and Fortran, Delphi and VBasic failed to do the
> > same, that is, gripping my imagination. I perceive Perl as a kind of
freestyle
> > language, where you have so many ways to do something that people tend to
say
> > 'this is no good for a beginner'. But hey, you can grow with the language,
and
> > you can use Perl on a very basic level (I know what I am talking about).
And,
> > not to forget, Perl is FREE. It's availability is excellent, Documentation
is
> > good, and you get to speak to nice people :). So if you like coolness, and a
> > bit of weirdness , go for Perl! I luvvit!
> >
>
> And I 'luvve' this thread - very luvvly statements from ol' realist
> programming moms and dads. So I can't resist:
>
> What is the *last* language all you experts would ever want to
> deal with ? Don't say there isn't one.
>
> Who bets with me ? Will the thread be as long from here on
> as it was for *first* language ?
>
> :-)
>
> Birgitt Funk
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
>
My first four years commercial programming were in Hewlett Packard's
'Transact/3000' - it had it's good points but I'll bet you've never heard of
it and that's my main argument against it.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 25 Jun 1998 20:44:44 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: first language - last language
Message-Id: <35929a8f.2659633@news.btinternet.com>
On Wed, 24 Jun 1998 18:19:15 GMT, birgitt@my-dejanews.com wrote :
>
> What is the *last* language all you experts would ever want to
> deal with ? Don't say there isn't one.
>
The Axis GIS system language (Sorry Eric). Check out the docs at
http://www.axis2000.co.uk/ for confirmation.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Thu, 25 Jun 1998 21:18:39 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Flames....
Message-Id: <6muett$evq$1@cyprus.atlantic.net>
According to les@MCS.COM (Leslie Mikesell):
>Chip Salzenberg <chip@mail.atlantic.net> wrote:
>>O'Reilly isn't a bunch of volunteers discussing their work/play amongst
>>themselves. They're a profit-making entity, albeit one with a slightly
>>broader mind and longer view than most. So there is no real comparison.
>
>It's odd that there is such a remarkable similarity in the names
>of these O'Reilly shills and the regular people on c.l.p.m. then.
Leaving aside the term "shill", which is pejorative and false:
Why do you think it odd? Tim O. recruits the real experts.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Thu, 25 Jun 1998 15:28:59 -0400
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: format with multiple headers
Message-Id: <6mu8dj$1l9q@fidoii.cc.Lehigh.EDU>
I want to maintain my page header, but use sub headers as well. Example:
__________________________________
PAGE HEADER page 1
SUB HEADER
blah
blah
SUBHEADER
blah
blah
__________________________________
PAGE HEADER page 2
SUB HEADER
blah
blah
blah
__________________________________
How can i do this? Perl only has $FORMAT_NAME and $FORMAT_TOP_NAME. I thought
perhaps I might build the sub sections on the side somehow, and then suck them
out of the accumulator to be print-ed to the REPORT. Not sure how to accomplish
that while still keeping my page header in case I should exceed page length.
Finally, I wonder how I might keep a block of text (a sub-section) together and
not be split over a page break.
Thanks,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Phil R Lawrence phone: 610-758-3051
Programmer / Analyst e-mail: prl2@lehigh.edu
194 Lehigh University Computing Center
E.W. Fairchild - Martindale, Bldg. 8B
Bethlehem, PA 18018
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Thu, 25 Jun 1998 21:45:53 GMT
From: Grehom@my-dejanews.com
Subject: Re: help! : Arrays in Perl
Message-Id: <6mugeh$a13$1@nnrp1.dejanews.com>
>
> I am pretty new with Perl an can't seem to find a function that will
> tell me the length of an array. Is there such a thing [there must be]?
>
I'm pretty new to Perl too - but I have a copy of the excellent 'Programming
Perl' by Larry Wall - and in the index under 'length of arrays' it refers to:
(page 49) scalar evaluation of @days just say $#days which will return the
subscript of the last element of the array.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 25 Jun 1998 16:56:44 -0400
From: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: How do I get a system call to write it's information into the file that calls it?
Message-Id: <Pine.GSO.3.96.980625164930.2391A-100000@callisto.acsu.buffalo.edu>
I have a piece of code that I want to execute in the shell and have its
output write into the application that called it.
$x=0;
#build the initial array of people who are logged on and what host
foreach $personA (@people_array){
foreach $hostA (@host_array){
if ((system "rusers -l $hostA | fgrep $personA") == 0){
push(@logged_on, $personA."@".$hostA);
print $logged_on[i];
$x++;
}
}
}
what it's suppose to do is run the command line
rusers -l $hostA | fgrep $personA
for a list of different people on a list of different servers. What it
does is just start spewing information about all users (not just the ones
in my list $personA) (like it only receives the command line
rusers -l $hostA
and not the rest of the line. So I'm assuming my "s are being used wrong.
Any idea how to fix that? And also the problem of not printing it to
screen, but just send the information to an array in the program?
Thanks in advance.
Bryan H
------------------------------
Date: 25 Jun 1998 20:03:15 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: how do I parse a certain structured text?
Message-Id: <6muae3$1if$1@news.ml.com>
Suppose I want to get
SID_NAME and ORACLE_HOME
from the following construct, how should I do it. Please note
the text can be arranged differently.
SID_LIST_CICGPROD-DS2-P_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CICGNYP1)
(ORACLE_HOME = /ds2-export/apps/oracle/product/7.3.4)
)
(SID_DESC =
(SID_NAME = CICGNYP2)
(ORACLE_HOME = /ds2-export/apps/oracle/product/7.3.4)
)
)
------------------------------
Date: Thu, 25 Jun 1998 20:38:42 GMT
From: markf@acuityinc.com
Subject: if statement, legal?
Message-Id: <3592B1D6.64495ACD@acuityinc.com>
if ($a > 0 or $b > 0 ) {}
It's the 'or' that I'm asking about. Is it legal, possible, or am I
using the wrong syntax?
-Mark
------------------------------
Date: Thu, 25 Jun 1998 20:43:38 GMT
From: "H. Wade Minter" <hminter@herc.com>
Subject: Re: if statement, legal?
Message-Id: <3592B5FD.30B9FC1@herc.com>
markf@acuityinc.com wrote:
> if ($a > 0 or $b > 0 ) {}
Try
if (($a > 0) || ($b > 0))
{
}
--Wade
------------------------------
Date: Thu, 25 Jun 1998 16:38:52 -0400
From: Bryan Belanger <bbelang1@eccms1.dearborn.ford.com>
Subject: Linked list
Message-Id: <3592B55C.FF530916@eccms1.dearborn.ford.com>
I am currently using a linked list in Perl for a nasty sort. The node of
this linked list is an object as follows:
package ReOrder;
sub new {
my($class) = shift;
my(%params) = @_;
bless {
"text" => $params{"text"},
"orderNum" => $params{"orderNum"},
"level" => $params{"level"},
"next" => $params{"next"},
"previous" => $params{"previous"}
}, $class;
}
Earlier in the program I do some direct assignments to the properties
without problems, but when I get to
the following four lines I get a "Can't modify modulus in scalar
assignment" error:
# Rehook our stuff
%{$cur_ReOrder}->{'next'} = %{$next}->{'next'};
%{$next}->{'next'} = %{$temp}->{'next'};
%{$next}->{'previous'} = $temp;
%{$temp}->{'next'} = $next;
Can anyone explain to me why this error occurs, and how I can get around
it?
Thanks,
Bryan Belanger
--
********************************************************************************
Bryan Belanger - PLSSG Developer
Cube: GS-T21
Phone: 31-74246
-- "This space for rent"
********************************************************************************
------------------------------
Date: Thu, 25 Jun 1998 21:43:34 GMT
From: bobmacd+cmp@netcom.com (Bob MacDowell)
Subject: MacPerl and odd filenames
Message-Id: <bobmacdEv4n0M.D2A@netcom.com>
I need to open some files in MacPerl 5.2.0r4, and it's unable to open
certain files. It can READDIR their names but when it tries to open them,
it fails. Here's the code:
#!perl
$dir = "Greg:Test:"; # This directory contains simple files only.
opendir (DIR, $dir) || die "Can't open directory $dir";
while ($_ = readdir (DIR)) {
$file = $dir . $_;
next unless -f $file;
print "Opening $file";
open (OUT, $file) || print " <--Error! Can't open!!";
close (OUT);
print "\n";
}
closedir (DIR);
outputs this:
Opening Greg:Test:<foo
Opening Greg:Test:<HP Drivers
Opening Greg:Test:<PC supprot- carto user pe
Opening Greg:Test:<Peterson Holiday Schedule
Opening Greg:Test:<RE>>>Jim Miller's access
Opening Greg:Test:<RE>>FWD>Green Team Qtrly m
Opening Greg:Test:<RE>>pcdir/jobs 100% <--Error! Can't open!!
Opening Greg:Test:<RE>FWD>Green Team Qtrly mt
Opening Greg:Test:<RE>Jim Miller's access
Opening Greg:Test:<RE>pcdir/jobs 100% <--Error! Can't open!!
Opening Greg:Test:<RE>QuickMail problems <--Error! Can't open!!
Opening Greg:Test:=RE>>FWD>Green Team Qtrly m
Opening Greg:Test:BCAD access
Opening Greg:Test:BCALSTART Tour
Opening Greg:Test:BFWD>Green Team Qtrly mtg. &
Opening Greg:Test:BRE>>CAD access
Opening Greg:Test:BRE>pcdir/jobs 100% <--Error! Can't open!!
Opening Greg:Test:MACDOWED
Three of the files have "/" in them, which I could understand as a problem
(even though macs use ":".) But why would "<RE>Quickmail problems" mess up?
There's nothing weird in it.
Anyone know how to work around this? I need to be able to open/read those
files.
-Bob
------------------------------
Date: Thu, 25 Jun 1998 13:56:43 -0700
From: josri <josri@postoffice.pacbell.net>
Subject: msqlperl and windows 95
Message-Id: <3592B98A.81E920A1@postoffice.pacbell.net>
Hi
I believe as of now, nobody has ported the msqlperl module for windows
95. Eventhough I am not familiar with makefile etc.... I just wanted to
give a try. So I tried with cygnus win32. As per the readme file there
are four steps to install msqlperl
1) perl Makefile.PL
2) make
3) make test
4) make install
The first step goes well for me. But when I try "make" I get the
following error:
"make: rem: Command not found". I tried going through the makefile and
found a line as "NOOP = rem" What does this line mean? Any idea? Can
somebody help me? Or anybody has success story of msqlperl on windows
95?
Thanks for any help
Regards
Josri
------------------------------
Date: Thu, 25 Jun 1998 20:23:16 GMT
From: tom@netoutfit.com (Tom O'Neil)
Subject: Mysterious error with Perl DBM
Message-Id: <3592b0cf.260739343@news.keyway.net>
I'm receiving an error while trying to update a Perl DBM I've created.
When I try to update one of the entries, I get the following error:
ndbm store returned -1, errno 28, key "ROOTS" at ./test.pl line 8.
However, if I shorten the length of the value I'm trying to insert by
a few characters (ie. if $temp is 10 characters shorter), it works
flawlessly. My code is as follows:
#!/usr/local/bin/perl
dbmopen(%MESSAGES, "messages", 0777);
$temp =
"875301413|876462624|876788942|877443038|877715997|877976239|877
989975|878074335|878162827|878582009|878679163|878680337|878926986|879184180|879
284817|879365289|879379090|879742157|879786812|879794871|879946335|880053478|880
144739|880145411|880577746|881092380|881100174|881941224|881946356|881947615|881
965551|882391125|882564267|882828766|882914067|882916042|882979679|883581104|883
587259|883772033|884117056|884194446|884834509|884888425|884954776|885614429|885
933100|885937346|886119668|886198915|886621723|886622012|886710216|887131050|887
139731|887151165|887151895|887737979|887758683|887761782|887835577|888268905|888
512519|888769820|889030840|889136031|889243409|889575046|889657648|889833369|889
990210|890153489|890331366|890756584|890839923|890841694|890871957|890872738|891
362400|891471085|891628810|892489811|892644722|892819923|893092270|893349892|893
718083|893804439|894045044|894068505|894285953|894312355|894318736|894380974|894
639212|894652724|894838809|895149681|897341747|898263700|898265779|898800325";
$MESSAGES{'ROOTS'} = $temp;
dbmclose (%MESSAGES);
Any help would be greatly appreciated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom O'Neil
tom@netoutfit.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PS. Hi Josh.
------------------------------
Date: Thu, 25 Jun 1998 20:13:36 GMT
From: Grehom@my-dejanews.com
Subject: Re: NEwbie question: how do I find string length?
Message-Id: <6mub1g$3nu$1@nnrp1.dejanews.com>
In article <35910C27.E7315623@oculus.lvl.pri.bms.com>,
> I was wondering if there is any builtin function in Perl for returning
> the length of a string. If not, what's the most efficient way to do
> this?
>
I'm fairly new to Perl but you could try 'length' as in: length EXPR This
function returns the length in bytes of the scalar value EXPR. If EXPR is
omitted it reurns the length of $_
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 25 Jun 1998 13:54:54 -0700
From: josri <josri@postoffice.pacbell.net>
Subject: perl on windows 95
Message-Id: <3592B91D.EBAD149F@postoffice.pacbell.net>
Hi
I have a web page with geocities and I want to post my Dynamic ip
address to that page as and when I log on to internet. I want this to do
with perl on windows 95. Now, how can I fetch a file, make changes and
again post the file? Is there somebody to help me out?
Thanks in advance for any help.
Regards
Josri
------------------------------
Date: Thu, 25 Jun 1998 20:39:05 GMT
From: rpero@boone.net (Ron Pero)
Subject: Re: Questions I'd like answered (was: Re: Flames....)
Message-Id: <3592b4f3.20963864@news.boone.net>
On Wed, 24 Jun 1998 21:57:16 GMT, Tom Phoenix <rootbeer@teleport.com>
wrote:
>
>But, among perl-related questions, probably my most pressing is this one.
>
> "Are there parts of the Perl documentation which,
> although their meaning is completely clear
> to me, are unclear to other people who
> nevertheless have the requisite technical
> knowledge; and can those parts be made
> clear to everyone somehow?"
>
>Of course, it's never seemed to me that simply asking that question
>would be of much practical utility. Cheers!
>
O contraire! Very practical. I come across such things often. If there
was a (receptive) place to send such suggestions for improvement, I
would do it.
------------------------------
Date: 25 Jun 1998 21:07:09 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: regex error
Message-Id: <eli$9806251653@qz.little-neck.ny.us>
In comp.lang.perl.misc, David D Winfield <dwinfield@arrissys.com> wrote:
> I am expecting the string, up to and including, the second ';'
> (semicolon). I forgot to mention that this is running on perl version
> 5.004_01 on Sun Unix System V. Now for the kicker. I have an answer.
> $Msg =~ /^(.+\/\;)/; does what i need it to do...
>
> If you have another one I'd appreciate it. Since, after all 'there's
> more than one way to do it!' (can I say that?)
Yours will get up to and including the last '/;'. When there is exactly
one of those in $Msg, this will be fine. In other cases however...
$Msg =~ m{ # begin m// using {} as delimiters
^ # anchor to start
( # begin capturing to $1
[^;]+ # non-empty text without semicolons
; # the first semicolon
[^;]+ # non-empty text without semicolons
; # the second semicolon
) # end capture of $1
}x; # end match; /x for extended format
This will span multiple lines if it can/needs to (yours would not, I
don't know if that is a feature). This will grab all of the text up
to the second semicolon exactly. It will not match if there is only
one semicolon; it does not require that the second semicolon be
preceeded by a slash. It requires that there be something before the
first semicolon and between the first and second semicolons.
Elijah
------
likes REs
------------------------------
Date: 25 Jun 1998 20:29:10 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Regexp/Email header problem
Message-Id: <6mubum$hfn$3@info.uah.edu>
In article <1db6nig.1720fkm1ut56a2N@roxboro0-061.dyn.interpath.net>,
phenix@interpath.com (John Moreno) writes:
: You have several problems - first the headers don't necessarily start
: with From (in fact they almost always start with Received, but that's
: neither here nor there) and secondly you're above regex is looking for
: "From " instead of "From: ".
You're confused. A line like
From gbacon@cs.uah.edu Thu Feb 5 13:31:24 1998
is known as the envelope. Your MTA usually puts it there (from the
contents of the MAIL From SMTP command). Many mail readers look for the
envelope as a message introducer (i.e. they rely on its presence). This
is why you'll often see lines that begin with "From " escaped by
prepending a >. (Some mail readers solve this problem with the
Content-Length: header).
Plain old From: is the familiar From: header that people like to muck
with. :-(
This hasn't much to do with Perl, though.
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Thu, 25 Jun 1998 21:06 +0100 (BST)
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Sending mail through another server?
Message-Id: <memo.19980625210625.55521A@skep.compulink.co.uk.cix.co.uk>
In article <35927eb9.218953939@news.charm.net>,
fordprefect@nospam.bigfooot.com (Ford Prefect) wrote:
> Hey gang,
>
> I was wondering if someone could point me in the right
> direction. I'm looking to send e-mail via a perl script through our
> SMTP server here. The box that will be running the script is an NT
> box and does not have a mail package in it. The only examples I've
> seen are ones that have sendmail already on the box. I did a scan on
> this group and through 3 different perl books ( don't know if they're
> that good ) and I haven't seen anything that might kick me off in the
> right direction. Any ideas?
>
Yup. Send me email and by return I'll send you smtp.zip which contains
the smtp.pl you need to do anything, a brief tutorial on how to use it,
and even something called linemail, which you can use in place of
/usr/lib/sendmail -t - should you so have a mind.
Note that smtp.pl was hacked from the far better Net::SMTP module. If you
can get away with the standard perl distribution on your box, use that.
If you are forced to use Activestate Perl (if your webserver is IIS), then
send me your mail.
Regards
Neil
------------------------------
Date: 25 Jun 1998 20:44:31 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Sending mail through another server?
Message-Id: <6mucrf$hfn$4@info.uah.edu>
In article <35927eb9.218953939@news.charm.net>,
fordprefect@nospam.bigfooot.com (Ford Prefect) writes:
: I'm looking to send e-mail via a perl script through our
: SMTP server here. The box that will be running the script is an NT
: box and does not have a mail package in it.
Take a look at Net::SMTP, which comes with Graham Barr's libnet
distribution:
<URL:http://www.perl.com/CPAN/modules/by-module/Net/>
Keep in mind that you might be unhappy if you try to connect to the SMTP
server and fail. That leaves you with three options:
1) use Net::SMTP and pray for success,
2) use Net::SMTP and reinvent the wheel, or
3) get a Linux box and let sendmail or qmail handle your mail
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Thu, 25 Jun 1998 21:07:35 GMT
From: sabhay@my-dejanews.com
Subject: socket programming in perl ?
Message-Id: <6mue6n$7nk$1@nnrp1.dejanews.com>
I am trying to write a clinet/server perl program through tcp. The client
opens a scocket, sends a command name to server, server executes the command
and returns back the out of the command to the client.
My program is dispalying the command out put on server screen but does not
return back on the client screen.
Here is the part of code which I tried
server:
----------------------
--
$myaddr = pack($sockaddr_format, AF_INET, $port, "\0\0\0\0"); bind(S,$myaddr)
|| die "Error binding socket:$!"; for (;;) { accept(NS,S) || die "Error
accepting connection:$!"; $fromaddr = getpeername(NS); ($family, $fromport,
$fromipaddr) = unpack($sockaddr_format,$fromaddr); ($fromhost) =
gethostbyaddr($fromipaddr,AF_INET); select(NS); $| = 1; select(STDOUT);
while (<NS>) { @a = $_ ; print "command = @a\n"; print "excuting command
$a[0]\n"; @OUT = system("$a[0]"); #print "@OUT"; print NS "@OUT";
}
# Print EOF
print "EOF\n";
close(NS);
}
------------------------------
Clent side ....
--------------------
------
# Connect to remote host
$toaddr = pack($sockaddr_format,$addrtype,$port,$ipaddr);
connect(S,$toaddr) ||
die "Could not connect to remote host:$!";
select(S); $| = 1; select(STDOUT);
$a = "ls /";
print S $a;
print $_;
while(<S>)
{
print $_;
}
close(S);
---------------------
Here I was trying to send "ls / " as command to server and was expecting the
server side "ls / " output on client screen. Instead I was geeting out put of
"ls /" displayed on server screen. Any idea hoe it can be done ?
Thanks in advance to all
Abhay
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 25 Jun 1998 16:24:06 -0400
From: Mark Lehrer <mark@satch.markl.com>
Subject: TCL string trimright/trimleft equivalent
Message-Id: <m3wwa51b89.fsf@satch.markl.com>
Hello! I am looking for an easy way to duplicate the tcl string
trimright and string trimleft commands which remove trailing and
leading whitespace.
Can someone give me a quick hint? The documents I found don't
give any clues.
Thanks!
Mark
------------------------------
Date: 25 Jun 1998 16:24:20 -0400
From: Mark Lehrer <mark@satch.markl.com>
Subject: TCL string trimright/trimleft equivalent
Message-Id: <m3vhpp1b7v.fsf@satch.markl.com>
Hello! I am looking for an easy way to duplicate the tcl string
trimright and string trimleft commands which remove trailing and
leading whitespace.
Can someone give me a quick hint? The documents I found don't
give any clues.
Thanks!
Mark (mark at lehrer dot nlcomm dot com)
------------------------------
Date: 25 Jun 1998 20:37:15 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: TCL string trimright/trimleft equivalent
Message-Id: <6mucdr$4g6$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Mark Lehrer <mark@satch.markl.com> writes:
:
:Hello! I am looking for an easy way to duplicate the tcl string
:trimright and string trimleft commands which remove trailing and
:leading whitespace.
:
:Can someone give me a quick hint? The documents I found don't
:give any clues.
Well, perlfaq4 has
How do I strip blank space from the beginning/end of a string?
That sure looks like what you want.
--tom
--
"Even egotists are allowed to have opinions." --Larry Wall
------------------------------
Date: Thu, 25 Jun 1998 21:04:44 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: TCL string trimright/trimleft equivalent
Message-Id: <MXyk1.56$u05.634898@news3.voicenet.com>
Mark Lehrer <mark@satch.markl.com> wrote:
>
>Hello! I am looking for an easy way to duplicate the tcl string
>trimright and string trimleft commands which remove trailing and
>leading whitespace.
>
>Can someone give me a quick hint? The documents I found don't
>give any clues.
perldoc perlfaq4
Look for: How do I strip blank space from the beginning/end of a string?
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: 25 Jun 1998 20:41:56 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Testing perl knowledge
Message-Id: <6mucmk$ctr$1@news.NERO.NET>
In article <Ev2vv0.4C9@news.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <6mps7g$l52$1@news.NERO.NET>,
>John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>>You should be careful with this. Many states assign special legal status
>>to the title "engineer".
>
>Judge: You are charged with impersonating an engineer. What
> say you ?
>
>CPE: Perl stands for "Pathologically Ecletic Rubbish
> Lister" and its motto is "There's More Than One
> Way To Do It". 'Engineer' is a bit of, um, license
> than one can scarcely fault, your Honor.
>
>Judge: Dismissed... but don't be seen hanging out with
> Randal.
No, more like:
Judge: Well, yes, we can fault it because in this state the term
"engineer" is reserved for those who have credentials from
recognized authorities. Sorry, but Chris Nandor isn't recognized.
You will be hanging out with Randal in a few months...
I didn't say it was bright, or right, or use any positive terminology
when referring to it. It just is. And even if it gets to the point where
a judge just says "dismissed", you've already lost time and money.
------------------------------
Date: 25 Jun 1998 21:20:13 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Testing perl knowledge
Message-Id: <eli$9806251708@qz.little-neck.ny.us>
In comp.lang.perl.misc, John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
> Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
> >John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
> >>You should be careful with this. Many states assign special legal status
> >>to the title "engineer".
> >
> >Judge: You are charged with impersonating an engineer. What
> > say you ?
> >
> >CPE: Perl stands for "Pathologically Ecletic Rubbish
> > Lister" and its motto is "There's More Than One
> > Way To Do It". 'Engineer' is a bit of, um, license
> > than one can scarcely fault, your Honor.
> >
> >Judge: Dismissed... but don't be seen hanging out with
> > Randal.
>
> No, more like:
>
> Judge: Well, yes, we can fault it because in this state the term
> "engineer" is reserved for those who have credentials from
> recognized authorities. Sorry, but Chris Nandor isn't recognized.
> You will be hanging out with Randal in a few months...
Since when can a state "reserve" a word? Since when is Chris Nandor not
recognized? I have a Master's Degree in Science. I photocopied it out
of my _Ask Dr. Science_ book. It is every bit as legitimate. If I were
to claim that I was "state certified" or that my Master's is from an
accredited institution, and do so in a fraudulant manner, then maybe
there would be a case. It is well within my rights to state (after
being certified whatever by Chris) that I am a Chris Nandor Certified
Whatever.
Elijah
------
willing to offer certifications in troublemaking
------------------------------
Date: 25 Jun 1998 20:29:08 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: The return status from system()?
Message-Id: <6mubuk$4g6$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Martin Gregory <mgregory@asc.sps.mot.com> writes:
:I think (hope) that the perl gurus are examining this, and there may
:be a better answer, but for now this is my experience, for what its worth.
We are. I thought we'd come to the conclusion that the
intervention of the shell confused matters. I know that
there was a bug in the Camel. But is the new stuff in the
superlatest version of the doc on system really still wrong
if there are no intervening shells?
--tom
--
Even if you aren't in doubt, consider the mental welfare of the person who
has to maintain the code after you, and who will probably put parens in
the wrong place. --Larry Wall in the perl man page
------------------------------
Date: Thu, 25 Jun 1998 15:21:55 -0500
From: Justin <jperkins@mail.wtamu.edu>
Subject: Use socket question
Message-Id: <3592B163.CEBD4D6A@mail.wtamu.edu>
Exactly what is included when in a script you put:
use Socket;
Is there a way to not use it and still make socket operations?
Justin Perkins
------------------------------
Date: Thu, 25 Jun 1998 15:03:13 -0500
From: "Michael D. Kersey" <mdkersey@hal-pc.org>
Subject: Re: What a Crappy World (oh, yes!)
Message-Id: <3592AD01.CC9104B0@hal-pc.org>
Thank you one and all for your contributions to this pessimistically-named but
incredibly optimistic (series of) thread(s)! You have reassured me of the
resilience of the human spirit, the search for excellence and the generation of
ideas that differences of opinion lead to. And, of course, I'm dying laughing!
"Arguing over differences of opinion is like mud-wrestling with a pig: the pig
enjoys it and, after awhile, you both start to look the same."
- Breck Carter told me something like this.
------------------------------
Date: Thu, 25 Jun 1998 20:44:46 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: What a Crappy World
Message-Id: <3592adb4.7559986@news.btinternet.com>
On Wed, 24 Jun 1998 09:44:11 -0500, Olga wrote :
>You know,
>I was just browsing this newsgroup and I noticed something that I would
>like to share with you all. Why is it that once a person becomes
>knowledgeable in a subject they have to make everyone else around them
>feel like shit.
<snip>
I think under the circumstances we might take a little advice from
this following post - perhaps such a device might take some of the
personal out of all of this ;-}
From: "Homer Simpson" <mmmm_donuts@hotmail.com>
Date: Fri, 28 Nov 97 09:47:28 -0800
Subject: Re: Complaint
Message-ID: <forumsweb880739248_mmmm_donuts@hotmail.com>
Organization: FORUMS.WEB Public Groupware Service
References: <347C485E.6F86@mb.sympatico.ca>
Newsgroups: comp.lang.c
Programming <sysdev@mb.sympatico.ca> wrote:
>
> I have a complaint.
>
Dear:
[X] Loser [ ] Lamer [ ] AOLer
[ ] Me-too-er [ ] Pervert [ ] Geek
[ ] Spammer [ ] Nerd [ ] Martyr
[ ] Fed [ ] Freak [ ] Scientologist
[ ] Socialist [ ] Stain [ ] anonymous
You Are Being Flamed Because:
[ ] Your lame advertising message has firmly convinced me to ignore
you
[ ] You posted a "test" in a newsgroup other than alt.test
[ ] You posted an "everyone is against me/my race/my religion/my
country" message
[ ] You posted something asking for warez sites
[ ] You quoted an ENTIRE post in your reply
[ ] You continued a long, stupid thread
[ ] You started an off-topic thread
[X] You posted a "YOU ALL SUCK" message
[ ] You said "me too" to something
[ ] You suck
[ ] You brag about things that never happened
[ ] Your sig/alias/server sucks
[ ] You made up slang then used it in a message
[ ] You posted a phone-sex ad
[ ] You posted to more than four newsgroups
[ ] You were imposing your religious beliefs on others
[X] You posted something really stupid/depraved
[X] You tried to blame others for your stupidity
[ ] You incorrectly assumed unwarranted moral or intellectual
superiority
[ ] You are posting an anonymous attack
To Repent, You Must:
[ ] Give up your AOL account
[ ] Give up your CIS account
[X] Bust up your modem with a hammer and eat it
[ ] Jump into a bathtub while holding your monitor
[ ] Actually post something relevant
[ ] Read the FAQ
[ ] Be the guest of honor in alt.flame for a month
[ ] Post your tests to alt.test
[ ] Print your home phone number in your adverts
[ ] Slam your fingers in a desk drawer repeatedly
[ ] Verify the effect of gravity by jumping from the nearest bridge
In Closing, I'd Like to Say:
[X] Get a life
[ ] Never post again
[X] I pity your dog
[ ] Remove yourself from our presence
[ ] Take your crap somewhere else
[ ] Learn to post or sod off
[ ] Do us all a favor and crawl into some industrial machinery
[ ] See how far your tongue will fit into the electric outlet
[X] Get a clue
[ ] All of the above
Actually I would check out the whole thread: it might be instructive
if not a little funny in parts (there is a complaint form as well
which I will mail if nobody can find it on DejaNews)
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2984
**************************************