[7793] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1418 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 5 18:16:45 1997

Date: Fri, 5 Dec 97 15:00:31 -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           Fri, 5 Dec 1997     Volume: 8 Number: 1418

Today's topics:
     "man perlsec" tainting question <rohan.oberoiTAKETHISOUT@cornell.edu>
     Re: ... rumours run amok <merlyn@stonehenge.com>
     Re: ? on localtime(time); <tchrist@mox.perl.com>
     Accessing DEC OSF1 Oracle db from Linux box (Lance A. Brown)
     Re: Alphanumeric Ranges Using .. and ++ <mrs@cae091.ed.ray.com>
     Re: can perl do multi-threaded programming? <eryq@zeegee.com>
     Re: Cross-platform way of interacting with user? <tchrist@mox.perl.com>
     D:\perl\SOURCE\CHAP03\sess01>perl -e `print "\a"   whil <s13621@er.uqam.ca>
     Re: deleting a line in an ascii file <Dudley@water.ca.gov>
     dynamic libraries under solaris <jcmurphy+usenet@smurfland.cit.buffalo.edu>
     Re: dynamic libraries under solaris (Even Holen)
     Re: eliminating part of file <rets@meta3.com>
     finding .pm files and where to include 3rd party libs o <tom_jenquin@mgic.com>
     Fully qualifying variables <achoy@us.oracle.com>
     Re: Getting rid of non-Y2K Perl4 (was Re: Pattern match <merlyn@stonehenge.com>
     Re: getting username from htaccess (Even Holen)
     Re: How do I print all but the first variable in an arr <jwilson@ic.ac.uk>
     Re: How do I print all but the first variable in an arr <rets@meta3.com>
     Re: looking for perl plotting interface <barnett@houston.Geco-Prakla.slb.com>
     Re: Making crontabs (Was: switch stdout and stderr) (Tushar Samant)
     Re: mass mailings from Perl:  fonts? <rootbeer@teleport.com>
     Re: Parameter Checking <rets@meta3.com>
     Re: Perl scripts to lookout for?? (zentara)
     perl with MS Access (Daveotlc)
     Re: perl with MS Access <davidk@nospam.cnct.com>
     Re: perl with MS Access <jim.michael@gecm.com>
     Re: printing and screen output <rootbeer@teleport.com>
     Re: Q: lambda fun, loop, string to expr (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: RESOURCE KIT ANOMALY... ONE MORE TIME (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Resource Kit Anomaly (Tushar Samant)
     Re: Resource Kit Anomaly (Clay Irving)
     returning an associated array from a perl library <katie@irenyx.com>
     Re: Setting default printer under Windows NT <jim.michael@gecm.com>
     sub in .pm!!!!! (James Dornan)
     Re: SybPerl <mpeppler@mbay.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 4 Dec 1997 15:45:50 GMT
From: Rohan Oberoi <rohan.oberoiTAKETHISOUT@cornell.edu>
Subject: "man perlsec" tainting question
Message-Id: <666j7e$q69@newsstand.cit.cornell.edu>

>From "man perlsec":

     Any variable
     that is set within an expression that has previously
     referenced a tainted value also becomes tainted (even if it
     is logically impossible for the tainted value to influence
     the variable).

I'd like a better understanding of what "within an expression" means
here than I can get from the examples perlsec provides.  For example,
when I run this script "foo.pl" (Perl 5.004 on Solaris):

harpo% more foo.pl
#!/usr/local/bin/perl -Tw
use strict;
$ENV{'PATH'} = '';
my $foo;
$ARGV[0] =~ m|(Hello)| and $foo = $1;
system "/bin/echo $foo";

harpo% foo.pl Hello
Hello
harpo%

I expected that "$ARGV[0] =~ m|(Hello)| and $foo = $1;" would
taint $foo because of the presence of $ARGV[0].  Can anyone 
explain why it doesn't ?

Thanks...
Rohan.




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

Date: 04 Dec 1997 17:39:50 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: mike@stok.co.uk (Mike Stok)
Subject: Re: ... rumours run amok
Message-Id: <8c90u0pqqx.fsf@gadget.cscaper.com>

>>>>> "Mike" == Mike Stok <mike@stok.co.uk> writes:

Mike> In article <666uvg$bfb$1@lyra.csx.cam.ac.uk>,
Mike> M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>> I R A Aggie <fl_aggie@thepentagon.com> wrote:
>>> 
>>> Well, its too late now. The rumor mill will run with it, and blow it
>>> completely out of proportion. Eventually, perl 4 will be blamed for
>>> violence, flood, famine, and El Nino.
>> 
>> Not to mention the plague of Camel fleas.

Mike> Someone had better tell those fleas to upgrade to the latest version soon
Mike> ;-)

On IRC-EFNET #perl the other day, we came up with some more precisely
accurate, but scary phrases:

    Larry Wall has no plans to make Perl4 be Y2K!
    No patches will ever be released to make Perl4 Y2K.
    It is unlikely that Perl4 will ever be Y2K certified.

And yes, this is forcing the issue via FUD, but remember that we're
merely combatting the *other* FUD, that moving from P4 to P5 is
impossible and/or will break things.

So, be sure to memorize the above phrases, and repeat them as often as
you can.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 270 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 5 Dec 1997 00:44:10 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ? on localtime(time);
Message-Id: <667ioq$hii$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    jfoss@jonesinternet.com writes:
:($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
:
:If I set these variable anyone know how to tell what $Yesterdays date
:was?

Of course:

    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
	    localtime(time() - 24 * 60 * 60);

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"... and I realized, we did not live in a scientific society."
	--R. P. Feynman, "Cargo cult science"


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

Date: 04 Dec 1997 12:49:23 -0500
From: brown9@niehs.nih.gov (Lance A. Brown)
Subject: Accessing DEC OSF1 Oracle db from Linux box
Message-Id: <yd1hg8pt2vw.fsf@splat.niehs.nih.gov>


Is there anything I can use to access an Oracle database running on a
DEC OSF1 3.2 system from a Linux system running perl5?  It appears
that DBD::Oracle needs the actual Oracle libraries on the client machine.

Thanks,
  --[Lance]


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

Date: Thu, 04 Dec 1997 17:37:51 -0500
From: Mark Stallard <mrs@cae091.ed.ray.com>
To: rootbeer@teleport.com
Subject: Re: Alphanumeric Ranges Using .. and ++
Message-Id: <348730BF.4A69@cae091.ed.ray.com>

Tom Phoenix wrote:
> 
> On Mon, 1 Dec 1997, Mark Stallard wrote:
> 
> > I'm writing a module which must generate sequences of alphanumeric
> > strings.  For example, the module might be asked to issue the first
> > 3 "numbers" between 1715A51882 and 1715A51932, and it would return
> > the list ( 1715A51882, 1715A51883, 1715A51884 ).  The next request
> > would begin where the previous request left off.
> 
> Hmmm... You haven't yet given a full specification: What comes after
> 1715A99999? It it 1715B00000 or 1715A100000? Or maybe 1715A9999A? :-)

1715A99999, 1715B00000, 1715B00001 ...  The number of characters
doesn't change in a given sequence.

> Other functions would include boolean test for whether or not a
> > value lies in a given range, and a count of values not yet issued
> > from a given range.
> 
> Oh, even more difficult! :-)  But here's an easy way to do what you want:
> Create a pair of functions to map your strings to (say) bitstrings, and
> back again.  Armed with those conversion functions, it's trivial to
> increment, decrement, or compare these values. Hope this helps!

It sounds like I'd need to write the increment & decrement functions
myself, and keep a record as to whether each char is alpha or numeric.
I'm not sure how much all that WOULD help.  I'll keep it in mind,
though.

Interestingly, Dean Inada (dmi@questrel.com) suggested a scheme that
resembled what I used originally:

> @a = (reverse $foo) =~ /([zZ9]*)([0-9]*[A-Za-z]*)(.*)/;
> for( @a ){ $_ = reverse $_ }
> $a[0] =~tr/zZ9/aA0/;
> $a[1]++;
> $foo = join '',reverse @a;

It might be more obvious to reverse @a twice, rather than reversing
each field twice (as scalars) then reversing @a once as a list.
Also, I can't assume a specific format for the range; only that it
contains a combination of alphas and digits.

y strategy is to split the string into on numeric/alpha boundaries
and process the fields in reverse order.  If a field contains more
characters after incrementing, the leading character is dropped and
the next field is incremented.

sub list_sequence {
	my $count       = shift @_ ;	# Count of Strings to Return
	my $range_start = shift @_ ;	# First Value to Use
	my $range_end   = shift @_ ;	# Last Legal Value
	my @sequence    = ( ) ;
	my ( $next, @fields, $fld, $fld_length, $i ) ;

	# Check Input Values

	unless ( length $range_start == length $range_end
	     &&  $range_start le $range_end ) {
		carp "Values don't form a range ($range_start, $range_end) -" ;
		return @sequence ;	# return ( ) creates more warnings
	}

	# Separate First Value into Fields

	$next   =  $range_start ;
	$next   =~ s/(\d)(\D+)/$1:$2/g ;
	@fields =  reverse split /:/, $next ;

	# Get Each Number Requested

	for ( $i = 0 ;  $i < $count ;  $i++ ) {
		$next = join "", reverse @fields ;

		# Quit if no values are left

		if ( $next gt $range_end ) { 
			last ;
		}

		push @sequence, $next ;

		# Increment Each Field as Needed

		foreach $fld ( @fields ) {
			$fld_length = length $fld ;
			$fld++ ;

			# If No Carryover Occured
			# 	Increment is Complete

			unless ( length $fld > $fld_length ) {
				last ;
			}

			# Remove Carried Over Character and Continue

			$fld = substr $fld, 1 ;
		}
	}

	return @sequence ;
}

I thought I could do this work in less code using Perl, but so far
that's the best I've come up with.

  -----------------------------------------------------------------
  Mark Stallard                         Raytheon Electronic Systems
  mrs@cae091.ed.ray.com                 Sudbury, Massachusetts (US)
  -----------------------------------------------------------------


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

Date: Thu, 04 Dec 1997 12:35:06 -0500
From: Eryq <eryq@zeegee.com>
Subject: Re: can perl do multi-threaded programming?
Message-Id: <3486E9CA.407B@zeegee.com>

On a slightly-related issue regarding 5.005:

Up until now, I've worked with the assumption that signal
handlers in Perl must follow the traditions of their C cousins:
avoid non-reentrant malloc and stdio libraries 
at all costs... so, for example, your Perl sighandler *can* safely use 
syswrite() for output, and it *can* set a pre-declared scalar variable 
to an integer or a float (or a string which will fit in the 
scalar's current buffer), and it *can* call subroutines which 
do only these things... but little else.

Now, sfio (I believe) allows for reentrancy, and it seems that
any malloc used by a thread-safe Perl would have to be reentrant
as well.  So... does this mean that signal handlers under 5.005
will no longer have to walk on eggshells to avoid core dumps?

-- 
   ___  _ _ _   _  ___ _   Eryq (eryq@zeegee.com)
  / _ \| '_| | | |/ _ ' /  President, Zero G Inc.
 |  __/| | | |_| | |_| |   "Talk is cheap. Let's build." - Red Green.
  \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
            |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 4 Dec 1997 17:49:16 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Cross-platform way of interacting with user?
Message-Id: <666qes$jir$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    john.brownie@pp.inet.fi (John Brownie) writes:
:I'm a newcomer to Perl, although with experience of C, awk, etc.  I've got 
:a successful script working on the Mac, but I need it to work on DOS 
:and/or Windows (probably both 3.1 & 95).  The major problem is how to 
:handle interacting with the user.

There's a great deal to be said for using a command line.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

	    Say aver, but ever, fever,
	    Neither, leisure, skein, deceiver.


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

Date: Thu, 04 Dec 1997 18:08:00 GMT
From: yuan <s13621@er.uqam.ca>
Subject: D:\perl\SOURCE\CHAP03\sess01>perl -e `print "\a"   while $_++ != 5`
Message-Id: <Pine.HPP.3.95.971204130419.28879A-100000@nobel.si.uqam.ca>

could anyone tell me what's wrong with that call from a dos prompt? 
Can't find string terminator "`" anywhere before EOF at -e line 1.

