[10548] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4140 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 3 12:07:43 1998

Date: Tue, 3 Nov 98 09:00:20 -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, 3 Nov 1998     Volume: 8 Number: 4140

Today's topics:
    Re: -w (was Re: It works , but why) <r28629@email.sps.mot.com>
        Alternative(s) for MailForm.pl <Geert.Roovers@nospam.com>
        ANNOUNCE: Bit::Vector 5.6 <sb@sdm.de>
        Announce: Parse-Yapp-0.16 released !! <desar@club-internet.fr>
        FAQ question. <kjetil@balder.no>
    Re: FAQ question. <gkaushik@gurv.demon.co.uk>
        HELP: Parsing (J.L. Forsyth)
        http requests hangup mehta@mama.indstate.edu
        java from perl in winnt bsethi@p21.com
    Re: Newbie: files in different directories. dave@mag-sol.com
        Newbie: read a string from keyboard <joyot@univ-tln.fr>
    Re: Not to start a language war but.. ajs@ajs.com
    Re: Not to start a language war but.. <jdporter@min.net>
    Re: Not to start a language war but.. <jdporter@min.net>
    Re: Not to start a language war but.. <jdporter@min.net>
    Re: OLE Publication (John Hardy)
        Packages and header files <cobalt@dircon.co.uk>
    Re: Packages and header files (Brand Hilton)
    Re: Perl & Y2K - booby trap code (I R A Aggie)
    Re: PERL is TOO flexible (Daniel E. Macks)
    Re: Poll: How Did You Learn Perl? <jdporter@min.net>
        Proposal and prototype of named parameter lists and oth ajs@ajs.com
        Q: trimming a database file kmyer@hotmail.com
    Re: Reference Safety <jeromeo@atrieva.com>
        regexp and date, help <shjmoore@sprynet.com>
    Re: regexp and date, help <featheredfrog@geocities.com>
        volunteers needed to test javascript database kush@dircon.co.uk
    Re: What is the "correct" location of perl under Solari <r28629@email.sps.mot.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 03 Nov 1998 08:58:42 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: -w (was Re: It works , but why)
Message-Id: <363F1A22.63F507A1@email.sps.mot.com>

Ronald J Kimball wrote:
> 
> Jarle H Knudsen <no.unsolicited.mail.please@jarle.com> wrote:
> 
> > If this is so important, why isn't this on by default? Then there
> > could be a switch to turn it of instead.
> 
> From the perl manpage:
> 
>    BUGS
>      The -w switch is not mandatory.

Is this bug intentional?

-tk


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

Date: Tue, 03 Nov 1998 15:13:24 +0100
From: Geert Roovers <Geert.Roovers@nospam.com>
Subject: Alternative(s) for MailForm.pl
Message-Id: <363F0F84.116AE855@nospam.com>

Hi,

Let me know if this is actually a question for a CGI newsgroup...

After I started using the FormMail.pl from Matt's Script Archive, I
noticed that a lot of people in this news group didn't support the use
of Matt's scripts. i take it that they have very good reasons for that,
and frankly, I'm not really interested in them :o)

What i am interested in though, is good alternatives. I realize I could
hack something myself, and I would, if I had the time. But since I don't
have the time, I went looking, and came up with a script called
"mailto.cgi" at http://www.cgibuilder.com/afm/ (It's titled "Advanced
Form Mailer")

Does anyone know this script, and - more important - is it any better
than Matt's? If not, what is a better alternative? I have to be able to
read a form, put all info in a mail, preferably according to my lay-out.

~Geert


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

Date: 3 Nov 1998 16:29:25 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANNOUNCE: Bit::Vector 5.6
Message-Id: <71nb15$7vm$1@news.neta.com>

I am pleased to announce version 5.6 of the "Bit::Vector" module:


The package is available for download either from my web site at

                  http://www.engelschall.com/u/sb/download/

or from any CPAN (= "Comprehensive Perl Archive Network") mirror server:
(allow a few days for propagation if necessary)

                  http://www.perl.com/CPAN/authors/id/STBEY/


The package consists of a C library (designed for maximum efficiency)
which is the core of a Perl module (designed for maximum ease of use).

The C library is specifically designed so that it can be used stand-alone,
without Perl.


What does it do:
----------------

This module is useful for a large range of different tasks:

  -  For example for implementing sets and performing set operations
     (like union, difference, intersection, complement, check for subset
     relationship etc.),

  -  as a basis for many efficient algorithms, for instance the
     "Sieve of Erathostenes" (for calculating prime numbers),

     (The complexities of the methods in this module are usually either
      O(1) or O(n/b), where "b" is the number of bits in a machine word
      on your system.)

  -  for shift registers of arbitrary length (for example for cyclic
     redundancy checksums),

  -  to calculate "look-ahead", "first" and "follow" character sets
     for parsers and compiler-compilers,

  -  for graph algorithms,

  -  for efficient storage and retrieval of status information,

  -  for performing text synthesis ruled by boolean expressions,

  -  for "big integer" arithmetic with arbitrarily large integers,

  -  for manipulations of chunks of bits of arbitrary size,

  -  for bitwise processing of audio CD wave files,

  -  to convert formats of data files,

