[23897] in Perl-Users-Digest
Perl-Users Digest, Issue: 6099 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 9 11:05:43 2004
Date: Mon, 9 Feb 2004 08:05:08 -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, 9 Feb 2004 Volume: 10 Number: 6099
Today's topics:
[WWW::Mechanize] how to 'click' on javascript:next(1) <grzegorzof@interia.pl>
ANNOUNCE: Data::TreeDumper version 0.12 (Nadim)
ANNOUNCE: Inline::Java 0.46 released! (Patrick LeBoutillier)
Announce: PerlPointCD 3.00 - a conference CD toolkit <perl@jochen-stenzel.de>
ANNOUNCE: Spreadsheet::Perl 0.06 (Nadim)
ANNOUNCE: Spreadsheet::TieExcel <simonecesano@libero.it>
Re: Array size <tadmc@augustmail.com>
Authen::Users 0.02 released <wherrera@lynxview.com>
Re: CGI.pm & multipart <gnari@simnet.is>
Re: Does anybody know... <tadmc@augustmail.com>
Re: Does anybody know... (Ondra)
Getting the return code of a program opened as a pipe <noel.sant@ntlworld.com>
Re: glob in perl <usenet@morrow.me.uk>
Re: glob in perl <tadmc@augustmail.com>
Re: glob in perl <xx087@freenet.carleton.ca>
Re: glob in perl <andreas@andiboehm.de>
Re: IO::Socket::INET Problem <notpublic@restricted.com>
Re: IO::Socket::INET Problem <notpublic@restricted.com>
Re: IO::Socket::INET Problem <usenet@morrow.me.uk>
Re: need help with this little perl script <usenet@morrow.me.uk>
Re: Perl project update <bik.mido@tiscalinet.it>
Re: Perl project update <tadmc@augustmail.com>
Re: Perl project update <usenet@morrow.me.uk>
Re: script working like daemon <usenet@morrow.me.uk>
Re: Shared variables along threads <usenet@morrow.me.uk>
Re: Shared variables along threads <jengelh@linux01.gwdg.de>
Re: Shared variables along threads <usenet@morrow.me.uk>
Re: substitution fails for long line <tadmc@augustmail.com>
Why is Perl losing ground? <roqetman@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 9 Feb 2004 15:53:16 +0100
From: "Grzegorz Goryszewski" <grzegorzof@interia.pl>
Subject: [WWW::Mechanize] how to 'click' on javascript:next(1)
Message-Id: <c086k7$91c$1@atlantis.news.tpi.pl>
Hello,
with WWW::Mechanize I want to simulate click on link defined via Javascript,
my perl code looks like:
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize ;
my $w = WWW::Mechanize->new;
$w->get("http://somepage"); #sorry cant uncover that
$w->success or die "Nie moge zaladowac strony :(!";
my @flinks = $w->find_all_links( url_regex => qr/next/i )
or die "nie znalazlem linka\n";
my ( $url, $title ) = @{$flinks[0]};
print $url , "\n";
$w->get( $url );
^^^^^^^^^^^^^^^^^^^^
I'm getting this error : Can't locate object method "host" via package
"URI::_foreign"
My code shows "JavaScript:next(1)" as a link. The point is I don't know how
to follow it.
That page generates 50 records at once, and user have to click 'next' in
order to get next 50 and so on.
Basically I want to 'click' on next link as long as its presented on page
and every time get page content.
Regards.
Grzegorz
------------------------------
Date: Mon, 9 Feb 2004 12:38:31 GMT
From: nadim@khemir.net (Nadim)
Subject: ANNOUNCE: Data::TreeDumper version 0.12
Message-Id: <HstLp6.1AEM@zorch.sf-bay.org>
The pure Perl module Data::TreeDumper version 0.12 is available
immediately from CPAN.
On-line docs: http://search.cpan.org/~nkh/
here's an example output:
title:
|- A [H1]
| |- a [H2]
| |- bbbbbb = CODE(0x8139fa0) [C3]
| |- c123 [C4 -> C3]
| `- d [R5]
| `- REF(0x8139fb8) [R5 -> C3]
|- ARRAY [A6]
| |- 0 [S7] = elment_1
| |- 1 [S8] = element_2
| `- 2 [S9] = element_3
`- C [H10]
`- b [H11]
`- a [H12]
|- a [H13]
|- b = CODE(0x81ab130) [C14]
`- c [S15] = 42
Powerful filters, ANSI (including color) support, compact easy to follow format.
Enjoy.
Cheers, Nadim.
------------------------------
Date: Fri, 6 Feb 2004 23:08:45 GMT
From: patrick_leboutillier@hotmail.com (Patrick LeBoutillier)
Subject: ANNOUNCE: Inline::Java 0.46 released!
Message-Id: <HstLn2.1wwp@zorch.sf-bay.org>
Get it from CPAN.
Inline::Java version 0.46 is a minor upgrade that includes:
+ Fixed Natives.xs to work with ExtUtils::ParseXS
Patrick
===========================================
INTRODUCTION:
Inline::Java - Write Perl classes in Java.
Inline::Java lets you write Perl classes in Java.
Example:
use Inline Java => <<'END';
class JAxH {
public JAxH(String x){
System.out.println("Just Another " + x + " Hacker") ;
}
}
END
new JAxH('Inline') ;
When run, this complete program prints:
Just Another Inline Hacker
------------------------------
Date: Sat, 7 Feb 2004 11:08:17 GMT
From: Jochen Stenzel <perl@jochen-stenzel.de>
Subject: Announce: PerlPointCD 3.00 - a conference CD toolkit
Message-Id: <HstLnJ.1EJo@zorch.sf-bay.org>
PerlPointCD is a tool to compose and maintain conference CDs, as well
as to build websites presenting conference materials. Initially
written and used to produce the CDs of the German Perl Workshop
(www.perlworkshop.de), it now was generalized to be of common use.
To make it easy to start with, to demonstrate how things work, and to
show how results can look like, the manual is included as a "demo CD"
with sources, building environment and results.
Version 3.00 can be found at http://sourceforge.net/projects/perlpoint .
Feature list from the README file:
* produces HTML user interfaces to browse,
* one or more template based layouts,
* layouts can provide CSS, Java, JavaScript and/or frames for
navigation,
* directory based approach makes it easy to organize talks within
the cd structure,
* automatic conversion between long and (ISO file system and
web address compliant) short directory names,
* convenient interface: makefile with certain targets,
* ready for teamwork: parts can be prepared by different team
members (and speakers) and easily integrated,
* easy and transparent integration of speaker materials,
* archive feature to integrate previous conferences,
* related talks (of current year and archives) are linked
automatically,
* source files can be written in PerlPoint or POD, further formats
can be added by own source filters in Perl,
* automatic links for CPAN modules,
* module index added automatically,
* author index added automatically,
* index page generated automatically,
* generic texts produced in configurable languages,
* powerful set of predefined PerlPoint macros ready to use,
* integrates validation links into prerelease pages,
* logging check mode for automatic preproductions to find
errors in integrated materials,
* supports browser navigation bars
* ... and more
------------------------------
Date: Mon, 9 Feb 2004 12:33:40 GMT
From: nadim@khemir.net (Nadim)
Subject: ANNOUNCE: Spreadsheet::Perl 0.06
Message-Id: <HstLoq.1EnB@zorch.sf-bay.org>
The pure Perl module Spreadsheet::Perl version 0.06 is available
immediately from CPAN.
On-line docs: http://search.cpan.org/~nkh/
This (fun) project could use some help.
Cheers, Nadim.
------------------------------
Date: Sun, 8 Feb 2004 10:17:06 GMT
From: simone cesano <simonecesano@libero.it>
Subject: ANNOUNCE: Spreadsheet::TieExcel
Message-Id: <HstLoC.1ABt@zorch.sf-bay.org>
Use Excel spreadsheets transparently like filehandles, arrays, hashes
or scalars.
Available at http://search.cpan.org/~scesano/Spreadsheet-TieExcel-0.73/
Regards,
Simone Cesano
------------------------------
Date: Mon, 9 Feb 2004 08:01:57 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Array size
Message-Id: <slrnc2f4ml.2vh.tadmc@magna.augustmail.com>
David Dyer-Bennet <dd-b@dd-b.net> wrote:
> I know $#foo is the max subscript of @foo.
>
> What's the max subscript of $f = [5, 4, 5, 4, 9]? (Yeah, I know, it's
> 4).
>
> That is, if I have an array ref, how do I get the max subscript of
> that array, without copying the whole thing to a temporary array?
Apply "Use Rule 1" from perlreftut.pod:
my $last_i = $#foo; # pretend it is a plain array
my $last_i = $#{ }; # replace the array _name_ with a block...
my $last_i = $#{ $f }; # that returns a reference to an array
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 7 Feb 2004 15:29:34 GMT
From: Bill <wherrera@lynxview.com>
Subject: Authen::Users 0.02 released
Message-Id: <HstLnv.1EM8@zorch.sf-bay.org>
Authen::Users, an authentication package written in Perl and using
SQLite or MySQL, has been uploaded to CPAN.
NAME
Authen::Users
DESCRIPTION
General password authentication using DBI-capable databases. Currently
supports
MySQL and SQLite databases.
Default is to use a SQLite database to store and access user information.
This module is not an authentication protocol. For that see something
such as Authen::AuthenDBI.
SYNOPSIS
use Authen::Users qw(:SQLite);
my $authen = new Athen::Users(dbtype => 'SQLite', dbname => 'mydbname');
my $a_ok = $authen->authenticate($group, $user, $password);
my $result = $authen->add_user(
$group, $user, $password, $fullname, $email, $question, $answer);
------------------------------
Date: Mon, 9 Feb 2004 13:56:22 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: CGI.pm & multipart
Message-Id: <c083gc$uk$1@news.simnet.is>
"chatiman" <chatiman@free.fr> wrote in message
news:402758f7$0$28746$626a14ce@news.free.fr...
> CGI.pm stops at initialisation with the error:
> Malformed multipart POST: data truncated
>
> What's wrong ?
my guess is that, due to malformed multipart POST,
data was truncated and CGI stopped.
seriously, we may need more info here, like:
what did you do?
did you look at the HTML that generated the POST?
did you make a minimal program that still makes this happen?
does a normal POST do this?
...
gnari
------------------------------
Date: Mon, 9 Feb 2004 07:44:46 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Does anybody know...
Message-Id: <slrnc2f3me.2vh.tadmc@magna.augustmail.com>
Ondra <neufingero@quick.cz> wrote:
> Subject: Does anybody know...
Please put the subject of your article in the Subject of your article.
> does anybody know what is this:
>
> my $tag
> $line =~ /<(\S+)[^>]*?>/;
> $tag = $1 || ""; /*****exactly this***/
I know what it is *not*. It is not Perl code, it has syntax errors.
It is a bug, you should never use the dollar-digit variables unless
you have first ensured that the match *succeeded*.
It is a bug since it tries to parse HTML with pattern matching
rather than with a real HTML parser. There are a bunch of examples
in the Perl FAQ of legal HTML that will break it...
The non-greediness serves no purpose, it is not needed.
It could be replaced with this:
my $tag = '';
$tag = $1 if $line =~ /<(\S+)[^>]*>/;
The
$tag = $1 || "";
is a common idiom for selecting a default value.
Note that it will do the wrong thing if the data contains "<0>"...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 Feb 2004 07:06:27 -0800
From: neufingero@quick.cz (Ondra)
Subject: Re: Does anybody know...
Message-Id: <9dd8be90.0402090706.4eccb3a0@posting.google.com>
Bernard El-Hagin <bernard.el-haginDODGE_THIS@lido-tech.net> wrote in message news:<slrnc2et42.jh.bernard.el-haginDODGE_THIS@gdndev25.lido-tech>...
> On 2004-02-09, Peter Hickman <peter@semantico.com> wrote:
> > Ondra wrote:
> >> Hello,
> >> does anybody know what is this:
> >>
> >> my $tag
> >> $line =~ /<(\S+)[^>]*?>/;
> >> $tag = $1 || ""; /*****exactly this***/
> >
> > Looks like a regex to match htlp tags and extract the body of the tag.
>
>
> That doesn't answer the OP's question.
>
>
> $tag = $1 || "";
>
>
> means "set $tag to the value of $1 if the value of $1 is true, otherwise
> set $tag to the empty string".
Yes that's it. Thank you
------------------------------
Date: Mon, 9 Feb 2004 15:28:46 -0000
From: "Noel Sant" <noel.sant@ntlworld.com>
Subject: Getting the return code of a program opened as a pipe
Message-Id: <PGNVb.55$Pe4.5@newsfep1-gui.server.ntli.net>
Hi! Can anyone help, please?
I'm using AciveState's "perl v5.8.0 built for MSWin32-x86-multi-thread"
(from a "perl -v" command), on Windows 2000. I want to use WZZIP (WinZip's
command line utility) to back up some data files. I'm using its -i option to
pick up files that have the archive attribute set, and the -rp option to
recurse into subfolders. I want to keep WZZIP's messages, but after the
first backup, they are mainly the names of folders, which aren't interesting
(to me). So I thought I'd open WZZIP as a pipe and read in its output,
filter out any lines ending with a (forward or back) slash, and print them
out again. I'd also like to print out its return code.
The following program snippet does whar I want, except for the return code.
When I just used the perl system function, it was fine, of course, but
something in the camel book (p. 342) made me think I might get it when
closing the pipe. Perhaps that's only in Unix systems. All I get is "1",
whereas WZZIP gives "0" if OK.
(The program would look prettier if I could use a non-proportional font, but
my Outlook Express News reader only seems to allow that if I use HTML, but I
wasn't sure if that was OK in this news group.)
=====================
# my $rc = system($command);
open ZIP_OUTPUT, "$command |"
or die "Error openng WZZIP output pipe etc."\n";
while (<ZIP_OUTPUT>) {
chomp;
s/\s+$//; # trim blanks right
next if /\\$/;
next if /\/$/;
print MESSAGES $_ . "\n";
}
my $rc = close ZIP_OUTPUT;
=====================
TIA,
Noel
------------------------------
Date: Mon, 9 Feb 2004 14:34:53 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: glob in perl
Message-Id: <c085qd$h2n$6@wisteria.csv.warwick.ac.uk>
Andreas Boehm <andreas@andiboehm.de> wrote:
> I found the following behavior of perls built-in glob, but do not know
> if this is correct.
> in debug and in normal mode globbing does the folling thing:
>
> DB<1> @a=glob("/home/sunny/share/User/Joerg/rho- SAX tryp/*");
> DB<3> x @a
> 0 '/home/sunny/share/User/Joerg/rho-'
> 1 'SAX'
> DB<4>
>
> Is this correct?
Yup.
> And does there exist a solution that correctly globs folders containing
> spaces in their names?
Don't use folder(spit!)^W^W directories with spaces in their names. It
will cause you much pain.
File::Glob::bsd_glob will treat each argument as a separate pattern,
rather than splitting on whitespace.
Ben
--
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based
on the strictest morality. [Samuel Butler, paraphrased] ben@morrow.me.uk
------------------------------
Date: Mon, 9 Feb 2004 09:07:08 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: glob in perl
Message-Id: <slrnc2f8gs.347.tadmc@magna.augustmail.com>
Andreas Boehm <andreas@andiboehm.de> wrote:
> I found the following behavior of perls built-in glob,
> And does there exist a solution that correctly globs folders containing
> spaces in their names?
You can do it without using glob at all:
# untested
my $dir = '/home/sunny/share/User/Joerg/rho- SAX tryp';
opendir DIR, $dir or die "could not open '$dir' directory $!";
my @a = sort map { "$dir/$_" } grep /^[^.]/, readdir DIR;
closedir DIR;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 Feb 2004 15:18:54 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: glob in perl
Message-Id: <slrnc2f96u.kid.xx087@smeagol.ncf.ca>
Andreas Boehm <andreas@andiboehm.de> wrote:
> And does there exist a solution that correctly globs folders containing
> spaces in their names?
Try: glob '/path/to/dir\ with\ spaces/*';
Note the single quotes to protect the backslashes.
or:
$dir = '/path/to/dir with spaces';
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: Mon, 09 Feb 2004 16:26:46 +0100
From: Andreas Boehm <andreas@andiboehm.de>
Subject: Re: glob in perl
Message-Id: <c088rm$13nsoi$1@uni-berlin.de>
hi,
>> DB<1> @a=glob("/home/sunny/share/User/Joerg/rho- SAX tryp/*");
>> DB<3> x @a
>>0 '/home/sunny/share/User/Joerg/rho-'
>>1 'SAX'
>> DB<4>
>>Is this correct?
why?
>>And does there exist a solution that correctly globs folders containing
>>spaces in their names?
> Don't use folder(spit!)^W^W directories with spaces in their names. It
> will cause you much pain.
but unix allows spaces in names since the seventies of the last century.
> File::Glob::bsd_glob will treat each argument as a separate pattern,
> rather than splitting on whitespace.
but the argument is quoted...
regards,
Andreas
------------------------------
Date: Mon, 9 Feb 2004 15:10:28 +0100
From: "kz" <notpublic@restricted.com>
Subject: Re: IO::Socket::INET Problem
Message-Id: <rBMVb.4$u_6.29981@news.uswest.net>
"Hobbit HK" <hobbit_hk@hotmail.com> wrote in message
news:22ee5d47.0402090547.1f8299e0@posting.google.com...
> I'm using WinXP (although I also have RH Linux and there's no
> difference) and I want to write a script which uses sockets... Now, my
> main problem is when there's nothing else to read from the socket...
> That's where my script stucks... My guess is that because it keeps on
> waiting for something (it can still get data)... Is there some way to
> bypass this?
> Will Blocking=>0 in IO::Socket::INET's new() help?
>
> BTW
> I'm using $line=<$sock> to read from the socket.
Your example seems to be blocking.
Snippet below does not exactly cover your case, worked in mine, though.
Calling the can_read method with no args was blocking. Specifying 500 ms
wasn't.
my $listen = IO::Socket::INET->new(Listen => 5, LocalAddr => 'localhost',
LocalPort => 12300, Proto => 'tcp') or die "listen: $!";
my $select = new IO::Select() or die "Can't setup main selector: $!";
$select->add($listen);
while (1) {
my @ready = $select->can_read(500); # magic
foreach my $endpt (@ready) {
# do whatever needs to be done
} }
HTH,
Zoltan
------------------------------
Date: Mon, 9 Feb 2004 15:10:41 +0100
From: "kz" <notpublic@restricted.com>
Subject: Re: IO::Socket::INET Problem
Message-Id: <sBMVb.5$u_6.29876@news.uswest.net>
"Hobbit HK" <hobbit_hk@hotmail.com> wrote in message
news:22ee5d47.0402090547.1f8299e0@posting.google.com...
> I'm using WinXP (although I also have RH Linux and there's no
> difference) and I want to write a script which uses sockets... Now, my
> main problem is when there's nothing else to read from the socket...
> That's where my script stucks... My guess is that because it keeps on
> waiting for something (it can still get data)... Is there some way to
> bypass this?
> Will Blocking=>0 in IO::Socket::INET's new() help?
>
> BTW
> I'm using $line=<$sock> to read from the socket.
Your example seems to be blocking.
Snippet below does not exactly cover your case, worked in mine, though.
Calling the can_read method with no args was blocking. Specifying 500 ms
wasn't.
my $listen = IO::Socket::INET->new(Listen => 5, LocalAddr => 'localhost',
LocalPort => 12300, Proto => 'tcp') or die "listen: $!";
my $select = new IO::Select() or die "Can't setup main selector: $!";
$select->add($listen);
while (1) {
my @ready = $select->can_read(500); # magic
foreach my $endpt (@ready) {
# do whatever needs to be done
} }
HTH,
Zoltan
------------------------------
Date: Mon, 9 Feb 2004 14:31:30 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: IO::Socket::INET Problem
Message-Id: <c085k2$h2n$5@wisteria.csv.warwick.ac.uk>
hobbit_hk@hotmail.com (Hobbit HK) wrote:
> I'm using WinXP (although I also have RH Linux and there's no
> difference) and I want to write a script which uses sockets... Now, my
> main problem is when there's nothing else to read from the socket...
> That's where my script stucks... My guess is that because it keeps on
> waiting for something (it can still get data)... Is there some way to
> bypass this?
What do you want it to do in that case? Stop? It is usual for socket
programs to either wait until the other end closes the socket (which
will come out as reading EOF) or to close it yourself on some
condition, ie. during the processing immediately after having read something.
> Will Blocking=>0 in IO::Socket::INET's new() help?
> I'm using $line=<$sock> to read from the socket.
Might do. It won't if you use buffered reads, though, so you either
want to switch to sysread or (if you have 5.8) push a :unix (NB. I
have never tried this and, though it ought to work, I don't really
know... :). You may also, as someone else said, want to use
IO::Select.
Ben
--
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'
:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: ben@morrow.me.uk
------------------------------
Date: Mon, 9 Feb 2004 14:13:52 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: need help with this little perl script
Message-Id: <c084j0$h2n$1@wisteria.csv.warwick.ac.uk>
"Danny" <dannywork5@hotmail.com> wrote:
> now I just want the script to do what it does (update the
> counter.txt)
Have you read perldoc -q "increment the number" ?
Ben
--
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else * ben@morrow.me.uk
------------------------------
Date: 9 Feb 2004 14:13:01 GMT
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl project update
Message-Id: <41oh20dk5i8pp1agsildi9c5otn6dilksq@4ax.com>
On Sun, 08 Feb 2004 19:57:35 GMT, "edgrsprj" <edgrsprj@ix.netcom.com>
wrote:
[snip lenghty description]
>After seeing that I decided to go ahead and create that interface, get my
>programming started, and then worry about choosing an ideal programming
>language later in time.
So what?!?
Do not think that I'm being rude to you, but I can't understand what
is the question in your long post, if there is a question.
If there's not a question, then I can't understand how your article
should be of any interest to anyone here.
A related issue is that IMHO you should learn to express yourself a
bit less verbosely, focusing on just a few points and drawing the
attention of your readers to them, rather than distracting them with
inessential descriptions. But that is only MHO...
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Mon, 9 Feb 2004 08:15:02 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl project update
Message-Id: <slrnc2f5f6.2vh.tadmc@magna.augustmail.com>
edgrsprj <edgrsprj@ix.netcom.com> wrote:
> "Keith Keller" <kkeller-usenet@wombat.san-francisco.ca.us> wrote in message
> news:7d960c.k0d.ln@goaway.wombat.san-francisco.ca.us...
>
>> On 2004-02-08, edgrsprj <edgrsprj@ix.netcom.com> wrote:
>> > For example, if a Windows Notepad text file window was being displayed
>>> the program would need to be able to read information from and write
>>> information to that screen.
>>
>> That's amazingly silly. Why Notepad? Why not just take a filename as
>> input and output to another file and/or STDOUT? Something like
>>
>
>
> The following is one of the most important reasons for developing this
> technology.
[ snip 40 lines]
But none of what you wrote has anything to do with the text you quoted!
Even taking into account all that you wrote, you can *still* operate
directly on a file rather than on data being displayed by some application.
You seem to have missed the point that Keith was making...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 9 Feb 2004 14:25:25 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Perl project update
Message-Id: <c0858l$h2n$3@wisteria.csv.warwick.ac.uk>
tadmc@augustmail.com wrote:
> edgrsprj <edgrsprj@ix.netcom.com> wrote:
> > "Keith Keller" <kkeller-usenet@wombat.san-francisco.ca.us> wrote in message
> > news:7d960c.k0d.ln@goaway.wombat.san-francisco.ca.us...
> >
> >> On 2004-02-08, edgrsprj <edgrsprj@ix.netcom.com> wrote:
> >> > For example, if a Windows Notepad text file window was being displayed
> >>> the program would need to be able to read information from and write
> >>> information to that screen.
> >>
> >> That's amazingly silly. Why Notepad? Why not just take a filename as
> >> input and output to another file and/or STDOUT? Something like
> >
> > The following is one of the most important reasons for developing this
> > technology.
>
> But none of what you wrote has anything to do with the text you quoted!
>
> Even taking into account all that you wrote, you can *still* operate
> directly on a file rather than on data being displayed by some application.
...and, if necessary, display it as you're going along for manual
reality-checking... or, indeed, work out what your reality-check rules
are, and code them up in Perl so it does it for you.
In case you haven't got it yet (and it seems you haven't), you
*really* *really* want to get away from this idea of controlling
window GUI programs. It'll just make your life about a million times
harder.
Ben
--
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else * ben@morrow.me.uk
------------------------------
Date: Mon, 9 Feb 2004 14:19:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: script working like daemon
Message-Id: <c084u6$h2n$2@wisteria.csv.warwick.ac.uk>
vangelob@in.tum.de (murph) wrote:
> i should write a script which sends a mail whenever a new user is
> trying to login to the system(linux) as a root. As much as i know that
> script should work like daemon(i think that i can write it ) , but i
> don't know what exactly should the script do ?
> How can i understand when someone try to login to the computer ?
> Any ideas ?
If the system uses PAM then the easiest way is to hook in there (this
is not a Perl question, and the answer will be a C program). Otherwise
you could have a program sit reading the logs...
Ben
--
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks] ben@morrow.me.uk
------------------------------
Date: Mon, 9 Feb 2004 14:27:09 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Shared variables along threads
Message-Id: <c085bt$h2n$4@wisteria.csv.warwick.ac.uk>
Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
> as in threads::shared(3pm) I read that one must use
> &share([]);
No, one must use
share([]);
or
share [];
Don't use the & unless you know what it does and why you need it to.
> to make a new array available to all threads. How well does this
> work with deeper arrays, i.e. does creating a new array using []
> within an already-shared array make that one also shared?
What happened when you tried it?
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
------------------------------
Date: Mon, 9 Feb 2004 15:32:17 +0100
From: Jan Engelhardt <jengelh@linux01.gwdg.de>
Subject: Re: Shared variables along threads
Message-Id: <Pine.LNX.4.53.0402091529040.22652@yvahk01.tjqt.qr>
>> as in threads::shared(3pm) I read that one must use
>> &share([]);
>
>No, one must use
> share([]);
>or
> share [];
Type of arg 1 to threads::shared::share must be one of [$@%] (not single ref
constructor) at tst.pl line 6, near "];"
Execution of tst.pl aborted due to compilation errors.
6: $mx = share [];
>Don't use the & unless you know what it does and why you need it to.
& executes a user-defined sub, or for that matter, any non-CORE functions such
as print, etc. Since threads is imported as a module, I assume share is a sub,
and not a CORE function. (p. 78 of 'Introduction to Perl', the Llama book)
>> to make a new array available to all threads. How well does this
>> work with deeper arrays, i.e. does creating a new array using []
>> within an already-shared array make that one also shared?
>
>What happened when you tried it?
See above.
>
Jan Engelhardt
--
------------------------------
Date: Mon, 9 Feb 2004 14:40:21 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Shared variables along threads
Message-Id: <c0864l$h2n$7@wisteria.csv.warwick.ac.uk>
Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
> >> as in threads::shared(3pm) I read that one must use
> >> &share([]);
> >
> >No, one must use
> > share([]);
> >or
> > share [];
>
> Type of arg 1 to threads::shared::share must be one of [$@%] (not
> single ref constructor) at tst.pl line 6, near "];" Execution of
> tst.pl aborted due to compilation errors.
This is because you can only share a *variable*, not an anonymous
array. The correct solution is not to simply disable the error by
using &: it is there for a reason, and you need to fix your code,
eg. by assigning it to a variable:
my $x = [];
share $x;
> >Don't use the & unless you know what it does and why you need it to.
>
> & executes a user-defined sub, or for that matter, any non-CORE
> functions such as print, etc. Since threads is imported as a module,
> I assume share is a sub, and not a CORE function. (p. 78 of
> 'Introduction to Perl', the Llama book)
Throw that book away and get another. It is *far* too out-of-date to
be any use. Read perldoc perlsub.
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
------------------------------
Date: Mon, 9 Feb 2004 08:09:17 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: substitution fails for long line
Message-Id: <slrnc2f54d.2vh.tadmc@magna.augustmail.com>
Pranav Agarwal <a__pranav@rediffmail.com> wrote:
> open(FH,"$ARGV[0]");
You should always, yes *always*, check the return value from open():
open(FH, $ARGV[0]) or die "could not open '$ARGV[0]' $!";
Have you seen this Perl FAQ?
What's wrong with always quoting "$vars"?
If you read from <>, perl will do the open()ing for you.
> while(<FH>){
> $x=$_;
If you want it in $x, then put it in $x straightaway
while ( my $x = <FH> ) {
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 09 Feb 2004 10:54:40 -0500
From: Dominic <roqetman@hotmail.com>
Subject: Why is Perl losing ground?
Message-Id: <23OVb.1$196.899@news.nyc.globix.net>
As a programmer who is addicted to Perl, I am curious as to why Perl is
losing ground to another bunch of languages, namely: Python, PHP and
Ruby. I'd like to hear your opinions. Is Perl just not "trendy" anymore?
Does it still scare programmers who haven't used it? Or do the other
languages have any major advantages over Perl? I haven't worked in these
other languages, so I'm not qualified to have much of an opinion here.
What do you think?
- Dom
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6099
***************************************