D:\perl\SOURCE\CHAP03\sess01>perl -e 'print "\t"  while $_++ != 5'


Can't find string terminator "'" anywhere before EOF at -e line 1.




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

Date: Thu, 04 Dec 1997 10:17:50 -0800
From: Dudley McFadden <Dudley@water.ca.gov>
To: Asmat Ullah <asmat@cad.strath.ac.uk>
Subject: Re: deleting a line in an ascii file
Message-Id: <3486F3CE.3B08B56@water.ca.gov>

Try using the the -i command-line option to Perl:


> Asmat Ullah <asmat@cad.strath.ac.uk> wrote in article
> <347D4C24.15FB@cad.strath.ac.uk>...
> > I have a flat file, containing a delimited(:) line by line list of names
> > and address, telephone numbers etc.
> > I need to know how to delete a line from this flat file.
> > example line:
> > Joe:Bloggs:MR:332442:Joe@someplace.com:Room1111
> > Please advise on best solution.
> > Thanks
> > Asmat

Try the following simple script:

#!/usr/bin/perl -ni
print unless /Joe:Bloggs:MR:332442:Joe@someplace.com:Room1111/;


Note that this will delete all occurrences of this line in the file (probably
what you want).

--
Dudley E. McFadden, III, P.E.
Office of SWP Planning        Department of Water Resources
Room 252-A                                   (916) 654-7668




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

