[8847] in Perl-Users-Digest
Perl-Users Digest, Issue: 2464 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 30 13:07:23 1998
Date: Thu, 30 Apr 98 10:00:55 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 30 Apr 1998 Volume: 8 Number: 2464
Today's topics:
Re: Bible References converted into Text (John Porter)
Re: Calculating business dates? <aqumsieh@matrox.com>
Re: Calculating business dates? <aricr@arconsultinginc.com>
change a string <jacques.huntziger@khe.scn.de>
Re: change a string <bornes@uqam.ca>
Re: change a string (Andrew M. Langmead)
Re: change a string <andy@wonderworks.co.uk>
Re: commenting a whole block? <frankie@etsetb.upc.es>
Comp.lang.perl.moderated 2nd RFD (was Re: 1701 days hat (John Stanley)
Help Beginner Modify A Little Code <sendto_fb@whitaker.org>
How to compile modules on CPAN? tonyyeh@earthlink.net
HTTP Proxy (Re: HTTP Request Headers) (John Porter)
HTTP Request Headers (Spike Hernandez)
inserting characters (Jeff McCreary)
Re: Need to find web-based e-mail client in Perl! keefner@visi.com
Newbie: How do you compile a script in Perl for Win32?? <JonathanBurns@onlineinfoservices.com>
Re: Ongoing E-Mail flood by mikes@activestate.com <andy@wonderworks.co.uk>
Re: Passing data to 'sub' functions? <gurun@acc.umu.se>
Re: performance hit ? (John Porter)
perl and GD <sirron@mail.mcoe.k12.ca.us>
Re: Perl/CGI scripts from UNIX to Macintosh/MacPerl? (Rich Morin)
Re: QRe: == vs. eq <gurun@acc.umu.se>
Re: Reading Perl scripts <barnett@houston.Geco-Prakla.slb.com>
Redirect returns text after system process whowawoo@yahoo.com
Re: Shared File Access Question/Problem (Mike Wescott)
Re: use of soubroutines ? <barnett@houston.Geco-Prakla.slb.com>
Re: Why doesn't this work? (Dave Neuer)
Re: You people want Perl to be popular? <gurun@acc.umu.se>
Re: You people want Perl to be popular? (Brian Sawert)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Apr 1998 14:30:11 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Bible References converted into Text
Message-Id: <MPG.fb256572f83bb8b989681@news.min.net>
On Wed, 29 Apr 1998 17:03:28 -0400, in article
<35479759.0@news1.ibm.net>, nospam@aol.com wrote:
> Anyone know of a perl program that easily translates Bible references into
> texts from a flat file text database?
>
> 1 John 3:16-20,22 into the Bible text itself?
> or 1 John 3:16-17;4:1-2
> or 1 John 3:16,19,20
Well, you know, that looks a lot like how newsrc files are formatted.
I suggest you grab News::Newsrc from CPAN, and look at the code
that grokes lines such as
alt.foo: 1-21,28,31-34
hth,
John Porter
------------------------------
Date: Thu, 30 Apr 1998 10:45:45 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Calculating business dates?
Message-Id: <35488E99.9102CADF@matrox.com>
--------------0DB88506B6788E1037C2C022
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Timothy Reed wrote:
> Hi,
> I need to determine if a given date falls (or fell) on a business date. I also
> need to tell if a day x days ahead or behind is a business date or note. Has
> anyone worked out a solution in Perl?
>
> Thanks,
> Tim
I really don't see the relevance of this message in this newsgroup. All you have
to do is figure out the mathematical realtionships that will give you the correct
answer.
--
Ala Qumsieh | "How much wood would a woodchuck
ASIC Design Engineer | chuck if a woodchuck could
Matrox Graphics Inc. | chuck wood?"
Montreal, Quebec | - Trivial ... 5!
--------------0DB88506B6788E1037C2C022
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Timothy Reed wrote:
<BLOCKQUOTE TYPE=CITE>Hi,
<BR>I need to determine if a given date falls (or fell) on a business date.
I also
<BR>need to tell if a day x days ahead or behind is a business date or
note. Has
<BR>anyone worked out a solution in Perl?
<P>Thanks,
<BR>Tim</BLOCKQUOTE>
I really don't see the relevance of this message in this newsgroup.
All you have to do is figure out the mathematical realtionships that will
give you the correct answer.
<PRE>--
Ala Qumsieh | "How much wood would a woodchuck
ASIC Design Engineer | chuck if a woodchuck could
Matrox Graphics Inc. | chuck wood?"
Montreal, Quebec | - Trivial ... 5!</PRE>
</HTML>
--------------0DB88506B6788E1037C2C022--
------------------------------
Date: Thu, 30 Apr 1998 12:19:22 -0400
From: Aric Rosenbaum <aricr@arconsultinginc.com>
Subject: Re: Calculating business dates?
Message-Id: <3548A48A.8A64C523@arconsultinginc.com>
Tim,
There are a few date modules at http://www.perl.com.
Date::DateCalc.pm will let you know the day of week.
Date::Manip.pm will let you calculate work days.
-- Aric
Ala Qumsieh wrote:
> Timothy Reed wrote:
>
>> Hi,
>> I need to determine if a given date falls (or fell) on a business
>> date. I also
>> need to tell if a day x days ahead or behind is a business date or
>> note. Has
>> anyone worked out a solution in Perl?
>>
>> Thanks,
>> Tim
>
> I really don't see the relevance of this message in this newsgroup.
> All you have to do is figure out the mathematical realtionships that
> will give you the correct answer.
>
> --
> Ala Qumsieh | "How much wood would a woodchuck
> ASIC Design Engineer | chuck if a woodchuck could
> Matrox Graphics Inc. | chuck wood?"
> Montreal, Quebec | - Trivial ... 5!
>
>
------------------------------
Date: 30 Apr 1998 13:55:45 GMT
From: "Zeta" <jacques.huntziger@khe.scn.de>
Subject: change a string
Message-Id: <01bd743f$f5382120$840c138e@huntzige.FR_HAG_01A>
Hello,
I have a little problem, I want to change in a string a / caratere, but I
can't..
I know that : $string =~ s/car/newcar/g;
but for / what car use?
Thank for you help.
------------------------------
Date: Thu, 30 Apr 1998 15:45:47 GMT
From: Bornes <bornes@uqam.ca>
Subject: Re: change a string
Message-Id: <35489CA8.51B1BC5A@uqam.ca>
Zeta wrote:
> Hello,
> I have a little problem, I want to change in a string a / caratere, but I
> can't..
> I know that : $string =~ s/car/newcar/g;
> but for / what car use?
> Thank for you help.
Use the \ before the / like the above example
$string =~ s/\//newcar/g;
So every / will be replaced by newcar
Rene
------------------------------
Date: Thu, 30 Apr 1998 16:22:34 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: change a string
Message-Id: <Es8ItM.FvJ@world.std.com>
"Zeta" <jacques.huntziger@khe.scn.de> writes:
>I have a little problem, I want to change in a string a / caratere, but I
>can't..
>I know that : $string =~ s/car/newcar/g;
>but for / what car use?
You might want to take a look at the perlop and perlre man pages. One
feature of the pattern match operator is that the left side is treated
like a double quoted string. This means that you can use backslash
escape sequences to product a character that you can't otherwise.
$string =~ s/\//newcar/g;
Another feature is that you can replace the forward slashes with any
non-alphanumeric, non-whitespace character. If you do this, then the
forward slash has no special meaning to the substitution operator.
$string =~ s#/#newcar#g;
You can even use "paired" characters.
$string =~ s(/)(newcar)g;
--
Andrew Langmead
------------------------------
Date: Thu, 30 Apr 1998 16:49:04 +0100
From: Andy Armstrong <andy@wonderworks.co.uk>
Subject: Re: change a string
Message-Id: <pQcXQDAw1JS1EwIV@wndrwrks.demon.co.uk>
In article <01bd743f$f5382120$840c138e@huntzige.FR_HAG_01A>, Zeta
<jacques.huntziger@khe.scn.de> writes
>Hello,
>I have a little problem, I want to change in a string a / caratere, but I
>can't..
>I know that : $string =~ s/car/newcar/g;
>but for / what car use?
>Thank for you help.
Use \/ or do something like $string =~ s!slash!/!g;
--
Andy Armstrong, Wonderworks, http://www.wonderworks.co.uk
------------------------------
Date: Thu, 30 Apr 1998 15:53:56 +0200
From: Francesc Guasch <frankie@etsetb.upc.es>
Subject: Re: commenting a whole block?
Message-Id: <35488274.F25C3DEF@etsetb.upc.es>
Stuart Cooper wrote:
>
> People who already use Emacs for editing their Perl code should try these
> commands out for block-(un)?commenting their code. In my view it will answer
> their block-commenting needs better than code fiddling (if (0) {}),
> pod fiddling, or the vi solution.
>
It runs out of topic but I'm unable to do a thing with emacs with perl
as I did with other languages, I want to indent a whole file, CTRL-i
just indents one line.
please tell me how ?
--
^-^.-----. mailto:frankie@citel.upc.es
o o ) http://citel.upc.es/~frankie
Y (_ (___(ssss
------------------------------
Date: 30 Apr 1998 15:22:59 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Comp.lang.perl.moderated 2nd RFD (was Re: 1701 days hath September (was: Re: rename funciton))
Message-Id: <6ia50j$6n0$1@news.NERO.NET>
In article <fl_aggie-3004980943400001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>That's why c.l.p.moderated is going to come up for a vote shortly.
You mean, despite the fact that the second RFD never materialized?
And that there is just a week left to discuss it if it does show up?
Please don't confuse the lack of discussion about the problems in the
first RFD with acceptance. The discussion died down when there was a
promise of a revised RFD.
Those of us who were opposed to parts of the proposal were told to stop
arguing about things that had been changed in the RFD and that those
changes would be posted soon. That "soon" was almost a month ago.
It would be very dissappointing to learn that those promises were made
in bad faith.
------------------------------
Date: Thu, 30 Apr 1998 12:30:44 -0400
From: Frank Blanchard <sendto_fb@whitaker.org>
Subject: Help Beginner Modify A Little Code
Message-Id: <3548A734.338C@whitaker.org>
the script returns data from a pipe
delimited ascii database. the results
print as a table row. i want to change
the results to a vertical list. any
suggestions?
thanks.
-fb
====================================================
$search_results .= "<TR>";
$hit_counter = "1";
foreach $field (@row)
{
$search_results .= "<TD>$field</TD>";
}
$search_results .= "</TR>";
}
====================================================
------------------------------
Date: Thu, 30 Apr 1998 16:13:04 GMT
From: tonyyeh@earthlink.net
Subject: How to compile modules on CPAN?
Message-Id: <3548a291.56863964@melcupa>
I am using Perl Win32 316 from ActiveState.
How do I compile modules on CPAN? For example, how to compile the PVM
module?
What is a "MAKE"?
------------------------------
Date: Thu, 30 Apr 1998 16:33:07 GMT
From: jdporter@min.net (John Porter)
Subject: HTTP Proxy (Re: HTTP Request Headers)
Message-Id: <MPG.fb273275033922f989682@news.min.net>
On Thu, 30 Apr 1998 15:34:49 GMT, in article
<3548996d.16209265@news.digex.net>, webmaster@gardenweb.com wrote:
> I need to see the request headers for an HTTP request EXACTLY as the
> browser sends them. It is a little beyond my ken to make a faux server
> that can record them.
>
> Does anyone know of a script or a site that might be able to show me
> exactly what Netscape sent the server?
Sounds like you want a simple proxy server.
So, can anyone supply a pointer to a proxy server written in perl?
It must not be hard to do, what with all the great support modules
available... but there doesn't seem to bee a "cookbook" way
mentioned in the module docs.
John Porter
------------------------------
Date: Thu, 30 Apr 1998 15:34:49 GMT
From: webmaster@gardenweb.com (Spike Hernandez)
Subject: HTTP Request Headers
Message-Id: <3548996d.16209265@news.digex.net>
I need to see the request headers for an HTTP request EXACTLY as the
browser sends them. It is a little beyond my ken to make a faux server
that can record them.
Does anyone know of a script or a site that might be able to show me
exactly what Netscape sent the server?
Thanks!
Spike Hernandez
webmaster@gardenweb.com
------------------------------
Date: Thu, 30 Apr 1998 16:09:54 GMT
From: jeffmcc@mindspring.com (Jeff McCreary)
Subject: inserting characters
Message-Id: <35489f2c.12816208@news>
Is there a way to insert a "/" into the middle of a string without
trying to concantenate substrings?
------------------------------
Date: Thu, 30 Apr 1998 10:12:38 -0600
From: keefner@visi.com
Subject: Re: Need to find web-based e-mail client in Perl!
Message-Id: <6ia4d6$ihq$1@nnrp1.dejanews.com>
In article <6h3o8e$egq$1@newsflash.concordia.ca>,
neil@domingo.concordia.ca (Neil Kandalgaonkar) wrote:
>
> In article <6gumiq$9nm$1@gaia.ns.utk.edu>,
> Bob Gwynne <gwynne@utkux.utk.edu> wrote:
>
> >You could probably personalize
> >the script for each student by giving each script a different name, e.g.,
> >johnsmail.pl, sarasmail.pl, etc., and loading up your HD with as many
> >scripts as there are students.
>
> What a unique solution. At my university there were 30,000 students. If
> each script is tightly written, providing email shouldn't require more
> than 30,000 files and 150 MB of software.
>
> Seriously though, maybe this MailMan thing solves all the problems (and
> there are many). But, if all you need is a system that works on a few
> kiosks, I'm not sure web-based email is the right thing to do. There are
> other options.
>
> 1) clients that can be scripted into quick reconfig for each user,
> reading mailboxes and preferences over the network.
>
> 2) use email clients that run on the remote host and have X Windows
> interfaces (much as I hate X windows, it has its uses.)
>
> 3) how about putting a telnet program on the kiosk and letting
> them use Pine or other email programs, from their regular unix accts?
another option.
There are lots of off-the shelf configurable browsers to do that
and they are all listed at www.kiosks.org, as well as some pretty handy
javascripts hackers use to "take advantage" of kiosks..
Craig
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 30 Apr 1998 16:10:48 GMT
From: "Jonathan Burns" <JonathanBurns@onlineinfoservices.com>
Subject: Newbie: How do you compile a script in Perl for Win32?????
Message-Id: <co121.994$v74.1476107@katana>
I have a .pl file, but when I access it from the web, it displays the script
as if it were a text file. Does it need to be compiled? How do you compile
it with Perl for Win32?
Thanks,
Jon Burns
JBurns@onlineinfoservices.com
------------------------------
Date: Thu, 30 Apr 1998 13:43:43 +0100
From: Andy Armstrong <andy@wonderworks.co.uk>
Subject: Re: Ongoing E-Mail flood by mikes@activestate.com
Message-Id: <bu$7vDA$HHS1EwsY@wndrwrks.demon.co.uk>
In article <6i9ioi$1oo$3@nz12.rz.uni-karlsruhe.de>, Marc Haber
<Marc.Haber-usenet@gmx.de> writes
[snip]
>I have received this notice _five_ times, the flood is still ongoing.
>Can anyone confirm this?
Yup.
--
Andy Armstrong, Wonderworks, http://www.wonderworks.co.uk
------------------------------
Date: Thu, 30 Apr 1998 18:03:57 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: Passing data to 'sub' functions?
Message-Id: <3548A0ED.AB0A701@acc.umu.se>
Wolfgang Denk wrote:
> To get you started: read the perlsub man page.
And when you are at it. Look at @_ too.
/Niclas
------------------------------
Date: Thu, 30 Apr 1998 14:07:39 GMT
From: jdporter@min.net (John Porter)
Subject: Re: performance hit ?
Message-Id: <MPG.fb25106f7ea710f989680@news.min.net>
In article <6i7o82$1fmm@fidoii.cc.Lehigh.EDU>, prl2@lehigh.edu says...
> I have package Staple in Staple.pm. One of the methods in Staple uses another
> method within Staple. Is there any performance hit when I say:
>
> package Staple;
> <snip>
> sub method_1 {
> <snip>
> $x = Staple->method_2();
> <snip>
> instead of:
> $x = method_2();
Performance is not the issue here: these two calls are not
equivalent. Whenever you have a function call prefixed
with something by an arrow, the prefixed thing gets passed
as the first argument. In other words,
Staple->method_2()
is the same as
method_2( Staple )
(Of course, package names are passed as strings.)
Now, if that subroutine isn't expecting any arguments, it
can ignore any it gets. In which case you may as well not
pass any, because that will incur some processing to set up
the arg list.
hth,
John Porter
------------------------------
Date: Thu, 30 Apr 1998 09:03:34 -0700
From: Joseph Norris <sirron@mail.mcoe.k12.ca.us>
Subject: perl and GD
Message-Id: <3548A0D6.3E0B72D9@mail.mcoe.k12.ca.us>
Hello perlites,
I am seeking a site on the web that will give me some examples of perl
and gd. I downloaded the module and istalled it. I have read the few
examples in the demos directory. I only found one that relates to cgi
and I need more of this type of information. Any place there might be
some more documentation would be nice.
Thanks. joseph.
------------------------------
Date: Thu, 30 Apr 1998 07:51:15 -0700
From: rdm@cfcl.com (Rich Morin)
Subject: Re: Perl/CGI scripts from UNIX to Macintosh/MacPerl?
Message-Id: <rdm-3004980751150001@140.174.42.30>
In article <35480F71.926258C9@TTusa.net>, mefe@TTusa.net wrote:
> Can anyone help me about how to convert a Perl/Cgi script to install it
> and make it work on a Mac server with MacPerl?
>
> Is there any certain way or any guide/manuel to translate them for
> MacPerl...
As long as the script doesn't use Perl extensions (binary add-ons), it
should translate pretty easily. The main bugaboos are:
* line termination (NL in Unix; CR in Mac OS)
* file naming differences (/ in Unix, : in Mac OS, etc.)
* system() and backquote use (not generally supported in MacPerl)
For very complete information on MacPerl, see the MacPerl Pages:
http://www.ptf.com/macperl
and, specifically, the online copy of "MacPerl: Power and Ease":
http://www.ptf.com/macperl/ptf_book/HTML
Hope this helps!
Rich Morin
Prime Time Freeware
--
Canta Forda Computer Laboratory | Prime Time Freeware - quality
UNIX consulting, training, & writing | freeware at affordable prices
+1 415-873-7841 | +1 408-433-9662 -0727 (Fax)
Rich Morin, rdm@cfcl.com | www.ptf.com, info@ptf.com
------------------------------
Date: Thu, 30 Apr 1998 18:01:13 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: QRe: == vs. eq
Message-Id: <3548A049.E277E7E8@acc.umu.se>
Art Cohen wrote:
>
> Tom Christiansen <tchrist@mox.perl.com> wrote:
>
> : I assure you that I find Windows more difficult and less intuitive --
> : you may drain-bramaged at will -- than Unix by a factor of something
> : like a googolplex.
>
> That's just because you've been using Unix longer. Say what you will about
> Windows but I think most people would consider the Win95 interface more
> "intuitive" than a shell prompt.
How about, Unix is more intuitive and Windows is less difficult!
I would say that when you are used to Unix as opposit to "used to
windows") you'll find the Unix extremely intuitive (though more
difficult).
/Niclas :)
------------------------------
Date: Thu, 30 Apr 1998 09:48:59 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Reading Perl scripts
Message-Id: <35488F5B.8A58CD45@houston.Geco-Prakla.slb.com>
Guy Bashan wrote:
>
> Sorry about the questions - I'm quite new to perl, and just messing
> around . . .
>
> I'm using "Microsoft Personal Server", How can my server know how to run
> the perl scripts ???
You tell it?
I don't use windows for Perl things, but as I understand it, you can set
up a file reference (Explorer/view/options(?)) and point pl extensions
to your perl executable, such that double-clicking on them runs them. I
think the same would hold true for typing them at the command line, but
don't quote me on that.
To do this from the command line, you may have to use regedit and modify
the registry keys to get it to work.
> Is there a way to tell the server the location of PERL, or can it read
> PERL scripts by itself ?
Some servers can read & use perl code (I think). Apache with mod_perl
has been bantered about, but I haven't investigated it at all. I don't
know, but somehow I doubt this Microsoft product will do that. I could
be wrong.
>
> thanks. Bashan.
<my $0.02>
Lose the sig card (especially in html format) for newsgroup postings.
Many readers of this group use text only newsreaders. Not having the
HTML gibberish (as it would appear to them) in the message would make
them far more likely to respond.
</my $0.02>
>
> ------------------------------------------------------------------------
>
> Guy Bashan <bashan@shani.com>
>
> Guy Bashan
> <bashan@shani.com>
> HTML Mail
> Netscape Conference Address
> Netscape Conference DLS Server
> Additional Information:
> Last Name Bashan
> First Name Guy
> Version 2.1
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
Schlumberger Geco-Prakla (281) 596-1434 (Office Number)
1325 S. Dairy Ashford #7051 (281) 556-7615 (Fax)
Houston, TX 77077
----------------------------------------------------------------------
------------------------------
Date: Thu, 30 Apr 1998 09:48:03 -0600
From: whowawoo@yahoo.com
Subject: Redirect returns text after system process
Message-Id: <6ia2v3$gd1$1@nnrp1.dejanews.com>
I am using Netscape Server 3.x on Windows NT.
I retrieve an image file from an FTP server ( NT IIS3) which works fine.
After I get the image I want to process it from an Intergraph CCITT group 4
format to a gif image using Image Alchemy by Handmade Software.
>From the command line the script works okay using c:\netscape\shell-cgi\perl
mycode.pl.
When I use it as a server app http://myserver.domain/shell-cgi/mycode.pl
inside a web page Netscape 4.x browser I get output from Image Alchemy (a dos
program) to the screen during processing and it does not execute the
"redirect" of the browser. It only gives me the text to redirect to another
page but doesn't actually do it.
I hope it's something painfully obvious.
The following is my script and I am new to Perl.
# mycode.pl
use CGI;
use Win32::Internet;
$I = new Win32::Internet();
$query = new CGI;
$host = "ftpserver";
$user = "anonymous";
$pass = "who\who.com";
$I->FTP($FTP, $host, $user, $pass);
if(!$FTP) {
($num, $text) = $I->Error();
print "*** Error: [$num] $text\n";
}
$FTP->Binary();
$result = $FTP->Get("/data/images/88.cit","/netscape/suitespot/docs/88.cit");
$err = $FTP->Error();
print "*** Error: $err\n" if ! $result;
$FTP->Close();
@convertcit = ("alchlong", "c:/netscape/suitespot/docs/88.cit
c:/netscape/suitespot/docs/88.gif -g -Xb550p -o -+");
system(@convertcit);
print $query->redirect('http://myserfer.domain/88.gif');
Any help, my thanks in advance !!
HU
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 30 Apr 1998 11:05:32 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
To: john.ackermann@daytonOH.ncr.com (John Ackermann)
Subject: Re: Shared File Access Question/Problem
Message-Id: <x4k987uz7n.fsf@cygnus.ColumbiaSC.NCR.COM>
In article <eNLNbi2c9GA.178@rpc1285.daytonoh.ncr.com> john.ackermann@daytonOH.ncr.com (John Ackermann) writes:
[Editted]
> I have one simple perl script (program "A") that connects via tcp/ip
> to a remote host and receives a text (line delimited) data stream. It
> then spools that data stream to a disk file, appending new data as it
> is received.
> A second perl script (program "B") [multiple instances] opens the
> spool file created by A program, dumps its current contents to the
> calling system, and continues to dump new data as it is appended.
> I need to be able to trim the size of the spool file every few hours
> by removing the oldest (i.e., the first) entries.
> So, I'm looking for a way to trim the head of a text file.
No easy way to do trim the beginning of a file. Since each program B
is effectively doing a "tail" I'd have program A rename the spool file
to "spoolfile.old" whenever a write takes it beyond a certain size.
Program B could then use a pair of stat()'s (one on the filehandle an
one on the file by name) and use that info to determine whether the
a new file must be opened. The tricky part will be avoiding race
conditions in B (either at start up or at switchover) when A is
switching.
--
-Mike Wescott
mike.wescott@ColumbiaSC.NCR.COM
------------------------------
Date: Thu, 30 Apr 1998 09:57:14 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: use of soubroutines ?
Message-Id: <3548914A.B49A894D@houston.Geco-Prakla.slb.com>
Christian Scholz wrote:
>
> Hi,
>
> Is there an easy possibility to use a subroutine in perl
> like in fortran77 ? In normal case the subroutines have to
> be declared in the main program.
Do you mean this must be the case in f77, or in perl? I don't know
fortran, but am very much confused by your statement. The guys I work
with program in f77 all the time, and have subroutines in seperate
files. It is equally possible in perl.
> In this case my main
> program extends.
Huh? *scratches head in befuddlement*
> I would like to call the subroutines in the
> main program and the subroutine itself is a separat file.
>
Assuming you mean you want to create perl subroutines in seperate files
(otherwise commonly referred to as Perl modules), and then include them,
have a look at:
perldoc perlmod
perldoc -f use
perldoc -f require
perldoc perlfaq7 (regarding 'How do I create a module').
Also check out the 'use lib' pragma. It allows you to create your own
library of modules, outside of the main Perl installation directories.
> Thanks.
> Chris
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Thu, 30 Apr 1998 16:31:43 GMT
From: daven@ldr.com (Dave Neuer)
Subject: Re: Why doesn't this work?
Message-Id: <daven-3004980931290001@daven.ldr.com>
In article <3541D406.78814D7C@spiritone.com>, smoothie@spiritone.com wrote:
> I have written a script to extract the meta tags from several html
> documents. Here's the code:
>
> #! /usr/bin/perl
>
> $dir = shift;
>
> opendir (D, $dir) or die "Can't open directory: $!\n";
> @files = readdir D;
> closedir D;
>
> foreach (@files){
> open (F, "<$dir/$_") or die "Can't open $_: $!\n";
> local $/ = undef;
> my $lines = <F>;
> $lines =~ s/.*(<meta\s[^>]*>).*/$1/mg;
> $file .= "$lines\n";
> close F;
> }
>
> open(F, ">metalist") or die "Can't open metalist: $!\n";
> print F $file;
> close F;
>
> This isn't working. The script just slurps the whole html file and
> prints it to the new file. I had originally written the replacement
> expression as:
>
> $lines =~ s/.*(<meta\s.*>).*/$1/mg;
>
> Though this didn't remove anything after the meta tag (which I realized
> was because the .*> matches everything from the first attribute's first
> character through the closing angle bracket of the entire HTML file),
> but at least it cut out the prematch stuff.
>
> I thought that by rewriting the expression as $lines =~
> s/.*(<meta\s[^>]*>).*/$1/mg; I would be sure that only the contents of
> the meta tag would match. However the fact that the html files are
> being printed to the new file intact leads me to believe that the
> expression is not matching anything. Why is this?
>
> Thanks in advance,
> Dave Neuer
>
I appreciate all of the responses that everyone provided. Using a module
or one of the regex's provided would work. More importantly, though, I
still want to know WHY mine DOESN'T work.
Thanks,
Dave Neuer
------------------------------
Date: Thu, 30 Apr 1998 17:56:35 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: You people want Perl to be popular?
Message-Id: <35489F33.DD61C182@acc.umu.se>
Craig Berry wrote:
> Actually, I still want it to be unpopular -- wildly unpopular, loathed
> and reviled. That way, I can get rich being one of the few brave
> programmers willing to maintain all those Perl apps out there that
> everyone else is too horrified to deal with.
Sounds like you should start writing some Cobol then :)
/Niclas
------------------------------
Date: Thu, 30 Apr 1998 15:40:34 GMT
From: bas.nospam@dana.ucc.nau.edu (Brian Sawert)
Subject: Re: You people want Perl to be popular?
Message-Id: <35489afd.60526853@usenet.nau.edu>
On Tue, 28 Apr 1998 22:45:41 -0400, Chris Lambrou <archive@cglis.com>
wrote:
>Well?
Definitely not. I can think of nothing more frightening than Microsoft
releasing a "Visual Perl Development Studio" that only takes up 200 Mb
of disk, uses 64 Mb RAM, and requires Internet Explorer.
------------------------------------------------------------
Brian Sawert
Information Technology Services
Northern Arizona University
------------------------------
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 2464
**************************************