[21897] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4101 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 12 00:06:27 2002

Date: Mon, 11 Nov 2002 21:05:09 -0800 (PST)
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, 11 Nov 2002     Volume: 10 Number: 4101

Today's topics:
    Re: Filehandles within a sub, passed ot main <wksmith@optonline.net>
    Re: Filehandles within a sub, passed ot main <mgjv@tradingpost.com.au>
    Re: Filehandles within a sub, passed ot main <mgjv@tradingpost.com.au>
    Re: Global file search function? (Miguel)
        Help! Bad Interperter: no such file or directory (Corey Andrews)
    Re: Help! Bad Interperter: no such file or directory <nospam@nospam.com>
    Re: Help! Bad Interperter: no such file or directory <tony_curtis32@yahoo.com>
    Re: Help! Bad Interperter: no such file or directory <spam@thecouch.homeip.net>
    Re: illegal use of comment ? [OT] <dglage_SPAMMERSWILLBEFLAMEDAT@gmx.de>
    Re: illegal use of comment ? <krahnj@acm.org>
    Re: illegal use of comment ? (Walter Roberson)
    Re: illegal use of comment ? (ebchang)
    Re: Is python a good choice for this task? <opengeometry@yahoo.ca>
        Keyboard mapping <ian_chapman@junk.net>
    Re: Keyboard mapping <mgjv@tradingpost.com.au>
        Newbie with Perl <mjwilusz@acsu.buffalo.edu>
    Re: Object in @INC returning Tie::Handles from INC meth (Bryan Castillo)
    Re: OT: pound sign, was Re: illegal use of comment ? (Walter Roberson)
    Re: OT: pound sign, was Re: illegal use of comment ? <tk@WINDOZEdigiserv.net>
    Re: saving a cgi file <wsegrave@mindspring.com>
    Re: saving a cgi file <harini_b@hotmail.com>
    Re: split /(\d\d)/, $_, 3 may return 5 elements - why? (Jay Tilton)
    Re: Upgrade to Perl 5.6.x ? <pkent77tea@yahoo.com.tea>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 12 Nov 2002 02:11:28 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Filehandles within a sub, passed ot main
Message-Id: <krZz9.16438$wF2.8494@news4.srv.hcvlny.cv.net>


"Martien Verbruggen" <mgjv@tradingpost.com.au>
--snio--

> Euhmmmmm...
>
> Did you know that in Perl 5.6.0, you can do
>
> open my $fh, "some_file" or die $!;
> while (<$fh>)
> {
>     # do stuff
> }
>
--snip--

This does work with my ActivePerl 5.6.1, but how are we supposed to know it?
perldoc -f open explicitly specifies the use of IO::File for this syntaxt.

Bill |




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

Date: Tue, 12 Nov 2002 04:02:51 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Filehandles within a sub, passed ot main
Message-Id: <slrnat0vfr.2kt.mgjv@verbruggen.comdyn.com.au>

On Tue, 12 Nov 2002 02:11:28 GMT,
	Bill Smith <wksmith@optonline.net> wrote:
> 
> "Martien Verbruggen" <mgjv@tradingpost.com.au>
> --snio--
> 
>> Euhmmmmm...
>>
>> Did you know that in Perl 5.6.0, you can do
>>
>> open my $fh, "some_file" or die $!;
>> while (<$fh>)
>> {
>>     # do stuff
>> }
>>
> --snip--
> 
> This does work with my ActivePerl 5.6.1, but how are we supposed to know it?
> perldoc -f open explicitly specifies the use of IO::File for this syntaxt.

The documentation for 5.6.x on open() (including perlopentut) is a bit
deficient in that respect, yes. This is why I didn't just refer to the
documentation, but instead assumed that it was unknown, and explained
it.

The 5.8.0 documentation on open() is a lot more up-to-date.

I knew because I had been following developments while they were going
on, and because I tend to read the perldelta files on new releases.

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | What's another word for Thesaurus?
                        | 


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