Date: 04 Dec 1997 11:30:17 -0500
From: Jeff Murphy <jcmurphy+usenet@smurfland.cit.buffalo.edu>
Subject: dynamic libraries under solaris
Message-Id: <wwawwhl9ili.fsf@smurfland.cit.buffalo.edu>


i've recently installed perl5.004_04 under solaris and
have been having some problems getting some modules to work.

i realize that using gnu-ld isn't a good move, so i'm using
/usr/ccs/bin/ld as the linker when building these modules. 

[if you use gnu-ld you typically get the symbol relocation error
 message when trying to load the module]

but i'm still getting the message on some modules [snmp & mysql].
i've search around, but haven't found a good explanation of 
why this error occurs when using the gnu-ld to link objects.. 

can someone explain what happens when gnu-ld is used that causes 
the error?

jeff

-- 
opinions are mine unless stated otherwise.


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

Date: 4 Dec 1997 17:28:04 GMT
From: evenh@ra.pvv.ntnu.no (Even Holen)
Subject: Re: dynamic libraries under solaris
Message-Id: <slrn68dq1b.2qs.evenh@ra.pvv.ntnu.no>

In <wwawwhl9ili.fsf@smurfland.cit.buffalo.edu>
on 04 Dec 1997 11:30:17 -0500, Jeff Murphy wrote:
>i've recently installed perl5.004_04 under solaris and
>have been having some problems getting some modules to work.
>
>i realize that using gnu-ld isn't a good move, so i'm using
>/usr/ccs/bin/ld as the linker when building these modules. 
>
>[if you use gnu-ld you typically get the symbol relocation error
> message when trying to load the module]
>
>but i'm still getting the message on some modules [snmp & mysql].
>i've search around, but haven't found a good explanation of 
>why this error occurs when using the gnu-ld to link objects.. 
>
>can someone explain what happens when gnu-ld is used that causes 
>the error?

