[9959] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3552 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 26 15:09:04 1998

Date: Wed, 26 Aug 98 12:01:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 26 Aug 1998     Volume: 8 Number: 3552

Today's topics:
    Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFO (Norman UNsoliciteds)
    Re: Perlscript: where is documentation <founder@pege.org>
    Re: Perlscript: where is documentation <founder@pege.org>
        problem trying to define my data structure <Harsh.Deshmane@sv.sc.philips.com>
    Re: problem trying to define my data structure (Mark-Jason Dominus)
    Re: Problem with "bind" statement in web server app (Mark-Jason Dominus)
        problems with  checking file just created <akarandi@pcocd2.intel.com>
    Re: read numbers from file into array (Mike Stok)
    Re: read numbers from file into array (Craig Berry)
        solution to broken require/use, weird current dir probl <erik@zeno.com>
    Re: String terminators (Larry Rosler)
        striping headers from an email message (g l e n  r a m s e y)
    Re: striping headers from an email message <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Y2K Date Support (Mark-Jason Dominus)
    Re: Y2K Date Support (Michael J Gebis)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 27 Aug 1998 03:58:17 +0900
From: No.unsoiliciteds@dead.end (Norman UNsoliciteds)
Subject: Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFORE POSTING
Message-Id: <No.unsoiliciteds-2708980358170001@cs11j08.ppp.infoweb.or.jp>

In article <fl_aggie-2608981049010001@aggie.coaps.fsu.edu>,
fl_aggie@thepentagon.com (I R A Aggie) wrote:
> Well, then go and learn. The source is there. Stop bugging us. 

The posting you quoted from started out by correcting an innacurate
statement about the learning Perl book, made I believe, by you. This is
what _I_ mean by this NG is for learning. Of course you take "learn" to
mean I'm asking _you_ to teach me. _I_ _AM_ _NOT_ _ASKING_ _YOU_ _TO_
_TEACH_ _ME_. I thought I made this quite clear in the posting you quoted
from here. Perhaps you didn't read down to the end of the posting, or
perhaps you thought the someone in " then if I don't understand the book,
I ask someone..." was you. I wasn't referring to you by inferrence.

> Thank you, Dr. Freud. Is that why you post this balderdash called
> FAR? Where you flamed as a child? Are you projecting?

No I wasn't flamed as a child and my father didn't humiliate me in public.

Perhaps it's for these reasons I find  abuse IRL or here hard to
comprehend and/or  tollerate, and I certainly don't sit back and watch
while it happens repeatedly through fear of peer pressure, here or IRL.

-- 
The Dinosaurs were so stupid, they couldn't 
even devise the means of thier own extinction, 
they had to wait for Nature to do it for them.


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

Date: Wed, 26 Aug 1998 14:05:13 +0200
From: "Mosl Roland" <founder@pege.org>
Subject: Re: Perlscript: where is documentation
Message-Id: <6s1jpc$19t$1@orudios.magnet.at>

Jonathan Stowe <Gellyfish@btinternet.com> wrote in message
35e30f19.7271905@news.btinternet.com...
>On Mon, 24 Aug 1998 20:17:54 -0700, Jan Krynicky wrote :
>
><snip>
>>
>>BTW: For those that do not know what is the difference.
>>PerlScript is a scripting engine made by ActiveState Tool corp.
>>This engine allows you to use Perl in ASP pages, in HTML pages instead
>>of JavaScript or VBScript, in Windows Scripting Host (I don't know why
>>would anyone want to do this) and in a growing list of applications.
>
>Actually, I was having that same thought just the other day - can
>anyone see *any* possible advantage of using PerlScript with the
>Windows Scripting Host rather than using normal Perl - just a thought
>and I dont think I can be bothered to find out by experiment.

I use PerlScript to write on Windows 95 perl programs with a graphic user
interface.

Mosl Roland
http://pege.org/ clear targets for a confused civilization
http://salzburgs.com/ (did not find a slogan :-)




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

Date: Wed, 26 Aug 1998 14:05:13 +0200
From: "Mosl Roland" <founder@pege.org>
Subject: Re: Perlscript: where is documentation
Message-Id: <6s1lhr$6gm$1@orudios.magnet.at>

