[18505] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 673 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 11 09:05:53 2001

Date: Wed, 11 Apr 2001 06:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <986994318-v10-i673@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 11 Apr 2001     Volume: 10 Number: 673

Today's topics:
    Re: $text in a text file - how do I get it to print? (Anno Siegel)
    Re: CGI.PM and Forms <bart.lateur@skynet.be>
    Re: CGI.pm V. Here Docs . . . <moiraine@qwest.net>
    Re: CGI.pm V. Here Docs . . . (Anno Siegel)
    Re: complaint about moderation of this group <iltzu@sci.invalid>
    Re: complaint about moderation of this group <flavell@mail.cern.ch>
        converting UTF8 to 8bit character <snefsite@hotmail.com>
    Re: converting UTF8 to 8bit character (Andre Malo)
    Re: converting UTF8 to 8bit character <bart.lateur@skynet.be>
    Re: converting UTF8 to 8bit character <snefsite@hotmail.com>
    Re: Deleting one line from a file (Anno Siegel)
        GD newbie <bosko.mirkic@zg.tel.hr>
    Re: How does one access path/command in perl (i.e., equ <stephenk@cc.gatech.edu>
        How does one access path/command in perl (i.e., equiv t <ron.flory@adtran.com>
    Re: How does one access path/command in perl (i.e., equ (Bernard El-Hagin)
    Re: how to improve this code? <dont.reply@myself.com>
        How to send a formatted string through a socket? (Tassilo v. Parseval)
    Re: LWP - HTTPS nobull@mail.com
    Re: Newbie hash vs files database?? <gtoomey@usa.net>
        Perl Debugger Build Errors <scott.rutherford@cern.ch>
    Re: perl hacker wanted <iltzu@sci.invalid>
    Re: Perl Timer! (Anno Siegel)
    Re: permanently change file name with regex dcutter@gmx.de
    Re: permanently change file name with regex (Rafael Garcia-Suarez)
    Re: Private subroutine inside subroutine nobull@mail.com
    Re: reference , 2-dimensional array (thanks Bart) <a.v.a@home.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 11 Apr 2001 07:29:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: $text in a text file - how do I get it to print?
Message-Id: <9b114g$5l5$1@mamenchi.zrz.TU-Berlin.DE>

According to A_Geekette  <moiraine@qwest.net>:
> Anno Siegel wrote:
> 
> > According to A_Geekette  <moiraine@qwest.net>:
> > > That all depends on how you read the data and where you put it when you read
> > > it.
> >
> > You must be using the words "read" and "put" in a broader sense than
> > customary.
> 
> I didn't quote them, therefore they are supposed to be taken as generalizations
> and not as specific Perl functions.  However, this can also be concluded
> by taking
> a closer look at my statement (statement to be taken as dictionary...etc.).
> "how you read the data".  How you input the data.  How you take in the
> data.  How
> you bring the data in to be manipulated...etc.  The most likely means "read" or
> "open".

Hmm...  open() doesn't transfer data to the user.  read() does, but
it won't expand a variable whose name is embedded in the data.

> "..where you put it when you read it."  Assuming you "read" a file what
> do you do
> with it?  You can't just "read" it.  You have to put it somewhere or declare a
> space for it.  ie:
> open FILE, "path/to/file" or die $!;
> $variable = <FILE>; #or
> @variable = <FILE>; #or
> %variable = <FILE>;
> close FILE or die $!;
> Now that you have put the data somewhere, you can manipulate it with
> ease.  Also,
> if you're doing lengthy manipulation you don't want to have to leave the
> file open
> in case something else might want access.

A truism.  Which of these operations would help expand a variable
whose name is embedded in the data?

> Have I made myself more clear?  Is this enough information for you?  I
> didn't want
> to have to go through all this lengthy explanation, but I assumed you all knew
> this.  I figured a simple statement could cover it.  Shall I be this in
> depth next
> time or can I keep my statements (not to be confused with a Perl statement)
> simple?

Yes, please keep them simple.

> > Nothing I would subsume under these terms would expand
> > a Perl variable whose name is embedded in the text.
> 
> open MESSAGE, "../messages/$hash{folder}/$hash{mesgid}"
>  or die "Serious dainbramage: $!";
> @themessage = <MESSAGE>;
> close MESSAGE;
> $name = $themessage[2]
> 
> Now $name = "Lastname", where Lastname replaced by whatever happend to be in the
> file.
> This is an excerpt from a prog I wrote.  It's tried and tested.  The file I was
> opening was a file created by another script, so I already know what's in it.

We are talking about expanding variables whose *names* are contained
in the text of a file.  When your program says $foo = 'ham' somewhere,
and you have a file with the line "we had $foo and eggs", the question
is, how to arrive at "we had ham and eggs".  No manner of "reading"
the data of "putting it" anywhere would accomplish that.

Anno


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

Date: Wed, 11 Apr 2001 09:54:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: CGI.PM and Forms
Message-Id: <tea8dtsbshe37fln4d55o3ja6gel8nj1n5@4ax.com>

speakeasy wrote:

>Well GET method works, but POST does not... I though POST allowed for more
>data... hmm....

It does.

Your log seems to indicate you're using a Windows server. Could that be
the root of your problem? A server bug? Yet, CGI.pm is known to work
around some known bugs of several servers.

-- 
	Bart.


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

Date: Wed, 11 Apr 2001 01:06:39 -0700
From: A_Geekette <moiraine@qwest.net>
Subject: Re: CGI.pm V. Here Docs . . .
Message-Id: <3AD4108E.AC1C425A@qwest.net>

ameen@dausha.net wrote:


> For handling user input, they use cgi-lib.

Bad.

> The developing environment uses Solaris with Netscape as a server.

Use Apache with mod_perl it will handle (not to be confused with "handler") Perl
written CGI scripts a lot faster.  Not to mention Apache is just a better server in
general.
perl.apache.org.

> How can I best approach this issue to perhaps convince them that CGI.pm isn't
> so bad after all?

CGI.pm isn't bad.  It's just slow for many reasons I won't get into.  You can load
just the specific portions of the module you need, but that gets a little
complicated. For more module info post to comp.lang.perl.modules.  Also, like
Rafael said.  www.cpan.org

I hate to leave you hanging like this, but if I write any more I'll get criticized
by someone.
I speak bluntly and to the point; some people have a problem with that.
So, give me an email if you want more information.  Web stuff is my specialty.

--
Geekette

"Try Not.  Do or do not.  There is no try."
-If you don't know who said this,
I don't want to talk to you. ;-)

"Nothing is impossible, no matter how improbable."
-Anonymous




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

Date: 11 Apr 2001 09:39:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: CGI.pm V. Here Docs . . .
Message-Id: <9b18p5$bba$1@mamenchi.zrz.TU-Berlin.DE>

According to A_Geekette  <moiraine@qwest.net>:

[...]
 
> I hate to leave you hanging like this, but if I write any more I'll get
> criticized
> by someone.

If you don't want to be criticized, don't post.  No-one is immune.
Claiming that you can't write for fear of being criticized is ridiculous.

> I speak bluntly and to the point; some people have a problem with that.

Oh?  You have detected a new trend in clpm.  Who, in particular,
would that be?

Anno


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

Date: 11 Apr 2001 10:47:08 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: complaint about moderation of this group
Message-Id: <986984970.8945@itz.pp.sci.fi>

In article <slrn9d0juk.3ud.mgjv@martien.heliotrope.home>, Martien Verbruggen wrote:
>On Sun, 08 Apr 2001 08:25:18 GMT,
>	---Pete--- <bogus@erol.com> wrote:
>> What's not 100% clear to me is why all the concern
>> because... comp.infosystems.www.authoring.cgi
>> only gets about 20 posting per day <grin>.
>
>And that is a big concern. Because all of the stuff that should go there
>comes here first. They need more exposure.

This suggests to me a potential course of action -- answer all the CGI
questions posted to this group *in ciwac*.

Yes, that does mean the OP may never see the answer, though a Cc might
fix that if they have a valid e-mail address.  But it would funnel more
on-topic content to ciwac, and hopefully reduce the noise here.

I still have trouble understanding why people would rather as a question
in a high-volume group when a less noisy alternative is available, but
it seems many people do in fact think so.  (Probably they assume that
the number of posts somehow correlates with the number of knowledgeable
readers -- an unfortunately common misconception.)

So if we just treat CGI-related answers as bulk material to be pushed
into ciwac, without too much regard to thread integrity, that might
establish a positive feedback mechanism that would increase the volume
of ciwac, and hopefully decrease that of clpm.


(Before someone mentions it: No, you can't crosspost to ciwac because
the moderator bot doesn't let you.  Crossposts between ciwac and a group
with a human moderator may succeed if you put the other group first, but
between ciwac and clpm it won't work.  In any case, that would keep much
of the noise in clpm.)

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.


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

Date: Wed, 11 Apr 2001 13:39:57 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: complaint about moderation of this group
Message-Id: <Pine.LNX.4.30.0104111314210.21895-100000@lxplus003.cern.ch>

On 11 Apr 2001, Ilmari Karonen wrote:

> This suggests to me a potential course of action -- answer all the CGI
> questions posted to this group *in ciwac*.

That's a good idea.  How about a trivial followup here saying nothing
more than that the question is being answered in ciwac, and a separate
followup posted only to ciwac?

> (Before someone mentions it: No, you can't crosspost to ciwac because
> the moderator bot doesn't let you.

Yes, that's one of the most irritating features of the bot, since it
prevents the use of the standard usenet technique of crossposting to
set followups and keep both sets of readers aware of what's going on.

cheers



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

Date: Wed, 11 Apr 2001 13:23:50 +0200
From: "Sven Franke" <snefsite@hotmail.com>
Subject: converting UTF8 to 8bit character
Message-Id: <9b1enq$hct$1@ncc1701.cistron.net>

Hi,
I need to translate UTF8 to 8bit character. I use this function (see under),
but I get an error.
Does anybody know why this is?
(strange thing...on another machine this is running ok....)


sub UTF8toChar {
  my $s = shift;
  $s =~ tr/\0-\x{ff}//UC;
  return $s;
}

Illegal hex digit ignored at ../lib/F1.pm line 1161.
Bareword found where operator expected at ../lib/F1.pm line 1161, near
"tr/\0-\x{ff}//UC"
Bareword "UC" not allowed while "strict subs" in use at ../lib/F1.pm line
1161.
syntax error at ../lib/F1.pm line 1161, near "tr/\0-\x{ff}//UC"
BEGIN failed--compilation aborted at ./simple.pl line 22.

Sven Franke




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

Date: 11 Apr 2001 11:36:45 GMT
From: ndparker@gmx.net (Andre Malo)
Subject: Re: converting UTF8 to 8bit character
Message-Id: <Xns90808A926E3ADndparker@news.o3media.de>

* Sven Franke schrieb in <9b1enq$hct$1@ncc1701.cistron.net>:

>I need to translate UTF8 to 8bit character. I use this function (see
>under), but I get an error.
>Does anybody know why this is?
>(strange thing...on another machine this is running ok....)

seems to be the wrong perl version?

== cut ===
sub fromUTF8 ($) {
  my $ref = shift;
  my $string = ref($ref)?$$ref:$ref;
  no warnings 'utf8';

  $string =~ tr/\x80-\xff//UC;

  ref($ref)?\$string:$string;
}
=== cut ===

requires at least perl 5.6.0
and works fine (on my machine ;)

n.d.p.
-- 
my @japh = (sub{q~Just~}, sub{q~Another~}, sub{q~Perl~}, sub{q~Hacker~});
my $japh = q[sub japh { }]; print join          #########################
 [ $japh =~ /{(.)}/] -> [0] => map $_ -> ()     #           n.d. parker #
=> @japh;                                       # http://www.o3media.de #


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

Date: Wed, 11 Apr 2001 11:54:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: converting UTF8 to 8bit character
Message-Id: <dhh8dtcqtiga13le0tgl88e41fcbjcrm8v@4ax.com>

Sven Franke wrote:

>I need to translate UTF8 to 8bit character. I use this function (see under),
>but I get an error.
>Does anybody know why this is?
>(strange thing...on another machine this is running ok....)

Perl version. You need at least 5.6.0.

-- 
	Bart.


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

Date: Wed, 11 Apr 2001 15:05:08 +0200
From: "Sven Franke" <snefsite@hotmail.com>
Subject: Re: converting UTF8 to 8bit character
Message-Id: <9b1klm$t22$1@ncc1701.cistron.net>


But my ISP only has 5.0053.....

can it be done?


"Bart Lateur" <bart.lateur@skynet.be> schreef in bericht
news:dhh8dtcqtiga13le0tgl88e41fcbjcrm8v@4ax.com...
> Sven Franke wrote:
>
> >I need to translate UTF8 to 8bit character. I use this function (see
under),
> >but I get an error.
> >Does anybody know why this is?
> >(strange thing...on another machine this is running ok....)
>
> Perl version. You need at least 5.6.0.
>
> --
> Bart.




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

Date: 11 Apr 2001 08:06:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Deleting one line from a file
Message-Id: <9b13al$5l5$3@mamenchi.zrz.TU-Berlin.DE>

According to Chris Stith  <mischief@velma.motion.net>:

[...]
 
> If what you want is what your code suggests you want, then this
> ugly approach may work:
> 
> my @array = (
>     'foo',
>     'bar',
> );
> while(<>) {
>     my $regex = join '|', @array;
>     print unless /$regex/;
> }

Why do you build the regex inside the loop?  It doesn't change.

Anno


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

Date: Wed, 11 Apr 2001 09:36:10 +0200
From: "Bosko Mirkic" <bosko.mirkic@zg.tel.hr>
Subject: GD newbie
Message-Id: <9b11f3$domh$1@as121.tel.hr>

O.K. say what you want, but I'm stuck at the very beginning. I'm trying to
use GD under win32 distribution of ActivePerl but I don't know how to do
this. Can somebody tell me what to do (please in plain English "copy to dir,
install to, configure this, etc").

Thanks




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

Date: Wed, 11 Apr 2001 08:54:10 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: How does one access path/command in perl (i.e., equiv to C/C++  argv[0])
Message-Id: <3AD453F2.86D18C17@cc.gatech.edu>

Ron Flory wrote:
> 
>  I'm a C/C++ person, but I work with a Perl guy who needs to determine
> the directory path that reflects where the executable was loaded/run
> from.
> 
>  This is because we have other programs that are related to the primary
> app located in this same directory, which we need to launch from the
> primary app.  We need to know this 'path' when launching the other apps
> (which may be in different places on different users systems).
> 
>  In C/C++ this is -always- available in argv[0], but he says this is not
> the case in Perl.  How can we work around this issue?
> 

The name of the executed file is stored in $0 .  To get the current
directory, use the Cwd module.
Hope this helps.

perldoc perlvar
perldoc Cwd
-- 
Stephen Kloder               |   "I say what it occurs to me to say.  
stephenk@cc.gatech.edu       |      More I cannot say." 
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.


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

Date: Wed, 11 Apr 2001 07:50:36 -0500
From: Ron Flory <ron.flory@adtran.com>
Subject: How does one access path/command in perl (i.e., equiv to C/C++ argv[0])
Message-Id: <3AD4531C.F4796C09@adtran.com>

hi-

 I'm a C/C++ person, but I work with a Perl guy who needs to determine
the directory path that reflects where the executable was loaded/run
from.  

 This is because we have other programs that are related to the primary
app located in this same directory, which we need to launch from the
primary app.  We need to know this 'path' when launching the other apps
(which may be in different places on different users systems).

 In C/C++ this is -always- available in argv[0], but he says this is not
the case in Perl.  How can we work around this issue?

 Help..

I do not usually haunt this group, so an email response would really be
appreciated.

 Thanks.

ron


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

Date: Wed, 11 Apr 2001 13:00:52 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: How does one access path/command in perl (i.e., equiv to C/C++ argv[0])
Message-Id: <slrn9d8lbi.k53.bernard.el-hagin@gdndev32.lido-tech>

On Wed, 11 Apr 2001 07:50:36 -0500, Ron Flory <ron.flory@adtran.com> wrote:
>hi-
>
> I'm a C/C++ person, but I work with a Perl guy who needs to determine
>the directory path that reflects where the executable was loaded/run
>from.  
>
> This is because we have other programs that are related to the primary
>app located in this same directory, which we need to launch from the
>primary app.  We need to know this 'path' when launching the other apps
>(which may be in different places on different users systems).
>
> In C/C++ this is -always- available in argv[0], but he says this is not
>the case in Perl.  How can we work around this issue?
>
> Help..

The value you're searching for is stored in the special variable $0. For
more information check out:

perldoc perlvar

Cheers,
Bernard
--
perl -e'$\=qq;,\n;;s,,*Just.*another.*Perl.*hacker,e;%JaPh
=(q,*,,q, ,);s,((?:[\w]+?::)|\*),$JaPh{${((sin(32)**2)+
(cos(32)**2))}},gex;print;'


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

Date: Wed, 11 Apr 2001 10:08:20 +0100
From: Ian Phillipps <dont.reply@myself.com>
Subject: Re: how to improve this code?
Message-Id: <3AD41F04.1EF7FA71@myself.com>

Mark Jason Dominus wrote:
> 
> In article <20010409.160429.2086206725.3777@irs-net.com>,
> Jens Luedicke <jens@irs-net.com> wrote:
> >how can I improve this code?
> >
> >foreach (split /\n/, $records[$number_of_mails]{"Header"}) {

> { my $rec = $records[$number_of_mails];
>   for (split /\n/, $rec->{"Header"}) {

The 'split' is wrong. RFC 822 headers are allowed to have continuation
lines, and it's a rare email message that doesn't use this (in at least
the Received:).
To: and Cc: lines very frequently have continuations, too.

split /^\b/ does the trick (but leaves the trailing \n in the value of
the header field).

>       $rec->{$hdr} = $val;

this is also wrong. You're allowed to have multiple "To" headers, for
instance. Your program will lose all but the last one.

Ian


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

Date: 11 Apr 2001 07:35:46 GMT
From: Tassilo.Parseval@post.rwth-aachen.de (Tassilo v. Parseval)
Subject: How to send a formatted string through a socket?
Message-Id: <9b11gi$g22$1@nets3.rz.RWTH-Aachen.DE>

Hi!

I've recently come to hit a problem that is really puzzling me and does not seem to be covered very well by any documentation.
Assuming I have a function that shall print a well formatted table using printf running a for-loop and with a header coming on top of the table:

# header

printf GREEN."%-4s".BLUE."|".GREEN."%-50.50s".BLUE."|".GREEN."%-8s".
       BLUE."|".GREEN."%-3s".BLUE."|".GREEN."%-6s".BLUE."|".GREEN."%-8s\n",
       "a", "b" , "c", "d", "e", "f";
print BLUE;
printf "-" x 4 ; printf "|";
printf "-" x 50; printf "|";
printf "-" x 8 ; printf "|";
printf "-" x 3 ; printf "|";
printf "-" x 6 ; printf "|";
printf "-" x 8 ; printf RESET."\n";

# table content

for my $hash (@found) {

	my (
		$str1,
		$str2,
		$st3,
		$str4, $str4, $str5,
		$str6
	) =	(
		# some assignements
		$hash->{key1};
		...
		...
	);

	# filling the table 

	printf "%-4d".BLUE."|".RESET."%-50.50s".BLUE."|".RESET."%-4.1f%3.2s ".
		BLUE."|".RESET."%-3d".BLUE."|".RESET."%-6.6s".BLUE."|".RESET."%-8s\n",
		$str1,
		$str2,
		#etc
		...;
}

This actually prints the table on the machine running the server and is doing fine. But as the request comes from a client the output must go to it as well.
I tried using sprintf and assigning sprintf's output to a variable and sending it back but that did not work out and only worked with simple strings such as 'sprintf "%-5.5s", "someString"'.
I suppose what I would need is a way of sending more or less a raw array to the other party. So how do I achieve that? Using 'send' or 'syswrite CLIENT, etc...' weren't the way and seem to be biased on either sending lines or characters.

Can anyone roughly point me to a possible solution?


Greetings,
Tassilo
		
-- 
What pains others pleasures me,
At home am I in Lisp or C;
There i couch in ecstasy,
'Til debugger's poke i flee,
Into kernel memory.
In system space, system space, there shall i fare--
Inside of a VAX on a silicon square.


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

Date: 11 Apr 2001 08:46:03 +0100
From: nobull@mail.com
Subject: Re: LWP - HTTPS
Message-Id: <u98zl7aiw3.fsf@wcl-l.bham.ac.uk>

"Enrico Ng" <ng@fnmail.com> writes:

> I want to use LWP  to get a https page.
> when I use get, I get nothing, I am assuming this is because of https
> does anyone know what option I need to use to get it to work?

Check out README.SSL in the LWP sources.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 11 Apr 2001 17:14:31 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Newbie hash vs files database??
Message-Id: <XiTA6.888$482.3864@newsfeeds.bigpond.com>

Some of the options you may want to consider are:

using a real DBMS and using the DBI interface
dbm - a flat file database of hashes
B-Trees http://perl.plover.com/BTree/

If you have lots of files in a single directory, it will take a long time to
open a single file.
Anything over 100 files in a directory would slow down an interactive
program.

gtoomey
------------
"Jason Goodrow" <"goodrow"@opencity. com> wrote in message
news:9b0uta$3ph$1@news.panix.com...
> Hi newsgroup, newbie here -
>
> I got involved with a really large database - lots of entries of 20
> variable length fields.
> When the fields were static I was using a flat file and seeking the
> records but now they're going to change so updates
> get complicated.
>
> I'm thinking of using hashes - one for each entry. I would then have a
> directory with
> 10k of hashes. Or seperate text files that I split for the fields and a
> directory with 10k text files.
>
> Am I abusing the unix directory structure with this many entries?
> These entries will mostly just sit there with flurries of activity so is
> either strategy easier
> on the CPU?
>
> thanks in advance,
>
> goodrow@panix.com
>




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

Date: Wed, 11 Apr 2001 13:19:19 +0200
From: Scott RUTHERFORD <scott.rutherford@cern.ch>
Subject: Perl Debugger Build Errors
Message-Id: <3AD43DB7.89B1AABD@cern.ch>

Hello,

I've got this perl program which runs ok, but seems to occasionally
throw up strange segmentation faults, especially since I introduced
threads.

So I have tried to load it into the debugger but get this message (the
code snippet is below).

Default die handler restored.

Loading DB routines from perl5db.pl version 1.07
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

"globally" is not defined in %File::Glob::EXPORT_TAGS at
/usr/local/lib/perl5/5.6.0/Exporter/Heavy.pm line 75
        Exporter::heavy_export('File::Glob', 'main', ':globally') called

at /usr/local/lib/perl5/5.6.0/Exporter.pm line 50
        Exporter::import('*File::Glob::EXPORT', ':globally') called at
betbot.pl line 178
        main::BEGIN() called at
/usr/local/lib/perl5/5.6.0/i686-linux-thread/File/Glob.pm line 178
        require 0 called at
/usr/local/lib/perl5/5.6.0/i686-linux-thread/File/Glob.pm line 178
Can't continue after import errors at betbot.pl line 178
BEGIN failed--compilation aborted at betbot.pl line 178.

Any ideas????

------ betbot.pl lines 177 - 184 ::

sub my_exit {
    unlink <*.pag>;
    unlink <*.dir>;
    $running = 0;
    $urls_queue->enqueue(undef);
    $files_queue->enqueue(undef);
    exit;
}





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

Date: 11 Apr 2001 11:13:22 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: perl hacker wanted
Message-Id: <986986374.10354@itz.pp.sci.fi>

In article <3AD3E50F.994CF30F@qwest.net>, A_Geekette wrote:
>Jonathan Stowe wrote:
>> A_Geekette <moiraine@qwest.net> wrote:
>
>> > 8) I'm too impatient to read and too rebelious to follow (some) rules, but...
>> Oh Bollocks.
>
>Oh...you know me so well.  You're right.  I was lying.
>
>> *PLONK*

It seems you just managed to break another one of those subtle rules.
This newsgroup has been visited by people who have in fact refused to
read (anything but usenet, it would seem, though their reading
comprehension hasn't been that great here either) or follow rules, and
the regulars here have little tolerance left for them.

Unfortunately it's too late to say you were only joking one you're in
the killfile.  I'd suspect Jonathan wasn't the only one to plonk you
based on that single line.  I haven't done that yet, since I've seen
some reasonable posts from you, but without evidence to the contrary I
would've taken it as an admission that you're either a troll or simply
too thickheaded to learn anything at all from us.

If you're not willing to read, there's no point in replying to you, and
if you're not willing to follow rules and behave like an adult, there's
no point in listening to you.  We're too busy anyway.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.


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

Date: 11 Apr 2001 08:00:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl Timer!
Message-Id: <9b12um$5l5$2@mamenchi.zrz.TU-Berlin.DE>

According to Gwyn Judd <tjla@guvfybir.qlaqaf.bet>:
> I was shocked! How could Abigail <abigail@foad.org>
> say such a terrible thing:
> >Chris Stith (mischief@velma.motion.net) wrote on MMDCCLXXIX September
> >MCMXCIII in <URL:news:td74urrcfuodd9@corp.supernews.com>:
> >:) Hernux <hernux@etherac.com.ar> wrote:
> >:) > Hi, is there a way to make a timer in perl???
> >:) 
> >:) > like settimeout function in javascript.......
> >:) 
> >:) I don't grok javascript. Ar eyou looking for time(), localtime(),
> >:) gmtime(), sleep(), alarm(), select(), POSIX::alarm(), POSIX::ctime(),
> >:) POSIX::difftime, POSIX::gmtime(), POSIX::localtime(), POSIX::mktime(),
> >:) or POSIX::pause()? Or perhaps Time::HiRes on CPAN?
> >
> >Perhaps he wanted Time::Local.
> 
> Or Benchmark::timethese()?