I'm not quite sure whether this will actually answer your question or
just produce a work-around or even worse be a total off-topic posting.
But I'll write this infor anyhow since I needed it my self a few days
ago...

I have recently tried to rebuild the module containing Mysql on a
solaris-system. The perl version I'm using is 5.004_04 and I got a
mystic error message when trying to do 'make test' on the module.

After a lot of plundering I discovered that if using gcc a compiler it
did have some problem locating the gcc-lib, so there was a hint on
compiling the mysql-libs saying: add '-L/usr/lib/... -lgcc' where '/...'
is to be the actual directory containing the libgcc.a-file. 

After digging around a while I found this file in
'/store/lib/gcc-lib/sparc-sun-solaris/2.7.2.1' (or something similar, most
probably you have /usr/lib... instead of /store/lib... ) and so I tried
to add this into the compiling of mysql. It didn't complaing, but things
still didn't work. That is the perl-module didn't work.

Finally I changed the Makefile.PL which came with the Mysql perl-module.
Within this file there is a sub called 'CheckForLibGcc' and I made this
look like: 

sub CheckForLibGcc() {
    return "-L/store/lib/gcc-lib/sparc-sun-solaris2/2.7.2.1/ -lgcc";
    # For reasons I don't understand the 'specs' file of some
    # gcc versions disable linking against libgcc.a in conjunction
    # with '-shared'. Unfortunately we need libgcc.a because of
    # some arithmetic functions.
   ...
}

In other words I bypassed the methods from CheckForLibGcc, which didn't
function in my case, with the output I knew I needed. And indeed it did
function like a charm after this modification...

I surely ought to find out why this method doesn't function, but at the
present time I don't have the time or energy to do that. But to make it
work I suggest you do a change like the one I made.

(The perl-module I talk about is Msql-Mysql-modules-1.1820 )

Regards,
Even Holen
-- 
<><   Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/   :-)


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

Date: Thu, 04 Dec 1997 11:32:40 -0600
From: Ken Holm <rets@meta3.com>
Subject: Re: eliminating part of file
Message-Id: <3486E938.1CFB@meta3.com>

Steve wrote:
> 
> I have a file that is read in using a perl script.  It then places the
> contents of a file back out to another file.  I want everything
> outputted to the new file, except for the <jdie> and </jdie> tags, and
> everything between them.  How do you go about that?  Thanks.
> 
> Steve

The following does not account for two sets of jdie on the same line. 
This should get you started though...

#!/usr/bin/perl5 -w

# Copyright(C) 1997 Kenneth A. Holm III
# All rights reserved
#
# See Licensing Info at http://www.metamall.com/rets/license.html
# If you find this script useful please send lots of money to
# Ken Holm
# POB 97536
# Jackson, MS 39288-7536
# rets@meta3.com


my $File = "file";
my $Line;
my $Flag = 0;

open (I, $File);
open (O, ">$File.new");
while (<I>){
    chomp;
    $Line = $_;
    if ($Line =~ /<jdie>/ && $Line =~ /<\/jdie>/) {
        $Line =~ s/<jdie>(.*)?<\/jdie>//g;
    } elsif ($Line =~ /<jdie>/) {
        $Flag++;
        $Line =~ s/<jdie>.*//g;
        print O $Line, "\n" if $Line;
        next;
    } elsif ($Line =~ /<\/jdie>/) {
        $Flag--;
        $Line =~ s/.*<\/jdie>//g;
        print O $Line, "\n" if $Line;
        next;
    }
    print O $Line, "\n" if ($Flag == 0);
}
close O;
close I;

exit;


