[8008] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1633 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 14 00:30:17 1998

Date: Tue, 13 Jan 98 21:00:26 -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           Tue, 13 Jan 1998     Volume: 8 Number: 1633

Today's topics:
     Re: Comparing strings <joseph@5sigma.com>
     Re: Displaying GIFs <dformosa@st.nepean.uws.edu.au>
     Re: Displaying GIFs (Martien Verbruggen)
     Re: fastest way for two-dimensional arrays? <joseph@5sigma.com>
     Re: finding member of a list (Jonathan Feinberg)
     Re: getpwnam on Solaris not giving me password? <keithk@doubled.com>
     Re: getpwnam on Solaris not giving me password? <keithk@doubled.com>
     Re: getpwnam on Solaris not giving me password? <keithk@doubled.com>
     Re: getpwnam on Solaris not giving me password? (Clay Irving)
     Getting an error in dbmopen <rbala@quantum-usa.com>
     HELP! Digital Alpha binaries? - PreCompiled Perl module <j_schrab@execpc.com>
     Re: How do I convert 19971016085243 to time since the e (Clay Irving)
     Re: I'm nem at this (adding numbers) <rootbeer@teleport.com>
     Re: Multi-line input: fastest way? (Terry Michael Fletcher - PCD ~)
     Re: Objects as keys for a hash table (Gurusamy Sarathy)
     Re: Objects as keys for a hash table (brian d foy)
     Re: Objects as keys for a hash table (Martien Verbruggen)
     Re: OO in a big progect!? (brian d foy)
     Perl module/script for Yahoo-like grouping of links <erisa@benefitslink.com>
     Re: Perl module/script for Yahoo-like grouping of links (brian d foy)
     perl(unix) + iODBC <kenlo@hk.super.net>
     Re: PGP Plugin (Clay Irving)
     Please Help <jeff@cws1.com>
     Re: Please Help (brian d foy)
     processes and win95 (William Byrd)
     Re: serious post about gmtime and year-1900 <Russell_Schulz@locutus.ofB.ORG>
     Re: setuid wrapper program for perl4 script... <rootbeer@teleport.com>
     Re: Speed up a file write? (perl tricks in a cgi script <joseph@5sigma.com>
     Re: Speed up a file write? (perl tricks in a cgi script (Michael R Weholt)
     Re: Testing for valid numeric values <rootbeer@teleport.com>
     Re: Testing for valid numeric values <rootbeer@teleport.com>
     Re: unlink () doesn't work under NT (Xiao Gao)
     Using Perl and CGI for background execution <mhardy@ctp.com>
     Re: Where can I get the pre-compiled binariy "undump" f <joseph@5sigma.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 13 Jan 1998 20:25:30 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Comparing strings
Message-Id: <34BC301E.37721AD2@5sigma.com>

No, if he were writing his Perl in C, he'd be saying strcmp
something or other.

We teach the rule very simply: the operators that you use to compare
numbers look like algebra (<, >, ==, etc.) and the operators that
you use to compare strings look like words or FORTRAN (lt, gt, eq,
etc.).

	-joseph

Rich Grise wrote:
> 
> No, I think he means
>  if ($string1 eq $string2) {
> ...
>  and he's a perl newbie who's still writing his perl in C, much
> like myself! :)


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

Date: 14 Jan 1998 00:25:42 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Displaying GIFs
Message-Id: <884737521.464702@cabal>
Keywords: just another new york perl hacker

In <comdog-1301980207030001@news.panix.com> comdog@computerdog.com (brian d foy) writes:

>In article <34BBD83E.23A9@mediacity.com.sg>, @mediacity.com.sg posted:

>> I have *nearly* got this working but not quite (common cliche).

>>  open(FILE, "c:\\webdocs\\adengine\\xmas.gif");
>>  binmode FILE;
>>  print "Content-type: image/gif\n\n";
>>  print <FILE>;
>>  close(FILE);

>what happens when you try that from the command line?  do you get
>all the image data of just a bit? (hint: why are you only reading
>one line of input?)

I think its more that he hasn't opened the file for output '<' nor has he
tested the opening of the file '|| die('a horable death');'.

However 'print <FILE>;' will print more then one line of data.  It will
load the file into memoury with one big gulp, and print it out again.

As the file becomes larger this becomes less effinit.


--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. 
Support NoCeM http://www.cm.org/                   
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 14 Jan 1998 02:31:20 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Displaying GIFs
Message-Id: <69h81o$1cb$1@comdyn.comdyn.com.au>

In article <884737521.464702@cabal>,
	? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:

> I think its more that he hasn't opened the file for output '<' nor has he

'<' is for input, and that is default if no specifier is given. He
doesn't need to open any output, because he's printing to STDOUT.

> tested the opening of the file '|| die('a horable death');'.

yep, that was a booboo. In a follow up he corrected that.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd.       | clothes.
NSW, Australia                      | 


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

Date: Tue, 13 Jan 1998 20:43:25 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: fastest way for two-dimensional arrays?
Message-Id: <34BC3451.BD6E63C6@5sigma.com>

Well, $a[2][3] = 10 will work.

As to why it works, or what's going on, that would be a good
thing to consult the online documentation for.  man perldsc,
man perllol, etc.

Getting C subroutines in a Perl program is trickier.  You can create
dynamically loaded modules that contain compiled code (C, C++, or
whatever), but it's not a one afternoon project unless you're either
very smart or very lucky.  You can take a look at my "XSUB" example
on my web page: http://www.effectiveperl.com/toc.html.  Some things
with XSUBs are easy and some are pretty hard (and UNDOCUMENTED).  
Unless you're very clever you're better off changing your C to fit 
Perl's needs rather than trying to adapt Perl the other way.

	-joseph

Bernhard Freund wrote:

> What is the fastest way to create and access
> something comparable to a two-dimensional array?
> (Some lines of code would help me getting used to the syntax...)
> 
> How can get C-subroutines in my perl programs?


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

Date: Tue, 13 Jan 1998 20:56:54 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: finding member of a list
Message-Id: <MPG.f25e56ebd39327f9896aa@news.concentric.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to the cited author.]

rshadian@hawaii.edu said...
> Is there a Perl function for checking whether a particular scalar value is
> contained within a list/array (kind of like LISP's "member" function)?  I

This is a FAQ, answered at some length in perlfaq4.

http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq4.html

Enjoy.
-- 
Jonathan Feinberg    jdf@pobox.com    Sunny Brooklyn, NY


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

Date: Tue, 13 Jan 1998 21:52:34 -0500
From: Keith Keilholtz <keithk@doubled.com>
Subject: Re: getpwnam on Solaris not giving me password?
Message-Id: <34BC2872.361C5447@doubled.com>

Roy,

I'm trying to do the same thing.  My understanding is that most systems now use password
shadowing and you have to get the encrypted password from the shadow file using getspnam.  Once
you get the encrypted password, you can use the crypt function to check the new password.

I wrote a small c program (my c is very rusty) to retrieve the encrypted password using the
getspnam system routine, but I was getting *NP* returned as the encrypted password.  Don't know
why.  If anyone knows a perl solution or can further explain this issue, it would be greatly
appreciated.

-Keith






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

Date: Tue, 13 Jan 1998 21:50:17 -0500
From: Keith Keilholtz <keithk@doubled.com>
To: "Roy S. Rapoport" <rsr@best.com>
Subject: Re: getpwnam on Solaris not giving me password?
Message-Id: <34BC27E9.96162C6A@doubled.com>

Roy,

I'm trying to do the same thing.  My understanding is that most systems now use password
shadowing and you have to get the encrypted password from the shadow file using getspnam.  Once
you get the encrypted password, you can use the crypt function to check the new password.

I wrote a small c program (my c is very rusty) to retrieve the encrypted password using the
getspnam system routine, but I was getting *NP* returned as the encrypted password.  Don't know
why.  If anyone knows a perl solution or can further explain this issue, it would be greatly
appreciated.

-Keith






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

Date: Tue, 13 Jan 1998 21:54:09 -0500
From: Keith Keilholtz <keithk@doubled.com>
Subject: Re: getpwnam on Solaris not giving me password?
Message-Id: <34BC28D1.5FF98147@doubled.com>

Roy,

I'm trying to do the same thing.  My understanding is that most systems now use password
shadowing and you have to get the encrypted password from the shadow file using getspnam.  Once
you get the encrypted password, you can use the crypt function to check the new password.

I wrote a small c program (my c is very rusty) to retrieve the encrypted password using the
getspnam system routine, but I was getting *NP* returned as the encrypted password.  Don't know
why.  If anyone knows a perl solution or can further explain this issue, it would be greatly
appreciated.

-Keith






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

Date: 13 Jan 1998 22:56:30 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: getpwnam on Solaris not giving me password?
Message-Id: <69hd1e$bhb@panix.com>

In <34BC28D1.5FF98147@doubled.com> Keith Keilholtz <keithk@doubled.com> writes:

>I'm trying to do the same thing.  My understanding is that most systems now 
>use password shadowing and you have to get the encrypted password from the 
>shadow file using getspnam.  Once you get the encrypted password, you can 
>use the crypt function to check the new password.

>I wrote a small c program (my c is very rusty) to retrieve the encrypted 
>password using the getspnam system routine, but I was getting *NP* returned 
>as the encrypted password.  Don't know why.  If anyone knows a perl solution 
>or can further explain this issue, it would be greatly appreciated.

Check:

  AcctInfo.pm -- Module 
  http://www.wcnet.org/~jzawodn/perl/AcctInfo/index.html
  A Perl module for accessing and updating Solaris account information 
  (user's password, shell, home directory, account expiration information, 
  group membership, quota, etc.). 

ObPlug: Perl Reference/Solaris <http://reference.perl.com/query.cgi?Solaris>

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Tue, 13 Jan 1998 20:34:27 -0500
From: Ramesh Balasubramanian <rbala@quantum-usa.com>
Subject: Getting an error in dbmopen
Message-Id: <34BC1623.1B5F@quantum-usa.com>

Hi!
 I am a newbie to Perl and am getting the following error while
attempting a dbmopen with this syntax:
  dbmopen(%last_good,"lastdb",0666);
error: AnyDBM_File doesn't define a TIEHASH method

Why?

Thank you
--Ramesh.


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

Date: Tue, 13 Jan 1998 19:26:17 -0600
From: Jeffrey Schrab <j_schrab@execpc.com>
Subject: HELP! Digital Alpha binaries? - PreCompiled Perl modules on WinNT
Message-Id: <69h47p$sdk@newsops.execpc.com>

I am looking for help to find a resource for pre-compiled Perl modules
(specifically, DateCalc) that are Windows NT 4.0 ready ... Digital Alpha
binaries.  I know this is a tall order.

Am I correct that there is *not* available an Alpha version of the gcc
compiler?  I would give a swing at doing it myself if there was.
Because I really only need DateCalc (for some cookie expiration date
calculations), I cannot justify getting a commercial compiler.

Otherwise, does any one have some source for simple date math that would
work in lieu of a full blown Perl extension module?

(Please cc any replies to jschrab@royle.com)

THANKS FOR *ANY* HELP!

BTW, I have been working with Perl for about two weeks.  This is kinda
neat!  The Perl community may have another convert.

AppleScript on the other hand... :(

--

<POOF!>

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

"In the end, I wonder if one of the most important steps on our journey
is
 the one in which we throw away the map.  In jettisoning the grids and
 brambles of our own preconceptions, perhaps we are better able to find
the
 real secrets of each place; to remember that we are all extensions of
our
 collective history."

 Loreena McKennitt - from the album "The Book of Secrets"
-----------------------------------------------------------------------------





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

Date: 13 Jan 1998 22:48:02 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: How do I convert 19971016085243 to time since the epoch??
Message-Id: <69hchi$ahg@panix.com>

In <01bd2057$f7289f00$48a30193@lonw3633> "Toby Ounsted" <tkounste@bechtel.com> writes:

>	I'm trying to use perl to parse some log files.  The string 19971016085243
>specifies the date that an event occoured, i.e. Year=1997, Month = 10th,
>Day =16th, time was 08:52:43 AM.  What I would like to do is to convert
>this string into the number of seconds since the epoch, in order that I can
>correlate the results and builtd up a table showing the frequency of the
>event over time.  Does anyone know of an easy way of doing this, or am I
>going to have to write a conversion routine from scratch?  I saw some time
>conversion routines on www.perl.com but sadly have not been able to get
>these working under perl for NT.  

Here's a start. Unpack the string:

  $string = "19971016085243";

  ($year,$mon,$day,$hour,$min,$sec) = unpack(a4a2a2a2a2a2, $string);

If you can get Date::Parse to work, you're there. 

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Tue, 13 Jan 1998 20:18:07 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Toby Potts <potts@hc.ti.com>
Subject: Re: I'm nem at this (adding numbers)
Message-Id: <Pine.GSO.3.96.980113201251.22337O-100000@user2.teleport.com>

On Mon, 12 Jan 1998, Toby Potts wrote:

>   This is the deal. After open a file from the input line and appending
> to it. I want to find or match all
>  numbers and add them together and print sum to screen. 

You'll have to define "numbers" before anyone can tell you how to find or
match them. I consider these to be numbers:  one googol, pi, "the smallest
whole number which cannot be uniquely described with fewer than fifteen
words", 1-800-JUNK-MAIL, and infinity. :-)

> This can be used
> for any file, but I will be using
>  for a file of time records.

I don't know what you mean by that.

> #!/apps/dad/bin/perl5 -w
> ##############################################
> print "Input File name = ";
> chomp($in=<STDIN>);
> open(FILE, ">>$in") || die "Cant open $in";

If it's an input file, why are you opening it for appending?

> print "What to append to file?: ";
> $line = <>;

That may or may not read from the standard input stream. 

> print FILE "$line";
> close FILE;
> system "more $in";

I don't see how this program relates to the task at hand. 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: 14 Jan 1998 03:04:17 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Multi-line input: fastest way?
Message-Id: <69h9vh$9f5$1@news.fm.intel.com>

Kevin Reid (kpreid@ibm.net) so eloquently and verbosely pontificated:
> Is there a better way to implement line continuations?
> 
>   $U_prompt = eval(qq|"$U_config{prompt}"|); 
>   print $U_prompt, "> ";                     # display prompt
>   chomp($U_code = <STDIN>);                  # get line
>   while ($U_code =~ /\\$/) {                 # if backslashed...
>     chop $U_code;                            # remove backslash
>     print " " x length($U_prompt), "> ";     # print cont. prompt
>     chomp($U_code .= "\n".<STDIN>);          # append string
>   }

the magic expression i have preferred to use is:

 $_ .= <> while s/\\\s*//;

for all my STDIN -> STDOUT compilers.  but those don't use prompts.

for a simple "shell-type" application (like yours?), i would use a for()
loop like so:

$U_input = "input";

for (print "$U_input> "; <>; print "$U_input> ") {
        $_ .= <> while s/\\\s*$// and print " "x length($U_input) ."> ";

	# your statement is now ready here....  you may need to chomp.

}

hope that helps.

-- 
#!/usr/local/bin/perl -w- tfletche@pcocd2.intel.com
sleep 1;$"=(time-$^T)<<1;$SIG{ALRM}=sub{print};${q$_$}=join"",
map{chr(hex)}split/(..)/,"4a75737420";alarm$";<>;s y(\0\w){4}.
?yreverse q brehtonabyex;alarm$";<>;for(;length>4;chop){}tr&to
an&empti&;alarm$";<>;s@$_@reverse',ret'.q csaw c@e;alarm$";<>;


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

Date: 14 Jan 1998 00:57:53 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Objects as keys for a hash table
Message-Id: <69h2ih$ak7@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <34BC00BC.C55AEFD6@us.oracle.com>,
Allen Choy  <achoy@us.oracle.com> wrote:
>keys.  When
>I try to retrieve the objects via key %hash, I get the objects, but
>they're no
>longer objects.  Is this the intended behavior?  And how does anyone
>have
>a decent workaround for this?

`perldoc Tie::RefHash`
and
tie %your_hash => 'Tie::RefHash';

 - Sarathy.
   gsar@umich.edu





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

Date: Tue, 13 Jan 1998 20:34:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Objects as keys for a hash table
Message-Id: <comdog-ya02408000R1301982034250001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34BC00BC.C55AEFD6@us.oracle.com>, Allen Choy <achoy@us.oracle.com> posted:

>I cached a list of objects using a hash table, with the objects as
>keys.  When
>I try to retrieve the objects via key %hash, I get the objects, but
>they're no
>longer objects.  Is this the intended behavior?  And how does anyone
>have
>a decent workaround for this?

the hash key is stringified before it is used as a key.  it looks
like when you use the object reference as a key, the reference
address (i.e. HASH(0x253d30c) or some such) is turned into a literal
string and then used as the key.  once you get a list of keys, there 
is nothing special about that sequence of characters.  it seems to 
me that there would be more problems than benefits if hash keys could 
be anything more than simple scalars.

as for workarounds, that depends on what you are trying to do.  a
more complex data structure is probably appropriate, but maybe
you could get away with an array.  perhaps if we knew what you
were trying to accomplish we could have better suggestions :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 14 Jan 1998 01:31:41 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
To: Allen Choy <achoy@us.oracle.com>
Subject: Re: Objects as keys for a hash table
Message-Id: <69h4ht$13s$1@comdyn.comdyn.com.au>

[Posted and Mailed]

In article <34BC00BC.C55AEFD6@us.oracle.com>,
	Allen Choy <achoy@us.oracle.com> writes:

> I cached a list of objects using a hash table, with the objects as
> keys.  When I try to retrieve the objects via key %hash, I get the
> objects, but they're no longer objects.  Is this the intended

The key into a hash most likely has to be a scalar, and will most
likely always be interpreted as a 'string'. This means that at the
moment you use your object reference as a hash key, it probably gets
forced into a string representation (possibly the same way as scalar()
does). This means that 'keys %hash' returns a list of string
representations of your objects, but not the references.

I might be wrong in this, but I suspect that that is what happens.

> behavior?  And how does anyone have a decent workaround for this?

I'd probably store the references in an array. Isn't that how you
intend to use them anyway? You want 'keys %hash' to return an array of
object references. Why not store them in an array to begin with? If
you don't want to deal with indices into the array, use shift,
unshift, pop and push to manipulate it. 

I am not sure why you want it stored in a hash table, but maybe you
have reasons for that that we don't know about yet, and that need to
be worked around. Is there anything stored in the values of the hash?
You could have a second array for that. Alternatively, you can store
some unique representation of your object (it's address or so), and
store a reference to the object as the value.

my %hash = ();
my %hash2 = ();
my @array = ();
my @array2 = ();

while (# loop condition here #)
{
	my %localhash = ();
	# ...
	my $obj = new Foo::Bar;
	# ...
	$hash{scalar($obj)} = $obj;

	$localhash{reference} = $obj;
	$localhash{other_value} = 1;
	$localhash{yet_other_value} = 2;

	$hash2{scalar($obj)} = \%localhash;

	# or..
	push @array $obj;
	push @array2 \%localhash;
}

Or something like that. The 'scalar($obj)' returns a string
representation of your object, which looks sort of like:
"Foo::Bar=HASH(0xdca78)". Since the number in there should be unique,
the key is unique. But I still fail to see why you'd need to do that.
Unless you need to do some sort of fast lookup for an object, I'd go
for the array approach.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Tue, 13 Jan 1998 23:20:01 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: OO in a big progect!?
Message-Id: <comdog-ya02408000R1301982320010001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34BBE577.41C6@fccc.edu>, Ying Hu <Y_Hu@fccc.edu> posted:

>I am programming in Perl/Tk for a big project in which there are some 
>interfaces for users to use Internet, Database ,Biostatistic software 
>and bioinformatic software .... But I am not sure that I must OR
>have to OR should use Perl-OO (object oriented module method) in
>the project.

there is nothing that fundamentally requires you to program in any
particular paradigm.  i tend to do any large project in a mostly
OO fashion though.  

> If using
>OO method, the speed will be slow in the big project?

depends on how efficiently you can code the alternatives, but i
would expect the OO method to take more CPU time and more memory,
however, i tend to think that the savings in programming time, cost,
and maintenance that comes along with OO outweighs those
concerns.  good modules/classes will make script writing very
easy and you'll have a lot more flexibility later.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 14 Jan 1998 03:32:07 GMT
From: Dave Baker <erisa@benefitslink.com>
Subject: Perl module/script for Yahoo-like grouping of links
Message-Id: <34bc30bd.6235052@news.magicnet.net>

I know there's such an animal out there, but I've had no luck
searching CPAN.

 I believe there was a similar question in the newsgroup a couple of
months ago, and someone said there is a module already. No luck
searching Deja News either.

Can anyone help? Thanks.

Dave Baker


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

Date: Tue, 13 Jan 1998 23:14:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl module/script for Yahoo-like grouping of links
Message-Id: <comdog-ya02408000R1301982314530001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34bc30bd.6235052@news.magicnet.net>, Dave Baker <erisa@benefitslink.com> posted:

>I know there's such an animal out there, but I've had no luck
>searching CPAN.

that's because i don't distribute it for free [1].  however, i'm happy
to discuss any questions you have related to the Perl implementation
of such a beast.

[1]
don't ask because you can't afford it

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 14 Jan 1998 10:51:18 +0800
From: "Kenneth LO" <kenlo@hk.super.net>
Subject: perl(unix) + iODBC
Message-Id: <69h91j$618$1@tst.hk.super.net>

Anyone uses perl on unix with iODBC ? I tried the iODBC extension module by
J. Michael Mahan (mahanm@nextwork.rose-hulman.edu) but it can't work with
the iODBC-myODBC package by Giovanni Maruzzelli (http://www.matrice.it)




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

Date: 13 Jan 1998 21:58:47 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: PGP Plugin
Message-Id: <69h9l7$6r7@panix.com>

In <34bb9a8e.25117814@news.sol.co.uk> mguz@sol.co.uk (Mark Guz) writes:

>Anyone recommend a good pgp plugin for perl???

Let's see... I searched Perl Reference for PGP and got:

      PGP library for Perl 
      This library contains a suite of PGP modules for Perl. Many of 
      the modules require the Systemics Cryptix 1.1 library. 

      PGP::Sign 
      This module creates and checks detached signatures for data. 

      PGPHTML 
      A perl script to make PGP signed web-pages. 

      PGP 
      An interface to the Pretty Good Privacy public-key cryptography system. 

What kind of "plugin" do you need?

Perl Reference <http://www.reference.perl.com>

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Tue, 13 Jan 1998 20:02:48 -0800
From: "Jeff Marsh" <jeff@cws1.com>
Subject: Please Help
Message-Id: <69hd40$edp@sjx-ixn4.ix.netcom.com>

I would appreciate any help that anyone can give me here...

I have a script that reads a text file where the information is delimited by
carriage return. How do I tell the script to look for the return and split
values accross it???

Here is the code fragment so far...

open ($file,"test.txt");
@Balance = split( ##Put carriage return here!!##, <$file>);
foreach $pair (@Balance) {
	($name, $value) = split('=', $pair);
	@first[$count] = $name;
	@second[$count] = $value;
	$count = $count+1;
}

the text file looks like:

FName=first name
LName=last name
Add1=primary address

-----
Please help..

--=Jeff=--
jeff@cws1.com


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

Date: Tue, 13 Jan 1998 23:26:10 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Please Help
Message-Id: <comdog-ya02408000R1301982326100001@news.panix.com>
Keywords: from just another new york perl hacker



Please check this information on how to choose a good subject for a post:
        http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post


In article <69hd40$edp@sjx-ixn4.ix.netcom.com>, "Jeff Marsh" <jeff@cws1.com> posted:

>I have a script that reads a text file where the information is delimited by
>carriage return. How do I tell the script to look for the return and split
>values accross it???

assuming that you set $/ (aka $INPUT_RECORD_SEPARATOR) appropriately...

>open ($file,"test.txt");

remember to check your return values!

   open FILE, 'test.txt' or die "$!";

>@Balance = split( ##Put carriage return here!!##, <$file>);

   my $line    = <FILE>;
   my @balance = split /\r/, $line;

data are data.  split doesn't care about any characters that we
happen to perceive as special. :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 14 Jan 1998 03:18:07 GMT
From: wcb4@erols.com (William Byrd)
Subject: processes and win95
Message-Id: <69h4sv$aen$1@winter.news.erols.com>

If this is not a question within the scope of this newsrgoup, please
pointmein the right direction.

Is it possible from perl to determine the win95 eqiv of a process ID
number, stop it and then re-run it as a "forked" (not a unix hacker so
I'm not sure I am using the right syntax.

What I want is a remote way to flush server logs. I have toyed with
the idea of running two servers www.mydomain.org and
admin.mydomain.org and having a script on admin.mydomain.org stop
www.mydomain.org, erase the log files and then re-run
www.mydomain.org.

I can not use a normal exec command to re-run the program (I believe)
because the calling admin.pl will not terminate until the process it
spawns (running www.mydomain.org) has termineted, which will not
happen (hopefully)

I know that the final use is a cgi, but I am looking for a perl method
finding a certain PID or a running application other than that
incarnationj of perl itself, stopping that PID and then spawning an
independant process???


any help would be appreciated.


-----------------------------------------------------
Please always check the syntax before applying any fix 
anyone gives you on a newsgroup, no one is perfect. 
Not everyone reads the newgroups every day, but most 
check their e-mail. A private e-mail with the answer
as well as the NG posting is often appreciated. 
Just my 2 cents worth.



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

Date: Tue, 13 Jan 1998 14:24:15 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: serious post about gmtime and year-1900
Message-Id: <19980113.142414.0Z1.rnr.w164w@locutus.ofB.ORG>

mgjv@comdyn.com.au (Martien Verbruggen) writes:

> Also, $year is the number of
> years since 1900, I<not> simply the last two digits of the year.
>
> Also, $year is the number of
> years since 1900, that is, $year is 123 in year 2023.

it's true; the shorter one (with an example) _is_ better.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Tue, 13 Jan 1998 20:31:12 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Bob Hewitt <bhewitt@orca.akctr.noaa.gov>
Subject: Re: setuid wrapper program for perl4 script...
Message-Id: <Pine.GSO.3.96.980113202441.22337P-100000@user2.teleport.com>

On Mon, 12 Jan 1998, Bob Hewitt wrote:

>   I've been trying to create and run a setuid C wrapper program such as
> is described in the perlsec man page (We have perl 4.036 on SGI with
> IRIX 5.3 here.

Eek! Perl 4 has serious security issues; are you sure that you wish to run
it set-id?

> We should be getting perl5 when IRIX 6.2 is installed. 

Good; 5.004 resolved many security issues.

> I have not found either 'taintperl' or 'suidperl' here.) 

Perhaps you should complain to whoever supplied you with your perl binary. 
(And you should ask them to help you compile 5.004, if you can't compile
it yourself.) 

> Anyhow, I always get "Can't run setuid script with taint checks." when I
> run that wrapper program. I expected the wrapper program to handle that
> problem. 

If perl sees that your script is running set-id, it will run it under
suidperl, as I understand things. (If you make your wrapper relinquish all
special privileges and run the script solely under the new uid and gid,
you should be able to avoid that. But be careful, please; I think you'd
also be avoiding taint checking.) 

> The script to be run is under another home directory, with a first line
> like:
> 
> #!/usr/bin/perl -wU

Why do you want -U ? I'm afraid to ask. :-)

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: Tue, 13 Jan 1998 20:16:54 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Speed up a file write? (perl tricks in a cgi script?)
Message-Id: <34BC2E1A.82E3A625@5sigma.com>

One more stylistic comment.  Personally I would use a "here doc" string
to print stuff like this rather than a whole bunch of print statements.
It won't make much difference efficiency-wise but it looks cleaner:

  print <<EOT;
  Here is a line.
  Here is a line with $a and $b in it.
  Here is another line with the value of $c in it.
  Here is a demonstration of the @{[func($x, $y)]} hack.
  Here is yet another line.
  EOT

Also bear in mind that strings can contain newlines, and you can
use alternative quoting characters:

  print qq{This is a double-quoted string.
  This is another line.};

	-joseph
	 http://www.effectiveperl.com

Michael R Weholt wrote:
> 
> In article <34BBB700.C347CFD9@5sigma.com>,
> joseph@5sigma.com wrote:
> >
> >Do you have any idea whether the print statements are taking
> >up the time, or whether the time is being spent starting
> >up the Perl interpreter and loading Text::Wrap?
> 
> Ah.  Good clue.  I inserted some timing marks into the loop on either
> side of the call to print via wrap and discovered the individual print
> statements don't even show up on the radar [...]h


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

Date: Wed, 14 Jan 1998 04:26:59 GMT
From: awnbreel@panix.com (Michael R Weholt)
Subject: Re: Speed up a file write? (perl tricks in a cgi script?)
Message-Id: <69heqj$2j0_002@mrw.panix.com>

In article <34BC2E1A.82E3A625@5sigma.com>, 
joseph@5sigma.com wrote:
>One more stylistic comment.  Personally I would use a "here doc" string
>to print stuff like this rather than a whole bunch of print statements.
>It won't make much difference efficiency-wise but it looks cleaner:
>
>  print <<EOT;
>  Here is a line.
>  Here is a line with $a and $b in it.
>  Here is another line with the value of $c in it.
>  Here is a demonstration of the @{[func($x, $y)]} hack.
>  Here is yet another line.
>  EOT

Whoa.  First I've heard of it.  This is referred to as a "here 
doc" string?  What's the <<EOT; do?  Tell the machine to print 
everything after it until it gets to EOT?  How would I use that to 
print to a file?

print FN <<EOT;  (?)

>Also bear in mind that strings can contain newlines, and you can
>use alternative quoting characters:
>
>  print qq{This is a double-quoted string.
>  This is another line.};

and this would be

print FN qq{ ... };   (?)

Thanks.

-- 
 mrw


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

Date: Tue, 13 Jan 1998 20:11:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matthew Cravit <mcravit@best.com>
Subject: Re: Testing for valid numeric values
Message-Id: <Pine.GSO.3.96.980113201023.22337N-100000@user2.teleport.com>

On 12 Jan 1998, Matthew Cravit wrote:

> sub IsNumeric($) {
> 	$_[0] =~ m/\D/ ? 0 : 1;
> }

You've got to be kidding!

> if IsNumeric "123.4567" {
> 	print "Numeric!\n";
> }
> else {
> 	print "Not numeric!\n";
> }

What did your copy of Perl print when you tried that?

-- 
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: Tue, 13 Jan 1998 20:45:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Porter <jdporter@min.net>
Subject: Re: Testing for valid numeric values
Message-Id: <Pine.GSO.3.96.980113204121.22337Q-100000@user2.teleport.com>

On Tue, 13 Jan 1998, John Porter wrote:

> Matthew Cravit wrote:
> > 
> > sub IsNumeric($) {
> >         $_[0] =~ m/\D/ ? 0 : 1;
> > }

> This subroutine returns True for arguments such as
> "Half-baked g0ggle-b0x d0-g00ders..."

It's a lousy subroutine, but that argument makes it return zero, a false
value. Of course, what makes it so lousy is that numbers like "1.25",
"1776 ", and "-10" also make it return a false value, even though "" makes
it return a true value.  :-P

-- 
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: 14 Jan 1998 03:19:10 GMT
From: Ko Kin (Xiao Gao) <ckko@cse.cuhk.edu.hk>
Subject: Re: unlink () doesn't work under NT
Message-Id: <69hare$e9n@eng-ser1.erg.cuhk.edu.hk>

Jeremy D. Zawodny <jzawodn@wcnet.org> wrote:
> What error did it issue?

But it says nothing.

I wrote:

unlink ("$jukebox[$i]\\$date\\*") || warn ("cannot delete files\n");
($jukebox[$i] - a:, $date - 19980114)
and it just says cannot delete files.

Of course, the disk is not write-protected, and the files are not open.

Thanks.

--
Regards,
KoKin


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

Date: Tue, 13 Jan 1998 22:47:35 -0600
From: Mike Hardy <mhardy@ctp.com>
Subject: Using Perl and CGI for background execution
Message-Id: <34BC4367.C5114E1@SPAMLESSctp.com>

Hi, I rooted around in faqs for a good long time and was unable to come
up with a satisfactory answer, though it may be simple.

I'm using the JavaWebServer (kinda interesting, as an aside) 1.0.3, on
an HP-UX 10.20 machine with Perl 5.004_4 and cgiwrap to execute
the cgi script as the user I want.

Everything CGI seems just fine and dandy except that no matter what I
try to do, the server waits on all children to exit before it will
display the page that the script generated.

This is a problem because one of the things the script does is fire off
a huge, time-consuming job that I certainly don't want to wait for :-)

I have tried:

system("<job> &");

a fork, then having the child do an exec "job";

I dunno what else I can try, but I thought a fellow perl-ster might have
encountered this. If you want more info, or feel I should look elsewhere
I'd be happy to give or take pointers.

TIA,
Mike


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

Date: Tue, 13 Jan 1998 20:22:52 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Where can I get the pre-compiled binariy "undump" for Linux?
Message-Id: <34BC2F7F.C553D55B@5sigma.com>

I wouldn't mind it if the "dump" operator went away.  It's
pretty funny, or pathetic, or whatever, to watch a programmer
who is trying to use a function named dump.

	-joseph

Russ Allbery wrote:
> 
> Martien Verbruggen <mgjv@comdyn.com.au> writes:
> 
> > perldoc perlfaq3
> > /What is undump
> > [PgDn]
> > [SNIP]
> > The undump program was an old attempt to speed up your Perl
> > program by storing the already-compiled form to disk.  This
> > is no longer a viable option, as it only worked on a few
> > architectures, and wasn't a good solution anyway.
> > [SNIP]
> 
> > I guess that because it is an old perl specific utility, it is
> > appropriate on c.l.p.misc.
> 
> undump isn't a Perl-specific utility.  It was a general program to do this
> sort of thing, and was in fact part of TeX for many years.  (Since TeX's
> build process has always involved loading the standard support code and
> then dumping a memory image.)  [...]


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

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

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