Date: Tue, 12 Nov 2002 04:06:42 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Filehandles within a sub, passed ot main
Message-Id: <slrnat0vn2.2kt.mgjv@verbruggen.comdyn.com.au>

On Tue, 12 Nov 2002 04:02:51 GMT,
	Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> On Tue, 12 Nov 2002 02:11:28 GMT,
> 	Bill Smith <wksmith@optonline.net> wrote:
>> 
>> "Martien Verbruggen" <mgjv@tradingpost.com.au>
>> --snio--
>> 
>>> Did you know that in Perl 5.6.0, you can do
>>>
>>> open my $fh, "some_file" or die $!;
>> 
>> This does work with my ActivePerl 5.6.1, but how are we supposed to know it?
>> perldoc -f open explicitly specifies the use of IO::File for this syntaxt.

[snip]

> I knew because I had been following developments while they were going
> on, and because I tend to read the perldelta files on new releases.

Oh, and I just noticed there is a little bit of information stuck in
perldata at the end, under the heading "Typeglobs and Filehandles".

Martien
-- 
                        | 
Martien Verbruggen      | Freudian slip: when you say one thing but
Trading Post Australia  | mean your mother.
                        | 


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

Date: 11 Nov 2002 19:42:40 -0800
From: m_dv@hotmail.com (Miguel)
Subject: Re: Global file search function?
Message-Id: <120db37b.0211111942.73adcd54@posting.google.com>

tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnat0a6h.261.tadmc@magna.augustmail.com>...
> Miguel <m_dv@hotmail.com> wrote:
> 
> >         I'm wondering how will be possible to search for a specific
> > file format (example .zip) 
> 
> 
> I guess you really meant file*name* rather than file format.
> 
> 
> > within the "entire" system, *every folder*.
> 
> 
>    use File::Find;
> 
>    my @found;
>    find sub { push @found, $File::Find::name if /\.zip$/ }, '.';
>    print "$_\n" for @found;
> 
> 
> You can read the documentation for the module by typing:
> 
>    perldoc File::Find

Fantastic, I was looking just for that. Ok, thank you both for your help.

-Miguel Daniel <m_dv@hotmail.com>


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

Date: 11 Nov 2002 19:26:30 -0800
From: matirxrabbit@Hotmail.com (Corey Andrews)
Subject: Help! Bad Interperter: no such file or directory
Message-Id: <8e213620.0211111926.1b507c09@posting.google.com>

Hey,
I'm running slack 8.1, and for some odd reason, my perl scripts won't
run.  When I type in the cmd "perl script.pl" it tests and runs fine,
but typing in the "./script.pl" by itself comes out with the error "
bad interperter: no such file or directory ".  Is this normal?
Checking twice (using cmd "which perl")..i'm pretty sure I got
everything down. It's chmod 755 and I even downloaded the most recent
perl interperter to be sure.  But it's still no go.  I need to be able
to run this correctly so my cgi scripts will work on my httpd server. 
Any ideas?

Corey


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

Date: Mon, 11 Nov 2002 19:31:33 -0800
From: "Tan D Nguyen" <nospam@nospam.com>
Subject: Re: Help! Bad Interperter: no such file or directory
Message-Id: <aqpsl0$cf10i$1@ID-161864.news.dfncis.de>


"Corey Andrews" <matirxrabbit@Hotmail.com> wrote in message
news:8e213620.0211111926.1b507c09@posting.google.com...
> Hey,
> I'm running slack 8.1, and for some odd reason, my perl scripts won't
> run.  When I type in the cmd "perl script.pl" it tests and runs fine,
> but typing in the "./script.pl" by itself comes out with the error "
> bad interperter: no such file or directory ".  Is this normal?
> Checking twice (using cmd "which perl")..i'm pretty sure I got
> everything down. It's chmod 755 and I even downloaded the most recent
> perl interperter to be sure.

Please provide us with the output of "which perl" and the path to Perl
executable on the top of your script.




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

Date: Mon, 11 Nov 2002 21:31:13 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help! Bad Interperter: no such file or directory
Message-Id: <87n0of31mm.fsf@limey.hpcc.uh.edu>