and more.


What's new in version 5.6:
--------------------------

The leading zeros in the output of "to_Hex()" have been suppressed.

BEWARE:

It is unlikely, but this may actually break existing applications!

Additionally, a warning produced by some compilers on line 2067 of
"BitVector.c" has been fixed.


Legal issues:
-------------

Copyright (c) 1995, 1996, 1997, 1998 by Steffen Beyer.
All rights reserved.

This package is free software; you can redistribute it and/or
modify it under the same terms as Perl itself, i.e., under the
terms of the "Artistic License" or the "GNU General Public License".

The C library at the core of this Perl module can additionally
be redistributed and/or modified under the terms of the
"GNU Library General Public License".


Prerequisites:
--------------

Perl version 5.000 or higher, and an ANSI C compiler (!)
                                     ^^^^^^


Author's note:
--------------

If you have any questions, suggestions or need any assistance, please
let me know!

I would in fact be glad to receive any kind of feedback from you!

I hope you will find this module beneficial.

Yours,
--
  Steffen Beyer <sb@engelschall.com> http://www.engelschall.com/u/sb/
       "There is enough for the need of everyone in this world,
         but not for the greed of everyone." - Mahatma Gandhi




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

Date: 3 Nov 1998 16:31:01 GMT
From: Francois Desarmenien <desar@club-internet.fr>
Subject: Announce: Parse-Yapp-0.16 released !!
Message-Id: <71nb45$8e9$1@news.neta.com>

I'm proud to announce that Parse-Yapp-0.16 module has just been
uploaded to CPAN.
It is now on its way and should be available very soon on your
nearest CPAN mirror site.

Major enhancements in this version are:
- Standalone parser modules:
    You can now generate standalone parser modules, so you don't need
anymore the
    Parse-Yapp module itself to have them run.
- Debugging Driver is now fully thread safe (the runtime driver was
already)
- Runtime Driver is now loaded at compile time, not 'evaled' no more

Here is the README file that comes with it:

Parse::Yapp - Yet Another Perl Parser compiler

Compiles yacc-like LALR grammars to generate Perl OO parser modules.

COPYRIGHT

(c) 1998 Francois Desarmenien, all rights reserved.
(see the Copyright section in Yapp.pm for usage and distribution rights)

IMPORTANT NOTES

THIS IS ALPHA SOFTWARE.

Though it has been tested a lot, there are probably bugs in it ;-)

I need FEEDBACK for every problem or bug you could encounter so I can
fix
them in the next release. Comments are welcome too.
But I also need FEEDBACK if you use it and have it work fine so I can
step
to beta and production releases. Just drop me a mail.

The Parse::Yapp pod section is the main documentation and it assumes
you already have a good knowledge of yacc. If not, I suggest the GNU
Bison manual which is a very good tutorial to LALR parsing and yacc's
grammar syntax.

The documentation is only a draft and should be rewritten (I think).
Any help on this issue would be very welcome.

DESCRIPTION

This is the alpha release 0.16 of the Parse::Yapp parser generator.

It lets you create Perl OO fully reentrant LALR(1) parser
modules (see the Yapp.pm pod pages for more details) and has
been designed to be functionnaly as close as possible to yacc,
but using the full power of Perl and opened for enhancements.

REQUIREMENTS

Requires perl5.004 or better :)

It is written only in Perl, with standard distribution modules,
so you don't need any compiler nor special modules.

INSTALLATION

perl Makefile.PL
make
make test
make install

WARRANTY

This software comes with absolutly NO WARRANTY of any kind.
I just hope it can be useful.


FEEDBACK

Send feedback, comments and bug reports to:

Francois Desarmenien
desar@club-internet.fr




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

Date: Tue, 03 Nov 1998 15:11:24 +0100
From: Kjetil Svendsberget <kjetil@balder.no>
Subject: FAQ question.
Message-Id: <363F0F0C.479BB05@balder.no>

I have a question which i didnt find at language.perl.com/faq
which MUST be a faq.

How do i remove carrige returns from a file copied from winblows to
unix?

i did a 

1,$s/^M//g

in VI, but apperently that didnt help.

it still says there carriage returns (015) in the file.

How do i easy do this?


-- 
Kjetil Svendsberget, systemengineer
Balder Dialog AS
Olaf Helsetsvei 6
N-0694 Oslo, Norway


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

