[8974] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2592 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 14 08:10:39 1998

Date: Thu, 14 May 98 05:01:16 -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           Thu, 14 May 1998     Volume: 8 Number: 2592

Today's topics:
        Accessing Oracle tables from Perl <ryant@pacbell.net>
        ANNOUNCE: Bit::Vector 5.3 <sb@sdm.de>
        ANNOUNCE: Date::Calc 4.0 <sb@sdm.de>
    Re: Another flock question... <txapi@xures.ei.uvigo.es>
    Re: Compile RE pat only when I change pat? (Henk Penning)
        Compiling Perl <xiaoyu@singnet.com.sg>
    Re: CPAN intended audience? (was Re: CPAN & Module grip <sb@sdm.de>
    Re: Extracting duplicated entries ... (InVisions Graphics)
    Re: Finding answers <sowmaster@juicepigs.com>
        format write and cutting the words <demaille@inf.enst.fr>
    Re: format write and cutting the words <sowmaster@juicepigs.com>
        gethostbyaddr not working in perl5.00401? tdj@mail.com
    Re: How can you break out of a 'while... ' loop in a fu (Stuart Wright)
        how to get subroutine name? (Oleg Yu. Polyanski)
    Re: how to get subroutine name? (brian d foy)
    Re: How to run Perlscript thru IIS? <perlguy@inlink.com>
        Matching the last character in a scalar <hauk@forumnett.no>
    Re: MODULE MANIA STRIKES (Was Re: What does this do?) (Tina Marie Holmboe)
    Re: MODULE MANIA STRIKES (Was Re: What does this do?) (Tina Marie Holmboe)
    Re: need help capturing error (Tina Marie Holmboe)
    Re: Nuclear bombing of NEW YORK! Small countries can ta (Stuart McDow)
    Re: Nuclear bombing of NEW YORK! Small countries can ta (Stuart McDow)
    Re: Please help w/ form mailing (InVisions Graphics)
    Re: program cannot run in CGI but in Perl on NT <perlguy@inlink.com>
    Re: read file backwards <sowmaster@juicepigs.com>
        reading file into an array of hash <xah@best.com>
    Re: Regular Expression Question <aidan@crux.blackstar.co.uk>
    Re: Running Perl on Windows (Steven Wayne)
        script opens new window <thijs@esense.nl>
    Re: sourcing a file in Perl (Tina Marie Holmboe)
    Re: Tearing my hair out over Regular Expressions - help (brian d foy)
        Tip: How to access a hash through a pointer greene@gucc.org
    Re: Tip: How to access a hash through a pointer (David A. Black)
        user "nobody"? (*/chebs )
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 14 May 1998 02:04:23 -0700
From: "ryant" <ryant@pacbell.net>
Subject: Accessing Oracle tables from Perl
Message-Id: <6jebok$9af$1@nnrp4.snfc21.pbi.net>

Hi,

I have a problem which I hope someone out there can help me with.  I have to
write some Perl code to access an Oracle database.  My question here is how
difficult would this be to perform straight from the script vs. writing
persistent object layers to perform the same tasks?  Additionally, how much
time and effort is required to write object libraries in Perl.

Thanks
Ryan




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

Date: 14 May 1998 11:00:16 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANNOUNCE: Bit::Vector 5.3
Message-Id: <6jeis0$r6k$2@bsdti6.sdm.de>

I am pleased to announce version 5.3 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.3:
--------------------------

The method "Norm()" has been further improved to become still a bit more
efficient.

The upgrade utility "upgrade_BV52" (a shell script) was ported to Perl
(now named "upgrade_BV53.pl"), making it faster, more flexible and easier
to read and maintain and -- last but not least -- executable under
Windows NT/95 as well.

Moreover, a similar tool for upgrading from "Set::IntegerFast" version 3.x
to "Bit::Vector" version 4.2 (called "upgrade_BV42.pl") was added.

Support for Windows NT/95 was also improved by adding the extension ".txt"
to all text files (where possible) in order to allow opening them with a
double-click.

Finally, the document "CHANGES.txt" was completely rewritten because
it had become a terrible mess.


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: 14 May 1998 10:58:47 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANNOUNCE: Date::Calc 4.0
Message-Id: <6jeip7$r6k$1@bsdti6.sdm.de>

I am pleased to announce version 4.0 of the "Date::Calc" 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 (useful for C developers) which is the
core of a Perl (wrapper) module (for easy access to the library from Perl).

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


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

This package consists of a C library and a Perl module (which uses
the C library, internally) for all kinds of date calculations based
on the Gregorian calendar (the one used in all western countries today),
thereby complying with all relevant norms and standards: ISO/R 2015-1971,
DIN 1355 and, to some extent, ISO 8601 (where applicable).

(See also http://www.engelschall.com/u/sb/download/Date-Calc/DIN1355/
for a scan of part of the "DIN 1355" document (in German)).

The module of course handles year numbers of 2000 and above correctly
("Year 2000" or "Y2K" compliance) -- actually all year numbers from 1
to the largest positive integer representable on your system (which
is at least 32767) can be dealt with.

Note that this package EXTRAPOLATES the Gregorian calendar BACK
until the year 1 A.D. -- even though the Gregorian calendar was only
adopted in 1582 by most (not all) European countries, in obedience to
the corresponding decree of catholic pope Gregor I in that year.

Some (mainly protestant) countries continued to use the Julian calendar
(used until then) until as late as the beginning of the 20th century.

Finally, note that this package is not intended to do everything you could
ever imagine automagically for you; it is rather intended to serve as a
toolbox (in the best of UNIX spirit and traditions) which should, however,
always get you where you want to go.

If nevertheless you can't figure out how to solve a particular problem,
please let me know! (See e-mail address at the bottom of this document.)


Changes in version 4.0:
-----------------------

 +  Complete rewrite of the XS file.
 +  Extensive rewrite of the C library at the core.
 +  Changed the naming conventions for function names from all lower case
    to mixed upper- and lower case.
 +  Added systematic exception handling.
 +  Renamed the package from "Date::DateCalc" to simply "Date::Calc".
 +  Renamed the corresponding files as well as the files of the C core.
 +  Added a new Perl function "Week_of_Year()" (replacing "week_number()").
 +  Changed the Perl function "Week_Number()" to call the C function
    "Week_Number()".
 +  Added new functions System_Clock()", "Today()", "Now()" and
    "Today_and_Now()".
 +  Added "check_business_date()", "Standard_to_Business()" and
    "Business_to_Standard()".
 +  Ported the functions from "Date::DateCalcLib" from Perl to C.
 +  Dropped the module "Date::DateCalcLib".
 +  Added multi-language support.
 +  Enhanced support for Windows NT/95.
 +  Complete rewrite of the demo programs.
 +  Complete rewrite of the documentation.
 +  Added many new tools, including a utility for upgrading existing
    applications automatically and a filter for conversions between
    different character sets (ISO-Latin-1 and PC "CP 850").


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: Thu, 14 May 1998 10:42:24 +0200
From: Jose Manuel Lopez Franco <txapi@xures.ei.uvigo.es>
Subject: Re: Another flock question...
Message-Id: <355AAE70.476D@xures.ei.uvigo.es>

Hi i,am, well ...
THANK YOU for the information... 
-- 
  Jose Manuel Lopez Franco
http://xures.ei.uvigo.es/~txapi
mailto:txapi@xures.ei.uvigo.es


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

Date: 14 May 1998 09:07:59 GMT
From: henkp@cs.ruu.nl (Henk Penning)
Subject: Re: Compile RE pat only when I change pat?
Message-Id: <6jec9f$qov$1@krant.cs.ruu.nl>

In <Pine.GSO.3.96.980513094053.21974n-100000@user2.teleport.com> Tom Phoenix <rootbeer@teleport.com> writes:

>On Wed, 13 May 1998, Peng Li wrote:
>
>> What I mean is, in the while loop, can PERL just compile one time in the
>> reg exp /$pat/, and recompile it again when I recall the function match.
>
>Sure, but you'll need to be tricky. :-)

 I've always wondered why perl doesn't store the RE with the machine.
 Instead of always, or never, rebulding the machine (depending on /o),
 it could compare the new RE with the RE of the machine.

 If this is too expensive, it could be the semantics of /o :
 try to use the old machine. This would not break existing progs.

 Am I missing something?

>Tom Phoenix       Perl Training and Hacking       Esperanto

 Henk Penning

--
Henk P. Penning, Dept of Computer Science, Utrecht University \__/  \__/  \
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. \__/  \__/
Telephone: +31-30-2534106, fax: 2513791, NIC-handle: HPP1 _/  \__/  \__/  \
News.answers http://www.cs.ruu.nl/cgi-bin/faqwais    \__/  \__/  \__/  \__/


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

Date: 14 May 1998 10:39:00 GMT
From: "LauRenCe WonG" <xiaoyu@singnet.com.sg>
Subject: Compiling Perl
Message-Id: <01bd7f24$f411cf40$683615a5@singnet>

Hello!
 
any good compilers to recommend for perl?  i heard there are only a few
compilers in the market and most are still in process of modifications and
a lot of patches.  i need a compiler to compile my scripts becoz i need to
pass the scripts to a friend who doesnt have a perl interpreter.  

Any suggestions are welcome, please kindly tell me of any sites which you
know i can download the compiler. thanks!

LauRence


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

Date: 14 May 1998 10:42:15 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: CPAN intended audience? (was Re: CPAN & Module gripes)
Message-Id: <6jehq7$pjn$1@bsdti6.sdm.de>

In comp.lang.perl.misc Earl Hood <ehood@medusa.acs.uci.edu> wrote:
> In article <3553f9f4.0@news.one.net>, Mike Heins <mikeh@minivend.com> wrote:

> >I would be willing to take on the additions to the PAUSE -- I see
> >it as a simple script to present a series of existing directories in
> >the application area, along with an input to create a new one, and the
> >corresponding symlinking to the authors/ID directory. It could stand
> >alone, I think, and be just another option area on the PAUSE menu.

> I think this would be great.  Are there any objections from
> other PAUSE maintainers.

No, great idea!

I already had a discussion about this with Andreas years ago that led to
nothing, alas.

I'm greatly in favour of this idea!

BTW, excellent statement of yours, Earl!

(Emphasizing what the "C" in CPAN actually stands for).

Yours,
-- 
    Steffen Beyer <sb@engelschall.com>
    Free Perl and C Software for Download: www.engelschall.com/u/sb/download/


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

Date: 14 May 1998 08:12:36 GMT
From: ig@gwi.net (InVisions Graphics)
Subject: Re: Extracting duplicated entries ...
Message-Id: <6je91k$mqs$1@noc1.gwi.net>

Well, one way would be to store all the 'keys' in a hash table, and have the keys shift each line into any array, then see which values in the hash have arrays with more than one element in it. Not terribly efficient maybe, but it works.

while(<DATA>) {
@keys = split /;/, $_;
push @{$lines{$keys[1]}} ,$_;
}

foreach $key (keys $lines) {
  $this_line_repeated if $#{$lines{$key}};
}

This is just pseudo code, mind you, and I'm sure there are much better ways to do it. Hope this helps some, though.

Chiu Chong-kan (ckchiu@cs.cuhk.hk) wrote:
: 
: Hi folks,
: 
:     I've got a file in the following format:
: 
: 123;ABC;test0
: 324;BBC;test1
: 100;ABC;test2
: 324;AAA;test3
: 999;BBC;test4
: .
: .
: 
:    What I want to do is to extract the rows with duplicated values on a
: specific column and put them into a file.  For example, if I treat
: the second column as key, the output file should be:
: 
: 123;ABC;test0
: 100;ABC;test2
: 324;BBC;test1
: 999;BBC;test4
: 
: If I treat the first column as key, the output should be:
: 
: 324;BBC;test1
: 324;AAA;test3
: 
: Anyone idea ?  Can anyone kindly give me a help ?
: 
: C.K.
: --
: Chong-kan Chiu				Dept.of Computer Science & Engineering
: E-mail : ckchiu@cs.cuhk.edu.hk 		The Chinese University of Hong Kong
: Phone  : (852) 2609-8422 		Shatin, Hong Kong

-- 
   >>>>>>>>>>>>>>>>>>>>>>>>>InVisions Graphics<<<<<<<<<<<<<<<<<<<<<<<<<
   http://www.gwi.net/ig/ - http://www.gwi.net/ig/archive/ - ig@gwi.net
     <<Digital Graphics - Java - HTML - CGIs - Animated Gifs - etc!>>
              Check out our new FREE web graphics archive!


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

Date: Thu, 14 May 1998 07:44:18 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: Finding answers
Message-Id: <355AD912.754F@juicepigs.com>

Tad McClellan wrote:
> 
> Website Construction Company (websites@erols.com) wrote:
> : I want to be independant as far as finding answers to questions.
> 
> Bravo!!
> 
> : I
> : remember once seeing someone using grep to search all of the
> : documentation to find answers. How did they do that? How would one do
> : it for Win95 version?
> 
> I don't speak Win95, but I do speak Perl, so let's grep with perl:
> 
>    perl -ne 'next unless /^=/; print if /My_Search_Term/' *.pod
> 

Win95 has a find function where you can tell it to search for files
containing the text you specify and if you chose to copy the pods into
html when you installed you can just search the perl/html directory and
then use your browser to read the files that it returns.
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 14 May 1998 12:24:30 +0200
From: Akim Demaille <demaille@inf.enst.fr>
Subject: format write and cutting the words
Message-Id: <qylemxxi201.fsf@ubu.enst.fr>


Hi!

I would like to know if there are means to tweak a bit the algorithm
Perl uses to cut/split on several lines too big an input for a format.

To say it with an example (which is also my question), I find very
nice that it cuts at word boundaries, but what if I wanted that it
_never_ cuts too long a word to fit in the field?

	How can I make sure Perl won't cut a word so that it
	fits in a field?

(Another wish could be to perform hyphenation, etc.  Hence I suppose a
general scheme to specify the way you'd like the fields to cut their
arguments would be pleasant).

Regards,
	Akim

-- 
P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
E-mail: demaille@inf.enst.fr
V-mail: +33 1 45 81 78 68


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

Date: Thu, 14 May 1998 07:17:14 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Akim Demaille <demaille@inf.enst.fr>
Subject: Re: format write and cutting the words
Message-Id: <355AD2BA.3C32@juicepigs.com>

[posted & mailed]

Akim Demaille wrote:
> 
> Hi!
> 
> I would like to know if there are means to tweak a bit the algorithm
> Perl uses to cut/split on several lines too big an input for a format.
> 
> To say it with an example (which is also my question), I find very
> nice that it cuts at word boundaries, but what if I wanted that it
> _never_ cuts too long a word to fit in the field?
> 
>         How can I make sure Perl won't cut a word so that it
>         fits in a field?
> 
> (Another wish could be to perform hyphenation, etc.  Hence I suppose a
> general scheme to specify the way you'd like the fields to cut their
> arguments would be pleasant).

Your question is a little bit confusing but I think what you are looking
for is the TEXT::Wrap module. I'm not sure if there is a wrap module
that will hyphenate words though.

HTH
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Thu, 14 May 1998 11:06:29 GMT
From: tdj@mail.com
Subject: gethostbyaddr not working in perl5.00401?
Message-Id: <6jej7k$ll4$1@nnrp1.dejanews.com>

Hello,

I found that the following function

  gethostbyaddr

works fine if I use the perl version:
  #!/usr/bin/perl

however it return empty results if I use the perl version:
  #!/usr/bin/perl5.00401

Any idea what the problem is?  Is it a bug of perl 5.00401? Any workaround?

Thank you for any help.

Ted

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 14 May 1998 09:03:56 GMT
From: stu-w@usa.net.remove.everything.after.net (Stuart Wright)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <355ab368.3756952@news.demon.co.uk>

On Wed, 13 May 1998 21:57:30 -0400, rjk@coos.dartmouth.edu (Ronald J Kimball) wrote:

>What's the point of programming in Perl if you don't have perl?  That's
>like programming in C without a C compiler.  You get a nice text file
>that does absolutely nothing.
>
It does plenty when it's uploaded to the server !


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

Date: 14 May 1998 12:01:53 +0400
From: luke@jet.msk.su (Oleg Yu. Polyanski)
Subject: how to get subroutine name?
Message-Id: <huu1ztxuvpq.fsf@jet.msk.su>

Hello.

	How can i get the name of a subroutine currently running?

/Oleg


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

Date: Thu, 14 May 1998 04:53:31 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: how to get subroutine name?
Message-Id: <comdog-ya02408000R1405980453310001@news.panix.com>
Keywords: from just another new york perl hacker

In article <huu1ztxuvpq.fsf@jet.msk.su>, luke@jet.msk.su (Oleg Yu. Polyanski) posted:

>        How can i get the name of a subroutine currently running?

see the documentation on the caller() function:

   #!/usr/bin/perl
   
   &foo();
   
   sub foo
      {  
      print "I'm in the subroutine called ", (caller(0))[3], "\n";
      }
      
   __END__
   
   I'm in the subroutine called main::foo

if you are doing AUTOLOAD stuff, look at $AUTOLOAD.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Thu, 14 May 1998 11:00:20 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: How to run Perlscript thru IIS?
Message-Id: <355ACEC4.A07D9101@inlink.com>

Try going to www.perl.com and clicking on the link that says "Windows
NT". 

The answer to your question can be found there.

HTH,

Brent


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

Date: Thu, 14 May 1998 13:19:31 +0200
From: Hauk Langlo <hauk@forumnett.no>
Subject: Matching the last character in a scalar
Message-Id: <355AD343.E540D01A@forumnett.no>

Hi there. After playing around with perl for a week or so, regular
expressions still are somewhat confusing.
Right now I would like to check if a scalars last letter(s) match either
"/" or ".txt". The ".txt" mach is not too much of a problem because such
a match would in most cases be the end of the scalar anyway. I know how
to detect a  / , but I would like a true condition only if it is the
last character. For experienced perl programers, this should be no
problem at all. I would be very thankfull if you could bother to help me
on this one. Thanks

Hauk Langlo




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

Date: 14 May 1998 11:05:04 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: MODULE MANIA STRIKES (Was Re: What does this do?)
Message-Id: <6jej50$hdh$4@news1.sol.no>

In article <6jam9n$ueh$1@cyprus.atlantic.net>,
	chip@mail.atlantic.net (Chip Salzenberg) writes:

> Your requests are contradictory.
> 
> What the user _wants_ and _asks_for_ is A.
> What the user _needs_ is B.
> 
> Now which answer do you ask for?  Make up your mind, please.

  My mind is quite made up, thankyou. The issue, here, isn't what the user
_needs_ - but what the user _asked_.

  The specific question was for help with a specific routine. The answer that
created the thread was a no-answer; namely telling the user to go use another
approach to a problem which was perceived by the person making the reply.

  Subsequently, the original user never got a chance to learn about read(),
but _perhaps_ a chance to learn about a module that he/she _perhaps_ had
some use of. With time, the poster might _perhaps_ even figure out how the
read() routine - which *was* what he wanted to know - works.

  Oh joy.

  "I want to do CGI programming. Any tips?" - "Use CGI.pm" - GOOD answer.
  "I want to learn how the read() function works." - "Use CGI.pm" - NO answer.


  (Do one really *need* to put IMHO on these things?)

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 14 May 1998 11:10:13 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: MODULE MANIA STRIKES (Was Re: What does this do?)
Message-Id: <6jejel$hdh$5@news1.sol.no>

In article <6jamen$uf2$1@cyprus.atlantic.net>,
	chip@mail.atlantic.net (Chip Salzenberg) writes:

>>  Agreed. However, I want to take this one step further: one MAY NOT expect
>>people to learn good, or even correct, Perl programming by reading module
>>source code; be those modules everso much from CPAN.
> 
> No way.  Perl code is Perl code.  There is no substitute for learning
> by example.

  Right.

   "I want to learn how to drive!"
   "Well, there's nothing like experience! Go out and look at how its done,
    kid, then come back when you've learned."


  Of course there is no substitue for learning by example - when the
fundamentals *stick*. There was a thread earlier on about

   if ( $a = "something" ) ...

  ie. the trick of assigning and testing at the same time. *Some* posters
thought that to be *great* style; some was not so positive. So, which Perl
code should someone learn by example from then ?

  Perhaps someone introduced objective quality checking of CPAN modules
since last I looked there ?

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 14 May 1998 10:13:23 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: need help capturing error
Message-Id: <6jeg43$hdh$2@news1.sol.no>

In article <EswAp8.4CA@world.std.com>,
	aep@world.std.com (Andrew E Page) writes:

>     Sounds like you want to open up a pipe.  

  It does indeed, but:



>     open( READ_OUTPUT, "prog2 |") || die "open failed\n" ;
> 
>     while( <READ_OUTPUT> ) {
>       # Process output in $_
>     }
> 
> Ref Programming Perl 2nd Edition, Larry Wall, O'Reilly & Assoc, pg 341

  I'd like to point you to the Perl FAQ, 

     "Why doesn't open() return an error when a pipe open fails?"

  which was pointed to me earlier by Tad. I suggest you backtick and check
  for errors in $? instead... OR use the solution in the FAQ.

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 13 May 1998 04:47:19 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <6jb8kn$55b$1@ns1.arlut.utexas.edu>

Jonathan Feinberg <jdf@pobox.com> writes:
> 
> Did this remind anyone else of the stuff that's printed on those
> wonderful Dr. Bronner's Essene soap bottles?

print <<SOAP;

DON'T DRINK SOAP! KEEP OUT OF EYE! DILUTE! DILUTE! OK!

SOAP

:-)

