[12938] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 348 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 3 10:17:23 1999

Date: Tue, 3 Aug 1999 07:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 3 Aug 1999     Volume: 9 Number: 348

Today's topics:
    Re: Reading group of files as One ? <tchrist@mox.perl.com>
    Re: reg.expressions: replace a substring ??? (Larry Rosler)
    Re: Running scrips on own pc (elephant)
    Re: Stopping output (Anno Siegel)
    Re: Stopping output (Michel Dalle)
        The question of the performence of database handle <c8133594@comp.polyu.edu.hk>
    Re: to Andreas <itc@cloudnet.com>
    Re: using __PACKAGE__ jschueler@tqis.com
    Re: using __PACKAGE__ jschueler@tqis.com
    Re: VERY,VERY URGENT: I need help with the Net::FTP mod <martin@adoma.se>
        What's a good database module to use? (Greg Miller)
    Re: What's a good database module to use? <tchrist@mox.perl.com>
    Re: Why no Perl books at Fry's? <gellyfish@gellyfish.com>
    Re: Working Telnet Script Needed <chrisnet01@yahoo.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 3 Aug 1999 06:15:12 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Reading group of files as One ?
Message-Id: <37a6dd50@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, "Steve" <itc@cloudnet.com> writes:
:I tried
:
:open(RES, " *.res") or die "Can't open results: $!/n";
:
:to read all files ending with .res
:Obviously this did not work.
:
:Is there anyway I can avoid hardcoding the file names in the
:program and also avoid manually cycling through each
:file ?

    local @ARGV = glob("*.res");
    while (<ARGV>) {  # implicit open each in @ARGV
	# do something input line in $_ here
    } 

or more explicitly and less conveniently


    for my $filename (glob("*.res")) { 
	local *INPUT;
	unless (open(INPUT, $filename)) {
	    warn "cannot open $filename: $!";
	    next;
	} 
	local $_;
	while (<INPUT>) {
	    # do something input line in $_ here
	} 

    } 

Note that <ARGV> may always be written <>.  But you probably knew that.

--tom
-- 
    The only disadvantage I see is that it would force everyone to get Perl.
    Horrors.  :-)
                    --Larry Wall in  <8854@jpl-devvax.JPL.NASA.GOV>


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

Date: Tue, 3 Aug 1999 06:42:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: reg.expressions: replace a substring ???
Message-Id: <MPG.12109192e7c3eaa8989da3@nntp.hpl.hp.com>

In article <37A6B136.85025A83@eed.ericsson.se> on Tue, 03 Aug 1999 
11:07:02 +0200, Alex Farber <eedalf@eed.ericsson.se> says...
> Ming Hubert wrote:
> > i have a outputstring (outstr1) on which i'd like to replace multiple
> > substrings which all begin with the same characters, for example: "repl_me".
> > the replacement should only be done till the next delimiter. the outstring
> > has the delimiter ";".

H1234;Tom John;repl_me tillnxt delim;Berlin;5000;repl_me again tillnxt
delim;Germany;repl_me again;
H1235;Kim Wild;Hamburg;repl_me tillnxt delim;8000;Germany;repl_me again
tillnxt delim;repl_me again;

Those semicolons look like field terminators, not delimiters.  
However...

> if the delimiter is just one character (like ";")
> 
>     s/repl_me.+?;/xxx;/g;
> 
> if the delimiter is a string (like "delim")
> 
>     s/repl_me(?:(?!delim).)+delim/xxxdelim/g;

That seems unnecessarily complex.  Why not just the same as your 
previous one?

      s/repl_me.+?delim/xxxdelim/g;

In either case, one should add the '/s' modifier if the string can span 
more than one line, and use '.*?' if 'repl_medelim' should become 
'xxxdelim' also.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 3 Aug 1999 22:30:52 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Running scrips on own pc
Message-Id: <MPG.12118c0964c921e2989bcc@news-server>

