[8468] in Perl-Users-Digest
Perl-Users Digest, Issue: 2085 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 12 17:27:43 1998
Date: Thu, 12 Mar 98 14:00:43 -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 Thu, 12 Mar 1998 Volume: 8 Number: 2085
Today's topics:
Re: A to lower case. <jhi@alpha.hut.fi>
Re: Accessing Client Data using Perl/ODBC <jkry3025@comenius.ms.mff.cuni.cz>
Re: array question <jsd@hudsucker.gamespot.com>
Re: cookies? (brian d foy)
Re: garbage collecting (Ken Fox)
Help: Getting rid of warning messages <areeves@us.ibm.com>
Re: Help: Getting rid of warning messages <jdf@pobox.com>
Re: How to read whole HTML content from Web pages? (Elf Sternberg)
Re: How to use CPAN modules <jkry3025@comenius.ms.mff.cuni.cz>
Re: Integration with the Perl I/O system <mishra.aditya@emeryworld.com>
Re: Need help importing an external function <quentin@jihad.amd.com>
Re: New problem .... <johan@solace.mh.se>
News test from here <chasecreek.systemhouse@usa.net>
Re: nslookup? <jsd@hudsucker.gamespot.com>
Oraperl and CGI - Does it work? chris_talley@ple.af.mil
Re: Perl & Cookies: How do I delete once a person leave (Elf Sternberg)
Re: Perl4 vs Perl 5 (Craig Berry)
Re: preserving age of file? (David Wall)
Problem with x in s///x (David Grove)
Re: Problem with x in s///x <jdf@pobox.com>
Re: RegEx - Am I being ignored? (Tom Grydeland)
Re: Running perl scripts in the background (Craig Berry)
Re: Running perl scripts in the background (Paul Wilson)
Re: Running perl scripts in the background (Greg Bacon)
Re: shift doesn't, NEXT-to-last value? (Sameer Anand Siruguri)
Re: Skipping within a line to read URL? <jsd@hudsucker.gamespot.com>
system("ed <stuff>") <eglamkowski@angelfire.com>
Test II - Ignore... <chasecreek.systemhouse@usa.net>
Re: Time delayed response scott@softbase.com
Re: Uploading files gt 16mb bombs... <camerond@mail.uca.edu>
use ? (Keith L. Miller)
Re: use ? <beske@worldnet.att.net>
Re: use ? (Craig Berry)
Re: You have 1 message(s) - how to print plurals? (Damian Conway)
Re: You have 1 message(s) - how to print plurals? (Ken Fox)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Mar 1998 23:40:40 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: A to lower case.
Message-Id: <oeeg1knlh9j.fsf@alpha.hut.fi>
toriw@online.no (Tor Iver Wilhelmsen) writes:
>
> On Tue, 10 Mar 1998 20:54:40 +0100, Mario Soares
> <mario_soares@hotmail.com> uttered:
>
> >make the conversion ~ /[A-Z]/ to ~ /[a-z]/ in all submited query,
> >but not for this kind of characters.
>
> For ISO-Latin-1 (and possibly others), lowercase versions are the
> value of the uppercase letter plus 0x20 (32).
With one exception: chr(223) ne uc(chr(255))).
(and 215 and 247 are not letters, even though they are in the middle
of letters...)
> --
> "Between our dreams and actions lies this world."
> - Bruce Springsteen, "Dead Man Walking"
> Tor Iver Wilhelmsen toriw@online.no
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Thu, 12 Mar 1998 20:59:50 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
To: Chai Khoo <chai@itrade.net>
Subject: Re: Accessing Client Data using Perl/ODBC
Message-Id: <3508BD46.4D1A@comenius.ms.mff.cuni.cz>
Chai Khoo wrote:
>
> Hi,
>
> Can anyone tell me what is the best approach to read data from the
> client database? I was hoping Perl/ODBC will solve the problem for me,
> but I could not find a way to talk to my client database using
> Perl/ODBC. Please let me know if there is a way to read client
> database.
>
> -chai@hotmail.com
You may use either Win32::ODBC from http://www.roth.net/odbc/
or OLE + ADODB.Connection.
The OLE.pm (or Win32::OLE) is a part of the standard Activestate
(or GS&core) ports. ADODB may be installed with MS IIS 3.0+
or MS OFFICE (I think).
HTH, Jenda
------------------------------
Date: 12 Mar 1998 19:03:19 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: array question
Message-Id: <6e9bhn$dng$1@was.hooked.net>
John Porter <jdporter@min.net> wrote:
> > So $VG contains "vg00" and you then want to create @vg00, right?
> Blargh, just use symbolic refs.
symbolic references have a host of problems. (can only refer to
global variables being the big one.)
i think for this problem the original poster should use a hash of
lists. see perldsc and perlref documentation for details.
--
Jon Drukman jsd@gamespot.com
-----------------------------------------------------------------------
Plan: Eat right, exercise regularly, die anyway.
------------------------------
Date: Thu, 12 Mar 1998 15:49:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: cookies?
Message-Id: <comdog-ya02408000R1203981549560001@news.panix.com>
Keywords: from just another new york perl hacker
In article <350822CA.8B77C383@bigsky.net>, "Keith L. Miller" <miller@bigsky.net> posted:
>Can anyone tell me how to use cookie's to bring information into my
>forms? I have seen some things on this, but really would like more
>details.
since this isn't a perl specific issue, it belongs elsewhere. but
before you get to elsewhere, you'll want to see the references in the
CGI Meta FAQ.
--
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>
------------------------------
Date: 12 Mar 1998 21:12:43 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: garbage collecting
Message-Id: <6e9j4b$ejj2@eccws1.dearborn.ford.com>
David Gallone <david.gallone@innet.lu> writes:
> garbage collecting for scalars, arrays or hashes when reference
> count goes to zero is not working with a regular perl interpreter
That would be a very irregular perl interpreter. Perhaps you've
busted something in your copy of the code?
> In this case, could you tell me what exact compilation option to
> use in order to get the right "destruct level".
It "just works" out of the box. You shouldn't mess around with the
destruct level unless you want to debug perl or you've got multiple
interpreters embedded in a custom application.
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
Date: Thu, 12 Mar 1998 14:34:03 -0500
From: Adam Reeves <areeves@us.ibm.com>
Subject: Help: Getting rid of warning messages
Message-Id: <350838AB.12DECFDB@us.ibm.com>
Could someone please tell me how to get rid of these warning messages
the right way?
Name "Q::description" used only once: possible typo at mytest.cgi line
96 (#1)
(W) Typographical errors often show up as unique variable
names. If you
had a good reason for having a unique name, then just mention
it
again somehow to supress the message (the use vars pragma is
provided for just this purpose).
Isn't $Q::description fully qualified? Maybe I just don't understand
what is going on here.
My code looks something like this...
...
use strict; #Restrict unsafe constructs
use diagnostics; #Force Verbose Warning Diagnostics
use CGI; #Use Perl5 CGI Library
...
my (
$query, #form data
);
...
#create a new CGI object with all the parameters passed to this script
$query = new CGI;
...
#import all the query variables int the Q namespace
$query->import_names('Q');
...
print <<HTML;
$Q::description
HTML
...
Any help would be greatly appreciated!
Cheers,
Adam
------------------------------
Date: 12 Mar 1998 15:18:13 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Help: Getting rid of warning messages
Message-Id: <g1knfyt6.fsf@news.concentric.net>
Adam Reeves <areeves@us.ibm.com> writes:
> Name "Q::description" used only once: possible typo at mytest.cgi
> line 96 (#1)
> $query->import_names('Q');
> print <<HTML;
> $Q::description
> HTML
Here's one way to solve it:
#!/usr/bin/perl -w
use strict;
use CGI qw( :standard );
package Q; #parameters from the form in namespace Q
use vars qw( $foo $bar $baz );
package main;
import_names( 'Q' );
print "$Q::foo\n";
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 12 Mar 1998 19:56:24 GMT
From: elf@halcyon.com (Elf Sternberg)
Subject: Re: How to read whole HTML content from Web pages?
Message-Id: <6e9el8$obi$1@brokaw.wa.com>
In article <3507fe4a.7748986@news.cedep.com>
gstamant@cedep.com (Guy St-Amant) writes:
>I would like my script to read the content of various Web pages.
>How can I do that?
perldoc LWP
perldoc lwpcook
Elf
--
It is forbidden to laugh again Elf M. Sternberg
We maim our joys or hide them www.halcyon.com/elf
Horses are made of chromium steel
And little fat men shall ride them. - T.S. Eliot
------------------------------
Date: Thu, 12 Mar 1998 21:44:48 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
To: "P.M.Wong" <s11976@net1.hkbu.edu.hk>
Subject: Re: How to use CPAN modules
Message-Id: <3508C7D0.5A0A@comenius.ms.mff.cuni.cz>
P.M.Wong wrote:
>
> Sorry for asking such trivial question but i just can't find
> any doc telling me what to do once i downloaded those CPAN modules
> For example, i just downloaded the CGI_Lite and after extracting the
> tar file, i found files like CGI_Lite.pm and Makefile.PL there.
> Do i have to make it (that's using Makefile.PL) before i can use
> it
> OR simply copy the CGI_Lite.pm to the appropriate directory
> (in my case it is /usr/local/lib/perl5/aix/5.00401 )
Some modules do not need any installing so you may just copy the .pm
files to correct directory. I don't know if CGI_Lite.pm is this case.
You should at least try to make it. The most common process is :
perl Makefile.PL
make
make test
make install
That is put the files into some directory. Run perl with the Makefile.pl
as the first parameter. This will create a file named makefile.
You will then call "make" (without parameters), then "make test"
to check everything is OK and at last "make install".
>
> If i need to make it, how do i go about doing it
> (I don't see any !#/usr/local/bin/perl line in the file Makefile.PL)
It can't, the author cannot know where did you put perl.
I have seen it in /usr/bin/perl, /big/bin/perl, ...
your is /usr/local/bin/perl.
You just have to call perl explicitly from the command line.
(Unless of course working with Windoze. It does not use #!)
HTH, Jenda
------------------------------
Date: Thu, 12 Mar 1998 12:50:47 -0800
From: "Mishra, Aditya" <mishra.aditya@emeryworld.com>
Subject: Re: Integration with the Perl I/O system
Message-Id: <6e9flc$hvi@news.cnf.com>
I found the "Advanced Perl Programming" book from O'Reilly very useful for
interfacing projects similar to the one you have mentioned .
------------------------------
Date: 12 Mar 1998 15:02:02 -0600
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: Need help importing an external function
Message-Id: <ximk99zmxmd.fsf@jihad.amd.com>
>>>>> "RW" == Rob Wilson <rwilson@cs.muohio.edu> writes:
RW> I have looked in the Camel book and a few others as well as
RW> read every web page that might be able to help, but I am
RW> stumped. I am trying to load a function into my script that
RW> will be re-evaluated each time a certain line is executed.
Rob - try this.
This code reads in perl from external files, and tries to catch
errors. The core idea is to use 'eval { require $file }'.
Once you have successfully run this eval, you can call the subroutine
with whatever args you need.
#!/usr/bin/perl -w
use English;
$vesta_conf_dir = "/home/quentin/src/vesta";
chdir $vesta_conf_dir || die "Could not chdir()";
for $vdata (<*.vesta>) {
print "Validating $vdata\n";
read_vesta_config($vdata);
}
sub read_vesta_config() {
my ($vconfig, $action) = @_;
undef ($EVAL_ERROR);
chdir $vesta_conf_dir || die "Could not chdir()";
local $SIG{__WARN__} = sub { die $_[0] };
eval { require $vconfig };
if ($EVAL_ERROR) {
print "Error in eval require $vconfig\n";
} else {
# Good stuff!
require $vconfig;
print "NIS server for cts_tx is: ",$cts_tx{nis_server}[0], "\n";
}
}
------------------------------
Date: Thu, 12 Mar 1998 21:20:51 +0100
From: "Mr. Johan Andersson" <johan@solace.mh.se>
Subject: Re: New problem ....
Message-Id: <350843A3.A09806C7@solace.mh.se>
No problem with this on my system, I cut and pasted it and run, it turned
out OK. You might have the EOF mark after the end_of_html without any
newline between, try adding a newline before ending the code.
/Johan
Ben wrote:
>
> The print stuff problem has solved ... But this one can't be solved by
> myself ....
>
> Can't find string terminator "end_of_html" anywhere before EOF at id2.cgi
> line 3
>
> The code is ...
>
> #!/usr/local/bin/perl
>
> print <<"end_of_html";
>
> Content-Type: text/html\n\n
> <HTML>\n
> <BODY BGCOLOR=\"#000000\" TEXT=\"#FF0000\">\n\n
> <FONT FACE=\"vendana\" SIZE=\"3\">\n
> Your IP address - $ENV{'REMOTE_ADDR'}\n\n
> </BODY>\n
> </HTML>
>
> end_of_html
>
> Anyone?
>
> Sorry again for posting so many questions!
>
> Regards
>
> Ben :)
--
+-------------------------------<Signature>-------------------------------+
| Johan Andersson, Skvnsbergsvdgen 7, 856 41 Sundsvall, Sweden |
| Admin @ Solace Computer Society | Senior Server Consultant @ Sun |
| mailto:johan@solace.mh.se | mailto:Johan.Andersson@sun.se |
+--------------------- http://www.solace.mh.se/~johan --------------------+
------------------------------
Date: Thu, 12 Mar 1998 19:15:46 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: News test from here
Message-Id: <35083319.46DBA64C@usa.net>
hi
Pls ignore..
------------------------------
Date: 12 Mar 1998 19:35:08 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: nslookup?
Message-Id: <6e9ddc$ee0$1@was.hooked.net>
David Wall <dkw0@cdc.gov> wrote:
> In article <6e6oco$8uh$1@was.hooked.net>, Jon Drukman <jsd@hudsucker.gamespot.com> wrote:
> >$packed_version=gethostbyaddr('hudsucker.gamespot.com');
> I think there's a typo there -- shouldn't that be gethostbyname?
you are absolutely correct.
Jon Drukman jsd@gamespot.com
-----------------------------------------------------------------------
Plan: Eat right, exercise regularly, die anyway.
------------------------------
Date: Thu, 12 Mar 1998 14:09:57 -0600
From: chris_talley@ple.af.mil
Subject: Oraperl and CGI - Does it work?
Message-Id: <6e9fbr$ti7$1@nnrp1.dejanews.com>
Hello all!
Before I embark on this escapade I wanted to see if it will actually work. I
recently tried to write a script with Tcl/Oratcl that will work in a cgi-bin,
it failed misserabely. Now I am planning on trying to do it with
Perl/Oraperl, however I don't want to waste my time if it won't work. I
looked into DBD::Oracle but it requires Oracle 7 which we won't be migrating
to for a couple months, I know, we're behind the times.
What all this boils down to is will Oraperl work in a cgi-bin environment?
Thank you!
Chris Talley
chris_talley@ple.af.mil
RCF Information Systems
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 12 Mar 1998 20:02:56 GMT
From: elf@halcyon.com (Elf Sternberg)
Subject: Re: Perl & Cookies: How do I delete once a person leaves my site?
Message-Id: <6e9f1g$o8o$1@brokaw.wa.com>
In article <Pine.BSI.3.96.980308201850.13476A-100000@xanadu.io.com>
Chocolate <poohba@io.com> writes:
>Is it possible to delete a cookie once a person leaves my domain? If so
>how?
This is not a Perl question, it's a generic CGI question.
The correct answer is to go to comp.infosystems.www.authoring.cgi.
In the meantime, check out http://www.w3.org/Protocols/rfc2109/rfc2109
for information on how Cookies are supposed to work.
The absolute short answer is "Don't specify an expiration
date."
Elf
--
It is forbidden to laugh again Elf M. Sternberg
We maim our joys or hide them www.halcyon.com/elf
Horses are made of chromium steel
And little fat men shall ride them. - T.S. Eliot
------------------------------
Date: 12 Mar 1998 18:42:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl4 vs Perl 5
Message-Id: <6e9aab$1th$3@marina.cinenet.net>
User (you@somehost.somedomain) wrote:
: I am currently working on a project, my team say that we should be
: programming in Perl 5, another Team Perl 4.
The other team is wrong, flat-out, no arguments.
: Can suggest any reasons not to go with Perl 4, specific cases of code
: not working, or any pointers to such info would be great.
* Perl 4 is no longer supported; bugs won't be fixed, features won't
be extended, new OSs (and versions of them) not supported.
* Perl 5 is nearly a superset of Perl 4; almost all code written for
Perl 4 will run with no/minor mods under Perl 5.
* Perl 5 offers massively superior features (extended regex support,
better modular programming support, etc).
---------------------------------------------------------------------
| 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: Thu, 12 Mar 1998 19:53:29 GMT
From: dkw0@cdc.gov (David Wall)
Subject: Re: preserving age of file?
Message-Id: <6e9epd$2nc4@cdc4.cdc.gov>
In article <3507c622.122398049@nntp.best.com>, mocat@spamtrap.best.com (jay) wrote:
>But I want to keep a "yesterday" log, and in order to do this, the
>program has to move the "today" log to the "yesterday" log every 24
>hours and start building up a new "today" log.
>Whenever the program opens the "today" log for writing, it deletes the
>old one and starts a new one. So everytime the file is modified, it
>gets a new timestamp.
>
>Is there a way I could work around this?
You could get today's date, then check the timestamp on the log file
*before* you open it. If today's date is different from the date on the
file, move the old log file to whereever, and open a new one.
David Wall
------------------------------
Date: Thu, 12 Mar 1998 18:53:02 GMT
From: pete@dave-world.net (David Grove)
Subject: Problem with x in s///x
Message-Id: <35082a4a.8460614@news.dave-world.net>
Under windows, the following doesn't act like it should...
___
$n = "123123";
$n =~ s{
(1)
(.)
(3)
}
{
$1
4
$3
}xg;
print "$n\n";
sleep(5);
___
Instead of printint 143143, it prints in a column with leading white
space. In other words, the s/// isn't ignoring the whitespace. Am I
not understanding this, or is it a bug?
------------------------------
Date: 12 Mar 1998 14:47:32 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Problem with x in s///x
Message-Id: <en074ror.fsf@news.concentric.net>
pete@dave-world.net (David Grove) writes:
> In other words, the s/// isn't ignoring the whitespace. Am I not
> understanding this, or is it a bug?
The former. The /x modifier affects the interpretation of the regular
expression in a s// operation, and not that of the replacement
expression. Perhaps you'd like to use the /e modifier for the sake of
legibility, though with a performance hit.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 12 Mar 1998 20:04:08 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: RegEx - Am I being ignored?
Message-Id: <slrn6ggftn.ms2.Tom.Grydeland@mitra.phys.uit.no>
On Thu, 12 Mar 1998 16:35:21 GMT,
Sneex <chasecreek.systemhouse@usa.net> wrote:
> OK, I feel like I have totally
> alienated the group, so, hell why not...
Because you don't want to be flamed as well as ignored?
> Is there a way to do the following in one shot?
Any reason why you would want to do that? If this works, is readable
(to you at least) and nobody complains, why fix it?
> $file =~ tr/A-Z/a-z/; # Upper to lowercase
> $file =~ s/(?:%20)+/_/g; # One or more spaces to "_"
> $file =~ s/%2525/-/g; # Convert all "%" to "-"
> $file =~ s/%252f/-/g; # Convert all "/" to "-"
> $file =~ s/%[\da-fA-F]{2}/-/g; # Remove all %xx
Those could conceivably become a single substitution;
$file =~ s/%(?:25(?:2[5f])?|[\da-f]{2})/-/g
(notice that [A-F] is completely redundant after your tr/A-Z/a-z/ above.
> $file =~ tr/a-zA-Z0-9_.-/-/cs; # Convert others to "-"
Hmm, we could throw that one into the substitution as well, but it might
slow things down: (You can't tell unless you benchmark it)
$file =~ s/(?:%(?:25(?:2[5f])?|[\da-f]{2})|[^\da-z_.])+/-/g
(notice the trailing + which will allow consecutive matches on any part
of the pattern to be translated into a single '-'. Notice also that -
is treated as an "illegal" character, automatically squeezing that one
as well.)
At this point, the tr/// and s/// is able to turn
"%20$#@$%2525-%20-%252f" into "-". Is that what you want?
> $file =~ tr/././s; # One or more periods to "."
Hmm, I don't see how that can be included *simply*. If you're
desperate, you could always do s/above regex|(\.)+/$1 || '-'/ge, but
you're getting desperately close to unreadable already.
> $file =~ s/_-_/_/; #
> $file =~ s/-_-/-/; #
> $file =~ s/_-/_/; #
> $file =~ s/-_/_/; #
I don't see the logic behind these.
> $file =~ tr/_/_/s; # Serialized _ to single "_"
> $file =~ tr/-/-/s; # Serialized - to single "-"
This has been taken care of above
> $file =~ s/_\././g; # Remove _ either side of "."
> $file =~ s/-\././g; # Remove - either side of "."
In short, think about what you're doing. Perhaps leaving it is OK.
> Sneex :-)
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 12 Mar 1998 18:38:30 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Running perl scripts in the background
Message-Id: <6e9a36$1th$2@marina.cinenet.net>
Paul Wilson (prw@god.I.hate.spam.vanitydomain.net) wrote:
: This may sound like a stupid question, but how do I get a perl script
: to run itself in the background on a UNIX (BSD) system? I've tried all
: kinds of fork stuff but the script just hangs on and never dumps me
: back to the UNIX prompt unless I hit ^Z bg.
Ummmm...have you tried putting a & after the script invocation?
% myscript -q foo &
(Not a Perl question, by the way, but I'm in a good mood today.)
---------------------------------------------------------------------
| 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: Thu, 12 Mar 1998 20:39:56 GMT
From: prw@god.I.hate.spam.vanitydomain.net (Paul Wilson)
Subject: Re: Running perl scripts in the background
Message-Id: <350847c5.99669585@news.bestweb.net>
On 12 Mar 1998 18:38:30 GMT, cberry@cinenet.net (Craig Berry) wrote:
>
>Ummmm...have you tried putting a & after the script invocation?
>
> % myscript -q foo &
>
Right, but I was thinking more of within the script itself so it
launches itself into the background.
$ ./script
Paul.
prw at vanitydomain dot net
(yes this is my real address)
------------------------------
Date: 12 Mar 1998 21:18:04 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Running perl scripts in the background
Message-Id: <6e9jec$7lg$5@info.uah.edu>
In article <350847c5.99669585@news.bestweb.net>,
prw@god.I.hate.spam.vanitydomain.net (Paul Wilson) writes:
: Right, but I was thinking more of within the script itself so it
: launches itself into the background.
:
: $ ./script
According to W. Richard Stevens[1] (I'll paraphrase since he doesn't
like Perl very much :-):
use Carp;
sub daemon_init {
my $pid = fork;
if (not defined $pid) {
croak "$0: failed fork: $!";
}
else if ($pid != 0) {
exit 0; # kill the parent and get back to a prompt
}
## child continues
# Stevens calls for a setsid() here, but I don't know of
# a Perl equivalent. Is there one, and if not, why not?
chdir "/";
umask 0;
}
[1] Stevens, W. Richard. _Advanced Programming in the Unix Environment_.
ISBN 0-201-56317-7. Program 13.1. pg 418.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Thu, 12 Mar 1998 19:25:17 GMT
From: sam@bhishma.cse.iitb.ernet.in (Sameer Anand Siruguri)
Subject: Re: shift doesn't, NEXT-to-last value?
Message-Id: <Epq0M6.B08@bhishma.cse.iitb.ernet.in>
On 2 Mar 1998 14:07:31 -0500, James Dudley wrote:
>Hello, all.
> I am reading the new Camel book, trying examples. I have made
>a simple example for "shift" but do not understand the results.
>(Running 5.004).
[part of program snipped]
>@foo = ("aa","bb","cc","dd","ee");
>
>foreach $foo (@foo) {
> print "Before shift:\t@foo\n"; (*)
> shift @foo;
> print "After shift:\t@foo\n\n";
>}
The question was, why does this execute only thrice? And end up with
@foo=("dd", "ee")? To figure out, change the *'ed line above to;
> print "Before shift:\t@foo and \$foo is $foo\n"; (*)
and examine the output. You will realise that Perl keeps an internal counter
initialised at the beginning of the foreach() loop and not each time the list
within the parens changes. When @foo=("dd", "ee"), the counter has gone to 4
and there is no element at that position. Hence, the loop exists. In general,
when programming (in any language), don't change the variable that is being
used to iterate over.
Sam.
>Yes, I've read the perlfunc pod, and it says that "If there are no
>elements in the array, returns the undefined value." But it seems
>to me that the loop I have written should work ONE more time than it
>does. What's going on with that? Thanks for your help.
>
>Jane (not James)
>
>
--
------------------------------------------------------------------------------
Sameer Anand Siruguri, 4th year, B. Tech. programme,
Department of Computer Science and Engineering,
Indian Institute of Technology, Mumbai, India.
sam@cse.iitb.ernet.in http://www.cse.iitb.ernet.in/~sam
------------------------------------------------------------------------------
------------------------------
Date: 12 Mar 1998 19:52:26 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: Skipping within a line to read URL?
Message-Id: <6e9edq$ee0$2@was.hooked.net>
Craig Berry <cberry@cinenet.net> wrote:
> John Moreno (phenix@interpath.com) wrote:
> : That it doesn't have a space would depend upon how the url is being
> : stored - file names can and do have spaces in them, so that MIGHT not be
> : able to be guaranteed.
> I don't think urls can have spaces in them, however. (I'm ready to have
> this disproved, if someone knows something I don't.)
you can put a %20 (hex representation of ASCII space) in the request
URL and it may possibly show up in the server's error log as a space.
it shows up in apache's logs. eg:
[Thu Mar 12 11:50:38 1998] [error] File does not exist: /data2/vgs/path to hell/hithere.html
so don't make any assumptions about spaces.
Jon Drukman jsd@gamespot.com
-----------------------------------------------------------------------
Plan: Eat right, exercise regularly, die anyway.
------------------------------
Date: Thu, 12 Mar 1998 14:28:10 -0500
From: the count <eglamkowski@angelfire.com>
Subject: system("ed <stuff>")
Message-Id: <3508374A.11CB@angelfire.com>
This is really an ed question, but I am using a perl script to automate
my running it... I've tried posting over on comp.unix.questions, but no
response yet :(
And since this group is MUCH higher volume... ;)
Anyway, I've got this ed script I created using diff -e and I need
to run this ed script on a dozen other files. Since the script is
so large as to be unpractical to rewrite for sed by hand, and I am not
aware of any way to get sed scripts out of diff or of any ed2sed
utilties or even any ed2perl utilities, I am stuck dealing with the ed
script itself.
So, I wrote this little perl program:
foreach $file (<*.e>) {
system ("ed -s $file <diff.ed >$file.out");
}
But the output files are empty.
I'm not familiar with ed, but I have been reading the man page to get
a grip on the problem. diff -e doesn't put any r or w commands or the
like in it, but I am not sure of how they would work in a script like
this, if they were even necessary (does the redirect into file.out do
what I think it does? ;)
------------------------------
Date: Thu, 12 Mar 1998 21:45:02 GMT
From: Bill Jones <chasecreek.systemhouse@usa.net>
Subject: Test II - Ignore...
Message-Id: <35085616.3F24@usa.net>
Not getting clpm...
My ISP Says it supposed to work this way...
:(
Why don't I believe them...
------------------------------
Date: 12 Mar 1998 22:57:08 GMT
From: scott@softbase.com
Subject: Re: Time delayed response
Message-Id: <6e9p84$lva$1@scully.new-era.net>
Mark Waterous (mail@silas.hypermart.net) wrote:
> somewhere in the body, with simply:
> print "<P> A paragraph for instance.</P>";
> print "<P> Followed by another one, but...";
> but I want it to delay for, say 2 seconds between outputting
> the second print line, so it would come up in the browser 2 seconds
> after the first.
Well, you could get a slower connection to the Internet. Seriously,
read some background info on the TCP/IP protocol. What you want
to do is impossible.
Your Perl program could write JavaScript code, don't forget. It
is downloaded en masse and executed by the client, and has a
delay.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: Thu, 12 Mar 1998 15:39:18 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: "Diane T. Willis" <dwillis@nswc.navy.mil>
Subject: Re: Uploading files gt 16mb bombs...
Message-Id: <35085606.A0507A95@mail.uca.edu>
[cc'd to dtw]
Diane T. Willis wrote:
>
> I have a program that accepts any file of your choice and will upload
> it to a designated directory on a server. Everything works fine until
> the file gets to a certain size, like around 16 MB. Then it bombs.
> But smaller files work fine. Anybody have any ideas? I'm new
> to Perl and thought that variables adjusted automatically.
>
This doesn't sound like a perl question, but a Microsoft question. Are
you using M$ IIS? That server is known to have some major problems with
uploading large files, and I do not know if they have been fixed.
Otherwise, it might be in your code. Try posting your upload script
here, there might be a limitation written into it inadvertantly.
Cameron
camerond@mail.uca.edu
------------------------------
Date: Thu, 12 Mar 1998 21:05:30 GMT
From: miller@bigsky.net (Keith L. Miller)
Subject: use ?
Message-Id: <35084d70.185943132@news.bigsky.net>
I have this line in a perl script, but it won't work. It is in a
script that accepts data from a web form. what does it mean?
I have looked through O'Reillys Programming Perl and Learning perl
books as well as Micheal O Foghlu's Perl Quick Reference, and none of
them have the "use" command anywhere. Help please!!!
use CGI qw( :standard );
Thank you,
Miller
------------------------------
Date: Thu, 12 Mar 1998 16:52:04 -0500
From: Bryan Beske <beske@worldnet.att.net>
Subject: Re: use ?
Message-Id: <6e9lev$pll@bgtnsc02.worldnet.att.net>
See Page 287 (Access to Modules) in the Blue Camel (OReilly) Book.
Feel free to email me if you still have questions.
b^2
------------------------------
Date: 12 Mar 1998 21:37:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: use ?
Message-Id: <6e9kii$gd9$1@marina.cinenet.net>
Keith L. Miller (miller@bigsky.net) wrote:
: I have this line in a perl script, but it won't work. It is in a
: script that accepts data from a web form. what does it mean?
: I have looked through O'Reillys Programming Perl and Learning perl
: books as well as Micheal O Foghlu's Perl Quick Reference, and none of
: them have the "use" command anywhere. Help please!!!
:
: use CGI qw( :standard );
Are you sure you have version 5 of Perl (and the associated books)? Do
'perl -v' to make sure. Do 'perldoc -f use' (if you do have v5+) to
learn the basics about 'use'. Get the 2nd ed. Camel for the details.
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: 12 Mar 1998 19:45:01 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: You have 1 message(s) - how to print plurals?
Message-Id: <6e9dvt$d7e$1@towncrier.cc.monash.edu.au>
cberry@cinenet.net (Craig Berry) writes:
>Dave Bushong (spamfree@yahoo.com) wrote:
>: I have a pet peeve about having a ten thousand dollar computer telling
>: me "1 file(s) copied", when it's a matter of checking whether or not the
>: count is one. In 'C', there is usually something in the printf that
>: uses the ternary operator, e.g., prinf ("%d file%s\n", count,
>: count==1?"":"s");
>:
>: That works if you know that you will be using the word "file", for
>: example, but is not a general solution. I looked for a "pluralize"
>: function in the Text modules (#11), but not exhaustively.
>Common Lisp has some really nice support for this sort of thing...but
>Perl doesn't, that I know of. Might make a nice CPAN module, if you want
>to do that.
I have written a module fairly sophisticated pluaralizing module for English
nouns and verbs. Currently it's called Text::Inflect::English and I'll
make it available from:
http://www.cs.monash.edu.au/~damian/InflectEnglish.tar.gz
early next week (after I write a POD for it :-)
Before I look at uploading it tho the CPAN I'd appreciate some feedback on
a more approriate name for the module.
The module provides the following export_ok'd subroutines:
PL(<word>,[<number>]) - pluralize <word> if <number> && <number> != 1
PL_N(<noun>,[<number>]) - pluralize <noun> if <number> && <number> != 1
PL_V(<verb>,[<number>]) - pluralize <verb> if <number> && <number> != 1
A(<noun>,[<number>]) - return "a <noun>"/"an <noun>" if <number>==1
return "<number> <noun>" otherwise
AN(<noun>,[<number>]) - return "a <noun>"/"an <noun>" if <number>==1
return "<number> <noun>" otherwise
NO(<noun>,[<number>]) - return "no <noun>" if !<number>
return "<number> <noun>" otherwise
inflect(<string>) - process any of the above appearing as text
in a string.
The inflect subroutine works such that:
$bob = 99;
$beast = "elk";
print "I shared A(PL(bottle of beer,$bob),$bob) with A($BEAST)\n";
would output:
I shared 99 bottles of beer with an elk
The pluralizing subroutines handle all the "regular" cases and most of
the weird ones, for example:
A.C.R.O.N.Y.M. -> A.C.R.O.N.Y.M.s
agendum -> agenda
aide-de-camp -> aides-de-camp
albino -> albinos
am -> are
ambassador-at-large -> ambassadors-at-large
analysis -> analyses
aviatrix -> aviatrices
axis -> axes
bacterium -> bacteria
biceps -> biceps
bison -> bison
bride-to-be -> brides-to-be
chairman -> chairmen
chickenpox -> chickenpox
child -> children
corps -> corps
corpus -> corpora
criterion -> criteria
dwarf -> dwarves
extremum -> extrema
focus -> foci
foot -> feet
genus -> genera
goose -> geese
has been -> have been
has-been -> has-beens
herself -> themselves
himself -> themselves
Inspector General -> Inspectors General
Major General -> Major Generals
mongoose -> mongooses
mouse -> mice
no -> noes
octopus -> octopuses
opera -> operas
opus -> opera
ox -> oxen
plateau -> plateaux
potato -> potatoes
quantum -> quanta
radius -> radii
salmon -> salmon
sheep -> sheep
soliloquy -> soliloquies
woman of substance -> women of substance
The "a/an" subroutines are fairly sophisticated too, and can cope with
"difficult" inflections like:
a bacterium an honorarium
an E.K.G. a hound
a eucalyptus an hourglass
an Euler number an I.O.U.
a eulogy an L.E.D.
a ewe a one night stand
an F.B.I. agent an onerous task
an H-Bomb an unidentified flying object
a height a uniform
an heir a uranium atom
a honed blade an urban myth
an honest man a youth
a honeymoon an yttrium atom
Damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
name: Dr Damian Conway addr: School of Computer Science
email: damian@csse.monash.edu.au and Software Engineering
web: http://www.cs.monash.edu.au/~damian Monash University
fax: +61-3-9905-5146 Clayton 3168, AUSTRALIA
------------------------------
Date: 12 Mar 1998 20:58:47 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: You have 1 message(s) - how to print plurals?
Message-Id: <6e9ia7$ejj1@eccws1.dearborn.ford.com>
[mailed and posted]
damian@cs.monash.edu.au (Damian Conway) writes:
> >Dave Bushong (spamfree@yahoo.com) wrote:
> >: I have a pet peeve about having a ten thousand dollar computer telling
> >: me "1 file(s) copied" ...
>
> I have written a module fairly sophisticated pluaralizing module for
> English nouns and verbs. Currently it's called Text::Inflect::English
Excellent. Now if you combine that module with Mark-Jason Dominus'
Interpolate module you could write:
use Interpolate P => 'pluralize';
print "$P{$count}{file} copied";
That's about as good as it's going to get. ;)
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
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 2085
**************************************