[7920] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1545 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 29 10:08:16 1997

Date: Mon, 29 Dec 97 07:00:34 -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           Mon, 29 Dec 1997     Volume: 8 Number: 1545

Today's topics:
     Re: *Square Roots* (Gabor)
     ANNOUNCE: Bit::Vector 5.0 BETA 2 <sb@sdm.de>
     ANNOUNCE: Getopt::Long version 2.13 released <jvromans@squirrel.nl>
     Re: ARGV to read commandline input (Andrew M. Langmead)
     Re: Debugging a segfault/running from core <joseph@5sigma.com>
     Re: Faster way of calculating sum of absolute values? <joseph@5sigma.com>
     Re: Finding the TITLE to a HTML page <joseph@5sigma.com>
     Re: Finding the TITLE to a HTML page (Jonathan Stowe)
     Re: flock v.s. Sun OS <use@reply.address.com>
     Net::SOCKS (v0.02) (Clinton Wong)
     Netchannel Breckc@inetnebr.com
     Perl/Tk On Win32: Error when I run FileDialog example (Troy Denkinger)
     Re: Regex problem in 5.004_04 ? (regexp *+ operand coul S.Petersen@usa.net
     Re: Rejected email message Mikel@ap.net
     Re: Size in KB (brian d foy)
     Re: Size in KB <use@reply.address.com>
     Re: SQL and PERL <gcaldwel@scsn.net>
     Re: Using the 'my' option in 'for' loops <joseph@5sigma.com>
     Re: Wacky idea: a PERL server (brian moore)
     Re: Which language pays most? Smalltalk, not C++ nor Ja <jdporter@min.net>
     Re: word-wrap or insert \n every 50 bytes or less (brian d foy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 29 Dec 1997 03:32:48 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: *Square Roots*
Message-Id: <slrn6ae644.hqh.gabor@vinyl.quickweb.com>

In comp.lang.perl.misc, Brandon <ordway@iwshost.net> wrote :
# If I have a number $mynumber how do I take the square root of it??  Post it
# on here or email me at ordway@iwshost.net
# 
# Thanks!!
# 

Use the aptly named 'sqrt' operator?


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

Date: 29 Dec 1997 11:43:16 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANNOUNCE: Bit::Vector 5.0 BETA 2
Message-Id: <6882ck$bv1$1@bsdti6.sdm.de>

I am glad to announce the second beta release of version 5.0
of my "Bit::Vector" module:

                    =====================================
                      Package "Bit::Vector" Version 5.0
                    =====================================
                      for Perl version 5.000 and higher

It is available either from my web site at

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

or from any CPAN mirror server (allow a few days for propagation
if necessary):

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

This new beta release contains four new features:

1) Concatenation of bit vectors

2) Bit vectors of length zero (i.e, containing 0 bits) are now
   possible (in order to make concatenation and substitution
   more consistent and more versatile)

3) You can calculate the reverse of a bit vector now (the LSB
   becomes the MSB and vice-versa)

4) The C library at the core of this module now also performs
   parameter checks (which were done exclusively in the XS
   layer in all previous versions)

According to the feedback I received for version 5.0b1 (not a
single bug report!), that version seems to be very stable already.

I am confident that this is true for this version as well.

Should this assumption prove wrong, please do not hesitate to
leave me a message at <sb@sdm.de>!

Please note that the documentation is still rudimentary (synopsis
is quite complete but detailed descriptions are lacking), which is
also the main reason why I still call this version "beta".

Moreover, the accompanying test scripts do not cover all of the
new features yet; but these features have been tested on my machine
and should therefore work as intended.


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 (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),
     like the "Sieve of Erathostenes" (for calculating prime numbers),

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

  -  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 generation depending on logical expressions,

  -  for big integer arithmetic,

  -  for manipulations of chunks of bits of arbitrary size,

and more.

A large number of import/export methods allow you to access individual
bits, contiguous ranges of bits, machine words, arbitrary chunks of
bits, lists (arrays) of chunks of bits or machine words and a whole
bit vector at once (for instance for blockread/-write to and from
a file).

You can also import and export the contents of a bit vector in binary,
hexadecimal and decimal representation as well as ".newsrc" style
enumerations.

Note that this module is especially designed for efficiency, which is
also the reason why its methods are implemented in C.

