[10778] in Perl-Users-Digest
Perl-Users Digest, Issue: 4379 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 8 12:07:21 1998
Date: Tue, 8 Dec 98 09:00:25 -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 Tue, 8 Dec 1998 Volume: 8 Number: 4379
Today's topics:
$|=0 om7@cyberdude.com
3 perl cgi questions... <chrknudsen@hotmail.com>
Re: 80 column conversion (John Moreno)
Re: Beginner Book? (Nnickee)
Can't locate auto/Net/FTP/cd.al in @INC ... <brandeda@se.bel.alcatel.be>
Does LWP/libwww module work with Win32 Perl? tyrosine@usa.net
flock doesn't flock under perl/linux andrewc@newtonsols.net
Re: Help: How to send email with attached multimedia fi <preble@ipass.net>
HELP: need to add features to "Mailing List Manager 3.0 (JT)
Re: HELP: need to add features to "Mailing List Manager (brian d foy)
Link problem 5.005_02 and SunOs 4.1.3_U1 geoffrey@iname.com
Re: Need Help on code! (Tad McClellan)
Need Help. ccboone@amber.indstate.edu
Re: Not a subroutine reference <ayoung@sigg.com>
Re: Not a subroutine reference <ayoung@sigg.com>
Re: Not a subroutine reference <ayoung@sigg.com>
Re: Not a subroutine reference <ayoung@sigg.com>
Re: panic: leave_scope inconsistancy (Peter Hamilton)
Re: Perl and Btrieve Support selitskiy@my-dejanews.com
Re: Perl Cookbook <samuel.patton@wichita.boeing.com>
Re: Perl/ Win32: Displaying a msgbox/dialog box on a r (Matthew H. Gerlach)
Regular Expression: Irregular spacing in email message (Chris Murray)
Re: Regular Expression: Irregular spacing in email mes <Allan@due.net>
Re: Regular Expression: Irregular spacing in email mes andrewc@newtonsols.net
Re: Regular Expression: Irregular spacing in email mes (Tad McClellan)
Send a non U.S charset mail gatzonis@OTENET.GR
shift. om7@cyberdude.com
Re: shift. andrewc@newtonsols.net
Re: shift. (brian d foy)
timelocal and localtime with negative values? (Andreas Schildbach)
Tkperl Binary for Linux Redhat 5.1 Wanted!!! <bond@ei.kodak.com>
Use Lib LIST fails with perlis.dll?? mwilliams@europarl.eu.int
Use script to send Standard Form Input? jday@microcal.com
Re: Why i can't "localize through a reference" in perl <feng_xian@mitel.com>
Re: Why i can't "localize through a reference" in perl <feng_xian@mitel.com>
Re: Why i can't "localize through a reference" in perl (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 08 Dec 1998 15:22:08 GMT
From: om7@cyberdude.com
Subject: $|=0
Message-Id: <74jg6t$uci$1@nnrp1.dejanews.com>
Can someone please tell what $|=0 does.
I've read it up, and understand that it flushes the buffer or something.
[Is that correct?]
And why would you need to use it?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 08 Dec 1998 14:53:18 GMT
From: "Christian H. Knudsen" <chrknudsen@hotmail.com>
Subject: 3 perl cgi questions...
Message-Id: <366D3E6F.6FE7768A@hotmail.com>
1) Is it possible for a cgi perl script to check if a file
on a remote server server exists? Check the size?
Ex.:
$exists = -e "http://www.blah.com/images/image.gif";
$size = -s "http://www.blah.com/images/image.gif";
When I run these, the script can't find the designated
file. (Naturally I have tested these on files that _do_
exist...)
2) Is it possible to check the dimensions of an image
file (width x height)?
3) How do you make a script that first reads/writes to
some files, then reloads a new page?
Ex.:
open (FILE, "...");
.
.
.
close (FILE);
print "Location: http://www.blah.com";
When I run this I get a "Premature end of script headers" error.
I guess this is because the lack of a "Content-type: ..." header.
But, if I include such a header the "Location: ..." header is
simply printed on the screen!
I've thought about simply reading the file of the page I want to
reload and then "print" line by line. But this doesn't change the
URL location...
Any help is appreciated!
-- Christian H. Knudsen
------------------------------
Date: Tue, 8 Dec 1998 11:57:52 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: 80 column conversion
Message-Id: <1djpudu.xiwfwa1nnbjusN@roxboro0-060.dyn.interpath.net>
I.J. Garlick <ijg@csc.liv.ac.uk> wrote:
> bart.lateur@skynet.be (Bart Lateur) writes:
> > I.J. Garlick wrote:
> >
> >>Don't like Text::Wrap, does screwy things with lines of characters greater
> >>than the max column width when there are no spaces in the line.
> >
> > What WOULD you like it to do? I can only think of two possibilities:
> >
> > A) Split the word that is too long onto chunks of at most 80 characters
> > B) Don't split the word, leave it as a chunk that is far too long
> >
> > Neither seems ideal. I don't know what Text::Wrap does, I haven't used
> > it yet.
>
> Agreed. However I would be happy with either.
>
> But Text::Wrap does, soemthing altogether weirder. If the line has no
> spaces and is greater than the column width specified it seems to save the
> line until it has finished with the rest and then print it out at the end.
>
> The two situations you specify I could do something about if I wanted to,
> what actually happens is impossible to deal with as the line is out of
> context and you don't know where to re-insert it.
>
> Apparently, according to Eric (see other posts), this is what the author of
> Text::Format didn't like and why that module was written. Going to have a
> good play with that to day, it maybe easier than continueing to wrestle with
> my attempt. (I was getting close but I had reached my limits on reg exps I
> feel.)
A easy way to do it with regex in case you don't like Text::Format (I
recently wanted to wrap while maintaining a prefix so I've written my
own) is to do it recursively -- loop and use a regular expression like:
$preferred_length=72;
$max_length=80;
$min2wrap=$max_length-$preferred_length;
$rest_of_line =~ s/(.{1,$preferred_length})(\s.{$min2wrap,})/$1/ if (length $rest_of_line > $max_length);
# but what if the line doesn't have any
if (length $rest_of_line > $max_length) {
$rest_of_line =~ s/(.{1,$preferred_length})(.+)/$1/;
}
# and get ready to send it, while saving the leftover
$send_line_text = $rest_of_line;
$text_wrapped_from_last_line = $2;
> I knew if I lurked long enough something good would come of reading this
> group, but this is the first time what I am currently trying to do has come
> up as a specific topic just in time.
>
> Anyway thanks to all of the Perl gurus who have been helping me without
> knowing it.
The above is part of a function to wrap while keeping a prefix (testing
some stuff for doing wrapping and rewrapping of usenet articles), if
you'd to see the whole thing just ask.
--
John Moreno
------------------------------
Date: Tue, 08 Dec 1998 16:34:57 GMT
From: nnickee@nnickee.com (Nnickee)
Subject: Re: Beginner Book?
Message-Id: <36705353.3866761@news.centuryinter.net>
On Tue, 08 Dec 1998 11:09:46 +0000, 23_skidoo
<23_skidoo@geocities.com> wrote:
>> > paulwade@my-dejanews.com wrote:
>> > > In article <3650788e.14819289@news.newsguy.com>,
>> > > jeff.kennedy@natdecsys.com (Jeff Kennedy) wrote:
>> > > > I need a book geared to an ABSOLUTE BEGINNER! No perl experience, no
>> > > > programming experience, no real shell scripting experience.
Might I suggest "Perl 5 for Dummies" without fear of 32 camels showing
up to take a dump on my front lawn?
Perl is my first language too (not counting html which just barely
(IMO) counts as a language) and P5FD was my first choice. Easy to
understand and work with, and comes with a CD with the various perls
for whatever OS you're running.
Now I'm looking for my second book, something with a little more meat
in it, geared towards win32. Suggestions? (Yes, I've read the faq, I
want opinions now :)
Nnickee
------------------------------
Date: Tue, 08 Dec 1998 15:41:22 +0100
From: David Van den Brande <brandeda@se.bel.alcatel.be>
Subject: Can't locate auto/Net/FTP/cd.al in @INC ...
Message-Id: <366D3A92.141E2CCB@se.bel.alcatel.be>
Can someone help me to solve this problem:
"Can't locate auto/Net/FTP/cd.al in @INC (@INC contains:
/usr/local/lib/perl5.004/sun4-solaris/5.004 /usr/local/lib/perl5.004
/usr/local/lib/perl5.004/site_perl/sun4-solaris
/usr/local/lib/perl5.004/site_perl .) "
here is my script:
#!/usr/local/bin/perl5 -w
use Net::FTP;
..
<CUT>
...
$fullpath="/mydirectory";
ftp($fullpath);
...
<CUT>
...
sub ftp
{
my $ftp = Net::FTP->new("btm24z");
$ftp->login("luypaerd","daniel7");
$ftp->cd (@ARGV[0]); # or $ftp->cd (@_);
$ftp->ls ("-l list.txt");
$ftp->quit;
}
Thanks,
David
--
V David Van den Brande, Trainee at
----------------- Alcatel Switching VE27
| A L C A T E L | Fr. Wellesplein 1 - 2018 Antwerp - Belgium
----------------- mailto:brandeda@se.bel.alcatel.be
------------------------------
Date: Tue, 08 Dec 1998 15:45:12 GMT
From: tyrosine@usa.net
Subject: Does LWP/libwww module work with Win32 Perl?
Message-Id: <366d47dc.1532316244@news.randori.com>
Hello,
I was wondering if anyone knows if the LWP/libwww perl module is
compatible with the Active State win32 Perl? If it is compatible can
it be used locally (in an ISP user account) situations by modifying
the @INC in such a way...
'********* Obtained from newsgroup posting **********
BEGIN {
push( @INC, "/mymodules");
}
to modify @INC.
'************************************************************
Is their a site/resource that might list those modules that are
compatible with win32? Thank you for any assistance.
-Derek
------------------------------
Date: 8 Dec 1998 14:58:42 GMT
From: andrewc@newtonsols.net
Subject: flock doesn't flock under perl/linux
Message-Id: <366d3ea2.0@mercury.nildram.co.uk>
Keywords: flock perl linux
I'm been driven to hair-tearing distraction trying to get flock() working
under Perl 5.005_02 on intel/linux 2.0.36. Note that I understand the
principles of file locking and have successfully used flock under Perl on
various platforms before.
Here's the offending code:
--------------------------------------------------------------------------
use Fcntl;
sub GetUserDetails
{
my $user=shift(@_);
my %details;
local (*USER);
open (USER,"$USER_DIR/$user") || return;
print "We opened the file OK\n".
if (!flock(USER,LOCK_SH))
{
close USER;
return;
}
print "We got past flock\n";
[snip]
}
-------------------------------------------------------------------------
When this is run, flock always returns FALSE and the subroutine exits. It
never gets to "We got past flock".
As I understand it, flock can only do three possible things when called just
with LOCK_SH:
1. It can obtain the lock and return TRUE
2. It can wait for the lock to be available
3. "Produces a fatal error if used on a machine
that doesn't implement flock(2), fcntl(2)
locking, or lockf(3)"
But yet, none of these is happening. Flock is simply immediately returning
FALSE.
I recompiled Perl, paying attention to what Configure thought about locking,
and it has defined HAS_FLOCK.
Elsewhere in the same package I have a routing which is the reverse of the
above - it opens the file for writing, calls flock with LOCK_EX, and writes
the details to the file before closing it. This works perfectly.
Can anyone enlighten me as to what's going on here? I must confess I have no
idea what to try next.
--
Andrew Crawford
+44 1883 626244
------------------------------
Date: Tue, 8 Dec 1998 11:18:30 -0500
From: "E. Preble" <preble@ipass.net>
Subject: Re: Help: How to send email with attached multimedia files uploaded from a form?
Message-Id: <Vkcb2.929$kx1.1286@news.ipass.net>
I've written a script called automail_lite that can email out a
binary attachment.
It uses formmail (by matt wright) as a base code, and MIME::TOOLS
to send the email.
See
http://www.datatrendsoftware.com/automail_lite.html
HTH
Edward Preble
Datatrend Software
http://www.datatrendsoftware.com
mailto:info@datatrendsoftware.com
Grab It! software for Excel 97
Digitizes data from charts and graphs
-----------------------------------------------------------------
wwv1@inclab09.cs.depaul.edu wrote in message
<366C0388.F0030AC0@hotmail.com>...
Hello,
I'm a new user of perl. Is there anybody can tell me how to
send
email with attached files uploaded from a form? I'm using HP Unix
platform and Apache server.
Any help will be greatly appreciated. Thank you.
Jane
------------------------------
Date: Tue, 08 Dec 1998 14:00:13 GMT
From: jett1not@homedot.com (JT)
Subject: HELP: need to add features to "Mailing List Manager 3.0" (2nd try)
Message-Id: <36732f11.5790407@news>
I'm using Selena Sol's Mailing List Manager 3.0 to maintain a fairly
large mailing list, the problem is that when a mailing is sent the
script relies on an open browser connection to display results as each
address on the list is sent. As a result, I'm getting timeouts which
cause the script to fail. I am able to disable this feature easy
enough, but the script seems to choke even with the browser update
disabled.
I'd like to do two things:
First, I'd like to have the script send maybe 100 addresses at a time,
pause for a predermined amount of time, then proceed to the next 100,
pause, etc... until the entire list has been sent. I seem to be
having problems on the server even with sending small lists out and
I'm thinking that perhaps I'm forking too many processes or "choking"
sendmail.
also, I'd like to have the script log a simple counter file upon
completion of the list, containing the number of messages which were
actually sent.
I'm only able to test the script with a handful of my own email
addresses and I don't think that my conditions are matching what the
sendmail encounters on the "working" list (slow servers, bounced mail,
etc..).
I'm a newbie to writing Perl scripts from scratch, but if somebody can
point me in the right direction, I'm fairly certain I can incorporate
the changes and get it to run. I do have "Programming Perl" from
O'Reilly, however I've just started into the book and I'm not yet able
to solve this problem.
TIA
-JT
Remove the "not" and delete the "dot" to reply
jett1not@homedot.com
------------------------------
Date: Tue, 08 Dec 1998 09:38:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: HELP: need to add features to "Mailing List Manager 3.0" (2nd try)
Message-Id: <comdog-ya02408000R0812980938420001@news.panix.com>
In article <36732f11.5790407@news>, jett1not@homedot.com (JT) posted:
> I'm using Selena Sol's Mailing List Manager 3.0 to maintain a fairly
> large mailing list, the problem is that when a mailing is sent the
> script relies on an open browser connection...
why not use something more robust like majordomo? it has a web
interface called majorcool, and it doesn't chain you to the
browser to send the mail. it's probably a lot nicer to resources
than your current solution too :)
btw, majordomo and majorcool are both written in Perl.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 08 Dec 1998 15:44:15 GMT
From: geoffrey@iname.com
Subject: Link problem 5.005_02 and SunOs 4.1.3_U1
Message-Id: <74jhgf$vnl$1@nnrp1.dejanews.com>
Using gcc version 2.7.2.3, I see
Running Mkbootstrap for B ()
chmod 644 B.bs
LD_RUN_PATH="" gcc -o ../../lib/auto/B/B.so -L/usr/local/lib B.o
collect2: ld returned 2 exit status
ld: Undefined symbol
_PL_markstack_ptr
....
All of the symbols are in libperl.a, but adding that to the
command line noes not change the situation.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 8 Dec 1998 09:16:49 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need Help on code!
Message-Id: <1tfj47.l9r.ln@metronet.com>
Matt Schuette (schuette@umr.edu) wrote:
: I didn't know $`, $&, and $' slowed it down. Thanks for setting me
: straight!
It is in the fine documentation for Perl's Regular Expressions
(perlre.pod):
-----------------------
Once perl sees that you need one of C<$&>, C<$`> or C<$'> anywhere in
the program, it has to provide them on each and every pattern match.
This can slow your program down. The same mechanism that handles
these provides for the use of $1, $2, etc., so you pay the same price
for each pattern that contains capturing parentheses. But if you never
use $&, etc., in your script, then patterns I<without> capturing
parentheses won't be penalized. So avoid $&, $', and $` if you can,
but if you can't (and some algorithms really appreciate them), once
you've used them once, use them at will, because you've already paid
the price. As of 5.005, $& is not so costly as the other two.
-----------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 08 Dec 1998 15:24:17 GMT
From: ccboone@amber.indstate.edu
Subject: Need Help.
Message-Id: <74jgau$ukr$1@nnrp1.dejanews.com>
I need to be able to execute a script from within perl as another user.
example
I need to restart a process that needs to be ran by xxx, but I am root. The
process has to be ran by xxx. Can someone point me in the right direction.
Please email me at ccboone@amber.indstate.edu
Thanks in advance,
Charles Boone
Unix System Admin -- Indiana State University
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 08 Dec 1998 10:16:52 -0600
From: Aaron Young <ayoung@sigg.com>
Subject: Re: Not a subroutine reference
Message-Id: <366D50F4.14DE1609@sigg.com>
> It's not that I don't believe you or anything
I guess what I'm wondering about is should I get the error message where
the actual dereferencee is taking place?
> Look for code that attempts to dereference a value as a subroutine.
>
> For example:
>
> $sub = sub { print "$_[0]\n"; };
> $arr = ["foo"];
>
> &$sub('bar'); # good
> &$arr('bar'); # bad!
>
------------------------------
Date: Tue, 08 Dec 1998 10:30:12 -0600
From: Aaron Young <ayoung@sigg.com>
Subject: Re: Not a subroutine reference
Message-Id: <366D5414.6AC8FECB@sigg.com>
Here's some other strange behavior this thing is exhibiting
if I comment out the close(M) then it will go around once then give me the
Not a Subroutine Reference error on the open
(this is sending out a mail everytime a file is processed)
No i know that it has to be earlier in the code, I just can't figure out
where
and if I don't mail, then the thing will chug along as if nothing's wrong
what could cause that kind of behavior?
Aaron Young wrote:
> More information
>
> I went ahead and rolled a small module to send mail off (much simpler than
> Mime::Lite) and got the same error which confirms my suspicions that it
> wasn't the module (though I never really thought it was)
>
> it seems I get the error on the
>
> close(M) line in my program and the close(SENDMAIL) line in MIME::Lite
>
> I could include the code here but it is quite a bit
>
> I'm just wondering what type of things to LOOK for
>
> Aaron Young wrote:
>
> > Perl People,
> >
> > I'm writing this app (in Perl) and I am suddenly getting this error Not
> > a Subroutine Reference.
> >
> > I have found some information about it, but not much.
> >
> > What I have seen is that this is me trying to use a reference to a
> > non-function as a function.
> >
> > the only thing is, I can't seem to find where I'm making the mistake.
> >
> > What types of things should i be looking for? Is there a known
> > suspicious construct?
> >
> > by the way, the error shows up in MIME::Lite (which works beautifully
> > otherwise, except when I call it from my program in a certain spot)
------------------------------
Date: Tue, 08 Dec 1998 10:41:29 -0600
From: Aaron Young <ayoung@sigg.com>
Subject: Re: Not a subroutine reference
Message-Id: <366D56B9.481806EC@sigg.com>
> I forgot to mention
I'm using objects for everything
I don't &function anything it's all $obj->function
------------------------------
Date: Tue, 08 Dec 1998 10:55:24 -0600
From: Aaron Young <ayoung@sigg.com>
Subject: Re: Not a subroutine reference
Message-Id: <366D59FC.813E1002@sigg.com>
#$SIG{CHLD} = \TAO::Queue::_REAPER();
Well, I knew it was somthing "I" was doing but I had no idea it would trace
back to this
Thank you to Ronald for helping out with the example
Now all I have to do is go back and try and figure out why I thought the above
code snippet was a good idea
(I was making this whole program multi-process, but I have the call to the
fork'ing subroutine commented out, but it appears that something else was
signalling the child and thus I was getting the Not a Subroutine Reference)
ayoung
------------------------------
Date: Tue, 08 Dec 1998 15:49:55 GMT
From: peter@cityc.co.uk (Peter Hamilton)
Subject: Re: panic: leave_scope inconsistancy
Message-Id: <366d42c2.19050586@gateway1>
Many thanks to both Tye McQueen and Ilya Zakharevich for their
suggestions and help, it's very much appreciated.
Tye McQueen wrote:
>My first guess is that the strange errors are caused by out of
>memory conditions that are not being detected by Perl (perhaps
>because they are happening when some library routine is allocating
>memory, for example).
Yes, we've come to the conclusion it's Perl or the system's reaction
to low resources, and we're now keeping a close watch on streams
memory. Currently we've got steams set to 8Mb, and may up this to the
maximum of 12. When streams run out, SCO simply crashes!
Ilya Zakharevich wrote:
> If something is doing this, it is your CRTL. Complain to your
> compiler vendor (you did not include perl -V output, did you?). As a
> workaround your buggy system, try $| = 1;
This is definately a possibility and yes, we've disabled buffering.
We often have 300 open pipes handling large amounts of data. After a
period of time (a few days), we think EAGAIN error messages are being
generated causing data to be resent in an endless loop, making certain
processes grow, causing the system to run out of resources.
We're tracking the problem closely.
Peter Hamilton
------------------------------
Date: Tue, 08 Dec 1998 15:51:46 GMT
From: selitskiy@my-dejanews.com
Subject: Re: Perl and Btrieve Support
Message-Id: <74jhuh$v$1@nnrp1.dejanews.com>
In article <366c6ac1.344535869@news.mmc.org>,
> You could, however, write a service that runs on an NT box connected to
> your Netware server that would handle database requests from your Linux box
> and make the requisite ODBC requests. Not for the faint of heart, but
> possible.
You can find such a thing on
http:\\www.geocities.com\SiliconValley\Horizon\5151
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 8 Dec 1998 16:37:32 GMT
From: "Sam Patton" <samuel.patton@wichita.boeing.com>
Subject: Re: Perl Cookbook
Message-Id: <F3nnID.LBH@news.boeing.com>
Yes very good book. However, if you work strictly in WinNT you have a lot
of translating to do.
Kevin W. Reed wrote in message <366bfbcf.0@news.redrose.net>...
>The Perl Cookbook from O'Reilly is pretty good. Just got it for a
>B-Day... Lots of solutions in it....
>
------------------------------
Date: Tue, 8 Dec 1998 16:37:57 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: Perl/ Win32: Displaying a msgbox/dialog box on a remote display?
Message-Id: <gerlachF3nnJA.7w7@netcom.com>
I'm probably going out on a limb here, but your question isn't really
a perl question per say. It is a win32 windowing question. You are
trying to get one PC generate an image on another PC. While Xwindows
is designed from the ground up for this sort of thing, Windows from
Micro$oft is not designed well for this sort of thing.
What you could do is create a program on the display PC "listening" for
display requests and have the PC generating the display "talk" to that program
and ask it to actually display a message box. Depending on your needs
this display server could be quite simple, or you could just use an Xserver
running on the PC.
Good Luck,
Matthew
In article <366C1142.875CA0E@ti.com> kpifer@ti.com writes:
>Howdy!
>
>I have met with very limited success finding an answer to this by reading the
>documentation for Perl modules I've found.
>
>Perl for Win32, I want to display a msgbox/dialog box on a remote PC, of the
>flavor that InitiateSystemShutdown does, given the computer name \\something or
>an IP address.
>
>Does anyone know where I can find, or if there is, a module that has this
>functionality and if there i any documentation on how to use it.
>
>Thanks,
>Kurt Pifer
>
>
------------------------------
Date: Tue, 08 Dec 1998 14:27:54 GMT
From: chris.murray@spam.pwgsc.gc.ca (Chris Murray)
Subject: Regular Expression: Irregular spacing in email message
Message-Id: <366d32b8.65086990@news.pwgsc.gc.ca>
Greetings all. I have an email message I would like to split into
seperate variables for input into an SQL database. (ie I would like to
split the product number 1008x into a seperate variable, the
description in another, etc...) The data source is an email of
product ids, description, prices and product categories. The problem
is this: I can't figure out a regular expression to split the data
into their seperate variables.
There is irregular spacing between the product number, description,
price and category code. However, each column starts at the same
location offset each time (Product_Number starts at column number 2,
description starts at column number 22, etc...)
Below is an example of the data and format The banner header
(Product_Number Description etc, repeats thoughtout the text file)
Product_Number Description Price Cat
-------------------- ------------------------------ ------------ ---
1032X OPT SERIAL PARALLEL CONT W/SW 1000.00 X
1212X OPT SBUS SUNISDN EXP KIT 1.0.3 500.00 X
1414X 16/4MBIT TOKEN RING INTERFACE 1000.00 X
1118X OPT SBUS SFE FWSCSI ADAPTER 1000.00 X
1519X OPT SBUS HSI/S INCL. SW 2000.00 X
1221X OPT SBUS PRESTOSERVE NFS ACCEL 3000.00 X
1225X OPT SBUS SAS FDDI 5.0 W/SW 2500.00 X
1336X OPT SBUS DAS FDDI 5.0 W/SW 4000.00 X
1552X OPT INT PCI 10/100BASET NIC 300.00 X
1653X OPT INT PCI 10/100BASET NIC 600.00 X
1434Y OPT QFE PCI CARD W/SW 1800.00 Y
1935Z OPT INT SUNFDDI/P SAS 1.0 2487.00 Z
Any thoughts or pointers to sources from the Perl community would be
gratefully received.
Perl version is 5.004_04 on a Solaris 2.6 box.
Thanks,
Chris
#(Please remove the double bang (!!) in my mail message for any mail
# replies)
------------------------------
Date: Tue, 8 Dec 1998 10:21:14 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Regular Expression: Irregular spacing in email message
Message-Id: <74jfrs$j5u$1@camel18.mindspring.com>
Chris Murray wrote in message <366d32b8.65086990@news.pwgsc.gc.ca>...
>Greetings all. I have an email message I would like to split into
>seperate variables for input into an SQL database. (ie I would like to
>split the product number 1008x into a seperate variable, the
>description in another, etc...) The data source is an email of
>product ids, description, prices and product categories. The problem
>is this: I can't figure out a regular expression to split the data
>into their seperate variables.
>
>There is irregular spacing between the product number, description,
>price and category code. However, each column starts at the same
>location offset each time (Product_Number starts at column number 2,
>description starts at column number 22, etc...)
Fixed length records always say unpack to me.
perldoc -f unpack
Just as an example, if you were to clean up your file so that it only
contained the data you could try something like:
#!/usr/local/bin/perl -w
use strict;
my ($in,@info);
open(DATA,"example.txt") or die "An ugly death due to $!";
while (chomp ($in = <DATA>)) {
@info = unpack("A21A36A8A2",$in);
#record lengths: 21 ascii chars, 36 chars, 8 chars, and 2 chars
# "A" strips trailing spaces and nulls, "a" does not
print join ("\n",@this);
}
or you could do something like:
($prod_num,$disc,$price,$cat) = unpack("A21A36A8A2",$in);
you get the idea.
HTH
AmD
>#(Please remove the double bang (!!) in my mail message for any mail
># replies)
would have mailed but the instructions were too confusing for me.
------------------------------
Date: 8 Dec 1998 15:22:29 GMT
From: andrewc@newtonsols.net
Subject: Re: Regular Expression: Irregular spacing in email message
Message-Id: <366d4435.0@mercury.nildram.co.uk>
Chris Murray <chris.murray@spam.pwgsc.gc.ca> wrote:
> Greetings all. I have an email message I would like to split into
> seperate variables for input into an SQL database.
[snip]
> Product_Number Description Price Cat
> -------------------- ------------------------------ ------------ ---
> 1032X OPT SERIAL PARALLEL CONT W/SW 1000.00 X
> 1212X OPT SBUS SUNISDN EXP KIT 1.0.3 500.00 X
I'm sure there are plenty of more elegent solutions to this than mine (and I
would certainly appreciate seeing them) but this will do the job for you.
And anyway, "there's more than one way to do it", and the best way is the
way that isn't broken :)
The trick is to anchor the regexp at the beginning "^" AND the end "$" of
the line. I'm sure there's ways to improve the efficiency of this match, and
it would even be possible to do extract the data without using regexps at
all, which might be faster - but would certainly take longer to program up.
----------------------------------------------------------------------------
#!/usr/bin/perl
while (<>)
{
if (/^\s*(\S+)\s+(.+\S)\s+(\d\S+)\s+(\S+)$/)
{
$num=$1;
$desc=$2;
$price=$3;
$cat=$4;
print "num=$num, desc=\"$desc\", price=$price, cat=$cat\n";
}
}
----------------------------------------------------------------------------
For the data set you gave, this produces:
num=1032X, desc="OPT SERIAL PARALLEL CONT W/SW", price=1000.00, cat=X
num=1212X, desc="OPT SBUS SUNISDN EXP KIT 1.0.3", price=500.00, cat=X
num=1414X, desc="16/4MBIT TOKEN RING INTERFACE", price=1000.00, cat=X
num=1118X, desc="OPT SBUS SFE FWSCSI ADAPTER", price=1000.00, cat=X
num=1519X, desc="OPT SBUS HSI/S INCL. SW", price=2000.00, cat=X
num=1221X, desc="OPT SBUS PRESTOSERVE NFS ACCEL", price=3000.00, cat=X
num=1225X, desc="OPT SBUS SAS FDDI 5.0 W/SW", price=2500.00, cat=X
num=1336X, desc="OPT SBUS DAS FDDI 5.0 W/SW", price=4000.00, cat=X
num=1552X, desc="OPT INT PCI 10/100BASET NIC", price=300.00, cat=X
num=1653X, desc="OPT INT PCI 10/100BASET NIC", price=600.00, cat=X
num=1434Y, desc="OPT QFE PCI CARD W/SW", price=1800.00, cat=Y
num=1935Z, desc="OPT INT SUNFDDI/P SAS 1.0", price=2487.00, cat=Z
--
Andrew Crawford
+44 1883 626244
------------------------------
Date: Tue, 8 Dec 1998 10:19:04 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regular Expression: Irregular spacing in email message
Message-Id: <ohjj47.bbs.ln@metronet.com>
Chris Murray (chris.murray@spam.pwgsc.gc.ca) wrote:
: Greetings all. I have an email message I would like to split into
: seperate variables for input into an SQL database. (ie I would like to
: split the product number 1008x into a seperate variable, the
: description in another, etc...) The data source is an email of
: product ids, description, prices and product categories. The problem
: is this: I can't figure out a regular expression to split the data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: into their seperate variables.
Well, don't use a regular expression then ;-)
: There is irregular spacing between the product number, description,
: price and category code. However, each column starts at the same
: location offset each time (Product_Number starts at column number 2,
: description starts at column number 22, etc...)
perldoc -f substr
perldoc -f unpack
either of those are likely to help with fixed-field-width stuff.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 08 Dec 1998 15:15:49 GMT
From: gatzonis@OTENET.GR
Subject: Send a non U.S charset mail
Message-Id: <74jfr2$u7b$1@nnrp1.dejanews.com>
HI,
my perl program has to email a file that is written in
a language other than US. I am confused on what I need
to do. UUencode? Mime?.
If Mime is the case what type do I use. Do I need to
sent it as an attachment.
Thanks for any help
Evan
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 08 Dec 1998 15:19:24 GMT
From: om7@cyberdude.com
Subject: shift.
Message-Id: <74jg1q$u8q$1@nnrp1.dejanews.com>
Can someone please tell me what the following does
my $variablename = shift;
It's being called inside a sub routine.
Thanks.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 8 Dec 1998 15:43:55 GMT
From: andrewc@newtonsols.net
Subject: Re: shift.
Message-Id: <366d493b.0@mercury.nildram.co.uk>
om7@cyberdude.com wrote:
> my $variablename = shift;
It removes the first value in the @_ array and puts it in $variablename. @_
is (amongst other things) where the parameters to a subroutine go when it
is called.
(If you're not in a subroutine, shift does the same thing with @ARGV, the
array of command line parameters to the program. But you said it's in a
subroutine.)
So;
--------------------------------------------------------------------------
sub bleh
{
# at this point, @_ is "eat","my","shorts"
my $a=shift; # now @_ is "my","shorts"
my $b=shift; # now "shorts"
my $c=shift; # now it's empty!
print "$a $b $c";
}
&bleh("eat","my","shorts");
--------------------------------------------------------------------------
would output..
--------------------------------------------------------------------------
eat my shorts
--------------------------------------------------------------------------
--
Andrew Crawford
+44 1883 626244
------------------------------
Date: Tue, 08 Dec 1998 12:00:12 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: shift.
Message-Id: <comdog-ya02408000R0812981200120001@news.panix.com>
In article <74jg1q$u8q$1@nnrp1.dejanews.com>, om7@cyberdude.com posted:
> Can someone please tell me what the following does
>
> my $variablename = shift;
sri[6] perldoc -f shift
=item shift ARRAY
=item shift
Shifts the first value of the array off and returns it, shortening the
array by 1 and moving everything down. If there are no elements in the
array, returns the undefined value. If ARRAY is omitted, shifts the
@ARGV array in the main program, and the @_ array in subroutines.
(This is determined lexically.) See also unshift(), push(), and pop().
Shift() and unshift() do the same thing to the left end of an array
that pop() and push() do to the right end.
--
brian d foy <brianNOSPAM@NOSPAM.smithrenaud.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
remove NOSPAM or don't. it doesn't matter either way.
------------------------------
Date: Tue, 08 Dec 1998 15:21:19 GMT
From: andreas.schildbach@rkdnet.de (Andreas Schildbach)
Subject: timelocal and localtime with negative values?
Message-Id: <366d4367.8399618@news.mediaways.net>
Hello everybody,
I want to express dates before 1.1.1970 with the usual time() based
"data types". Someone told me that timelocal and localtime deals with
negative numbers to express these dates, but this isn't the case with
my perl version (5.005_02 build on Win32-x86).
Is there any truth to the above?
Thanks for any information.
- Andreas
------------------------------
Date: Tue, 08 Dec 1998 11:40:55 -0500
From: Thomas Bond <bond@ei.kodak.com>
Subject: Tkperl Binary for Linux Redhat 5.1 Wanted!!!
Message-Id: <366D5697.BBAA3E6@ei.kodak.com>
Hi All,
Could anyone tell me where I might find a Tkperl binary for Intel
based Linux Redhat 5.1.
Thanks in advance.
Tom Bond
--
Realtime Software Solutions, Inc. Ph:1-716-467-8889
URL:http://realtime1.com
Services:Web Design, Document Conversion to HTML, Embedded Real-time
Design
Sponsor: LINUX User's Group Of Rochester(LUGOR) URL:http://www.lugor.org
------------------------------
Date: Tue, 08 Dec 1998 16:09:40 GMT
From: mwilliams@europarl.eu.int
Subject: Use Lib LIST fails with perlis.dll??
Message-Id: <74jj02$10j$1@nnrp1.dejanews.com>
I have a statement in my .plx file that says:
use lib ('c:/PERL/5.005/LIB');
If i test this using perl.exe ice.plx
C:\DATA\InetPub\wwwroot\haha\Scripts>perl ice.plx flavour=MINT
c:/PERL/5.005/LIB/MSWin32-x86-object
c:/PERL/5.005/LIB
c:\perl\lib
C:\Perl\5.005\lib/MSWin32-x86-object
C:\Perl\5.005\lib
C:\Perl\site\5.005\lib/MSWin32-x86-object
C:\Perl\site\5.005\lib
c:\perl\site\lib
C:\Perl\site\lib
.
Content-type:text/html
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1> Hello, world!</h1>
</body>
</html>
<P> your favorite flavour is MINT.</BODY>
</HTML>
However when accessed via perlis.dll ( i.e. via a browser)
The user gets the famous and informative 'script produced no output'
The server log gets the super informative
15:54:28 136.173.21.22 GET /haha/Scripts/ice.plx 500
Apparently this means server Internal error ( huh ??)
and the Perlis-err.log gets
*** 'C:\data\Inetpub\wwwroot\haha\Scripts\ice.plx' error message at:
1998/12/08 16:46:36 Can't locate Tie/Hash.pm in @INC (@INC contains:
c:\perl\lib C:\Perl\site\5.005 \lib/MSWin32-x86-object C:\Perl\site\5.005\lib
c:\perl\site\lib .) at C: \Perl\site\5.005\lib/Win32/WebEnv.pm line 6. BEGIN
failed--compilation aborted.
So why doesn't the use lib statement work when used with the perlis.dll ??
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 08 Dec 1998 15:22:28 GMT
From: jday@microcal.com
Subject: Use script to send Standard Form Input?
Message-Id: <74jg7h$ucn$1@nnrp1.dejanews.com>
I am modifying a script that under certain parameters sends a query
string to another script. i.e.
if ($FORM{ad_cat} eq "previous user") {
print "Location:
http://mydomain/getaddress.pl?ad_cat=pr
evious+user\n\n";
};
Unfortunately, this also presents the query string in the address field of
the users browser. I do not want them to be able to bookmark the address
and therefore by-pass the series of scripts if they return
To work around the problem, I would like to use Post rather than Get and
send the information as standard form input, but I don't know if this is
possible from script.
Can anyone tell if it's possible and how it would be done??
Cheers,
Julie
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 08 Dec 1998 10:09:22 -0500
From: "FENG XIAN, ALEX" <feng_xian@mitel.com>
Subject: Re: Why i can't "localize through a reference" in perl version 5.005_02
Message-Id: <366D4122.3157A691@mitel.com>
thanks for your suggestions anyway. maybe sometime it's easier to ask a
question to somebody than to read documents.
Martien Verbruggen wrote:
>...
/Alex
--
_ _ _ _____ ___ _
| \ / || |_ _| __| | FENG XIAN (Alex)
| |\/| || | | | | _|| |__
|_| |_||_| |_| |___|____| Tel: (613) 592-2122 x 6882
_________________________ Fax: (613) 592-4784
mailto:feng_xian@mitel.com
S E M I C O N D U C T O R http://www.semicon.mitel.com
------------------------------
Date: Tue, 08 Dec 1998 10:15:11 -0500
From: "FENG XIAN, ALEX" <feng_xian@mitel.com>
Subject: Re: Why i can't "localize through a reference" in perl version 5.005_02
Message-Id: <366D427F.97CD2E88@mitel.com>
Andrew Allen wrote:
>
> Only in perl4. In perl5, you can build any sort of data structure
> using hard references, usually much easier than using symbolic
> references.
that's right. hard references can build complex data structure. but my
problem is my subroutine will access lots of global data and i hope the
global data's name is built from the subroutine's arguments, e.g.
&subroutine("prefix1", "data1", "postfix", ...);
&subroutine("prefix2", "data2", "postfix", ...);
&subroutine("prefix3", "data3", "postfix", ...);
...
then i have to use the symblic reference. i also want to localize the
local variables inside the subroutine, that 's where my problem comes
from. but maybe i just use a normal localize variable, a local variable
created from symblic name is not really needed.
thank you very much.
>
> Andrew Allen
/Alex
--
_ _ _ _____ ___ _
| \ / || |_ _| __| | FENG XIAN (Alex)
| |\/| || | | | | _|| |__
|_| |_||_| |_| |___|____| Tel: (613) 592-2122 x 6882
_________________________ Fax: (613) 592-4784
mailto:feng_xian@mitel.com
S E M I C O N D U C T O R http://www.semicon.mitel.com
------------------------------
Date: Tue, 8 Dec 1998 10:14:50 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Why i can't "localize through a reference" in perl version 5.005_02
Message-Id: <q9jj47.bbs.ln@metronet.com>
FENG XIAN, ALEX (feng_xian@mitel.com) wrote:
: thanks for your suggestions anyway. maybe sometime it's easier to ask a
: question to somebody than to read documents.
: Martien Verbruggen wrote:
: >...
Well, lots of folks will no longer even *see* questions
posted by you...
*plonk*
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4379
**************************************