Date: Tue, 03 Nov 1998 16:13:09 +0000
From: gaurav kaushik <gkaushik@gurv.demon.co.uk>
Subject: Re: FAQ question.
Message-Id: <363F2B94.55DA4C2@gurv.demon.co.uk>

There are two methods -
1- In Vi as you are doing the right except perhaps when putting ^M you
are using
two characters i.e. char cap and char M. So, when you issue 1,$s/ .. try
using
CTRL-M character. To get CTRL-M you will have to put CTRL and V key
togather
and then press CTRL and M key togather. Then, this thing should work.

2- Another way is - issue this command -
tr -ds "\r" "" <file1>file2

Here tr command is deleting the carriage return char denoted by \r  .It
takes the
input from file1 and produces the output file file2. Remember to use
both input
operators '<'  and also '>'.
Gaurav Kaushik

Kjetil Svendsberget wrote:

> I have a question which i didnt find at language.perl.com/faq
> which MUST be a faq.
>
> How do i remove carrige returns from a file copied from winblows to
> unix?
>
> i did a
>
> 1,$s/^M//g
>
> in VI, but apperently that didnt help.
>
> it still says there carriage returns (015) in the file.
>
> How do i easy do this?
>
> --
> Kjetil Svendsberget, systemengineer
> Balder Dialog AS
> Olaf Helsetsvei 6
> N-0694 Oslo, Norway



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

Date: Tue, 03 Nov 1998 16:55:42 GMT
From: jforsyth@islandactive.com (J.L. Forsyth)
Subject: HELP: Parsing
Message-Id: <363f341f.10474719@news.auracom.com>

Here's my problem: 

A user will make some choices from an HTML form and then hit "submit"
This results in an outside company (not me) passing back some results
based on the user's choices, in an ASCII text file. I need to parse
this file and return the user with a nicely formatted HTML page.
Can anyone point me in the right direction of where to find
information on how to do this?

Also, this is probably a ridiculous question but, 
I need to print a % sign in a form option, and I've never needed to
do this before, how do I get % to print.

Thanks in advance

J.Forsyth
Island Interactive
jforsyth@islandactive.com



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

Date: Tue, 03 Nov 1998 14:52:54 GMT
From: mehta@mama.indstate.edu
To: elharo@sunsite.unc.edu
Subject: http requests hangup
Message-Id: <71n5c6$7na$1@nnrp1.dejanews.com>

3/11/98

Hello:

I am doing applet/servlet cgi-post communication.  It works just fine.	I do
clean request and response closing of the i/o streams setting necessary
headers like content-length and content-type.

I though am unable to solve one problem.  When I try to make multiple
consecutive immediate requests to the servlet the applet side stream hangs up
or is unable to complete the method call and also the web server does not
seem to get the request (atleast does never show up in the web server log)
and worst is the web server starts to consume cpu resource bogging the
computer down.	so looks like web server does get the request but due to some
reason is thinking and thinking over something that I just cannot understand.

The set up is nt 4.0, netscape 4.07, apache/jrun and also tried with two other
web servers like java web server and eas (inhouse).

if some one could guide I would appreciate.  is it some header field in http
request I need to set etc though while doing post from applet I do
setUseCaches to false.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 03 Nov 1998 15:20:21 GMT
From: bsethi@p21.com
Subject: java from perl in winnt
Message-Id: <71n6vl$a4o$1@nnrp1.dejanews.com>

I am trying to run java code from within perl. I need to pass a parameter to
the java code. It takes the argument, manipulates it and returns a value,
which perl uses in some calculations. since i can't use the open2 command in
winnt (it uses fork()...not acceptable in winnt), i tried using the following
command: $pd = system('java test','234'); this runs the java code, takes in
234 as the parameter. However i am not being able to catch the output from
the java program. i tried catching <STDIN> but that didn't work. Any/all
suggestions will be greatly appreciated. Thanks a lot bhavna

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 03 Nov 1998 15:52:01 GMT
From: dave@mag-sol.com
To: chrknudsen@hotmail.com
Subject: Re: Newbie: files in different directories.
Message-Id: <71n8r1$d13$1@nnrp1.dejanews.com>

[email copy of usenet posting copied to cited author]

[by the way Christian, please try to fix tyour line wrapping - it's seriously
broken.]

In article <363EF167.397A3A59@control.auc.dk>,
  Morten Knudsen <mk@control.auc.dk> wrote:
> Here's my problem...
>
> I'm trying to build a virtual shopping cart for use in a small on-line
> store. Each user is assigned a
> file with a filename equal to the users ip address. This file will then
> contain information about the
> user's purchases. But, I can't seem to get the script to find the file
> ($ip). When I place the file in
> the same directory as the script, there's no problems at all, but I just
> can't find the file in another
> directory! Help!

[snipped to the relevant statement]

>   open (CARTFILE, "<$cart");