--
Stuart McDow                                     Applied Research Laboratories
smcdow@arlut.utexas.edu                      The University of Texas at Austin
            "Look for beauty in roughness, unpolishedness"


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

Date: 13 May 1998 04:44:26 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <6jb8fa$4ln$1@ns1.arlut.utexas.edu>

Jonathan Feinberg <jdf@pobox.com> writes:
> 
> Did this remind anyone else of the stuff that's printed on those
> wonderful Dr. Bronner's Essene soap bottles?

print <<SOAP;

DON'T DRINK SOAP! KEEP OUT OF EYE! DILUTE! DILUTE! OK!

SOAP

:-)

--
Stuart McDow                                     Applied Research Laboratories
smcdow@arlut.utexas.edu                      The University of Texas at Austin
            "Look for beauty in roughness, unpolishedness"


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

Date: 14 May 1998 08:20:37 GMT
From: ig@gwi.net (InVisions Graphics)
Subject: Re: Please help w/ form mailing
Message-Id: <6je9gl$mqs$2@noc1.gwi.net>

Well, I know there is a mail utility that imitates the unix mail command for NT, if you want to just port Unix mail procedures to NT, but as the previous responder said, there are a few modules, such as smtp that may help you as well. I do not know where that utility is, however, but it shouldn't be too hard to find.