To further increase execution speed, the module doesn't use bytes as its
basic storage unit, but rather uses machine words, assuming that a machine
word is the most efficiently handled size of all scalar types on all
machines (that's what the ANSI C standard proposes and assumes anyway).

In order to achieve this, it automatically determines the number of bits
in a machine word on your system and then adjusts its internal configuration
constants accordingly.

The greater the size of this basic storage unit, the better the complexity
(= execution speed) of the methods in this module, but also the greater the
average waste of unused bits in the last word.


Important note:
---------------

Note that the C library at the core of this module ("BitVector.c") can
also be used stand-alone (i.e., without Perl).

To do so, link the output file "BitVector.o" (which is produced when you
build this module or when you just compile "BitVector.c") with your
application.


Example applications:
---------------------

See the module "Set::IntegerRange" for an easy-to-use module for sets
of integers.

See the module "Math::MatrixBool" for an implementation of boolean
matrices.

(Both modules are also available from my web site or any CPAN server)

A tool relying crucially on this "Bit::Vector" module is "Slice" (see
also "http://www.engelschall.com/sw/slice/"), a tool for generating
different document versions out of a single master file. (This tool
was written by Ralf S. Engelschall).

This tool is itself part of another tool (by the same author), "WML"
(= "Website Meta Language"), which allows you to generate and maintain
large web sites (see also "http://www.engelschall.com/sw/wml/"). Among
many other features, it allows you to define your own HTML tags which
will be expanded either at generation or at run time, depending on your
choice.


New features in version 5.0:
----------------------------

In version 5.0b1, the following new methods have been added:

  -  Word_Bits()
  -  Long_Bits()
  -  Primes()
  -  Interval_Copy()
  -  Interval_Substitute()
  -  to_Bin()
  -  from_bin()
  -  to_Dec()
  -  from_dec()
  -  Insert()
  -  Delete()
  -  add()
  -  subtract()
  -  Negate()
  -  Absolute()
  -  Sign()
  -  Multiply()
  -  Divide()
  -  GCD()
  -  Block_Store()
  -  Block_Read()
  -  Word_Size()
  -  Word_Store()
  -  Word_Read()
  -  Word_List_Store()
  -  Word_List_Read()
  -  Word_Insert()
  -  Word_Delete()
  -  Chunk_Store()
  -  Chunk_Read()
  -  Chunk_List_Store()
  -  Chunk_List_Read()
  -  Index_List_Store()
  -  Index_List_Read()
  -  Transpose()

In version 5.0b2, the following new methods have been added:

  -  Index_List_Remove()
  -  Concat
  -  Concat_List
  -  Reverse
  -  Interval_Reverse

Please see the "Bit::Vector" man page (after installing this module)
for more details about these new methods.

The following methods have been re-implemented in C (instead of Perl):

  -  Version()
  -  Shadow()
  -  Clone()
  -  to_Enum()       (previously named "to_ASCII")
  -  from_enum()     (previously named "from_ASCII")

The following methods have been renamed:

  -  to_String()      -->    to_Hex()
  -  from_string()    -->    from_hex()
  -  to_ASCII()       -->    to_Enum()
  -  from_ASCII()     -->    from_enum()

(Aliases for the old names are still available but deprecated!)

And finally, the following methods are gone:

  -  lexorder()
  -  new_from_String()

A patch utility is available in the module's distribution to upgrade your
existing applications and to provide substitutes for the two methods that
are gone.


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

This package with all its parts is

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

Please read the file "LICENSE" in the module's distribution for details
about the exact terms under which this package may be used and distributed.


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

Perl version 5.000 or higher, a C compiler capable of the ANSI C standard (!)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


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

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

Also, if there is anything you would like to do with this module which
the module doesn't provide yet, please let me know! If it fits the module's
overall concept, I'll implement it as soon as possible. Frequently this is
only a matter of a few days.

I hope you will find this module beneficial!

Best Regards,
--
    Steffen Beyer <sb@sdm.de> 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
    >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: 29 Dec 1997 14:38:22 GMT
From: Johan Vromans <jvromans@squirrel.nl>
Subject: ANNOUNCE: Getopt::Long version 2.13 released
Message-Id: <688cku$f34$1@news1.teleport.com>

Version 2.13 of module Getopt::Long is now available via CPAN. It
should soon appear in directory authors/Johan_Vromans as file
GetoptLong-2.13.tar.gz. It will be standard part of Perl 5.005 or later.

Module Getopt::Long implements an extended getopt function called
GetOptions(). This function implements the POSIX standard for command
line options, with GNU extensions, while still capable of handling
the traditional one-letter options (including option bundling).

The README document is attached to this message.

The best way to download from CPAN is to use a Web browser and point
it to http://www.perl.com/CPAN/ (include the final slash!). It will
automagically be redirected to a CPAN site in your neighborhood. URL:
http://www.perl.com/CPAN/authors/Johan_Vromans

Changes in version 2.13
-----------------------

* All regexps are changed to avoid the use of $`, $& and $'. Using one
  of these causes all pattern matches in the program to be much slower
  than necessary.

* Configuration errors are signalled using die() and will cause the
  program to be terminated (unless eval{...} or $SIG{__DIE__} is
  used).

* Option parsing errors are now signalled with calls to warn().

* In option bundles, numeric values may be embedded in the bundle
  (e.g. -al24w80).

* More 'perl -w' warnings eliminated for obscure cases of bundling.

* Removed non-standard version number matching. Version 1.121 is now
  more than 1.12 but less than 1.13. 

Previous released version was 2.12.

---- README ----

Module Getopt::Long - extended processing of command line options
=================================================================

Module Getopt::Long implements an extended getopt function called
GetOptions(). This function implements the POSIX standard for command
line options, with GNU extensions, while still capable of handling
the traditional one-letter options.
In general, this means that command line options can have long names
instead of single letters, and are introduced with a double dash `--'.

Optionally, Getopt::Long can support the traditional bundling of
single-letter command line options.

Getopt::Long::GetOptions() is part of the Perl 5 distribution. It is
the successor of newgetopt.pl that came with Perl 4. It is fully
upward compatible. In fact, the Perl 5 version of newgetopt.pl is just
a wrapper around the module.

For complete documentation, see the Getopt::Long POD document or use
the command

    perldoc Getopt::Long

FEATURES
========

* Long option names

Major advantage of using long option names is that it is much easier
to memorize the option names. Using single-letter names one quickly
runs into the problem that there is no logical relationship between
the semantics of the selected option and its option letter.
Disadvantage is that it requires more typing. Getopt::Long provides
for option name abbreviation, so option names may be abbreviated to
uniqueness. Also, modern shells like Cornell's tcsh support option
name completion. As a rule of thumb, you can use abbreviations freely
while running commands interactively but always use the full names in
scripts. 

Examples (POSIX):

    --long --width=80 --height=24

Extensions:

    -long (convenience) +width=80 (deprecated) -height 24 (traditional)

By default, long option names are case insensitive.

* Single-letter options and bundling

When single-letter options are requested, Getopt::Long allows the
option names to be bundled, e.g. "-abc" is equivalent to "-a -b -c".
In this case, long option names must be introduced with the POSIX "--"
introducer.

Examples:

    -lgAd (bundle) -xw 80 (bundle, w takes a value) -xw80 (same)
    even -l24w80 (l = 24 and w = 80)

By default, single-letter option names are case sensitive.

* Flexibility:

  - options can have alternative names, using an alternative name
    will behave as if the primary name was used;
  - options can be negatable, e.g. "debug" will switch it on, while
    "nodebug" will switch it off.    
  - options can set values, but also add values producing an array
    of values instead of a single scalar value, or set values in a hash.

* Options linkage

Using Getopt::Long gives the programmer ultimate control over the
command line options and how they must be handled:

  - by setting a global variable in the calling program;
  - by setting a specified variable;
  - by entering the option name and the value in an associative array
    (hash) or object (if it is a blessed hash);
  - by calling a user-specified subroutine with the option name and
    the value as arguments;
  - combinations of the above.

* Customization:

The module contains a special method, Getopt::Long::config, to control
configuration variables to activate (or de-activate) specific
behavior. It can be called with one or more names of options:

  - default

	Restore default settings.

  - auto_abbrev      

	Allow option names to be abbreviated to uniqueness. 

  - getopt_compat   

	Allow '+' to start options.

  - permute
  - require_order           

	Whether non-options are allowed to be mixed with options.

	permute means that 

	    -foo arg1 -bar arg2 arg3

	is equivalent to

	    -foo -bar arg1 arg2 arg3

	(provided -foo does not take an argument value).

	require_order means that options processing
	terminates when the first non-option is encountered.

	    -foo arg1 -bar arg2 arg3

	is equivalent to

	    -foo -- arg1 -bar arg2 arg3

  - bundling

	Setting this variable to a non-zero value will allow 
	single-character options to be bundled. To distinguish bundles
	from long option names, long options must be introduced with 
	"--" and single-character options (and bundles) with "-".

  - ignore_case      

	Ignore case when matching options.

  - pass_through

	Do not issue error messages for unknown options, but leave
	them (pass-through) in @ARGV.

* Usable variables

  - $Getopt::Long::error

	Internal error flag. May be incremented from a call-back
	routine to cause options parsing to fail.

  - $Getopt::Long::debug           

	Enable copious debugging output. Default is 0.

AVAILABILITY
============

The official version for module Getopt::Long comes with the Perl 5
distribution. 
Newer versions will be made available on the Comprehensive Perl Archive
Network (CPAN), see "http://www.perl.com/CPAN/authors/Johan_Vromans".

COPYRIGHT AND DISCLAIMER
========================

Module Getopt::Long is Copyright 1990,1997 by Johan Vromans.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

-------------------------------------------------------------------
Johan Vromans                                  jvromans@squirrel.nl
Squirrel Consultancy                       Haarlem, the Netherlands
http://www.squirrel.nl       http://www.squirrel.nl/people/jvromans
------------------ "Arms are made for hugging" --------------------




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

Date: Mon, 29 Dec 1997 14:49:52 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: ARGV to read commandline input
Message-Id: <ELyH75.Bn1@world.std.com>

Curmudgeon <Curmudgeon@mbcf.org> writes:

>close(<ARGV>);

You probably don't want to do that.

the <> operator reads the next line of a text file. You are reading a
line from the text file and using it as an indirect filehandle to pass
to close.

Never mind that fact that you open a filehandle called "FILE" and are
trying to close one called "ARGV".

How about:

#!/usr/bin/perl -w

my $file = shift @ARGV;
my $pattern = shift @ARGV;

open FILE, $file or die "Can't open $file: $!\n";
while(<FILE>) {
  print if /$pattern/o;
}
close FILE;

Although you might want to steal a trick from "grep" and make the
pattern the first argument. That way you can use all the rest of the
files on the command line as files to search.

#!/usr/bin/perl -w
my $pattern = shift @ARGV;
while(<>) {
  print if /$pattern/o;
}
-- 
Andrew Langmead


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

Date: Mon, 29 Dec 1997 04:04:12 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Debugging a segfault/running from core
Message-Id: <34A783AB.27C53B91@5sigma.com>

What was your child script doing?  Was it a Perl program?

In general, if Perl seg faults that is a bug in Perl.  You should
report such bugs (and a method of reproducing the behavior) to
Perl 5 Porters with the perlbug program.

As far as figuring out where/what/when a Perl program is seg faulting,
there isn't anything high-tech that makes it simple.  You can try to 
debug from the core but only if you have built Perl with debugging 
support, which you probably haven't.

	-joseph
	 http://www.effectiveperl.com

Boris Statnikov wrote:
> 
> My configuration:
> 
> Running under perl 5.004_04 on Linux 2.0.  Library used: libwww5.18 (and
> consequently libnet and maybe some others).
> 
> My script crashed having caught SIG 139 (SIGSEGV) from the child
> script.  Since this is not a blatant programming error (i.e. memory
> allocation), I am somewhat at a loss as to what I might have done to
> eventually cause the script to crash [...]s


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

Date: Mon, 29 Dec 1997 02:34:55 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Faster way of calculating sum of absolute values?
Message-Id: <34A76E93.7D05230@5sigma.com>

Yet Another Way To Do It.  I have no idea whether it's the fastest
but it seems to be a step forward.

This is kind of a fun problem.  I'm thinking of making it the first
Effective Perl Programming contest problem ....

	-joseph
	 http://www.effectiveperl.com

use Benchmark;
$string1="5174";
$string2="7823";

#your[0] code

timethis(10000,<<'EO1');
@string1=split //, $string1;
@string2=split //, $string2;
$sum=0;
for ($i=0;$i<$#string1;$i++) {
        $sum+=abs($string1[$i]-$string2[$i]);
}
EO1

#your[1] code

timethis(10000,<<'EO2');
$sum=0;
for ($i=0;$i<$#string1;$i++) {
        $sum+=abs(substr($string1,$i,1)-substr($string2,$i,1));
}
EO2

#my code
timethis(10000, <<'EO3');
$sum=0;
my $s = $string1;
my $i = length $s;
vec($s, $i, 8) -= vec($string2, $i, 8) while $i--;
$s =~ tr/\367-\377/\11\10\7\6\5\4\3\2\1/;
$sum = unpack "%32C*", $s;
EO3


timethis 10000:  6 secs ( 6.54 usr  0.00 sys =  6.54 cpu)
timethis 10000:  4 secs ( 3.05 usr  0.00 sys =  3.05 cpu)
timethis 10000:  1 secs ( 1.72 usr  0.00 sys =  1.72 cpu)
{joseph}:108%


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

Date: Sun, 28 Dec 1997 21:43:25 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <34A72A49.301320@5sigma.com>

Tushar Samant wrote:
> 
> john@castleamber.com writes:
> >Eric Bohlman <ebohlman@netcom.com> wrote
> >
> >> <HTML>
> >> <HEAD>
> >> <TITLE>
> >> <!--Insert the title of the document after this
> >>   line but before the line that says </TITLE>-->
> >> </TITLE>
> >> ...
> >
> >weblint warns agains the use of mark up in comments. It is bad practice
> >to do so.
> 
> That's hardly the point... Take out the markup and you still have
> a counterexample. 

A comment inside <TITLE></TITLE> is a counterexample?  Well,
get rid of it then.

> Why is it bad practice to have markup inside
> comments, though? This is not a Perl question, but I am curious,
> and asking a sincere question. What possible use can comments have
> with a restriction like that?
> 

The point is, HTML is hard and slow to parse, and
anything that makes it easier to do a "good enough" job 
is worthwhile.

Consider how many code browsers and other tools (like
lint!) have been written for C and C++ that do not
completely parse the language.  Consider how many people
have adapted their coding styles to those tools.  Why 
should HTML be treated differently?  If complete parsing 
were such a compelling necessity, why wouldn't C/C++ tools 
have been doing it for the past 20 years?  Answer: quick
and dirty IS good enough for many, many applications.
If it's not, write something slower and cleaner!  But
there's no need to complain about a short, reasonably
useful solution if your answer is longer, more complex,
and doesn't offer anything extra to that particular
situation.

This is probably not a direction I should go, but when
I hear people arguing that such-and-such a program doesn't
parse all HTML perfectly, I often get the feeling the argument
is more about someone's infatuation with the grandeur of
SGML and not about the needs of a programmer trying to
deal with a few plain old HTML files.  Only a very few
applications need to deal with *any possible* HTML file.
Others have simpler requirements.

All that aside, if someone eventually whips up a fast
HTML (or SGML) parser with an easy to use interface (I don't
think the current modules are there yet), I'll be all for it.
But HTML is so convoluted and has so many subtleties that
I have my doubts about whether an efficient, user-friendly 
HTML parser will come to pass.

Well, that was probably too much like a Dennis Miller rant.
I'll back off and wish everyone a happy holiday season again,

	-joseph
	 http://www.effectiveperl.com


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

Date: 29 Dec 1997 14:10:47 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <688b17$4v$1@mendelevium.btinternet.com>

In article <686lc0$m0h@tekka.wwa.com>, scribble@pobox.com says...
<cut>
>Why is it bad practice to have markup inside
>comments, though? This is not a Perl question, but I am curious,
>and asking a sincere question. What possible use can comments have
>with a restriction like that?
>...

Well, Certainly MS Internot Explorer & the other one will actually try and 
parse such tags - strange but true, and thus display the rest of the 
commented text.  Many tales of woe regarding this can be find in 
comp.lang.javascript and other such places.


/J\



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

Date: 29 Dec 1997 10:14:43 GMT
From: "John Bokma" <use@reply.address.com>
Subject: Re: flock v.s. Sun OS
Message-Id: <01bd1442$d4a62fe0$02521e0a@tschai>



Tom Phoenix <rootbeer@teleport.com> wrote in article
<Pine.GSO.3.96.971228131748.26956K-100000@user2.teleport.com>...
> On 28 Dec 1997, John Bokma wrote:
> 
> > I've problems with flock on Sun OS,

Solaris.

> 
> Did your perl binary pass all of the 'make test' tests when it was
> compiled?

I run this code on a system to which I don't have root access and
I didn't (can't) compile perl on it. I read an old posting about problems
with sockets and flock with solaris.
 