[ item posted to comp.lang.perl.misc and CCed to Paul Reid ]

Paul Reid writes ..
>Whats with the shh everybody? What am i missing?

*8^) .. just that the '-w' is not actually essential for your script to 
work .. just that it warns you about likely errors .. most newbies don't 
use it for one reason or another and it causes them a lot of grief .. 
it's best if you believe that it's essential for your script to run .. it 
may cause you a little pain to begin with - but you'll learn a lot more 
and there'll be less pain in the long run

-- 
 jason - who built a proper spam catcher today -


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

Date: 3 Aug 1999 11:00:29 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Stopping output
Message-Id: <7o6i4d$9v5$1@lublin.zrz.tu-berlin.de>

 <makarand_kulkarni@my-deja.com> wrote in comp.lang.perl.misc:

>Code snippet to illustrate how it cud be done.

[snippet snipped]

Please place your replies below the quoted text.  If Deja.com doesn't
allow you to do that, don't post from there.  Thank you.

Anno


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

Date: Tue, 03 Aug 1999 11:02:08 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Stopping output
Message-Id: <7o6ib5$mrf$1@news.mch.sbs.de>

In article <slrn7qcld9.rb1.abigail@alexandra.delanet.com>, abigail@delanet.com wrote:
>Joan Richards (richj@home.com) wrote on MMCLXII September MCMXCIII in
><URL:news:37A57F3A.434ADCF7@home.com>:
>**
>** How can I force my script to only "show" 5 until the user hits "n" (next
>** or whatever) and then show the other five etc. etc. etc.
>
>RTFFAQ.

Which one are you referring to ? I was looking at the same thing
for the "more" thread, but I haven't found anything interesting,
except maybe in Perl FAQ 8, which refers to the Term:: modules
and thingies like stty and /dev/tty.

But that part still seems to be very Unix-centric, so it may not be a
solution for MS-oriented platforms. Haven't tried it yet, but /dev/tty
seems to be missed there for some reason :-)

Michel.


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

Date: Tue, 03 Aug 1999 21:10:12 +0800
From: Carfield Yim <c8133594@comp.polyu.edu.hk>
Subject: The question of the performence of database handle
Message-Id: <37A6EA34.F125F7C1@comp.polyu.edu.hk>


I want to ask, is ODBC really very slow? Will it affect the performance
of the system very much??
If I change to use the other database driver, like mySQL or mSQL, will
the performance change a
lot?




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

Date: Tue, 3 Aug 1999 08:11:44 -0500
From: "Steve" <itc@cloudnet.com>
Subject: Re: to Andreas
Message-Id: <7VBp3.107$H_3.13973@ptah.visi.com>

Hi Andreas,
I get the message
"bad command or file name"
when I run the code you specified.

Any ideas what I'm doing wrong ?

Thanks
Steve

Andreas Fehr <backwards.saerdna@srm.hc> wrote in message
news:37a6dcf2.24729358@news.uniplus.ch...
> On Tue, 3 Aug 1999 06:55:35 -0500, "Steve" <itc@cloudnet.com> wrote:
>
> >
> >@result  = glob("*.*");
> >while (<*.*>) { statements };
> >@result  = glob("$dir\*.*");
> >@result  = glob("$dir/*.*");
> >
> >
> >--- Bad command or file name
> >
>
> What line gave you the above error message??
>
> What do you get if you run:
> while (<*.*>) { print $_, "\n";}
>
> Andreas




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

Date: Tue, 03 Aug 1999 13:39:24 GMT
From: jschueler@tqis.com
To: tchrist@mox.perl.com
Subject: Re: using __PACKAGE__
Message-Id: <7o6rea$fe9$1@nnrp1.deja.com>

I appreciate the expertise behind this response.  But might as well
state the obvious plainly:  Tom, your response merely confirms that the
answer I am looking for is *not* in the documentation... leaving me
empty handed.  What's the point?

