[22440] in Perl-Users-Digest
Perl-Users Digest, Issue: 4661 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 4 14:06:16 2003
Date: Tue, 4 Mar 2003 11:05:10 -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 Tue, 4 Mar 2003 Volume: 10 Number: 4661
Today's topics:
Re: [OT] NEWBIE: PerlNET <jasonhood@tiscali.co.uk>
Archive::Zip and file attributes <Joly.Patrick@ic.gc.ca>
Array construction with references rather than anonymou (Bob Kenney)
Re: Array construction with references rather than anon <usenet@dwall.fastmail.fm>
Does anyone know how to overload the backticks operator <jamesd@transmeta.com>
Re: Greedy regexps <somewhere@nowhere.com>
Re: Greedy regexps <usenet@dwall.fastmail.fm>
Re: Greedy regexps <jurgenex@hotmail.com>
Re: Greedy regexps <jurgenex@hotmail.com>
Re: Greedy regexps <somewhere@nowhere.com>
Re: Greedy regexps <ubl@schaffhausen.de>
Re: Greedy regexps <abigail@abigail.nl>
Re: Greedy regexps <abigail@abigail.nl>
Re: newbie hash question (Anno Siegel)
Re: newbie hash question <mike@luusac.co.uk>
Re: newbie hash question (Anno Siegel)
Re: newbie hash question <mike@luusac.co.uk>
Re: newbie hash question <nobull@mail.com>
Perl Script to Produce XML <hillmw@charter.net>
Re: Perl Script to Produce XML <newsfeed2@boog.co.uk>
Re: Playing a .wav file <ian@WINDOZEdigiserv.net>
Power status on laptop (Graham Knight)
Re: Power status on laptop <abigail@abigail.nl>
Re: Stolen! <Juha.Laiho@iki.fi>
Re: Stolen! <Juha.Laiho@iki.fi>
Re: Text list to html files <greg@racquettech.com>
Re: Works offline but not online <bart.lateur@pandora.be>
Re: Works offline but not online <Johan.Ljunggren@uab.ericsson.se>
Re: Works offline but not online <abigail@abigail.nl>
Re: XML to HTML <newsfeed2@boog.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 4 Mar 2003 14:18:03 -0000
From: "Jason Hood" <jasonhood@tiscali.co.uk>
Subject: Re: [OT] NEWBIE: PerlNET
Message-Id: <3e64b561_1@mk-nntp-2.news.uk.tiscali.com>
> Of course, I agree that the 'value' of Microsofts offerings is not
particularly
> high in regard to the cost ;-) But in some scenarios, Microsoft makes
sense.
>
...
> I thought I'd stick my hand up, and stress that Microsoft bashing is not
what
> this group is all about. We're meant to be open minded, darn it, after
all.. we
> use Perl ;-)
>
Lets face it nobody thinks that microsoft gets it right all of the time, but
then nobody does.
Microsoft is in the business of making a profit but they are also committed
to technology. Some things belong in the public domain, somethings don't.
Turn the other cheek, just because they strive to make things incompatible
doesn't mean we have to. When you respond to questions by ranting at
microsoft you appear to everyone like the guy standing outside mcdonalds
condeming them as the spawn of satan.... <crazy>
> written at this point. .Net supports at least Fortran, C++, Perl (if this
> PerlNET actually exists), VB, C#, and ASP at this point. And one could
harp on
PerlNET does exist and can be seen at www.activestate.com which is the home
of the win version of perl. It stills needs work but it's a step in an
admirable direction, especially if mono comes off.
Jason
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
------------------------------
Date: Tue, 4 Mar 2003 13:33:27 -0500
From: "Joly, Patrick: IAC" <Joly.Patrick@ic.gc.ca>
Subject: Archive::Zip and file attributes
Message-Id: <3E3612E8D41DD3118DCC060000000000096C4A6D@pubgate-01.ic.gc.ca>
I am trying to create a new archive containing only those files in a
directory tree which have the archive attribute set to on (i.e. deemed
"ready for archiving"). I am using Windows 2000 and Active-State Perl
5.8.
So far I have used method addTree() from Archive::Zip::Tree to fetch the
whole tree and then attempted to remove files whose archive attribute is
not set.
use strict;
use warnings;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use Archive::Zip::Tree;
chdir "P:/z_backup/ado";
my $zip = Archive::Zip->new();
$zip->addTree( "P:/ado", 'ado' );
# die 'write error' if $zip->writeToFileNamed( 'adobackup.zip' ) !=
AZ_OK;
my @members = $zip->members();
my $i = 0;
for $file (@members) {
my $attrib = $file->fileAttributeFormat(); # so I can view what
the method returns
print '$attrib is: ', "$attrib\n";
$zip->removeMember($file) if ($file->fileAttributeFormat() eq
"FA_ARCH");
my @remain = $zip->memberNames();
print ++$i, " - @remain\n";
}
It looks as though fileAttributeFormat() may not be the right member
method. I have also tried externalFileAttributes(), but to no avail.
Is what I am trying to do possible at all? TIA!
Patrick Joly, Economist
Industrial Analysis Centre, Industry Canada
Joly.Patrick@ic.gc.ca
------------------------------
Date: 4 Mar 2003 07:49:13 -0800
From: bob@mve.com (Bob Kenney)
Subject: Array construction with references rather than anonymous array's, using 'split'?
Message-Id: <faeaf4e4.0303040749.33779886@posting.google.com>
How can I return a 'split' as an array, which I can then reference,
from a reference array, The Sample of code below works pretty well on
the majority of my files? However, files that contain 1,000,000+
vertex (all doubles) things just grind to a halt... Although, not to
bad on LINUX and SGI64, (obviously) on WIN32 and dealing with doubles
in these numbers, we hit problems.
I need a Solution biased on references rather than copying data. +
This small section is were all my scope for optimisation lies and the
script has to be fast on all platforms. There has to be away around
the windows problem, short of using it as a football!)
Any suggestions!
I would ideally like to do something like:
$array[$counter] = \( split( ' ', $line) ); #But this returns a list
and not an array!!!
FILE SAMPLE *************************
2418.8750 160.5000 -3082.7861
2418.8750 2.5000 -3088.6606
2577.9375 2.5000 -3112.5317
2418.8750 319.0000 -3076.8501
2577.9375 160.5000 -3105.7024
2418.8750 1269.5000 -3121.2732
2259.8750 1428.0000 -3081.4302
2259.8750 1269.5000 -3083.3533
2418.8750 1428.0000 -3082.3345
2259.8750 1586.0000 -3074.9983
2418.8750 636.0000 -3120.9150
2418.8750 477.5000 -3080.0090
2577.9375 477.5000 -3108.7290
2418.8750 794.5000 -3121.9253
2577.9375 636.0000 -3114.9971
***************************************
CODE SAMPLE****************************
my $line;
my @array;
$#array = $num_vertex;
my $counter = 0;
while ( $line =<FILE> )
{
#Split the line and put all data less "spaces" in to an array of
references
$array[$counter] = [ split(' ', $line) ];
$counter++;
$line = <FILE>;
}
#$this = a hash within an object, ( my %data =('vertex' => undef,
...etc ) )...
$this->{vertex} = \@array ;
*********************************************
Regards Bob
------------------------------
Date: Tue, 04 Mar 2003 16:23:01 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Array construction with references rather than anonymous array's, using 'split'?
Message-Id: <Xns933473CE6EA18dkwwashere@216.168.3.30>
Bob Kenney <bob@mve.com> wrote on 04 Mar 2003:
> my $line;
> my @array;
> $#array = $num_vertex;
> my $counter = 0;
>
> while ( $line =<FILE> )
> {
> #Split the line and put all data less "spaces" in to an
> #array of references
>
> $array[$counter] = [ split(' ', $line) ];
>
> $counter++;
> $line = <FILE>;
> }
You can replace this with
my @array;
push @array, [ split ] while <FILE>;
That should help some. Accessing array elements by index is often
not the most efficient way to process an array in Perl. And you
don't need to declare the array size -- it will be resized as
necessary.
--
David K. Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: Tue, 04 Mar 2003 09:20:42 -0800
From: James Damon <jamesd@transmeta.com>
Subject: Does anyone know how to overload the backticks operator?
Message-Id: <3E64E06A.394BC338@transmeta.com>
Hi,
I am interested in making an expression like `ls` to be an alias for
a subroutine that does an Open3. This would allow me to store the
standard out and standard
error in a systematic way, and to do things like make multiple copies of
the output, as well as
run time filtering.
Does anyone know how I can overload the `` operation?
I did some reading and I know that `` is just an alias for "qx"
operator. However, I was not able to
Export qw from a module and override the behavior of qx
Example
This works
package tmp;
require Exporter;
use Carp;
@ISA = qw( Exporter );
@EXPORT = qw( system readpipe );
sub system {
print "Your command was \n";
print @_,"\n";
}
sub readpipe {
print "Your command was \n";
print @_,"\n";
}
1;
#
# And in the main code
use tmp;
system("ls *");
will print
Your command was
ls *
However, I was not able to get QX to be exported correctly .
This is an interesting problem since it isn't covered in the Perl Manual
at all.
Does anyone have any ideas about what to do in this situation?
Thanks for the help
-Jimi
------------------------------
Date: Tue, 4 Mar 2003 14:20:32 -0000
From: "Bigus" <somewhere@nowhere.com>
Subject: Re: Greedy regexps
Message-Id: <b42cnm$u7q@newton.cc.rl.ac.uk>
Tore Aursand wrote:
> On Tue, 04 Mar 2003 12:56:29 +0000, Bigus wrote:
>> I am parsing some HTML code in the following manner:
>> [...]
>
> For the n'th time: Parsing HTML _is_ rocket science. Someone, but not
> necessarily rocket scientists, have already done the HTML parsing job
> for you.
>
> Have a look at the HTML parser modules found at CPAN.
Yes, but sussing out the documentation on some of those modules can be
rocket science in itself sometimes! ...or at least to me, since I am not a
"natural" programmer and don't have any background education in computers,
so when people start throwing around terms such as classes, entities,
constructors, callbacks, etc etc my eyes start to glaze over rapidly ;-)
Not only that, but some of these modules have methods for every conceivable
task that you might want to perform, which is great, however it means that
some of the more basic tasks become lost in the array of syntax needed to
achieve all these different functions. Or at least, that's my perception of
it :)
I don't want to do anythign fancy.. simply makr the headings as I described,
and then remove the HTML elements.. I wouldn't have thought that'd require
more than a couple of lines, but I still haven't fully mastered regexps,
hence my problem!
Spencer
------------------------------
Date: Tue, 04 Mar 2003 15:09:29 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Greedy regexps
Message-Id: <Xns93346756589DEdkwwashere@216.168.3.30>
Bigus <somewhere@nowhere.com> wrote on 04 Mar 2003:
> Tore Aursand wrote:
>> Have a look at the HTML parser modules found at CPAN.
>
> Yes, but sussing out the documentation on some of those modules
> can be rocket science in itself sometimes!
Try HTML::TokeParser. It still uses HTML::Parser, but provides an
interface that you may find easier to use. (I find it easier, anyway)
--
David K. Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: Tue, 04 Mar 2003 15:12:52 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Greedy regexps
Message-Id: <Un39a.74071$_J5.12882@nwrddc01.gnilink.net>
Bigus wrote:
> I am parsing some HTML code in the following manner:
>
> [some terrible REs snipped]
For the gazillionth time: use an HTML parser to parse HTML.
See google and RTFM (perldoc -q "remove HTML") why you cannot do it with
REs.
jue
------------------------------
Date: Tue, 04 Mar 2003 15:19:16 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Greedy regexps
Message-Id: <Ut39a.74085$_J5.48842@nwrddc01.gnilink.net>
Bigus wrote:
> Tore Aursand wrote:
>> On Tue, 04 Mar 2003 12:56:29 +0000, Bigus wrote:
>>> I am parsing some HTML code in the following manner:
>>> [...]
>>
>> For the n'th time: Parsing HTML _is_ rocket science. Someone, but
>> not necessarily rocket scientists, have already done the HTML
>> parsing job for you.
>>
>> Have a look at the HTML parser modules found at CPAN.
>
> Yes, but sussing out the documentation on some of those modules can be
> rocket science in itself sometimes! ...or at least to me, since I am
> not a "natural" programmer and don't have any background education in
> computers, so when people start throwing around terms such as
> classes, entities, constructors, callbacks, etc etc my eyes start to
> glaze over rapidly ;-) [...]
>
> I don't want to do anythign fancy.. simply makr the headings as I
> described, and then remove the HTML elements..
Then just copy and paste the fine example code that comes with HTML::Parser:
"More examples are found in the "eg/" directory of the HTML-Parser
distribution; [...] and the program htext show how to obtain the plain text,
but not any script/style content."
The only 'problem' is that you have to download the source code from CPAN
because binary installations like e.g. ActiveState don't include those
examples.
jue
------------------------------
Date: Tue, 4 Mar 2003 15:29:30 -0000
From: "Bigus" <somewhere@nowhere.com>
Subject: Re: Greedy regexps
Message-Id: <b42gor$10i4@newton.cc.rl.ac.uk>
Jürgen Exner wrote:
> Bigus wrote:
>> I am parsing some HTML code in the following manner:
>>
>> [some terrible REs snipped]
>
> For the gazillionth time: use an HTML parser to parse HTML.
> See google and RTFM (perldoc -q "remove HTML") why you cannot do it
> with REs.
Thanks, I'm happy to use the "simple minded" approach as all the HTML pages
being searched are ones that I've created, so I know what kind of HTML is in
there and regular expressions will do the trick.
I've also decided that instead of trying to match what's in cells with
class=head1, I'm going to give priority to matches in upper case, since all
those headings are in capitals anyway, so it makes sense.
That doesn't explain what I was doing wrong in that last line of my code
though. I would be interested in knowing what I was doing wrong for future
ref.
Thanks
Spencer
------------------------------
Date: Tue, 04 Mar 2003 17:41:15 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Greedy regexps
Message-Id: <b42o5v$1ov$1@news.dtag.de>
Bigus wrote:
> That doesn't explain what I was doing wrong in that last line of my code
> though. I would be interested in knowing what I was doing wrong for future
> ref.
I wish you good luck. I myself don't feel to be up to the task to parse
HTML myself, especially not my own or that of the next WYSIWYG editor I
might be using in the future together with my current Perl programs.
->malte
------------------------------
Date: 04 Mar 2003 17:21:01 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Greedy regexps
Message-Id: <slrnb69o3t.8tl.abigail@alexandra.abigail.nl>
Bigus (somewhere@nowhere.com) wrote on MMMCDLXXII September MCMXCIII in
<URL:news:b427pu$vf2@newton.cc.rl.ac.uk>:
^^
^^ Can someone tell me what is happening? I thought that the ? regexp character
^^ was supposed to stop this happening.
The ? modifier doesn't stop the regexp from matching, and it doesn't
stop the regexp from matching at the earliest point possible.
If you insist on doing this with a regexp, you need to make it much
tigher, to prevent it from matching too much. But it would be far,
far better to parse HTML.
People should stop thinking it's easy to parse HTML with a single regexp.
It's not. Parsing is far, far easier.
Abigail
--
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'
------------------------------
Date: 04 Mar 2003 17:22:55 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Greedy regexps
Message-Id: <slrnb69o7e.8tl.abigail@alexandra.abigail.nl>
Bigus (somewhere@nowhere.com) wrote on MMMCDLXXII September MCMXCIII in
<URL:news:b42cnm$u7q@newton.cc.rl.ac.uk>:
)) Tore Aursand wrote:
)) > On Tue, 04 Mar 2003 12:56:29 +0000, Bigus wrote:
)) >> I am parsing some HTML code in the following manner:
)) >> [...]
)) >
)) > For the n'th time: Parsing HTML _is_ rocket science. Someone, but not
)) > necessarily rocket scientists, have already done the HTML parsing job
)) > for you.
)) >
)) > Have a look at the HTML parser modules found at CPAN.
))
)) Yes, but sussing out the documentation on some of those modules can be
)) rocket science in itself sometimes! ...or at least to me, since I am not a
)) "natural" programmer and don't have any background education in computers,
)) so when people start throwing around terms such as classes, entities,
)) constructors, callbacks, etc etc my eyes start to glaze over rapidly ;-)
If you are not all that, then you shouldn't at all attempt to parse HTML
with a regexp, as that's far more difficult than to understand the
documentation of a module.
Abigail
--
:;$:=~s:
-:;another Perl Hacker
:;chop
$:;$:=~y
:;::d;print+Just.
$:;
------------------------------
Date: 4 Mar 2003 14:23:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbie hash question
Message-Id: <b42ctn$2dm$1@mamenchi.zrz.TU-Berlin.DE>
Mike <mike@luusac.co.uk> wrote in comp.lang.perl.misc:
> Hi
>
> > So what parts of "A xyz" can vary in which way? How, do you think,
> > should we come up with a regex when you don't say what it is supposed
> > to match?
>
> the xyx will differ, as in
>
> "A sdfgfdgjdfgjkfdg: 123"
> ...
> ...
> "A sdfgfdgjdfgjkfdg: 648"
> ...
> ...
> "A sdfgfdgjdfgjkfdg: 291"
>
> so something like /^[A-Z].*:\d\d\d/
Okay.
> > Same question as above: What parts of "blah blah blah" can vary in
> > which way? How are all "blah blah blah"-lines different from all
> > "A xyz"-lines?
>
> something like /:\n.*/
That matches everything that begins with a newline. Since a line in a
file can only have a newline at the end, this will only match empty
lines.
Or do you just want to pick the line following the first pattern, no
matter what it contains?
> I think I will be reasonably okay with the regexps, or at least whiile my
> experiance of regexps is limited I think that I can have a reasonable
> attempt at trying to come up with the regexps even though my examples above
> won't work. ;-)
>
> > What if no "blah blah blah" follows an "A xyz"? What if more than
> > one do?
>
> They don't, the file to parse is structured. I see your point, but that
> would be (for me) a further development.
>
> >
> > > repeat process until EOF.
> > >
> > > Any pointers to code which does something like this or basic stuff about
> > > hashes generally would be appreciated.
>
> If this is still to imprecise I am just after examples of reading a file and
> creating a hash by using 2 regexps as described - I can then make an
> attempt at it myself ....
Unfortunately, the second pattern is useless in explaining what you
actually want.
Assuming you have two regexes $re1 and $re2 that pick out the lines,
here is one way to interpret what you have said so far (untested,
obviously):
until ( eof $in ) {
while ( <$in> ) { # search for first pattern
last if /$re1/;
}
chomp;
my $key = $_; # save the key match
while ( <$in> ) { # search second pattern
last if /$re2/;
}
chomp;
$hash{ $key} = $_; # enter result into hash
}
Anno
------------------------------
Date: Tue, 4 Mar 2003 16:03:22 -0000
From: "Mike" <mike@luusac.co.uk>
Subject: Re: newbie hash question
Message-Id: <H649a.12138$EN3.97238@newsfep4-glfd.server.ntli.net>
Hi Anon
> > > Same question as above: What parts of "blah blah blah" can vary in
> > > which way? How are all "blah blah blah"-lines different from all
> > > "A xyz"-lines?
> >
> > something like /:\n.*/
>
> That matches everything that begins with a newline. Since a line in a
> file can only have a newline at the end, this will only match empty
> lines.
oh yes, I have just been regexping a slupped string & got confused. I mean
to match a line *following* a line which ends in a ':' (also I forgot to
escape the : in my eg)
> Or do you just want to pick the line following the first pattern, no
> matter what it contains?
No, the line which will become the value that I want is 2 lines down from
the line which will be the key. I will want the value to contain the whole
of a line, eg
Abc: 123
Blah:
Text to be the value
Bac: 225
Blah Blah:
More text to be the next value
So I end up with :
Key | Value
_____|________________________
123 | Text to be the value
225 | More text to be the next value
So I would precede your code example (thanks) with
open (HE, '< text.txt');
$in = HE;
close <HE>;
?
thanks.
Mike
------------------------------
Date: 4 Mar 2003 16:21:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbie hash question
Message-Id: <b42jps$75o$1@mamenchi.zrz.TU-Berlin.DE>
Mike <mike@luusac.co.uk> wrote in comp.lang.perl.misc:
[...]
> So I would precede your code example (thanks) with
> open (HE, '< text.txt');
> $in = HE;
> close <HE>;
No, with a current Perl you would precede it with
open my $in, 'text.txt';
See perldoc -f open
Anno
------------------------------
Date: Tue, 4 Mar 2003 17:13:55 -0000
From: "Mike" <mike@luusac.co.uk>
Subject: Re: newbie hash question
Message-Id: <Q859a.12214$EN3.97920@newsfep4-glfd.server.ntli.net>
Hi,
> No, with a current Perl you would precede it with
I am using perl 5.6.1 - I realise that the latest stable is 5.8.0 - do you
consider my version 'current' for the purposes of your code ? I did
'perldoc -f open' but saw open examples of the way I suggested, but not your
way - maybe I was looking in the wrong place or misunderstanding ?
thanks
Mike
------------------------------
Date: 04 Mar 2003 17:43:07 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: newbie hash question
Message-Id: <u9of4r81uc.fsf@wcl-l.bham.ac.uk>
"Mike" <mike@luusac.co.uk> trims too much so that is it impossible to
know what he's talking about when he says:
> > No, with a current Perl you would precede it with
>
> I am using perl 5.6.1 - I realise that the latest stable is 5.8.0 - do you
> consider my version 'current' for the purposes of your code ?
I'm assuming you are taking about using the new-style open:
open(my $foo,'<','foo.txt') or die "....: $!";
instead of the old:
open(FOO,'<foo.txt') or die "....: $!";
> I did 'perldoc -f open' but saw open examples of the way I
> suggested, but not your way - maybe I was looking in the wrong place
> or misunderstanding ?
The documentation in 5.6.1 lags behind the functionality.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 4 Mar 2003 15:09:43 -0600
From: "Michael Hill" <hillmw@charter.net>
Subject: Perl Script to Produce XML
Message-Id: <v69gd7p6ttu045@corp.supernews.com>
I am getting a server error attempting to run a cgi script that results in
an xml display to the browser. The server log says I have a malformed
header.
The cgi script is:
print "<?xml:stylesheet type='text/xsl' href='my.xsl'?>\n";
print "<portfolio>\n";
print "<review>\n";
print "<id>1</id>\n";
print "<type>A</type>\n";
print "<title>A really Cool title</title>\n";
print "<e_start>2003-03-04</e_start>\n";
print "<e_end>2003-03-04</e_end>\n";
print "</review>\n";
print "</portfolio>\n";
I added a type to my .htaccess file in the cgi-bin directory thinking that
was the problem.
This same display below works fine in my html directory:
<?xml:stylesheet type='text/xsl' href='my.xsl'?>
<portfolio>
<review>
<id>1</id>
<type>A</type>
<title>A really Cool title</title>
<e_start>2003-03-04</e_start>
<e_end>2003-03-04</e_end>
</review>
</portfolio>
Any help is appreciated.
------------------------------
Date: Tue, 4 Mar 2003 15:40:36 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: Perl Script to Produce XML
Message-Id: <K%39a.12125$EN3.97111@newsfep4-glfd.server.ntli.net>
Michael Hill wrote:
> print "<?xml:stylesheet type='text/xsl' href='my.xsl'?>\n";
<snip>
> print "</portfolio>\n";
>
> I added a type to my .htaccess file in the cgi-bin directory thinking that
> was the problem.
>
> This same display below works fine in my html directory:
Are you printing a Content-Type before sending the XML? If not, there's your
problem.
Pete
------------------------------
Date: Tue, 04 Mar 2003 14:09:09 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: Playing a .wav file
Message-Id: <2mc96vgh1cqen5mmbp1m5dpqbcnukr4tji@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on Tue, 04 Mar 2003 15:04:07 +0100, Malte Ubl
<ubl@schaffhausen.de> managed to scribble:
> Ian.H [dS] wrote:
> > -----BEGIN xxx SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Afternoon all =)
> >
> > Does anyone know of a method/function that'll enable a wav file
> > to be played on a certain event?
> >
> > I experimented and used a system() call with just the wav file as
> > an arg, but this opened the default media player.
> >
> > The script will be run through a client app on a system, not Web
> > based. I've tried searching google and came up with no leads.
> >
> > Any information appreciated.
>
> You dont state your platform. On Win32 this should be doable via
> OLE.
>
> ->malte
Oops, apologies malte and fair point.
Initially, this would be running on a Win2k box. It'll actually be
part of an XChat IRC client script (nothing script kiddie.. just
trying to use as notification purposes for me and other Opers).
It might be ported to FreeBSD (or *NIX in general, never used Linux
so unaware of any differences in drivers et al) but this wouldn't be
as yet.
Any info on the Win version would be greatly appreciated as I can
possibly use that later on to help me port to the *NIX version.
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPmSzg2fqtj251CDhEQKY0gCeObmeNXerMGvSAM0zLnneBJwfaH8AnRub
oN5a82JBZGl0d1GWttJFCBmB
=ebsZ
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Scripting, Web design, development & hosting.
------------------------------
Date: 4 Mar 2003 07:08:30 -0800
From: graham@purplemtn.com (Graham Knight)
Subject: Power status on laptop
Message-Id: <20b950bc.0303040708.110259b2@posting.google.com>
I have a laptop running windows 2000.
Does anyone know of a way in perl or otherwise to query the state of
the power? I am running a perl script that needs to know if the
laptop is on battery power or AC.
Thanks,
Graham
------------------------------
Date: 04 Mar 2003 18:12:43 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Power status on laptop
Message-Id: <slrnb69r4r.8tl.abigail@alexandra.abigail.nl>
Graham Knight (graham@purplemtn.com) wrote on MMMCDLXXII September
MCMXCIII in <URL:news:20b950bc.0303040708.110259b2@posting.google.com>:
`' I have a laptop running windows 2000.
`'
`' Does anyone know of a way in perl or otherwise to query the state of
`' the power? I am running a perl script that needs to know if the
`' laptop is on battery power or AC.
There's no Perl function that check something that's very system
dependent. For most environments, this would not even be a sensible
question.
Just call whatever program you would call to check the status, and
parse the output, or check the return value. Alternatively, write
a piece of XS or Inline::C code that calls the appropriate C function.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Tue, 04 Mar 2003 17:02:01 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Stolen!
Message-Id: <b42m12$gkb$1@ichaos.ichaos-int>
"Peter Cooper" <newsfeed2@boog.co.uk> said:
>The most compelling argument I've seen is one of speed. With all of the
>statistics I've seen (even those done by Perl people), PHP with the Zend
>optimiser outperforms Perl by a long way on Web applications, and outperforms
>mod_perl /slightly/.
Are you comparing here Perl run as CGI with PHP run as CGI - or Perl run
as CGI with PHP run as a web server module? If the latter, that is then
where your speed difference is - CGI versus module execution; not language
difference (and actually your mention about PHP outperforming mod_perl only
slightly seems to indicate that execution mode difference is the reason
for the speed difference - not the language).
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Tue, 04 Mar 2003 17:12:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Stolen!
Message-Id: <b42miq$gkb$2@ichaos.ichaos-int>
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> said:
>w i l l <will@com.yahoo> wrote in
>news:b8686vohbs1ghg6js7rohkji6ojqpqjqui@4ax.com:
>> 1) why use PHP at all if you are familiar with perl?
>
>I can't really answer this, having never used PHP, but it's my
>understanding that PHP makes some quick and dirty tasks quicker and
>less dirty. In particular, it's supposed to make database access
>sweet.
Oh. Compared to what? DBI seems to be a pretty good interface for
databases - and it seems that the PHP people are slowly seeing the
value of that kind of technology, too.
So, DBI is database independent abstraction layer; with some limitations
it's very easy to switch a DBI-based application from f.ex. MySQL to
Oracle. Of course, there still are the potential problems with
different dialects (or proprietary extensions) of SQL query language
itself, but if your application was written with portability in mind,
there shouldn't be too many problems because of this. Optimally, you
just install the appropriate db-specific module (DBD::Oracle, ...)
and change your connection parameter line, and your application is
ready to use a different DB engine.
Last time I looked at PHP, there was one module for connecting to
Oracle 7, one for connecting to Oracle 8, one for connecting to
MySQL, ... . And all different. And, if you happen to need a connection
to DB you didn't think of when installing PHP: recompile the whole
PHP. Compared to Perl/DBI situation: compile&install the database-
specific DBD module, and it is added to your existing functionality.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: 04 Mar 2003 18:16:36 GMT
From: Greg Raven <greg@racquettech.com>
Subject: Re: Text list to html files
Message-Id: <3E64ED84.8050509@racquettech.com>
Tad McClellan wrote:
> Greg Raven <greg@racquettech.com> wrote:
>
> MIME in newsgroups makes less folks read what you have to say.
>
> Consider turning that off for news.
>
>>Thanks a million.
>
> You can pay me back by reading the Posting Guidelines that are
> posted here frequently, and stop with the top-posting and full-quoting.
Done, and done.
>>You didn't include it, but I assumed that DATA needs to be opened and
>>closed,
>
> No, my program runs fine exactly as I posted it.
>
> The DATA filehandle is special (the Posting Guidelines mention that too).
>
> If you want to open a Real File then you should choose a filehandle
> name *other* than DATA.
Then I screwed it up, but by explicitly opening and closing DATA, the
program runs like crazy, even with all the .html formatting added in to
make the pages purty.
I'll also check out "How to Ask Questions the Smart Way."
Finally, I wasn't able to spot anything about the DATA filehandle in the
Posting Guidelines, nor using perldoc -q and looking for <DATA> or
filehandle, but I'll keep looking.
I really appreciate all your help.
--
Greg Raven, MRT
U.S. Racquet Stringers Association
PO Box 40
Del Mar, CA 92014
858-481-3545 vox ext. 18
858-481-0624 fax
------------------------------
Date: Tue, 04 Mar 2003 14:25:36 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Works offline but not online
Message-Id: <aod96v07l1v37d7lf4qoec9232emkk8t0l@4ax.com>
Johan Ljunggren wrote:
>> What *exactly* happens, or doesn't happen? Saying "it doesn't [work]"
>> is not particularly helpful.
>
>$rc = 256 and no HTML output.
256 = exit code 1
What does $! contain, after the failed function call?
--
Bart.
------------------------------
Date: Tue, 04 Mar 2003 16:01:33 +0100
From: Johan Ljunggren <Johan.Ljunggren@uab.ericsson.se>
Subject: Re: Works offline but not online
Message-Id: <hd39a.83$Or2.1124563@uab.ericsson.se>
On 2003-03-04 15:25, Bart Lateur wrote:
> Johan Ljunggren wrote:
>
>
>>>What *exactly* happens, or doesn't happen? Saying "it doesn't [work]"
>>>is not particularly helpful.
>>
>>$rc = 256 and no HTML output.
>
>
> 256 = exit code 1
>
> What does $! contain, after the failed function call?
>
Empty string.
------------------------------
Date: 04 Mar 2003 17:14:57 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Works offline but not online
Message-Id: <slrnb69nog.8tl.abigail@alexandra.abigail.nl>
Bart Lateur (bart.lateur@pandora.be) wrote on MMMCDLXXII September
MCMXCIII in <URL:news:aod96v07l1v37d7lf4qoec9232emkk8t0l@4ax.com>:
** Johan Ljunggren wrote:
**
** >> What *exactly* happens, or doesn't happen? Saying "it doesn't [work]"
** >> is not particularly helpful.
** >
** >$rc = 256 and no HTML output.
**
** 256 = exit code 1
**
** What does $! contain, after the failed function call?
The function call *didn't* fail. The system() was succesfull, so
there won't be any useful information in $!. Only if system()
itself failed (returning -1), $! will be set.
Abigail
--
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
. "\162\1548\110\141\143\153\145\162\0128\177" and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}
------------------------------
Date: Tue, 4 Mar 2003 15:56:04 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: XML to HTML
Message-Id: <L%39a.12126$EN3.97111@newsfep4-glfd.server.ntli.net>
Tore Aursand:
> Why don't you just (...) write a stylesheet for the XML file?
Varying browser support and various browser inconsistencies might be the problem
with that method.
Pete
------------------------------
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 4661
***************************************