[6277] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 899 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 5 11:17:47 1997

Date: Wed, 5 Feb 97 08:00:23 -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           Wed, 5 Feb 1997     Volume: 7 Number: 899

Today's topics:
     Re: [help] 501 not implemented (Nathan V. Patwardhan)
     Re: [help] matching multiple patterns (Chris Nandor)
     Re: [help] matching multiple patterns (Mike Stok)
     Re: [Q] Perl 4 -> Perl 5 installation (Mike Stok)
     Re: Anyone got a base64 encoder? <mdc@isd.net>
     Calculating easter <jonas@cultcom.se>
     Re: CGI module problem (can't get multivalued parameter <dick@hpsqf.sqf.hp.com>
     Re: CGI module problem (can't get multivalued parameter (Chris Nandor)
     Re: Cleaning up defunct processes on SunOS (Tim Goodwin)
     Re: Compiling perl _as_ a shared library? (Jason C Austin)
     Re: Compiling perl _as_ a shared library? (Mike Stok)
     Re: DNS lookups in perl (Joey Gibson)
     Re: Enviroment (Dave Thomas)
     Fast list search <jjardine@global.co.za>
     Re: Fast list search (Dave Thomas)
     Re: Fast list search (Mike Stok)
     Re: Filehandle: open(FILE) while{} close(FILE) <mdc@isd.net>
     Re: Frivilous request for new Perl function ()
     How handle Retry, Ignore, Fail? ?? <100072.2701@CompuServe.COM>
     Maximum to size of string? (M.Boekhold)
     Re: Notorious problem with sockets and POP3 - please gi (Tim Goodwin)
     Parsing using Perl <njb@cs.bham.ac.uk>
     Re: Parsing using Perl (Dave Thomas)
     Re: Perl and method not implemented (Nathan V. Patwardhan)
     Re: Perl and method not implemented (Charlie Stross)
     Re: Perl compiler/translator for PC (Mike Stok)
     Re: Perl compiler/translator for PC <gnadan@earthlink.com>
     Re: Perl problem, help! <rootbeer@teleport.com>
     Re: Perl regexes are *not* greedy (was Pattern Matching (13F9G0000-GebhardtRW(DR9267)257)
     Re: Perl regexes are *not* greedy (was Pattern Matching (Mike Stok)
     Re: Perl Script <tchrist@mox.perl.com>
     Re: Perl Script <rootbeer@teleport.com>
     Please post perl FAQ again! I don't see in my listing. <sgrover@elizacorp.com>
     Re: Q: opening a file RW without deleting it. <mdc@isd.net>
     Re: Recursive Calls in Perl? <jander@jander.com>
     Shouldn't HTML2PS output binary? <adige@xnet.com>
     Re: Spooling gifs <jander@jander.com>
     Re: Trimming Dollar Value <tchrist@mox.perl.com>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 5 Feb 1997 14:38:14 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: [help] 501 not implemented
Message-Id: <5da60m$5l1@fridge-nf0.shore.net>

tyahn (tyahn@ix.netcom.com) wrote:
: I'm working on Website 1.1 with windows 95
                 ^^^^^^^^^^^
Oh oh.  Sounds like an issue for comp.infosystems.www.servers.misc.
Since there aren't any Perl issues here, I really can't help you.

HTH!

--
Nathan V. Patwardhan
nvp@shore.net
"Outshined outshined outshined!"
	--Chris Cornell from Soundgarden


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

Date: Wed, 05 Feb 1997 10:07:57 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: [help] matching multiple patterns
Message-Id: <pudge-ya02408000R0502971007570001@news.idt.net>

# Not to take away from Chris' point, but if efficiency is an issue,
# I'd recommend that
#         $text =~ /%name|%info/i
# be written as:
#         $text =~ /%(?:name|info)/i
# 
# This keeps the (relatively costly) alternation at bay until the % can
# actually match. [See Hip Owls p. 155, mid-page]

Ay, where's a good DFA when you need it?  ;-)

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: 5 Feb 1997 15:24:46 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: [help] matching multiple patterns
Message-Id: <5da8nu$7kr@news-central.tiac.net>

In article <pudge-ya02408000R0502971007570001@news.idt.net>,
Chris Nandor <pudge@pobox.com> wrote:

>Ay, where's a good DFA when you need it?  ;-)

Maybe we need /p and /d modifiers for posix and deterministic pattern
matching...

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 5 Feb 1997 13:11:03 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: [Q] Perl 4 -> Perl 5 installation
Message-Id: <5da0t7$rdn@news-central.tiac.net>

In article <32F82812.231C@atwww.com.au>, Jon Hall  <jon@atwww.com.au> wrote:

Do you get any error messages?  One thing it might be is that CGI.pm could
be unreadable - if you're running it from a web server then are you sure
which user & group ids the server is running as?  Do other libraries work
OK?

Mike

>I've got the perl 5 binary working, but referencing libraries seems to
>be creating a bit of trouble.
>
>I've tried:-
>
>use CGI;
>
>and had the CGI.pm file sitting in the same directory as the perl
>script,
>
>I've also tried:-
>
>use lib '/directory/to/libraries/';
>use CGI;
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Wed, 05 Feb 1997 07:22:16 -0600
From: Mark Conty <mdc@isd.net>
Subject: Re: Anyone got a base64 encoder?
Message-Id: <32F88988.3B73@isd.net>

Check out the MIME:: modules in CPAN.  There are routines there
to do base64 encoding and decoding.

-- 
Mark D. Conty    <><       "Let every man be quick to listen, slow to
mdc@isd.net                  speak, and slow to anger."  (James 1:19)


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

Date: Wed, 05 Feb 1997 14:54:06 -0800
From: Jonas Liljegren <jonas@cultcom.se>
Subject: Calculating easter
Message-Id: <32F90F8E.794B@cultcom.se>

How do I calculate the date of easter?

I have looked at some date modules, but can't find a solution.

The easter is the first sunday after the full moon that falls on or next
after mars 20:th. But how do i know how the moon cycles? Isn't there any
program that I could use?

-- 
 / Jonas Liljegren
http://w3.adb.gu.se/~a95jonas/welcome.html
Geek Code 3.1 GIT/P/Od-s+:-a24C++US++P++LEW++N++
o?K?w!oM!VPSPE-Y--PGP-t+5X++R@tv+b+!DID++Geh!!r!y+


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

Date: Wed, 05 Feb 1997 09:26:57 +0000
From: Dick Middleton <dick@hpsqf.sqf.hp.com>
Subject: Re: CGI module problem (can't get multivalued parameter from param)
Message-Id: <32F85261.26FF@hpsqf.sqf.hp.com>

Anat Rozenzon wrote:
> 
> Hi All,
> 
> I'm having problems with using param to get a multivalued parameter
> (list with multiple selections).
> The docs say to do this:
> 
> @value = $query->param('my_list');
> 
> but it just won't work, instead of getting a list with two strings
> inside @values I get just the number: 2.

That doesn't seem right to me.  The return from a multiple select is a
comma separated list.  I would expect to see something like:

@value = split(',', $query->param('my_list'));

unless your CGI module does that automatically for you.

Dick

-- 

Dick Middleton            
dick@sqf.hp.com


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

Date: Wed, 05 Feb 1997 10:13:06 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: CGI module problem (can't get multivalued parameter from param)
Message-Id: <pudge-ya02408000R0502971013060001@news.idt.net>

In article <32F85261.26FF@hpsqf.sqf.hp.com>, Dick Middleton
<dick@hpsqf.sqf.hp.com> wrote:

# > I'm having problems with using param to get a multivalued parameter
# > (list with multiple selections).
# > The docs say to do this:
# > 
# > @value = $query->param('my_list');
# > 
# > but it just won't work, instead of getting a list with two strings
# > inside @values I get just the number: 2.
# 
# That doesn't seem right to me.  The return from a multiple select is a
# comma separated list.  I would expect to see something like:
# 
# @value = split(',', $query->param('my_list'));
# 
# unless your CGI module does that automatically for you.

If you do CGIs and you haven't used CGI.pm, check it out.  Yes, CGI.pm does
that for you.  And I think it is more likely that he was doing something
like:

   print @value;

instead of

   print join(', ',@value);

but since he did't post the code, we can't be sure, ay?

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: 5 Feb 1997 13:53:13 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: Cleaning up defunct processes on SunOS
Message-Id: <5da3c9$7mj@join.news.pipex.net>

In article <32F661B2.446B9B3D@research.att.com>,
Avi Rubin  <rubin@research.att.com> wrote:
>We are developing a multithreaded (many forks) application,
>and on an SGI machine, we use 
>
>$SIG{CHLD} = \&REAPER;
>sub REAPER {
>my $waitedpid;
>    $waitedpid = wait;
>    logmsg "reaped $waitedpid". ($? ? " with exit $?" : "");
>}
>
>to get rid of defunct/zombie processes. It works great. However,
>when we go over to a sparcstation running SunOS 4.1.x, the
>program dies upon reaping the first child.

You can't do all that in a signal handler!

For portably reliable signal handlers, all you should do is set a global
variable and return.  Then in the main loop of your program, you can
check that variable, and take the appropriate action.  This is mentioned
in the perlipc(1) man page.

In this particular case, I wouldn't bother using signals.  Simply put
this code into your main loop somewhere.

    use POSIX 'WNOHANG';
    while (waitpid(-1, WNOHANG) > 0) {
            # do logging of $?, etc.
    }

Tim.
-- 
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall


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

Date: 04 Feb 1997 21:13:50 GMT
From: jason@daffodil.cs.odu.edu (Jason C Austin)
Subject: Re: Compiling perl _as_ a shared library?
Message-Id: <JASON.97Feb4161350@daffodil.cs.odu.edu>

In article <telnet.854726609@hercules> randal@hercules.cs.uregina.ca (Dee Jay Randall) writes:
=>   The following is part of a discussion on IRC. I am still looking for
=> an answer or any tips.
=> 
=> <randal> Has anyone considered compiling perl as a shared lib?
=> <randal> There would be a couple of reasons. For my purpose, we are trying to
=>     use a perl compiler (generates c code which it compiles). The resulting
=>     binary is over 700kb though because it basically drops the whole of the
=>     perl binary inside it.
=> <randal> The reason everyone else would love it is because when you run
=>     perl cgi's on web servers, each process takes up a whole perl interpreter
=>     sized chunk of memory. Shared lib would greatly reduce this.
=> <chilly> randal: you don't want to use shared libs for the interpreter.
=> <chilly> randal: basically, anything that c decides to use as a shared
=>     lib, perl will
=> <randal> because too much of it is data segment?
=> <chilly> randal: correct
=> <randal> chilly: any suggestions on how to shrink the binary I get out
=>     of the perl "compiler"
=> <chilly> randal: nothing right now

	I'm pretty sure you're not going to make any gains from this.
If most of perl is not shareable, all you're going to accomplish is a
program that starts slower and takes the same amount of memory to run.
Considering how cheap gigabytes of disk costs now, I don't think that
little executable size savings would be worth it.

	What would be nice is if you could dump the code resulting
from the compile stage of the interpreter and then just load that for
each instance.  That should cut down on the perl's usual slow startup.
Anyone know if you can do this?

	What would be even better would be a pre-forked http server
with perl built into it, so it could load and run these dumped images
without forking.

	If this is a heavily used program, I would definitely look at
re-writing it directly in C rather than using a translator.  Perl may
be faster for development, but for a heavily used application, you pay
for that savings 1000 times over in resources and reliability.
--
Jason C. Austin
austin@visi.net


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

Date: 5 Feb 1997 15:31:50 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Compiling perl _as_ a shared library?
Message-Id: <5da956$83d@news-central.tiac.net>

In article <JASON.97Feb4161350@daffodil.cs.odu.edu>,
Jason C Austin <austin@visi.net> wrote:

>	What would be nice is if you could dump the code resulting
>from the compile stage of the interpreter and then just load that for
>each instance.  That should cut down on the perl's usual slow startup.
>Anyone know if you can do this?

Check out the Compiler module by Malcolm Beattie which can be found on
CPAN.

>	What would be even better would be a pre-forked http server
>with perl built into it, so it could load and run these dumped images
>without forking.

Check out the mod_perl Apache and perl module - Doug MacEachern has just
put up an informative page at http://www.osf.org/~dougm/apache

>	If this is a heavily used program, I would definitely look at
>re-writing it directly in C rather than using a translator.  Perl may
>be faster for development, but for a heavily used application, you pay
>for that savings 1000 times over in resources and reliability.

Surely that depends, if you're stuck with an IO bound application on one
where the run time is large compared to the load/compile time then the
difference between well written idiomatic perl and well written idiomatic
C might not be as large as you think...

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Tue, 04 Feb 1997 08:35:42 -0500
From: joeyGibson@mindspring.com (Joey Gibson)
Subject: Re: DNS lookups in perl
Message-Id: <32f93aef.4700478@news.mindspring.com>

On 4 Feb 1997 22:24:32 -0700, mfuhr@dimensional.com (Michael Fuhr)
wrote:
||| -snip-
||| ># Fetch the info from the DNS server.
||| >($name, $aliases, $addrType, $length, @addresses) = gethostbyname
||| >$ARGV[0];
||| -snip-
||| 
||| The requestor specifically said he wanted to look up DNS MX records,
||| while your example uses gethostbyname, which looks up A records.  This
||| won't give the desired results.

Duoohh! Sorry. I guess that's what I get for not reading the post all
the way through. I just saw the initial question and ran with it. 

Joey


--
/| Joey Gibson - VB/PB/C++ Developer, JAPH , Right-Wing Extremist!
||   joeyGibson@mindspring.com /\ www.mindspring.com/~joeygibson/
|| [I]t isn't so much that liberals are ignorant. It's just that
||       they know so much that isn't so. - Ronald Reagan
\|     Get my PGP key from a key-server. Key-ID: 0x16817A11



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

Date: 5 Feb 1997 14:30:01 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Enviroment
Message-Id: <slrn5fh670.msu.dave@fast.thomases.com>

On 5 Feb 1997 07:24:10 GMT, Steven R. Johnson <stevej@mistic.net> wrote:
> 
> I have a perl script set up as a menu.. I have it set as a users shell in
> /etc/password, one of the options is to launch the news reader (tin).  The news
> server address is defined by $NNTPSERVER  in the /etc/profile  Now for some
> reason when the perl script launches the news reader the enviroment variable
> never gets defined.  How do I keep enviroment variables intact?

What is executing /etc/profile in the case of the Perl shell? Without a
conventional shell, you won't get /etc/profile executed, so you won't get
the environment variables (or anything else it establishes).

Dave


-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 5 Feb 1997 16:43:19 GMT
From: "James Jardine" <jjardine@global.co.za>
Subject: Fast list search
Message-Id: <01bc1360$5a8b5480$69a703c4@albatross>

Hi there,

Is there a fast built-in command which will tell me if a string is in a
list?

eg 

if (inlist($searchstring, @list))
{
  ...
}

Thanks,
James


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

Date: 5 Feb 1997 14:34:00 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Fast list search
Message-Id: <slrn5fh6ef.msu.dave@fast.thomases.com>

On 5 Feb 1997 16:43:19 GMT, James Jardine <jjardine@global.co.za> wrote:
> Hi there,
> 
> Is there a fast built-in command which will tell me if a string is in a
> list?
> 
> eg 
> 
> if (inlist($searchstring, @list))
> {
>   ...
> }

my @list = qw(dave was here);

my $count = grep(/a/, @list);
print "There were $count 'a's\n";

# -- or --

my @res = grep(/a/, @list);
print "These words contain 'a's: ", join(', ', @res), "\n";





-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 5 Feb 1997 15:15:33 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Fast list search
Message-Id: <5da86l$722@news-central.tiac.net>

In article <01bc1360$5a8b5480$69a703c4@albatross>,
James Jardine <jjardine@global.co.za> wrote:
>Hi there,
>
>Is there a fast built-in command which will tell me if a string is in a
>list?

You can use grep e.g.

  if (grep /$string/, @list) {
    ...
  }

but be aware that this is pattern matching, so you might match partial
words (or unexpected things if your $string contains pattern matching
metacharacters) do you might want to say

  if (grep $_ eq $string, @list) {
    ...
  }

but both of these methods do a linear scan through the list, so even if
your string is at $list[0] the rest of the elements are examined.  This
might not be fast if you have lists with millions of elements.  You could 
resort to the method suggested in the FAQ:

  5.5) How can I tell whether an array contains a certain element?

  There are several ways to approach this. If you are going to make this
  query many times and the values are arbitrary strings, the fastest way is
  probably to invert the original array and keep an associative array lying
  about whose keys are the first array's values. 

    @blues = ('turquoise', 'teal', 'lapis lazuli');
    undef %is_blue;
    for (@blues) { $is_blue{$_} = 1; }

  Now you can check whether $is_blue{$some_color}. It might have been a good
  idea to keep the blues all in an assoc array in the first place.

  If the values are all small integers, you could use a simple indexed
  array. This kind of an array will take up less space: 

    @primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31);
    undef @is_tiny_prime;
    for (@primes) { $is_tiny_prime[$_] = 1; }

  Now you check whether $is_tiny_prime[$some_number]. 

  If the values in question are integers instead of strings, you can save
  quite a lot of space by using bit strings instead:

    @articles = ( 1..10, 150..2000, 2017 );
    undef $read;
    grep (vec($read,$_,1) = 1, @articles);
    
    Now check whether vec($read,$n,1) is true for some $n.

The FAQ is on CPAN and you can get to it through http://www.perl.com/FAQ

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Wed, 05 Feb 1997 06:59:57 -0600
From: Mark Conty <mdc@isd.net>
Subject: Re: Filehandle: open(FILE) while{} close(FILE)
Message-Id: <32F8844D.DE5@isd.net>

What he's asking for isn't entirely ludicrous, though.  This was posted
as a response to an earlier inquiry about both reading and writing to
the same file, and I think it'll help here, too:

> From: mike@stok.co.uk (Mike Stok)
> Newsgroups: comp.lang.perl.misc
> Subject: Re: Q: opening a file RW without deleting it.
> Date: 2 Feb 1997 22:19:20 GMT
> Organization: Pencom Systems Administration
> Lines: 37
> Message-ID: <5d33t8$5lf@news-central.tiac.net>
> References: <5d05al$ann$1@jake.esu.edu>
> Reply-To: mike@stok.co.uk
> NNTP-Posting-Host: p16.ts2.lowel.ma.tiac.com
> Path: usamrid.isd.net!pull-feed.internetmci.com!newsfeed.internetmci.com!europa.clark.net!news.mathworks.com!uunet!in2.uu.net!199.0.65.182!news-in.tiac.net!posterchild!news@tiac.net
> 
> In article <5d05al$ann$1@jake.esu.edu>,
> Brian Sherwood <root@babbage.esu.edu> wrote:
> 
> >	I would like to open a text file and only change one line
> >of the file.  Whenever I open the file for reading and writing the
> >file is truncated to zero bytes.  Is there a way to do something 
> >like the following without truncating the file?
> 
> You could try usinf +< in place of +>, the +> does the same as > except
> that you also have read access to the file handle.  Try something like:
> 
> #!/usr/local/bin/perl -w
> 
> $file = 'test.txt';
> 
> open FILE, ">$file" or die "couldn't open $file to write ($!)\n";
> foreach (0 .. 5) {
>   print FILE "$_\n";
> }
> close FILE or die "couldn't close $file ($!)\n";
> 
> open FILE, "+<$file" or die "couldn't reopen $file (rw $!)\n";
> scalar <FILE>;
> scalar <FILE>;
> print FILE "x\n";
> seek FILE, 0, 0 or die "couldn't rewind $file ($!)\n";
> 
> print while <FILE>;
> 
> close FILE or die "couldn't close $file ($!)\n";
> 
> __END__
> 
> Hope this helps,
> 
> Mike

-- 
Mark D. Conty    <><       "Let every man be quick to listen, slow to
mdc@isd.net                  speak, and slow to anger."  (James 1:19)


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

Date: 5 Feb 1997 13:59:30 GMT
From: mhm@dax.austin.ibm.com ()
Subject: Re: Frivilous request for new Perl function
Message-Id: <5da3o2$j6c@ausnews.austin.ibm.com>


$foo = substr($str,0,-1);

--
----------------------------------------------------------------------
Michael H. Moran                  | Standard Disclaimer:  The content 
mhm@austin.ibm.com                | of this posting is independent of 
Modeling, Analysis, and Compilers | official IBM position.
IBM Corporation, Austin, Texas    |


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

Date: 5 Feb 1997 12:57:27 GMT
From: Braunbeck <100072.2701@CompuServe.COM>
Subject: How handle Retry, Ignore, Fail? ??
Message-Id: <5da03n$mvl$1@mhafc.production.compuserve.com>

Hi,

I'm try to write a script to check filesystem if every
file is readable. If I try to execute it I got
the following error.

Data error (bad CRC) error reading drive A
Retry, Ignore, Fail?

1.) Is it possible to handle this in the Perlscript and
    to continue after detect this error.
2.) I count the bytes which I read with the bytes the file have
    but if I handle the error with f there is no byte missing. 
    Why?
I develop my programs under bigperl 
This is perl, version 4.0M4
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 
19:39:30 $
Patch level: 36

-- 
Thanx
	Braunbeck
Please send only in USASCII 7-Bit and prefix the subject with 
Braunbeck# 


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

Date: 5 Feb 1997 13:37:39 GMT
From: boekhold@elektron.et.tudelft.nl (M.Boekhold)
Subject: Maximum to size of string?
Message-Id: <5da2f3$q1v@elektron.et.tudelft.nl>

Hi,

Is there a limit to the size of a string in Perl5? I have a cgi-0script that
now chokes. It uses *really* large strings (I put an entire HTML-table
into a string, which makes it easy for me to work with template-files
for the html-output). It looks to me as if mytable just doesn't fit
into the string anymore, it is broken of somewhere right in the middle.

It also may have something to do with the regex-stuff, since I do something
like: $line =~ s/TABLE/$table/, or even with print (print $line).

This is with perl 5.003_07 with suid security patch on a BSDI/2.1 system.

Please help me on this, it's kinda important to me to get this to work again


Maarten

--
_____________________________________________________________________________
|     Maarten Boekhold, Faculty of Electrical Engineering TU Delft,   NL    |
|        M.Boekhold@et.tudelft.nl   boekhold@gopher.library.tudelft.nl      |
-----------------------------------------------------------------------------


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

Date: 5 Feb 1997 14:00:00 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: Notorious problem with sockets and POP3 - please give me a clue
Message-Id: <5da3p0$7vi@join.news.pipex.net>

In article <32fa17ca.21597826@news.alt.net>, Gary <gniemcew@dti.net> wrote:
>The problem is that no matter what I do -  the script connects just
>fine, I am getting the OK+ welcome line, debug tols me I got through
>the print SOCKET all right, but after that  - the script just hangs,

Because the SOCKET filehandle is buffered, and you haven't written
"enough" data to it.  Set SOCKET to be autoflushed...

    select SOCKET; $| = 1; select STDOUT;

Tim.
-- 
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall


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

Date: Wed, 05 Feb 1997 13:07:11 +0000
From: Nigel Byrnes <njb@cs.bham.ac.uk>
Subject: Parsing using Perl
Message-Id: <32F885FE.41C6@cs.bham.ac.uk>

Hi

I have got to write a "parser" for a feature integrator program. I was
wondering if Perl is the right language to use and if so, could someone
point out any sites on the web that would be of interest to me in the
writing of such a program. 

For further information about the Parsing program, I am to write and the
context in which it sits, access y project page from
http://www.cs.bham.ac.uk/~njb/

thanks

-- 
Nigel 

"...just like havin' a cup of tea in the morning!"
Noel Gallagher, 1997


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

Date: 5 Feb 1997 14:36:36 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Parsing using Perl
Message-Id: <slrn5fh6jb.msu.dave@fast.thomases.com>

On Wed, 05 Feb 1997 13:07:11 +0000, Nigel Byrnes <njb@cs.bham.ac.uk> wrote:
> Hi
> 
> I have got to write a "parser" for a feature integrator program. I was
> wondering if Perl is the right language to use and if so, could someone
> point out any sites on the web that would be of interest to me in the
> writing of such a program. 

You might want to check out the version of byacc that generates Perl -
available on CPAN. 

Dave



-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 5 Feb 1997 14:34:48 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Perl and method not implemented
Message-Id: <5da5q8$5l1@fridge-nf0.shore.net>

Darrell LaRock (rockhead@camalott.com) wrote:
: Is anyone familar with a method not implemeted error. When using cgi
: scripts with a webpage.  I am using the action "POST".  Also, is there
[snip]

This is not a Perl issue.  It's an issue for comp.infosystems.www.servers.misc
or to take up with your provider.  Probably one of two things is happening:
(1) your server hasn't been configured for .cgi scripts (you'll get this
error message with Apache by default for 1.1.1), or (2) you don't have
permissions to execute CGI scripts.  Once again, talk to your provider
and see how they have the server config'd.

HTH!

--
Nathan V. Patwardhan
nvp@shore.net
"Outshined outshined outshined!"
	--Chris Cornell from Soundgarden


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

Date: Wed, 5 Feb 1997 14:45:17 -0000
From: charlie@antipope.org (Charlie Stross)
Subject: Re: Perl and method not implemented
Message-Id: <MPG.d62ad54c4844cac989680@news.demon.co.uk>

In article <01bc1300$daf2bc40$e08c53c6@rockhead.camalott.com>, 
rockhead@camalott.com says...
> Is anyone familar with a method not implemeted error. When using cgi
> scripts with a webpage.  I am using the action "POST".  Also, is there
> another way to send results to a script file.  I believe my ISP is not
> setup correctly, and I was wondering if there are any files that I can
> check to see if this is so.

You're not using the action "POST"; you're using the HTTP method POST. 
For an explanation of what this _means_, see:

http://www.antipope.org/charlie/webbook/

and read Chapter 3.

>From the 'method not implemented' error it sounds as if 
you're using a crap CGI script that expects to be
invoked only via the GET method, and doesn't understand POST.
This is a bad sign; it suggests the script is poorly written
and may contain security holes.

> My ISP is running Linux red hat Release 4.0 (Colgate) Kernal 2.0.18 on an
> i586.  Any help would be appreciated.

There's no indication in there that your ISP is incorrectly configured;
it sounds like your problem stems from not understanding the HTTP
protocol properly, not understanding how CGI scripts work, and not
having a working script to test in the first place.

RedHat 4.0 comes as standard with a working perl distribution; unless
someone's gone and broken it it almost certainly works properly. (I
speak from experience; I run 4 RedHat boxes and use them for web
application development.)



