[8458] in Perl-Users-Digest
Perl-Users Digest, Issue: 2074 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 11 14:07:30 1998
Date: Wed, 11 Mar 98 11:01:00 -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 Wed, 11 Mar 1998 Volume: 8 Number: 2074
Today's topics:
Re: ? on http://www.perl.com/CPAN-local/doc/FMTEYEWTK/s <uri@sysarch.com>
Re: ? on http://www.perl.com/CPAN-local/doc/FMTEYEWTK/s (Richard Bellavance)
Re: ? on http://www.perl.com/CPAN-local/doc/FMTEYEWTK/s <fp@pmpcs.com>
Re: ?name=A+B <hsommer@micro.ti.com>
Re: ?name=A+B (Steve Linberg)
Re: A simple question about command line variables... craig@synapse-group.com
Accessing password protected URL's with LWP neal@make-a-store.com
Re: Attempt to free unreferenced scalar during global d (Chip Salzenberg)
Re: Automating Visual C++ Builds with Perl <dcarr@ivation.com>
Re: c.l.p.mod and TPI <jason@primal.ucdavis.edu>
Re: c.l.p.mod and TPI (John Stanley)
Re: c.l.p.mod and TPI <jason@primal.ucdavis.edu>
Changing the UID of a PERL CGI script from nobody to a james@lucent.com
Re: Checking filedate in perl (Bjorn Malmberg)
Compilation : errors pp_sys.c errors under AIX <simmona1@bp.com>
Re: Completely Stumped <hsommer@micro.ti.com>
Re: Completely Stumped <jgoerzen@southwind.net>
Re: Completely Stumped (Bjorn Malmberg)
Re: Completely Stumped <Dave.Cross@gb.swissbank.com>
Creating non-.pm code distributions <annis@biostat.wisc.edu>
Easy regex question <chris@surewould.com>
Re: First Line for a Perl File in NT (Craig Berry)
Re: HELP IN A PERL SCRIPT (Greg Bacon)
Re: HELP IN A PERL SCRIPT <jdporter@min.net>
How do I rename a file using perl arzoo@ids.net
Re: How do I rename a file using perl <hsommer@micro.ti.com>
Re: How do I rename a file using perl (Steve Linberg)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Mar 1998 12:30:54 -0500
From: Uri Guttman <uri@sysarch.com>
To: "Peter Perchansky" <fp@pmpcs.com>
Subject: Re: ? on http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html --- Sorting ?
Message-Id: <x7n2ext9rl.fsf@sysarch.com>
"Peter Perchansky" <fp@pmpcs.com> writes:
> my $bigstring;
>
> my $fh = new FileHandle "</u/web/pmpcsc/_private/guestbook.dat";
> while ($_ = $fh->getline)
> {
> chop;
> $bigstring .= $_ . "\n";
> } ## END while
> undef $fh; ## close file
this is all done much easier with
@lines = $fh->getlines ;
>
> my @lines = split( /\n/, $bigstring);
> my @listrefs = map { [$_, (split('\t', $_))[2] ] } @lines;
as mentioned by other posts, use /\t/
also i tried your code. are you sure the fields are tab delimited? the
posting has spaces which i converted to tabs so the split would
work. maybe they got converted to spaces somewhere in your system
> my @newrefs = sort { $a->[1] <=> $b->[1] } @listrefs;
^^^
here is the true culprit |||
it should be cmp for text comparison. the code here is for the date
comparison which is numberic (actually the date sort would be faster as
text since no conversions would be necessary as the date fields are of
constant length and text sortable)
> my @data = map { $_->[0] } @newrefs;
> Thank you for your time.
you're welcome. i will send you a bill :-)
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: 11 Mar 1998 12:22:51 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: ? on http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html --- Sorting ?
Message-Id: <6e6h9b$ght@ocean.CAM.ORG>
In article <6e68lp$7q2$1@usenet46.supernews.com>,
Peter Perchansky <fp@pmpcs.com> wrote:
>
>After the change, it is
>
> Peter Perchansky
> Marilyn Faughner
> Lori Perchansky
> Sam Perchansky
>
>Original data in the form of timestamp, time spelled out, name, etc. -- tab
You're using the numeric comparison operator ("<=>") to sort strings.
Try changing it to "cmp".
Richard.
--
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
"All along this path I tread / My heart betrays my weary head
With nothing but my love to save / From the cradle to the grave"
(Eric Clapton, "From the cradle")
------------------------------
Date: Wed, 11 Mar 1998 11:58:24 -0500
From: "Peter Perchansky" <fp@pmpcs.com>
Subject: Re: ? on http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html --- Sorting ?
Message-Id: <6e6fvj$dfq$1@usenet45.supernews.com>
Hi Andrew:
Andrew M. Langmead wrote in message ...
>The operator "<=>" is for numeric comparisons. I think you want the
>"cmp" operator instead. The term "'Sam' <=> 'Lori'" will always
>evaluate that they are equal.
That did the trick; thank you.
--
===========================================================
Peter Perchansky, Computer Consultant & Microsoft FrontPage MVP
Dynamic Net, Inc. DBA PMP Computer Solutions
Providing Dynamic Databases, Design, & Electronic Commerce Solutions
FrontPage Web Hosting at http://www.pmpcs.com/services/fpwebhosting.htm
FrontPage Support http://www.pmpcs.com/support/frontpage.htm
------------------------------
Date: Wed, 11 Mar 1998 10:55:14 -0600
From: Holly Sommer <hsommer@micro.ti.com>
Subject: Re: ?name=A+B
Message-Id: <3506C1F2.7C0CB62D@micro.ti.com>
Arnoud de Jong wrote:
: How can I change the <space> to <+>?
To change one whitespace (space, tabs, etc.) to one plus sign:
s/\s/\+/; (or s/ /\+/; for just an actual space)
to change any number of consecutive whitespaces to one plus sign:
s/\s+/\+/; (or, again, s/( )+/\+/;)
Tim-toady.
-Holly, rereading the blue camel book
------------------------------
Date: Wed, 11 Mar 1998 13:36:44 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: ?name=A+B
Message-Id: <linberg-1103981336440001@projdirc.literacy.upenn.edu>
In article <6e6dq9$c8b$1@info.service.rug.nl>, "Arnoud de Jong"
<arnoud@notenbomer.nl> wrote:
> Hi
>
> Suppose i have name with spaces included (Arnoud de Jong). Now I want to
> create a link to another .pl that would look like this :
> dosomething?name=Arnoud+de+Jong
>
> How can I change the <space> to <+>?
>
> Arnoud
Use CGI.pm.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Wed, 11 Mar 1998 12:01:45 -0600
From: craig@synapse-group.com
Subject: Re: A simple question about command line variables...
Message-Id: <6e6jfo$ol3$1@nnrp1.dejanews.com>
@ARGV in Perl will get command-line arguments (unlike C, $ARGV[0] is the first
argument, not the name of the script, which is in $0).
However, what you're asking for isn't really Perl; it's batch scripting.
You'll need to pull out the arguments to the batch script, append them to the
"perl perlscript" command, and then reference them via @ARGV. If I remember
correctly, command line variables are referenced in batch files as %n, where n
is the place of the argument, indexed off 1; therefore, your batch file
command would look something like "perl foo.pl %1 %2".
-------------------------------------------
Craig Mertens
craig<at>synapse-group<I still get spam>com
The above comments should not be taken as truthful, timely, accurate or in any
way representative of the opinions, practices, values and/or policies of the
Synapse Group or its vendors, employees or corporate partners.
>
> Hi, I've checked through the documentation that I have about Perl5.0 but
> can't seem to find what I need. (WINNT40)
>
> In my Perl script, I want to check for variables that the user my put on
> the command line.
>
> If my scripts requires that the user types the command (script.bat)
> followed by his name (DAVID) and his age (47), how can I access these
> variables in my script?
>
> In C-shell, $0 represents the scripts, $1 represents the firts variable,
> $2 represents the second variable, and so on. What, if any, is the Perl
> equivalent?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 11 Mar 1998 11:43:20 -0600
From: neal@make-a-store.com
Subject: Accessing password protected URL's with LWP
Message-Id: <6e6id6$nru$1@nnrp1.dejanews.com>
I am trying to use the LWP module to access a URL that uses user
authentication.
I've tried setting my URL to http://username:password@www.myhost.com but I
always get a 401 Authorization Required Error.
Here is my code:
$geturl = 'http://username:password@www.host.com/index.html';
$req = HTTP::Request->new(GET => "$geturl");
$req->header(Accept => "text/html, */*;q=0.1",
Authorization =>'Basic');
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
my $t1 = new Benchmark;
my $td = timediff($t1,$t0);
# Check the outcome of the response
if ($res->is_success) {
print "Good request: $i took ",timestr($td),"\n";
} else {
print "Bad luck this time: $i
took",timestr($td),"\n",$res->content,"\n\n"
;
}
Do I need any additional HTTP headers for this to work?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 11 Mar 1998 17:01:31 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Attempt to free unreferenced scalar during global destruction
Message-Id: <6e6g4n$8u8$1@cyprus.atlantic.net>
According to Pse@euclid.jpl.nasa.gov:
>A cron job that generally executes without incident produced a dozen
>or so messages:
> Attempt to free unreferenced scalar during global destruction.
>the other day.
Could be a signal problem (do you use signals?).
>The Camel suggests that this is due to a bug in the C module
>I am developing; unfortunately, this script uses no C code of mine, the only
>modules it does use that have any C in are DBI and DBD::Oracle. No other
>messages were output.
Oracle isn't the best-written client library. It could be Oracle's fault.
It could be cosmic rays or bad RAM, for that matter. If you can
reproduce it regularly, there's a *chance* you can find out what's
going wrong and why.
--
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: Wed, 11 Mar 1998 12:18:33 -0500
From: Doug Carr <dcarr@ivation.com>
Subject: Re: Automating Visual C++ Builds with Perl
Message-Id: <3506C769.6C1606E5@ivation.com>
Visual C 5 comes with nmake which will still run your old makefiles, if that's
what you want. But if you want to have a script to automate the building of VC
5's workspaces & projects (the .dsw and .dsp files), you have a few choices:
1. As part of your development process, always export the workspace to a
makefile & then you can (maybe) use your old nmake-based scripts (see tools,
options, build, Export makefile when saving project file)
2. Use the AutoBuild Automated Build Add-in. Search for 'autobuild' in help.
This runs from within VC, so by itself it may not be quite what you want if you
want to control the whole process from your script.
3. Use OLE to control VC. Search for "Home Page: Developer Studio Objects" in
VC for an overview. There's a 'Build' method in there that lets you build a
configuration.
Doug.
Danny Aldham wrote:
> X-Newsreader: TIN [version 1.2 PL2]
>
> Daniel R. Kegel (dank@alumnae.caltech.edu) wrote:
> : I'm trying to figure out how to script my Visual C 5.0 biulds.
> : I used to use Makefiles, but Visual C 5.0 has made that nearly impossible.
>
> Perl itself uses a Makefile to build on VC++ 5.0 .
>
> --
> Danny Aldham SCO Ace, MCSE, JAPH, DAD
> Field Service Manager BCTel Systems Support
> 7000 Lougheed Hwy, Burnaby BC (604) 444-8949
------------------------------
Date: Wed, 11 Mar 1998 09:12:24 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: c.l.p.mod and TPI
Message-Id: <Pine.OSF.3.95.980311090558.11118K-100000@primal.ucdavis.edu>
On 11 Mar 1998, ? the platypus {aka David Formosa} wrote:
> I was told on this thread that ads would be sent to TPI, thay would look
> at them and decide wether or not thay where apporprate to the newsgroup
> and then post them. In other words thay are acting just as a moderator
> would.
>
> It is my option that looking a posts and deciding there approprateness
> should be the task of the listed moderators.
I think that Randal's insistence upon formalizing the role of the TPI is
a little silly, and certainly unnecessary. But the moderator is within
his rights to seek whatever advice and help he deems appropriate in
doing his job. Hey, he could consult me, or you, if he so chose. It
happens that he is choosing the TPI board, and announcing that choice.
I suspect that this is an effort to institutionalize Perl (no, no, has
nothing to do with the Cuckoo's Nest, dammit!), which I happen to think
is a smart thing to do, and good for all of us. But that supposition,
and my opinions regarding that supposed strategy, are irrelevant.
Randal *is* the moderator of c.l.p.announce, and as such has very wide
latitude in his behavior...including the option of unilaterally and publicly
reducing his freedom of action. Really, complaining about how he
performs *that* voluntary job is pretty silly.
---------------------------------------------------------------------------
Jason Christian University of California, Davis
jason@primal.ucdavis.edu Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614 Davis, CA 95616
------------------------------
Date: 11 Mar 1998 18:03:22 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: c.l.p.mod and TPI
Message-Id: <6e6jla$a4l$1@news.orst.edu>
In article <Pine.OSF.3.95.980311090558.11118K-100000@primal.ucdavis.edu>,
Jason Christian <jason@primal.ucdavis.edu> wrote:
>On 11 Mar 1998, ? the platypus {aka David Formosa} wrote:
>
>> I was told on this thread that ads would be sent to TPI, thay would look
>> at them and decide wether or not thay where apporprate to the newsgroup
>> and then post them. In other words thay are acting just as a moderator
>> would.
>>
>> It is my option that looking a posts and deciding there approprateness
>> should be the task of the listed moderators.
>
>I think that Randal's insistence upon formalizing the role of the TPI is
>a little silly, and certainly unnecessary. But the moderator is within
What you are replying to was written prior to Randal's decision to allow
TPI approved articles in clpa, and was in reference to allowing TPI to
approve articles for c.l.p.mod. Note that this was not in the sense of
"advice". If TPI approved it, it was posted -- they posted it. And they
were not tasked with approving just TPI generated articles. We were told
that we should trust them, that they would approve articles from other
people announcing conferences etc. In this function, they were going to
acting as moderators without being listed as such.
------------------------------
Date: Wed, 11 Mar 1998 10:30:43 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: c.l.p.mod and TPI
Message-Id: <Pine.OSF.3.95.980311102252.11118M-100000@primal.ucdavis.edu>
On 11 Mar 1998, John Stanley wrote:
> In article <Pine.OSF.3.95.980311090558.11118K-100000@primal.ucdavis.edu>,
> Jason Christian <jason@primal.ucdavis.edu> wrote:
> >On 11 Mar 1998, ? the platypus {aka David Formosa} wrote:
> >
> >> I was told on this thread that ads would be sent to TPI, thay would look
> >> at them and decide wether or not thay where apporprate to the newsgroup
> >> and then post them. In other words thay are acting just as a moderator
> >> would.
> >>
> >> It is my option that looking a posts and deciding there approprateness
> >> should be the task of the listed moderators.
> >
> >I think that Randal's insistence upon formalizing the role of the TPI is
> >a little silly, and certainly unnecessary. But the moderator is within
>
> What you are replying to was written prior to Randal's decision to allow
> TPI approved articles in clpa, and was in reference to allowing TPI to
> approve articles for c.l.p.mod. Note that this was not in the sense of
> "advice". If TPI approved it, it was posted -- they posted it. And they
> were not tasked with approving just TPI generated articles. We were told
> that we should trust them, that they would approve articles from other
> people announcing conferences etc. In this function, they were going to
> acting as moderators without being listed as such.
Okay. Then take it as a reply to your just-posted article, asking Randal
to prove his contention that c.l.p.announce doesn't allow some sort of
announcement. You think he's wrong, I think he's wrong, it may well be
that only Randal holds that interpretation...but Randal has announced
that he will post those articles. Upon the advice of <some nefarious
cabal>, sure...but that is precisely my point. Randal as c.l.p.announce
moderator can seek whatever advice he wants...that of the Nefarious
Cabal, left-handed Death-Row inmates, my three-year-old daughter, even
you or me. Evidently Randal's announced decision to seek the help of
the Nefarious Cabal, rather than some other group, or instead of relying
on his own devices, disturbs you. Alas, your disturbance on this matter
at least is entirely irrelevant: c.l.p.announce has already been
created, with Randal as despot^H^H^H^H^H^Hmoderator.
btw, didn't you promise to killfile me a couple of months ago?
---------------------------------------------------------------------------
Jason Christian University of California, Davis
jason@primal.ucdavis.edu Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614 Davis, CA 95616
------------------------------
Date: Wed, 11 Mar 1998 12:05:10 -0600
From: james@lucent.com
Subject: Changing the UID of a PERL CGI script from nobody to a specific user?
Message-Id: <6e6jm4$olu$1@nnrp1.dejanews.com>
Hi, All
I am writing a PERL 5 script that requests a user's server id and
password via a secure HTML form. The CGI script/Web server is running as
nobody. I need to be able to change the UID of the script from nobody to the
username entered into the HTML form.
I have looked into forking, setuid, suidperl, and perlsec as well as
the O'Reilly books with no luck.
I guess what I am looking for is the PERL equivalent of "su username"
with an option to enter the corresponding password.
Any help would be greatly appreciated and a quick example would make me VERY,
VERY grateful.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 11 Mar 1998 17:17:21 GMT
From: news@NOSPAMgb-design.com (Bjorn Malmberg)
Subject: Re: Checking filedate in perl
Message-Id: <3506c71a.17612873@news.algonet.se>
On 11 Mar 1998 11:14:27 -0500, Dean Pentcheff <dean@tbone.biol.sc.edu>
wrote:
<snip>
>Have you considered reading the Perl documentation? Several megabytes
>of it came with your Perl installation. Filetest operators are
>documented in the perlfunc manual section.
I am reading the manuals that came with my perl installation! But
maybe I didn't find just this!! Will search better next time!
<snip>
>No. You want to use Usenet to get help, but you don't want to read
>Usenet? And you want me to edit your email address for you? You're
>kidding.
I read from this group too!! But I can't be online all the time to
read it! It cost to much here in Sweden!
I use the NOSPAM thing in my email address since I don't want any SPAM
in my inbox! You should do that too!!!
Why do you send this kind of message to this newsgroup anyway??
Send it to my email address if you have any complaints about what I
do!
For all the others:
Sorry for waisting your bandwidth with this unuseful message, won't do
it again!
____________________________________________________
Take away the word NOSPAM to make an email reply! :)
------------------------------
Date: 11 Mar 1998 17:37:45 GMT
From: <simmona1@bp.com>
Subject: Compilation : errors pp_sys.c errors under AIX
Message-Id: <01bd4d14$4fe479a0$8acd66a1@eubpcw710.lon.cuk.bp.com>
I'm trying to help the unfortunates I find myself working with,
none of whom have even *heard* of Perl (!), by installing and
compiling it under AIX. I accepted all the AIX defaults in
Configure and all seems well until :
*** WHOA THERE!!! ***
The recommended value for $d_setregid on this machine was "undef"!
Keep the recommended value? [y]
and the same for $d_setreuid, $d_setrgid and $d_setruid.
With all four errors, I accepted the default [y] answer to keep
recommended values. 'make' then dies with a series of errors of
the form :
' "pp_sys.c", line 4088.22: 1506-285 (S) The indirection operator cannot
be applied to a pointer to an incomplete struct or union. '
These flag lines 4035 - 4088 of "pp_sys.c". Hacking pp_sys.c is, of
course, _way_ out of my league. I've done my best to read the
faqs, docs, readmes and so on.
Could anyone give me a hint about what I'm doing wrong ? Is there a
connection between the Configure and make errors ?
By all means tell me to RTFM if I've missed something obvious ...
thanks in advance for any help,
Andrew Simmons
--
simmona2@bp.com
--------- Probably not my employer's opinions ----------
------------------------------
Date: Wed, 11 Mar 1998 11:09:00 -0600
From: Holly Sommer <hsommer@micro.ti.com>
Subject: Re: Completely Stumped
Message-Id: <3506C52C.FEE9DA69@micro.ti.com>
David wrote:
: 1. How do compile a script? Do I even need to?
The perl engine interprets scripts - this is in comparison to C,
which compiles and links into a standalone executable. You just need
to pass the script onto the interpreter. (This is a simplified view).
: 2. How do I install the Perl 5.004 I have?
It's pretty much impossible to answer this without knowing your OS,
at the very least. Go to http://www.perl.org and look around some.
: 3. Do I need to be connected to my service provider to run a program?
No.
: 4. Can I write scripts in something like 'Notepad' and then just save
: them with the extension .pl.
Yes. Just make sure that the bangpath on the first line of the file
points to your perl engine/interpreter... format for this will vary,
depending on the OS in which the script will run.
-Holly
------------------------------
Date: 11 Mar 1998 11:14:10 -0600
From: John Goerzen <jgoerzen@southwind.net>
Subject: Re: Completely Stumped
Message-Id: <r6zogzdxi8t.fsf@peridot.southwind.net>
"David" <d.thomson@netcom.co.uk> writes:
> Please Help,
>
> compiler(which I have) but it is very vague about instructions(and when I
> say vague, I mean virtually none)....so my main questions are below and I
> would be grateful if anybody could help me out:
>
> 1. How do compile a script? Do I even need to?
You don't compile a script; you just run it. On Unix systems, you
insert the first line in the script as:
#!/path/to/perl
And mark it executable (chmod a+x scriptname)
> 2. How do I install the Perl 5.004 I have?
Depends. You didn't mention what operating system you use. If you
use Linux, most distributions come with Perl precompiled for you. It
is just a matter of installing the package. If you use other OSs, you
will probably have to compile it yourself...
> 3. Do I need to be connected to my service provider to run a program?
Well, are you running the program on your computer or your service
provider's computer? What kind of program is it, and what kind of
service provider?
> 4. Can I write scripts in something like 'Notepad' and then just save them
> with the extension .pl.
Yes.
You can call scripts whatever you want.
--
John Goerzen Southwind Internet Access, Inc.
E-mail: Business, jgoerzen@southwind.net; Personal, jgoerzen@complete.org
Computer Science Dept., Wichita State University, jgoerzen@cs.twsu.edu
Developer, Debian GNU/Linux <http://www.debian.org>
------------------------------
Date: Wed, 11 Mar 1998 17:24:43 GMT
From: news@NOSPAMgb-design.com (Bjorn Malmberg)
Subject: Re: Completely Stumped
Message-Id: <3506c79e.17745507@news.algonet.se>
On Wed, 11 Mar 1998 16:46:11 -0000, "David" <d.thomson@netcom.co.uk>
wrote:
First of all, I'm pretty new to perl to, but I think I can answer your
questions tho! :)
<snip>
>1. How do compile a script? Do I even need to?
You don't have to compile them!
>2. How do I install the Perl 5.004 I have?
Just use the install program ! :)
If you have win95 or something, remember to put perl in your path! :)
>3. Do I need to be connected to my service provider to run a program?
Nope, if you wanna run a program you've written just type perl
programname.pl (if you're running any win32 machine) Don't know
exactly what to do in UNIX. If you want to run it as a CGI script you
have to have access to the cgi-bin directory at your ISP or maybe, if
you're lucky, just rename the scripts to filename.cgi and they might
work in another directory!
>4. Can I write scripts in something like 'Notepad' and then just save them
>with the extension .pl.
That's right! works great, but remember to name it with the extension
.pl Sometimes Notepad wants to name the file filename.pl.txt so, check
that! The editor I use is Arachnophilia which is great for perl
scripting!
>
>Any help most graciously welcomed
>Jim.
>
>
____________________________________________________
Take away the word NOSPAM to make an email reply! :)
------------------------------
Date: Wed, 11 Mar 1998 17:42:39 GMT
From: David Cross <Dave.Cross@gb.swissbank.com>
Subject: Re: Completely Stumped
Message-Id: <y4dwwe186pc.fsf@gb.swissbank.com>
"David" <d.thomson@netcom.co.uk> writes:
> 1. How do compile a script? Do I even need to?
You don't compile Perl scripts.
> 2. How do I install the Perl 5.004 I have?
That depends where you got it from and in what format.
I'd be very surprised if is doesn't come with installation
instructions.
> 3. Do I need to be connected to my service provider to run a program?
Only if you're writing a CGI script. Please don't confuse Perl with
CGI, it's a recipe for getting ignored on this group!
> 4. Can I write scripts in something like 'Notepad' and then just save them
> with the extension .pl.
Yes, but you really don't need the '.pl' extension (tho' it might
make things a bit easier on a Prisoner of Bill system that doesn't
understand and '#!' line.
hth,
Dave... .. .
--
If I wasn't so busy writing status reports,
my status report might just become a progress report.
Dave.Cross@gb.swissbank.com
------------------------------
Date: Wed, 11 Mar 1998 11:01:05 -0600
From: William Annis <annis@biostat.wisc.edu>
Subject: Creating non-.pm code distributions
Message-Id: <3506C350.AA5@biostat.wisc.edu>
When I want to make a module available to the public, I have
all the wonderful tools that ship with perl. I just create
Makefile.PL with the ExtUtils::MakeMaker library, the MANIFEST file,
and voila! I can type 'make dist' and suddenly I have a complete
distribution of my library.
I've been working on a Unix event monitoring system (yes, I
know, another one) that I'd like to be able to make available to
people who want it. It's getting fairly large. It's written almost
entirely in perl5, and includes several .pm's I've written in addition
to the various daemons and agents involved.
What I'd like to know is if anyone has successfully used the
ExtUtils tools to create makefiles suitable for application
distribution, and if so have they documented this feat.
Thanks for your time.
--
William Annis - System Administrator - Biomedical Computing Group
(608) 263 8625 annis@biostat.wisc.edu Finger for PGP key.
------------------------------
Date: Wed, 11 Mar 1998 13:13:29 -0500
From: Chris <chris@surewould.com>
Subject: Easy regex question
Message-Id: <3506D449.7AC4342@surewould.com>
I have a regex question that for some reason is stumping me:
How the heck do I match a word?
For example, I want to check for 0 or 1 instances of the word 'teapot'.
/teapot?/ doesn't work, since it checks for 'teapo' and an optional t.
/[teapot]/ is of course also not quite right. What the heck is my
problem? My perl book is packed away in my brother's basement, the
perlop help page doesn't help with this, and I looked at www.perl.org
for an FAQ but I couldn't find one mentioned.
Thanks,
Chris
------------------------------
Date: 11 Mar 1998 18:01:04 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: First Line for a Perl File in NT
Message-Id: <6e6jh1$pbt$1@marina.cinenet.net>
slnlz@cc.usu.edu wrote:
: What is the first line for a perl file in a windows NT environment? In
: Unix it looks like #!/usr/bin/perl or so, how about that in NT? Thank you for
: your help.
The 'shebang' trick (first line being #!/what/to/run) doesn't work on NT,
but Perl is nonetheless kind enough to parse it out and use any
command-line options it finds. For this reason, and also to make porting
to Unix systems easier, I always start my NT Perl scripts with
#!/usr/bin/perl -w
The path part is meaningless for NT, but it will get you -w checking and
is likely to work if you move the script to Unix later.
HTH...
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 11 Mar 1998 17:29:32 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: HELP IN A PERL SCRIPT
Message-Id: <6e6hls$lt2$8@info.uah.edu>
[Posted and mailed]
In article <6e6a99$hmr$1@nnrp1.dejanews.com>,
wsayegh@lynx.neu.edu writes:
: I am not a PERL professional, and I need the following help. How could I do
: the following:
You may want to consider hiring one if your woes continue.
: Store the first 140 characters of each line (line by line) in a variable, and
: the rest of the characters (141+) in another variable. If the first character
: in the variable is equal to X the do so else do that....
my $one;
my $another;
while (<>) {
chomp;
if (/^(.{140})(.*)/) {
$var = $1;
$another = $2;
if (substr $var, 0, 1 eq "X") {
# do something
}
else {
# do that
}
}
else {
warn "$0: $.: bad line";
}
}
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Wed, 11 Mar 1998 12:54:39 -0500
From: John Porter <jdporter@min.net>
Subject: Re: HELP IN A PERL SCRIPT
Message-Id: <3506CFDF.3500@min.net>
Greg Bacon wrote:
>
> In article <6e6a99$hmr$1@nnrp1.dejanews.com>,
> wsayegh@lynx.neu.edu writes:
> : I am not a PERL professional, and I need the following help. How could I do
> : the following:
>
> You may want to consider hiring one if your woes continue.
Or learning perl, since that is probably the objective of
the homework assignment.
John Porter
------------------------------
Date: Wed, 11 Mar 1998 11:03:02 -0600
From: arzoo@ids.net
Subject: How do I rename a file using perl
Message-Id: <6e6g20$m32$1@nnrp1.dejanews.com>
I want to rename a file using a PERL script that takes an input from a HTML
form and renames according to that input. I have almost everyting working
except the actual rename command itslef. Here is what I set up before the
rename itslef. The names have been changed to protect the innocent.
$Digit_Dir = "/home/lalalala/cgi-bin/dada/000/";
$doda = "doda.gif";
$rename = '/bin/mv';
$NewName = "dododo.gif";
$OldName = "dadada.gif";
$oldfile = "$Digit_Dir$OldName";
$newfile = "$Digit_Dir$NewName";
$dodaDir = "$Digit_Dir$doda";
OK, I thought with the code below I could rename doda.gif to dadada.gif and
then rename dododo.gif to doda.gif I found this code in a perl script that
modifies web pages from a HTML form input without having to FTP to your site.
open(OLDNAME,"|$rename $dodaDir $oldfile");
print OLDNAME $dodaDir;
close(OLDNAME);
open(NEWNAME,"|$rename $newfile $dodaDir");
print NEWNAME $newfile;
close(NEWNAME);
HELP!!! It does not work. File chmond on the .gif's are 644. Anyone have
any suggestions? I am a novice at this as you may have suspected.
Thanks
Len
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 11 Mar 1998 11:44:17 -0600
From: Holly Sommer <hsommer@micro.ti.com>
Subject: Re: How do I rename a file using perl
Message-Id: <3506CD71.222110D@micro.ti.com>
Whoa, you made yourself alot of work there. Just do this:
$file1 = "/path/to/file/one";
$file2 = "/path/to/file/two";
$err = `mv $file1 $file2`;
Chmod of 644 means read permissions for everyone, and write
permissions only for the owner of the file. It is possible
that you don't own the files in question. Be sure to check
this first.
-Holly
------------------------------
Date: Wed, 11 Mar 1998 13:43:30 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: How do I rename a file using perl
Message-Id: <linberg-1103981343310001@projdirc.literacy.upenn.edu>
In article <6e6g20$m32$1@nnrp1.dejanews.com>, arzoo@ids.net wrote:
>I have almost everyting working
> except the actual rename command itslef.
<much snippage>
Is there a reason you don't want to use "rename"? As in:
rename ($oldname, $newname);
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
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 2074
**************************************