[9718] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3312 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 1 23:04:49 1998

Date: Sat, 1 Aug 98 20:00:22 -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           Sat, 1 Aug 1998     Volume: 8 Number: 3312

Today's topics:
    Re: [Q]s on non-blocking system calls ("forks") <kj0@mailcity.com>
    Re: accessing local vars from packages <rootbeer@teleport.com>
    Re: Another newbie problem with Perl odbc and #!@!!@#%  <metcher@spider.herston.uq.edu.au>
    Re: Coverage Tool? <alastair@calliope.demon.co.uk>
    Re: hiding user input <sysop97@nospam.callisto.si.usherb.ca>
        How good is foreach and/or substitution? <sysop97@nospam.callisto.si.usherb.ca>
    Re: loggin out of CGI authenticated state <rootbeer@teleport.com>
    Re: Mail::Pop3Client; Can not retrieve Body ;( (Nathan V. Patwardhan)
    Re: Native "vmstat" in Perl ? (Gary Liefer)
    Re: Newbie Perl Problem <alastair@calliope.demon.co.uk>
    Re: newbie split question (Andre L.)
    Re: newbie split question (Abigail)
    Re: non-perl question about linux (Ronald J Kimball)
    Re: Parse HTML to 16-bit Text <rootbeer@teleport.com>
    Re: perl 32bit (Dustin Mollo)
    Re: Perl == Unix? (was Re: Programmer's Editor) <mpersico@erols.com>
        perl and shell help required - 2 related(?) questions <arranp@datamail.co.nz>
    Re: perl complier for ms dos (Martien Verbruggen)
    Re: Perl, CGI program execution (Bob Trieger)
    Re: Perl-CGI: Need help setting filename in browser whe <bowlin@sirius.com>
        Power (ie C's 4^7) <melkor@valimar.middle.earth>
    Re: Power (ie C's 4^7) (Mark-Jason Dominus)
    Re: Programmer's Editor <mgregory@asc.sps.mot.com>
    Re: Rearange text (Craig Berry)
    Re: Scheduling subroutines (Jack Ostroff)
    Re: Scheduling subroutines <bowlin@sirius.com>
    Re: Setting up a Members Only Section on Unix server (Bob Trieger)
    Re: Try to execute perl script in local (Jack Ostroff)
    Re: What's the future of Perl? (Craig Berry)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 2 Aug 1998 02:16:47 GMT
From: k y n n <kj0@mailcity.com>
Subject: Re: [Q]s on non-blocking system calls ("forks")
Message-Id: <6q0i6g$eef@news1.panix.com>



Oh, wow!  What a surprise.  I didn't know that the exec'd process
retained the pid of the exec'ing script.  (BTW, is this documented
anywhere?)

Thank you very much!

K.

In <Ewz1G8.KsL@world.std.com> aml@world.std.com (Andrew M. Langmead) writes:

>k y n n <kj0@mailcity.com> writes:

>>My duct-tape-&-buble-gum solution: 1) use perl's fork() to spawn a
>>child perl process; 2) have this child issue the system("frobozz")
>>call; 3) have the parent perform several chancy, totally non-portable
>>manipulations with the output of ps and the child's pid to figure out
>>frobozz's pid (it turns out to be a greatgrandchild process).

>Why not have your script just fork() and exec() "frobozz" directly?
>Then the PID of 'frobozz" is the return value of fork().
>-- 
>Andrew Langmead


------------------------------

Date: Fri, 31 Jul 1998 05:36:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: accessing local vars from packages
Message-Id: <Pine.GSO.4.02.9807302231390.9340-100000@user2.teleport.com>

On Thu, 30 Jul 1998 salvador@my-dejanews.com wrote:

> I am developing an application that uses two packages, say P1 and P2,
> from the subs in P1 y call P2 subs from which I want to access a local
> var in P1, I hope some code would help to understand this
> 
> package P1;
> sub sub1 {
> 	local %c;

Are you sure you want to use local? 

> 	...
> 	P2::sub2();
> }
> 
> package P2;
> sub sub2 {
> 	do something with %c;
> }

