[19275] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1470 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 8 21:07:41 2001

Date: Wed, 8 Aug 2001 18:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <997319109-v10-i1470@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 8 Aug 2001     Volume: 10 Number: 1470

Today's topics:
        [ANNOUNCE] HTTP::WebTest 1.05 <ilya@martynov.org>
        ANNOUNCE: Getopt::Long 2.26 (Johan Vromans)
        code doesn't work from "learning perl" <david@phobia.ms>
    Re: code doesn't work from "learning perl" (Mark Jason Dominus)
    Re: code doesn't work from "learning perl" <Tassilo.Parseval@post.rwth-aachen.de>
    Re: code doesn't work from "learning perl" <l_pantin@hotmail.com>
    Re: cross reference? <leary@foad.NOSPAM.org>
    Re: cross reference? <leary@foad.NOSPAM.org>
    Re: cross reference? <l_pantin@hotmail.com>
        FAQ: How do I keep persistent data across program calls <faq@denver.pm.org>
    Re: Large file upload through https (Emmett)
    Re: newbie question... <gnarinn@hotmail.com>
    Re: Perl not releasing lock on file under Windows?? <Tassilo.Parseval@post.rwth-aachen.de>
        Perl Search Engine <AHALL5@nc.rr.com>
    Re: Perl Search Engine <l_pantin@hotmail.com>
    Re: perldoc is like Greek to a beginner?? <gnarinn@hotmail.com>
    Re: RegEXP's <l_pantin@hotmail.com>
    Re: Simple sorting question <sh@planetquake.com>
    Re: String manipulation <brentdax1@earthlink.net>
    Re: substring matching and assigning to variable (Kate T. Porter)
        Thanks All <jclover@nati.org>
    Re: Using a http proxy <nc@uq.net.au>
    Re: Where are those !'s coming from? (Eric M)
        Write to middle of file <sh@planetquake.com>
    Re: Write to middle of file <wyzelli@yahoo.com>
    Re: Write to middle of file <sh@planetquake.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 08 Aug 2001 23:47:04 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: [ANNOUNCE] HTTP::WebTest 1.05
Message-Id: <tn3k4hoh3sgaef@corp.supernews.com>


The uploaded file

    HTTP-WebTest-1.05.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/I/IL/ILYAM/HTTP-WebTest-1.05.tar.gz
  size: 60698 bytes
   md5: 8c9b0742f34310f41e35cca8fc1bdc36

NAME
    HTTP::WebTest - Test remote URLs or local web files

DESCRIPTION
    This module runs tests on remote URLs or local web files containing
    Perl/JSP/HTML/JavaScript/etc. and generates a detailed test report.

    The test specifications can be read from a parameter file or input as
    method arguments. If you are testing a local file, Apache is started on
    a private/dynamic port with a configuration file in a temporary
    directory. The module displays the test results on the terminal by
    default or directs them to a file. The module optionally e-mails the
    test results.

    Each URL/web file is tested by fetching it from the web server using a
    local instance of an HTTP user agent. The basic test is simply whether
    or not the fetch was successful. You may also test using literal strings
    or regular expressions that are either required to exist or forbidden to
    exist in the fetched page. You may also specify tests for the minimum
    and maximum number of bytes in the returned page. You may also specify
    tests for the minimum and maximum web server response time.

    If you are testing a local file, the module checks the error log in the
    temporary directory before and after the file is fetched from Apache. If
    messages are written to the error log during the fetch, the module flags
    this as an error and writes the messages to the output test report.

Changes since 1.04:

   * Installation of http-webtest directory is optional now for Unix
     platforms. It is completely disabled on Win32 platform.

   * Mentioned in docs that this module should work on Win32
     platform. Bug reports from this platform would be appreciated.

   * Do not use environment variable WEBTEST_LIB in 'wt' script. It
     seems to be needed only for debuging purposes and it was a source
     of many Perl warnings if it was not defined.

   * Sample Apache config file bundled with this module now contains
     directives to disable usage of apache access and resource config
     files.

   * Use File::Temp for sane creation of temporary directories.

   * Removed section 'CHANGES' from HTTP::WebTest POD docs since it
     became too long. Anybody interested in changes should consult
     this file.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




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

