[16338] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3750 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 19 18:06:26 2000

Date: Wed, 19 Jul 2000 15:05:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964044317-v9-i3750@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 19 Jul 2000     Volume: 9 Number: 3750

Today's topics:
    Re: Attatchments from client (Cameron Laird)
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!! <smerr612@mailandnews.com>
    Re: ATTENTION PERL MEATHEADS <godzilla@stomp.stomp.tokyo>
        automated filling of html/cgi-pages <smeagel@firemail.de>
    Re: bless loses inheritance? nobull@mail.com
    Re: bless loses inheritance? (Anno Siegel)
        command line options(on win98) <nair@ee.tamu.edu>
        Counter Problem <steve@gte.net>
    Re: Counter Problem paydro@my-deja.com
        counting substrings (Jim Quinn)
    Re: counting substrings <tony_curtis32@yahoo.com>
    Re: counting substrings <tina@streetmail.com>
    Re: counting substrings (Jim Quinn)
    Re: counting substrings <tony_curtis32@yahoo.com>
    Re: counting substrings (Abigail)
    Re: counting substrings <tony_curtis32@yahoo.com>
        Date on Win32 Rephrased <vibrato@my-deja.com>
    Re: Date on Win32 Rephrased <tony_curtis32@yahoo.com>
    Re: Date on Win32 Rephrased <jraff@home.com>
    Re: Date on Win32- Answer <vibrato@my-deja.com>
        Date on Win32 <vibrato@my-deja.com>
    Re: Date on Win32 <noemail@noemail.com>
    Re: DB_File question. (Anthony DeLorenzo)
        Explanation needed for "Security Audit and Taint Check" <tangb@pt.cyanamid.com>
    Re: File handling problems!! <craig.arnold@boeing.com>
        flock <jaigan@umr.edu>
        humbly parsing Perl jdimov@cis.clarion.edu
        More Info: Question: system () from C++ CGI to Perl .pm <lwilcox@emory.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 19 Jul 2000 13:07:19 -0500
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: Attatchments from client
Message-Id: <FA608464DBB2CF93.3E4F35D08E30A5B6.21B722478319AFEF@lp.airnews.net>

In article <3975E477.3EC5D2C2@muskegon.k12.mi.us>,
 <cpoole@muskegon.k12.mi.us> wrote:
>I have a  cgi form on our UNIX server I'm using to request particular
>information.  Along with this information the user who accesses this form
>will be required to attatch a file from their PC, most likely a MS Word
>document.  The CGI form is on our UNIX server and the file that needs to be
>attatched is on any users personal computer.    The form will be access from
>the users PC via Netscape Navigator.
>
>My question is what code do I put in the PERL script, which resides on the
>server, such that it will include a attatchment, where the file that needs
>to be include resides on the users personal computer?
			.
			.
			.
There's no particularly finite answer to this question.

The least painful way to proceed is to arrange for client-
side selection of the client-side file, followed by an
HTTP upload of the file to create a temporary file on the
server, followed by what should be for you a straightfor-
ward attachment of the temporary file in your e-mail item.

This has essentially nothing to do with sendmail, and barely
more with Perl.

Do you need help with a Web file upload?
-- 

Cameron Laird <claird@NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


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

Date: Wed, 19 Jul 2000 20:16:17 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!
Message-Id: <8l529v$88l$1@nnrp1.deja.com>

In article <m1k8ej56yh.fsf@halfdome.holdit.com>,
  merlyn@stonehenge.com (Randal L. Schwartz) wrote:

> Nope.  I'm referring to statements made by our pseudonyminal troll,
> <p3rlc0dr@my-deja.com>, whom I now believe I have a good guess as to
> the actual identity, or at least understand the person whom this
> person most highly respects.  Cool.

???  I'm not sure I understand what you're saying.  You have a good
guess as to p3r1c0dr's real identity?  Or you're saying you can
understand this person's behavior because you understand the mindset of
the kind of person who could highly respect the person p3r1c0dr
respects?  Or are you saying that even if you're wrong about p3r1c0dr's
identity, at least you've come to some understanding of Tom?