Jonathan Stowe <Gellyfish@btinternet.com> wrote in message
35e30f19.7271905@news.btinternet.com...
>On Mon, 24 Aug 1998 20:17:54 -0700, Jan Krynicky wrote :
>
><snip>
>>
>>BTW: For those that do not know what is the difference.
>>PerlScript is a scripting engine made by ActiveState Tool corp.
>>This engine allows you to use Perl in ASP pages, in HTML pages instead
>>of JavaScript or VBScript, in Windows Scripting Host (I don't know why
>>would anyone want to do this) and in a growing list of applications.
>
>Actually, I was having that same thought just the other day - can
>anyone see *any* possible advantage of using PerlScript with the
>Windows Scripting Host rather than using normal Perl - just a thought
>and I dont think I can be bothered to find out by experiment.

I use PerlScript to write on Windows 95 perl programs with a graphic user
interface.

Mosl Roland
http://pege.org/ clear targets for a confused civilization
http://salzburgs.com/ (did not find a slogan :-)




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

Date: Wed, 26 Aug 1998 10:20:24 -0700
From: Harsh Deshmane <Harsh.Deshmane@sv.sc.philips.com>
Subject: problem trying to define my data structure
Message-Id: <35E443D7.AB756EF0@sv.sc.philips.com>

Hello everyone,

I have spent a lot of time trying to get this to work:
I have created a sample program, showing my problem:
I tried originally
my $my_pin{"related" => %related,} and when that didn't work,
tried the lines in the file below. [ they didn;t work either]

In the program, below:
$pp , the new pin, doesn't see the "related" hash entry,
Doing a
Debug> x $pp shows the following:
Stack dump during die enabled outside of evals.

Loading DB routines from perl5db.pl patch level 0.94
Emacs support available.

Enter h or `h h' for help.

main::(t1:14):  $pp = pin::new();
  DB<1> s
pin::new(t1:6):         my %related;
  DB<1> n
pin::new(t1:7):         my $my_pin = {"related" => undef,};
  DB<1> n
pin::new(t1:8):         $my_pin{"related"} = { %related};
  DB<1> n
pin::new(t1:9):         return $my_pin;
  DB<1> n
main::(t1:16):  print STDOUT "$pp\n";
  DB<1> x $pp
0  HASH(0x40025d4c)
   'related' => undef

As a result, I cannot access the hash within the hash.
What am I doing wrong ?

thanks for your help!
-harsh


#!/user/harshdes/cadbin/perl -d

package pin;

sub new {
        my %related;
        my $my_pin = {"related" => undef,};
        $my_pin{"related"} = { %related};
        return $my_pin;
}

package main;

$pp = pin::new();

print STDOUT "end sampel\n";




--
Harsh Deshmane                   ESTC, Philips Semiconductors
Tel: 408-991-4720  Pager:408-619-0092       Fax: 408-991-3355
Email: Harsh.Deshmane@sv.sc.philips.com  Seri:harshdes@svlhp8





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

Date: 26 Aug 1998 13:49:19 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: problem trying to define my data structure
Message-Id: <6s1hqv$a97$1@monet.op.net>


In article <35E443D7.AB756EF0@sv.sc.philips.com>,
Harsh Deshmane  <Harsh.Deshmane@sv.sc.philips.com> wrote:
>        my $my_pin = {"related" => undef,};
>        $my_pin{"related"} = { %related};
>        return $my_pin;

$my_pin{"related"} is part of the %my_pin hash variable

$my_pin is a scalar variable that has nothing to do with %my_pin.
They are completely separate variables with no connection at all.

In your code, `$my_pin' contains a reference to an anonymous hash with
key "related".  If you want to change the value associated with this
key, you must use

	$my_pin->{"related"} =  (whatever);

>What am I doing wrong ?

That is a more difficult question, bnecause your code is so puzzling I
am not sure what you want to accomplish.

It seems to me that your function could be reduced to:

	sub new {
	  return { "related" => { } };
	}

but I am not sure that that is really what you want.


Please see http://www.plover.com/~mjd/perl/FAQs/ for an article about
how to use references.  You have some confusion abuot the basic
syntax, which this article was designed to try to clear up.



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

Date: 26 Aug 1998 13:15:33 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Problem with "bind" statement in web server app
Message-Id: <6s1frl$9qq$1@monet.op.net>

In article <6s1amn$f0i$1@nnrp1.dejanews.com>,
 <robertrose@my-dejanews.com> wrote:
>In article <6rvgq5$ikb$1@monet.op.net>,
>  mjd@op.net (Mark-Jason Dominus) wrote:
>> 	|| ($err = $!, &tprint, die "bind: $err");
>Thanks for the ideas. I tried using $! and I received a "Illegal seek"
>message. Do you know what this means?

I suspect it means you didn't follow my directions.