> > I've written a counter based on the famous "Web Techniques" (nr 4).
> > But sometimes the counter-file is cleared and, hence the counter is
reset.
> 
> That's a sure sign that something is going wrong. :-)  But did you try
> installing Randal's original code to see whether the same problem occurs?

No, but the important part, i.e. the file locking is the same.

> 
> > pseudo code:
> 
> Do you want us to help you with pseudo debugging? :-)

I think the relevant parts are in it. No need to post 100 lines of code.
The file locking is not working. How I read/write the file doesn't 
really matter (or what I read/write), does it? Besides, I don't want
this question to end up in a endless "you should use ... instead of ...".
The flock isn't working, the rest of the code is not the problem.

I forgot to mention that the counter works most of the times, but
somehow can't read the file back once in a while. It resets the
counter. A small trick prevents this, now I read the file, when it's
empty the script sleep(1) and rereads the file. But I think that
is a bit stupid, because flock should make this not necessary. 

> Good luck!

8-).

John

-- 
------------------------------------------------------------------
C A S T L E  A M B E R      Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com



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

Date: 29 Dec 1997 14:40:03 GMT
From: clintdw@netcom.com (Clinton Wong)
Subject: Net::SOCKS (v0.02)
Message-Id: <688co3$f7o$1@news1.teleport.com>