If your file is in another directory, you need to prepend that directory's
name to the file name when opening it. Something like:

open(CARTFILE, "<$dir/$cart") or die "Can't open $dir/$cart: $!\n";

You should also bear in mind that your web server user (who owns the CGI
process) may well only have access to the web documents directory tree. You
might need to find out where that is by using $ENV{DOCUMENT_ROOT}.

> Any help would be really appreciated!

Hope this helped.

> Please e-mail me at: chrknudsen@hotmail.com

Done, but it's usually considered to ask for a emailed copy, or better to read
the reply in the newsgroup.

Dave...

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://london.pm.org/>
[Note Changed URL]

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 03 Nov 1998 16:19:16 +0100
From: Joyot Pierre <joyot@univ-tln.fr>
Subject: Newbie: read a string from keyboard
Message-Id: <363F1EF3.FBEEB225@univ-tln.fr>

My problem:
How can i read a string from keyboard (the Pascal readln)?

A very simple problem I suppose !

Thank you.
--
  ------------------------------------------------------------------------

Pierre JOYOT (Assistant Professor)
Universiti de Toulon et du Var
IUT GIM, BP 132, 83857 La Garde CEDEX (FRANCE)
Til: 04 94 14 22 11 and 04 94 14 24 07; Fax: 04 94 14 21 51
Email: joyot@univ-tln.fr




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

Date: Tue, 03 Nov 1998 15:26:08 GMT
From: ajs@ajs.com
Subject: Re: Not to start a language war but..
Message-Id: <71n7af$b2g$1@nnrp1.dejanews.com>



  wtanksle@cx930311-b.ocnsd1.sdca.home.com (William Tanksley) wrote:
> In article <909712475.164200@thrush.omix.com>, Zenin wrote:

> line = file.readline()
> while line:
>   do ( something )
> line = file.readline()  # better, but too redundant

Yeah, perl does seem to have the upper-hand when it comes to that sort of code
fragment. However, I really like the "lines" of python. Just wish it had
braces (or begin/end; I liked Pascal;) and some of Perl's flexibility
(TMTOWTDI sort of things).

On the other hand, I'm an old UNIX hacker, and far too used to sh, awk, C,
etc to feel comfortable using a language so alien, in semantics, from that
history. Perl grabbed me after a year (1990) of avoiding it. I switched to
perl BECAUSE it catered to that experience set.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 03 Nov 1998 10:49:39 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <363F2613.A9AFD289@min.net>

William Tanksley wrote:
> 
> In article <363DD845.66165EAB@min.net>, John Porter wrote:
> >William Tanksley wrote:
> >> Unfortunately, Perl code is complex as well.
> >> ML or Prolog are complex languages with simple code.  That's a feature. Perl
> >> is a complex language with complex code, and that's because of missing
> >> features.
> 
> >I'm sorry to be so blunt, but -- that's a lie.  A raw, bare lie.
> >Whether you are intentionally prevaricating, or are simply uninformed, I
> >don't know.
> 
> A 'lie' is always intentional.  If I'm wrong, please tell me so.  I consider
> myself told.  ;-). 

Sorry; kind of a knee-jerk reaction, since the last 87 times I heard
someone say that, it was always an intentional prevarication.
So, "perl code is complex" is a lie, whether you realized it or not.  ;-)

hand,
John Porter


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

Date: Tue, 03 Nov 1998 11:08:38 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <363F2A86.37F01FB@min.net>

William Tanksley wrote:
> 
> Perl supports variable access, a simple operation, with syntax that looks
> like an array reshape in J.

Is that a stumbling block for you?  If so, you're in the minority.
How many people know J?


> Perl supports passing scalars to a function...  Sort of.

No, no, passing scalars to functions is the cleanest, simplest thing.
I can't imagine how you could find it otherwise.  ???


> Arrays?  You're on your own;
> try implementing your own function passing protocol.

Not at all.  Maybe you're only familiar with (the now quite antiquated)
version 4 of Perl.  It is now entirely trivial to pass an array by
reference.


> In general, Perl makes many complicated things simple.  Applause.  Perl then
> goes on to make many simple things complicated.  Boo, hiss.

Um, that's still an assertion for which you have given no support.
Can you think of a real example?


> >Now please don't take this as a knock on Python or any other language.
> >I'm drawing no comparisons here.


> At any rate, I'm here (in comp.lang.perl) to learn
> Perl, not Python, even though so far I see almost no reason to like Perl.

Hmmm, I didn't need a reason to like it; I just took an immediate liking
to it.  But maybe not everyone is like that.


> >> Python is n-bit clean, where n is the size of your data structures.  Not
> >> everything is an array of char, no matter what ANSI (the C standard) says.
> 
> >Sure, if by "data structures" you mean the native word size on your machine.
> 
> Eh?  No, any data structure you want.  