Jennifer Verk (skydive@megsinet.net) wrote:
: Hi there.  I'm really new to perl.  Through examples and reading I've
: come up with a custom script to take the contents of a form and appends
: it to a log file.  Now, I need to know how to add to this to have the
: logfile emailed.
: 
: I think I know how to do it for a Unix machine....but I'm using WinNT
: IIS.  Someone please help me.  If it makes a difference, we are also
: using FastTrack and LiveWire (which I don't know much about...yet  :o)
: 
: Thanks.
: 
: =============================
: Jennifer
: skydive@megsinet.net
: =============================
: 

-- 
   >>>>>>>>>>>>>>>>>>>>>>>>>InVisions Graphics<<<<<<<<<<<<<<<<<<<<<<<<<
   http://www.gwi.net/ig/ - http://www.gwi.net/ig/archive/ - ig@gwi.net
     <<Digital Graphics - Java - HTML - CGIs - Animated Gifs - etc!>>
              Check out our new FREE web graphics archive!


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

Date: Thu, 14 May 1998 11:08:37 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: program cannot run in CGI but in Perl on NT
Message-Id: <355AD0B5.DD4BC7DD@inlink.com>

First, you have to call it using the FULL path and drive letter on the
server.

Second, I recently had problems passing command-line parameters to a DOS
program so I created a BAT file to call the DOS program.  Then I called
the BAT file from Perl and all was well.

I know that this sounds like a total kludge, but let me assure you, it
IS a total kludge :-)  BUT IT WORKS!