>> On 11 Nov 2002 19:26:30 -0800,
>> matirxrabbit@Hotmail.com (Corey Andrews) said:

> Hey, I'm running slack 8.1, and for some odd reason, my
> perl scripts won't run.  When I type in the cmd "perl
> script.pl" it tests and runs fine, but typing in the
> "./script.pl" by itself comes out with the error " bad
> interperter: no such file or directory ".  Is this
> normal?  Checking twice (using cmd "which perl")..i'm
> pretty sure I got everything down. It's chmod 755 and I
> even downloaded the most recent perl interperter to be
> sure.  But it's still no go.  I need to be able to run
> this correctly so my cgi scripts will work on my httpd
> server.  Any ideas?

Your #! line is wrong.  Or you don't have one, which is
also wrong :-)



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

Date: Mon, 11 Nov 2002 22:39:25 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Help! Bad Interperter: no such file or directory
Message-Id: <3DD077ED.8080109@thecouch.homeip.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1



Corey Andrews wrote:
| Hey,
| I'm running slack 8.1, and for some odd reason, my perl scripts won't
| run.  When I type in the cmd "perl script.pl" it tests and runs fine,
| but typing in the "./script.pl" by itself comes out with the error "
| bad interperter: no such file or directory ".  Is this normal?
| Checking twice (using cmd "which perl")..i'm pretty sure I got
| everything down. It's chmod 755 and I even downloaded the most recent
| perl interperter to be sure.  But it's still no go.  I need to be able
| to run this correctly so my cgi scripts will work on my httpd server.
| Any ideas?

Check the shebang (the first line) in your perl script.  It should look
something like so:

#!/usr/bin/perl

Make sure the path it says matches the exact same path `which perl`
gives you.

Also if you're uploaded your file from a windows machine, you might have
extra carriage returns there.  Run your file through some sort of
dos2unix utility if the above suggestion doesn't help.

Best of luck.


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE90HfteS99pGMif6wRAl9WAKDSCa3z7/OijdaERr4OaQL51dnsUgCgi+/Y
4JsF1qtczHFeI1OeQtdzuhI=
=M6ft
-----END PGP SIGNATURE-----



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

Date: Tue, 12 Nov 2002 04:13:20 +0100
From: Daniel Glage <dglage_SPAMMERSWILLBEFLAMEDAT@gmx.de>
Subject: Re: illegal use of comment ? [OT]
Message-Id: <Xns92C32913AEE80NowstopsanobleheartG@62.153.159.134>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in 
news:3DD0038E.B33E668C@earthlink.net:

>> That us a US thing.  # is the pound sigh over there, that is, not
>> pound sterling but the unit of weight.
> Strangely, even though we USAans read "#" as "pound" or "pound sign", we
> don't use it to denote weight -- we write pounds as "lbs" ... which
> makes just as little sense, since the word "pound" has neither an "l"
> nor a "b" in it.

http://www.worldwidewords.org/qa/qa-pou1.htm reads:
---
"Why are pounds, when used as a weight, abbreviated lbs?" 
The origin is in the Latin word libra, which could mean both balance scales 
(hence the symbol for the astrological sign Libra, which was named after a 
constellation that was thought to resemble scales) and also a pound weight, 
for which the full expression was libra pondo, the second word being the 
origin of our pound. 
---

Sounds a bit obscure to me, but after all - a Latin root is an excuse for 
everything. ;)


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

Date: Mon, 11 Nov 2002 23:16:32 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: illegal use of comment ?
Message-Id: <3DD03A36.508205DB@acm.org>

Walter Roberson wrote:
> 
> Here in Canada, '#' would usually be called "number sign" or "sharp sign"
> (as in music.)

You must be in another part of Canada because here the colloquial useage
is "pound sign" or "pound key".  :-)


John
-- 
use Perl;
program
fulfillment


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

Date: 12 Nov 2002 01:35:53 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: illegal use of comment ?
Message-Id: <aqpltp$7hn$1@canopus.cc.umanitoba.ca>