-- Charlie Stross


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

Date: 5 Feb 1997 13:06:48 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl compiler/translator for PC
Message-Id: <5da0l8$r2i@news-central.tiac.net>

In article <32F95405.34@thevortex.com>,
Nightshadow  <nightshadow@thevortex.com> wrote:
>Does Perl exist for the dos PC? If so, where can I find a
>such a compiler/translator. Thanx and sorry for posting this, but
>I've searche high and low and just couldn't find any.

You might look in the ports/msdos/ directory on a Comprehensive Perl
Archive Network (CPAN) site.  One way to get to CPAN is to use Tom
Christiansen's multiplexor at http://www.perl.com/CPAN/ and another is to
ftp to the master site at ftp.funet.fi and look in
/pub/languages/perl/CPAN at the SITES file and find a nearby site to
connect to using an ftp client.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 5 Feb 1997 14:04:01 GMT
From: "Greg Nadan" <gnadan@earthlink.com>
Subject: Re: Perl compiler/translator for PC
Message-Id: <01bc136e$253fcdc0$35132399@interport.interport.net>

Go to www.shareware.com and do a search for perl ( or winperl) , look
through the results for "winperl". I just got it myself the other day, It
is pretty cool. Obviously winperl runs under windows. I think there are DOS
version out there also. The only problem I am having with it is I assumed
that file operations would be DOS like. Using the \ for path's and not the
/'s like unix. I also cant find any documentation for winperl that might
explain some of the other differences. 
	Hope it helps

		-Greg Nadan

