[8977] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2595 Volume: 8

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

Date: Thu, 14 May 98 09:00: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           Thu, 14 May 1998     Volume: 8 Number: 2595

Today's topics:
        ANNOUNCE: Bit::Vector 5.3 <sb@sdm.de>
        ANNOUNCE: Date::Calc 4.0 <sb@sdm.de>
    Re: Automate connection w/ SB1000 <rootbeer@teleport.com>
    Re: creating some sort of deamon <brianm@kodak.com>
    Re: Does Perl have a IDE?I don't like command line. (Sitaram Chamarty)
    Re: Does Perl have a IDE?I don't like command line. (Koos Pol)
    Re: Get file date greene@gucc.org
    Re: memory efficiency question (Jari Aalto+usenet.nil)
    Re: memory efficiency question <br@ndon.com>
    Re: MODULE MANIA STRIKES (Was Re: What does this do?) (Tina Marie Holmboe)
        New module: Tie::LLHash.pm (ordered hashes) (Ken Williams)
    Re: output to a certain place in the HTML-file <brianm@kodak.com>
    Re: password <brianm@kodak.com>
    Re: Perl not and ! operator differences <tchrist@mox.perl.com>
    Re: Perl Not Showing Errors <tchrist@mox.perl.com>
    Re: Randomly sorting an array (Abigail)
    Re: script opens new window <brianm@kodak.com>
    Re: Seen a module for manipulating ZIP files? <rootbeer@teleport.com>
    Re: The battle against WIMPs (was Re: Does Perl have a  (Stuart McDow)
    Re: user "nobody"? <rootbeer@teleport.com>
    Re: What does this do? (John Porter)
    Re: writing simple XS functions (Ken Fox)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 14 May 1998 15:04:57 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANNOUNCE: Bit::Vector 5.3
Message-Id: <6jf16p$jcu$1@news.neta.com>

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 15:04:33 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANNOUNCE: Date::Calc 4.0
Message-Id: <6jf161$jct$1@news.neta.com>

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 15:30:16 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: James <chamberl@magpage.com>
Subject: Re: Automate connection w/ SB1000
Message-Id: <Pine.GSO.3.96.980514082915.21974R-100000@user2.teleport.com>

On 14 May 1998, James wrote:

> I don't know how to write a script to POST to a url of ACTION="http:/" 

If you have a valid HTTP URL, that's easy to do in Perl, with the LWP
module. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 14 May 1998 11:22:38 -0400
From: Brian Mathis <brianm@kodak.com>
To: Mathijs Oosterom <thijs@esense.nl>
Subject: Re: creating some sort of deamon
Message-Id: <355B0C3E.8D0807D6@kodak.com>

[posted and emailed]

Mathijs Oosterom wrote:
> 
> Hi,
> 
> I have a script that sends mail to certain persons after checking if today
> is the right date to do that. So the scripts sends mail every day, but
> every dat to different addresses. All data is stored in a database.
> 
> This script must be activated only once a day, because the date doesn't
> change during the day :)). This means that this script can't be related to
> accessing a website or filling out a form or something. It should act like
> a deamon or something.
> 
> Does anyboy know how to realise this?
> 
> Thanks,
> 
> Thijs.

On UNIX, 'man cron'

Brian Mathis


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

Date: 14 May 98 12:46:30 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <slrn6ljp9t.1ju.sitaram@ltusitaram.diac.com>

On 13 May 1998 06:36:28 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:

>P.S.  Btw, for those counting keystrokes, here is how you do it with
[snip]
>If I had source code for the viewer, I would improve it a lot :-( ;-),
>but even in this form it is infinitely better than nothing (what man +

Precisely.  On Unix you usually do have the source code (even if
using a proprietary Unix, you can still install and use GNU
tools).  If you can change the BOOK viewer, you can certainly
write a similar one that uses existing *text*-based help files
(POD, HTML, whetever...).

My very modest (internal to my employer's firewalls, fortunately
for the rest of the world!) web pages have a very modest and quite
simple search engine that does almost what you described.  I'm
sure there are others that might fit your description better.

Even if no one no one has done *exactly* what VIEW.EXE can do, the
fact is that it *can be done*, while on OS/2 you are left wishing
for the source code.

Sitaram
-------
who would be using OS/2 now, if he hadn't been hooked on Linux!
IOW - dont get me wrong, Ilya, I think OS/2 is great, and I'm not
knocking it here...


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

Date: 14 May 1998 14:48:15 GMT
From: koos@stag (Koos Pol)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jf07f$9iu@news.nl.compuware.com>

Greg Bacon (gbacon@cs.uah.edu) wrote:
| 	koos@stag (Koos Pol) writes:
| : Flipping pages is
| : better that flipping manpages after all...

| I'm not sure who said it first (I suspect Tom C.), but you can't grep
| dead trees.

This is only part of the truth.


| : I program, but it
| : doesn't mean it has to be the archaic way.

| It's sad to learn that thought and understanding have been deprecated.

They are not depreciated. However, the programming environment is there
to serve *me*. Any way to make my programming life easier is
considered a pro. In this respect, IDE's, online help, etc can be a
very valuable add-on.
"Thought and understanding" as such are a misargument.

--
Koos Pol
----------------------------------------------------------------------
S.C. Pol                                           tel: +31 20 3116122
Systems Administrator                      email: Koos_Pol@bigfoot.com
Compuware Europe                 PGP public key available upon request

      A little inaccuracy sometimes saves tons of explanation.
                        -- H. H. Munroe


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

Date: Thu, 14 May 1998 15:27:25 GMT
From: greene@gucc.org
Subject: Re: Get file date
Message-Id: <6jf2gt$dsk$1@nnrp1.dejanews.com>

In article <6j8fgi$n20$1@imsp009a.netvigator.com>,
  "Chris Fu" <fuc@esquel.com> wrote:
>
> Hi everybody,
> Anyone knows how to use script to fetch the file date?
> Best rgds

Yup. Try
    perldoc -f stat

--
# 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: 14 May 1998 18:07:43 +0300
From: Jari Aalto <<jari.aalto@poboxes.com> (Jari Aalto+usenet.nil) >
Subject: Re: memory efficiency question
Message-Id: <tb7m3onb5s.fsf@blue.sea.net>

|Tue 98-05-12 tmornini@netcom.com (Tom Mornini) comp.lang.perl.misc
| Ala Qumsieh (aqumsieh@matrox.com) wrote:
| 
| : > @myarray=<FILEHANDLE>
| : >
| : > David
| 
| :  This loads the entire file into an array. This should be faster, but if
| : your file is large, you might have memory problems ...
| : Using either approaches really depends on your application.
| 
| You'd better benchmark that! I assumed the same thing and found that line
| at a time was somewhat faster than loading into an array! Reading the whole
| file into a scalar, however, was very fast...


So what is the fastest way? What code did you use to read the file
directly to scalar?

    1.
        @file = <FILE>;

    2.

        while ( <FILE> )
        {
            push @FILE, $_;
        } 


    3.

        $file = join '', <FILE>;
        @file = split '\n', $file;


jari



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

Date: Thu, 14 May 1998 11:19:59 -0400
From: Brandon Golm <br@ndon.com>
Subject: Re: memory efficiency question
Message-Id: <355B0B9F.5AD3F7C4@ndon.com>

> | You'd better benchmark that! I assumed the same thing and found that line
> | at a time was somewhat faster than loading into an array! Reading the whole
> | file into a scalar, however, was very fast...
> 
> So what is the fastest way? What code did you use to read the file
> directly to scalar?


{
	local $/ = undef;
	$file = <FILE>;
}


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

Date: 14 May 1998 15:05:26 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: MODULE MANIA STRIKES (Was Re: What does this do?)
Message-Id: <6jf17m$e80$1@news1.sol.no>

In article <MPG.fc4cce12c8f4689896c3@news.min.net>,
	jdporter@min.net (John Porter) writes:

> Now I'm not against learning how to use read() -- I'm for it -- but
> after a while you start to recognize that many questions, as asked,
> are really symptoms of a deeper misunderstanding.

  Very true - but: the original question in this thread fell into the:

    "Having read something I don't understand"

  rather than the

    "Having written something that doesn't work"

  class. In the latter instance I'd agree with you fully - the poster was
  trying to re-invent the wheel. In the former, however, the poster seemed
  to have read something he/she didn't understand, and wanted explained.

  Now there's a tad different, methinks.

-- 
  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 15:03:39 GMT
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: New module: Tie::LLHash.pm (ordered hashes)
Message-Id: <6jf14b$jcp$1@news.neta.com>

Hi,

The uploaded file

    Tie-LLHash-0.01.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/KWILLIAMS/Tie-LLHash-0.01.tar.gz
  size: 3558 bytes
   md5: fdfe60855a65dcb763ad32f86db7b614


Here's a snippet from the documentation:

DESCRIPTION
  This class implements an ordered hash-like object. It's a cross between
a Perl 
  hash and a linked list. Use it whenever you want the speed and structure of a 
  Perl hash, but the orderedness of a list.

  Don't use it if you want to be able to address your hash entries by number, 
  like you can in a real list (i.e. $list[5]).

  See also Tie::IxHash by Gurusamy Sarathy. It's similar (it does ordered 
  hashes), but it has a different internal data structure and a different