Date: 08 Aug 2001 16:32:10 +0200
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: ANNOUNCE: Getopt::Long 2.26
Message-Id: <tn3k545t7k00@corp.supernews.com>

Version 2.26 of module Getopt::Long has been released to CPAN. It will
be standard part of Perl 5.8.

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 easiest way to get it is by using the CPAN shell:

   perl -MCPAN -e 'install("Getopt::Long")'

Alternatively, use a Web browser and point it to the CPAN search engine:
  http://search.cpan.org/search?mode=module&query=Getopt::Long
  http://search.cpan.org/search?module=Getopt::Long

Changes in version 2.26
-----------------------

* New option type: 'o'. It accepts all kinds of integral numbers in
  Perl style, including decimal (24), octal (012), hexadecimal (0x2f)
  and binary (0b1001).

* Fix problem with getopt_compat not matching +foo=bar.

* Remove $VERSION_STRING for production versions.

Previous released version was 2.25.

---- 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::Configure, 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.

  - gnu_compat

	Compatibility with GNU getopt_long().

  - 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.

  - prefix

	The string that starts options. See also prefix_pattern.

  - prefix_pattern

	A Perl pattern that identifies the strings that introduce
	options. Default is (--|-|\+) unless environment variable
	POSIXLY_CORRECT has been set, in which case it is (--|-).

  - debug

	Enable copious debugging output.

* Object oriented interface:

Using the object oriented interface, multiple parser objects can be
instantiated, each having their own configuration settings:

    $p1 = new Getopt::Long::Parser (config => ["posix"]);
    $p2 = new Getopt::Long::Parser (config => ["no_posix"]);
    if ($p1->getoptions(...options descriptions...)) ...

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".
Or use the CPAN search engine:
  http://search.cpan.org/search?mode=module&query=Getopt::Long
  http://search.cpan.org/search?module=Getopt::Long

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

Module Getopt::Long is Copyright 2001,1990 by Johan Vromans.
This program is free software; you can redistribute it and/or
modify it under the terms of the Perl Artistic License or 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: Wed, 8 Aug 2001 18:23:21 -0400
From: David Hill <david@phobia.ms>
Subject: code doesn't work from "learning perl"
Message-Id: <20010808182321.4bbae64d.david@phobia.ms>

Hello -
	I am reading my "Learning Perl 2nd edition" book by Randal Schwartz.  In Chapter 3 on page 49, The examples given to not work as they say.

my @array = (1.2 .. 5.2); # same as (1.2, 2.2, 3.2, 4.2, 5.2)
my $size = @array;
my $i;

for ($i = 0; $i < $size; $i++) {
	print $array[$i] . "\n";
}

this prints
1
2
3
4
5

Shouldn't it print the following?
1.2
2.2
3.2
4.2
5.2

Thanks
- David






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

Date: Wed, 08 Aug 2001 22:38:52 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: code doesn't work from "learning perl"
Message-Id: <3b71bf4e.6907$9c@news.op.net>

In article <20010808182321.4bbae64d.david@phobia.ms>,
David Hill  <david@phobia.ms> wrote:
>Hello -
>	I am reading my "Learning Perl 2nd edition" book by Randal Schwartz.  In Chapter 3 on page 49, The examples given to not work as they say.

You are correct.  This is an error in the book. 

Accoding to:

        http://www.oreilly.com/catalog/lperl2/errata/

this was fixed in the October 1999 printing.
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Thu, 09 Aug 2001 00:47:56 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: code doesn't work from "learning perl"
Message-Id: <3B71C19C.4060503@post.rwth-aachen.de>

Mark Jason Dominus wrote:
> In article <20010808182321.4bbae64d.david@phobia.ms>,
> David Hill  <david@phobia.ms> wrote:
> 
>>Hello -
>>	I am reading my "Learning Perl 2nd edition" book by Randal Schwartz.  In Chapter 3 on page 49, The examples given to not work as they say.
>>
> 
> You are correct.  This is an error in the book. 
> 
> Accoding to:
> 
>         http://www.oreilly.com/catalog/lperl2/errata/
> 
> this was fixed in the October 1999 printing.