It looks as if you want to have a variable that stays around from one
invocation of your subs to the next. (Is that right?) In that case, you
should probably use %P1::c, and get rid of the call to local. Hope this
helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Fri, 31 Jul 1998 12:16:06 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Another newbie problem with Perl odbc and #!@!!@#% Win95
Message-Id: <35C128E6.A4209D74@spider.herston.uq.edu.au>

I have no idea why this would work anywhere.  Isn't perl case-sensitive?

-- 
Jaime Metcher

beaugard@inteport.net wrote:
> 
> I am trying to run the following code using Perl 5.004:
> 
> use win32::odbc;

use Win32::ODBC;

> $dsn = "computername";
> $db = new win32::odbc($dsn);

$db = new Win32::ODBC($dsn);

> 
> This works on NT but on win95 build 4.00.950a. I get the following
> error:
> 
>         "Can't locate object method "new" via package "win32::odbc" at
> test.pl, line 5"
> 
> This is really fustrating to say the least. I'm using the same
> distribution on both machines. Anyone who has any advice can post or
> perhaps e-mail me at
> 
> beaugard@interport.net
> 
> Thanks in advance,
> Ed Beaugard


------------------------------

Date: Fri, 31 Jul 1998 01:32:58 +0000
From: Alastair <alastair@calliope.demon.co.uk>
Subject: Re: Coverage Tool?
Message-Id: <35C11ECA.2BF8B534@calliope.demon.co.uk>

Eric Sheng wrote:
> 
> Hi,
> 
>         I've gotten the gz file and tried to install the package.  There were some
> error messages about missing man pages on coverage but that's about it.  Everything
> happened quite smoothly.  I, however, don't think I have the installation done in the
> right directory.  The document on the web doesn't explicitly say where.  So I just picked
> a directory.
> 
>         I went ahead and tried to do some test runs with:
> 
> perl -d:Coverage test.pl
> 
>         but got:
> 
> Unrecognized switch: -:Coverage.
> 

Similarly here. I thought this sounded interesting and
downloaded it too. Like you, the only glitches to the normal
installation was complaint about man pages being the wrong
format. 

However, it dawned on me that you need to put the
'-d:Coverage' inside the perl program i.e.

#!/usr/bin/perl -d:Coverage

as the first line (or similar).

Then you'll get your analysis file and can view via
'coverperl'. Having written this down, I'm starting to feel
stupid now ...

-- 
------------------------------------------------
Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk
------------------------------------------------


------------------------------

Date: Fri, 31 Jul 1998 03:03:19 GMT
From: Jay Taylor <sysop97@nospam.callisto.si.usherb.ca>
Subject: Re: hiding user input
Message-Id: <35C132F1.663@bothered.com>

> ++ I'm too stupid to figure out the FAQ.

> Must be the latter. Which doesn't surprise as you're too stupid to
> indicate on your email that you posted a copy as well.

Tsk! Tsk!
Someone comes looking for help and gets slammed!
If you don't have anything nice to say ...


------------------------------

Date: Fri, 31 Jul 1998 02:54:51 GMT
From: Jay Taylor <sysop97@nospam.callisto.si.usherb.ca>
Subject: How good is foreach and/or substitution?
Message-Id: <35C130F5.33E0@nospam.callisto.si.usherb.ca>

Here's what I have done:

http://callisto.si.usherb.ca/~eslcafe/cgi-bin/test/sample-result.htm

I am able to search for a word IN A TEXT FILE and display the word's
full line, highlighting the word.

foreach $line (@inputData)
	{
		if ($line =~ /$in{'word'}/i)
		{
		$line =~ s/$in{'word'}/<<b>$in{'word'}<\/b>/oix;
		print "$line<BR>\n";
		}
	}

HERE'S WHAT I WANT TO DO NOW:

Each line in a text file is a complete sentence.
If the third sentence contains the word I am searching for, I want to
print the third sentence (I CAN DO THIS) BUT I ALSO WANT TO print the
second and fourth lines too!


Example text file:

----------------------------------
Mary had a little lamb
Whose fleece was really crusty
Everywhere that stupid lamb went
it smelled up the town
Poor Mary
----------------------------------

I search for "stupid"

I want to extract from the text file and output to the screen:

	Whose fleece was really crusty<BR>
	Everywhere that <B>stupid</B> lamb went<BR>
	it smelled up the town<BR>



How can I do it?

Please reply to:

	mailto:sysop97@nospam.callisto.si.usherb.ca

Please delete "nospam." I am on holidays, will check my e-mail, but
don't have news installed on my laptop to save space. I may miss the
post. Sorry to be a pain.

Jay & Nathalie


------------------------------

Date: Fri, 31 Jul 1998 04:58:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: loggin out of CGI authenticated state
Message-Id: <Pine.GSO.4.02.9807302156440.9340-100000@user2.teleport.com>

On 29 Jul 1998, Hu Liang wrote:

> I've seen a few pages having a "logout" feature that erases this state
> information... how it that accomplished and can it be done with perl?

It sounds as if you want to ask a browser to do something. To do that,
just follow the proper protocols. If you're not sure about the protocols,
read their specifications or ask in their newsgroups. Hope this helps!

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 2 Aug 1998 02:47:40 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Mail::Pop3Client; Can not retrieve Body ;(
Message-Id: <6q0k0c$f0g@fridge.shore.net>

Michael Schmidt-Maier (MSchmidt@riedlingen.netsurf.de) wrote:
: Hi there all you Guru4s ;)
: I finally come to the conclusion that I need your professional help with
: this.

Any compelling reason to post this six times?
Any compelling reason to post this six times?
Any compelling reason to post this six times?
Any compelling reason to post this six times?
Any compelling reason to post this six times?
Any compelling reason to post this six times?

:-)

--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>


------------------------------

Date: 1 Aug 1998 18:25:42 -0700
From: gary@lscruz.scf.lmms.lmco.com (Gary Liefer)
Subject: Re: Native "vmstat" in Perl ?
Message-Id: <6q0f6m$eh0$1@lscruz.scf.lmms.lmco.com>

In article <u343guok.fsf@birch.i-have-a-misconfigured-system-so-shoot-me>,
root  <root@birch.netsis.com> wrote:
[ ... ]
>Problem:  IMHO, the backquoted "vmstat | tail -1" on line 15.  This 
>          forks not one, but two processes .. every $Sleeptime 
>          seconds.  Not good.  Running this on an old SPARC 2 shows 
>          96% idle .. but perfmeter sings a far different song.  
>          During the 30 seconds the process runs, CPU averages about 
>          20%, and peaks at 30%.  Which makes this code a 
>          "Heisenberg's microscope".  
>
>What I    Is there a Perl-native "vmstat" module that does not 
>want:     require a second process to be forked ?  That might help.  
>

- Most versions of vmstat take optional "count" and "interval" args
so you could fire it off in a pipe.  Something like...


#!/usr/local/bin/perl -w
#
# Simple script to monitor and log CPU activity over an extended 
# period.
# C. Roten, 07/09/1998.
#

$Last = 10;
$Sleeptime = 3;
$cpuOffs = 16;	# Offset to the first CPU field

open( vmP, "vmstat -w $Sleeptime -c $Last |" )
  || die( "Can't run vmstat: $!" );

while (<vmP>) {

  s/^\s*(.*?)\s*$/$1/;		# Off leading, trailing whitespace
  next unless( /^\d+/ );	# Skip label lines

  ($SEC,$MIN,$HOUR,$MDAY,$MON,$YEAR) = localtime( time );
  $Mon = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$MON]; 
  $Year = 1900 + $YEAR; 

  @CPUDATA = split( /\s+/ );

  print "$HOUR:$MIN:$SEC $MDAY $Mon $Year\t",
        join( ' ', splice( @CPUDATA, $cpuOffs, 3 ) ),
        "\n";
}