If it is Tom, I seriously doubt we'd be able to track him, he'd have
covered up his trail very well.  And I, for one, don't believe he'd
troll the group, no matter how much of pain he can be at times, he
decided his time is too valuable to waste on this group once the s/n
ratio got out of hand way back, why would he do something here now which
is guaranteed to be a waste of time?

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 19 Jul 2000 14:08:55 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: ATTENTION PERL MEATHEADS
Message-Id: <397618E7.2B2C336F@stomp.stomp.tokyo>

Steven Merritt wrote:
 
>   merlyn wrote:
 
> > Nope.  I'm referring to statements made by our 
> > pseudonyminal troll, <p3rlc0dr@my-deja.com>, whom
> > I now believe I have a good guess as to the actual
> > identity, or at least understand the person whom this
> > person most highly respects.  Cool.
 
> ???  I'm not sure I understand what you're saying.  You
> have a good guess as to p3r1c0dr's real identity?  Or you're
> saying you can understand this person's behavior because you
> understand the mindset of the kind of person who could highly
> respect the person p3r1c0dr respects?  Or are you saying that
> even if you're wrong about p3r1c0dr's identity, at least you've
> come to some understanding of Tom?
 
> If it is Tom, I seriously doubt we'd be able to track him, he'd
> have covered up his trail very well.  And I, for one, don't believe
> he'd troll the group, no matter how much of pain he can be at times,
> he decided his time is too valuable to waste on this group once the
> s/n ratio got out of hand way back, why would he do something here 
> now which is guaranteed to be a waste of time?


Are you suggesting all these previous claims and factual 
pronouncements by long time regulars here, of Ganesha 
being none other than myself, are false? Well I'll be.

Sometimes I feel like Isabella Rossellini trying to deal
with Dennis Hopper doing his inhaler thing in Blue Velvet.

Ganesha, don't you think me the best mistress of subtlety.
Tell ya, these boys have permanently misplaced common sense.
They truly need to get their snoopy ways better organized.

* enjoys a forever silent laugh *

Godzilla!


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

Date: Wed, 19 Jul 2000 20:23:00 +0200
From: Mario Scholz <smeagel@firemail.de>
Subject: automated filling of html/cgi-pages
Message-Id: <MPG.13e0106f12c19025989681@news.uni-erlangen.de>

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

Hi,

is it possible to automate filling html-pages with cgi-inputboxes and 
send them back to the server with perl ? Perhaps with the use of lynx ?

If it is possible, how can I do this ?

thanks

Mario Scholz


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

Date: 19 Jul 2000 18:56:30 +0100
From: nobull@mail.com
Subject: Re: bless loses inheritance?
Message-Id: <u94s5mypf5.fsf@wcl-l.bham.ac.uk>

up2l8@my-deja.com writes:

>  say that there is a $o such that ref($o) = "X";
>  and there exists an A::methoda
>  and there is also a B::methodb
>  and A isa B.
>  then

Rather than _saying_ all this you should write it in actual (strict,
warning-free) Perl, test that it actually does what you say then cut
and paste the actual complete code into your post.  Often, as in this
case, you will find the Perl code is no longer than the prose.  Also
the exercise of doing this will often find the problem for you thus
saving everybody's time.

If we can actually run your actual code that actually produced
unexpected output then we can and actually reproduce or (actually
fail to reproduce) the actual behaviour you actually saw.  There can
be no possibility for misinterpretation of your description.

Why do we have to keep on saying this in every programming newsgroup?
Why do people find it so hard to accept?  This is not a rhetorical
question.  I really want to know why you, Eric, decided to post to
comp.lang.perl.misc having ignored one of the half-dozen bits of
advice that is given to almost _everyone_ who posts here?  Hell, I'd
even given you this advice personally in this very thread (although
it's possible you wouldn't have had a chance to see it bofore you
posted again).