One should have also fixed the perlop-manpage then:

  "Binary ".." is the range operator, which is really two
   different operators depending on the context.  In list
   context, it returns an array of values counting (up by
   ones) from the left value to the right value."

There is no reason why it shouldn't be able to count up by one on 
non-integer numbers.


Tassilo
-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Thu, 09 Aug 2001 00:42:47 GMT
From: "Kevin Bartz" <l_pantin@hotmail.com>
Subject: Re: code doesn't work from "learning perl"
Message-Id: <b0lc7.39161$gj1.3620200@bgtnsc05-news.ops.worldnet.att.net>

That's an old oversight from Learning Perl. That type of series
generator can take only integers. From the command line, perl -e
"print join \"\n\", (1.2 .. 5.2)" gives me 1-5, not 1.2-5.2.

Kevin

David Hill wrote in message
<20010808182321.4bbae64d.david@phobia.ms>...
:Hello -
: I am reading my "Learning Perl 2nd edition" book by Randal Schwartz.
In Chapter 3 on page 49, The examples given to not work as they say.
:
:my @array = (1.2 .. 5.2); # same as (1.2, 2.2, 3.2, 4.2, 5.2)
:my $size = @array;
:my $i;
:
:for ($i = 0; $i < $size; $i++) {
: print $array[$i] . "\n";
:}
:
:this prints
:1
:2
:3
:4
:5
:
:Shouldn't it print the following?
:1.2
:2.2
:3.2
:4.2
:5.2
:
:Thanks
:- David
:
:
:
:




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

Date: Wed, 8 Aug 2001 17:53:40 -0500
From: "Leary" <leary@foad.NOSPAM.org>
Subject: Re: cross reference?
Message-Id: <7mjc7.45372$C7.11563513@e3500-chi1.usenetserver.com>

"Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote in message
> Leary (leary@foad.NOSPAM.org) wrote:
> : Is there such an animal as a cross reference of the sort;
> : in dos you could do this;
> :     for /f "tokens=1-3 delims=," %%g in (testdata.txt) do (some stuff)
> : in perl you would accomplish this by;
> :     blah blah...
>
>
> Unfortunately, being a perl programmer who only dabbles in NT, it is not
> clear what the "for /f..." is doing.
>
> If you explain what this does then I'm sure someone could show a simple
> example of doing it in perl.
>
The "for /f" takes a string of input, delimited by the delims= char and
returns the number of "tokens" specified by the tokens= field. As an example
if testdata.txt contained a single line as follows;

>>start testdata.txt<<
first field, second field, third field
>>end testdata.txt<<

then ;
%%g=first field
%%h=second field
%%i=third field

%%g is explicitly declared while %%h and %%i are implicitly declared via the
tokens option. Basically it's one of the primary methods of parsing text in
an NT script.






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

Date: Wed, 8 Aug 2001 18:09:23 -0500
From: "Leary" <leary@foad.NOSPAM.org>
Subject: Re: cross reference?
Message-Id: <RAjc7.45381$C7.11576038@e3500-chi1.usenetserver.com>

"Leary" <leary@foad.NOSPAM.org> wrote in message
> "Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote in message
> > Leary (leary@foad.NOSPAM.org) wrote:
> > : Is there such an animal as a cross reference of the sort;
> > : in dos you could do this;
> > :     for /f "tokens=1-3 delims=," %%g in (testdata.txt) do (some stuff)
> > : in perl you would accomplish this by;
> > :     blah blah...
> >
> >
> > Unfortunately, being a perl programmer who only dabbles in NT, it is not
> > clear what the "for /f..." is doing.
> >
> > If you explain what this does then I'm sure someone could show a simple
> > example of doing it in perl.
> >
> The "for /f" takes a string of input, delimited by the delims= char and
> returns the number of "tokens" specified by the tokens= field. As an
example
> if testdata.txt contained a single line as follows;
>
> >>start testdata.txt<<
> first field, second field, third field
> >>end testdata.txt<<
>
> then ;
> %%g=first field
> %%h=second field
> %%i=third field
>
> %%g is explicitly declared while %%h and %%i are implicitly declared via
the
> tokens option. Basically it's one of the primary methods of parsing text
in
> an NT script.
>
In the hope of not seeming like a total newbie loser... I have a script I
wrote in NT script that generates a report. As an exercise I am writing a
perl script that does the same report. The for /f statement above is what I
used to parse the input data for the report. The actual data I am parsing
looks like this;