Nightshadow <nightshadow@thevortex.com> wrote in article
<32F95405.34@thevortex.com>...
> Does Perl exist for the dos PC? If so, where can I find a
> such a compiler/translator. Thanx and sorry for posting this, but
> I've searche high and low and just couldn't find any.
> 
> -- 
>                   /\
>       /vvvvvvvvvvvv \------------------------------
>       `^^^^^^^^^^^^ /========== Nightshadow =====/
>                   \/
>     "War does not determine who's right, war determines who's left."
> 


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

Date: Wed, 5 Feb 1997 07:48:34 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Anicia Limmany <msl@kewlaid.highfiber.com>
Subject: Re: Perl problem, help!
Message-Id: <Pine.GSO.3.95.970205073443.8099C-100000@linda.teleport.com>

On 4 Feb 1997, Anicia Limmany wrote:

> Subject: Perl problem, help!

You can tell that that subject line could be improved because it could be
applied equally well to any one of about 200 new messages each week in
this newsgroup. Fortunately there's a frequent posting about choosing good
subject lines which will help you choose a better one next time.

> format STDOUT_TOP =
> 
> .

> format STDOUT = 
> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> $MOD                               
> .

When I see these formats, I wonder whether you're aware that print (or
printf or sprintf) might be a better way to accomplish what you're trying
to do. There's nothing wrong with what you're doing, in much the same way
that there's nothing wrong with putting mustard on ice cream. 

> while (INPUT) {
> $_ = <INPUT>;

It's nice to indent your loop body, for clarity. But more importantly,
testing INPUT will never become false in this case. You want this,
instead.

    while (<INPUT>) {

 ...which is short for this.

    while (defined($_ = <INPUT>)) {

You also mentioned something about how your data file has some newline
characters near the beginning, and you don't want those to print out.
There are lots of ways to fix that; one would be to simply not print (or
write, if you must) until you've read the start of your real data.

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/




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

Date: Wed, 5 Feb 1997 15:17:27 GMT
From: gebha@sparky.dr.lucent.com (13F9G0000-GebhardtRW(DR9267)257)
Subject: Re: Perl regexes are *not* greedy (was Pattern Matching Question)
Message-Id: <E54yH3.EnB@drnews.dr.lucent.com>

tchrist@mox.perl.com wrote:
> 
> For the rest of the audience: in Perl REs, eagerness applied to direct,
> predictable, LEFT-TO-RIGHT fulfillment is far more important than 
> a potentially bigger return later down the line.  DFAs are not easy 
> to write, nor are they easy to explain.  Simple left-to-right
> processing is much easier to explain and understand for beginners,
> amongst others.

I had noticed that, at least in alternation constructs, Perl preferred
matching the leftmost alternative.  I took advantage of this but felt
uncomfortable because I couldn't find anything in perlre(1) that
described the preference.  Am I safe counting on this?

-- 

Robert W. Gebhardt
rgebhardt@lucent.com



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

Date: 5 Feb 1997 15:36:15 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl regexes are *not* greedy (was Pattern Matching Question)
Message-Id: <5da9df$8a7@news-central.tiac.net>

In article <E54yH3.EnB@drnews.dr.lucent.com>,
13F9G0000-GebhardtRW(DR9267)257 <gebha@sparky.dr.lucent.com> wrote:

>I had noticed that, at least in alternation constructs, Perl preferred
>matching the leftmost alternative.  I took advantage of this but felt
>uncomfortable because I couldn't find anything in perlre(1) that
>described the preference.  Am I safe counting on this?

You might feel happier if you check out Jeffrey Friedl's Mastering Regular
Expressions book which has illuminated several nooks & crannies in perl's
handling or regexes (amongst other languages...)

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 5 Feb 1997 13:20:54 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Script
Message-Id: <5da1fm$oa4$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, ezarrabi@direct.ca writes:

:This is a multi-part message in MIME format.

This doesn't sound good.

:--------------7D6C491D30B7
:Content-Type: text/plain; charset=us-ascii
:Content-Transfer-Encoding: 7bit
:
:I have this perl script and I was wondering how to run it on my web
:page. My web page is at: http://www.tarantulainc.com/sepehr
:
:--------------7D6C491D30B7
:Content-Type: application/x-perl; name="ssi_rand_image.pl"
:Content-Transfer-Encoding: base64
:Content-Disposition: inline; filename="ssi_rand_image.pl"

There's no good reason for this.  Post the script without these
damned MIME attachments, and maybe it will get looked at.  As it
is, you've merely tweaked my killfile urge.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com

"Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in."
	--Larry Wall in <1994Jul21.173737.16853@netlabs.com>


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

Date: Wed, 5 Feb 1997 07:31:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: ehsan zarrabi <ezarrabi@direct.ca>
Subject: Re: Perl Script
Message-Id: <Pine.GSO.3.95.970205072903.8099B-100000@linda.teleport.com>

On Tue, 4 Feb 1997, ehsan zarrabi wrote:

> I have this perl script and I was wondering how to run it on my web
> page.

Check your server's documentation and ask your webmaster to help you make
it happen. If you're still having troubles, check a CGI or server
newsgroup (or its faq) because this isn't a Perl question. (You can tell
it's not a Perl question because the answer would be the same if it were a
shell script, for example.) Good luck!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 5 Feb 1997 15:47:05 GMT
From: "Samir Grover" <sgrover@elizacorp.com>
Subject: Please post perl FAQ again! I don't see in my listing.
Message-Id: <01bc137c$6c86b050$6b00000a@e15>


I am looking for following Q.

5.25) How can I use pass a filehandle to a function, or make a list of
      filehandles?


thanks,


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

Date: Wed, 05 Feb 1997 06:46:10 -0600
From: Mark Conty <mdc@isd.net>
To: Brian Sherwood <root@babbage.esu.edu>
Subject: Re: Q: opening a file RW without deleting it.
Message-Id: <32F88112.5454@isd.net>

[ Posted & mailed. ]

If you want to get a bit more involved, you might look into the DB_File
module, which gives you, among other things, the ability to manipulate
each line of a flat file as a @list or even as a %hash.

-- 
Mark D. Conty    <><       "Let every man be quick to listen, slow to
mdc@isd.net                  speak, and slow to anger."  (James 1:19)


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

Date: 05 Feb 1997 08:53:12 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Recursive Calls in Perl?
Message-Id: <7mkn4awn.fsf@jander.com>

"Samir Grover" <sgrover@elizacorp.com> writes:

> 
> Is recursive procedure call not allowed?

Yes, recursive procedure calls certainly _are_ allowed. Thus, you have
a logic problem somewhere. Without seeing all of your code it's
difficult to diagnose :)

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Wed, 05 Feb 1997 08:24:34 -0600
From: Vik Adige <adige@xnet.com>
Subject: Shouldn't HTML2PS output binary?
Message-Id: <32F89822.5AC7@xnet.com>

Hi,

I'm using html2ps on an HP-UX machine, with perl already pre-installed.
But, when I operate on an HTML document, I get a file with a whole bunch
of cryptic text output (supposedly postscript, but NOT in the expected
binary).  When I then print this resultant file, I just get a dump of
the text.

Anybody know what's wrong here?  I'm sure it's not my printer (which
does postscript), and I'm sure it's not the way I'm printing (using the
'lp -dPRINTER FILE' unix command).

Thanks in advance for any help.
Vik.


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

Date: 05 Feb 1997 08:58:05 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Spooling gifs
Message-Id: <68074aoi.fsf@jander.com>

Steve Johnson <stevej@wco.com> writes:

Wrong newsgroup. Try comp.infosystems.www.authoring.cgi.

> I've seen counters that you call up via an <img src="couter"> type
> command.  And I Sapose the cgi program just streams the gif data directly
> to the web browser.. (graphicle counters do this)    My Question is how is
> this done?  Can someone post an example of this?  thanks
> 
> -Steve
> 

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: 5 Feb 1997 14:05:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Trimming Dollar Value
Message-Id: <5da43s$p8i$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    "Bok Nan Lo" <support@inklineglobal.com> writes:
:I'm having hard time with formatting and trimming an amount in a variable.
:
:e.g. $3.4405
:
:I just wanted it to be $3.44 rather than four decimal places. How can I get
:it solved?!
:
:P/S: I want to actually trim it rather than formatting to STDOUT using
:printf().

Well, you could do this:

    $it = '3.4405';
    $it = int(100 * $it + 0.5)/100;

or even more creatively this:

    $it = '3.4405';
    $it =~ s/(\...).*//;

This is all respecting your probably unreasonable aversion to the oft-used
sprintf function:

    $it = '3.4405';
    $it = sprintf "%.2f", $it;

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com

    "Since when did you hear people talk about writing LISP or BASIC *scripts*?
     JCL and shell make command *scripts*; perl and LISP make *programs*."  --me


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

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

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 V7 Issue 899
*************************************

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