Show us the new code that generates the `illegal seek' error.



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

Date: Wed, 26 Aug 1998 11:02:15 -0700
From: "Arvind K. Karandikar" <akarandi@pcocd2.intel.com>
Subject: problems with  checking file just created
Message-Id: <35E44DA7.5714@pcocd2.intel.com>

Hi,

i have the following code snippet that reads data from a socket 
(created elsewhere) and writes it out to the specified file. this works 
fine, the file is created with the correct data in it: 
------ begin code -------
sub writeFile {
    my $inputSockRef = shift ;
    my($fileName, $data) ;
    chomp($fileName = <$inputSockRef>) ;
    Defs::printDebug("writing input into file $fileName") ;
    open(OFILE, ">$fileName") or 
	 die "can't open file $fileName: $!\n" ;
    do {
        chomp($data = <$inputSockRef>) ;
        print OFILE "$data\n" ;
    } while ($data !~ /eof/) ;
    close OFILE or die "error closing file $fileName: $! $?" ;
    Defs::printDebug("done writing $fileName") ;
----- end code -----
however, i now need to check the file stats (basically the size) so i
added a -s $filename line, but this returns an undef value. i then 
added this to check if perl could see this file :

    my $fileSize = 0 ;
    while(!-e $fileName) {
        print "no file found!!\n" ;
        sleep 60 ;
    }
    $fileSize = -s $fileName ;


this keeps printing the 'no file found' message. it seems to me that 
perl can't see the file, but i don't see why. actually looking at the
directory shows the file in all its glory. I looked up the 
documentation, but didn't see anything that would indicate where the 
problem could be.

any help appreciated!

thanks,
Arvind

== my views only ==


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

Date: 26 Aug 1998 17:16:27 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: read numbers from file into array
Message-Id: <6s1ftb$2j8@news-central.tiac.net>

In article <6s1cn4$a92$1@news.usf.edu>,
Himanshu Gohel <gohel@csee.usf.eduXXX> wrote:
>Hi,
>
>My first program in perl, so bear with me.  I've figured out the shell
>of my program (opening, writing and closing files).  The problem is
>I haven't figured out how to read the formatted input from the input file
>to manipulate and then send to the output file.  The input looks like:
>
>n
>x0 x1 x2 ... xn
>y0 y1 y2 ... yn
>
>n is an integer, and x,y are floats.  x's may be on one line, or
>split over various lines if too many.  Same for y's.  I would like
>to read the x and y values into one array (or two separate if
>that's easier).
>
>Help?  (If you reply by email, please remove the anti-spam 'XXX' Thanks)

Does this give you any ideas?  <DATA> reads data after the __END__ token.

#!/usr/local/bin/perl -w

$count = <DATA> + 0;
push @list, split while <DATA>;

# another way:
#
# while (<DATA>) {
#   push @list, split (' ', $_);
# }

# same effect as:
#
# $/ = undef;
# @list = split ' ', <DATA>;

@x = splice @list, 0, $count;
@y = splice @list, 0, $count;

print "x is (@x)\n";
print "y is (@y)\n";
__END__
10
1.1
2.1 3.1

4.1 5.1 6.1
7.1 8.1 9.1 10.1
  1.2 2.2 3.2 4.2
5.2 6.2 7.2 8.2 9.2
10.2

This assumes that your data's separated by whitespace.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 26 Aug 1998 17:11:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: read numbers from file into array
Message-Id: <6s1fkc$9pm$2@marina.cinenet.net>

Himanshu Gohel (gohel@csee.usf.eduXXX) wrote:
: My first program in perl, so bear with me.  I've figured out the shell
: of my program (opening, writing and closing files).  The problem is
: I haven't figured out how to read the formatted input from the input file
: to manipulate and then send to the output file.  The input looks like:
: 
: n
: x0 x1 x2 ... xn
: y0 y1 y2 ... yn

Are there really n+1 x and n+1 y values, or should the last values be
x(n-1) and y(n-1)?  I'm going to presume the latter in what follows; the
correction if I've guessed wrong is trivial.

: n is an integer, and x,y are floats.  x's may be on one line, or
: split over various lines if too many.  Same for y's.  I would like
: to read the x and y values into one array (or two separate if
: that's easier).

Here's how I'd approach it, untested.  First, I'd slurp the entire file
into a single scalar, by undefing $/ before the first read (see perldoc
perlvar).  Presuming that scalar is called $data, and you want the x and y
values in arrays named @x and @y, here's how I'd proceed:

  my @values = split ' ', $data;
  my $n      = shift @values;

  die "Element count is not 2*n\n" unless @values == 2*$n;

  # Skip the following steps if you want all the x values and then
  # all the y values in one array; that's what @values is at this point.

  my $n2     = $n / 2;
  my @x      = @values[0..$n2-1];
  my @y      = @values[$n2..$#values];

HTH...

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Wed, 26 Aug 1998 18:23:39 GMT
From: "Erik Knepfler" <erik@zeno.com>
Subject: solution to broken require/use, weird current dir problem
Message-Id: <LoYE1.432$J3.9736777@nnrp2.ni.net>

I discovered that in IIS4 with ActivePerl 5.02 , if .pl is associated with
Perl.EXE rather than PerlIS.DLL, running scripts through the web server will
cause Perl to believe that the current directory is always
x:\inetpub\wwwroot.  This causes all require and use statements to break if
they assume that the current directory contains the file they are
requiring/using.  Changing the map to PerlIS.DLL solves this problem.  This
can be verified with the following script, executed from a remote client:

print "HTTP/1.0 200 OK\n\n";
print `dir`;
exit();

In one configuration it will always show the web root regardless of where
the script exists and is being ran from.  In the other configuration, it
will properly show the current directory.  Bug?  Maybe.  Older versions of
Perl.EXE didn't seem to have this problem.

Erik




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

Date: Wed, 26 Aug 1998 09:57:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: String terminators
Message-Id: <MPG.104dde677564a1719897f4@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6s1cml$kmu$1@heliodor.xara.net> on Wed, 26 Aug 1998 15:22:48 
+0100, Martin <minich@globalnet.co.uk> says...
 ...
> try
> 
> print <<EOF;
> 
> foo
> bar
> foo
> bar
> 
> EOF
> ;
> exit(1);
> 
> Note the semicolon on the line below the EOF.

Which terminates an empty statement that does nothing whatsoever.

Note the semicolon on the line 'print <<EOF;' which terminates the 
'print' statement (correctly).

-- 
(Yet Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 26 Aug 1998 17:03:10 GMT
From: glen@perfectday.com (g l e n  r a m s e y)
Subject: striping headers from an email message
Message-Id: <35e43f02.6499915@news.easynet.co.uk>

In the same way that cgi-lib.pl allows me to strip out the contents of
a html form, is there a similar "library" that will do the same for an
email past to a script?

So, I'd be able to do something like;

	my_from=$in{"From:"} # retreive from header
	my_replyto=$in{"Reply-To:"} # restreive reply-to header
	my_body=$in{"Body"} # retreive actual body message of email

Thanks,

Glen.


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

Date: 26 Aug 1998 19:18:01 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: striping headers from an email message
Message-Id: <7x67ffd5me.fsf@salome.vcpc.univie.ac.at>

Re: striping headers from an email message, g
<glen@perfectday.com> said:

g> In the same way that cgi-lib.pl allows me to strip out
g> the contents of a html form, is there a similar "library"
g> that will do the same for an email past to a script?

                              <pedant>passed</pedant>

g> So, I'd be able to do something like;
g>   my_from=$in{"From:"} # retreive from header

         <pedant>single quotes better here if just literal</pedant>

Yep, the Mail::* family, get 'em @ CPAN if you don't already
have 'em, e.g. perldoc Mail::Internet

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: 26 Aug 1998 13:13:51 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Y2K Date Support
Message-Id: <6s1fof$9q5$1@monet.op.net>


In article <6s179d$des$2@ligarius.ultra.net>,
Bob Trieger <sowmaster@juicepigs.com> wrote:
>C.H.U.D was a B flick made in '84 and I think that Gebis recently saw it and 
>it was just fresh in his mind.
>
>I'm not sure if it was mentioned at the conference.

I kept expecting Jon to slip it into one of those quiz show questions
about `expend the following acronyms', but he didn't.


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

Date: 26 Aug 1998 17:33:43 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Y2K Date Support
Message-Id: <6s1gtn$4d0@mozo.cc.purdue.edu>

cberry@cinenet.net (Craig Berry) writes:

}I R A Aggie (fl_aggie@thepentagon.com) wrote:
}: C.H.U.D.s? or is this in the jargon file?

}Oh, for pete's sake, doesn't *anybody* read the FAQs anymore?  See
}perlfaq17, "Why did a hideous deformed humanoid emerge from the sewers and
}eat my brain while I was trying to sort a hash of lists?"

Look, this has been discussed ad naseum in the group.  Perl does not
have a C.H.U.D. problem, but when the year 2000 arrives, perl
doesn't prevent you from having a C.H.U.D. problem either.  

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

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


Administrivia:

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

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


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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