-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Thu, 04 Dec 1997 10:20:37 -0800
From: Tom Jenquin <tom_jenquin@mgic.com>
Subject: finding .pm files and where to include 3rd party libs on Configure run
Message-Id: <3486F475.A8@mgic.com>

Now that its my job to update to Perl5.004_04 at our site I'd like some
simple info for running my sh Configure.

I'm running on Solaris 2.3 unix.

Question 1: In my perl programs I code a "use" statement to access .pm
files.  How do I tell perl (at Configure time) to also look for .pm
files in my application directory.

Question 2: I have added a C extension to perl that uses a Sun SNA
library.  I am making my extension static.  How do I tell perl (at
Configure time) to link with the Sun SNA lib. Or how do I specify its
use in the Makefile.PL in my extensions directory.


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

Date: Thu, 04 Dec 1997 16:23:33 -0800
From: Allen Choy <achoy@us.oracle.com>
Subject: Fully qualifying variables
Message-Id: <34874984.D70548E6@us.oracle.com>

Hi.

This concerns the strict pragma.

I was wondering if anyone has a good explanation why the strict pragma
would flag variables defined in a package needs to be fully qualified
and not subroutines?

Thanks!

allen



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

Date: 04 Dec 1997 17:31:20 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: mike@stok.co.uk (Mike Stok)
Subject: Re: Getting rid of non-Y2K Perl4 (was Re: Pattern matching (or not....))
Message-Id: <8cd8jcpr53.fsf@gadget.cscaper.com>

>>>>> "Mike" == Mike Stok <mike@stok.co.uk> writes:

Mike> If you're using perl for CGI scripts then when you move from 4 -> 5 it's
Mike> well worth considering apache/mod_perl to really speed things up as you
Mike> take advantage of the new features of perl 5 and the modules available
Mike> from CPAN.  If that's interesting then http://perl.apache.org and
Mike> http://www.perl.com are places to start looking.

Or, to avoid having to hunt for mod_perl, just remember:

	apache.perl.org

and

	perl.apache.org

Doesn't matter which order... just get'em both on there. :-) They both
point at the same archive.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 270 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 4 Dec 1997 17:34:36 GMT
From: evenh@ra.pvv.ntnu.no (Even Holen)
Subject: Re: getting username from htaccess
Message-Id: <slrn68dqdj.2qs.evenh@ra.pvv.ntnu.no>

In <661olc$k9u$1@hecate.umd.edu>
on 2 Dec 1997 19:47:56 GMT, Dennis Mercer wrote:
>Is there a way that you can use Perl to get the username from htaccess?
>I'm running on a Solaris machine with Perl 5.004_03.  The web server is
>Apache.  Thanks for your help.

If we're talking about how to access the username someone is logged in
as try $ENV{REMOTE_USER}. (If it fails with that then simply use the
script to the whole of %ENV, lots of good information there ).

If we're talking about how to access the file then it's simply to open
the file and parse each line till you find the given information.

Hope this helps, if not please clarify what you want!

Regards,
Even Holen
-- 
<><   Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/   :-)


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

Date: 4 Dec 1997 17:48:47 GMT
From: "Jeff Wilson" <jwilson@ic.ac.uk>
Subject: Re: How do I print all but the first variable in an array?
Message-Id: <01bd00dc$df0258c0$d53ec69b@leicester>

I see you've got lots of answers - here's another ...

	shift(@stuff); while(@stuff){print shift(@stuff),"\n";}

 ... if @stuff is expendable.
-- 

                                Jeff Wilson
                                London - UK

James Zubin Pope <jzp@usa.net> wrote in article
<3487a7be.28527677@news.demon.co.uk>...
> Hi there,
> 
> I am fairly new to perl and this is the situation I am in. I need to
> be able to print all but the first variable in a regular array. Do I
> make sense? Basically I have an array of:
> 
> @stuff
> 
> and I want to print $stuff[1] and $stuff[2] and $stuff[3] etc BUT NOT
> $stuff[0].
> 
> Is there a simple way of doing this? To make it more difficult is the
> fact that the pieces of data in the array are changing so it will not
> necessarily be the last 'x' amount in the array.
> 
> Any suggestions?
> 
> Cheers,
> 
> James.
> P.S. Could you forward any replies to my email aswell? Ta.
> 


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

Date: Thu, 04 Dec 1997 12:03:31 -0600
From: Ken Holm <rets@meta3.com>
To: jzp@usa.net
Subject: Re: How do I print all but the first variable in an array?
Message-Id: <3486F073.3F54@meta3.com>

The following works:  
perl5 -e 'my @List = ("This", "That", "And", "The udder"); print join "
- ", @List[1..$#List]; print "\n"'

A couple of items:

* $# is used to indicate the last element in the list (array)
* .. is used to indicate a span

so...