A module for implementing SOCKS clients in perl is now available at:
http://postmaster.net/~clintdw/src/SOCKS-0.02.tar.gz

It's in the beginning states of development.  Feedback appreciated.

Cheers,
Clinton




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

Date: Sun, 28 Dec 1997 21:33:18 -0600
From: Breckc@inetnebr.com
Subject: Netchannel
Message-Id: <883365617.1479933954@dejanews.com>

I recently bought Netchannel for my computer phobic parents thinking that
would be the easiest way for them to get on the net.  Three day to get
connected. Only get recordings on toll free customer service line.  When
I did get through the fix that was need would have been impossible to
figure out.  It is extremely slow.  On a large TV the you still have to
scroll to see the screen.  Awkward to use.  I am boxing it up and taking
it back.  Has anyone had a similar experience?	Is Webtv better

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Mon, 29 Dec 1997 04:58:16 GMT
From: troy@whadda.com (Troy Denkinger)
Subject: Perl/Tk On Win32: Error when I run FileDialog example
Message-Id: <687b4h$2ts$1@nntp3.interaccess.com>

Platform: Win32
Perl version: 5.004_02
Perl/Tk version: 402.002

When I try to run the FileDialog example program that comes with the 
FileDialog.pm module on either WinNT or Win95, I get the following 
error:

C:\perlprog>perl tkfiledialog.pl Invalid master window .filedialog 
for filedialog at C:\PERL\lib\site/Tk/Submethods.pm line 34. 
at C:\PERL\lib\site/Tk/FileDialog.pm line 429

I've been through FileDialog.pm and Submethods.pm, and I'm unable to 
determine the cause of this error.  Has anyone seen it or know some 
trick to working with this widget under Win32?

I've included the example program below if, for some reason, you don't 
have it.

Regards,

Troy Denkinger

-------------->FileDialog example<-----------------

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

use Tk;
use Tk::FileDialog;
use strict;
 
my($main) = MainWindow->new;
my($Horiz) = 1;
my($fname);
my($LoadDialog) = $main->FileDialog(-Title =>'This is my title',
                                    -Create => 0);
$LoadDialog->configure(-FPat => '*pl',
                      -ShowAll => 'NO');
$main->Entry(-textvariable => \$fname)
       ->pack(-expand => 1,
              -fill => 'x');
$main->Button(-text => 'Kick me!',
             -command => sub {
                 $fname = $LoadDialog->Show(-Horiz => $Horiz);
                 if (!defined($fname)) {
                     $fname = "Fine,Cancel, but no Chdir anymore!!!";
                     $LoadDialog->configure(-Chdir =>'NO');
                 }
             })
       ->pack(-expand => 1,
              -fill => 'x');