>   bless $o, "A";   #rebless "X" inst. to "A"
>   $o->methodb;     #this fails in my code.
>   #BUT:
>   $o->methoda;
>   $o->methodb;     #This will now work.

OK now let's try that again, this time *all* in Perl:

#!/usr/bin/perl -w
use strict;

my $o = bless [], 'X';
sub A::methoda { print "A::methoda\n" };
sub B::methodb { print "B::methodb\n" };
@A::ISA = 'B';

bless $o, "A";  
$o->methodb;    # Eric claims that this fails 
$o->methoda;
$o->methodb;

__END__

Would it really have been all that painfull to have put in the effort
to write your original post like that?

Anyhow, this produces expected output on 5.005_03.

B::methodb
A::methoda
B::methodb

If it doesn't work on your Perl 5.004_04 interpreter then it's
reasonable to assume that this is was bug that has been subsequently
fixed.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 19 Jul 2000 18:17:26 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: bless loses inheritance?
Message-Id: <8l4rbm$kas$1@lublin.zrz.tu-berlin.de>

 <up2l8@my-deja.com> wrote in comp.lang.perl.misc:
>In article <8l1ku0$hbd$1@lublin.zrz.tu-berlin.de>,

>Sorry, I think this just confused the issue.  The same
>behavior can be exhibited with any subroutine.  I modified
>it to sub ima{}.  What I found is that as long as some sub
>defined in the explicit package that the object is an instance
>of is called.

The end of that sentence doesn't look.  I guess what you are saying
is, if you want to call an inherited method, you must first call
a method that is not inherited.  This seems to be indicated by
the outline you give next.

> In otherwords:
> say that there is a $o such that ref($o) = "X";
> and there exists an A::methoda
> and there is also a B::methodb
> and A isa B.
> then
>  bless $o, "A";   #rebless "X" inst. to "A"
>  $o->methodb;     #this fails in my code.
>  #BUT:
>  $o->methoda;
>  $o->methodb;     #This will now work.
>(package X in this case is irrelavent).

When you build that situation in a minimal way (see code below),
the behavior you describe doesn't happen.  Something else must
be going wrong in your code.  Make a copy and cut it down brutally
until the error disappears.  Then you'll know more.

Anno

#!/usr/bin/perl -w
use strict;

package X;

sub new {
  my $class = shift;
  bless [], $class;
}

package A;
@A::ISA = qw( B);

sub methodA {
  print "methodA\n";
}

package B;

sub methodB {
  print "methodB\n";
}

my $obj = new X;
bless $obj, 'A';

$obj->methodB; # this works with no ado
-- 
"Its not bad design, its a cgi script!"


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

Date: Wed, 19 Jul 2000 13:09:53 -0500
From: Umesh <nair@ee.tamu.edu>
Subject: command line options(on win98)
Message-Id: <Pine.GSO.4.21.0007191304590.25750-100000@eesun1.tamu.edu>


hi,

I have a perl executable with command line options.
IT works fine on unix/windows(from dos command line).

I now need to convert it to Win98 executable since customer wants to
run it as Win98 and not on DOS.  I am thinking of using perl2exe but am
not sure how the command line options will be interpreted?

Would I need to recode and use Perl::Tk and have a gui and then use 
perl2exe ?

All help is highy appreciated...

thanks!



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

Date: Wed, 19 Jul 2000 19:47:15 GMT
From: "SteveSingletary" <steve@gte.net>
Subject: Counter Problem
Message-Id: <7Bnd5.655$Qd5.210923@dfiatx1-snr1.gtei.net>


Can someone help me with this code.  I thought this would be the easy part
to the script.

#
$comment_file = "/home/www/guest/comments.txt";

if (-e $comment_file) {
   open (FILE,">>$comment_file");
   $NBR = 0;
}
else {
   open (FILE,">$comment_file");
   $NBR = 1;
}
#
# Calculate the comment number
#
if ($NBR != 1) {
  @comm_count = <FILE>;
  foreach $line (@comm_count) {
    $NBR++
    }
  $NBR++
}
#
if ($form_results{'COMMENT'})  {
  print FILE "$NBR=$form_results{'COMMENT'}\n";
}
####
The output should be:
1=comment1
2=comment2
 ...