@List[1..$#List] reads "the elements from offset 1 to the last element
in the array List.

-K
-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Thu, 04 Dec 1997 10:51:13 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: looking for perl plotting interface
Message-Id: <3486DF7F.3E825D9B@houston.Geco-Prakla.slb.com>

Curtis Hrischuk wrote:

> Hi.  I am looking to graph some data points and I was wondering what
> packages exist.  I have looked that the Term::Gnuplot package but it
> seems too low level.  What I want is the equivelant of gnuplot, pass
> it a file of data points or strings and it plots it on the screen.  Is
> there a package out there that I haven't stumbled on?  Does anyone
> have some code or examples they want to share?
>

Is there something you want to do that gnuplot won't let you do?  I'm no
expert with gnuplot (or plotting in general for that matter), but it is
pretty good, I think.

I use it for printing graphs of disk space usage on several machines.  I
use Perl to create a "gnuFormatFile" that has things like:
set output "file.ps"
set terminal postscript
set xlabel = "Number of Samples"
set ylabel = "Megabyte"

I set several other options also.  Once the Perl script has created the
above gnuFormatFile, I then call gnuplot (like this:  gnuplot
gnuFormatFile) to create the graph (a postscript file for printing), and
exit.

It should be easy enough to put to your screen, using "set output X11"
(assuming you're using an xterm window under X Windows).  All the other
options are in the man pages (we don't have them installed here however,
but I've got a printed manual from off the web).

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: 4 Dec 1997 10:55:17 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Making crontabs (Was: switch stdout and stderr)
Message-Id: <666n9l$2ev@tekka.wwa.com>

seh@pecc.co.uk writes:
>Not such a good idea, the solaris man page (crontab (1))says:
>
>               Note:  All crontab jobs should be submitted  using
>               crontab;  you  should not add jobs by just editing
>               crontab file because cron will  not  be  aware  of
>               changes made this way.

That still means you can check if the crontab file exists.
crontab -l isn't the only way to find out ...

At any rate, have you tried IPC::Open3? It works very nicely.



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

Date: Thu, 4 Dec 1997 16:34:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Phil R Lawrence <prl2@lehigh.edu>
Subject: Re: mass mailings from Perl:  fonts?
Message-Id: <Pine.GSO.3.96.971204163331.4421f-100000@usertest.teleport.com>

On 4 Dec 1997, Phil R Lawrence wrote:

> Can I use different fonts printing from Perl?  

It sounds as if you're trying to control what your printer does. If so,
you should check its documentation. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 04 Dec 1997 12:19:37 -0600
From: Ken Holm <rets@meta3.com>
To: Hans Van Lint <hvanlint@lodestar.be>
Subject: Re: Parameter Checking
Message-Id: <3486F439.FF6@meta3.com>

Hans Van Lint wrote:
> 
> Is there a way to check if the data entered by a user in a form is an
> integer value??
> 
> (if data.value is integer then continue)
> 
> eg:
> 
> User fills in value -> 25
> Data entered is ok
> 
> User fills in value -> A5
> Gets message --> Please enter an integer value

If the data is in variable $in{number} then:

$response = ($in{number} =~ /^\d+$/) ? "OK" : "Enter integer";
print $response, "\n";

/^\d+$/ reads "starts with and ends with one or more digits"

-K

-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Fri, 05 Dec 1997 06:22:05 GMT
From: zentara@mindspring.com (zentara)
Subject: Re: Perl scripts to lookout for??
Message-Id: <34879c15.81068@news.mindspring.com>

On 3 Dec 1997 20:18:58 GMT, Zenin <zenin@best.com> wrote:

>zentara <zentara@mindspring.com> wrote:
>: I'm looking at PERL as the best language to spend time learning.

>zenin:
>	Good choice, IMO. :-)

>	Check out:
>		http://www.perl.com/CPAN-local/scripts/
>	for many good (and not so good...) examples.
>
>: What should I look for in the scripts as a general indicator of
>: "virus-like shenanigans"?  Since I don't know the language yet,
>: it would be nice to know a few "code snippets" to be on the
>: look out for.
>
>	system ("rm -rf /*");  ## :-)
>
 Heh, heh..... I hope you are not waiting at the CPAN site for
me, "like a cat waiting to pounce on a mouse".

I've read your postings and compared to me you are like a
big powerful wizard. 
Hopefully one day I will be able to rattle one-liners off
the top of my head like you guys.

Thanks for the nice reply.


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

Date: 4 Dec 1997 17:09:01 GMT
From: daveotlc@aol.com (Daveotlc)
Subject: perl with MS Access
Message-Id: <19971204170901.MAA01981@ladder02.news.aol.com>

I'm expanding an existing perl application to put data into an Access database,
then analyze it.  I'd appreciate information from anyone who knows the
programming interface between the two and can get me started.  Clues about
related documentation will also be welcome.

                       Enjoy,
                       Dave Olson
                       daveotlc@aol.com


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

Date: Thu, 4 Dec 1997 12:31:33 -0500
From: "Dave Kaufman" <davidk@nospam.cnct.com>
Subject: Re: perl with MS Access
Message-Id: <666qbh$qkb@world6.bellatlantic.net>

check out Dave Roth's Perl5 Win32::ODBC module, at http://www.roth.net/odbc/

The test script that comes with it shows you how to crete an Access DSN and
read it into perl.


- Dave Kaufman <davidk@cnct.com>
------------------------------------------------
Run, rabbit, run.
Dig that hole.  Forget the sun.
When at last the work is done,
Don't sit down, it's time to dig another one.
- Pink Floyd
------------------------------------------------

Daveotlc wrote in message <19971204170901.MAA01981@ladder02.news.aol.com>...
>I'm expanding an existing perl application to put data into an Access
database,
>then analyze it.  I'd appreciate information from anyone who knows the
>programming interface between the two and can get me started.  Clues about
>related documentation will also be welcome.
>
>                       Enjoy,
>                       Dave Olson
>                       daveotlc@aol.com



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

Date: Thu, 04 Dec 1997 12:34:27 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: perl with MS Access
Message-Id: <3486E9A3.66ED@gecm.com>

Daveotlc wrote:
> 
> I'm expanding an existing perl application to put data into an Access database,

Search dejanews on 'perl access'.


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

Date: Thu, 4 Dec 1997 17:01:39 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "David R. Adams" <dradams@bigfoot.com>
Subject: Re: printing and screen output
Message-Id: <Pine.GSO.3.96.971204165842.4421h-100000@usertest.teleport.com>

On Thu, 4 Dec 1997, David Adams wrote:

> If I use 
> 	print "thinking.";
> then
> 	print ".";
> then finally
> 	print "\n";
> 
> Nothing shows up on my xterm until the \n line. Any suggestions?

Check out your system's output buffering, and try the magical $| variable.
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 04 Dec 97 12:24:22 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Q: lambda fun, loop, string to expr
Message-Id: <3486e84d$3$ofn$mr2ice@speaker>

In <664vll$hp9$1@agate.berkeley.edu>, on 12/04/97 at 01:05 AM,
   ilya@math.ohio-state.edu (Ilya Zakharevich) said:
+-----
| > | This ain't no bug, but is very close to be one.
| > I wouldn't call it a bug, but I'd say that it's lagging behind the rest of
| > Perl --- after all, anonymous subs (i.e. "$a = sub { ... }") are a relatively
| > recent addition compared to "sort { ... } ...".
| Quite the opposite, it is going ahead of the rest of Perl, where you cannot
| call a chunk of code without an *enourmous* overhead.
+--->8

But you can't adapt that to Perl subs in general, since sort's BLOCK parameter
is deliberately optimized to skip some context setup.  Omit setting up the
context for subs in general and an awful lot of subs are going to break
horribly....

[sigh, "\@" turned out to be significant in ICE templates.  Corrected JAPH
follows] -- 
sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{$_}:$_}
split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!A\'6'.
"\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=new main;map{$b->_}split(//,' Brandon S. Allbery KF8NH');#:-)


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

Date: Thu, 04 Dec 97 12:29:25 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: RESOURCE KIT ANOMALY... ONE MORE TIME
Message-Id: <3486e8bf$4$ofn$mr2ice@speaker>

In <6655l8$ltq$1@srv38s4u.cas.org>, on 12/04/97 at 02:48 AM,
   lvirden@cas.org said:
+-----
| :If I recall correctly, the PRK setup tool uses the CPAN module.  The
| :CPAN module can't handle compressed files, although it can handle
| :gzipped files (CPAN::Config uses gzip, not compress) -- I believe that
| Strange - gzip handles compressed files just fine 
+--->8

If I had to take a wild guess, I'd suspect case-mapping:  gzip sees ".z" (as
opposed to ".Z") and tries to treat it as a System III/V "pack" file (Huffman
code, not LZW or LZ77).