flavor 
  of usage. It makes your hash behave more like a list than this does.

SYNOPSIS
     use Tie::LLHash;

     tie (%hash, "Tie::LLHash"); # A new empty hash

     # Add some entries:
     (tied %hash)->first('the' => 'hash');
     (tied %hash)->insert('here' => 'now', 'the');
     (tied %hash)->first('All' => 'the');
     (tied %hash)->insert('are' => 'right', 'the');
     (tied %hash)->insert('things' => 'in', 'All');

     $value = $hash{'things'}; # Look up a value
     $hash{'here'} = 'NOW';    # Set the value of an EXISTING RECORD!


     $key = (tied %hash)->key_before('in');  # Returns the previous key
     $key = (tied %hash)->key_after('in');   # Returns the next key

     # Luxury routines:
     $key = (tied %hash)->current_key;
     $val = (tied %hash)->current_value;
     (tied %hash)->next;
     (tied %hash)->prev;
     (tied %hash)->reset;




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

Date: Thu, 14 May 1998 11:27:34 -0400
From: Brian Mathis <brianm@kodak.com>
To: jm@kolumbus.fi
Subject: Re: output to a certain place in the HTML-file
Message-Id: <355B0D66.2B02A20A@kodak.com>

[posted and emailed]

Jari Martikainen wrote:
> Hi!
> 
> I have a script that adds the data from a form to the bottom of the
> HTML-file. Is it possible to put the data to a certain place within
> HTML? What is the Perl syntax and how do I define the place in HTML?
> 
> If this is not possible, what is the syntax to put the data to the top
> of the HTML-document.
> 
> Thanks in advance,
> Jari

Take a look at the s/// operator, it will do what you want nicely. 
Here's a simple example:

-----------------------------
undef $/;
$data = <DATA>;
$/ = "\n";

$data =~ s/REPLACE/This is the new text/g;

print $data;


__DATA__
the text of my file is here
line2
REPLACE
line4
line5

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

Brian Mathis


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

Date: Thu, 14 May 1998 11:10:45 -0400
From: Brian Mathis <brianm@kodak.com>
Subject: Re: password
Message-Id: <355B0975.1236E764@kodak.com>

Martien Verbruggen wrote:
> How do you know what my intent is? My intent was to make him aware of
> the fact that it is not secure. What he does with that is his
> business, not mine. It's his responsibility to make decisions based on
> the information he can find about it. If he implements this, without
> any precautions or thought, he might find himself involved in a law
> suit down the track when in some way one of those passwords gets
> intercepted.
> 
> There are security issues involved. It has nothing to do with
> paranoia. It has to do with being _aware_ of the issues, and being
> _informed_.
> 
> Martien
> --

I'm not neccessarily claiming *your* intent, just intent in general. 
He's already stated that the users are telnetting to the machine, and
passwords go over the net in plaintext when telnetting.  That is the
weak link.  Sending them over the web doesn't make them any more or less
secure.  That said, and understood, the only conclusion that can be
drawn from the statement, "doing it over the web is insecure", is that
the intent of the statement is to make the user paranoid.

I want to make it clear that I am not trying to personally attack you,
but I'm trying to clarify what many people, including yourself, seem to
think is an issue.  You just happened to post a message about the issue.


Brian Mathis


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

Date: 14 May 1998 15:30:43 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl not and ! operator differences
Message-Id: <6jf2n3$r7j$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Jari Aalto <jari.aalto@poboxes.com> writes:
:    Can someone give me an example when I have to use ! operator
:    over "not". It seems that the more readable "not" is much
:    better in code that will be maintained in big projects.

You have it entirely backwards.  

"!" is to be preferred over "not" in all circumstances.
"not" should not have been added to the language.

Sure, it lets you say
    if (not $a = f())
rather than
    if (!($a = f()))
but you should have been saying
    unless ($a = f()) 
all along.

Or consider how different are

  $x = $a && $b;
vs
  $x = $a and $b;