however, the output is
2=comment1
1=comment1
1=comment1
So apparently the counter is not counting the foreach's.  I have tried
diferent things but can't figure it out.

Steve





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

Date: Wed, 19 Jul 2000 20:32:04 GMT
From: paydro@my-deja.com
Subject: Re: Counter Problem
Message-Id: <8l5385$8ud$1@nnrp1.deja.com>

I am not quite so sure that you can make an array equal a filehandle
like that... Instead of the foreach loop you have, try doing a while
(<FILE>){ $NBR++; }. Furthermore, you can not open a bi-directional
filehandle like that... You can not use the same filehandle for both
input and output when dealing with a file... so, open one filehandle to
read the contents of the comments.txt, and one to write to it.

John Vicondoa

In article <7Bnd5.655$Qd5.210923@dfiatx1-snr1.gtei.net>,
  "SteveSingletary" <steve@gte.net> wrote:
>
> Can someone help me with this code.  I thought this would be the easy
part
> to the script.
>
> #
> $comment_file = "/home/www/guest/comments.txt";
>
> if (-e $comment_file) {
>    open (FILE,">>$comment_file");
>    $NBR = 0;
> }
> else {
>    open (FILE,">$comment_file");
>    $NBR = 1;
> }
> #
> # Calculate the comment number
> #
> if ($NBR != 1) {
>   @comm_count = <FILE>;
>   foreach $line (@comm_count) {
>     $NBR++
>     }
>   $NBR++
> }
> #
> if ($form_results{'COMMENT'})  {
>   print FILE "$NBR=$form_results{'COMMENT'}\n";
> }
> ####
> The output should be:
> 1=comment1
> 2=comment2
> ...
> however, the output is
> 2=comment1
> 1=comment1
> 1=comment1
> So apparently the counter is not counting the foreach's.  I have tried
> diferent things but can't figure it out.
>
> Steve
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 19 Jul 2000 19:39:22 GMT
From: jq@usa.net (Jim Quinn)
Subject: counting substrings
Message-Id: <8F7693F15jqusanet@64.252.33.231>

I need to count how many purely numeric substrings are contained in a 
string such as
156-161       6       FILECODE (PGM ID, LIST, DB IDENT)                                                              
Any help would be greatly appreciated


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

Date: 19 Jul 2000 14:44:16 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: counting substrings
Message-Id: <87snt5j46n.fsf@limey.hpcc.uh.edu>

>> On Wed, 19 Jul 2000 19:39:22 GMT,
>> jq@usa.net (Jim Quinn) said:

> I need to count how many purely numeric substrings are
> contained in a string such as 156-161 6 FILECODE (PGM
> ID, LIST, DB IDENT) Any help would be greatly
> appreciated

\d+ matches a non-zero sequence of digits, so...

  my $s = '156-161       6       FILECODE (PGM ID, LIST, DB IDENT)';
  my @matches = $s =~ /\d+/g;
  print join("\n", @matches), "\n";

Of course, in some contexts, you might regard 123,456 and
similar strings as "purely numeric".

  perldoc perlre

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: 19 Jul 2000 19:48:07 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: counting substrings
Message-Id: <8l50ln$3o7ol$1@ID-24002.news.cis.dfn.de>

hi,
Jim Quinn <jq@usa.net> wrote:
> I need to count how many purely numeric substrings are contained in a 
> string such as
> 156-161       6       FILECODE (PGM ID, LIST, DB IDENT)      

you mean, with the string above it would be 3?
156, 161 and 6?
if so, then try out:

@count = ($string =~ /\d+/g);
print "Number: ".scalar @count;

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


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

Date: Wed, 19 Jul 2000 20:11:27 GMT
From: jq@usa.net (Jim Quinn)
Subject: Re: counting substrings
Message-Id: <8F76A5468jqusanet@64.252.33.231>