Try out these options and let me know where you get with it...

Brent
My job is to create SOLUTIONS, not give excuses!


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

Date: Thu, 14 May 1998 07:38:43 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Website Construction Company <websites@erols.com>
Subject: Re: read file backwards
Message-Id: <355AD7C3.2582@juicepigs.com>

[mailed & posted]

Website Construction Company wrote:
> 
> I looked in many places, and I know I have seen the answer before but
> can't find it, so....
> 
> How do you read from the bottom line up in a text file?

perldoc -f reverse

HTH
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Thu, 14 May 1998 04:21:04 -0700
From: "Xah" <xah@best.com>
Subject: reading file into an array of hash
Message-Id: <6jejnl$dfq$1@nntp2.ba.best.com>

A fairly lame question:

I want to parse a file into an array of hashes such as

$record = (
 {seller_ship_carrier=>'UPS',
   seller_street_address=>'4299 Court Court Apt: 3',
   seller_state=>'Ohio',...},
 {...},
 ...
);

where the file content has the following form:

#---------being sample file.

--

seller_ship_carrier: 
seller_street_address: 668 Elmdale Rd.
seller_state: CA

--
seller_ship_carrier: UPS

seller_state: Ohio
seller_street_address: 4299 Court Court Apt: 3

--

#--------end sample file.