In article <pkent77tea-60BF37.21505711112002@news-text.blueyonder.co.uk>,
pkent  <pkent77tea@yahoo.com.tea> wrote:
:To reduce confusion it our Duty! to use, and encourage others to use, 
:unambiguous terms, especially in international areas like Usenet. In 
:this case the best thing to do, the thing with _zero_ ambiguity, is to 
:use the single plain ASCII (and supersets) character '#'. Calling it 
:hash, or octothorpe are also unambiguous in terms of fonts/glyphs/etc.

Using the character '#' has some ambiguity: ASCII allowed the display
for that position to be the UK pounds-stirling L-bar symbol. (Or
was it ANSI X.3? I get the two confused.) Even without the 
shift-in, shift-out, and graphics-renditions behaviours, '#' was
on the list of National Symbols whose appearance was allowed to vary
from location to location.

This behaviour has likely been bred out of modern standards, but
still exists in sufficiently precise terminal emulators.
--
Studies show that the average reader ignores 106% of all statistics
they see in .signatures.


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

Date: Tue, 12 Nov 2002 02:20:01 GMT
From: echang@netstorm.net (ebchang)
Subject: Re: illegal use of comment ?
Message-Id: <Xns92C3D915ECCD6echangnetstormnet@207.106.92.86>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in 
<3DD0038E.B33E668C@earthlink.net>:

[snip]

>Does anyone know the reasoning behind why, when reading punctuation
>aloud, sometimes we speak the word "sign" or "mark", and sometimes we
>don't add anything?  Eg, reading across the top of my keyboard, I would
>say tilde, exclamation point, at symbol, pound sign, dollar sign,
>percent sign, caret, ampersand, times (only when used to multiply things
>together, otherwise it's "asterix"), left parenthesis, right
>parenthesis, underscore, plus (but it's only "plus" if it's being used
>to add two things togeter, otherwise it's "plus sign").

What jumps out at me is that tilde, caret, ampersand, asterisk, underscore, 
and the parentheses are naming the character, while exclamation point, at 
symbol, pound sign, dollar sign, percent sign, and plus sign - as well as 
question mark and equal sign - incorporate the meaning or usage of the 
symbol. Hence when we refer to the latter, we have to indicate that we mean 
the symbol rather than its meaning. 

-- 
EBC


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

Date: 11 Nov 2002 23:43:39 GMT
From: William Park <opengeometry@yahoo.ca>
Subject: Re: Is python a good choice for this task?
Message-Id: <aqpfbb$c4ca2$1@ID-99293.news.dfncis.de>

In comp.lang.python Ron Lau <ral@spongebob.corporate.com> wrote:
> Hi,
> 
> This IS NOT a request for someone to write a program for me. (But I won't
> turn it down :)  ).  The only programming I ever did was FORTRAN >:P , and short shell
> scripts. I'm just looking for advice.
> 
> 
> I have a CFD program that takes a text file as input (Q1.1). I run it on the
> command line as:
> 
> phoe Q1.1
> 
> which outputs the binary file PH.1
> 
> 
> I also have a program that gives me a number as the last line of its
> output to the terminal with the command
> 
> pointquerey  PH.1 TempK 1 1 1 | tail -1
> 
> 
> What I do now is compare the output of the line above to the value I want
> it to be, then change a parameter in the Q1.1 file, say T1=500.0
> 
> I would like to write something that would Goal Seek this for me.
> (something simple like a newtonian method)
> 
> So I would need a program to..
> --------------------------
> 
> run the command "phoe Q1.1"
> 
> then run the command "pointquery PH.1 TempK 1 1 1 | tail -1"
> 
> read the output of the above and compare to the desired value.
> 
> calculate a better value of T1.
> 
> replace T1=oldvalue in the file Q1.1 with the calculated value from
> above.
> 
> loop back to the beginning...
> 
> -------------------------
> 
> 
> My question is, What language is best suited for this? Perl, Python, or
> shell scripts?
> 
> 
> TIA!
> 
> ral

Well, shell is more natural approach, though you can do it in any scripting
language.  For example,
    while [ $out ... $some_value ]; do
	phoe Q1.1
	out=`pointquery PH.1 TempK 1 1 1 | tail -1`
	if [ ...<terminal_condition>... ]; then 
	    break
	fi
	T1=...
	sed "g/T1=.*/s//T1=$T1/" Q1.1 > new && mv new Q1.1
    done

-- 
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Linux solution for data management and processing. 
1986 VW Jetta, 350000km :-))


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