tony_curtis32@yahoo.com (Tony Curtis) wrote in 
<87snt5j46n.fsf@limey.hpcc.uh.edu>:

>my $s = '156-161       6       FILECODE (PGM ID, LIST, DB IDENT)';
>  my @matches = $s =~ /\d+/g;
>  print join("\n", @matches), "\n

This will extract the numeric substrings, but what i am looking for is a 
count of how many numeric substrings were found...


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

Date: 19 Jul 2000 15:14:13 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: counting substrings
Message-Id: <87puo9j2sq.fsf@limey.hpcc.uh.edu>

>> On Wed, 19 Jul 2000 20:11:27 GMT,
>> jq@usa.net (Jim Quinn) said:

> tony_curtis32@yahoo.com (Tony Curtis) wrote in
> <87snt5j46n.fsf@limey.hpcc.uh.edu>:

>> my $s = '156-161 6 FILECODE (PGM ID, LIST, DB IDENT)';
>> my @matches = $s =~ /\d+/g; print join("\n", @matches),
>> "\n

> This will extract the numeric substrings, but what i am
> looking for is a count of how many numeric substrings
> were found...

@matches in a scalar context (this was an exercise for the
reader).  The point of showing the matches was to indicate
the right things had been found.  Simply saying "3"
doesn't mean the *correct* 3 substrings.

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: 19 Jul 2000 16:43:55 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: counting substrings
Message-Id: <slrn8nc5ph.3do.abigail@alexandra.delanet.com>

Tony Curtis (tony_curtis32@yahoo.com) wrote on MMDXIV September MCMXCIII
in <URL:news:87puo9j2sq.fsf@limey.hpcc.uh.edu>:
:} >> On Wed, 19 Jul 2000 20:11:27 GMT,
:} >> jq@usa.net (Jim Quinn) said:
:} 
:} > tony_curtis32@yahoo.com (Tony Curtis) wrote in
:} > <87snt5j46n.fsf@limey.hpcc.uh.edu>:
:} 
:} >> my $s = '156-161 6 FILECODE (PGM ID, LIST, DB IDENT)';
:} >> my @matches = $s =~ /\d+/g; print join("\n", @matches),
:} >> "\n
:} 
:} > This will extract the numeric substrings, but what i am
:} > looking for is a count of how many numeric substrings
:} > were found...
:} 
:} @matches in a scalar context (this was an exercise for the
:} reader).  The point of showing the matches was to indicate
:} the right things had been found.  Simply saying "3"
:} doesn't mean the *correct* 3 substrings.


But there are far more than 3 numerical substrings in the above string.
1, 15, 156, 5, 56, 6, 1, 16, 161, 6, 61, 1 and 6 are all numerical
substrings, for a total of 13.

   $sum = 0;
   map {my $l = length; $sum += $l * ($l + 1)} m/\d+/g;
   print $sum / 2;


Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};                # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: 19 Jul 2000 15:47:11 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: counting substrings
Message-Id: <87n1jdj19s.fsf@limey.hpcc.uh.edu>

>> On 19 Jul 2000 16:43:55 EDT,
>> abigail@delanet.com (Abigail) said:

> '156-161 6 FILECODE (PGM ID, LIST, DB IDENT)'

> But there are far more than 3 numerical substrings in
> the above string.  1, 15, 156, 5, 56, 6, 1, 16, 161, 6,
> 61, 1 and 6 are all numerical substrings, for a total of
> 13.

I was going to mention this in my first post, but it
seemed obvious that the context indicated the OP wanted
maximal substrings...

t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Wed, 19 Jul 2000 20:35:28 GMT
From: Lance Hoffmeyer <vibrato@my-deja.com>
Subject: Date on Win32 Rephrased
Message-Id: <8l53ee$98u$1@nnrp1.deja.com>

How can I get the date and save it into a variable MMDDYYYY without
having to hit any keys?

$datevar = system("date") will give me the date but I have to hit ENTER
when I am asked if I wish to change the date!

Lance