$main->Checkbutton(-text => 'Horizontal',
                  -variable => \$Horiz)
       ->pack(-expand => 1,
              -fill => 'x');
$main->Button(-text => 'Exit',
             -command => sub {
                 $main->destroy;
             })
       ->pack(-expand => 1,
              -fill => 'x');
MainLoop;
print "Exit Stage right!\n";
exit;


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

Date: Mon, 29 Dec 1997 03:21:21 -0600
From: S.Petersen@usa.net
Subject: Re: Regex problem in 5.004_04 ? (regexp *+ operand could be empty)
Message-Id: <883386840.2107834383@dejanews.com>

In article <adelton.882806648@aisa.fi.muni.cz>,
  adelton@fi.muni.cz (Honza Pazdziora) wrote:

> The problem is that your code says in fact ([something]*)+ which is
> probably not what you want. Positive number of zeroes occurences is
> this zero, so that plus doesn't make sense with combination of star.
> So you probably want to change your line [^>'"] * to [^>'"] +. If
> there is nothing to fit it, the regexp engine will go to the single
> and double quote section, so you do not say if there is nothing to be
> found, OK, go for next round (which would probably end up with the
> same conclusion).

Hi Honza,

thanks for replying and pointing out the problem. I sent a note to the FAQ
maintainers about this problem.

All the best,
Stephan

S.Petersen@usa.net

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Mon, 29 Dec 1997 00:01:26 -0600
From: Mikel@ap.net
Subject: Re: Rejected email message
Message-Id: <883372561.1741225987@dejanews.com>

In article <comdog-2112971645320001@news.panix.com>,
  comdog@computerdog.com (brian d foy) wrote:
>
> In article <349D551D.7EE1@sonic.net>, mikel@ap.net wrote:
>
> > use MIME::Lite;
> > $msg = new MIME::Lite
> > From =>'starbird\@sonic.net',
> > To =>'mikel\@ap.net',
>
> > This runs, but the message is rejected by sendmail because the sender is
> > unknown.  But the login is right and has email on the site.
>
> what happens when you try
>
>    print 'starbird\@sonic.net';
>
> good luck :)
>
> --
> brian d foy                                 <http://computerdog.com>
>