You completely misunderstand the notion of "8-bit clean".
It is not about data structures.  By insisting that it is,
you make a fool of yourself.


> Your point was, I believe, that Perl is good at handling data because Perl
> can handle arbitrary streams of bytes very well.  My point is that Perl is
> not very good at handling data because it can't handle arbitrary structures
> very well.
> 
> Don't get me wrong: it handles them, all you have to do is work with it.
> But its support is concentrated entirely on handling streams of bytes.

I'm sorry, friend, but you clearly do not know whereof you speak.
You would do well to remain reticent, rather than bring upon yourself
the shame of words spoken without knowledge.


> >> >    public StringBuffer append (boolean bool)   { _extractStringBuffer().append (bool); type = STRING; return string; }
> >> [plus a mess of almost identical overloadings of the same function,
> >> differing only in type]
> 
> >> Second, the main reason you put all those functions flat next to each other
> >> is that they're all the same text, only different data types.  Er -- that's
> >> not needed in Python, even though it is in Perl.  All data types are first
> >> class, including hashes, arrays, and scalars.
> 
> >It's not needed in Perl either, although for slightly different reason.
> 
> Well, I'd say it's pretty much the same reason.  Both of them have runtime
> types, even if Perl does make textual distinctions between a few of its
> types.

You have reversed yourself.  First you say it is needed in Perl, though
not in Python, and then you say it's not needed in Perl for pretty much
the same reason it's not needed in Python.  In case you are actually
confused, let me assure you, you were right the second time. :-)

(Btw, you blew away the attributions.)

John Porter


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

Date: Tue, 03 Nov 1998 11:23:53 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <363F2E19.9D754671@min.net>

William Tanksley wrote:
> 
> >In comp.lang.perl.misc,
> >    wtanksle@cx930311-b.ocnsd1.sdca.home.com (William Tanksley) writes:
> >:Perl supports passing scalars to a function...  Sort of.  Arrays?  You're on
> >:your own, try implementing your own function passing protocol.
> 
> ...I can see that I've gotten a little too strident again.
> Yup, my message did go overboard.  My apologies; I've always had a problem
> with judging the tone of my messages.  Mea culpa.

Overboard doesn't describe it.  Your characterizations of Perl are
inaccurate; plain and simple.


> I understand [pass-by-reference semantics] quite well. 

No, you don't.
But that's o.k.  All in good time.

> sub whatever { my %tv_show = %{[$@_[0]]};
>  # yadda.
> }
> 
> I sure am illiterate.  Let me try that again.
> 
> my %tv_show = %{[shift]};

You were saying?


> Linked lists are so cool that Perl provides them as a primitive type.  Cool.

False.  Are you thinking of arrays?


> And then it doesn't let you pass them to functions unless you pass only that
> one list.

Well, that's not passing an array to a function, that's passing a sequence
of values, perhaps corresponding to the elements of an array -- but not
necessarily.


> If you want to pass more than one list, you have to actually pass
> references or some other trick.  Why?

It's not a trick.  References in Perl are not complicated!

-- 
John "Throbblefoot" Porter

Please Don't "Courtesy CC" me.
I read this newsgroup fanatically.  You know that!
("Emailed only" is fine, though.)

"The people at the Grey Hotel
  Are either aged or unwell." -- EG


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

Date: Tue, 03 Nov 1998 14:24:01 GMT
From: jhardy@cins.com (John Hardy)
Subject: Re: OLE Publication
Message-Id: <5mE%1.268$jk1.531260@198.235.216.4>


You can also try : 

http://www.microsoft.com/data/oledb/techinfo/oledbleveling2.htm




In article <363E6BE5.8941BE46@anlon.com>, chad@anlon.com says...
>
>Anybody know of some good documents that contain
>definitions of OLE objects?
>



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

Date: Tue, 3 Nov 1998 13:48:37 -0800
From: "Paul Davies" <cobalt@dircon.co.uk>
Subject: Packages and header files
Message-Id: <363f1fbf.0@newsread1.dircon.co.uk>

Hi There

Could someone please explain why the following is occuring:

I have a header file: header.pl, which contains a list of variable values
(e.g.  $INPUTFILE="input.txt") etc, which I wish to use throughout my
program.

I have a package called say, packageOne.pl

Within packageOne I have the lines:

package packageOne;
require header.pl;

I also have packageTwo.pl and in that are the lines:

package packageTwo;

require packageOne.pl;
require header.pl;

The problem is that I cannot access $INPUTFILE in packageTwo. It seems I can
only retrieve its value using
$packageOne::INPUTFILE.

If I have imported the header.pl file into packageTwo, why can't I just
access $INPUTFILE?

Thanks

Paul









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

