[9571] in Perl-Users-Digest
Perl-Users Digest, Issue: 3165 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 15 14:11:36 1998
Date: Wed, 15 Jul 98 11:00:40 -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 Wed, 15 Jul 1998 Volume: 8 Number: 3165
Today's topics:
Re: "reset" does not work ?! (M.J.T. Guy)
'use diagnostics' with Win32-perl <spettay@lgc.com>
***Can no one answer this question????*** <bth@cs.buffalo.edu>
Anybody got a function to backup file? <winter@nevis1.nevis.columbia.edu>
Character Translate Tables marcus_w@my-dejanews.com
client/server help (Joseph M Carlton)
Re: Custom Programming Job (Eric Harley)
Re: Dynamic HTML document in new browser window? (brian d foy)
Re: Editing files tim221175@my-dejanews.com
Re: Extracting URLs from a file (brian d foy)
Re: Guidance.. (Eric Harley)
How can I be sure that an ISP understands their configu <nospam@nospam.com>
Re: How can I be sure that an ISP understands their con (Steve Linberg)
Re: newbie question on pattern match (Larry Rosler)
Re: Perl Beautifier Home Page <jdporter@min.net>
Re: perl IDE and compiler <Gregory.Rebuck@digital.com>
Re: Perl Setup on NT <tdean@gte.net>
Re: Perl Setup on NT (Steve Linberg)
Re: Perl zipping files?? <perlguy@inlink.com>
Re: Q: Changing IP address via perl <gratz@ite.inf.tu-dresden.de>
Re: RegExps: Check if string consists of EXACTLY 3 digi (Eric Harley)
Re: SMB and Timestamps (Larry Rosler)
Re: Sticking in NULL after split(II) merzky@physik.hu-berlin.de
Re: The three properties of programmers <devnull@interlog.com>
Re: The three properties of programmers <jdporter@min.net>
The visibility of @_... <cmason@transarc.com>
use strict <gil_brown@hp.com>
Re: use strict (Steve Linberg)
Re: Where is perldoc? (Scott Erickson)
Re: y2k (Scott Erickson)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Jul 1998 17:44:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "reset" does not work ?!
Message-Id: <6oippn$he4$1@pegasus.csx.cam.ac.uk>
Yakov Yukhnovetsky <jak@tx1.elex.co.il> wrote:
>I perform several sequential pattern searches, OK.
>.
>$_ = "1111 fffffff 7777777777 jjjjjjjjjjjj";
>
># the first search:
>/(\d+)\s+(\w+)\s+(.+)/;
>print "$1\n$2\n$3\n\n";
>
># the second one:
>/(\d+)\s+(RRR)(\w+)\s+(.+)/;
>print "$1\n$2\n$3\n";
>
>Obviously, the second search will fail, but $1, $2 and $3 are still exist from
>the first search.
You seem to have some confused program logic.
If a match has failed, you shouldn't be looking at $1 etc.
If you want to check if a match has succeeded, look at the result of
the match, not the values of $1 etc.
Note that $1 etc can be undefined even though a match succeeded, e.g.
after matching /(a)|(b)/ one of $1, $2 will be undef.
Mike Guy
------------------------------
Date: Wed, 15 Jul 1998 12:30:43 -0500
From: "Steve Pettay" <spettay@lgc.com>
Subject: 'use diagnostics' with Win32-perl
Message-Id: <6oioql$2va$1@dildog.lgc.com>
What's the secret to using "use diagnostics" under Win32-perl?
I get the error:
couldn't find diagnostic data in /pod/perldiag.pod
C:\PERL\lib\i386-win32 C:\PERL\lib . test.pl at
C:\PERL\lib/Diagnostics.pm line 225, <POD_DIAG> chunk 507.
BEGIN failed--compilation aborted at test.pl line 3, <POD_DIAG>
chunk 507.
The string "C:\PERL\lib\i386-win32 C:\PERL\lib ." represents my @INC
array.
I gathered that the problem is that I didn't have the perldiag.pod file,
I had the binary installation so I went and retrieved the perl source
and manually placed all pod files in the existing pod directory:
C:\Perl\lib\Pod\ with no luck.
Do I have to build the perl binary from the source to get this
to work or some other trick?
Anyone?
===================================================================
Steve Pettay (spettay@lgc.com)
Landmark Graphics Corporation
Drilling & Well Services Products Group
6660 S. Sheridan Suite 205
Tulsa, OK 74133
(918) 523-9550
(918) 523-9556 fax
===================================================================
------------------------------
Date: Wed, 15 Jul 1998 13:22:47 -0400
From: Bryan T Hoch <bth@cs.buffalo.edu>
Subject: ***Can no one answer this question????***
Message-Id: <Pine.GSO.3.96.980715132052.38B-100000@armstrong.cs.Buffalo.EDU>
This posting was previously called:
Re: Placing output from System() call into an array from the file that calls it?
and I've posted the question about 3 times in the last month and half.
Can someone who knows the answer PLEASE let me know? Thanks!
On Thu, 9 Jul 1998, Bryan T Hoch wrote:
>
> In one of my Perl programs, I have a line that calls a system call to see
> who is on line.
>
> if ((system ("rusers -l $hostA | fgrep $personA")) == 0){
> }
>
> Basically it will check to see if $personA is on $hostA and if so, it will
> place it in an array (somewhere in the if statement). At least that's what
> I want it to do.
> Right now, what it does is just spit out every single user on $hostA to
> the screen (it doesn't take into account it's only looking for $personA.
> How do I make it so it doesn't print it to the screen (rather to an array
> or string in the program) and how do I do it so it only checks for
> $personA, and not everyone on that host?
> Thanks a lot to anyone who tries to help.
> Bryan H
>
>
>
------------------------------
Date: Wed, 15 Jul 1998 13:34:12 -0400
From: Dave Winter <winter@nevis1.nevis.columbia.edu>
Subject: Anybody got a function to backup file?
Message-Id: <35ACE813.F712C490@nevis1.nevis.columbia.edu>
Hi --
I was wondering if anyone out there has written, and is willing to
share, a function which can detect if a file exists, and if so, rename
it with a version number, similar to the way emacs can (if you configure
it to do so) or similar to the result of the logrotate program (commonly
found on linux systems).
This is a fairly simple task, but would rather not do it myself because
a) i don't want to reinvent the wheel, and b) no matter what I write, I
am pretty comfident someone else out there will have done a better job
at it :-).
Anyway, any pointers would be appreciated.
Dave Winter
------------------------------
Date: Wed, 15 Jul 1998 17:17:28 GMT
From: marcus_w@my-dejanews.com
Subject: Character Translate Tables
Message-Id: <6oio79$4g9$1@nnrp1.dejanews.com>
Where ca I find some complete character
translation tables for converting between
CodePages 850,437 - ISO 8859-x - HTML entities ?
Thanx in advance
Marcus
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 15 Jul 1998 17:39:58 GMT
From: carltjm@mail.auburn.edu (Joseph M Carlton)
Subject: client/server help
Message-Id: <6oiphe$1m5$1@ultranews.duc.auburn.edu>
I'm working with the client and server examples on pages 349-354 of
Programming Perl. I can't get them to run without errors. I know that I
need to change stuff, but it is not real clear what I need to change to
get it to work on my system. For example, I get an error on the line
$rendezvous = shift || '/tmp/catsock'; because /tmp/catsock does not exist.
What is this file? What should be in it? I'm also getting the following
errors on my server:
Global symbol "paddr" requires explicit package name at server2.perl line 27.
Global symbol "waitedpid" requires explicit package name at server2.perl
line 43.
Variable "$waitedpid" is not imported at server2.perl line 45.
Global symbol "waitedpid" requires explicit package name at server2.perl
line 45.
Any help would be appreciated. So far, no one has responded to my
posts, so please tell me if I'm breaking some sort of etiquete.
--
Joey Carlton
Senior, Computer Engineering
Auburn University
carltjm@mail.auburn.edu
------------------------------
Date: Wed, 15 Jul 1998 10:25:19 -0700
From: eharley@pacbell.net (Eric Harley)
Subject: Re: Custom Programming Job
Message-Id: <eharley-1507981025190001@ppp-207-214-149-59.snrf01.pacbell.net>
Sounds like a piece of cake. Is the job still open? You can reach me at
eharley@pacbell.net or 415-499-8072
> Hi,
>
> I need to have a CGI program written that will read a text file of URL's and
> submit them to various search engines automatically.
>
> We already use one that will submit to all of the major search engines
> automatically, but it requires manually typing in the URL for each page that
> we're submitting. The idea would be to either create a new program, or
> modify this existing program so that it can read a text file and do this
> without someone having to sit at the keyboard and type all day.
>
> If there's someone out there that can do this for us, please email me at:
> selipson@computercoach.com, or call me at my office number below to discuss
> rates, etc...
>
> Thanks
>
> Steve
>
> Steven E. Lipson
> President
> Computer Coach, Inc.
> http://www.computercoach.com
> Voice: (561) 483-0140
> Fax: (561) 483-7773
--
Eric Harley
Freelance Programmer
You need it done, I'm your man.
eharley@pacbell.net
http://burn.victim.com/~eharley
------------------------------
Date: Wed, 15 Jul 1998 13:35:26 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Dynamic HTML document in new browser window?
Message-Id: <comdog-ya02408000R1507981335260001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35abe959.57970461@nntp.idsonline.com>, root.noharvest.\@not_even\here.com posted:
>Sabine Cremer <sabine@ikt.de> Said this:
>
>>I wrote a simple perl application to get an answer from a database.
>>Because it is called from a frame too small for the output, I want to
>>put the dynamically generated data into a new browser window. How to do
>>it??
>
>Just like you would with any other document you want to open in a
>different window or frame.
>
>You are confusing yourself by trying to figure out how to get the CGI
>script to force itself somewhere - It cannot.
and the Window-target header proves it!
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>
------------------------------
Date: Wed, 15 Jul 1998 17:27:12 GMT
From: tim221175@my-dejanews.com
Subject: Re: Editing files
Message-Id: <6oiopg$5e5$1@nnrp1.dejanews.com>
In article <6oicsb$hbr$1@nnrp1.dejanews.com>,
merzky@physik.hu-berlin.de wrote:
> In article <6oi70h$8u9$1@nnrp1.dejanews.com>,
> tim221175@my-dejanews.com wrote:
> > Is there an easy way of editing a file. I want to append a line of text in
> > the middle of a text file. Will I have to cut the file in two halves and
then
> > concatenate them with new line in the middle or is there an easy way to do
> > this in perl?
> >
> > -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> > http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
> >
>
> something like this could do the job:
>
> #!/usr/bin/perl -w
>
> use strict;
>
> my ($linenumber) = 12; # the line to be edited
> my ($infile) = "halli.in";
> my ($outfile) = "hallo.out";
> my (@contents);
>
> open (IN, "<$infile") || die "no infile? : $!\n";
> open (OUT, ">$outfile") || die "no permissions? : $!\n";
>
> @contents = <IN>; # now we have a field of lines...
> close (IN);
>
> # edit line 12: replace all hallo's by ballo's:
> $contents[$linenumber] =~ s/hallo/ballo/;
>
> # append a line to line 12:
> $contents[$linenumber] .= "new line iserted here...\n";
>
> # print to outfile:
> printf (OUT @contents);
> close (OUT);
>
> thats it I think..:-)
> If you wonna edit any line having a certain pattern (the usual case),
> try:
>
> # fo all lines
> foreach $line (@contents) {
>
> # thi one?
> if ($line =~ /pattern/) {
>
> # do the stuff...
> $line .= "new line inserted...\n";
> }
>
> # done...
>
> HtH, Andre.
> --
> Andre Merzky
> pinocchio@earthling.net
> http://pino.home.pages.de/
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
Thanks very much it works perfectly.
Is there an easy way to delete lines from a text file as well ?
Many Thanks
Tim
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 15 Jul 1998 13:54:14 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Extracting URLs from a file
Message-Id: <comdog-ya02408000R1507981354140001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35ad2a91.2524514@news.earthlink.net>, jsaya@iname.com (John) posted:
>Anyone know of a simple method (using Perl), to extract all URLs and
>and anything that links to graphics and other sites from a text file?
NAME
HTML::LinkExtor - Extract links from an HTML document
SYNOPSIS
require HTML::LinkExtor;
$p = HTML::LinkExtor->new(\&cb, "http://www.sn.no/");
sub cb {
my($tag, %links) = @_;
print "$tag @{[%links]}\n";
}
$p->parse_file("index.html");
....
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>
------------------------------
Date: Wed, 15 Jul 1998 10:17:47 -0700
From: eharley@pacbell.net (Eric Harley)
Subject: Re: Guidance..
Message-Id: <eharley-1507981017480001@ppp-207-214-149-59.snrf01.pacbell.net>
> The script is an online entry editor.. With it, you can view entries
> (which simply displays the text file), or add entries (each entry is
> just a line of text). However, I am wanting to implement a delete
> feature. This is not as easy as I had hoped it would be, though. I
> figured the best layout to do this would be to put a checkbox next to
> each entry (each line). To delete an entry, you would simply check the
> checkbox next to the corresponing entry. You would then submit,
> confirm (I'm clear on how to do the confirming part), and it would
> delete the appropriate line from the text file.
Here is a script that I wrote for a client that handles features similar
to yours. The file uses two sharps (##) to separate fields. When a request
is received, only one ID is passed along so it doesn't do exactly what you
want. However, adding processing for multiple IDs is trivial.
Original Script:
#!/usr/local/bin/perl
use CGI;
$query = new CGI;
$data_file = "af_data.txt";
$journal_file = "af_journal.txt";
$LOCK_UN = 8;
$LOCK_EX = 2;
print $query->header();
$id_num = $query->param('id');
$who = $query->param('who');
$comments = $query->param('comments');
@date_fields = localtime(time);
$date = "$date_fields[3]/$date_fields[4]/$date_fields[5]";
open DATA,"<$data_file";
open JOURNAL,">>$journal_file";
lock_DATA();
lock_JOURNAL();
while(<DATA>) {
/(^[0-9]+)##/;
if( $1 == $id_num ) {
print JOURNAL "$date##$who##$comments##$_";
} else {
print DATA;
}
}
unlock_DATA();
unlock_JOURNAL();
sub lock_DATA {
flock DATA,$LOCK_EX;
#And in case someone appended
#while we were waiting...
seek DATA, 0, 2;
}
sub lock_JOURNAL {
flock JOURNAL,$LOCK_EX;
#And in case someone appended
#while we were waiting...
seek JOURNAL, 0, 2;
}
sub unlock_DATA {
flock DATA,$LOCK_UN;
}
sub unlock_JOURNAL {
flock JOURNAL,$LOCK_UN;
}
You will notice that this script prints out the deleted line to a journal
for archive purposes.
This script processes an array and preforms the exact same function as above:
#!/usr/local/bin/perl
use CGI;
$query = new CGI;
$data_file = "af_data.txt";
$journal_file = "af_journal.txt";
$LOCK_UN = 8;
$LOCK_EX = 2;
print $query->header();
$who = $query->param('who');
$comments = $query->param('comments');
@date_fields = localtime(time);
$date = "$date_fields[3]/$date_fields[4]/$date_fields[5]";
foreach $id_num(@ids) {
open DATA,"<$data_file";
open JOURNAL,">>$journal_file";
lock_DATA();
lock_JOURNAL();
while(<DATA>) {
/(^[0-9]+)##/;
if( $1 == $id_num ) {
print JOURNAL "$date##$who##$comments##$_";
} else {
print DATA;
}
}
unlock_DATA();
unlock_JOURNAL();
close DATA;
close JOURNAL;
}
sub lock_DATA {
flock DATA,$LOCK_EX;
#And in case someone appended
#while we were waiting...
seek DATA, 0, 2;
}
sub lock_JOURNAL {
flock JOURNAL,$LOCK_EX;
#And in case someone appended
#while we were waiting...
seek JOURNAL, 0, 2;
}
sub unlock_DATA {
flock DATA,$LOCK_UN;
}
sub unlock_JOURNAL {
flock JOURNAL,$LOCK_UN;
}
If you need further help with your script, just ask.
--
Eric Harley
Freelance Programmer
You need it done, I'm your man.
eharley@pacbell.net
http://burn.victim.com/~eharley
------------------------------
Date: Wed, 15 Jul 1998 12:32:18 -0700
From: Gary Peek <nospam@nospam.com>
Subject: How can I be sure that an ISP understands their configuration related to handling my scripts?
Message-Id: <35AD03C2.203@nospam.com>
My apologies if this is not an apropriate place to post this inquiry.
I am having problems with an ISP that does not seem to have anyone that
understands their server software's configuration well enough to tell me
why things do not work.
(To be specific I have a script that works when called from a URL, but
does not when used as a "execGCI" server side include.)
There are of course many configuration options when setting up server
software, but the support people at an ISP are not usually the
knowledgable ones. And when things don't work you seldom get error
messages. They just don't work.
Have any of you had similar experiences? Is it a matter of chosing an
ISP that is "full service" rather than one of the "discount" services?
Am I expecting too much from "discount" ISP's?
Another way to go about this is to ask if any of you know of "discount"
virtual domain hosting companies that know what they are doing or at
least have good support.
Gary Peek
peek@freefall.com
------------------------------
Date: Wed, 15 Jul 1998 13:52:29 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: How can I be sure that an ISP understands their configuration related to handling my scripts?
Message-Id: <linberg-1507981352290001@projdirc.literacy.upenn.edu>
In article <35AD03C2.203@nospam.com>, nospam@nospam.com wrote:
> My apologies if this is not an apropriate place to post this inquiry.
This is not an appropriate place to post this inquiry.
> I am having problems with an ISP that does not seem to have anyone that
> understands their server software's configuration well enough to tell me
> why things do not work.
This is a problem, indeed. Unfortunately, there is no law that ISPs have
a clue. All you can do is find one that does and vote with your dollars.
Your problem certainly has nothing to do with Perl, though. You know this
already.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Wed, 15 Jul 1998 10:39:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie question on pattern match
Message-Id: <MPG.1016893833e30ac2989716@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6oikfp$kqu$2@marina.cinenet.net> on 15 Jul 1998 16:13:45 GMT,
Craig Berry <cberry@cinenet.net> says...
> Abigail (abigail@fnx.com) wrote:
> : wings (xuchu@iscs.nus.edu.sg) wrote on MDCCLXXIX September MCMXCIII in
> : <URL: news:6oh5uk$eb13@id4.nus.edu.sg>:
> : ++ thx for all replies. i am clear now:) yes, my original thought was
> : ++ s/(\d)(\d\d\d)(\D)*/$1,$2/; and s/(\d)(\d\d\d)(\D)+/$1,$2/;
> : ++ but neither of them worked. i was confused at that time coz the output
> : ++ ate the trail of my original string.
> :
> : Note that all the proposed solutions, correct or not, suffer from
> : one thing: they are quadractic in the size of the number. Note a
> : problem if you numbers are below a million, but a potential one
> : if the numbers are huge.
>
> Note that N here is not the size of the number in the sense of its
> magnitude, but rather in the sense of its left-of-the-decimal digit
> count...which is roughly the base-10 logarithm of the (absolute value of
> the) number. I don't think even a quadratic algorithm is a problem for Ns
> in perhaps the low teens at most (which takes us up into the trillions).
Abigail hit it right on the head. The crossover on my system is one
million. As demonstrated:
#!/usr/local/bin/perl -w
use Benchmark;
timethese(1 << (shift || 0), {
Reverse => sub {
$_ = '1' x 7;
s((\d+))(local $_ = reverse $1;
s((\d\d\d)(?=\d))($1,)g; reverse)e;
},
While => sub {
$_ = '1' x 7;
1 while s/(\d)(\d\d\d)(?!\d)/$1,$2/;
},
});
Benchmark: timing 16384 iterations of Reverse, While...
Reverse: 15 secs ( 3.46 usr 0.03 sys = 3.49 cpu)
While: 17 secs ( 3.76 usr 0.02 sys = 3.78 cpu)
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 15 Jul 1998 17:38:56 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35ACEAD3.603@min.net>
Craig Berry wrote:
>
> In every multi-person software project I've ever worked on,
> an early decision has been made to use spaces *only* for indents.
My experience, too.
> Now, um, as to what this has to do with Perl, ah...tabify and detabify are
> really easy to write in Perl. Yeah, that's it. :-)
You laugh, but I say: nvi.
--
John Porter
We have enough youth, how about a fountain of smart?
------------------------------
Date: Wed, 15 Jul 1998 11:33:44 -0600
From: "Greg Rebuck" <Gregory.Rebuck@digital.com>
Subject: Re: perl IDE and compiler
Message-Id: <6oipkm$qqk$1@nntpd2.cxo.dec.com>
Okay, I just tried the Perl-to-C-to-binary procedure with a bonehead simple
Perl script and it worked fine (the executable came out to 850K!) Bothers
me still that the guy who wrote it seems to have lost interest and therefore
it just sits out there collecting dust.
If anyone knows what happened to Malcolm Beattie let us all know.
Greg.
------------------------------
Date: Wed, 15 Jul 1998 13:23:38 -0400
From: "tdean" <tdean@gte.net>
Subject: Re: Perl Setup on NT
Message-Id: <6oiop5$7cm$1@news-1.news.gte.net>
perlscript.pl is in c:\perl\bin
--
ICQ 7305805
replace at with @ and dot with .
Steve Linberg wrote in message ...
>In article <6ogu63$nje$1@news-2.news.gte.net>, "tdean" <tdeanatgtedotnet>
wrote:
>
>> I want to execute my perl scripts from within the Dos box on NT4SP3 from
C:\
>> I have added the following to the path environment variable:
>> C:\;C:\Perl\bin and rebooted the machine to take effect
>> when I then open a NT Dos box which defaults to c:\ and I try to execute
a
>> perl script:
>> perl perlscript.pl I get the following msg:
>> "can't open perl script perlscript.pl. No such file or directory"
>> guys, whats the fix for this?
>
>where is perlscript.pl?
>_____________________________________________________________________
>Steve Linberg National Center on Adult Literacy
>Systems Programmer &c. University of Pennsylvania
>linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Wed, 15 Jul 1998 13:44:11 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl Setup on NT
Message-Id: <linberg-1507981344110001@projdirc.literacy.upenn.edu>
In article <6oiop5$7cm$1@news-1.news.gte.net>, "tdean" <tdeanatgtedotnet> wrote:
So perl c:\perl\bin\perlscript.pl doesn't work?
> perlscript.pl is in c:\perl\bin
>
> --
> ICQ 7305805
> replace at with @ and dot with .
> Steve Linberg wrote in message ...
> >In article <6ogu63$nje$1@news-2.news.gte.net>, "tdean" <tdeanatgtedotnet>
> wrote:
> >
> >> I want to execute my perl scripts from within the Dos box on NT4SP3 from
> C:\
> >> I have added the following to the path environment variable:
> >> C:\;C:\Perl\bin and rebooted the machine to take effect
> >> when I then open a NT Dos box which defaults to c:\ and I try to execute
> a
> >> perl script:
> >> perl perlscript.pl I get the following msg:
> >> "can't open perl script perlscript.pl. No such file or directory"
> >> guys, whats the fix for this?
> >
> >where is perlscript.pl?
> >_____________________________________________________________________
> >Steve Linberg National Center on Adult Literacy
> >Systems Programmer &c. University of Pennsylvania
> >linberg@literacy.upenn.edu http://www.literacyonline.org
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Wed, 15 Jul 1998 16:43:03 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Perl zipping files??
Message-Id: <35ACDC17.711E03D2@inlink.com>
What OS are you on? I am guessing UNIX since you say that the server
does not recognize pkzip.exe.
Also, did you look at the module: Compress::Zlib in CPAN? It may do
just what you are looking to do...
HTH,
Brent
------------------------------
Date: 15 Jul 1998 19:34:13 +0200
From: Achim Gratz <gratz@ite.inf.tu-dresden.de>
Subject: Re: Q: Changing IP address via perl
Message-Id: <c3ec3nhm8.fsf@ite127.inf.tu-dresden.de>
Bullwinkle <at@whatsamattau.edu> writes:
> I routinely move my laptop between the ethernet at work and an ethernet
> at home. I've got the changes needed down to just changing the IP
> address and rebooting. However, it's still kludgey.
If you have to reboot to change the IP address, you must be on
Windows. I guess you can muck with the registry and probably convince
the IP stack of the new adress. The canonical solution however would
be to use DHCP. I don't know if it's possible to fool the machine
into providing it's own DHCP server on 127.0.0.x, but it's worth a
try.
[F'ups set to the non-Perl group]
Achim Gratz.
--+<[ It's the small pleasures that make life so miserable. ]>+--
WWW: http://www.inf.tu-dresden.de/~ag7/{english/}
E-Mail: gratz@ite.inf.tu-dresden.de
Phone: +49 351 463 - 8325
------------------------------
Date: Wed, 15 Jul 1998 10:30:20 -0700
From: eharley@pacbell.net (Eric Harley)
Subject: Re: RegExps: Check if string consists of EXACTLY 3 digits ??
Message-Id: <eharley-1507981030210001@ppp-207-214-149-59.snrf01.pacbell.net>
> I am writing a CGI script which accepts input via QUERY_STRING.
> However, the input is only valid if it consists of EXACTLY 3 DIGITS! No
> more , no less, no other characters in front, after or in between the
> digits. Ive tried things such as:
>
> if ($ENV{'QUERY_STRING'} =~ /[0-9]\{3\}/)
> {
> print "String is valid";
> }
> else
> {
> print "Invalid input";
> }
The winded path would be
if ( (length $q == 3) and ($q =~ /[0-9][0-9][0-9]/) ) {
print "Valid\n";
} else {
print "Invalid\n";
}
but this would suffice
if ($q =~ /^[0-9]{3}$/) {
print "Valid\n";
} else {
print "Invalid\n";
}
--
Eric Harley
Freelance Programmer
You need it done, I'm your man.
eharley@pacbell.net
http://burn.victim.com/~eharley
------------------------------
Date: Wed, 15 Jul 1998 10:13:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: SMB and Timestamps
Message-Id: <MPG.1016830065f5ec35989715@nntp.hpl.hp.com>
In article <6oil31$aph$1@nntp.msstate.edu> on 15 Jul 1998 16:24:01 GMT,
Brent Johnson <brentj@ext.msstate.edu> says...
> I am trying to write a Perl script which scans through a common
> public directory and moves any files older than a certain date
> to another directory. Problem is, when someone saves a file to
> a mounted SMB filesystem, it keeps the original file date.
>
> Is there a way to 'touch' files when they are copied? Or some
> other way? I've looked at the creation times (same as it is
> on their PC's), modified times (no help there) and the 'atime' ..
> which I have no idea what that is.. but it isnt correct.
>
> Any help would be appreciated,
>
> - Brent
Look at `perldoc -f utime`. The utime() function should let you do what
you want, and is OS-independent, whereas the `touch` command is OS-
dependent.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 15 Jul 1998 17:30:42 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: Sticking in NULL after split(II)
Message-Id: <6oip02$5pl$1@nnrp1.dejanews.com>
> >A simple workaround would be:
> >(for all vars, you could use a field here...)
>
> >@vars = split (/:/);
> >foreach $var (@vars) {
> > unless (defined ($var)) {
> > $var = "NULL";
> >}
>
> >#... stick them togethsr:
> >$outstring = join (/,/, @vars);
>
>
> That doesn't compile (missing })
Hmm, elm does not know how to execute perl sripts on the fly...
it's a shame, i know... :-) (well, I could try a shell escape
and parse the tmp-message file for #!/...perl, execute the script
in an eval and check the error message... - No bad idea finally,
I'll think about it..;-)
> - also, see Larry's point about
> empty split()-resultant fields being nonetheless defined.
Hmm, thats right of course...
ok, for the original asker:
@vars = split (/:+/);
Is much better, since you avoid empty fields.
But number of fields can vary now...
Andre.
--
____________________________________________________________________
| | |
| Andre Merzky | |
| Dep. of Physics - EEP I | Kathrin Kirsch & Andre Merzky |
| Humboldt University of Berlin | bij Beekma |
| Invalidenstr. 49 | van Boetzelaerstraat 5^3 |
| D-10115 Berlin | NL-1051 CS Amsterdam |
| Tel.: ++49 - 30 - 2093 7988 | Tel.: ++49 - 171 - 280 24 12 |
| | |
| --- |
| pinocchio@earthling.net - http://home.pages.de/~pino |
| __o --- |
| _`\<,_ |
|____ (_)/ (_) _________________________________think global_________|
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 15 Jul 1998 13:15:56 -0400
From: Gordon Blair <devnull@interlog.com>
Subject: Re: The three properties of programmers
Message-Id: <Pine.BSI.3.96r.980715131419.11708B-100000@shell1.interlog.com>
This seems like you're being impatient (3rd)
On Wed, 15 Jul 1998, Mark Stang wrote:
> I am racking my brain trying to remember the three properties of
> programmers, as per the Camel book. Alas, I do not have my copy with me.
>
> I can remember 2 of them: laziness and hubris...please someone tell
> me...what is the third?
>
------------------------------
Date: Wed, 15 Jul 1998 17:54:10 GMT
From: John Porter <jdporter@min.net>
Subject: Re: The three properties of programmers
Message-Id: <35ACEE65.5C17@min.net>
Mark Stang wrote:
>
> I am racking my brain trying to remember the three properties of
> programmers, as per the Camel book. Alas, I do not have my copy with me.
>
> I can remember 2 of them: laziness and hubris...please someone tell
> me...what is the third?
Um -- Forgetfulness?
--
John Porter
We have enough youth, how about a fountain of smart?
------------------------------
Date: Wed, 15 Jul 1998 13:13:39 -0400
From: Chris Mason <cmason@transarc.com>
Subject: The visibility of @_...
Message-Id: <35ACE343.2D8ECDEE@transarc.com>
In perldoc perlsub, while discussing prototypes with &, it says:
...That prints ``unphooey''. (Yes, there are still
unresolved issues having to do with the visibility
of @_. I'm ignoring that question for the moment.
(But note that if we make @_ lexically scoped, those
anonymous subroutines can act like closures...
(Gee, is this sounding a little Lispish?
(Never mind.))))
Well, I thought that was cute when I first read it, but now it's not cute,
it's just confusing, and now it matters too, because I'm writing a sub that
uses the & prototype:
# pushes a scalar onto an array only if test
# code returns false for each item
sub pushuniq (&\@$) { # prototyped to take a real array as the
# first argument. Otherwise it would slurp evything.
my ($test, $target, $list) = @_;
map { &$test($list, $target) && return 0 } @$target;
push @$target, $list;
}
I want to call it like this:
pushuniq {${ pop }->[0] eq ${ pop }->[0]}
@{ $FENTS{$file} }, [$fname, $arg];
Now, my question (finally). What _is_ the visibility of @_ there? What
will it be popping off of? The @_ of the sub that I'm currently in, or the
@_ that I pass into that sub when it gets called from pushuniq()? Do
anonymous subroutines act like closures? Am I out of my mind?
Thanks.
A confused, but amused, perl hacker,
-c
--
[ Chris Mason cmason@transarc.com cmason@cmu.edu http://ros.res.cmu.edu ]
[ "He will debauch himself with ideas... if for only one second of his ]
[ life he can close his eyes to the hideousness of reality." -- Miller ]
------------------------------
Date: Wed, 15 Jul 1998 13:16:12 -0400
From: "Gil Brown" <gil_brown@hp.com>
Subject: use strict
Message-Id: <6oio53$gbn$1@ocean.cup.hp.com>
I trying to learn perl5 (I've only written stuff in 4 so far) and I am
having a problem with use strict. All I want to do is read from a file
(simple enough) and when I uncomment use strict nothing works and it does
when I comment it. This is the example I am referring to:
#! /usr/bin/perl -w
######################
#
#
#use strict;
use FileHandle;
my $fh = new FileHandle; # Create local filehandle
open ($fh, "/home/gbrown/test/lolo") || die $!;
$line = <$fh>;
print "$line\n";
while ($line ne "")
{
print "$line\n";
$line = <$fh>;
}
Thank you for your help!
P.S. This is the error message I get when I use use strict
# ./test
Global symbol "line" requires explicit package name at ./test line 10.
Execution of ./test aborted due to compilation errors.
------------------------------
Date: Wed, 15 Jul 1998 13:50:00 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: use strict
Message-Id: <linberg-1507981350000001@projdirc.literacy.upenn.edu>
In article <6oio53$gbn$1@ocean.cup.hp.com>, "Gil Brown" <gil_brown@hp.com>
wrote:
> P.S. This is the error message I get when I use use strict
>
> # ./test
> Global symbol "line" requires explicit package name at ./test line 10.
> Execution of ./test aborted due to compilation errors.
you have to define $line. Either use:
my $line
or
use vars (qw {$line});
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Wed, 15 Jul 1998 16:59:55 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: Where is perldoc?
Message-Id: <35acd471.9747105@news.mr.net>
Previously, lvirden@cas.org wrote:
>Re: unable to call perldoc from the command line
>
>I assume you _have_ a command line and are not 'stuck' in some sort
>of program manager application.
Yep, I am aptempting to call it from the bash shell.
>Are you able to call perl from the command line?
Yep, do it everyday.
>If it's not there, then something is wrong with the installation.
It is not there, but after much searching, I found the perldoc that
was installed with Perl5.003. We are currently using Perl5.004_04 and
perldoc is not located in the same dir as the binary. So, I will use
the older version and ask why perldoc was not installed in the
standard location.
Thanks for your help
Scott.
------------------------------
Date: Wed, 15 Jul 1998 17:22:31 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: y2k
Message-Id: <35ace439.13787265@news.mr.net>
Previously, Michael Nguyen <ez062634@mailbox.ucdavis.edu> wrote:
>localtime() returns the year as the current year minus 1900 how will this
>affect localtime() when 2000 comes by ... whill it return 100?
>
>mike
Mike,
What part of subtraction don't you understand? Did you skip every math
class offered to you?
2000 - 1900 = 100. duh!
Or are you a consultant who gets paid by the hour to find answers for
these critical questions?
Did you ever bother to read the documentation that comes with Perl? Or
are you unable to read as well as subtract?
Or do you think that Perl was designed such that subtraction would
continue working up to Y2000, but stop working after that?
I am gonna bring your question to the next Y2k meeting I attend just
so I can show everyone the critical questions that have to be asked?
Scott.
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3165
**************************************