I went in to edit the script and noticed that the backslash was missing
in the "To:" field address.  I added the backslash and the message was
sent correctly.  Sometimes the isp tweaks things, so there may be more to
the story, but my problem has vanished like the milk and cookies on
Christmas eve!

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Mon, 29 Dec 1997 05:51:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Size in KB
Message-Id: <comdog-2912970551260001@news.panix.com>

In article <34A721AF.3D40@arrowweb.com>, mhanson@arrowweb.com wrote:

> How do you tell the size of a string in KB. I have a string that is the
> contents of a file and i want to beable to tell how large it is before i
> save it to my server.

count how many characters are in the string (perhaps with length() ),
multiply by the number of bytes per character, then divide by 1000.

or check the file size for the file (perhaps with a file test
operator) from which the data came.

-- 
brian d foy                                 <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm


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

Date: 29 Dec 1997 12:37:01 GMT
From: "John Bokma" <use@reply.address.com>
Subject: Re: Size in KB
Message-Id: <01bd1456$b4b5d3c0$02521e0a@tschai>



brian d foy <comdog@computerdog.com> wrote in article
<comdog-2912970551260001@news.panix.com>...
> In article <34A721AF.3D40@arrowweb.com>, mhanson@arrowweb.com wrote:
> 
> > How do you tell the size of a string in KB. I have a string that is the
> > contents of a file and i want to beable to tell how large it is before
i
> > save it to my server.
> 
> count how many characters are in the string (perhaps with length() ),
> multiply by the number of bytes per character, then divide by 1000.

1024 8-).

> or check the file size for the file (perhaps with a file test
> operator) from which the data came.

If you do this on a dos/windos/nt machine, take care of the line
termination, which
differs from UNIX. 

John


-- 
------------------------------------------------------------------
C A S T L E  A M B E R      Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com



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

Date: Sun, 28 Dec 1997 16:30:10 -0500
From: "Gerald Caldwell Jr." <gcaldwel@scsn.net>
Subject: Re: SQL and PERL
Message-Id: <34a6c525.0@news.scsn.net>



Peter Salomonsen wrote in message <01bd138f$4ab6ffc0$e5684382@peterhome>...
>Does anyone know an easy and efficient way to connect Perl and a
>SQL-database in an unix/linux environment? Is there any free code
>available?
>
>Please CC your answer to pesalomo@online.no
>
>Peter
>