Date: 3 Nov 1998 15:36:46 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Packages and header files
Message-Id: <71n7ue$bh111@mercury.adc.com>

In article <363f1fbf.0@newsread1.dircon.co.uk>,
Paul Davies <cobalt@dircon.co.uk> wrote:
>Hi There
>
>Could someone please explain why the following is occuring:
>
>I have a header file: header.pl, which contains a list of variable values
>(e.g.  $INPUTFILE="input.txt") etc, which I wish to use throughout my
>program.
>
>I have a package called say, packageOne.pl
>
>Within packageOne I have the lines:
>
>package packageOne;
>require header.pl;
>
>I also have packageTwo.pl and in that are the lines:
>
>package packageTwo;
>
>require packageOne.pl;
>require header.pl;
>
>The problem is that I cannot access $INPUTFILE in packageTwo. It seems I can
>only retrieve its value using
>$packageOne::INPUTFILE.
>
>If I have imported the header.pl file into packageTwo, why can't I just
>access $INPUTFILE?

>From the perlfunc man page:

require [...] demands that a library file be included if it hasn't 
already been included.                                ^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^

Since it was already included in packageOne, Perl doesn't re-include it.

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Tue, 03 Nov 1998 09:50:45 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <fl_aggie-0311980950450001@aggie.coaps.fsu.edu>

In article <71lukc$qgs$1@nnrp3.snfc21.pbi.net>, snowhare@devilbunnies.org
(Snowhare) wrote:

+ Here is a *live* example of someone (not me) being bitten by year - 1900
+ in Perl that I just found while cleaning out my old mailboxes: 
+ 
+ # Avoid an embarassing year 2000 glitch in three years...
+ # If we're selling the product after the year 2099 I won't care...
+         if ($eyear < 97) {
+                 $eyear = "20$eyear";
+         }
+         else {
+                 $eyear = "19$eyear";
+         }
+ 
+ The comment is in the original code. Yeppers....

Thems that don't read the Friendly Manual and make assumptions as to what
they are returned from localtime() gets whats they deserves.

James


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

Date: 3 Nov 1998 16:03:30 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: PERL is TOO flexible
Message-Id: <71n9gi$7jd$1@netnews.upenn.edu>

PERL ROCKS! (emills@harris.com) said:
: Its nice to be flexible sometimes- having several means to accomplish
: something can be helpful. But when not necessary, it makes learning a
: language and interpreting syntax more difficult than it needs to be.
: Don't get me wrong- PERL ROCKS! I use it almost exclusively now. This is
: a philosophical question from a PERL user- so don't flame!
: 
: But for example, why should I be able to call a subroutine with
: 
:   mysub();
:   &mysub;
:   &mysub();

They all do different things WRT argument passing and prototype-
checking. The ampersand variants are the 'original' from the earlier
perl versions. The bareword variant is new with perl5. If the
ampersandish syntax were dropped or prototypes were suddenly enforced
on it, old programs would break (though the latter case that might be
a good thing:). The ampersand also makes sense in light of
  $mysub = sub {print "hi mom"};
  &$mysub;

: This is but one example I've found that seems redundant. Another:
: 
:   print "stuff\n";
:   print ("stuff\n");
: 
: What does this add?

But there's a pretty big diffeence between these two:
  print "cycle ",++$cycle;
  print ("cycle "),++$cycle;

The issue is "looks like function then treat like function." Parens
merely force the issue by making it look like a function and making
the arguments to that function more explicit. It'd be silly to always
require parens with a print statement, but there's got to be a way to
force my example to not output $cycle.

dan
-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Tue, 03 Nov 1998 10:35:27 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <363F22BF.A8460110@min.net>

John Porter wrote:
> 
> So here's a poll for everyone.
> From what resource(s) did you learn Perl?

You all may recall this poll I posed a little while back.
Well I've gone to the trouble of tallying up the results,
and here they are.  Note that the categories are not exact;
in particular, I have attempted to guess whether the code
people studied was from the distribution or outside sources.
Maybe we should ignore that one.
In fact these results are almost meaningless, because it was
never clear what I meant by "learn[ing] Perl".
What I was really after was some comparative usefulness of
different resources for the very rank beginner; clearly
all of us are still in the process of learning Perl.

Many people indicated that writing code was a significant
part of their education.  I think that is universal, and
so is not reflected here.

     Docs in the distribution : 37 
     Programming Perl v.2 (Blue Camel) : 21 
     Programming Perl v.1 (Pink Camel) : 20 
     Newsgroup : 19 
     Studying code in the distribution : 17 
     Tutorial on the WWW : 15 
     Studying code NOT in the distribution : 12 
     Learning Perl v.1 (Pink Llama) : 11 
     Learning Perl v.2 (Blue Llama) : 8 
     Mastering Regular Expressions : 6 
     Teaching or Writing about it : 4
     Advanced Perl Programming : 3 
     The Perl Cookbook : 3 
     Effective Perl Programming : 2 
     Studying the perl source code : 2 
     Learn Perl in 21 Days (Till) : 2 
     Perl 5 Quick Reference : 1 
     Perl 5 Interactive Course (Orwant) : 1 
     Commercial class : 1 
     Personal tutor : 1 
     University class : 0