Date: Mon, 11 Nov 2002 22:22:09 -0500
From: Ian Chapman <ian_chapman@junk.net>
Subject: Keyboard mapping
Message-Id: <3DD073E1.F13CCD1@junk.net>

I'm at sympatico dot ca not junk.net
Hi
    I have a problem with ctl D, in fact all ctl characters in that they
print on the screen as ^D or ^Z etc.  I should be able to hit ctl D to
terminate keyboard input into an array.  My question is where in perl's
many source files do I find keyboard mapping?

            Regards Ian.



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

Date: Tue, 12 Nov 2002 04:11:42 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Keyboard mapping
Message-Id: <slrnat100f.2kt.mgjv@verbruggen.comdyn.com.au>

On Mon, 11 Nov 2002 22:22:09 -0500,
	Ian Chapman <ian_chapman@junk.net> wrote:
> I'm at sympatico dot ca not junk.net
> Hi
>     I have a problem with ctl D, in fact all ctl characters in that they
> print on the screen as ^D or ^Z etc.  I should be able to hit ctl D to
> terminate keyboard input into an array.

How do you mean? What your terminal uses to generate an end-of-file
signal is up to your terminal's settings, but it has nothing at all
to do with arrays, or even Perl.

On unices, it tends to be ctrl-d, while on windows it is (can that be
changed?) ctrl-z.

On unix, the stty command can tell you more about what it is for your
tty.

I must say that I really don't know what you mean by "terminate
keyboard input into an array"...

>                                          My question is where in perl's
> many source files do I find keyboard mapping?

There is no such thing as a keyboard mapping in perl's source code. If
perl is reading input from your terminal, it will stop when it
encounters an end-of-file condition (or error), and how your terminal
signals that is up to it, not to perl.

What is the code you are running, on which platform, and how are you
running it?

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | "Mr Kaplan. Paging Mr Kaplan..."
                        | 


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

Date: Mon, 11 Nov 2002 22:28:05 -0500
From: Michael J Wilusz <mjwilusz@acsu.buffalo.edu>
Subject: Newbie with Perl
Message-Id: <aqpsff$5ff$1@prometheus.acsu.buffalo.edu>

Hey All!
     Great newgroup!  It's hard to find one where everyone is down to Earth
and not lookin to hurt eachother.  Anyways... onto Perl.  Never touched it,
but must say I've heard a lot with Perl scripts and such.  Here's what I
need to do:

-Take a filename as a command line argument.
-The file will contain lines which are either a comment,
beginning with the character #, or records of
white-space-seperated fields of the format:


-I will be using a remote file called names.dat as my input.
    -This file is a list of names (makes sense, right?)
    -The line's look like the following
                                           tldona             TLD      Tony
L    Danza    523-8426 Junior_Designer RO
  Here's what each means:  Unix-username Initials Firstname MI Lastname
Phone       Site                    Attributes


The output should l ook like this:

        Phone Book

Name                    Telephone
=============================
Tony       Danza     584 523 8426

And here's a hint I was given:
        Hint: the first line of your script should be:
        #! /util/bin/perl -w


Any help would be awesome.  I'm recently came out of emergency surgery and
have work piled on me, and had a gentle reminder today that the deadline for
this is upcoming.  I have some minor Java knowledge, so basic programming is
fresh in this young mind.  Thanks for any and all help everyone!  Good
evening all.

-Mike W.




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

Date: 11 Nov 2002 20:39:16 -0800
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: Object in @INC returning Tie::Handles from INC method
Message-Id: <1bff1830.0211112039.5651535d@posting.google.com>

