[18867] in Perl-Users-Digest
Perl-Users Digest, Issue: 1035 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 1 11:05:41 2001
Date: Fri, 1 Jun 2001 08:05:12 -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: <991407912-v10-i1035@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 1 Jun 2001 Volume: 10 Number: 1035
Today's topics:
[ANNOUNCE] XML::TokeParser 0.03 (Eric Bohlman)
ANNOUNCE: Barcode::Code128 version 2.0 (William R. Ward)
Api function to call up an input box in Perl <b.duffy@mvt.ie>
Re: Api function to call up an input box in Perl <pne-news-20010601@newton.digitalspace.net>
cpu temp monitors in win32::perflib (darrin)
Re: Fcntl usage? <m.grimshaw@salford.ac.uk>
Re: Getting Users' IP (Alan Barclay)
Re: Getting Users' IP <bart.lateur@skynet.be>
Halting a program? <muddycat@hotmail.com>
Re: Halting a program? <pne-news-20010601@newton.digitalspace.net>
Re: Halting a program? <muddycat@hotmail.com>
Re: Halting a program? <godzilla@stomp.stomp.tokyo>
Re: Halting a program? <alastairmurray@hotmail.com>
Re: How to walk dir structures (Abigail)
i dont understand Cookies <noemail@noemail.com>
Re: module for MS SQL (Rachel Coleman)
Re: module for MS SQL <bart.lateur@skynet.be>
Overriding builtin functions <simonmcc@nortelnetworks.com.nospam>
parsing an output of httpQ <daniel304@planet.nl>
Re: parsing an output of httpQ <godzilla@stomp.stomp.tokyo>
Re: Pattern matcher memory corruption? <goldbb2@earthlink.net>
Re: Perl script error during testing (Helgi Briem)
Re: Perl script error during testing <sloon@mindless.com>
Re: question about the UNIX commands in perl script <tschmelter@statesman.com>
Re: Rename .htm to .html (felan)
Re: Rename .htm to .html (Bernard El-Hagin)
Re: Rename .htm to .html (Bernard El-Hagin)
Re: Rename .htm to .html <juex@my-deja.com>
Seek and destroy ! - s/// problems (Matthew J. Salerno)
slides <tonio@punk-ass.co.uk>
UPDATE & for loop (bin)
using perflib (bob)
Re: Using Perl to keep track on internet usage? (darrin)
Re: Using Perl to keep track on internet usage? (Matthew J. Salerno)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Jun 2001 11:40:32 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: [ANNOUNCE] XML::TokeParser 0.03
Message-Id: <thf50hotm13a5b@corp.supernews.com>
Version 0.03 of XML::TokeParser has been uploaded to CPAN.
XML::TokeParser provides a "pull" interface to XML::Parser similar to the
one that HTML::TokeParser provides for HTML::Parser.
New features:
begin_saving() and restore_saved() methods allow you to "back up" within a
token stream.
unget_token() is now smart enough to properly handle "partial" tokens
returned by get_tag().
A couple bugs were also fixed.
------------------------------
Date: Thu, 31 May 2001 11:42:05 -0700 (PDT)
From: wrw@bayview.com (William R. Ward)
Subject: ANNOUNCE: Barcode::Code128 version 2.0
Message-Id: <thf50rmpks060@corp.supernews.com>
Barcode::Code128 - Generate CODE 128 bar codes
DESCRIPTION:
Barcode::Code128 generates bar codes using the CODE 128 symbology.
It can generate images in PNG or GIF format using the GD package,
or it can generate a text string representing the barcode that you
can render using some other technology if desired.
The intended use of this module is to create a web page with a bar
code on it, which can then be printed out and faxed or mailed to
someone who will scan the bar code. The application which spurred
its creation was an expense report tool, where the employee
submitting the report would print out the web page and staple the
receipts to it, and the Accounts Payable clerk would scan the bar
code to indicate that the receipts were received.
The default settings for this module produce a large image that
can safely be FAXed several times and still scanned easily. If
this requirement is not important you can generate smaller image
using optional parameters.
If you wish to generate images with this module you must also have
the GD.pm module (written by Lincoln Stein, and available from
CPAN) installed. Version 1.20 or higher of GD generates a PNG
file, due to issues with the GIF patent. If you want to create a
GIF, you must use version 1.19 or earlier of GD. However, most
browsers have no trouble with PNG files.
If the GD module is not present, you can still use the module, but
you will not be able to use its functions for generating images.
You can use the barcode() method to get a string of "#" and " "
(hash and space) characters, and use your own image-generating
routine with that as input.
To use the the GD module, you will need to install it along with
this module. You can obtain it from the CPAN (Comprehensive Perl
Archive Network) repository of your choice under the directory
"authors/id/LDS". Visit http://www.cpan.org/ for more information
about CPAN. The GD home page is:
http://stein.cshl.org/WWW/software/GD/GD.html
EXAMPLE:
use Barcode::Code128;
$object = new Barcode::Code128;
print "Content-Type: image/png\n\n";
$object->png('CODE 128');
AUTHOR: William R. Ward, wrw@bayview.com
TERMS: This module is placed into the public domain. You are free to
use, modify, or redistribute this module in any way for commercial
or other uses. My only request is that if you change it, please
submit copies of your changed code (or diffs) so that I can
incorporate them into the version on CPAN. Also, in order to
reduce the likelihood of confusion please do not distribute a
modified version of this module unless you change the name first.
HISTORY:
Version 2.0, 5/28/2001 - Generate either PNG or GIF, or neither,
depending on what version of GD is installed; lots of
optional parameters added; minor bug fixes
Version 1.11, 10/29/1999 - Fix bug in test script
Version 1.10, 10/26/1999 - Generate PNG instead of GIF files
Version 1.01, 7/19/1999 - Bug fix to deal with inputs ending in zero
Version 1.00, 3/8/1999 - Initial version.
--
William R Ward Bay View Consulting Services http://www.bayview.com/~wrw/
wrw@bayview.com 2860 Porter St PMB 408 phone +1 831/423-3295
PGP Key 0x2BD331E5 Soquel, CA 95073-2419 USA fax +1 831/423-6499
Public key at http://www.bayview.com/~wrw/pubkey.txt pager +1 831/458-8862
------------------------------
Date: Fri, 1 Jun 2001 13:57:01 +0100
From: "bernie" <b.duffy@mvt.ie>
Subject: Api function to call up an input box in Perl
Message-Id: <9f83bl$95r$1@kermit.esat.net>
I am wondering how to call an API function from Perl which will pop up an
input box and the value returned
to Perl.
Thanks
------------------------------
Date: Fri, 01 Jun 2001 16:07:04 +0200
From: Philip Newton <pne-news-20010601@newton.digitalspace.net>
Subject: Re: Api function to call up an input box in Perl
Message-Id: <ca8fhto1p6p7qpng5n11d91v2kb38a3nui@4ax.com>
On Fri, 1 Jun 2001 13:57:01 +0100, "bernie" <b.duffy@mvt.ie> wrote:
> I am wondering how to call an API function from Perl which will pop up an
> input box and the value returned to Perl.
This is system dependent in general, though if you use a GUI toolkit
such as Tk or Gtk, this may provide an appropriate function.
What system and/or GUI toolkit are you using?
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 1 Jun 2001 04:56:28 -0700
From: dthusma@balsasoft.com (darrin)
Subject: cpu temp monitors in win32::perflib
Message-Id: <525a9ea2.0106010356.480196ce@posting.google.com>
are there any metrics in perflib to get cpu temp? an example would
be great. I know how to get temp on linux/sun, but cannot seem to solve
it for win32.
All positive comments are welcome
------------------------------
Date: Fri, 01 Jun 2001 11:35:37 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: Fcntl usage?
Message-Id: <3B176FF9.950EA1D2@salford.ac.uk>
Hi,
Thanks for having patience with me....
> As you can see, neither -w or strict have any problems with this. I'm
> still wondering what your original problem is, if it isn't that the
> constants aren't defined...
>
> Could you submit some code that, for you, gives warnings, and/or
> errors?
1/
I have these snippets of code from a CGI package:
##############
use Fcntl;
if(!($lockuserdb = &q_tiedb(\%USER, $q_userdb, O_RDONLY, 0444)))
{
return $lockuserdb;
}
sub q_tiedb
{
my($D, $dbb, $modea, $modeb) = @_;
tie(%{$D}, DB_File, $dbb, $modea, $modeb) || return 0;
return &q_lock_files($dbb);
}
###############
q_lock_files simply returns the path/name of a temporary file I use for
locking purposes or 0 for failure (could've used flock but, in this
case, didn't).
The code above all works but fills my apache error log with the usual
warning about O_RDONLY being non-numeric etc.
In the parallel universe that is the other post I made about Fcntl after
cancelling this original post, the following was given as the solution
to the other code I was working on (and works without warnings):
2/
##########
That's done it - thanks! Now I get no complaints with:
use Fcntl;
if(!(%DB = $db->open_db('test.db', O_RDONLY)))[snip].......
# this is called from an external package
sub open_db
{
my $self = shift;
my @input = @_;
my %DB;
tie(%DB, 'DB_File', $input[0], $input[1]) || return 0;
return %DB;
}
Bart Lateur wrote:
>
> Mark Grimshaw wrote:
>
> >if(!(%DB = $db->open_db('test.db', "O_RDONLY")))
>
> Drop the quotes. O_RDONLY is a "constant", i.e. a sub. For example,
> O_RDONLY() should work
>
> --
> Bart.
###############
I've snipped a lot of code and collated code from different
scripts/packages in the interests of brevity (and, hopefully, clarity)
but the point that puzzles me is why the first snippet above should give
rise to warnings while the second, with what seems like the same usage
of O_RDONLY, doesn't.
More puzzling (to me) is why the following does NOT complain (it uses
the external package that has the subroutine q_tiedb no. 1/ above which,
as explained above, DOES complain about O_RDONLY when called from within
that package):
3/
#################
&open_user_db(O_RDONLY, 0444); # Read only
sub open_user_db
{
if(!($lockuserdb = &q_tiedb(\%USER, $q_userdb, $_[0], $_[1])))
{
[snip]
}
}
#################
Hoping you can make sense of what I've written.....
------------------------------
Date: 1 Jun 2001 11:21:31 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Getting Users' IP
Message-Id: <991394485.827891@elaine.furryape.com>
In article <1103_991306344@peterrei>,
Peter Reid <peter.reid2000@ntlworld.com> wrote:
>to store the IP address of everyone submitting entries to my guestbook.
>When it came to making a complaint to an ISP, they said I was recording
>the IP of their proxy
>server and not of the person who had abused my guestbook. They said I should use
This is really offtopic, but there is no way to know the address of
the client - the address of the proxy server is all you can get. The
client might not have an IP address, or it might be an IP address which
only makes sense within their private IP address space.
------------------------------
Date: Fri, 01 Jun 2001 14:12:00 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Getting Users' IP
Message-Id: <kn8fht496nouujp0tvfark07uojqrufhul@4ax.com>
Alan Barclay wrote:
>This is really offtopic, but there is no way to know the address of
>the client - the address of the proxy server is all you can get. The
>client might not have an IP address, or it might be an IP address which
>only makes sense within their private IP address space.
In the latter case, the IP of the proxy IS important.
--
Bart.
------------------------------
Date: Fri, 1 Jun 2001 14:54:20 +0100
From: "Muddy Cat" <muddycat@hotmail.com>
Subject: Halting a program?
Message-Id: <thf7ie76cucc96@corp.supernews.co.uk>
Could anyone help me out? I'm trying to write a PERL script (for a user
registration system) and I've sort of picked PERL up on the run. I think
this is a fairly basic thing I'm trying to do, but can't for the life of me
find it in my PERL reference book, or find the right words to look for it on
the net.
I've basically got some 'sub' blocks of code, (which I assume are the same
as functions that I might use in JavaScript?) which handle errors... e.g. if
the user tries to register with a name that already exists, and I want the
program to carry out the commands in that sub and then *stop*, rather than
returning to the list of sub calls that I have at the top. Is this possible?
Apologies if this is a lame question!
Many thanks for any wisdom. :)
------------------------------
Date: Fri, 01 Jun 2001 16:12:14 +0200
From: Philip Newton <pne-news-20010601@newton.digitalspace.net>
Subject: Re: Halting a program?
Message-Id: <dh8fht8jpgp99g9d9abugmi7sqh72tm8bh@4ax.com>
On Fri, 1 Jun 2001 14:54:20 +0100, "Muddy Cat" <muddycat@hotmail.com>
wrote:
> I'm trying to write a PERL script
There is no PERL; there is only Perl and perl (for the difference, see
the FAQ -- e.g. `perldoc -q difference` , but only the first "hit").
> I've basically got some 'sub' blocks of code, (which I assume are the same
> as functions that I might use in JavaScript?)
Yes.
> I want the program to carry out the commands in that sub and then *stop*,
> rather than returning to the list of sub calls that I have at the top.
> Is this possible?
Yes, for example with the 'exit' function. `perldoc -f exit` for a short
description of this function.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Fri, 1 Jun 2001 15:21:17 +0100
From: "Muddy Cat" <muddycat@hotmail.com>
Subject: Re: Halting a program?
Message-Id: <thf951abjek3aa@corp.supernews.co.uk>
Thanks Phillip, that worked perfectly. *So* simple! Thanks also for the
correction on PERL... I've often wondered about that one.
------------------------------
Date: Fri, 01 Jun 2001 07:22:51 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Halting a program?
Message-Id: <3B17A53B.351B586C@stomp.stomp.tokyo>
Muddy Cat wrote:
(snipped)
> Could anyone help me out?
___
| |
The exit door is over there ---> | |
| '|
|___|
Help yourself out.
> I want the program to carry out the commands in that sub and then *stop*
Have you considered one of the most fundamental functions
offered by Perl, exit?
Godzilla!
------------------------------
Date: Fri, 01 Jun 2001 14:29:16 GMT
From: "AlyM" <alastairmurray@hotmail.com>
Subject: Re: Halting a program?
Message-Id: <0FNR6.20514$zb7.2652184@news1.cableinet.net>
In article <thf7ie76cucc96@corp.supernews.co.uk>, "Muddy Cat"
<muddycat@hotmail.com> said:
<snip>
> Apologies if this is a lame question!
There are no lame questions, just lame people. Did you learn "PERL" from
a nice big book with "BECOME AN EXPERT PERL PROGRAMMER IN 23 SECONDS!!!"
on the front by any chance?
------------------------------
Date: Fri, 1 Jun 2001 14:28:34 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: How to walk dir structures
Message-Id: <slrn9hf9ki.eod.abigail@tsathoggua.rlyeh.net>
Fred Zimmerman (fredz@silversoftware.com) wrote on MMDCCCXXXI September
MCMXCIII in <URL:news:3b16b543.187516133@news.ne.mediaone.net>:
:) How can I use Perl to walk directories recursively
:) and query files for date/timestamp for copying to
:) a target directories.
You could use Perl to call rsync.
:) Sample code appreciated.
my $source = "/path/to/some/dir";
my $dest = "/path/to/other/dir";
system rsync => $source => $dest;
Abigail
--
perl -wle'print"Êõóô áîïôèåò Ðåòì Èáãëåò"^"\x80"x24'
------------------------------
Date: Fri, 01 Jun 2001 14:50:34 GMT
From: "Thing" <noemail@noemail.com>
Subject: i dont understand Cookies
Message-Id: <_YNR6.9479$S2.661022@newsread2.prod.itd.earthlink.net>
the concept is that you send a cookie to a client to save some stuff, then
you read it when you want. but there are paths and expirations and stuff, i
think i am getting confused.
-------this is login.pl------------
#!/perl/bin/perl.exe -w
use CGI qw/:standard/;
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$q = new CGI;
my $cookie = $q->cookie(-name => "something",
-value => "something",
-expires=> "+1d");
print $q->redirect (-url =>"http://dacyr/cgi-bin/loginresults.pl",-cookie =>
$cookie);
---------this is loginresults.pl---------
#!/perl/bin/perl.exe -w
use CGI qw/:standard/;
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$query = new CGI;
$answers = $query->cookie(-name=>'something');
print "Content-Type: text/html\n\n";
print "FAAAAAAAAAAAAAAAACKKCKCKKKKK";
print $answers;
i dont know what im doing, help me ?
------------------------------
Date: 1 Jun 2001 14:30:21 GMT
From: rachel@lspace.org (Rachel Coleman)
Subject: Re: module for MS SQL
Message-Id: <slrn9hf9nt.7lo.rachel@colon.hist.cam.ac.uk>
On Fri, 01 Jun 2001 09:00:31 GMT, rich <nospam@newsranger.com> wrote:
>I usually use the MySQL database along with the module, DBI::MYSQL. For one
>reason or another I have to use Microsofts SQL server now. Could anybody
>recommend the best module for connecting to this database?
I expect you actually use DBI and DBD::mysql. Unless your code uses
MySQL-specific things, all you should need to change is the DBD file for
one that can talk to SQLServer. Here is how to help yourself next time:
http://www.cpan.org
Select 'Perl core and CPAN modules documentation'
Either search for SQLServer
Or select 'Database Interfaces' (listed under 'CPAN Categories'), and then
'DBD' and look at the list of modules.
Either way you should find
DBD-FreeTDS-0.02 : FreeTDS SQLServer and Sybase database driver for the
DBI module
Read the documentation and establish if it will do what you need.
Best wishes,
Rachel
------------------------------
Date: Fri, 01 Jun 2001 14:40:39 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: module for MS SQL
Message-Id: <1eafht07tafqnugbh92jhf9tto3pdfgdal@4ax.com>
rich wrote:
>I usually use the MySQL database along with the module, DBI::MYSQL. For one
>reason or another I have to use Microsofts SQL server now. Could anybody
>recommend the best module for connecting to this database?
DBD::ODBC
--
Bart.
------------------------------
Date: Fri, 1 Jun 2001 14:32:06 +0100
From: "Simon McCaughey" <simonmcc@nortelnetworks.com.nospam>
Subject: Overriding builtin functions
Message-Id: <9f85cj$5ke$1@bmerhc5e.ca.nortel.com>
My problem is in unit-testing modules, I want to stub out all external
function calls, so for example I want the function time() to always return
991401617 (for example)
So having read cookbook, and camel it seems the best way to redefine a
function *globally* is to do :
*CORE::GLOBAL::time = sub {
return 991401617;
}
and this works.
Is it possible to do this from inside a sub, as I cant seem to get that
working??
Thanks
Simon.
------------------------------
Date: Fri, 1 Jun 2001 15:54:11 +0200
From: "Daniel van den Oord" <daniel304@planet.nl>
Subject: parsing an output of httpQ
Message-Id: <9f86l7$7motj$1@reader02.wxs.nl>
I'm making a script that can control winamp with the httpQ plugin..
You can call for output like this
http://Your.server.ip:port/getplaylisttitle?p=password
The output is simply
Artist-title song<br>Artist-title song<br>Artist-title song<br>Artist-title
song<br>Artist-title song<br>Artist-title song<br>
I want to be able to parse this into an useable array
is this possible ?!?
Thanks in advance !!!
p.s. trying to make a web-based-winamp
------------------------------
Date: Fri, 01 Jun 2001 07:33:45 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: parsing an output of httpQ
Message-Id: <3B17A7C9.F7AAD2B7@stomp.stomp.tokyo>
Daniel van den Oord wrote:
(snipped)
> Artist-title song<br>Artist-title song<br>Artist-title song<br>Artist-title
> song<br>Artist-title song<br>Artist-title song<br>
> I want to be able to parse this into an useable array
> is this possible ?!?
You will do yourself a greater service by reading about
and researching arrays along with how arrays can be
created, rather than coming here to ask. This basic
nature of your question indicates you really need
to do your homework.
Godzilla!
------------------------------
Date: Fri, 01 Jun 2001 10:22:54 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Pattern matcher memory corruption?
Message-Id: <3B17A53E.43875517@earthlink.net>
John Bower wrote:
>
> Briefly, I get incorrect pattern match behavior when processing very large text
> files. The same code seems to work flawlessly on the same records in smaller
> files. Strangely, if I wrap the code in an eval, it works fine.
>
> I am wondering if I could be experiencing some memory corruption within
> Perl's pattern matching routines after processing several hundred thousand
> records? I thought perhaps the eval caused the interpreter to create a new
> pattern match object with an untainted memory space. For the curious, details
> and code excerpts are below...
>
> Thanks!
>
> --------
> John A. Bower Chemical Abstract Services
> Dept. 42 Database Quality Engineering 2540 Olentangy River Road
> x2703 Columbus, OH 43210-0012
> jbower@cas.org (614) 447-3600
> --------
>
> I had written a placeholder for a function which was to accept a reference to
> an array of strings, a reference to a search string, and was to return true
> or false depending on whether the first string in the referenced array
> contained the search string. I eventually filled in the placeholder with the
> following lines:
>
>
> ################################################################################
> # This subroutine accepts an array ref to CN names. It returns TRUE if the #
> # first (NT1) name was a "hit". In order to do this, the routine is passed #
> # a second argument, which is a ref to the search string. #
>
> ################################################################################
> sub NT1Hit {
> my $cnRef = shift;
> my $searchRef = shift;
> my $pattern = makePattern($$searchRef);
> my $nt1 = $cnRef->[0];
> if ($nt1 =~ m/$pattern/i) {
Considering what makePattern does, it might be better to use \Q to quote the string.
if( $cnRef->[0] =~ m/\Q$$searchRef/i ) {
Or considering that all you're doing is a case-insensitive search for a substring,
and *not* doing anything which really needs regular expression matching...
if( index(lc($cnRef->[0]),lc($$searchRef)) < 0 ) {
I would do some benchmarks to see which is faster. Also, there's no reason not to
move lc on the search pattern to outside of the sub, to avoid having it done again
and again.
> return 1;
> } else {
> if ($debug) {
> print STDERR " NT1 did NOT hit ($pattern): $cnRef->[0]\n";
> }
> }
> return 0;
> }
>
>
> ################################################################################
> # This subroutine escapes characters that have special significance in Perl #
> # patterns. #
>
> ################################################################################
> sub makePattern {
> my $string = $_[0];
> $string =~ s/([\-,\/()\[\]?\.\*\+])/\\\1/og;
> return $string;
> }
Is your computer's quotemeta function broken?
>
> The routines work fine with sample data sets of 10,000 records, but start
> misbehaving in the midst of processing larger datasets of 600,000 and up.
> For example, I get lines like this in the debugging output:
>
> ----------------------------------------
> search results for 144940-98-7 NT1: Guanylin
> NT1 did NOT hit (Guanylin): 3-86-Uroguanylin, pro- [3-methionine] (human clone pHUG31)
> NT1 did NOT hit (Guanylin): 2-86-Uroguanylin, pro- [2-methionine] (human clone pHUG31)
> ----------------------------------------
>
> when clearly "Guanylin" is a substring in both of those strings if you
> ignore case. Curiously, these errors do not occur when the same record is
> placed in a smaller file.
Pretty peculiar. Maybe it's ignoring the case-insensitivity?
> The following work-around fixes the problem, but
> it makes me nervous as I do not know WHY:
[snip]
> my $code = "if (\$nt1 =~ m/$pattern/i) { \$nt1Match = 1;}";
> eval($code);
> if ($nt1Match) {
[snip]
> Could I be experiencing some memory corruption within Perl's pattern
> matching routines? I know very little of the internals of Perl...
What version of perl are you using?
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Fri, 01 Jun 2001 11:36:03 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Perl script error during testing
Message-Id: <3b177d98.183140943@news.isholf.is>
On Thu, 31 May 2001 12:49:17 GMT, sloon <sloon@mindless.com>
wrote:
>I'm an adult, and an intelligent one, and I find your comments
>childish and rude.
Well, you certainly give a picture perfect impression of
a rude, obnoxious, spoiled 14 year old script kiddie.
I think you're impersonating an intelligent adult. You're
not doing it very well though.
Helgi Briem
------------------------------
Date: Fri, 01 Jun 2001 14:19:31 GMT
From: sloon <sloon@mindless.com>
Subject: Re: Perl script error during testing
Message-Id: <619fht8ann0egkgeg8sdh4uduf779fvj8j@4ax.com>
I assume that you are under the impression that you sound like an
adult?
I particularly like your comment about "not banging my ass on the way
out the door".
Very mature...
On Fri, 01 Jun 2001 11:36:03 GMT, helgi@NOSPAMdecode.is (Helgi Briem)
wrote:
>On Thu, 31 May 2001 12:49:17 GMT, sloon <sloon@mindless.com>
>wrote:
>
>>I'm an adult, and an intelligent one, and I find your comments
>>childish and rude.
>
>Well, you certainly give a picture perfect impression of
>a rude, obnoxious, spoiled 14 year old script kiddie.
>
>I think you're impersonating an intelligent adult. You're
>not doing it very well though.
>
>Helgi Briem
------------------------------
Date: Fri, 01 Jun 2001 13:13:14 GMT
From: Tim Schmelter <tschmelter@statesman.com>
Subject: Re: question about the UNIX commands in perl script
Message-Id: <3B1794E8.7995D143@statesman.com>
"John W. Krahn" wrote:
<SNIP>
> $ perl -wpe "BEGIN{print'the result = '}$_=(split' ')[3]" ping*
> Unquoted string "ping" may clash with future reserved word at -e line 1.
> Can't modify constant item in multiplication at -e line 1, at EOF
> Execution of -e aborted due to compilation errors.
> the result =
<SNIP>
Well, you'll need to quote as appropriate for your system, of course.
perldoc perlrun
--
Tim Schmelter
------------------------------
Date: Fri, 01 Jun 2001 10:22:56 GMT
From: felan_66@hotmail.com (felan)
Subject: Re: Rename .htm to .html
Message-Id: <3b176c9e.168740134@news.uio.no>
On Fri, 1 Jun 2001 09:13:32 +0000 (UTC),
bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>On Fri, 01 Jun 2001 09:06:38 GMT, felan <felan_66@hotmail.com> wrote:
>>On Fri, 1 Jun 2001 08:58:13 +0000 (UTC),
>>bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>>
>>>On Fri, 01 Jun 2001 08:48:35 GMT, felan <felan_66@hotmail.com> wrote:
>>>>Can any one show me a command i unix or a program i perl which
>>>>converts all the .htm extension in a given directory to .html
>>>>extensions?
>>>
<....>
Does anyone know why this doesn't work
(it should rename all the .html files to .htm files in a given
directory)
foreach $file (<*.html>) {
rename (<*.html>, <*.htm>)
}
------------------------------
Date: Fri, 1 Jun 2001 10:34:09 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Rename .htm to .html
Message-Id: <slrn9her8c.com.bernard.el-hagin@gdndev25.lido-tech>
On Fri, 01 Jun 2001 10:22:56 GMT, felan <felan_66@hotmail.com> wrote:
>On Fri, 1 Jun 2001 09:13:32 +0000 (UTC),
>bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>
>>On Fri, 01 Jun 2001 09:06:38 GMT, felan <felan_66@hotmail.com> wrote:
>>>On Fri, 1 Jun 2001 08:58:13 +0000 (UTC),
>>>bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>>>
>>>>On Fri, 01 Jun 2001 08:48:35 GMT, felan <felan_66@hotmail.com> wrote:
>>>>>Can any one show me a command i unix or a program i perl which
>>>>>converts all the .htm extension in a given directory to .html
>>>>>extensions?
>>>>
><....>
>
>Does anyone know why this doesn't work
>(it should rename all the .html files to .htm files in a given
>directory)
>
>foreach $file (<*.html>) {
> rename (<*.html>, <*.htm>)
>}
Where are you using $file in that loop? And do you know what
<*.html> does?
foreach my $file (<*.html>){
$file =~ /(.*)\.html$/;
rename ($file, $1 . 'htm');
}
Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print print;'
------------------------------
Date: Fri, 1 Jun 2001 10:39:38 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Rename .htm to .html
Message-Id: <slrn9herii.com.bernard.el-hagin@gdndev25.lido-tech>
On Fri, 1 Jun 2001 10:34:09 +0000 (UTC), Bernard El-Hagin
<bernard.el-hagin@lido-tech.net> wrote:
>On Fri, 01 Jun 2001 10:22:56 GMT, felan <felan_66@hotmail.com> wrote:
>>On Fri, 1 Jun 2001 09:13:32 +0000 (UTC),
>>bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>>
>>>On Fri, 01 Jun 2001 09:06:38 GMT, felan <felan_66@hotmail.com> wrote:
>>>>On Fri, 1 Jun 2001 08:58:13 +0000 (UTC),
>>>>bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>>>>
>>>>>On Fri, 01 Jun 2001 08:48:35 GMT, felan <felan_66@hotmail.com> wrote:
>>>>>>Can any one show me a command i unix or a program i perl which
>>>>>>converts all the .htm extension in a given directory to .html
>>>>>>extensions?
>>>>>
>><....>
>>
>>Does anyone know why this doesn't work
>>(it should rename all the .html files to .htm files in a given
>>directory)
>>
>>foreach $file (<*.html>) {
>> rename (<*.html>, <*.htm>)
>>}
>
>Where are you using $file in that loop? And do you know what
><*.html> does?
>
>foreach my $file (<*.html>){
> $file =~ /(.*)\.html$/;
> rename ($file, $1 . 'htm');
>}
Mental note - stop posting silly code and following-up own posts.
foreach my $file (<*.html>){
$file =~ /(.*).$/;
rename ($file, $1);
}
Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print print;'
------------------------------
Date: Fri, 1 Jun 2001 07:39:59 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: Rename .htm to .html
Message-Id: <3b17a932@news.microsoft.com>
"felan" <felan_66@hotmail.com> wrote in message
news:3b176c9e.168740134@news.uio.no...
> Does anyone know why this doesn't work
> (it should rename all the .html files to .htm files in a given
> directory)
>
> foreach $file (<*.html>) {
> rename (<*.html>, <*.htm>)
> }
Let's see:
Assuming you have three file a.html, b.html, and c.html and two files x.htm
and y.htm.
Then the rename comand above will be
rename (('a.html', 'b.html', 'c.html') , ('x.htm', 'y.htm'))
I doubt that is what you want.
jue
------------------------------
Date: 1 Jun 2001 07:56:35 -0700
From: msalerno@my-deja.com (Matthew J. Salerno)
Subject: Seek and destroy ! - s/// problems
Message-Id: <6622f4b.0106010656.6985fe33@posting.google.com>
Hi all, I am having a problem. I am writing a script that will remove
the "the" from the beginning of any txt file and will convert all
spaces to underscores "_". There are other things it has to do, but
the main problem I am having is that I cannot get the "the" in the
beginning of the filename removed. I looked at the perlop and it
recommends using something like "s/\bfoo\b/bar/g;" but it replaces the
entire string to a 1 or 2. Please assist.
Thanks,
Matt
#!/usr/local/bin/perl -w
use strict;
use File::Find;
my $outpt;
my $path = "/foo/bar/";
my $logpath = "/foo/bar/changelog";
my @files;
find sub { push @files, $File::Find::name if /\.txt\z/i && -f; },
"$path";
open(LOGFILE, ">$logpath");
foreach (@files){
my $i = 0;
my @filepath = split ("/" , $_);
my $filename = $filepath[$#filepath];
#$filename =~ tr/^"the"//d;
#$filename = s/the/ /;
$filename =~ tr/ /_/;
$filepath[$#filepath] = $filename;
my $finalnm = join("/", @filepath);
if ( $_ ne $finalnm){
$outpt = "Renaming $_ to $finalnm\n";
$i++;
}
else {
$outpt = "No Change - $_\n";
}
print $outpt;
print LOGFILE $outpt;
#rename $_, $finalnm if $i > 0;
}
close LOGFILE;
------------------------------
Date: Fri, 01 Jun 2001 14:31:05 +0200
From: antoine <tonio@punk-ass.co.uk>
Subject: slides
Message-Id: <3B178B09.73C97E7C@punk-ass.co.uk>
Hi,
I've just been informed that I'll have to give a 5 days Perl tutorial
starting on monday and I have no time to prepare slides. Does anyone
know where I could get some slides for this?
Thanks
------------------------------
Date: 1 Jun 2001 06:32:19 -0700
From: givemeonly@hotmail.com (bin)
Subject: UPDATE & for loop
Message-Id: <ac020fec.0106010532.350cdf27@posting.google.com>
I have a problem with updating values in a mysql database. When I
execute the perl script the it will only update the last value in the
for loop into the database (everything else in the script works fine
except for the update bit..)
First it gets values out of the database and then it creates values in
a loop which it has to insert into a different table.
while (@rows = $sth5->fetchrow_array){
my $periodid = $rows[0];
my @park = $rows[1];
if ($park[0] eq '') {
my $sql3 = "UPDATE temp_period SET start_park='NULL' WHERE period_id =
'$periodid'";
my $sth3 = $dbh->prepare($sql3);
$sth3->execute or die "error in sql" . $dbh->errstr;
next;
}
&firstday(@park);
&lastday();
for (my $i = &firstday(@park); $i <= &lastday(); $i += 604800){
my $old_park_date = localtime($i);
my $parkdate = UnixDate(($old_park_date), "%Y-%m-%d");
my $sql4 = "UPDATE temp_period SET start_park='$parkdate' WHERE
period_id = '$periodid'";
my $sth4 = $dbh->prepare($sql4);
$sth4->execute or die "error in sql" .$dbh->errstr;
}
}# End loop;
Any help will be greatly appreciated.
Kim
------------------------------
Date: 1 Jun 2001 06:48:38 -0700
From: s1ider@phreaker.net (bob)
Subject: using perflib
Message-Id: <2ccba88b.0106010548.67ca80da@posting.google.com>
Is there a way of using perflib (or anything else for that matter) to
access the cpu/internal tempurature? Thanks.
Bob
------------------------------
Date: 1 Jun 2001 05:22:47 -0700
From: dthusma@balsasoft.com (darrin)
Subject: Re: Using Perl to keep track on internet usage?
Message-Id: <525a9ea2.0106010422.25001505@posting.google.com>
"Ed" <spis@worldnet.att.net> wrote in message news:<W4ER6.55816$t12.4463151@bgtnsc05-news.ops.worldnet.att.net>...
> Hello group,
>
> Have been using Perl for a short while and have be asked to something I
> really am not sure where to start. My boss want to keep track of what files
> are being viewed on each PC (approx 8 PC (Win98)) on each account. Is there
> an easy way to make a program run when the puter is turned on, perferable
> without anyone knowing it is running. I thought about automatically copying
> the temp and history files but this does not seem to be a great idea.
>
> Any ideas would be appreciated.
>
> Ed
I have developed an app (in Perl, of course) called LogViewer (0
points for originality there). It lends itself well to this task.
The article is in the March 2000 issue of SysAdm. Being you prob dont
have that issue on hand, my site http://balsasoft/com has a older
overview under products - logviewer or ESM.
In essence, here is how it works.
Prelude:
You configure what logs to monitor on which systems (ie: weblogs on
all pcs)
You configure the automatic alarms, which use regexp to alarm in real
time when certain syntax occurs.
Instance starting:
You start the master Obelisk, or central server. This is the system
that allows you to view logs from many systems at once via a central
interface. In essence, its a network/db server.
On each PC (client), start the aux code. This code automatically
starts 'tailing' those specified files. new lines are both monitored
for alarms and automatically sent (in real time) to the master
Obelisk.
User Gui.
Go to the webpage to see this. It allows you to view upto 6 logs in
real-time from any combo of machines. Switching to different logs is
no problem.
----------------------------------------
Requirements:
If you don't want the compiled version,
perl, perl Tk and (older perl) libnet.pm
The code fits on a single floppy.
If you just want to use it on a few systems and don't expect four
start service, don't worry about cost, just ask and I'll send it.
Works on anything* perl does.
PS Also, look at my customerize app. It uses graphviz to build
directed graphs of user click streams.
------------------------------
Date: 1 Jun 2001 06:20:50 -0700
From: msalerno@my-deja.com (Matthew J. Salerno)
Subject: Re: Using Perl to keep track on internet usage?
Message-Id: <6622f4b.0106010520.47f1bd14@posting.google.com>
"Ed" <spis@worldnet.att.net> wrote in message news:<W4ER6.55816$t12.4463151@bgtnsc05-news.ops.worldnet.att.net>...
> Hello group,
>
> Have been using Perl for a short while and have be asked to something I
> really am not sure where to start. My boss want to keep track of what files
> are being viewed on each PC (approx 8 PC (Win98)) on each account. Is there
> an easy way to make a program run when the puter is turned on, perferable
> without anyone knowing it is running. I thought about automatically copying
> the temp and history files but this does not seem to be a great idea.
>
> Any ideas would be appreciated.
>
> Ed
What about a proxy ? Just about all proxy servers will allow you to
log all requests. I realize that this is not a perl solution, but it
is a viable one.
Matt
------------------------------
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 1035
***************************************