Don't we have a Multimedia module on CPAN?

Anno


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

Date: 11 Apr 2001 07:27:04 GMT
From: dcutter@gmx.de
Subject: Re: permanently change file name with regex
Message-Id: <9b1108$j06$1@news.netmar.com>

In article <9b00ba$gs3$1@newsg1.svr.pol.co.uk>, francesca
<plusc@freeserve.net> writes:
>I want to permanently change
>some file names using this regex
>
>$x =~ s/_/- /g;
>
>I can change and print result
>but dont know how to change the file names
>in a directory permanent..
>Ive looked at using rename  but not sure?
>
>Thanks

rename is ok, but U can also use nasty OPSYS dependent code:

`mv $old $new` || die "couldn't rename $old to $new\n";

Daniel

 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: 11 Apr 2001 07:54:01 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: permanently change file name with regex
Message-Id: <slrn9d83dn.nh4.rgarciasuarez@rafael.kazibao.net>

dcutter@gmx.de wrote in comp.lang.perl.misc:
> In article <9b00ba$gs3$1@newsg1.svr.pol.co.uk>, francesca
> <plusc@freeserve.net> writes:
> >I want to permanently change
> >some file names using this regex
> >
> >$x =~ s/_/- /g;
> >
> >I can change and print result
> >but dont know how to change the file names
> >in a directory permanent..
> >Ive looked at using rename  but not sure?
> 
> rename is ok, but U can also use nasty OPSYS dependent code:
> 
> `mv $old $new` || die "couldn't rename $old to $new\n";