In article <8l51sp$7q9$1@nnrp1.deja.com>,
  Lance Hoffmeyer <vibrato@my-deja.com> wrote:
> How can I get the date on Win95?
>
> Lance
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 19 Jul 2000 15:56:39 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Date on Win32 Rephrased
Message-Id: <87k8ehj0u0.fsf@limey.hpcc.uh.edu>

>> On Wed, 19 Jul 2000 20:35:28 GMT,
>> Lance Hoffmeyer <vibrato@my-deja.com> said:

> How can I get the date and save it into a variable
> MMDDYYYY without having to hit any keys?

> $datevar = system("date") will give me the date but I
> have to hit ENTER when I am asked if I wish to change
> the date!

You could pay someone else to hit Enter for you.

Or

    perldoc -f localtime

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Wed, 19 Jul 2000 21:54:58 GMT
From: "jraff" <jraff@home.com>
Subject: Re: Date on Win32 Rephrased
Message-Id: <Sspd5.75627$lU5.511473@news1.rdc1.nj.home.com>

This 'hit the ENTER key' is solved by creating a file with a new line in it.
Then 'date < new_line_file.txt' prints the date and exits.

This isn't perl it's DOS!!!
----------------------------------------------------------------------------
----
"Lance Hoffmeyer" <vibrato@my-deja.com> wrote in message
news:8l53ee$98u$1@nnrp1.deja.com...
> How can I get the date and save it into a variable MMDDYYYY without
> having to hit any keys?
>
> $datevar = system("date") will give me the date but I have to hit ENTER
> when I am asked if I wish to change the date!
>
> Lance
>
>
> In article <8l51sp$7q9$1@nnrp1.deja.com>,
>   Lance Hoffmeyer <vibrato@my-deja.com> wrote:
> > How can I get the date on Win95?
> >
> > Lance
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Wed, 19 Jul 2000 21:01:15 GMT
From: Lance Hoffmeyer <vibrato@my-deja.com>
Subject: Re: Date on Win32- Answer
Message-Id: <8l54uc$aeb$1@nnrp1.deja.com>

use Time::localtime

$now=ctime();
print $now;


In article <8l51sp$7q9$1@nnrp1.deja.com>,
  Lance Hoffmeyer <vibrato@my-deja.com> wrote:
> How can I get the date on Win95?
>
> Lance
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 19 Jul 2000 20:09:12 GMT
From: Lance Hoffmeyer <vibrato@my-deja.com>
Subject: Date on Win32
Message-Id: <8l51sp$7q9$1@nnrp1.deja.com>

How can I get the date on Win95?

Lance


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 19 Jul 2000 16:49:41 -0400
From: Young <noemail@noemail.com>
Subject: Re: Date on Win32
Message-Id: <39761465.988EBB86@noemail.com>

Use "time", "gmtime", "localtime", etc.

Lance Hoffmeyer wrote:

> How can I get the date on Win95?
>
> Lance
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: 19 Jul 2000 19:18:43 GMT
From: gonzo@vex.net (Anthony DeLorenzo)
Subject: Re: DB_File question.
Message-Id: <8l4uuj$q0t$1@news.tht.net>

In article <Pine.OSF.4.21.0007190308270.17902-100000@mail.med.upenn.edu>,
Nico Zigouras  <zigouras@mail.med.upenn.edu> wrote:
>As far as I know, you can't use data structures in a tied DB_file hash,
>right?  You can only use strings, right?  When I tried to use an array as
>a value strict gave me an error.

You could also use the Data::Dumper module which will convert a perl
data structure to a string, which you can store in a DBM hash and then 
retrieve and use eval to restore.  Check out perldoc Data::Dumper.

Regards, 
Tony

-- 
# Anthony DeLorenzo <drgonzo@canada.com>
# http://www.vex.net/~gonzo/
# mojo wire: 209-391-8932


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