There are several issues causing user dissatisfaction (let's call them
bugs):  The first is in the documentation.  Since, given the source, I
assume your list below is comprehensive.  The best, perlmod.pod,
suggests:
     The special symbol __PACKAGE__ contains the current package,
     but cannot (easily) be used to construct variables.
(...read "kludge me")

Based on the available documentation and experimentation, the
__PACKAGE__ transformation occurs during compilation.  For some reason
" __PACKAGE__ " (surrounded by whitespace) transforms, but
"$__PACKAGE__::..." is left literal.  I'm still awed by this language,
so I expect this design decision is not an oversight.  But I cannot
fathom the reasoning- maybe to avoid clobbering users' variables of the
same name?

Third, this whole undertaking is an effort at another workaround.  So
long as I 'use strict;', the variable $AUTOLOAD is not available to my
package method unless I 'use vars qw( $AUTOLOAD )'.  I never use the
directive otherwise and prefer to avoid that workaround.  The only other
workable solution references $blah::blah::AUTOLOAD with the full package
name.  But experience has taught me not to leave landmines like that
lying around.  Using $__PACKAGE__::AUTOLOAD seems like the best
solution, (if it worked).

Admittedly, the following works and is simply inelegant:
my $autoload = eval( '$' . __PACKAGE__ . '::AUTOLOAD' ) ;

 -Jim

