[8093] in Perl-Users-Digest
Perl-Users Digest, Issue: 1712 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 23 09:08:09 1998
Date: Fri, 23 Jan 98 06:01:05 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 23 Jan 1998 Volume: 8 Number: 1712
Today's topics:
Re: Apache: Using SSI within perl script-generated web (Michael Budash)
character comparison... <dane@owlnet.rice.edu>
conditionally use a module <Hendrik.Klompmaker@net.iend.wau.nl>
Re: conditionally use a module (Mike Heins)
custom scripts (calling all perl and/or w3-msql experts <James@cydaps.nospam.co.uk>
Re: Cwd pragma/realpath conflict? (M.J.T. Guy)
DBD::mysql problem - please help! <rhakim@cyberus.ca>
DBD::Solid <kopenshaw_no_spam_please@netproducts.net>
Re: Determining file type (Lars Gregersen)
Re: Freidl's book mystery <joseph@5sigma.com>
Re: help -- use METHOD::PACKAGE; <rjk@coos.dartmouth.edu>
Help with an Array of instances (Dave Frascone)
Re: hi (Tad McClellan)
Re: HOw to check for file existence in each home direct <xxTony.Curtis@vcpc.univie.ac.at>
Looking for lib ndbm <bidouye@club-internet.fr>
Re: multi-line substitution (Tad McClellan)
Re: perl 5.003 negation bug? <rjk@coos.dartmouth.edu>
perl auto update: <jahnel@xarch.tu-graz.ac.at>
Re: Perl-script to binary? (Tad McClellan)
Re: Perl-script to binary? <danboo@negia.net>
Re: Q: How to view NT groups? (Win32::NetAdmin) (Betty Kainz)
Reading persistent logs <gking@c-com.net>
Re: References to parent objects (M.J.T. Guy)
Re: relational operators and negative numbers (Tad McClellan)
Setting up a LaTeX->file->printer system... (Jeeves)
Sort help please <andrew.spiers@virgin.net>
Re: Sort help please (Tad McClellan)
Re: Summary: help with sorting <joseph@5sigma.com>
Re: UNIX to %$$@! Win: Script Won't Go <danboo@negia.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 23 Jan 1998 00:16:05 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Apache: Using SSI within perl script-generated web page
Message-Id: <mbudash-2301980016060001@0.0.0.0>
In article <34c7a769.3220114@news.fast.net>, hunngai@fast.net (Gail Hunn) wrote:
>> Hi.
>>
>> I have a perl script that generates a web page, and the generated web
>> page includes a "virtual include" SSI.
>>
>> At the moment, this doesn't work. The dynamic page is generated, and
>> it contains the "virtual include" line as a comment, but it doesn't
>> execute it.
>>
>> I have the mod_include module compiled into Apache, and SSI works fine
>> in my static pages. The Options Includes statement is in the
>> access.conf file for my cgi directory.
>>
>> Can anybody steer me towards a solution for this? Thanks in advance.
strange...someone else asked this same question today... see:
http://www.apache.org/docs/misc/FAQ#ssi-part-iii
hth -
--
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736
------------------------------
Date: Fri, 23 Jan 1998 01:54:25 -0600
From: "Dane Christensen" <dane@owlnet.rice.edu>
Subject: character comparison...
Message-Id: <6a9i4q$aai$1@excalibur.flash.net>
Is there a way to alphebetically compare single characters?
I've tried ...elsif ($char1> $char2) {... but, unlike C, they don't
seem to be simply represented by numbers. Thx.
------------------------------
Date: Fri, 23 Jan 1998 11:41:33 +0100
From: Hendrik Klompmaker <Hendrik.Klompmaker@net.iend.wau.nl>
Subject: conditionally use a module
Message-Id: <34C873DC.4D18B7A1@net.iend.wau.nl>
Hi,
Is it possible to conditionally USE a module or not ?
eg. based on the availability of a module.
Something like this
$UseMD5 = 1;
if ($UseMD5) {
use MD5;
}
Obviously this doesn't work if MD5 isn't installed but how should it be
solved ?
TIA
Hendrik.
--
-----------------------------------------------------------------
|************** Wageningen Agricultural University. ************|
| Department of Information Management and Datacommunication |
-----------------------------------------------------------------
Hendrik Klompmaker: Senior Technologist
Internet : Hendrik.Klompmaker@Net.IenD.Wau.Nl
X400 : c=nl;a=400net;p=surf;o=wau;ou1=IenD
: ou2=Net;s=klompmaker;gi=hendrik
Phone : +31 (0)317-484059
Fax : +31 (0)317-482970
Snail : Dreijenplein 2
6703 HB Wageningen / The Netherlands
--------------------------------------------------------
------------------------------
Date: 23 Jan 1998 11:27:00 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: conditionally use a module
Message-Id: <6a9uq4$5b9$1@vixen.cso.uiuc.edu>
Hendrik Klompmaker (Hendrik.Klompmaker@net.iend.wau.nl) wrote:
: Hi,
:
: Is it possible to conditionally USE a module or not ?
: eg. based on the availability of a module.
:
: Something like this
:
: $UseMD5 = 1;
: if ($UseMD5) {
: use MD5;
: }
:
: Obviously this doesn't work if MD5 isn't installed but how should it be
: solved ?
:
BEGIN {
eval {
require MD5;
import MD5;
};
if($@) {
warn "MD5 module not available.\n";
$::Fallback_on_checksum;
}
}
I do something just like that in my application. MD5 doesn't
actually require import, for it is totally object-oriented, but
if you need the equivalent of "use" you will need to do the import.
--
Regards,
Mike Heins
This post reflects the
opinion of my employer.
------------------------------
Date: Fri, 23 Jan 1998 09:32:17 +0000
From: James <James@cydaps.nospam.co.uk>
Subject: custom scripts (calling all perl and/or w3-msql experts)
Message-Id: <5nudORAhOGy0EwcG@cydaps.co.uk>
I, as the company's web designer (but not a programmer!) have been asked
by my boss to create a searchable database for the company's new website
due out soon. I was wondering if anyone would be interested in creating
a perl script that searches a pipe delimited text file exported from
Access 97 onto a UNIX server running Perl5?
The site will be used for searching though jobs, IT and Finance
especially with upto 20,000 jobs in the database at any one time, but
normally the average will be around 10,000. An example of what I have
been asked to create can be found at http://www.job.co.uk/cgi/w3-msql/-/
jobs/searchform.htm
There will be a constantly changing list of Areas and Categories within
the Access database, so somehow this would need to be echoed on the
search page (perhaps by separate files listing areas and categories etc,
I don't know! :-( ). At the moment this company are using mSQL on a
UNIX server which makes a difference I know, but obviously it is
possible to do exactly the same sort of thing with standard perl
scripts, it is just whether it is possible to keep track of changes to
the Areas and Categories drop down menus?
Would this be something you would be interested in doing for me, and if
so, what sort of price do you think would be involved and how long would
it take? I am having to pay for this out of my own pocket as my boss
assumes that I should be able to programme in Perl even though I stated
that I do HTML, graphics and a *tiny* bit of Perl!
Basically, if the cost is not too great and it is possible to do this
script so that the user only has to export one text file from Access and
it can be done quickly then it is almost certain that I shall go ahead
with the script.
I am based in the UK so everything would have to be done by email /
phone (would that be a problem for a project like this?)
Below is a example of how the text file that will be exported from
Access 97 database. There may be one or two extra fields but nothing too
dramatic. Is it possible from a file like this to search in the same
method as the job.co.uk web site I mentioned above and also to create
the search form on the fly based on the data from the text file (ie
create the drop down menus for Area and Category from the data in the
delimited text file)?
1|a-ref|Agency Name|Category|Skills|Description|Location|Area|Contact|Po
st Date|Expiry Date|Email|WebSite|
[This is all one line, just wrapped in most mail programs]
The alternative is to use the same w3-mSQL as job.co.uk have, but I
received a quote for this at around #320,000 ($35,000 or so I think
that equates to! Ouch!!!!), so a perl option would be better unless you
can create solutions in w3-mSQL for less!
I have managed to create a basic search script myself, but it is not
wonderful and this needs to be reliable, robust and able to do what is
necessary all from the one text file if possible!!!
Best wishes, and thanks for any help with this!!
James
------------------------------
Date: 23 Jan 1998 08:50:15 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Cwd pragma/realpath conflict?
Message-Id: <6a9lk7$84a$1@lyra.csx.cam.ac.uk>
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>In article <34C6C429.5616@cruzio.com>,
> Chuck Sheldon <csheldon@cruzio.com> writes:
>> Have you seen the symptoms generated by the following script?
>
>Displays the same problems for me.
>
>> If so, please clue me in to what causes it.
>
>I don't, but you might want to submit it as a bug with perlbug, and see what
>happens.
I see no bug, except in the script provided.
As perlfunc makes clear, $! is only set on a *failing* system command.
In other circumstances, it typically contains historical junk.
So only look at $! if $linkvalue is false.
Mike Guy
------------------------------
Date: Fri, 23 Jan 1998 06:36:04 GMT
From: Richard Hakim <rhakim@cyberus.ca>
Subject: DBD::mysql problem - please help!
Message-Id: <34C83A53.580DDCF0@cyberus.ca>
Hi -
I'm getting the following error message at my call to
$dbh = DBI->connect("DBI:mysql:$database",$user,$password);
perl: can't resolve symbol 'dirty'
perl: can't resolve symbol 'perl_destruct_level'
install_driver(mysql) failed: Can't load
'/usr/lib/perl5/site_perl/i386-linux/auto/DBD/mysql/mysql.so' for module
DBD::mysql: Unable to resolve symbol at
/usr/lib/perl5/i386-linux/5.00401/DynaLoader.pm line 155, <> chunk 4.
at (eval 3) line 2
DBI::install_driver('DBI', 'mysql') called at
/usr/lib/perl5/site_perl/DBI.pm line 329
DBI::connect('DBI', 'DBI:mysql:Timesheet', 'hakim', 'yomama')
called at ./timesheet-insert.cgi line 43
Does anyone have any ideas? It seems to be a problem with perl5db.pl,
or maybe with my install of DBD::mysql, but it seems extraordinary to me
that such a standard module wouldn't work...I'm running RedHat Linux
with the latest DBI. My DBD::mysql came from the
RPM Mysql-DBI-perl-bin-3.21.21a-1, which is the latest one I can find.
I've loaded mysqld with the option to ignore grant tables, so it isn't a
permissions problem. And by reading the second-last line of the error
message, I can see that the variables are all producing correct values
in the connect() call.
In short, I'm stumped. Can anyone help?
Thank you,
Richard Hakim
richard@kokoro.com
------------------------------
Date: 23 Jan 98 10:14:34 GMT
From: "Karen" <kopenshaw_no_spam_please@netproducts.net>
Subject: DBD::Solid
Message-Id: <01bd27e2$d0c97e00$4b9798c3@karen.nchannel.com>
Hi All,
I'm trying to get into the basics of the Solid DB with Perl. I've installed
the modules and my /usr/lib/perl5/site_perl/DBD directory has:
DBD -> drwxr-xr-x Solid -> -r--r--r--Const.pm
-> -r--r--r-- Solid.pm
-> -r--r--r-- other pms
and my @INC has /usr/lib/perl5/site_perl in it.
I'm trying a very basic example which came with the Solid DBD and an error
is reporting:
Can't find loadable object for module DBD::Solid::Const in @INC
(/usr/lib/perl5/i386-linux/5.00401 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
/usr/lib/perl5/site_perl/DBD/Solid.pm line 14
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/DBD/Solid.pm
line 14.
BEGIN failed--compilation aborted at ./test.pl line 8.
Solid.pm line 14 reads: use DBD::Solid::Const qw(:sql_types);
test.pl line 8 reads: use DBD::Solid;
Can anyone help? The files are where they should be (I've also tried
symlinks under /usr/lib/perl5/site_perl and /usr/lib/perl5/site_perl/DBD to
no avail)
Thanks in advance
------------------------------
Date: Fri, 23 Jan 1998 09:51:56 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: Determining file type
Message-Id: <34c862e2.588466@130.228.3.8>
[p&m]
On 19 Jan 1998 22:25:41 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
wrote:
>In article <34C2F0A8.3F15D7@5sigma.com>,
> "Joseph N. Hall" <joseph@5sigma.com> writes:
>
>> I am sure that I have seen some discussion of a module along the
>> lines of the file(1) command, but now I can't find it. Well, ok,
>> maybe I was dreaming.
>
>Now that you mention it.. I seem to recall something about that as
>well, but it probably was a long time ago. I can't find anything on
>CPAN. I guess the person suggesting it never got around to actually
>implement it.
There is a reference to a programme called magic made in Perl that
implements file in the following URL:
http://fohnix.metronet.com/perlinfo/scripts/assorted/magic.pl.info
I guess that the author David W. Sanderson <dws@ssec.wisc.edu> never
finished the work because I can't find it (but would be very glad to
know if anyone else have).
Lars
Lars Gregersen, M.Sc. Chem. Engng.
Department of Chemical Engineering, DTU, Denmark
E-mail: lg@kt.dtu.dk
Homepage: http://www.gbar.dtu.dk/~matlg/
------------------------------
Date: Fri, 23 Jan 1998 06:28:07 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Freidl's book mystery
Message-Id: <34C89A00.60B1D6B2@5sigma.com>
Sheesh, give me a break. OK, here's the one from my book, which
is not particularly fast but is at least comprehensible.
# Split on strings and delimiters.
for (split m!("(:?\\\W|.)*?"|/\*|\*/)!) {
if ($in_comment) {
$in_comment = 0 if $_ eq "*/" # Look for */ if in a comment.
} else {
if ($_ eq "/*") { # Look for /* if not in a comment.
$in_comment = 1;
print " "; # Comments become a space.
} else {
print; # If not in a comment, print.
}
}
}
If I wanted this to be faster, I'd write an XSUB, not a long regex.
Using regexes for comment preprocessing (and tokenizing in general)
is, well, basically a losing approach if you like speed.
But that's just me. It all depends on what you want and how you
feel like doing it.
-joseph
http://www.effectiveperl.com
Gabor wrote:
>
> In comp.lang.perl.misc, Joseph N. Hall <joseph@5sigma.com> wrote :
> # m{/\*(.*?)\*/} is correct. However, it wasn't that simple before
> # the advent of *?. There are a couple of points being made. (1)
> # it is very difficult to express certain "non-greedy" constructs
> # with greedy regular expressions, and (2) which one is more efficient
> # is not necessarily obvious.
>
> Actually, it's not correct. Try something with a comment delimiter
> embedded.
>
> /*
> puts("hello */ world");
> */
------------------------------
Date: Fri, 23 Jan 1998 02:01:11 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Justin Vallon <vallon@pearl.fi.bear.com>
Subject: Re: help -- use METHOD::PACKAGE;
Message-Id: <34C84037.90FBB5AA@coos.dartmouth.edu>
[posted and mailed]
Justin Vallon wrote:
>
> Also, if you need to adjust @INC, it must be done at compile-time via a BEGIN
> block, because the 'use' files are located during compilation, not execution.
Or you can do it in the recommended way (which happens to be the way the original
user was doing it):
use lib 'path/to/lib';
Chipmunk
------------------------------
Date: Fri, 23 Jan 1998 04:29:40 GMT
From: chaos@mindspring.com (Dave Frascone)
Subject: Help with an Array of instances
Message-Id: <34c81bc5.142403637@news.mindspring.com>
I am trying to make an array of instances. For some reason, I can't
quite get it to work. This is not my exact code, but this is what I
am trying:
package Something;
@Instances=();
sub initialize {
my $instance;
my $i;
for $i (0 .. 10) {
$instance = Something->new($i);
push @Instances, $instance;
}
}
When I get out of the loop, and look at @Instances, all of them are
the same! (They contain the same data.) I've tried storing
references (push @Instances, \$instance)
And, I've tried putting the my inside the for loop.
I know this must be a stupid question, but if you know what I'm doing
wrong, please e-mail me @ chaos@mindspring.com.
Thanks in advance,
Dave
------------------------------
Date: Fri, 23 Jan 1998 01:01:47 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: hi
Message-Id: <r8f9a6.lf7.ln@localhost>
Your Subject header sucks.
(because it does not give the subject!)
Alexander Kovalenko (luckycom@ica.net) wrote:
: hey guyz
^^^^
Groovy lingo there dude.
: any idea how i can chmod file from my script ?
By calling perl's builtin chmod() function?
(documented in the 'perlfunc' man page)
Was that a trick question or something?
: 'cause it seems that just
: system ("chmod","660 test.dat");
That looks like some other kind of chmod (because you usually stick
a zero in front to get octal interpretation in perl).
Don't know why you'd want to fork off another process, when you
can do it right from within perl...
: does not work out...
Care to describe what doesn't work?
See any error messages?
Smell any smoke or anything? ;-)
You should ask to be informed of problems executing your system() call:
die "system() call failed $!" if system ("chmod","660 test.dat");
^^
^^ this will often give a good clue...
: so any ideaz would be appreciated!
^^^^^
There's that Oh So Cute snazzy lingo again. You're really styling.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 23 Jan 1998 10:03:07 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: roberts_d@bms.com
Subject: Re: HOw to check for file existence in each home directory of Unix users
Message-Id: <7xd8hjh8ac.fsf@beavis.vcpc.univie.ac.at>
Re: HOw to check for file existence in each home directory
of Unix users, Dan <roberts_d@bms.com> said:
Dan> Hello What I need to do is check for the existence of a
Dan> .forward file in each of my users homme directories.
Dan> Then, if there is no .forward file in the users hoem
Dan> dir I would get that users loginid printed to a file.
Dan> Can someone help me out here??
The following are likely to be needed:
getpwent()
! -f $forward
"man perlfunc" is the place to start.
hth,
tony
------------------------------
Date: Fri, 23 Jan 1998 11:57:24 +0000
From: STOCK Fridiric <bidouye@club-internet.fr>
Subject: Looking for lib ndbm
Message-Id: <34C885A4.5781@club-internet.fr>
Hello,
I'm looking for lib ndbm to compile Perl5.003 under SCO Unix R3.2V4.2
with Gcc 2.7.2.2
Thank's
--
00 00
Fridiric STOCK
00 00
------------------------------
Date: Fri, 23 Jan 1998 06:34:07 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: multi-line substitution
Message-Id: <vn2aa6.i29.ln@localhost>
Brendan Macmillan (bren@fangorn.cs.monash.edu.au) wrote:
: I want to match across lines - just like a C-style comment, which can
: begin:
: /*
: on one line, and end
: */
: on another.
from the Perl FAQ, part 6:
"How do I use a regular expression to strip C style comments from a file?"
: It seemed to me that some of the options for s/// would do just that -
: but I haven't had any luck; eg
: s/\\footnote{([^}]*)}/\[$1\]/ #use options g, s m??
: only catches those on a single line. I remember doing this in sed;
: but how in perl?
Looks OK to me. Do you actually _have_ a multiline string in $_ ?
from the Perl FAQ, part 6:
"I'm having trouble matching over more than one line. What's wrong?"
: Thanks!!
Uh huh.
Two FAQs in one post. Efficient...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Jan 1998 02:11:48 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: "Vladimir Z. Nuri" <vznuri@netcom.com>
Subject: Re: perl 5.003 negation bug?
Message-Id: <34C842B4.260EF8C4@coos.dartmouth.edu>
[posted and mailed]
Vladimir Z. Nuri wrote:
>
> after a lot of dinking around trying to track down a subtle
> bug, I ran into the following.
> the following program execution baffles me:
>
> #!/usr/bin/perl5.003
>
> $x = "-4";
> print(-$x, "\n");
> $x = -4;
> print(-$x, "\n");
>
> this program outputs:
>
> +4
> 4
>
> running perl 4.0, I get
>
> 4
> 4
It's either a bug in perl4 or a new feature in perl5.
>From Programming Perl 2nd Ed, pg 80:
Unary minus performs arithmetic negation if the operand is numeric. If the
operand is an identifier, a string consisting of a minus sign concatenated
with the identifier is returned. **Otherwise, if the string starts with a
plus or minus a string starting with the opposite sign is returned.**
In general, it doesn't matter whether a scalar is a 'number' or a 'string',
but there are a few cases where it makes a difference. This is one of them.
I would suggest changing the expression to
-$x + 0
to force a numeric interpretation. That will drop a '+', but leave a '-'.
Chipmunk
------------------------------
Date: Fri, 23 Jan 1998 10:39:19 +0100
From: Jahnel Klaus <jahnel@xarch.tu-graz.ac.at>
Subject: perl auto update:
Message-Id: <34C86547.1D2DE812@xarch.tu-graz.ac.at>
is it possible to reload a perl script every 10 seconds to put out new
datas?
Klaus
------------------------------
Date: Fri, 23 Jan 1998 00:48:18 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl-script to binary?
Message-Id: <ife9a6.7e7.ln@localhost>
Martin Osmundsvaag (martino@tor.hb.uib.no) wrote:
: How to make a binary exe-file out of a perl script.
: Is there a perl2c program? Where to find info about it?
The same place you find out about MOST things perly.
In the documentation that *** you already have ***.
It comes with the perl distribution.
from the Perl FAQ, part 3:
"How can I compile my Perl program into byte code or C?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Jan 1998 01:07:58 -0500
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Perl-script to binary?
Message-Id: <34C833BD.8CB4A82B@negia.net>
check out the FAQ list at:
http://language.perl.com/faq/index.html
or, to review the previous discussions, do a search at:
http://www.dejanews.com
dan "doing a little community service" boorstein ;)
Martin Osmundsvaag wrote:
>
> Hi!
> How to make a binary exe-file out of a perl script.
> Is there a perl2c program? Where to find info about it?
>
> Thanks in advance..
> --
> - Martin O.
------------------------------
Date: 23 Jan 1998 10:27:00 +0100
From: midimani@site88.ping.at (Betty Kainz)
Subject: Re: Q: How to view NT groups? (Win32::NetAdmin)
Message-Id: <6mR1ut5hdNB@site88.ping.at>
Hi Jason !
On 22 Jan 98 junk@sober.com wrote :
> I've been looking at Win32::NetAdmin and Win32::AdminMisc but I
> have not found a way to list NT groups.
I've been looking desperately for the same thing, but unfortunately
it seems that neither of the modules provide a solution.
Maybe we could ask Dave Roth about this after he's settled in
and is back on the net.
> Anyone know a workaround?
...ugly, but yes, there is one. ;-)
You can get the list of groups by using the NT "net" command:
net group /DOMAIN
What you get is a less-than-lovely 3-column list. ;-)
Try it from the command line, and you'll see what I mean.
However, it is at least parsable with Perl. :^)
If you have problems, feel free to drop me a line.
....hope it helps, :-)
Betty
------------------------------
Date: Fri, 23 Jan 1998 07:35:07 -0600
From: Greg King <gking@c-com.net>
Subject: Reading persistent logs
Message-Id: <34C89C8B.E4208F79@c-com.net>
How do you setup a Perl program to look for incoming logs messages going
to a log file without terminating?
For example : then command tail -f filename opens a log file and then
displays the incoming messages as they are written. How would this be
done in Perl?
thanks and also please email me : gking @ c - com . net
------------------------------
Date: 23 Jan 1998 09:51:31 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: References to parent objects
Message-Id: <6a9p73$a4j$1@lyra.csx.cam.ac.uk>
Dan Sumption <dan@gulch.demon.co.uk> wrote:
>
>The situation is thus:
>- I have a page object, which contains a number of properties (e.g.
>title, author, content)
>- The page object may also have a number of unspecified file objects,
>each of which holds different ways of representing the data within the
>page.
>- For the file object to write its own particular version of the page,
>it needs to access the page's data (title etc.), and the best way I
>can see of doing this is by storing a reference to the parent object
>within the file structure.
That will work OK. I do that sort of thing all the time.
But be warned that because your data structures have loops, they will
never be automatically destroyed - the reference counts will always
be > 0. You'll need to provide an explicit function which breaks
the loops, allowing the data to go away.
Mike Guy
------------------------------
Date: Fri, 23 Jan 1998 00:45:05 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: relational operators and negative numbers
Message-Id: <h9e9a6.7e7.ln@localhost>
Michael Rocchetti (miker@miracle.net) wrote:
: Dear God - I pray that this is not a stupid question.....
he, he...
: I want to compare numbers and execute a bad_entry subroutine if b is greater
: than a.
: The code looks like this:
: &bad_entry if ($FORM{'b'} > $FORM{'a'});
: this seems to work well when both a and b are positive numbers - but it
: doesn't work when one or both of the numbers are negative.
Why don't you give us an example of a couple of negative numbers
that aren't doing what you expect. Something like:
---------------
#!/usr/bin/perl -w
$FORM{'a'} = -5;
$FORM{'b'} = -1;
print "bad entry\n" if ($FORM{'b'} > $FORM{'a'});
---------------
outputs:
bad entry
Seems OK to me...
: Am I doing something wrong? How do I use numeric relational operators to
: compare negative numbers?
The same way you compare positive numbers.
: Any help would be greatly appreciated.
Any code (that we can run) illustrating your problem would be
greatly appreciated.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 23 Jan 1998 07:33:15 GMT
From: darlenem@PAS.DE.SPAM.flash.net (Jeeves)
Subject: Setting up a LaTeX->file->printer system...
Message-Id: <slrn6cgj01.gdb.darlenem@jeeves.flash.net>
Since I migrated to Linux from Win95 a few months ago, I've been writing
documents in HTML and carrying them a win95 machine at work that runs Netscape
(my machine here is a 486-25 w/ 4MB ram and about 140M hd, of which 20 or so is
free). I've heard great reviews of LaTeX and Ghostscript for publishing under
Linux, and I'd definitely like to have more control over the formatting of my
text. So my question is this: how do I set up a system where I can write in
LaTeX, use ghostscript and/or whatever filtering software is necessary to print
it from an HP Deskjet 680C that's connected to a distant (not connected at all)
Win95 box? Ideally, I was thinking that the rendering software would give me
some kind of binary file that I could somehow send directly to the DeskJet from
the Win95 box. I'm pretty sure this is possible, but the docs for apsfilter
were extremely intimidating and seemed to imply that support for remote
printers was sketchy, let alone unconnected imaginary printers. How do I go
about setting this up? Can I do it in 15M?
The second thing is that I need to learn LaTeX =) All the tutorial- and
reference-style documents I've come across were in .dvi or .ps format, which as
yet I cannot read. Can anyone point me to a good source of plaintext or HTML
info?
Thanks,
Jeeves (darlenem@spamless.flash.net)
--
---------------------------------------------------------------------
J | Copyright (c) 1997 Jeeves Industries Limited.
J | All rights reserved. Void where prohibited.
J | Some restrictions may apply. Limit 1 per customer.
J J | Offer not valid in conjunction with any other offer.
JJJ | Some sold separately. Not intended for children under 3.
---------------------------------------------------------------------
>From .cshrc:
alias rm 'rm -rf \!*'
alias hose kill -9 '`ps -augxww | grep \!* | awk \'{print $2}\'`'
alias kill 'kill -9 \!* ; kill -9 \!* ; kill -9 \!*'
alias renice 'echo Renice\? You must mean kill -9.; kill -9 \!*'
=====================================================================
------------------------------
Date: Fri, 23 Jan 1998 11:14:12 +0000
From: Andrew Spiers <andrew.spiers@virgin.net>
Subject: Sort help please
Message-Id: <34C87B83.B2F51586@virgin.net>
Can someone help me please ? I have been trying to get my sort to work
but I cant. Several of you have offered advice but I still cant get it
to work. Below is the code I am using. The file contains a list of name
i.e.
Bob Jones
John Smith
John Smith
The object of the script is to count the number of entries for each
person and display them in rank order with the number of entries and the
percentage.
Many thanks,
open (VOTE,"$voting_log") || die "Can't open file: $_ $!\n";
while (<VOTE>) {
my $name = $_;
$total{$name}++;
$final_total++;
}
close (VOTE);
for $name1 (sort { $temp{$a} cmp $temp{$b} } keys %total) {
$percentage = sprintf("%.2f",(($total{$name1} / $final_total) *
100));
my $name2 = $name1;
chomp($name2);
print pre("<b>$name2</b> has $total{$name1} votes which is
$percentage %");
}
------------------------------
Date: Fri, 23 Jan 1998 07:20:25 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Sort help please
Message-Id: <pe5aa6.ib9.ln@localhost>
Andrew Spiers (andrew.spiers@virgin.net) wrote:
: Can someone help me please ? I have been trying to get my sort to work
: but I cant. Several of you have offered advice but I still cant get it
: to work. Below is the code I am using. The file contains a list of name
[snip]
: for $name1 (sort { $temp{$a} cmp $temp{$b} } keys %total) {
^^^
cmp compares strings.
<=> compares numbers.
The values in %temp are numbers.
(worthless choice of name there, %count or
something that has some relationship to what is
stored in it is a Good Idea.
)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Jan 1998 06:42:29 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
To: Michael D Sohn <msda+@andrew.cmu.edu>
Subject: Re: Summary: help with sorting
Message-Id: <34C89D5D.DB3BD0F0@5sigma.com>
Also see
http://www.effectiveperl.com/recipes/sorting.html
'fieldsort' should work fer ya.
-joseph
Michael D Sohn wrote:
>
> I wrote:
>
> : I have a table of information that is delineated by tabs that I want to
> : sort. The problem is that the column that I want to sort on is in
> : scientific notation. For example:
>
> Thanks to Andrew J., Andrea G., Tad M. and Bryan W. for the solution.
> Tad's answer was the most complete.
------------------------------
Date: Fri, 23 Jan 1998 01:23:30 -0500
From: Dan Boorstein <danboo@negia.net>
Subject: Re: UNIX to %$$@! Win: Script Won't Go
Message-Id: <34C83762.25425AA5@negia.net>
N.A.F. McNelly wrote:
> Is there anyone who knows perl for Windows who can tell me what's
> going wrong here?
>
> His error messsage is:
>
> Can't open first gif. at C:\perl\datef\test.pl
> line 9, <stdin> chunk 1.
>
> The short test.pl script is:
>
> #!/usr/local/bin/perl
> use GD;
> print "Enter The Desired Name of the Output File: ";
> $name=<STDIN>;
> $last=".gif";
> $nme=$name . $last;
> open (GIF,"start.gif") || die ("can't open first gif");
can't be sure, but it may a path problem.
try giving it a full path like:
$file = 'C:/perl/datef/start.gif';
open (GIF, $file) || die "$file: $!";
as a general rule i usually put my filenames within a variable.
that way i can use them in the die as well, and be sure
that they are what i thought they would be.
and just so you know. $nme is going to look kind of funny.
don't forget to chomp $name.
dan boorstein
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1712
**************************************