Date: 19 Jul 2000 14:03:52 GMT
From: "ARC" <tangb@pt.cyanamid.com>
Subject: Explanation needed for "Security Audit and Taint Check" on perldoc ...
Message-Id: <01bff192$9b055380$3036ad8d@feralloj2.pt.cyanamid.com>

Dear Perl Support Group,

	I have just built Perl 5.6.0 and perl itself is working properly.  As I
tried to run the "perldoc perldoc" command,  I got the response: 

"Superuser must not run perldoc without security audit and taint checks."

	I am running on an IRIX 6.5 system.  Could someone please explain to me
what that means and what I need to do to get the perldoc command working.

	Thank you, folks.

BASF
Bill Tang


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

Date: Wed, 19 Jul 2000 20:58:32 GMT
From: Craig Arnold <craig.arnold@boeing.com>
Subject: Re: File handling problems!!
Message-Id: <39761678.365BD261@boeing.com>

1) The files, firstpart and secondpart, are being overwritten because you
have the ">" in your open statements - this opens a file for writing and
wipes out whatever was in it.  You want the ">" in the newfile line because
you are creating a new file, but in the other two, you'll lose all your
data.  See the perlfunc man page for more info on open (look for "open
FILEHANDLE").

2) It appears that you are using $- rather than $_ in your print statement
(only on the firstpart section).  This will give you the number of lines
left on the page of the currently selected output channel (probably zero),
rather than the lines of data contained in the file. See the perlvar manpage
for more info on $- and $_.

 hth

Craig Arnold

"Vinod K. Menon" wrote:

> Hello all...
>
> I have a file handling question. I am trying to sandwich two strings
> that are created elsewhere in the code between two files and make that
> into a new file. the two files are named "firstpart" and "secondpart"
> and each of them are regular text files with about a 1000 lines each.
> the following section of code does the manipulation. What is happening
> is that when the newfile is generated, all that is there in the newfile
> are the two strings ($keyString and $KeyValString2 - they are generated
> elsewhere). Moreover, the other two files "firstpart" and "lastpart" are
> also empty..the lines are deleted in those two!!! Then I replaced the
> two files(firstpart and lastpart ) again with the 1000 lines (i had
> copies thank god!) and opened them before I ran the script to see if
> they had the text and they did. THen I ran the script (its part of a CGI
> script) and the same thing happened. Only the two new strings in the
> newfile and the other source files empty!!! The following is the section
> of code that performs these operations.
>
> I am going nuts trying to figure it out..can anyone help with
> suggestions?
> Vinod
> ------------------------------------------------------------
>
> open(GENFILE, "> newfile")|| die "cannot create the file:$!";
>
> open (FIRSTPART, "> firstpart")||die "cannot open file firstpart:$!";
>
> while(<FIRSTPART>){
> print GENFILE $-;
> }
>
> close(FIRSTPART);
>
> print GENFILE "$KeyString \n ";
> print GENFILE "$KeyValString2 \n";
>
> open(SECONDPART, "> lastpart")||die "cannot open file secondpart:$!";
>
> while (<SECONDPART>){
> print GENFILE $_;
> }
>
> close(SECONDPART);
> close (GENFILE);
>
> rename ("newfile", "world.wrl");
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: 19 Jul 2000 16:09:22 -0500
From: Jaiganesh Panneerselvam <jaigan@umr.edu>
Subject: flock
Message-Id: <39761902@news.cc.umr.edu>

I have written a CGI script in PERL for unix  to execute a Fortran Program 
from the web. The script receives the input from the user and writes it to a file 
and then executes the fortran program.The fortran program will read the 
data from the file and produces the output.The data stored in the file 
should be protected until fortran program completes the process.Therefore 
I need to Lock the data file when the Fortran program is running.I used 
flock(Exclusive lock) to lock the file but it did not work.The perl book 
says flock may not work in the networks.I need to run the script in the 
AFS network.I am using perl version 5.Is there any another way to solve 
the problem.
            can anyone help me in solving the problem.
Thanks 
Jai



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