About "studying the perl source code": I find it hard to
believe that anyone can learn Perl from studying the source
code.  But two folks mentioned it, and I believe them.

-- 
John "Throbblefoot" Porter

Please Don't "Courtesy CC" me.
I read this newsgroup fanatically.  You know that!
("Emailed only" is fine, though.)

"The people at the Grey Hotel
  Are either aged or unwell." -- EG


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

Date: Tue, 03 Nov 1998 15:11:04 GMT
From: ajs@ajs.com
To: reichert@numachi.com
Subject: Proposal and prototype of named parameter lists and other features
Message-Id: <71n6e8$9c1$1@nnrp1.dejanews.com>

I've created a prototype pre-processor for implimenting named parameter lists
and simpler class/method declarations. Please have a look at:

	http://kr.com/~ajs/p.html

For documentation on the pre-processor, and:

	http://kr.com/~ajs/p

For the code (with embeded pod documentation).

This is intended as the opening of a dialogue on the topic of named parameter
lists and class definitions (and potentially other areas in which Perl's
syntax could use some ease-of-use changes). I do not intend for this to remain
as a pre-processor. If accepted, I would want to turn this into some sort of
extension to the core parser, but in what way, I'm not sure.

Please pardon me if I'm out of touch, and lots of people are already tackling
this. I have little time these days, and just writing this was a lot of work.
Please let me know if I'm working at cross-purposes with anyone.

The BUGS and TODO sections of the documentation cover a lot of territory, if
you are interested in what you might suggest or contribute.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 03 Nov 1998 14:43:07 GMT
From: kmyer@hotmail.com
Subject: Q: trimming a database file
Message-Id: <71n4ps$6oh$1@nnrp1.dejanews.com>

Hi,

Please respond via email as I don't have the time to track down all responses
and haven't gotten a decent newsreader setup yet!

I've been assigned the task of getting together a mailing list of all 9th and
11th graders here at our school to be given to the area vocational technology
school.  Our school records are stored on a VAX (yuck) and I had our computer
operator create a file with all the info of the records for 9th and 11th
grade. There are 23 fields for each student and a blank line in between.

What I want to do is read the first 9 fields, skipping the blank lines in
between, then skip the next 14 fields to the start of the next records.  This
basically gets me just their mailing address which is all I want.  I then want
to output this in some sort of delimited manner to another file.

I am almost a complete newbie to perl but it seems to me from what I know that
this should be a much simpler task to do under perl than say writing a C
subroutine.  Can anyone offer some tidbits or code snippets that do what I
want?  I'd greatly appreciate any help anyone could offer!

Thanks,

Kevin
--
Kevin Myer
Technical Services Specialist
ELANCO School District

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 03 Nov 1998 08:16:51 -0800
From: "Jerome O'Neil" <jeromeo@atrieva.com>
Subject: Re: Reference Safety
Message-Id: <363F2C73.8391137B@atrieva.com>

Zenin wrote:

> Jerome O'Neil <jeromeo@atrieva.com> wrote:
> : I have been working with large hashes, and am concerned about scoping
> : issues when passing their references arround.  If one sub returns a hash
> : reference for use in another sub, at what point does the reference fall
> : out of scope?
>
>         I don't think it's scope you're worried about here, but more likely
>         the total life span of the data.  Data dies when its reference count
>         goes to zero.
>