In article <37a5ef21@cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:
>      [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
>     jschueler@tqis.com writes:
> :The string string __PACKAGE__ failed for the www.perl.com
documentation.
> :And when I searched USENET, I get many false results due to poster's
> :sigs.  There's some quote, maybe biblical, about teaching a man to
> :fish...  Can anyone advise where I ought to have looked for this
answer?
>
> % cd /usr/src/perl5.005_59/pod/
> % grep __PACKAGE__ *.pod
> perl5004delta.pod:=item __PACKAGE__
> perl5004delta.pod:C<__FILE__> and C<__LINE__>, C<__PACKAGE__> does
I<not> interpolate
> perldata.pod:The special literals __FILE__, __LINE__, and __PACKAGE__
> perldata.pod:(due to an empty C<package;> directive), __PACKAGE__ is
the undefined value.
> perlfaq7.pod:    my $packname = __PACKAGE__;
> perlmod.pod:The special symbol C<__PACKAGE__> contains the current
package, but cannot
> perlmod.pod:    print "in ", __PACKAGE__, ": \$name is '$name'\n";
> perlobj.pod:    $self->{ __PACKAGE__ . ".count"}++;
> perltootc.pod:  __PACKAGE__ -> {CData2} = shift if @_;
> perltootc.pod:  return __PACKAGE__ -> {CData2};
> perltootc.pod:In the second accessor method, the __PACKAGE__ notation
was used for
> perltootc.pod:always put the __PACKAGE__ in a variable first.
> perltootc.pod:  my $class = __PACKAGE__;
> perltootc.pod:  my $obclass = shift || __PACKAGE__;
> perltootc.pod:    __PACKAGE__ -> bigbang();
> perltootc.pod:    for my $datum (keys %{ +__PACKAGE__ }) {
> perltootc.pod:should probably be C<$self-E<gt>{ __PACKAGE__ .
"_ObData1" }>, but that
>
> --
> I'll say it again for the logic impaired.  --Larry Wall
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 03 Aug 1999 13:49:33 GMT
From: jschueler@tqis.com
To: mjd@op.net
Subject: Re: using __PACKAGE__
Message-Id: <7o6s19$ft1$1@nnrp1.deja.com>

Can't use string ("foobar::hello") as a SCALAR ref while "strict refs"
in use at
 /tmp/hi line 9.


Am I doing something wrong?

 -Jim

In article <7o549d$cns$1@monet.op.net>,
  mjd@op.net (Mark-Jason Dominus) wrote:
> In article <7o4pov$1qv$1@nnrp1.deja.com>,  <jschueler@tqis.com> wrote:
> >  print $__PACKAGE__::hello, "\n" ;
> >
> >I would prefer that this script print "world" instead of a blank
line.
> >Is there some idiom I need to use?
>
> 	print ${__PACKAGE__ . '::hello'}
>
> You're doing an implict concatenation operation there, and Perl
> doesn't have implicit concatenation except inside of "..." strings.
> So you need the . to make Perl do the concatenation of the package
> name and the :: and the variable name.
>
> >Can anyone advise where I ought to have looked for this answer?
>
> Grepping the documenation is sometimes a good bet.
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 03 Aug 1999 11:54:03 +0100
From: Martin Quensel <martin@adoma.se>
Subject: Re: VERY,VERY URGENT: I need help with the Net::FTP module and  ActiveStates Perl!!!
Message-Id: <37A6CA4B.C9D46937@adoma.se>



bernie wrote:
> 
> Hello
> 
> I found out how to do it: nmake is the key !!!
> 
> Thanks for your help.
> 
> Regards
> bernie

Next time you maybee should try ppm.
or read the docs.

MQ


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

Date: Tue, 03 Aug 1999 13:14:00 GMT
From: gmiller@iglou.com (Greg Miller)
Subject: What's a good database module to use?
Message-Id: <37a6e9dd.1454021@news.iglou.com>

	My ISP doesn't allow telnet access and doesn't have a C
compiler installed (or at least I don't have access to it).  So
obviously mSQL and MySQL are out.
	So what packages are availalble which don't require telnet to
install them, and don't require C compilation?


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

Date: 3 Aug 1999 07:53:22 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: What's a good database module to use?
Message-Id: <37a6f452@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    gmiller@iglou.com (Greg Miller) writes:
:	So what packages are availalble which don't require telnet to
:install them

This makes so little sense to me I cannot begin to know what you need
to do.

I don't mean to be harsh, but perhaps you should get real access to a
real computer.  This whole "strange-action-at-a-distance" model that even
moderately usable ISPs impose on Prisoners of Bill is no less painful than
was the situation when we'd dutifully surrender our cards to the mainframe
operators, and then the following day, receive a continuous-feed printout
showing nothing worked.  Then we give them reordered cards, and the day
following, get back more futile printouts.  I would rather be a cook
than work under those conditions.  I'm surprised anybody puts up with it.

--tom
-- 
    I won't mention any names, because I don't want to get sun4's into
    trouble...  :-)     --Larry Wall in <11333@jpl-devvax.JPL.NASA.GOV>


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

Date: 3 Aug 1999 13:54:02 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Why no Perl books at Fry's?
Message-Id: <37a6e66a_1@newsread3.dircon.co.uk>

CGI <PerlCoder@Unix.com> wrote:
> 
> I went to Fry's Electronics. They have a large selection of computer
> books, bigger than places like Crown and Barnes & Noble. I saw lots of
> books on Java, C++, HTML, MCSE, etc. but I couldn't find anything on
> Perl. So how should one interpret this situation? 

You might as well ask why there is more Jeffrey Archer than Kurt Vonnegut.
It is down to the buyer for the shop or perhaps of the distributor they
buy from.  Did you see "The Art of Computer Programming" at that store
and how many " ... for Dummies" books - I think that answers your question.

/J\
-- 
"Gary Glitter pulls out of Children in Need" - BBC News Website


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

Date: Tue, 3 Aug 1999 11:39:31 +0100
From: "Chris" <chrisnet01@yahoo.com>
Subject: Re: Working Telnet Script Needed
Message-Id: <7o6gu1$1m6$1@dvorak.ednet.co.uk>

elephant man,

Please stop sending rants.

I spend more time reading your complaints than I do reading questions.
You presumably spend more time replying than reading them.

answer : stop doing it. You're a genius already. Let the others find their
own way.
Newsgroups were not established especially for you.

chris




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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 348
*************************************


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