Date: Wed, 19 Jul 2000 19:16:55 GMT
From: jdimov@cis.clarion.edu
Subject: humbly parsing Perl
Message-Id: <8l4uqk$5d6$1@nnrp1.deja.com>



  I know that parsing Perl code is best done by Perl itself, and no
other mortal software should ever attempt to do that.  But it just so
happens that I need to parse some Perl code myself.  Well, not quite
your conventional parsing...  Here:

  I'm trying to extract all occurances of certain operators from a perl
script and produce some kind of output of the form:

   operator argument argument [...] argument;

  I want to do this without ever trying to actually interpret the code.
This is because I wanna be able to extract this information from perl
scripts that use or require other modules which I do not neccesarely
have access to.  So say, for example, I had the following list of
operators:

  print
  system
  sort

and I had the following piece of code:

  #!/usr/local/bin/perl -w
  use strict;
  use SomeModule::ThatsMissing;

  my $line = "a line.\n";
  print "hello wolrd\n", $line;
  subFromMissingModule ("a","b");
  my $filename = "foo.bar";
  system ("ls", '-l',
          $filename); # comment: system ($a, $b);
  print 'I just did system ("ls",$filename);\n';
  # the end of it

  I'd like to get a list somewhat similar to this:

  print "???" $line
  system "???" "???" $filename

  I don't know how clearly I'm communicating my ideas here...  I'll be
glad to give more explanations if this message is vague at some points.

  So...  Any help / pointers to possible help / thoughts / whatever?

  Thanks a bunch.

  - jdimov


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 19 Jul 2000 14:50:44 -0400
From: Lisa Wilcox <lwilcox@emory.edu>
Subject: More Info: Question: system () from C++ CGI to Perl .pm with Linux Kernel 2.2.16
Message-Id: <3975F883.D54D85FD@emory.edu>

Hello all,

Thanks to everyone who responded.  I haven't gotten much farther, but at
least I'm ruling things out.  First, let me summarize the problem.  I've
got a C++ CGI making a syscall (system()) to a Perl module on a Red Hat
Linux server running kernel 2.2.16.  I actually am doing this on two
servers.  Everything is similar (the CGI code, C++ and Perl, and the
back end system are identical) except that the test server runs the
syscall and the production server (with the newer kernel 2.2.16) does
not.

Basically, the C++ CGI takes arguments from the HTML form and passes
them first to a back end search and retrieval system, then makes a
system call to the Perl module, which does a search of the individual
"hits" reported by the search and retrieval system.  After the Perl
module is finished, the C++ CGI finishes processing the hit list.  On
the test server, the output of the Perl module is printing back to the
user.  On the production server, the output of the Perl module is not
printing back to the user.  The main difference is in the versions of
glibc and the linux kernel.

As suggested, I tried using the -w flag, but I'm not seeing additional
error messages.  Actually, I'm not seeing any error messages.  Nothing
is reporting to /var/log/httpd/error_log.  If I use "use strict", the
script balks at the number of globally scoped variables I'm using.  Lazy
programming practice, I know.  But if this were part or all of the
problem, why would this be an issue on one server and not the other?
Otherwise, if I run the Perl program at the command line, it works as
expected.

I did grab the return value of the syscall, which is a high nonzero,
positive number (33,000+, depending on the query used) on the version
that does not work as expected.  Where it does work as expected, the
number returned is zero.  According to the system, system() should
return -1 or 127 if there is an error, and zero is the string is null
and the shell is not available.  What does this mean?

Using strace wasn't very useful to me because I can't run the C++ CGI
from the command line.  (It's programmed to parse GET or POST method
requests.)  I did use strace on the command without the arguments just
to see what I would get, and found no differences between the version
that works and the one that does not.

I haven't tried adding a statement at the beginning of the C++ program
that makes STDERR go to a special log file.  That's next on my list.

Thanks again for all of your help.

--
Lisa Wilcox
SAGE Systems Developer
SAGE Project:  http://sage.library.emory.edu/
Woodruff Library/Emory University
Email: lwilcox@emory.edu
Phone: 404-727-0961




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3750
**************************************


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