As long as we are talking about the same fruit, we can call it apples or
oranges.   I am always pleased when people listen to what I mean, and not what
I say.  (It's a trick my wife taught me.)  ;->

[Excellent discussion of reference counts and garbage collection sniped]


> Welcome to reference counting garbage collection.  This works far
> better then a "real" GC, until you do this:
>
> $a = \$b;
> $b = \$a;
>

What if, however, I had done this:

sub useahashref(\%){
    my($hashref) = shift;
}

What are the implications for $hashref now?  Are there any special
considerations for @_?

Thanks!

--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Tue, 03 Nov 1998 11:12:07 -0500
From: Jay Moore <shjmoore@sprynet.com>
Subject: regexp and date, help
Message-Id: <363F2B56.238443A4@sprynet.com>

This is a multi-part message in MIME format.
--------------9838CF8013AE2CF1AFE5629C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Help,
I'm trying to break up a date variable into several fields.  However, my
string match is not matching anything.  There must be a cleaner way of
doing this as well.  Any help would be appreciated.

The following code:
 ....
$date = $smtp{"DATE"};
print $date;
($dow,$day, $month, $year, $hour, $min, $sec, $timezone) = $date  =~
/(^\w\w\w\s), (\d\d\s) (\w\w\w\s)(\d\d\d\d\s) (\d\d):(\d\d):(\d\d)
(.*)$/;
print ("\nThe date is: $dow $day $month $year $hour $min $sec
$timezone\n");
 .....


Produces the following output:

Fri, 07 Aug 1998 13:33:22 -0400
The date is:

What is wrong with my string match?

thanx in advance,
Jay Moore

--------------9838CF8013AE2CF1AFE5629C
Content-Type: text/x-vcard; charset=us-ascii;
 name="shjmoore.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Jay Moore
Content-Disposition: attachment;
 filename="shjmoore.vcf"

begin:vcard 
n:Moore;Jay 
tel;work:703.351.5870 x252
x-mozilla-html:TRUE
org:Domain Techonolgies
adr:;;1901 N. Ft Myer Drive;Arlington;VA;;
version:2.1
email;internet:moorejay@netscape.net
title:Senior Unix Systems Engineer
fn:Jay Moore
end:vcard

--------------9838CF8013AE2CF1AFE5629C--



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

Date: Tue, 03 Nov 1998 11:28:36 -0500
From: "Michael D. Hofer" <featheredfrog@geocities.com>
To: Jay Moore <shjmoore@sprynet.com>
Subject: Re: regexp and date, help
Message-Id: <363F2F34.1D4@geocities.com>

I'm sure you'll get a bunch of replies, but why not use a couple of
splits rather than a long regexp?


#!/bin/perl -w

use strict;

my $date='Fri, 07 Aug 1998 13:33:22 -0400';
my ($dow, $day, $month, $year, $time, $zone) = split /\s+/,$date;
my ($hour, $min, $sec) = split /:/,$time;
$dow =~ s/,//;

print "$date\n";
print ("\nThe date is: $dow $day $month $year $hour $min $sec $zone\n");


Seems to work for me (perl5.004_04)

Jay Moore wrote:
> 
> Help,
> I'm trying to break up a date variable into several fields.  However, my
> string match is not matching anything.  There must be a cleaner way of
> doing this as well.  Any help would be appreciated.
> 
> The following code:
> ....
> $date = $smtp{"DATE"};
> print $date;
> ($dow,$day, $month, $year, $hour, $min, $sec, $timezone) = $date  =~
> /(^\w\w\w\s), (\d\d\s) (\w\w\w\s)(\d\d\d\d\s) (\d\d):(\d\d):(\d\d)
> (.*)$/;
> print ("\nThe date is: $dow $day $month $year $hour $min $sec
> $timezone\n");
> .....
> 
> Produces the following output:
> 
> Fri, 07 Aug 1998 13:33:22 -0400
> The date is:
> 
> What is wrong with my string match?
> 
> thanx in advance,
> Jay Moore
> 
>     ---------------------------------------------------------------
> 
>                                  Name: shjmoore.vcf
>                Part 1.2          Type: text/x-vcard
>                              Encoding: 7bit
>                           Description: Card for Jay Moore

-- 
Cian ua'Lochan /mka/ Michael D. Hofer
I'm not a medievalist - I just play one on weekends!
http://www.geocities.com/SoHo/Lofts/9800/


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

Date: Tue, 03 Nov 1998 14:25:19 GMT
From: kush@dircon.co.uk
Subject: volunteers needed to test javascript database
Message-Id: <71n3of$5hb$1@nnrp1.dejanews.com>

Hi there information pros

I am currently seeking volunteers to carry out a beta test of a new
search engine called Advanced Sniffer.

Advanced Sniffer is a Javascript based database developed to aid in the
searching of Info Connect (the librarian's no 1 directory in
cyberspace).

Please do a couple of searches (especially with boolean and proximity
operators) and send feedback to me.

Thanks

Advanced Sniffer is at http://www.users.dircon.co.uk/~kush/manual.htm

Regards

Godfrey Oswald
Info Connect
London

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 03 Nov 1998 08:54:41 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: What is the "correct" location of perl under Solaris?
Message-Id: <363F1931.B35B6B41@email.sps.mot.com>

[posted to comp.lang.perl.misc and copy emailed]

Martin Gregory wrote:
> 
> Tk Soh <r28629@email.sps.mot.com> writes:
> > I wonder why we couldn't just let the #! look for Perl by just PATH variable.
> >
> > -tk
> 
> We do.  We use this at the top of perl scripts...
> 
> eval 'exec perl -w -S $0 ${1+"$@"}'     # Use the  -*- perl -*- on our path
>      if 0;
> 
> .. no more #! problems...

Wow, this is great! Mind explain to me how it work? Thanks.

-tk


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

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

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