[22734] in Perl-Users-Digest
Perl-Users Digest, Issue: 4955 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 7 18:10:53 2003
Date: Wed, 7 May 2003 15:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 7 May 2003 Volume: 10 Number: 4955
Today's topics:
Re: @Array - making it null (Anno Siegel)
Re: accept() -> "Interrupted System Call" <someone@somewhere.nl>
Re: Checking administrator rights (Gert Vanderstukken)
Extracting types of HTML links. (Thaddeus L. Olczyk)
Re: Extracting types of HTML links. <nobull@mail.com>
Re: foolproof requires (Analysis&Solutions)
Re: Forcing an rvalue context on a scalar expression <nobull@mail.com>
Re: Hash memory consumption <mhunter@celeste.net.berkeley.edu>
Re: How do you create a biniary file in Perl. <flavell@mail.cern.ch>
Match ascii codes in a reg exp (Thomas Richards)
Re: Match ascii codes in a reg exp <krahnj@acm.org>
Re: Match ascii codes in a reg exp <nobull@mail.com>
Parse::RecDescent: need help with actions and return va (J. H.)
Perl code to dump palm datebook? joe@jolomo.net
Perl Directories (SuperStar)
Re: Perl Directories <usenet@dwall.fastmail.fm>
Re: Perl Directories <nobull@mail.com>
Re: Perl Editor : Whats Recommended <greg@racquettech.com>
Re: Question about File test operators <TruthXayer@yahoo.com>
Re: Removal or HTML tags from pages <fxn@hashref.com>
Re: Removal or HTML tags from pages <abigail@abigail.nl>
Re: What is good to learn <cwilbur@mithril.chromatico.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 May 2003 21:46:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: @Array - making it null
Message-Id: <b9burj$1gb$1@mamenchi.zrz.TU-Berlin.DE>
Uri Guttman <uri@stemsystems.com> wrote in comp.lang.perl.misc:
> >>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
>
> AS> If I may presume to answer for Uri here, I don't think there is any
> AS> objection to using undef() with scalars.
>
> nah, don't speak for me :). i have been looking at all uses of undef and
> i find so few valid ones. in over 6k lines of one project, i have used
> it 3 times. and i don't do anything special to code around undef. i just
> don't think and design code where it is needed. there are so many ways
> to not use it that are clear and concise.
Oh, I agree. In all normal cases where a clear variable is needed,
my() does the job. The need to reset a variable to its pristine state
should rarely arise.
Note, however, that what Helgi was doing wasn't strictly necessary.
It concerned variables that had been declared and set (by split())
only for the purpose of giving instructive names to pieces of data.
This is "poetic" code that is there to talk to the reader, not to
accomplish something. Then, what more poetic way is there to express
"...but we don't need these:...", than to say "undef(); undef(); undef()"?
Or is that "codetic"?
> i know of a few cases where using undef to generate an undefined value
> is needed. one is where you are returning a value in a sub called in a
> list context. a plain return returns () which is different than return
> undef. you may actually want to have a real undef value in that
> list/array that gets the sub's values.
Yes, but that's rare. Most cases of "return undef" to signal failure
are an error. Simple return is the default way. In scalar context,
the caller will see an undef anyhow. In list context, there is only a
problem when an empty list is a valid result. Then other means must
be considered (most likely involving references or objects, which
takes us back to the scalar case).
> and if you want to be annoying (which i don't there) you can create
> undef values like:
>
> return do{ my $foo } ;
>
>
> but most cases of $foo = undef can be removed by decent design and use
> of scope. so that only leaves the above case and maybe a couple of
> others where it is needed. i tend to see use of undef as a red flag now.
I think the use is justified when it means what it does, put the variable
into its pristine state. So there is no better way than "undef $cache"
to invalidate a cache, because that's exactly what we want to do here.
In an extended way, it may be used in an interface to say "reset this
to the default", but I guess that may already raise objections.
Otherwise, in a code review, I would certainly see lots of explicit
undef's as a red flag. It is often just a side-effect of using package
variables where lexicals should be used.
Anno
------------------------------
Date: Wed, 7 May 2003 21:43:22 +0200
From: "Stefan" <someone@somewhere.nl>
Subject: Re: accept() -> "Interrupted System Call"
Message-Id: <3eb961b8$0$126$e4fe514c@dreader5.news.xs4all.nl>
"David" <spam@nospam.com> schreef in bericht
news:Co5ua.319$dv1.75455@newsfep2-gui.server.ntli.net...
> I'm a bit of a newbie at Perl, but I am trying to hack together a simple
> port forwarder.
> It seems to work fine under windows, but when I run it under Linux the
> accept() command
> occasionally fails with the error "Interrupted system call". Any idea what
> this means, why
> it's happening, and how to fix it?
>
> The perl versions I am using are:
> Windows: v5.8.0 built for MSWin32-x86-multi-thread
> Linux: v5.8.0 built for i386-linux-thread-multi
It seems Unix flavour independ - I've seen the same thing on SunOS and
FreeBSD. It's non-fatal and the solution/work-around is to redo the accept()
call if it wasn't successful the 1st time. See the sniplet of code below;
use Errno 'EINTR'; # or use a constant value of 4
ClientAccept: {
$ch = $ah->accept();
if ($! == EINTR) {
if ($ch) {
print "Non-fatal Interrupted system call in accept()\n";
} else {
print "Interrupted system call - redo accept()\n";
redo ClientAccept;
}
}
# --- rest of your server-code
}
If your looking for a complete description, try Google on "EINTR" and "perl"
and "accept".
Good luck,
Stefan
> My perl code is:
> #!/usr/bin/perl
>
> use IO::Socket::INET;
> use IO::Select;
> $SIG{CHLD} = sub {wait ()};
>
>
> if ($#ARGV+1!=3)
> {
> print ("Usage:\n");
> print (" portforward.pl [local_port] [remote_ip] [remote_port]\n\n");
> print (" local_port = The port to listen on.\n");
> print (" remote_ip = The IP address of the machine to forward the
> connection to.\n");
> print (" remote_port = The port on the remote machine to forward the
> connection to.\n\n");
> exit;
> }
> $| = 1;
> my $s = IO::Socket::INET->new(
> LocalPort => $ARGV[0],
> Type => SOCK_STREAM,
> Reuse => 1,
> Listen => SOMAXCON
> )
> or die "$ARGV[0]: Socket could not be created. Reason: $!\n";
> print ("$ARGV[0]: Listening on port $ARGV[0]\n");
> while ( $c = $s->accept() or die "$ARGV[0]: Cannot accept connection.
> Reason: $!\n" )
> {
> print ("$ARGV[0]: Received connection.\n");
> print ("$ARGV[0]: Forking...\n");
> $pid = fork();
> die "$ARGV[0]: Cannot fork: $!" unless defined($pid);
> if ($pid == 0)
> {
> # Child Process
> print ("$ARGV[0]: Connecting to remote server: $ARGV[1]:$ARGV[2]\n");
> my $r = IO::Socket::INET->new(
> PeerAddr => $ARGV[1],
> PeerPort => $ARGV[2],
> Proto => 'tcp',
> Type => SOCK_STREAM
> )
> or die "Couldn't connect! $!";
> print ("$ARGV[0]: Connection established.\n");
> my ( $bytes, $fh );
> my $select = IO::Select->new( $c, $r );
> LOOP: while (1)
> {
> foreach $fh ( $select->can_read(10) )
> {
> last LOOP unless ( defined( $bytes = sysread( $fh, $_, 4096 )));
> last LOOP if ( $bytes == 0 );
> last LOOP unless ( defined( syswrite( ( ( fileno($fh) == fileno($c) )?
> $r : $c ), $_, $bytes ) ) );
> }
> }
> close($r); close($c);
> print("$ARGV[0]: Client disconnected.\n");
> exit(0); # Child process exits when it is done.
> }
> # else 'tis the parent process, which goes back to accept()
> }
> close($s);
> print ("$ARGV[0]: Port forwarder listening on $ARGV[0] has died");
>
>
>
------------------------------
Date: 7 May 2003 12:22:14 -0700
From: gert.vanderstukken@pandora.be (Gert Vanderstukken)
Subject: Re: Checking administrator rights
Message-Id: <5eb4ae79.0305071122.35abcd9d@posting.google.com>
Thanks James,
it works great...
"James" <argonhigh@hotmail.com> wrote in message news:<G3Ota.3432$VJ.317819@news20.bellglobal.com>...
> > I'm sorry, but I cannot find the parameter to use. I'm using perl on a
> > Windows NT system.
>
> This will work
>
>
> ###
> use Win32::API;
> $isadmin = new Win32::API('advpack.dll', 'IsNTAdmin', 'NN', 'N');
> $status=$isadmin->Call(0,0);
> if($status != 0) { print "You are an administrator."; }
> else { print "You are not an administrator."; }
> ###
> #http://www.mentalis.org/apilist/IsNTAdmin.shtml
------------------------------
Date: Wed, 07 May 2003 20:49:15 GMT
From: olczyk@interaccess.com (Thaddeus L. Olczyk)
Subject: Extracting types of HTML links.
Message-Id: <3eb96f5e.163880515@nntp.interaccess.com>
Sorry to ask this here, as it is only peripherally related to Perl.
But many here often parse HTML so I think this may be one of the
better places to get a good answer.
I have a HTMl document and I want to extract all links and sort
them into two types: external, and internal.
The best way to describe them is this:
Image you load the page in a browser, as the browser displays
the page it encounters links and makes a decision. Some of the
links ( external ) are only loaded by user action. Others ( internal )
are automatically loaded with the page.
Examples are:
an anchor <A HREF=....> is external. You need to click on it to load.
an source <SRC IMAGE= ...> Loads a document ( usually an image )
imediately.
a frame <FRAME HREF=...> loads a document immediately ( usually a web
page ).
Basically I need a list of all such tags and their classification (
external or internal ). Can anyone help?
------------------------------
Date: 07 May 2003 22:19:30 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Extracting types of HTML links.
Message-Id: <u9smrqzc7x.fsf@wcl-l.bham.ac.uk>
olczyk@interaccess.com (Thaddeus L. Olczyk) writes:
> Sorry to ask this here, as it is only peripherally related to Perl.
> But many here often parse HTML so I think this may be one of the
> better places to get a good answer.
>
> I have a HTMl document and I want to extract all links
There's a module to do that on CPAN.
Looking for the terms "HTML", "link" and "extract" in close proximity
is left as an exercise for thge reader.
> and sort
> them into two types: external, and internal.
> Examples are:
> an anchor <A HREF=....> is external. You need to click on it to load.
> an source <SRC IMAGE= ...> Loads a document ( usually an image )
> imediately.
> a frame <FRAME HREF=...> loads a document immediately ( usually a web
> page ).
>
> Basically I need a list of all such tags and their classification (
> external or internal ). Can anyone help?
A full list of standard HTML tags and their meanings can be found
in, err...., the HTML standard.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 7 May 2003 20:13:16 +0000 (UTC)
From: info@analysisandsolutions.com (Analysis&Solutions)
Subject: Re: foolproof requires
Message-Id: <b9bpcs$cr8$1@reader1.panix.com>
In <gqphbv0u1pel8bef79f96d962vahh23hsb@4ax.com> Andrew Lee <spamtrap@nowhere.com> writes:
>On Wed, 7 May 2003 05:00:09 +0000 (UTC), info@analysisandsolutions.com
>(Analysis&Solutions) wrote:
>Eric is suggesting that you create a module for each language. That
>isn't (IMO) complex.
>Hope that makes sense -- I have not had my coffee yet ... :-\
Yes. You're making sense. But, I don't know if it's the best solution.
First, for the reason asked in my prior post:
>>Also, this seems to eliminate the ability to dynamically call
>>different languages on the fly.
For example, I wasn't able to do this in order to dynamically determine
the language used:
use language::ccvs_$Language;
Of course, as Eric suggested, programmers can call the language module,
and then my language modules call the main module. But to have this work
dynamically, it seems the programmers would have to create an if range
statement series evaluating $Language and then "use"ing the appropriate
language module. Certainly doable, but not as simple.
Also, this would necessitate the language files being a bit more complex.
I want them to be as stripped down as possible.
Finally, if a language file doesn't exist via use, Perl barfs, displaying
system path information, which isn't the best practice.
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
------------------------------
Date: 07 May 2003 20:46:37 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Forcing an rvalue context on a scalar expression
Message-Id: <u9brye1qw2.fsf@wcl-l.bham.ac.uk>
Steven Kuo <skuo@mtwhitney.nsc.com> writes:
> On 7 May 2003, Brian McCauley wrote:
>
> > Abigail <abigail@abigail.nl> writes:
> >
> > > foo (@q ? $q [-1] : undef)
> >
> > That's a very simple and elegant solution in the specific case of the
> > example of $q[-1] causing "Modification of non-creatable array value
> > attempted". You are focusing too closely on the simplified example
> > used to illustrate the question and not the actual question. In the
> > original situation I happend to encounter this was really more like
> > func()->[-1] where func() is quite expensive.
> But it seems that even if func()->[-1] were expensive, you could do
> this:
>
> bar(@{[func()->[-1]]});
Ah, yes. The famous @{[]} construct! I was forgetting that little
marvel (despite the fact that I use it often in other contexts).
Thankyou.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 7 May 2003 19:48:15 +0000 (UTC)
From: Mike Hunter <mhunter@celeste.net.berkeley.edu>
Subject: Re: Hash memory consumption
Message-Id: <slrnbbioks.10m.mhunter@celeste.net.berkeley.edu>
On 28 Apr 2003 18:33:13 GMT, ctcgag@hotmail.com wrote:
> > I followed a suggestion on this group to try pack'ing
> > values to be stored instead of storing array references, but it hasn't
> > helped much.
>
> Did you try tying it to disk?
Unfortunately it's actually a hash of hashes, so that isn't straight
forward. I was pointed at a class/package that does that but I couldn't
make it work.
> > My question is: Is there any way to reduce the consumption of the hash
> > data structure itself?
>
> Not feasibly. If eliminating the overhead from 5 million arrays didn't
> help, I doubt that decreasing the overhead from one hash is going to
> help, anyway.
My thought was that the data structure overhead was the problem, somehow.
> Large hashes are pretty memory efficient, at least for general purpose
> use. If you're use for the hash is not general purpose, I'd have to know
> what is non-general about your purpose before suggesting ways to improve
> it.
Basically I have
while (<HUGEDATA>)
{
my ($source, $dest, $d1,$d2,$d3,$d4,$d5) = split...;
$hash{$source}->{$dest} += [$d1,$d2,$d3,$d4...];
}
Of course with lots more code to make that actually work.
Thanks for your reply.
Mike
------------------------------
Date: Wed, 7 May 2003 20:04:54 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How do you create a biniary file in Perl.
Message-Id: <Pine.LNX.4.53.0305071958170.22309@lxplus013.cern.ch>
On Wed, May 7, Michael Carman inscribed on the eternal scroll:
> > No: when you're working with sockets then you're expected to be
> > reading and writing them as binary, so that the DOS newline semantics
> > don't come into play.
>
> The example makes two bad assumptions:
> 1) That there's been a binmode(SOCKET).
> 2) That the person reading it will realize that.
You're right.
> If you've never done socket programming, the need to use binmode() isn't
> obvious (after all, you're (often) writing text, aren't you?).
Yup. I think the key (although it wouldn't be obvious to a newcomer)
is that Perl's text semantics are designed for platform-native text
format. Whereas the conventional sockets format (with ASCII CRLF as
newlines) is designed to be platform-independent, and, as such, should
be kept away from platform-specific text semantics. Hence binmode();
> Also,
> since text IO is the default, the absence of an explicit binmode()
> implies that you *are* using the normal text semantics.
Yes, good point. Thanks.
------------------------------
Date: 7 May 2003 11:29:14 -0700
From: tom.richards@rocketmail.com (Thomas Richards)
Subject: Match ascii codes in a reg exp
Message-Id: <f118866.0305071029.62c591d4@posting.google.com>
I have a script that runs the following tr command on a file to delete
keystroke errors from a file so that it can be loaded into a database.
tr -d -A '\0-\11\13-\37\177-\377' < $FILE.bad > $FILE.good
I am looking for the perl reg exp that matches and prints any line in
the file $FILE.bad that was deleted by the tr.
Please can anyone help me to work out the reg exp to do this?
Thanks,
Tom
------------------------------
Date: Wed, 07 May 2003 19:55:48 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Match ascii codes in a reg exp
Message-Id: <3EB964A7.20658A5A@acm.org>
Thomas Richards wrote:
>
> I have a script that runs the following tr command on a file to delete
> keystroke errors from a file so that it can be loaded into a database.
>
> tr -d -A '\0-\11\13-\37\177-\377' < $FILE.bad > $FILE.good
^^
tr doesn't have an -A switch, at least mine doesn't. What does it do?
> I am looking for the perl reg exp that matches and prints any line in
> the file $FILE.bad that was deleted by the tr.
tr doesn't delete lines, it deletes characters. How do you expect perl
to match something that isn't there anymore?
John
--
use Perl;
program
fulfillment
------------------------------
Date: 07 May 2003 20:42:16 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Match ascii codes in a reg exp
Message-Id: <u9he861r3b.fsf@wcl-l.bham.ac.uk>
tom.richards@rocketmail.com (Thomas Richards) writes:
> I have a script that runs the following tr command on a file to delete
> keystroke errors from a file so that it can be loaded into a database.
>
> tr -d -A '\0-\11\13-\37\177-\377' < $FILE.bad > $FILE.good
>
> I am looking for the perl reg exp that matches and prints
You must be joking! You want a regex with a side-effect? That's
hideous!
> any line in the file $FILE.bad that was deleted by the tr.
Making a random guess at what -A means on tr (I don't have access to
your computer!)...
I belive the following regex will find a match in such lines:
/[\0-\11\13-\37\177-\377]/
I'm not going to show you how to make a regex with a side-effect of
printing because that's just way too strange.
Much better to say:
print if /[\0-\11\13-\37\177-\377]/;
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 7 May 2003 14:50:11 -0700
From: niles-igby@excite.com (J. H.)
Subject: Parse::RecDescent: need help with actions and return values
Message-Id: <102bcdfa.0305071350.4abc5476@posting.google.com>
I'm having difficulty getting Parse::RecDescent to do what
I want it to do. In particular, I'm unclear about how actions
should be used. I'm writing a parser for Oracle SQL*Loader
control files (if you are interested in their format, which can
be vastly more complicated than my little example, see Oracle's
TechNet--it's free to sign up--at this URL:
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/apa.htm#620714).
Anyways, I have the following simple Control File:
OPTIONS (ROWS=700, BINDSIZE=3494304, READSIZE=3494304, ERRORS=100000)
LOAD DATA characterset UTF8
APPEND
INTO TABLE some_table
FIELDS (
COLUMNA terminated by ',' enclosed by '"',
COLUMNB terminated by ',',
"COLUMNC" terminated by ',' enclosed by '"',
COLUMND CHAR(400) terminated by ',' enclosed by '"'
)
("COLUMNC" is double quoted so I can test that double quoted column
names are parsable--like the other column names, it's just an
arbitrary name for this example.)
Here's my grammar:
my $grammar = q{
File: options_statement(?) load_statement table_name field_list /\z/
{ \%item }
options_statement: /OPTIONS\s*\(/i parameter(s) /\s*\)/
{ $item{parameter} }
parameter: /(\w+)=(\d+),?/
{
my %options;
$options{$1} = $2;
\%options;
}
load_statement: is_continued characterset(?) load_type
{
my %load_params;
$load_params{is_continued} = $item{is_continued};
$load_params{characterset} = $item{characterset};
$load_params{load_type} = $item{load_type};
\%load_params;
}
is_continued: load_data_statement | continue_load_statement
load_data_statement: /LOAD\s+(?:DATA)?/i { 'N' }
continue_load_statement: /CONTINUE_LOAD/i { 'Y' }
characterset: /CHARACTERSET\s+(\w+)/i { $1 }
load_type: /INSERT/i | /APPEND/i | /REPLACE/i | /TRUNCATE/i { $1 }
table_name: /INTO\s+TABLE\s+(\w+)/i { $1 }
field_list: /FIELDS/i '(' column_spec(s) ')'
{ $item{column_spec} }
column_spec: column_name datatype(?) term_by(?) enc_by(?) /,?/
{
my %column_info;
$column_info{name} = $item{column_name};
$column_info{datatype} = $item{datatype};
$column_info{size} = $item{size};
$column_info{terminator} = $item{term_by};
$column_info{enc_char} = $item{enc_by};
\%column_info;
}
column_name: /"?(\w+)"?/ { $1 }
datatype: /\w+/ { $1 }
term_by: /TERMINATED\s+BY/i terms
terms: quoted_char | /WHITESPACE/i | hex_value
enc_by: /(?:OPTIONALLY\s+)?ENCLOSED\s+BY/i enc
enc: quoted_char | hex_value { $1 }
quoted_char: /'(.)'/ { $1 }
hex_value: /X'[0-9a-fA-F]+'/i
};
Currently, the grammar won't parse the final column specification
("COLUMND"); when I remove that line, it parses it.
My code does this:
$self->{'parser'} = Parse::RecDescent->new($grammar);
# $cf_text contains the control file from above
my $ret_val = $self->{'parser'}->File($cf_text);
print Dumper($ret_val), "\n";
I suspect that my problems center around incorrect actions.
What I was trying to do was to simply parse a control file and create
a data structure that I could return. I wasn't as interested in
making repeated calls to assemble values (such as column names and
attributes), but I could do that if necessary.
In the above, "terms" seems to work just fine, for example,
but when I changed the datatype subrule to the following two rules:
datatype: /\w+/ size(?) { $item{datatype} }
size: '(' /\d+/ ')' { $item{size} }
I had problems if I didn't include an action returning $item{whatever}.
I think I need some guidelines on the "hows" and "whens" of actions.
Specifically, parts of my grammar won't work unless I return
$item{whatever_the_subrule_is} for reasons that are unclear to me,
while other parts work just fine without that. I'm not sure which
actions I should be using: the top-level rule action, a mid-level
subrule action, or the lowest level action (or some combination
of them). Do they propagate upwards? Meaning, if I have the following:
some_rule: some_subrule
some_subrule: atom1 atom2
atom1: /\w+/
atom2: /\d+/
do I put actions foreach rule and subrule, and then in my some_rule
rule put in a hash or something that returns all of the values? Or is
it enough to just put in a top-level action like this:
{
my %hash;
$hash{atom1} = $item{atom1};
$hash{atom2} = $item{atom2};
\%hash;
}
My strategy so far has been to put actions and returns all over the
place and see what works, but this has met with limited success. :-(
I've read the documentation, but I haven't understood it very well
(clearly). Any suggestions would be appreciated.
TIA!
------------------------------
Date: Wed, 7 May 2003 20:32:10 +0000 (UTC)
From: joe@jolomo.net
Subject: Perl code to dump palm datebook?
Message-Id: <b9bqga$d5v$1@reader1.panix.com>
Does anyone have some perl code that will take the datebook.dat
file from the palm hot-sync and output the entries in a log format
something like:
2002 Dec 29 Sun 10:15 DFW -> ATL delta 1119
2003 Jan 9 Thu 14:00 Doctor appt
2003 Jan 9 Thu 16:00 Drinks @ Trader Vics
2003 Jan 12 Sun 13:00 Movie: It Happened One Night
ie only print lines for times when there is data. If not from
the datebook.dat maybe some other version of palm data (which?)
I've looked at pilot-link & the PDB module, but they don't
seem to do it.
Thanks for any help
--
Joe Morris
Live music in Atlanta http://jolomo.net/atlanta/shows.html
------------------------------
Date: 7 May 2003 12:34:42 -0700
From: mnabbas@hotmail.com (SuperStar)
Subject: Perl Directories
Message-Id: <95d0e029.0305071134.2491cdd6@posting.google.com>
Hi Folks,
Im a newbie at perl, I stumbled onto a problem with directories that I
thought maybe is a problem with my program. Im trying to write a
program which transverses a directory according to my input. When I
try to check for validity it complains that the directory is not
there.
1) Is there a way to check the parent directories of each Directory I
transverse i.e. the full path as in Java?
2) How do you use the directory function telldir, all i can figure out
is that it returns a position, whats that about?
3) Is there a simpler function maybe a module that I overlooked that
can help me with my transversing problem?
Regards in Advance,
Super *
------------------------------
Date: Wed, 07 May 2003 19:45:22 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Perl Directories
Message-Id: <Xns9374A047BED28dkwwashere@216.168.3.30>
SuperStar <mnabbas@hotmail.com> wrote:
[snip]
> Im trying to
> write a program which transverses a directory according to my
> input. When I try to check for validity it complains that the
> directory is not there.
[snip]
> 3) Is there a simpler function maybe a module that I overlooked
> that can help me with my transversing problem?
Perhaps
use File::Find;
will be helpful. Check the docs (perldoc File::Find) to see if it does
what you want.
------------------------------
Date: 07 May 2003 21:09:59 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl Directories
Message-Id: <u93cjq1pt4.fsf@wcl-l.bham.ac.uk>
mnabbas@hotmail.com (SuperStar) writes:
> Hi Folks,
>
> Im a newbie at perl, I stumbled onto a problem with directories that I
> thought maybe is a problem with my program.
What was the problem?
> Im trying to write a program which transverses a directory
What do you mean by "transverses a directory"?
> according to my input.
What do you mean by "according to my input"?
> When I try to check for validity
What do you mean by "I try to check for validity"?
> it
What do you mean by "it"?
> complains
What do you mean by "complains"?
> that the directory is not there.
What do you mean by "the directory is not there"?
If you try to read a directory that does not exist you get an error.
Do you consider thie to be a problem? If so why?
> 1) Is there a way to check the parent directories of each Directory I
> transverse i.e. the full path as in Java?
What is it that you want to check about the parent directories?
> 2) How do you use the directory function telldir, all i can figure out
> is that it returns a position, whats that about?
telldir() is relatively useless. It's return value should be consider
opaque - the only thing you can do with it is pass it to seekdir(). I
have never yet fould a use for telldir()/seekdir().
> 3) Is there a simpler function maybe a module that I overlooked that
> can help me with my transversing problem?
You have not described what you mean by transversing or the nature of
the problem.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 07 May 2003 18:21:18 GMT
From: Greg Raven <greg@racquettech.com>
Subject: Re: Perl Editor : Whats Recommended
Message-Id: <greg-907A8B.11212807052003@spectator.sj.sys.us.xo.net>
In article <vb5ff3962ji6cd@corp.supernews.com>,
"Chris" <chris_12003@yahoo.com> wrote:
> Is there an editor that will allow me to clearly see code thats in { }. I
> have a perl script that has lots of nested { } brackets and its hard for me
> to tell where the code stops and which else statements belong to which if.
> Will homesite do this or is there something else available?
>
> Thanks,
> Chris
At the risk of being PC-incorrect, I must point out that BBEdit
(http://www.barebones.com/) is a fantastic perl editor for the Mac
platform. Under OS9 in works alongside MacPerl, and on OS X it
works with the built-in perl. You get syntax coloring and a bunch
of other cool features, and BBEdit can check the syntax as well.
It's not free, but it works like crazy. If you just need crude
syntax coloring on the Mac, Hydra has it, along with the ability to
allow others to collaboratively edit your perl code (or any other
text) right along with you.
--
Greg Raven
U.S. Racquet Stringers Association
Solana Beach, CA
------------------------------
Date: Wed, 07 May 2003 11:15:15 -0700
From: TruthXayer <TruthXayer@yahoo.com>
To: Sateesh <trycarb@hotmail.com>
Subject: Re: Question about File test operators
Message-Id: <3EB94D33.A31F771E@yahoo.com>
Sateesh wrote:
> =
> Hi all,
> =
> I have a doubt regarding the usage of -M file test operator in perl :
> =
> The following perl code :
> =
> 1 #!/usr/local/bin/perl -w
> 2 use strict;
> 3 open(LIS,"ls |") || die "Cannot ls:$! \n";
> 4 while(<LIS>) {
> 5 chomp;
> 6 next if -d;
> 7 print "$_ \n" if -M < 1; # Question abt this line
> 8 }
> =
> throws up an error :
> Warning: Use of "-M" without parens is ambiguous at find.pl line 7.
> Unterminated <> operator at find.pl line 7.
Warning: Use of `%s` without parens is ambiguous
(S) You wrote a unary operator followed by something that
looks like a binary operator that could also have been
interpreted as a term or unary operator. For instance, if
you know that the rand function has a default argument of
1.0, and you write =
rand + 5;
you may think you
wrote the same thing as =
rand() + 5;
but in actual
fact, you got =
rand(+5);
So put in parentheses to say what you really mean. (You
could could be comparing String "-M" to be lt 1 as well). Be
clear in your code.
print if ((-M $_) < 1);
-- =
thanks
-Tr=DCtH
------------------------------
Date: Wed, 7 May 2003 19:06:49 +0000 (UTC)
From: Xavier Noria <fxn@hashref.com>
Subject: Re: Removal or HTML tags from pages
Message-Id: <b9blg9$s1q$1@news.ya.com>
In article <945bf980.0305070940.5431d0b2@posting.google.com>, Stephen Adam wrote:
: Just a quickie. I want to remove all tags, scripts etc from WWW pages
: leaving just the text a user would see and maybe parsing some of the
: meta content tags
HTML::Strip
-- fxn
------------------------------
Date: 07 May 2003 19:16:11 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Removal or HTML tags from pages
Message-Id: <slrnbbimrr.moj.abigail@alexandra.abigail.nl>
Stephen Adam (00056312@brookes.ac.uk) wrote on MMMDXXXVI September
MCMXCIII in <URL:news:945bf980.0305070940.5431d0b2@posting.google.com>:
`` Hi guys and girls,
``
`` Just a quickie. I want to remove all tags, scripts etc from WWW pages
`` leaving just the text a user would see and maybe parsing some of the
`` meta content tags, I know the perl cook book has some thing on it (I
`` may have to buy the book) though I am thinking the "HTML::Parser"
`` module would be my best bet.
Removing all tags from an HTML isn't at all the same as seeing the
text as a user. After all, if all webbrowsers would do was stripping
out HTML tags, what would be point of adding them in the first place?
If you want to remove HTML tags, see the FAQ. If you want to see the
page "as the user would see it", I'd do:
print `lynx -dump $url`;
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Wed, 07 May 2003 21:28:26 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: What is good to learn
Message-Id: <87llxio3tg.fsf@mithril.chromatico.net>
TruthXayer <TruthXayer@yahoo.com> writes:
> Charlton Wilbur wrote:
> >
> > Joe Creaney <mail@annuna.com> writes:
> >
> > > I would like to be able to get an entry level job programming. I am
> > > teaching myself C++ and Perl.
>
> > You also ought to be familiar with basic programming in
> > several *different* languages -- LISP or Scheme, Smalltalk, C, Eiffel,
> > Prolog, and Self.
>
> Wow! Are there jobs in LISP,C, and Prolog still around?
Yes, yes, and yes.
But more than that, it's not about learning syntax and quirks, it's
about learning different ways to think. The more ways you can solve a
problem, and the more experience you have in solving different
problems in different ways, the better your chances of solving the
problem that's set in front of you.
Once you've learned the set of programming languages I listed, nothing
in a new programming language will surprise you. It will always be
like this feature of Smalltalk, or like that feature of LISP, but
slightly different. You'll also have a frame of reference for
evaluating programming languages: when you actually have experience
with Eiffel and Smalltalk, you can take a look at C++ and Java and see
their warts and their strengths more clearly.
And I advocate this approach to learning, because this is the way I
was taught. I picked up the fundamentals of C++ in a weekend; how
could I not, since it was like a hash of C and Eiffel, but not as
elegant as either, and with an unnatural fixation on static
compile-time type checking? I never mastered all the details, but
that's more due to never having needed to or wanted to. I've done
similar things with Perl (which I use rather extensively) and Java
(which I've used maybe a half-dozen times in the last five years,
mainly for applets).
The flaw, of course, is that you don't have "Introduction to C++, 3
credits" on your resume. But after your first professional job, that
won't matter much anyway.
Charlton
------------------------------
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 4955
***************************************