close( vmP );



-- 
-------------
Gary Liefer   gary@lscruz.scf.lmms.lmco.com


------------------------------

Date: Fri, 31 Jul 1998 00:39:55 +0000
From: Alastair <alastair@calliope.demon.co.uk>
Subject: Re: Newbie Perl Problem
Message-Id: <35C1125B.9EA873DB@calliope.demon.co.uk>

William L. Loucks wrote:
> 
> Even as 'root' on Linux Slackware 3.5, when
> I try to run a Perl script, I get "Permission denied".
> Any clues??? Thanks
> 
> W.Loucks <loucksw@bright.net>

Check the file permissions and make sure it's executable
('x'). If not, do a ;

chmod u+x <file>

and try again.  Do some basic research on unix.

-- 
------------------------------------------------
Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk
------------------------------------------------


------------------------------

Date: Fri, 31 Jul 1998 00:26:03 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: newbie split question
Message-Id: <alecler-3107980026030001@dialup-398.hip.cam.org>

In article <6pr52v$2uu$3@client3.news.psi.net>, abigail@fnx.com wrote:

> Thomas Rock (thomas@x-tekcorp.com) wrote on MDCCXCIV September MCMXCIII
> in <URL: news:35C0DE69.2D4B@x-tekcorp.com>:
> ++ 
> ++ You could also do:
> ++ 
> ++ @list=split('^');
> 
> Really?
> 
>    $_ = 'aap^noot^mies';
>    @list  = split '^';
>    @list2 = split '\^';
>    map {print "<$_>"} @list;  print "\n";
>    map {print "<$_>"} @list2; print "\n";
> 
> prints
> 
>    <aap^noot^mies>
>    <aap><noot><mies>
> 
> 
> ++ Have fun learning Perl!
> 
> 
> You too!


How about

   print map {"<$_>"} @list;  print "\n";
   print map {"<$_>"} @list2; print "\n";

to avoid using map in a void context? :-)

A.L.


------------------------------

Date: 31 Jul 1998 06:24:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie split question
Message-Id: <6prnvm$61r$3@client3.news.psi.net>

Andre L. (alecler@cam.org) wrote on MDCCXCV September MCMXCIII in
<URL: news:alecler-3107980026030001@dialup-398.hip.cam.org>:
++ In article <6pr52v$2uu$3@client3.news.psi.net>, abigail@fnx.com wrote:
++ 
++ >    map {print "<$_>"} @list;  print "\n";
++ >    map {print "<$_>"} @list2; print "\n";
++ 
++ How about
++ 
++    print map {"<$_>"} @list;  print "\n";
++    print map {"<$_>"} @list2; print "\n";
++ 
++ to avoid using map in a void context? :-)


Surely you realize the list returned by

      map {"<$_>"}

very likely takes much more space than the list returned by

      map {print "<$_>"}

:-)

Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


------------------------------

Date: Thu, 30 Jul 1998 21:35:57 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: non-perl question about linux
Message-Id: <1dd00ok.1ctshbqnu3zrcN@bay2-138.quincy.ziplink.net>

I'm sorry, I believe you're looking for the comp.lang.non-perl.misc
newsgroup.

Moron.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Fri, 31 Jul 1998 05:52:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Parse HTML to 16-bit Text
Message-Id: <Pine.GSO.4.02.9807302251470.9340-100000@user2.teleport.com>

On Thu, 30 Jul 1998, Matt Steinhoff wrote:

>     What's the easiest way to covert from...
> There is a <B>bold</B> word in this sentence.
> =A0=A0=A0 ...to...
> There is a b^Do^Dl^Dd^D word in this sentence.

I think you want to use a module to parse the HTML. Check on CPAN. Hope
this helps!

--=20
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 31 Jul 1998 03:51:30 GMT
From: dustin@sonic.net (Dustin Mollo)
Subject: Re: perl 32bit
Message-Id: <6prf02$p7s$1@ultra.sonic.net>