Or consider how different are

  $x = !$c ? $a : $b;
vs
  $x = not $c ? $a : $b;

Stop trying to hide from punctuation.  You confuse
people and make code hard to maintain.

All these bogotic "and", "or", and "not" absurdities do is push
down knowledge of operator precedence from one place in the language
to the other.  They also make it harder to read and maintain code.
Punctutation is a good thing.  Too many words turn into lisp, which 
no one claims easy to read.

capital all these bogotic quote and quote comma quote or quote comma
and quote not quote absurdities do is push down knowledge of operator
precedence from one place in the language to the other period capital
they also make it harder to read and maintain code period capital
punctutation is a good thing period Too many words turn into lisp
comma which no claims easy to read period


    foreach (@sections) {
	/head1 (.*)/;
	my $count = 0;
	while (/\n/g) { $count++ }
	$max = length($1) if $max < length($1);
	$_ = [ $_, $1, " ($count)" ];
    }


foreach scalar default IN array sections 
  BEGIN FOREACH
    MATCH default 
      WITH string OF "head1" space keep nonnewline repeated endkeep
    my scalar count gets assigned 0
    while MATCH default WITH newline globally
      BEGIN WHILE
	add one to scalar count
      END WHILE
    if scalar max less than length of first keep
      BEGIN IF
	scalar max gets assigned length of first keep
      END IF
    scalar default gets assigned CONSTRUCT anonymous array
	BEGIN LIST
	  scalar default 
	    followed by 
	  first keep
	    followed by 
	  string OF space and "(" and scalar count and ")"
	END LIST
  END FOREACH

If you're happy than that, please try Cobol.  And consider
writing a calculus book without using and symbolic notation.

--tom
-- 
    If I allowed "next $label" then I'd also have to allow "goto $label",
    and I don't think you really want that...  :-) [now works in perl5!]
            --Larry Wall in <1991Mar11.230002.27271@jpl-devvax.jpl.nasa.gov>


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

Date: 14 May 1998 15:34:04 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Not Showing Errors
Message-Id: <6jf2tc$r7j$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, gwebb@reedtech.com writes:
:I just want perl to report every single error it finds and not "save"
:me from seeing a flood of errors that result from one faultly line.

You must have taken different courses in compiler theory and construction
than I did.  Error recovery is extremely difficult.  A cascade of
errors is useless.  Flood suppression makes perfect sense, because
after the first error or three, the remaining ones are all red herrings.
Perl quite rightly gives up until you fix the start of the flood.

--tom
-- 
A power tool is not a toy.  Unix is a power tool.


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

Date: 14 May 1998 15:50:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Randomly sorting an array
Message-Id: <6jf3sv$4c2$1@client2.news.psi.net>

Chip Salzenberg (chip@mail.atlantic.net) wrote on MDCCXVI September
MCMXCIII in <URL: news:6jd6hg$a2$1@cyprus.atlantic.net>:
++ According to abigail@fnx.com:
++ >Chip Salzenberg (chip@mail.atlantic.net) wrote:
++ >++     sub shuffle {
++ >++         my @new;
++ >++         push @new, splice @_, rand @_, 1 while @_;
++ >++         @new;
++ >++     }
++ >
++ >Don't do that! It's horribly inefficient.
++ 
++ Worse than the exchange trick?  Why?


Quadratic vs linear behaviour, due to the splice. And in case
analysis doesn't convice you, here's a benchmark:


Benchmark: timing 10 iterations of chip, fisher_yates...
      chip: 397 secs (322.19 usr  0.23 sys = 322.42 cpu)
fisher_yates1: 48 secs (45.98 usr  0.37 sys = 46.35 cpu)
fisher_yates2: 40 secs (37.29 usr  0.01 sys = 37.30 cpu)


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

use strict;
use Benchmark;


sub chip_shuffle {
    my @new;
    push @new, splice @_, rand @_, 1 while @_;
    @new;
}


sub fisher_yates_shuffle {
    my $array = @_ == 1 && ref $_ [0] eq 'ARRAY' ? shift : [@_];
    for (my $i = @$array; -- $i;) {
        my $r = int rand ($i + 1);
       ($array -> [$i], $array -> [$r]) = ($array -> [$r], $array -> [$i]);
    }
    wantarray ? @$array : $array;
}


my @list1 = (1 .. 50000);
my @list2 = (1 .. 50000);
my @list3 = (1 .. 50000);