Look at these two sites.

http://www.hermetica.com/


http://mongoose.bostic.com/db/




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

Date: Sun, 28 Dec 1997 21:46:08 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Using the 'my' option in 'for' loops
Message-Id: <34A72AEC.BBD2653B@5sigma.com>

That may be the correct answer (pretty good guess, anyway) but
it would be nice to see Mashas's original code.

	-joseph
	 http://www.effectiveperl.com

Joe Gottman wrote:
> 
> mashas@amdocs.com wrote:
> >
> > Hello,
> > I wrote a recursive subroutine using two independent
> > 'for' loops.[...]
> >
> 
>     When you use 'my' within a for loop like that, the localized
> variable is local
> to that loop. Thus, in the second loop you were using a global variable,
> which got
> clobbered by the second loop in the recursive call.  When you declared
> the 'my'
> variable outside the loops, the variable is local to the subroutine (or
> at least
> to a block containing both loops) so both loops use the 'my' variable.
> You could also
> have declared the variable as 'my' within both for loops.  This would
> also have
> kept everyting local, but in this case you would in effect be using two
> different
> variables in the two loops, which might be a problem if you wanted the
> second loop to
> start where the first loop ended.


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

Date: 29 Dec 1997 06:40:11 GMT
From: bem@news.cmc.net (brian moore)
Subject: Re: Wacky idea: a PERL server
Message-Id: <687gkb$bco$2@news.cmc.net>

In article <67l27e$pve$1@mahler.udel.edu>,
	biell @ udel . edu (Bill Totten) writes:
> In article <wx090tlw0bz.fsf@sws5.ctd.ornl.gov>,
> Dave Sill  <dsill@sws5.ctd.ornl.gov> wrote:
>>Perl is nifty, but it's just too expensive to start up a new perl
>>process to handle a quick job like munging/matching mail/news headers
>>on a busy SMTP/NNTP server. Has anyone ever thought about the
>>possibility of running perl in a client/server mode, where
>>/usr/bin/perl is just a client that passes the script to a long-lived
>>server daemon and waits for the results? One obvious complication is
>>handling different users. The server could run as root, I suppose, but
>  <...>
> 
>   This is not really necessary, however.  In any reasonable OS, perl will
> stay in shared memory if you have enough of it.  So, if perl never leaves
> shared memory, you have the bulk of the program ready for use by anyone.
> The first time you start it, it will still need to be loaded.

Actually, it's unnecessary for another reason: INN, for example can be
easily built with perl hooks.  This allows a long running perl function
to scan message headers (and with a patch to INN, the body) looking for
articles to reject.  I drop well over 100k spams a day with this at a
cost of <10ms per message (with the current volumes of spam, this is
a huge win, since it's a lot of messages I don't write to disk :)).

Embedding a perl interpreter in other things (say, Apache) has also
been done with great effect: compile the stuff once, the perl functions
can be rerun quickly and simply.

Don't even have to run 'perl' itself, then: just libperl.

The best thing about perl5 is its ability to be embedded in other programs
and the huge collections of modules from CPAN.  Um, the two best things...

-- 
Brian Moore                      Kill A Spammer For Jesus
Sysadmin, C/Perl Hacker


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

Date: Mon, 29 Dec 1997 09:31:56 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Which language pays most? Smalltalk, not C++ nor Java.
Message-Id: <34A7B45C.403B@min.net>

Robert Dewar wrote:
> OK, so your compiler can compile memfoo without compiling. Wunderbar! But
> that does NOT mean that you can actually go ahead and call a routine memfoo
> if the standard forbids it. To do so would be incompetent programming.

So now a "language" is not defined by the compiler -- or even by the
preprocessor+compiler+linker+etc, as some have it...
I am forbidden by a piece of paper from calling a function 'memfoo'!

John Porter
jporter@logicon.com


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

Date: Mon, 29 Dec 1997 05:54:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: word-wrap or insert \n every 50 bytes or less
Message-Id: <comdog-2912970554380001@news.panix.com>

In article <34A70C34.5330@erols.com>, jcotton@erols.com wrote:

> Help.  I need to word-wrap a string variable.  Say:
> $string01 = 'bla bla bla bla bla bla bla bla etc....';

perhaps the Text::Wrap module would work for you :)

-- 
brian d foy                                 <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm


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

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

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