-- 
sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{$_}:$_}
split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!A\'6'.
"\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=new main;map{$b->_}split(//,' Brandon S. Allbery KF8NH');#:-)


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

Date: 4 Dec 1997 10:31:09 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Resource Kit Anomaly
Message-Id: <666lsd$al@tekka.wwa.com>

ghowland@hotlava.com writes:
>The java stuff is, to be honest, piss poor.  I was hoping for a perl ->
>java bytecode compiler -

That's the impression I got. This is pretty disappointing.

>                       instead I got java with embedded perl - big
>deal!  Perl is trivial to embed, and this is just java with embedded
>perl, unless I'm much mistaken.  I shall be releasing a free version of
>*perl with embedded java* (as oppossed to Larry Wall's java with
>embedded perl) in the near future.  What I am proposing is embedding
>perl in java using a java extension, having a small java program to kick
>off perl in a thread so that control now lies with the perl interpreter,
>and then calling java functions from perl using perl extensions (!). 
>It's actually very straightforward.  If anyone would like to help me
>with this project, get in touch (and I'll set up a mailing list for
>developers etc.)
>
>Gary
>-- 
>pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
>Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06




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

Date: 4 Dec 1997 19:54:48 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Resource Kit Anomaly
Message-Id: <667jco$arm@panix.com>