What's a *GOOD* way to do it? Thanks for any directions.

Note:
* the value of a key may me empty.
* the value of the key may contain ":", but the key never contain ":".
* Not to assume that there are only short number of keys. (using
"which/switch" methods are probably not good.)
* Records are separated by "--\n", but there may be extra spaces between
each line.
* The order of the keys in each line may not be consistant.

Current I read them in as an array by setting $/ to "--", then do the chore
to clean the array... fairly cumbersome.

 Xah, xah@best.com
 http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
 "I'm a programer, you're a programmer."


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

Date: Thu, 14 May 1998 10:38:26 GMT
From: Aidan Rogers <aidan@crux.blackstar.co.uk>
Subject: Re: Regular Expression Question
Message-Id: <895145912.821610@sparc.tibus.net>

Thanks very much for the advice, and explanations. I got everything working 
just fine now :)

Aidan


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

Date: Thu, 14 May 1998 08:33:57 GMT
From: steven@amber.co.uk (Steven Wayne)
Subject: Re: Running Perl on Windows
Message-Id: <355eab87.2530398@news.demon.co.uk>

genfil@my-dejanews.com wrote:

>I need help!
>I write perl scripts on unix and now I have to write scripts on NT and
>Win95.
>Is there an equivalent of  "#!/usr/bin/perl" on NT and Win95?
>Thank you!