Benjamin Goldberg wrote:
> Bryan Castillo wrote:
> > 
> > > Well, ordinary open filehandles and tied handles *should* work about
> > > the same.  Objects derived from IO::Handle are, in fact, ordinary
> > > open handles, except that in addition to being able to use the
> > > builtin io operators, you can use object-oriented methods on them,
> > > too.
> > >
> > > PerlIO layers are a bit different... however, there should be little
> > > enough need for you to concern yourself there, since you generally
> > > don't have to deal with PerlIO objects directly; they're hidden
> > > inside the internal data of the IO-ref part of the filehandle.
> > 
> > Do you have any idea then, why PerlIO layers work as returned values
> > for INC while tied filehandles don't.
> 
> I've never seen a PerlIO layer returned from an INC method.
> 
> I *have* seen ordinary filehandles (with PerlIO layers pushed onto them
> via binmode) returned from an INC method.
> 

Sorry to rehash this, but....

Based on Ben's explanations, testing and reading source I have come up
with this list of my (?:mis)?understandings of IO in perl.

1. For most purposes (in pure perl code), tied file handles work 
   under the same conditions as normal open files, pipes, etc... 
   (I guess anything that has a file descriptor in C)

2. Objects derived from IO::Handle provide nifty OO methods for 
   file handles.