In <comdog-ya02408000R0412971527010001@news.panix.com> comdog@computerdog.com (brian d foy) writes:
>In article <666lsd$al@tekka.wwa.com>, scribble@tekka.wwa.com (Tushar Samant) wrote:

>>ghowland@hotlava.com writes:
>>>The java stuff is, to be honest, piss poor.  I was hoping for a perl ->
>>>java bytecode compiler -
>>
>>That's the impression I got. This is pretty disappointing.

>i suppose that no one has considered this is the first release of a 
>perl->java thingy, and that things will get better?  certainly the
>author has a pretty good track record for that sort of thing :)

Yeah, grab a copy of Perl 1.0 at:

    http://www.oasis.leo.org/perl/src/perl1/00-index.html

Then see how fancy your Perl programs look. :)

-- 
Clay Irving <clay@panix.com>                   http://www.panix.com/~clay/


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

Date: 5 Dec 1997 00:38:19 GMT
From: "Katie" <katie@irenyx.com>
Subject: returning an associated array from a perl library
Message-Id: <01bd017a$264c1480$130232cc@univac.irenyx.com>

	Hi,
	
	I am building a perl library for use with numerous files. I am using an
include statement to include the files. In one of the library files there
is a function that I need to get to return an associated array to the
program that is calling the library file. Could anyone offer any
suggestions on the syntax etc. to use to get the array to return in full?? 

Thanks,
Katie


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

Date: Thu, 04 Dec 1997 12:28:56 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Setting default printer under Windows NT
Message-Id: <3486E858.6DEF@gecm.com>

charlot@cam.org wrote:
> I would like to know if it is possible to set the default printer of a Windows
> NT (3.51) server from Perl.  "Now why would you want to do that ?", you aks...
(deletia)
> Now for the difficult part (well, it's difficult to me anyways): some reports
> must be printed in "landscape" orientation.  The approach I am trying is to
> define two NT printers pointing to the same physical printer, but one in
> portrait mode and the other in landscape.  Now all I need is to switch the
> default printer when needed.  I tried mucking around in the registry, but

You can define a LPT1 port from the command line:

net use lpt1 /delete
net use lpt1 \\myprintserver\landscapeprintername


#!/usr/bin/perl -w
system 'net use lpt1 /delete';
system 'net use lpt1 \\\\MyPrintServer\\MyLandscapeDefinedPrinter';

Now print to LPT1.

Cheers,

Jim


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

Date: 4 Dec 1997 23:51:23 GMT
From: james@zaire.hooked.net (James Dornan)
Subject: sub in .pm!!!!!
Message-Id: <667flr$rri$1@its.hooked.net>

I created my first sub in a pm file and I wanted to use it to set all
kinds of variables. Unlike a sub from withing the script, it does not
share variale space. How do I change this?

-- james


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

Date: Thu, 04 Dec 1997 08:53:46 -0800
From: Michael Peppler <mpeppler@mbay.net>
To: Mark Strivens <mark@har.mrc.ac.uk>
Subject: Re: SybPerl
Message-Id: <3486E01A.192E@mbay.net>

Mark Strivens wrote:
> 
> I'm trying to compile SybPerl 2.08 on a Sun Solaris 2.5.1 machine
> using gcc 2.7.2.3 and CTlib version 11.1.
> 
> After running 'perl Makefile.PL;make' I get many errors, in the first
> compile step:
> 
> gcc -c -I/sybase/include -I/usr/local/include -I/opt/local/include -O
> -DVERSION=\"2.07\"  -DXS_VERSION=\"2.07\"  -fpic -I/opt/local/lib/perl5
> /sun4-solaris/5.00301/CORE -DCTLIBVS=100 -DSYBPLVER='"2.07"' -DDO_TIE
> CTlib.c
> 
> I get errors such as:
> 
> In file included from
> /opt/local/lib/perl5/sun4-solaris/5.00301/CORE/perl.h:104,
>                  from CTlib.c:26:
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:71:
> parse error before `fpos_t'

I suspect a problem with the way perl is installed at your site.
You may want to rebuild perl to try to fix it (you can rebuild it and
install it in an area of your home directory by setting the
prefix parameter in the Configure script).

Michael
-- 
Michael Peppler       -||-  Data Migrations Inc.
mpeppler@datamig.com  -||-  http://www.mbay.net/~mpeppler


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

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 1418
**************************************

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