timethese 10, {
    chip          => sub {@list1 = chip_shuffle @list1},
    fisher_yates1 => sub {@list2 = fisher_yates_shuffle @list2},
    fisher_yates2 => sub {fisher_yates_shuffle \@list3},
};
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Thu, 14 May 1998 11:21:19 -0400
From: Brian Mathis <brianm@kodak.com>
Subject: Re: script opens new window
Message-Id: <355B0BEF.9B18ECA9@kodak.com>

Mathijs Oosterom wrote:
> 
> 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?
> 

Well, it's not a perl problem.  try one of the html groups..


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

Date: Thu, 14 May 1998 15:28:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Gever Tulley <gever@helium.com>
Subject: Re: Seen a module for manipulating ZIP files?
Message-Id: <Pine.GSO.3.96.980514082810.21974Q-100000@user2.teleport.com>

On Thu, 14 May 1998, Gever Tulley wrote:

> I would like to create, list, and extract items from
> a ZIP file using Perl. Has anybody already written this?

If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-)  Hope this helps!

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 May 1998 15:30:08 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: The battle against WIMPs (was Re: Does Perl have a IDE?)
Message-Id: <6jf2m0$6dm$1@ns1.arlut.utexas.edu>

chip@mail.atlantic.net (Chip Salzenberg) writes:
> 
> Windows is helpless against the onslought of Linux and other free
> software.  Is M$ on the ropes?  No... but they're bleeding, and
> their counterpunches aren't landing.
>
> [The battle] is where it should be: Solid engineering.

This might be interesting. You've probably already seen it but here it
is anyway:

http://www.kirch.net/unix-nt.html

This is a good comparison of NT and Unix (Linux, really) by someone
who seems to be well informed. This page has a number of good links,
including one to a page that describes one unnamed Company's
disastrous attempt to convert their entire IT facility from being Unix
based to NT. This one is
http://www.aberdeen.com/research/comp/onsite/case1/body.htm

My favorite quote: The most stable NT machines "only" had to be
rebooted three or four times per day.


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


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

Date: Thu, 14 May 1998 15:48:27 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: */chebs <chebs@elfin.org>
Subject: Re: user "nobody"?
Message-Id: <Pine.GSO.3.96.980514084716.21974U-100000@user2.teleport.com>

On Thu, 14 May 1998, */chebs wrote:

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

You can often use 'kill 0' to check that a process is still alive.

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

Check out perlsec, and whether your system supports set-id Perl scripts.
Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 14 May 1998 15:32:09 GMT
From: jdporter@min.net (John Porter)
Subject: Re: What does this do?
Message-Id: <MPG.fc4da1eb17d926e9896c5@news.min.net>

On 8 May 1998 21:58:33 GMT,
in article <6ivv69$icf$1@marina.cinenet.net>,
cberry@cinenet.net (Craig Berry) wrote:
> J1T1W1 (j1t1w1@aol.com) wrote:
> : if someone could explain this line of code to me I would greatly appreciate
> : it.
> : 
> :               read(STDIN, $buf, $ENV{'CONTENT_SIZE'});
> 
> It inspects the value of the environment variable CONTENT_SIZE, and reads 
> that many bytes from the standard input stream into the scalar variable $buf.
> 
> This looks like the first step in a roll-your-own CGI input parser; if 

I rather hope that's not what j1t1w1 is trying to do,
since Content-Size is not a valid HTTP header.
But I get this sinking feeling...

John Porter



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

Date: 14 May 1998 14:50:10 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: writing simple XS functions
Message-Id: <6jf0b2$4d22@eccws1.dearborn.ford.com>

Jean-Luc Szpyrka <Jean-Luc.Szpyrka@sophia.inria.fr> writes:
> Ken Williams wrote:
> > I'm trying to get my feet wet learning XS by translating a few
> > functions in a module to XS.
> 
> You should also have a look at SWIG. This is really simplier to use
> than writing an XS stuff.

You forgot the "IMHO" disclaimer... ;)

SWIG can be helpful when wrapping large C or C++ libraries for use with
perl -- *very* helpful if you want to support multiple scripting
languages such as Perl, Tcl and Python.  However, if you have just a few
C functions that you only want to use with perl, XS is a good choice.
XS is also a good choice if you want to support Perl-specific calling
conventions.  (IMHO, replace "a good" with "the best." ;)

If you are trying to access perl functions from C, then you'll
definitely want to know about XS and the perl internals.  SWIG can't
help you at all in this direction.

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

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

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