11:00:01 AM Mon Oct 09, 2000  00005   PAYMENT    40.10    0.00 FALSE FALSE

That should be all one line.





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

Date: Thu, 09 Aug 2001 01:00:32 GMT
From: "Kevin Bartz" <l_pantin@hotmail.com>
Subject: Re: cross reference?
Message-Id: <Qglc7.39187$gj1.3621663@bgtnsc05-news.ops.worldnet.att.net>

Is this a fixed-width record or is there a delimiting character? If
it's fixed width, you'll want to unpack() it and if it's delimited
you'll want to split it by the delimiter and read in the individual
values.

It might be helpful, too, if I knew exactly what data type you need
back. Do you want a hash or a two-dimensional array?

Kevin

Leary wrote in message ...
:"Leary" <leary@foad.NOSPAM.org> wrote in message
:> "Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote in message
:> > Leary (leary@foad.NOSPAM.org) wrote:
:> > : Is there such an animal as a cross reference of the sort;
:> > : in dos you could do this;
:> > :     for /f "tokens=1-3 delims=," %%g in (testdata.txt) do (some
stuff)
:> > : in perl you would accomplish this by;
:> > :     blah blah...
:> >
:> >
:> > Unfortunately, being a perl programmer who only dabbles in NT, it
is not
:> > clear what the "for /f..." is doing.
:> >
:> > If you explain what this does then I'm sure someone could show a
simple
:> > example of doing it in perl.
:> >
:> The "for /f" takes a string of input, delimited by the delims= char
and
:> returns the number of "tokens" specified by the tokens= field. As
an
:example
:> if testdata.txt contained a single line as follows;
:>
:> >>start testdata.txt<<
:> first field, second field, third field
:> >>end testdata.txt<<
:>
:> then ;
:> %%g=first field
:> %%h=second field
:> %%i=third field
:>
:> %%g is explicitly declared while %%h and %%i are implicitly
declared via
:the
:> tokens option. Basically it's one of the primary methods of parsing
text
:in
:> an NT script.
:>
:In the hope of not seeming like a total newbie loser... I have a
script I
:wrote in NT script that generates a report. As an exercise I am
writing a
:perl script that does the same report. The for /f statement above is
what I
:used to parse the input data for the report. The actual data I am
parsing
:looks like this;
:
:11:00:01 AM Mon Oct 09, 2000  00005   PAYMENT    40.10    0.00 FALSE
FALSE
:
:That should be all one line.
:
:
:




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

Date: Thu, 09 Aug 2001 00:17:01 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I keep persistent data across program calls?
Message-Id: <1Ekc7.3$B2j.170718720@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How do I keep persistent data across program calls?

    For some specific applications, you can use one of the DBM modules. See
    the AnyDBM_File manpage. More generically, you should consult the
    FreezeThaw, Storable, or Class::Eroot modules from CPAN. Here's one
    example using Storable's "store" and "retrieve" functions:

        use Storable; 
        store(\%hash, "filename");

        # later on...  
        $href = retrieve("filename");        # by ref
        %hash = %{ retrieve("filename") };   # direct to hash

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.70
-- 
    This space intentionally left blank


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

Date: 8 Aug 2001 16:48:29 -0700
From: emmettwa@onebox.com (Emmett)
Subject: Re: Large file upload through https
Message-Id: <e0da462e.0108081548.2a8bed44@posting.google.com>

Thought I'd mention ...

You could use the unix shar utility to break the large file
into parts. Then upload those. 

"shar" files are shell scripts so after uploading all the
files to the remote host you only have to use
use sh to recreate the large file.

"shar" has command line options for specifying the maximum file size.
It also does automatic uuencoding and compression.

Emmett


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

Date: Wed, 8 Aug 2001 23:54:22 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: newbie question...
Message-Id: <997314862.334426013287157.gnarinn@hotmail.com>