You can use:

#!/perl/bin -w

etc to put any command line switches in, but this won't cause the program
to run as it does in Unix. To do this you will have to associate the .pl
extension with c:\perl\bin\perl.exe and name your perl scripts xxx.pl

Do you know how to do this?

Steven.


-- 
We pray for one last landing, on the globe that gave us birth,
To rest our eyes on fleecy skies, and the cool green hills of Earth.
                                                  -- R.A. Heinlein
http://www.ambercomputing.demon.co.uk/


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

Date: 14 May 1998 11:26:11 GMT
From: "Mathijs Oosterom" <thijs@esense.nl>
Subject: script opens new window
Message-Id: <01bd7f2a$da8bf040$a44a6dc2@earl.esense.nl>

Hi all,

I have the following problem: 

I wrote a script that can be activated after filling out a form. The script
generates a new html-file. The problem is that the script opens a new
windows for the new html-file.

I would like the new html-file to replace the html-file with the form in
it.

Does anyboy know what the problem could be?

Thanks in advance,

Thijs.


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

Date: 14 May 1998 10:17:43 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: sourcing a file in Perl
Message-Id: <6jegc7$hdh$3@news1.sol.no>

In article <3558ABB5.77F0396A@shell.com>,
	Yong Huang <yong@shell.com> writes:

> The statement exec "/bin/csh", "myscript.csh"; doesn't affect the current
> process. It only affects the child process. I don't know how to change the
> current process setting (e.g. environment variables).

  Might I suggest a look at the Perl FAQ; specifically:

   "I {changed directory, modified my environment} in a perl script. How
    come the change disappeared when I exited the script? How do I get my
    changes to be visible?"

  Good luck!

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: Thu, 14 May 1998 04:05:14 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Tearing my hair out over Regular Expressions - help!
Message-Id: <comdog-ya02408000R1405980405140001@news.panix.com>
Keywords: from just another new york perl hacker

In article <3559f6e5.4095422@news.cableinet.co.uk>, ljs@cableinet.co.uk (Luke Steele) posted:

>"CONTACT:  Luke Steele  \nADDRESS: asdf  \n" =~
>/^CONTACT:\s*(.*)\s*\n/gmi;

you want that capture to be non-greedy:

   /^CONTACT:\s*(.*?)\s*\n/gmi;
   
>$&==CONTACT:_______Luke Steele___
>$1==Luke Steele___
>
>(The idea is $1 should contain Luke Steele with no spaces afterward.)

but why use a regex?

   #!/usr/bin/perl
   
   my @lines = split /\n/, "CONTACT:  Luke Steele  \nADDRESS: asdf  \n";
   
   foreach my $line ( @lines )
      {
      my($field, $value) = split /:\s+/, $line, 2;
   
      $value =~ s/\s+$//;
   
      print "[$field] [$value]\n";
      }
   __END__
   
   [CONTACT] [Luke Steele]
   [ADDRESS] [asdf]

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Thu, 14 May 1998 10:24:25 GMT
From: greene@gucc.org
Subject: Tip: How to access a hash through a pointer
Message-Id: <6jegon$ia8$1@nnrp1.dejanews.com>

I'm not exactly a newbie to perl (I've been using it for over 18 months), but
have often wondered what the proper form is for de-referencing pointers to a
hash. After a bit of trial-and-error, I've found that the following code
works, and is accepted even with 'use strict' turned on.