philey (philey@hotmail.com) wrote:
: hey.
: where can i get the perl compiler for windows 95?

http://www.perl.com/latest.html

-Dustin


------------------------------

Date: Thu, 30 Jul 1998 22:40:35 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Perl == Unix? (was Re: Programmer's Editor)
Message-Id: <35C12EA3.3CBD61B3@erols.com>

My $0.02

Cameron Dorey wrote:
> 

> I would love to be a Porter, but I'm actually just a lowly
> chemist, using Perl as written (on M$, no less).

Then maybe you can use module Chemistry::Elements, found at CPAN.


------------------------------

Date: Fri, 31 Jul 1998 11:44:12 +1200
From: Arran Price <arranp@datamail.co.nz>
Subject: perl and shell help required - 2 related(?) questions
Message-Id: <35C1054C.2E75@datamail.co.nz>

Hi all,

Question 1.
I have created a menu using perl for some of my users.
One of the options I have on this menu is to allow them into the shell.
How do I go about this?
I tried using
`bash`
`exec bash`
etc but they all return to my menu without the user getting to do
anything

Question 2 (which quite possibly is related)
Some of the user programs which are run, need to use system variables.
eg export $LD_LIBRARY_PATH=/whatever/ (would generally be typed at the
shell prompt) is used by a cobol program.
Is it possible to set these variables from within the perl script.
Then at a later part of the program run the non perl user program and
expect it to retain the variables I have exported?

any help appreciated

Arran

My opinions are my own, and do not reflect my employers...


------------------------------

Date: 30 Jul 1998 23:34:29 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: perl complier for ms dos
Message-Id: <6pqvu5$5gu$5@nswpull.telstra.net>

In article <6plj25$5ek$1@nnrp1.dejanews.com>,
	indhiraa@hotmail.com writes:
> In article <35BDF9DE.634C4B2@emirates.net.ae>,
>   sursood <sursood@emirates.net.ae> wrote:
>> i don't have access to cgi-bin directory or perl on my server can i try
>> the scripts on my stand alone machine?
> 
> Try perl2exe found at:

Huh? Did you misunderstand the question? He wants to run perl scripts
on his local machine.

The answer of course is: get a copy of perl for your OS, whatever that
is. http://www.perl.com/latest.html

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


------------------------------

Date: Fri, 31 Jul 1998 01:27:07 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Perl, CGI program execution
Message-Id: <6pr6md$gr4$3@strato.ultra.net>

[ posted and mailed ]

aacwn100@my-dejanews.com wrote:

-> (the program is a sound processing one. I'm trying to make it possible to use
-> it on the Web!)

This is not a perl problem. If you need assistance with cgi, aks in a 
newsgroup dedicated to cgi.

news:comp.infosystems.www.authoring.cgi


HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972 
  Ext: 1949 and let the jerk that answers know 
  that his toll free number was sent as spam. "


------------------------------

Date: Thu, 30 Jul 1998 18:26:45 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Bill Ward <billw@mentis.com>
Subject: Re: Perl-CGI: Need help setting filename in browser when downloading from server script
Message-Id: <35C11D55.ED9EECA7@sirius.com>

Bill Ward wrote:
> 
> Application: a "secure" script for transferring files out of the webspace to
> a user's browser.  Users apply password then are presented with choices each
> invoking a script with access to files located in directories not available
> to the httpd.
> 
> This script prints the contents of the file to the user (same method used by
> script-generated HTML) but the filename the browser sees is that of the
> script, not of the actual binary file.
> 
> What syntax do I use to instruct the browser to accept a new page with a
> specific filename (in this case, a *.pdf.)?
> 
> Any help is appreciated.

This is definitely not a Perl question but the answer is to use pathinfo.

Send the filename to download to your script as pathinfo:

http://host/cgi-bin/prog.pl/file_to_download.ext

Then the URL the browser sees will end with the proper file name.

HTH -- Jim Bowlin


------------------------------

Date: 2 Aug 1998 02:03:08 GMT
From: Thomas van Gulick <melkor@valimar.middle.earth>
Subject: Power (ie C's 4^7)
Message-Id: <6q0hcs$545$1@dinkel.civ.utwente.nl>

I couldn't find it in the perlop pages so I'll try here, is there some sort
of power function in perl ala the ^ operator in C, or do I have to do it all
myself?

Thomas
-- 
http://utumno.student.utwente.nl/
melkor@utumno.student.utwente.nl


------------------------------

Date: 1 Aug 1998 22:22:40 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Power (ie C's 4^7)
Message-Id: <6q0ihg$ff5$1@monet.op.net>

In article <6q0hcs$545$1@dinkel.civ.utwente.nl>,
Thomas van Gulick  <melkor@valimar.middle.earth> wrote:
>I couldn't find it in the perlop pages so I'll try here, is there some sort
>of power function in perl ala the ^ operator in C, or do I have to do it all
>myself?

C doesn't have a power operator.  ^ is the bitwise exclusive or
operator, not power.

You might want to search in `perlop' for the word `power' or
`exponent'. 








------------------------------

Date: 31 Jul 1998 09:09:46 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Programmer's Editor
Message-Id: <r8zpdqlxh9.fsf@asc.sps.mot.com>

Cameron Dorey <camerond@mail.uca.edu> writes:

> [cc'd to tc]
> 
> Tom Christiansen wrote:
> > 
> >  [snip]
> > Several questions unrelated to your product's alleged technical wizardry:
> > 
> >     Is this free?
> >     Is source available?
> >     Does it run on Unix?
> > 
> > If the answers to these are no, why are you advertising here? :-(
> 
> IMHO, Questions 1 and 2 are valid, but with all due respect, this ain't
> comp.lang.perl.unix, and Question 3 is irrelevant.

I still don't see why he should not advertise here even if the answers
to all the questions are NO.

The _only_ relevant question to which a NO answer would contraindicate
advertising here is

 "Does it help me edit perl?"

Martin.


------------------------------

Date: 31 Jul 1998 00:24:50 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Rearange text
Message-Id: <6pr2si$jk5$2@marina.cinenet.net>

Ophir Marko (ophir@saifun.com) wrote:
: I have a file that looks like this:
: 
: aa b ccc d
: 1 2 3 4
: 
: I made a script that rearanges the file to look like this:
: aa === 1
: b === 2
: ccc === 3
: d ===4
: 
: What I want to have as an output is this:
: 
: aa......1
: b.......2
: ccc.....3
: d.......4
: 
: How do I write that kind of script?

Assuming the two columns are the keys and values respectively of a hash
named %table (should be easy enough to convert to whatever you really
have), here's what I'd do:

  my $col2offset = 8;

  foreach my $key (sort keys %table) {
    my $val = $table{$key};

    print $key, '.' x ($col2offset - length($key)), $val, "\n";
  }

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: 30 Jul 1998 18:19:38 GMT
From: ostroj@gsun150.pfizer.com (Jack Ostroff)
Subject: Re: Scheduling subroutines
Message-Id: <6pqdfq$c3l6@mascagni.pfizer.com>

In article <35c0ab6f.71516829@nntp.bestweb.net>, paul@cytech.net (Paul) writes:
> I'm trying to get a perl program that runs 24/7 do a specific
> subroutine at midnight everynight. Using alarm and catching $SIG{ALRM}
> doesn't quite do what I want as there is no (fairly easy) way to be
> able to calculate the amount of seconds until midnight using time and
> then resetting the number of seconds till the next midnight in each
> subroutine.
> 
> The camel book says something about using itimer routines via syscall,
> but doesn't give any documentation on how to implement it.
> 
> I really don't want to crontab a kill signal if I can help it.
> 
How close to midnight do you actually need to do this thing?
Why not just sleep for some reasonable amount of time (seconds,
minutes, half hour?) and see if it is close enough?
Why not just have cron run a job to run the subroutine?  If it 
really has to be a subrouting in your running process, have 
cron do something (touch a file?) which the program can check
for?

How about having the program wait on reading from a named pipe,
and cron can write something to it at midnight?


------------------------------

Date: Thu, 30 Jul 1998 18:18:11 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Paul <paul@cytech.net>
Subject: Re: Scheduling subroutines
Message-Id: <35C11B53.ABC2AADD@sirius.com>

Paul wrote:
> 
> I'm trying to get a perl program that runs 24/7 do a specific
> subroutine at midnight everynight. Using alarm and catching $SIG{ALRM}
> doesn't quite do what I want as there is no (fairly easy) way to be
> able to calculate the amount of seconds until midnight using time and
> then resetting the number of seconds till the next midnight in each
> subroutine.
> 
> The camel book says something about using itimer routines via syscall,
> but doesn't give any documentation on how to implement it.
> 
> I really don't want to crontab a kill signal if I can help it.
> 
> Any suggestions?
> 
> Paul.

What's wrong with:

   my($sec, $min, $hour) = localtime();
   my $remaining = 60 * 60 * 24 - ($sec + 60 * ($min + 60 * $hour));
   sleep($remaining);

HTH -- Jim Bowlin


------------------------------

Date: Fri, 31 Jul 1998 01:15:29 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Setting up a Members Only Section on Unix server
Message-Id: <6pr60k$gr4$2@strato.ultra.net>

[ posted and mailed ]

stanzz@en.com wrote:
-> This seems to be a typical question.
-> 
-> i am having trouble setting up a Members Only section
-> on the Unix Server. Scripts are executed only in
-> the CGI-BIN.  When i set up a MEMBERS subdirectory of
-> the CGI-BIN, and password protect it, users
-> are not allowed to access the index.html or any
-> other web page because it's the cgi-bin.
-> 
-> If I protect a regular directory, my bulletin board
-> script which is executed in the cgi-bin is not
-> protected.

What the hell if anything does this have to do with perl?

-> any advice?

Yes, buy a clue.

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972 
  Ext: 1949 and let the jerk that answers know 
  that his toll free number was sent as spam. "


------------------------------

Date: 30 Jul 1998 15:42:27 GMT
From: ostroj@gsun150.pfizer.com (Jack Ostroff)
Subject: Re: Try to execute perl script in local
Message-Id: <6pq493$c3l2@mascagni.pfizer.com>

In article <35C081B6.49149113@wanadoo.fr>, Ferdi <cogelog@wanadoo.fr> writes:
> I have learned perl for a few days now. I have installed Perl (last
> version) and a 
> local server (omnihttpd 1.01) to test my scripts. In the dos windows, I
> can see the script results.
> But in my browser, I have always ( and it not depends on the perl file,
> I try several files)
> the same error message in a dialog box : "Document contains no data".
> Can you help me!
> Thanks in advance.
> Ferdi

[Thanks for the English.  You'll be much happier than my attempting
to reply in French...]

Have you checked the web server's error log?  Have you saved 
the script's output in a file and pointed your browser at that?  
Have you looked at http://language.perl.com/faq/index.html
particularly the (as Tom Phoenix says "do not be offended by
the name") Idiot's Guide to Solving Perl/CGI Problems and the 
Perl CHI Programming FAQ?

Good luck


------------------------------

Date: 31 Jul 1998 00:17:25 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: What's the future of Perl?
Message-Id: <6pr2el$jk5$1@marina.cinenet.net>

Tom Christiansen (tchrist@mox.perl.com) wrote:
[wrt the Perl compiler]
: Sure, it's there, but it's not what you think it is.  The compiler does
: not, except in a few very rare cases, do any of these things:
: 
:     increase security
:     increase portability
:     decrease size
:     decrease runtime

OK, so what *does* it do (better than the usual run-time interpreter, that
is)?  Is shrouding for release to untrustworthy clients the only win?

---------------------------------------------------------------------
   |   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 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3312
**************************************

home help back first fref pref prev next nref lref last post