In article <Iigc7.4771$V43.379193@e3500-atl1.usenetserver.com>,
Leary <leary@foad.NOSPAM.org> wrote:
>Why does the snippet below not work? If I comment out either of the system()
>calls the script works fine. But if both lines are active I geta syntax
>error.
>
>TIA
>
>#!perl -w
># 8/8/2001 12:56PM
>system("vhouse3 %IBERDIR%\\data\\house50 > house50.txt")
>
>system("dbf2text %IBERDIR%\\data\\hse.dbf hsedbf.txt")
>


you forgot to end your lines with ';'

gnari


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

Date: Thu, 09 Aug 2001 00:26:13 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Perl not releasing lock on file under Windows??
Message-Id: <3B71BC85.60803@post.rwth-aachen.de>

Carlos C. Gonzalez wrote:
> Hi everyone,
> 
> I have a CGI Perl script activated by a submit button on an HTML form.  
> The CGI script executes fine under Perl at the DOS command prompt.  
> 
> This is the code (it's just a dummy script to test that things are 
> working):
> 
> #!/usr/bin/perl 
> 
> use CGI::Carp qw(carpout fatalsToBrowser);
> use diagnostics;
> use strict;
> 
> use constant TRUE           => "1";  #any value other than "0" or "" is 
> true!
> use constant FALSE          => "0";


You should better not define a constant TRUE and FALSE. This is 
something that comes from other programming languages and might cause 
problems in Perl. This may work for scalars but matters get more complex 
under different circumstances, such as lists and hash-elements.
I can't give you a definite example now where this might fail....I just 
remember Randal once giving some code-snippets where a mere TRUE or 
FALSE would break your script.

Tassilo
-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Thu, 09 Aug 2001 00:25:41 GMT
From: "Antoine Hall" <AHALL5@nc.rr.com>
Subject: Perl Search Engine
Message-Id: <9Mkc7.105408$TM5.15369395@typhoon.southeast.rr.com>

Does anyone know where I can find a simple but fast search engine?

==
'Toine




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

Date: Thu, 09 Aug 2001 00:54:04 GMT
From: "Kevin Bartz" <l_pantin@hotmail.com>
Subject: Re: Perl Search Engine
Message-Id: <Malc7.39176$gj1.3621911@bgtnsc05-news.ops.worldnet.att.net>

Try $text =~ /$word/

It's burly and built for the job.

Kevin

Antoine Hall wrote in message
<9Mkc7.105408$TM5.15369395@typhoon.southeast.rr.com>...
:Does anyone know where I can find a simple but fast search engine?
:
:==
:'Toine
:
:




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

Date: Wed, 8 Aug 2001 22:05:01 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <997308301.595097878016531.gnarinn@hotmail.com>

In article <MPG.15db22897ad499d2989718@news.edmonton.telusplanet.net>,
Carlos C. Gonzalez  <miscellaneousemail@yahoo.com> wrote:

>Programmers like me who come from high level languages (except for C - 
>and my experience in that was the least in all of them) will have a 
>tougher time than those who come from all out computer science 
>backgrounds I am sure. 
>

I am just wondering, do you consider perl to be a low lever language?


>As another example of the kind of confusion that Perl can be for a 
>beginning Perl programming take regular expressions.  I have never in my 
>life had to deal with the confusions of Perl regular expressions.  C came 
>close but even in C they were logical and from what I remember the 
>characters used were consistent.  They did not change much with the 
>context.  One character did not mean one thing until it was put inside 
>brackets to mean something else type of thing.  And C's regular 
>expressions did not have the incredibly rich set of possibilities that 
>Perl's does IMHO.  
>

C has regular expressions?

>
>Sure an assignment operation such as $string = "some value" is a 
>programming fundamental.  
>
>But not something like: $pattern =~ s/(\W)/\\$1/g;.  This is Perl 
>peculiar. At least from my background.  I've never had to deal with this 
>kind of confusing string until arriving at Perl.  
>

it is best to keep regular expression syntax totally separate in your
mind from usual programming syntax, just like format syntax.

gnari


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

Date: Thu, 09 Aug 2001 00:25:11 GMT
From: "Kevin Bartz" <l_pantin@hotmail.com>
Subject: Re: RegEXP's
Message-Id: <HLkc7.39137$gj1.3618361@bgtnsc05-news.ops.worldnet.att.net>