I feel that this is not well explained in either the on-line docs or in the
Camel or Gekko books. Hopefully this will help out some other people:

#!/perl/bin/perl -w

use strict;

my %Hash = ('One' => "(1)",
         'Two' => "(2)",
         'Three' => "(3)"
        );

foreach (keys %Hash) {
    print "$_ => $Hash{$_}\n";
}
# prints, as expected:
#    Three => (3)
#    Two => (2)
#    One => (1)

my $hashref = \%Hash;
print "hashref = $hashref\n";
# prints
#    hashref = HASH(0x88bee0)

foreach (keys %$hashref) {
    print "$_ => $$hashref{$_}\n";
}
# note the 'magic' here - %$hashref is the syntax for referencing a hash
# through a pointer, and $$hashref{$key} is the syntax for referencing
# a hash element. I guess the problem here was that I was trying to use
# the * operator, as any good C programmer would.
# This foreach loop prints, as expected,
#    Three => (3)
#    Two => (2)
#    One => (1)

I hope that this information is useful to somebody. This code has been tested
on a WinNT system running PERL 5.004_02, with the command perl -w, and
generated no errors.

--
# James Greene - Informatics Consulting - D-79539 Loerrach, Germany
# Internet: www.gucc.org/greene/consult - greene@gucc.org
# PGP Fingerprint: 8930 41E7 351B 56D8 801C  D4D9 4C76 AF0F E24E F307
perl -we "$_=join'<',qw{d2by' f5e;f4z($iu w0@86yo=&ae b!097)l(&aa8vme
b$*};$_=unpack'u*',uc;print"

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 14 May 1998 07:18:19 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Tip: How to access a hash through a pointer
Message-Id: <6jejtr$5ir$1@earth.superlink.net>

Hello -

greene@gucc.org writes:

>I'm not exactly a newbie to perl (I've been using it for over 18 months), but
>have often wondered what the proper form is for de-referencing pointers to a
>hash. After a bit of trial-and-error, I've found that the following code
>works, and is accepted even with 'use strict' turned on.

>I feel that this is not well explained in either the on-line docs or in the
>Camel or Gekko books. Hopefully this will help out some other people:

I doubt you'll find much on pointers in Perl documentation, since Perl
doesn't have pointers.  (Though there's a fair amount about them
in perlguts.)


>foreach (keys %$hashref) {
>    print "$_ => $$hashref{$_}\n";
>}
># note the 'magic' here - %$hashref is the syntax for referencing a hash
># through a pointer, and $$hashref{$key} is the syntax for referencing
># a hash element. I guess the problem here was that I was trying to use
># the * operator, as any good C programmer would.
># This foreach loop prints, as expected,
>#    Three => (3)
>#    Two => (2)
>#    One => (1)


Describing this as a way around the unavailability of the C * operator
seems like a solution in search of a problem.

Have a look at perlref:

   Anywhere you'd put an identifier (or chain of identifiers) as
   part of a variable or subroutine name, you can replace the
   identifier with a simple scalar variable containing a reference
   of the correct type:

     $bar = $$scalarref;
     push(@$arrayref, $filename);
     $$arrayref[0] = "January";
     $$hashref{"KEY"} = "VALUE";
     &$coderef(1,2,3);
     print $globref "output\n";

   It's important to understand that we are specifically NOT
   dereferencing $arrayref[0] or $hashref{"KEY"} there.  The
   dereference of the scalar variable happens BEFORE it does any
   key lookups.


>I hope that this information is useful to somebody. This code has been tested
>on a WinNT system running PERL 5.004_02, with the command perl -w, and
>generated no errors.


Hmmm...  are we back to the issue of whether non-*nix systems have all
the docs?  No, please, no!


David Black
dblack@saturn.superlink.net


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

Date: Thu, 14 May 1998 10:05:11 GMT
From: chebs@elfin.org (*/chebs )
Subject: user "nobody"?
Message-Id: <355bc1aa.3378383@news.demon.co.uk>

Hi
I would like to write a script to check if a my chat server is 
still running and if not start it up again.

I have been experimenting with:

$pscheck = `ps -ef |grep chebs`;

if($pscheck =~ /chatServer/i){
   $start = `java chatServer &`;
}

Is there any way to start the process with my 'login' as id 
instead of 'nobody' when calling the script from a browser?

or is that a bad idea?

If it's better to use 'cron' to run the script would it run 
as 'me' or 'nobody'?

Many thanks
chebs


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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