This does not work.

Backticks return the output of the command (as described in perlop), NOT
an error status code (although they return undef if the command failed).

See also the FAQ : (perlfaq8)
  What's wrong with using backticks in a void context?

Moreover, $new seems to have embedded spaces (translated from '_' by the
substitute command given by the OP). This will confuse the shell spawned
by the backticks.

See "perldoc -f system" for a good alternative to backticks in this case.
(use the syntax: system 'mv',$old,$new).

Another note : most of the time, you should use rename() to rename
files. There's no need for the overhead of launching a different
process. Use this method only when you're falling into one of the
restrictions described in "perldoc -f rename".

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
use lib sub{$_=$_[1];y;_.mp; ,\n;d;print;
open+0;*0};use Just_another_Perl_hacker;1


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

Date: 11 Apr 2001 08:56:30 +0100
From: nobull@mail.com
Subject: Re: Private subroutine inside subroutine
Message-Id: <u9bsq3aj3q.fsf@wcl-l.bham.ac.uk>

brian@brie.com (Brian E. Lavender) writes:

> I created a private subroutine inside another subroutine.

Really?  Are you sure?  These don't exist as such in Perl5 but ISTR
they will in Perl6 ("my sub").  In Perl5 you can fake it using a
lexically scoped scalar holding a reference to an anonymous sub.

>  Rather than pass the variables to the private subroutine, I made
> them visible to the private subroutine using local. Is this good
> coding practice?

Your package variable work-round for the lack of private subroutines
in Perl5 is widely used but it is not the only option:

> sub outer (@) {
>     use vars qw($arg2);
>     my $arg1 = shift;
>     local $arg2 = shift;
>     
>     print "outer arg1: $arg1\n";
> 
>     _inner();
> 
>     sub _inner {
>         print "inner arg2: $arg2\n";
>     }
>   
> }

sub outer (@) {
     my $arg1 = shift;
     my $arg2 = shift;
     
     my $_inner = sub {
         print "inner arg2: $arg2\n";
     }

     print "outer arg1: $arg1\n";
 
     $_inner->();
}

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 11 Apr 2001 10:59:49 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: reference , 2-dimensional array (thanks Bart)
Message-Id: <3AD410E8.CE8EB7EF@home.nl>

thanks Bart,
it does just what i need

>
> This ought to be better:
>
>         while(my @fields = $sth->fetchrow_array){
>             push @list, \@fields;
>
>
> Unfortunately, fetchrow_arrayref returns the same reference every time
> (for speed reasons).
>
> --
>         Bart.



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

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


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