It's not too hard. Given a string, we want to loop through it and
match either everything inside a pair of brackets or everything up
until the next whitespace or bracket. Try this.

$string = 'this is my great <b>string</b> with lots of <a
href="http://www.foo-bar.com/index.php?action=listall&user=foo">links<
/a> in
it to some place on the net.';

my @array;
push @array, $1 while $string =~ s/(<(?>.|\s)+?>|[^<> ]+?
|[^<> ]+?(?=<))//s;

print join "\n", @array;

Kevin

Adrian Immler wrote in message
<9krjeu$64vma$1@ID-17302.news.dfncis.de>...
:let's say i've got a string like this:
:
:$string = 'this is my great <b>string</b> with lots of <a
:href="http://www.foo-bar.com/index.php?action=listall&user=foo">links
</a> in
:it to some place on the net.';
:
:is it possible to create an array with RegEXP's that looks like this?
:
:
:$array[0] = 'this';
:$array[1] = 'is';
:$array[2] = 'my';
:$array[3] = 'great';
:$array[4] = '<b>';
:$array[5] = 'string';
:$array[6] = '</b>';
:$array[7] = 'with';
:...
:$array[n] = '<a
:href="http://www.foo-bar.com/index.php?action=listall&user=foo">';
:$array[n] = 'links';
:....
:
:
:i've got the problems with that it should not break it up at spaces
within
:<>.
:
:question1: how is the performance if the string got a lenngth of lets
say
:5000 signs !?
:
:question2: can someone tell me that regexp?
:
:note: i'm usually from php, but it is also possible to use RegEXP's
in
:there, if someone got an idea of doing this without regexps or some
notes
:for use with PHP please also let me know.
:
:thanks
:
:
:
:




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

Date: Thu, 09 Aug 2001 00:08:35 GMT
From: "Sean Hamilton" <sh@planetquake.com>
Subject: Re: Simple sorting question
Message-Id: <7wkc7.39924$b_3.3217628@news0.telusplanet.net>

Something like

@someData = sort
{
    my @a = split (' ', $a);
    my @b = split (' ', $b);

    $a[2] <=> $b[2];
}
@someData;


Off the top of my head, may not work without tweaking.

sh

"JR" <tommyumuc@aol.com> wrote in message
news:319333f5.0108081242.290f501f@posting.google.com...
> I have a tab-delimited file with fields similiar to the ones below:
>
> 01   001   00001   23432
> 01   005   00002   23422
> 02   003   00001   23421
> 04   001   00001   23423
> 08   002   00005   23423
> ..
> ..
> ..
>
> I need to sort this by the third column so that the output is as
> follows:
>
> 02   003   00001   23421
> 04   001   00001   23423
> 01   001   00001   23432
> 01   005   00002   23422
> 08   002   00005   23423
> ..
> ..
> ..
>
> The only sorting I've ever done to this point was taken care of by
> @someData = sort { ($a) cmp ($b) } @someData, which worked fine when
> the column I wanted sorted by were in positions 1 and 2, respectively.
>
> How can I sort on the third column in the above examples?
>
> Thanks very much.




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

Date: Wed, 08 Aug 2001 23:25:14 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: String manipulation
Message-Id: <uTjc7.1215$%o4.125310@newsread1.prod.itd.earthlink.net>

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:ldj2nto6nnpfapn28as6fl5gb04ub5qe65@4ax.com...
> Brent Dax wrote:
>
> >    push @dstr, /(\d{4})/g;
> >
> >    push @dstr, $1 while(/(\d\d)/g);
>
> I think the first statement will push the lot onto @dstr, because the
> regex is matched in list context.
>
> $_ = '20010808091821';
> push @dstr, /(\d{4})/g;
> push @dstr, $1 while /(\d{2})/g;
> $" = ':';
> print "@dstr\n";
> -->
> 2001:0808:0918:20:01:08:08:09:18:21
>
> Indeed. It even resets pos() at the end of the match, because of the
> failure.

D'oh!  I wasn't aware of m//g's behavior in list context--my bad.  (Although
now that I've seen it, it does make sense...)

> And there is no need for a loop in the second statement.

See the note above.