3. More recent versions of perl (what versions?) provide a filtering
   mechanism, through the use of PerlIO, but the objects are still 
   of type PerlIO.
   (there is a #define PERLIO_LAYERS in perlio.h)

4. Tied filehandles do not always work the same as a PerlIO type at
the
   C/XS level and because of this, will not work as values returned 
   from INC callbacks.

[I know this started off with a question about how to load 
 perl modules out of zip files, but for me... it turned into
 having to understand the why not just the how.]

Explanation (really observation) of #4

- the use of eval and require (anything else?) results in a call
  to the function pp_require in pp_ctl.c.

  pp_ctl wil:

  1. will extract the value of a reference    
    (a tied filehandle will evaluate true in the condition below)
    if (SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVGV) {
      arg = SvRV(arg);
     }

  2. will try to convert the GV * to an IO *
    (a tied filehandle will evaluate true in the condition below)     
    if (SvTYPE(arg) == SVt_PVGV) {
      IO *io = GvIO((GV *)arg);
    
  3. will do nothing with the io becaus it is NULL.


Some test code I wrote to come to this conclusion


<snippet of XS (yeah I used printf so)>
void
print_glob_info (some_glob)
    SV * some_glob;
  PREINIT:
    IO * io;
  CODE:
    /* sv_tos - is something i whipped up to print the type
       (probably already exists somewhere */
    if (SvROK(some_glob)) {
      printf("SvTYPE = [%d:%s]\n", SvTYPE(some_glob),
sv_tos(some_glob));
      some_glob = SvRV(some_glob);
    }
    printf("SvTYPE = [%d:%s]\n", SvTYPE(some_glob),
sv_tos(some_glob));
    if (SvTYPE(some_glob) == SVt_PVGV) {
      io = GvIO((GV*)some_glob);
      printf("Is io null [%s]\n", ((io) ? "no" : "yes"));
      if (io) {
        printf("IoTYPE = [%c]\n", IoTYPE(io));
      }
    }


<snippet of perl>
package GlobTest;
use Tie::Handle;
use vars qw(@ISA $AUTOLOAD);

@ISA = qw/Tie::Handle/;

sub AUTOLOAD { printf "method: %s\n", $AUTOLOAD }

sub BEGIN {
  foreach (qw/PRINT PRINTF WRITE READ GETC READLINE
              EOF CLOSE SEEK TELL OPEN BINMODE/)
  {
    eval "sub $_ { _debug(\@_) }";
    die $@ if ($@);
  }
}

sub TIEHANDLE { bless {} }

sub _debug {
  printf "%s:%d:%s\n", (caller(1))[1,2,3];
  printf("  %s\n", $_) foreach(@_);
}

package main;
use GlobInfo; 

GlobInfo::print_glob_info(\*STDOUT);
require Symbol;
my $s = Symbol::gensym;
tie *$s, 'GlobTest';
print "$s = $s\n";
GlobInfo::print_glob_info($s);

<$s>;
print $s "hi";

require IO::File;
my $fh = IO::File->new(">blah.txt") || die;
GlobInfo::print_glob_info($fh);



<output>
SvTYPE = [3:RV]
SvTYPE = [13:PVGV]
Is io null [no]
IoTYPE = []
GLOB(0x80fbbd8) = GLOB(0x80fbbd8)
SvTYPE = [3:RV]
SvTYPE = [13:PVGV]
Is io null [yes]
test.pl:51:GlobTest::READLINE
  GlobTest=HASH(0x80fbc08)
test.pl:52:GlobTest::PRINT
  GlobTest=HASH(0x80fbc08)
  hi
SvTYPE = [3:RV]
SvTYPE = [13:PVGV]
Is io null [no]
IoTYPE = [>]
method: GlobTest::DESTROY


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

Date: 12 Nov 2002 01:16:53 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: OT: pound sign, was Re: illegal use of comment ?
Message-Id: <aqpkq5$6uv$1@canopus.cc.umanitoba.ca>

In article <Pine.LNX.4.40.0211111946160.10037-100000@lxplus075.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
:On Nov 11, Walter Roberson inscribed on the eternal scroll:

:> I saw  #  for weight several times in England when I was last there
:> a short number of years ago.

:I think you were mistaking a scribbled "lb".  Try writing "lb"
:longhand with a bit of a flourish on the final loop, and I think
:you'll see what I'm getting at.

No, it was clearly the  #  character I saw. I saw it in a cheese store,
and I saw it in a couple of public markets.
--
   "No one has the right to destroy another person's belief by
   demanding empirical evidence."            -- Ann Landers


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

Date: Tue, 12 Nov 2002 01:23:11 GMT
From: tk <tk@WINDOZEdigiserv.net>
Subject: Re: OT: pound sign, was Re: illegal use of comment ?
Message-Id: <nvl0tuolhcrokqd3ugd8g2t3bfhf14dq9d@4ax.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In a fit of excitement on 12 Nov 2002 01:16:53 GMT, roberson@ibd.nrc.ca
(Walter Roberson) managed to scribble:

| In article
| <Pine.LNX.4.40.0211111946160.10037-100000@lxplus075.cern.ch>, Alan J.
| Flavell <flavell@mail.cern.ch> wrote:
| :On Nov 11, Walter Roberson inscribed on the eternal scroll:
| 
| :> I saw  #  for weight several times in England when I was last
| there :> a short number of years ago.
| 
| :I think you were mistaking a scribbled "lb".  Try writing "lb"
| :longhand with a bit of a flourish on the final loop, and I think
| :you'll see what I'm getting at.
| 
| No, it was clearly the  #  character I saw. I saw it in a cheese
| store, and I saw it in a couple of public markets.

I can't say I've ever seen the # sign over here in the UK, other for a
shortened (US?) version for 'number'.. but I don't get around
everywhere.


Regards,

  tk

-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3

iQA/AwUBPdBYPijNZg8h4REKEQI0+QCbBW7/eHUg0mfMt4KGrqukBzekXeAAn3CQ
4HuQZ3qCgDdOYKH4/jcZABDT
=goGT
-----END PGP SIGNATURE-----

-- 
+--------------------------+
|     digiServ Network     |
|      Web solutions       |     Remove WINDOZE to reply.
| http://www.digiserv.net/ |
+--------------------------+


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

Date: Mon, 11 Nov 2002 16:40:37 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: saving a cgi file
Message-Id: <aqpdju$crc$1@slb0.atl.mindspring.net>

"Westy" <intlone@hotmail.com> wrote in message
news:28b2c540.0211111236.7ee38f73@posting.google.com...
> Rather new to perl!  Writing programs in notepad, but having trouble
> saving them as cgi files, keep saving as text files.  Appreciate any
> suggestions.

You should be saving as text files. To prevent your editor from appending a
 .txt filename extension, e.g., cgi_file.pl.txt, simply enclose the filename
and extension in quotes, e.g., Save As "cgi_file.pl"

Bill Segraves




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

Date: Tue, 12 Nov 2002 00:49:38 GMT
From: "hb" <harini_b@hotmail.com>
Subject: Re: saving a cgi file
Message-Id: <CeYz9.1341$kV.62001357@newssvr14.news.prodigy.com>


Westy <intlone@hotmail.com> wrote in message
news:28b2c540.0211111236.7ee38f73@posting.google.com...
> Rather new to perl!  Writing programs in notepad, but having trouble
> saving them as cgi files, keep saving as text files.  Appreciate any
> suggestions.


When saving the file in notepad make sure that Save type as is set to All
Files and not Text Documents(.txt).Once this is done you should be able to
save the file with a .cgi extension.

Regards,
hb





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

Date: Tue, 12 Nov 2002 01:23:53 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: split /(\d\d)/, $_, 3 may return 5 elements - why?
Message-Id: <3dd05457.191655264@news.erols.com>

cjavajim@yahoo.com (Jim Bowie) wrote:

: Why does `split' yield five elements when a maximum of three was
: specified in the following code?
:
: while ( <DATA> )
: {
:     chomp;
:     my @fields = split /(\d\d)/, $_, 3;
:     print "'$_' " foreach @fields;
:     print "\n";
: }
: __END__
[snip]

: In "Programming Perl" 3rd edition page 795, it has "...if the PATTERN
: contains parentheses, then the substring matched by each pair of
: parentheses is included in the resulting list, interspersed with the
: fields that are ordinarily returned."

There's the answer to the question in the subject.
The split pattern is grabby.

: Hmm. No mention of the '' elements.

That's a completely different question.  Keep reading.

perldoc -f split
    [...]
    Empty leading (or trailing) fields are produced when there
    positive width matches at the beginning (or end) of the string;
    a zero-width match at the beginning (or end) of the string does
    not produce an empty field.
    [...]

: I finally resolved this issue by including grep:

Consider that split() is not the best tool for this task.

Use split when there are pieces of a string that need to be discarded.

Use m// when there are pieces of a string that need to be kept.



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

Date: Mon, 11 Nov 2002 23:54:34 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Upgrade to Perl 5.6.x ?
Message-Id: <pkent77tea-85AB03.23543411112002@news-text.blueyonder.co.uk>

In article <aqo4ei$r34$1$8302bc10@news.demon.co.uk>,
 "Clyde Ingram" <cingram@pjocsNOSPAMORHAM.demon.co.uk> wrote:

> Where can I find the most compelling statement of why my project's
> Development Manager should give the green light for an upgrade from Perl
> 5.00404 (!!) to 5.6 (on Solaris 2.6)?

We also use 5.00404 (exactly) and TheyRunOurWebservers have recently 
installed perl 5.6.1 as an opt-in upgrade for some applications. I'd say 
5.6.1 is the one to go for right now.

The reasons for upgrading are pretty wide ranging, from major security 
bugfixes, major resource allocation bugs, bugs in the regexp engine, 
bugs in many core functions, bugs and features in the standard library 
of perl modules, far more features in the standard library, more stuff 
in the standard library, far better debugging and hardcore developer 
stuff, large file and 64 bit support etc etc.
[ see the perldelta pages for details ]

If that's not compelling enough, well-written code that ran under 
5.00404 will generally work just fine under 5.6.1, no changes to be made 
(naturally you should always check this :-) To spell it out, this means 
a low cost of migration.

And if that wasn't enough, who says you can only have one copy of perl 
on a system. We've happily got 3 versions sitting in /usr/local/bin. 
Just install perl 5.6.1 so it doesn't touch the existing installation 
and let people 'opt-in' to using it - that way you can compare both 
versions together.

And if they still don't get it, they shouldn't have the superuser 
password on your machine :-)

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

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


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