> /^(\d{4})/g and @dstr = $1;
> push @dstr, /\d\d/g;
>
> (/\d\d/ is faster than /\d{2}/)

Really?  I figured they'd evaluate to the same thing internally.

> Also:
>
> @dstr = (scalar(/^(\d{4})/g, "$1"), /\d\d/g);
>
> Note that I had to "stringify" $1 in order to prevent the first value
> from being overwritten.
>
> I would call none of these "better" than the original.

Did I say they were better?  I didn't think so--they're just different
approaches.  Furhtermore, they spell things out more, which may be "better"
for a beginner.  TMTWTDI.

--Brent Dax
brentdax1@earthlink.net




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

Date: 8 Aug 2001 22:34:59 GMT
From: katetal@ugcs.caltech.edu (Kate T. Porter)
Subject: Re: substring matching and assigning to variable
Message-Id: <9kseqj$a6u@gap.cco.caltech.edu>

>I need to assign a substring to a variable. The problem is that the
>string contains non-alphanumeric characters. This is what I want to
>do:
>
>$spelling = substr(/alpha\(\'.*/, 7, -3)

how about this my ($spelling)=$var=~/(<your regex here>)/;
e.g. my $var="blah,hello";
my @tokens=$var=~/([\w]+),([\w]+).{3,3}/;
my $spelling=$tokens[2];
this would get you 'he' out of $var.




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

Date: Wed, 8 Aug 2001 17:26:42 -0500
From: "Jonathan Clover" <jclover@nati.org>
Subject: Thanks All
Message-Id: <tn3ergr65ju0de@corp.supernews.com>

Thanks everyone!
Jonathan




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

Date: Thu, 09 Aug 2001 10:11:54 +1000
From: Matthew Braid <nc@uq.net.au>
Subject: Re: Using a http proxy
Message-Id: <3B71D54A.2E63DE71@uq.net.au>

Hi all,

Thanks for the help - I didn't know about LWP::UserAgent. I'll take a
look at it, but for the moment the program isn't big or important enough
to require a package installation. The unbuffering worked perfectly (I
can't believe I didn't think of that).

Thanks,
MB


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

Date: 8 Aug 2001 15:16:03 -0700
From: emuller@u.washington.edu (Eric M)
Subject: Re: Where are those !'s coming from?
Message-Id: <5adbbbf7.0108081416.5cf1e5f@posting.google.com>

Hi,

Well thanks for all the help. Even though the post was way off the
mark, the approaches to the problem were very useful.

Turns out the problem is in Mime::Lite part of the script, maybe in
Mime::Lite itself.
After I add the entry to the databases I mail the databases to myself
using Mime:Lite. When I Fetch the file to my Mac, the file has none of
the !'s. I then viewed the email message in both Entourage, and Pine
and the !'s were there.
 The code creating the problem:

$msg = MIME::Lite->new(

                     From    =>"$PI_email",
                     To      =>"$em_email",
                     Cc		 =>"$em_email",
                     Subject =>"Teri added data to YRC databases",
                     Type    =>'multipart/mixed'
                      );
        
        ### Add parts;
        $msg->attach(Type     =>'TEXT',   
                     Data     =>"Look at the following answers to
check to see if they agree with the information you entered.
Did they want plasmids/strains? $selectplasmids. \nIf yes, then
yrcdis.txt database has been updated.
Did they want training? $tr. \nIf yes, then yrctr.txt database has
been updated.
Did they request a new collaboration? $st. \nIf yes, then yrccol.txt
database has been updated.
Did they update a proposal? $on. \n
If they included a title to the collaboration, what was it?
\n\n$Coltitle
\n They made these general comments:\n$comments"
                    );  
        $msg->attach(Type     =>'TEXT',
                     Path     =>'yrcDbtest.txt',
                     Disposition => 'attachment'
                    );
        $msg->attach(Type     =>'TEXT',
                     Path     =>'yrccol.txt',
                     Disposition => 'attachment'
                    );
        $msg->attach(Type     =>'TEXT',
                     Path     =>'yrctr.txt',
                     Disposition => 'attachment'
                    );
        $msg->attach(Type     =>'TEXT',
                     Path     =>'yrcdis.txt',
                     Disposition => 'attachment'
                    );

    #Output the message:

        ### Format as a string:
        $str = $msg->as_string;
        
        ### Print to a sendmail stream;
        $msg->print(\*SENDMAIL);

    #Send the message:

        ### Send using sendmail;
        $msg->send;


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

Date: Thu, 09 Aug 2001 00:00:58 GMT
From: "Sean Hamilton" <sh@planetquake.com>
Subject: Write to middle of file
Message-Id: <_okc7.39918$b_3.3216291@news0.telusplanet.net>

Greetings,

I have a fairly large (50+mb) file, into which I wish to write.

I'd rather not read the whole thing into memory, modify, clear, write, for
obvious reasons.

The logical thing to do seems to be:

Open file A for reading.
Apply shared lock onto A.
Open temp file B for writing.
Apply exclusive lock onto B.
Write A into B until arriving at the point at which stuff needs to be
written.
Write new stuff to B.
Write A into B until eof.

Now here is the problem: I should then delete A and rename B to A. However,
I fear the brief period of time in which A is absent will break things.

Ideas?

sh




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

Date: Thu, 9 Aug 2001 09:48:59 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Write to middle of file
Message-Id: <IAkc7.3$x7.79118@wa.nnrp.telstra.net>

"Sean Hamilton" <sh@planetquake.com> wrote in message
news:_okc7.39918$b_3.3216291@news0.telusplanet.net...
> Greetings,
>
> I have a fairly large (50+mb) file, into which I wish to write.
>
> I'd rather not read the whole thing into memory, modify, clear, write, for
> obvious reasons.
>
> The logical thing to do seems to be:
>
> Open file A for reading.
> Apply shared lock onto A.
> Open temp file B for writing.
> Apply exclusive lock onto B.
> Write A into B until arriving at the point at which stuff needs to be
> written.
> Write new stuff to B.
> Write A into B until eof.
>
> Now here is the problem: I should then delete A and rename B to A.
However,
> I fear the brief period of time in which A is absent will break things.
>
> Ideas?
>

Rename A and then rename B?  Whilst there is still a brief moment of absence
of A, it may be significantly shorter than the delete - rename process.

It also depends on your OS.

If you are on a *nix, you could create a symbolic link to A, for normal
operations, then simply rename the symbolic link to point to B after the
write is completed.  That is probably about as non disruptive as you could
get.

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

Date: Thu, 09 Aug 2001 00:26:37 GMT
From: "Sean Hamilton" <sh@planetquake.com>
Subject: Re: Write to middle of file
Message-Id: <1Nkc7.39931$b_3.3221108@news0.telusplanet.net>

Well, the main issue is the breaking of shared locks. I'm probably just
going to have to write B back into A. At least then I won't have a 50 meg
chunk of memory used up.

sh

"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:IAkc7.3$x7.79118@wa.nnrp.telstra.net...
> "Sean Hamilton" <sh@planetquake.com> wrote in message
> news:_okc7.39918$b_3.3216291@news0.telusplanet.net...
> > Greetings,
> >
> > I have a fairly large (50+mb) file, into which I wish to write.
> >
> > I'd rather not read the whole thing into memory, modify, clear, write,
for
> > obvious reasons.
> >
> > The logical thing to do seems to be:
> >
> > Open file A for reading.
> > Apply shared lock onto A.
> > Open temp file B for writing.
> > Apply exclusive lock onto B.
> > Write A into B until arriving at the point at which stuff needs to be
> > written.
> > Write new stuff to B.
> > Write A into B until eof.
> >
> > Now here is the problem: I should then delete A and rename B to A.
> However,
> > I fear the brief period of time in which A is absent will break things.
> >
> > Ideas?
> >
>
> Rename A and then rename B?  Whilst there is still a brief moment of
absence
> of A, it may be significantly shorter than the delete - rename process.
>
> It also depends on your OS.
>
> If you are on a *nix, you could create a symbolic link to A, for normal
> operations, then simply rename the symbolic link to point to B after the
> write is completed.  That is probably about as non disruptive as you could
> get.
>
> Wyzelli
> --
> ($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
> around');
> for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
> $_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
>
>
>




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 1470
***************************************


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