[21713] in Perl-Users-Digest
Perl-Users Digest, Issue: 3917 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 5 00:06:28 2002
Date: Fri, 4 Oct 2002 21:05:11 -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 Fri, 4 Oct 2002 Volume: 10 Number: 3917
Today's topics:
Re: code for loading and copying Web Pages <avecfrites@yahoo.com>
File::Copy from NT to Unix using UNC (David L. Adams)
Re: File::Copy from NT to Unix using UNC <darin@naboo.to.org.no.spam.for.me>
Help please extracting data from a word document (pierrot)
Re: Help please extracting data from a word document <nospam@nospam.com>
Re: Help please extracting data from a word document <ron@savage.net.au>
Re: Help please extracting data from a word document <nospam@nospam.com>
Re: help w chained "maps" <goldbb2@earthlink.net>
How to read outlook mail??? a246456@fmr.com
Re: how to read the image content. <nospam@nospam.com>
Re: IO::Select has limits? or how to use IO::Poll? <crudmail@cox.net>
Re: ithreads, perl 5.8 and shared objects <derek@wedgetail.com>
Novice - Submit to different scripts (Lew903)
Re: Novice - Submit to different scripts <stegmark@attbi.com>
Re: One line to Segfault Perl <parv_fm@emailgroupsWhereElse.com>
Re: One line to Segfault Perl <pkent77tea@yahoo.com.tea>
Re: One line to Segfault Perl <dha@panix2.panix.com>
Re: One line to Segfault Perl <wsegrave@mindspring.com>
Re: One line to Segfault Perl <wsegrave@mindspring.com>
Re: Open a Session inside Session <rereidy@indra.com>
perl interface to FreeBSD user ppp <dmehler@siscom.net>
perl user interface interface to tar? <dmehler@siscom.net>
Re: perl user interface interface to tar? <nospam@nospam.com>
Re: Script to Change Filename <NO_SPAM_pangjoe@rogers.com>
searching an array. <dmehler@siscom.net>
Re: searching an array. (Jay Tilton)
Re: Splice function with arrays <krahnj@acm.org>
Re: What can I do if I have not got chmop <s_grazzini@hotmail.com>
Re: What can I do if I have not got chmop <jurgenex@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 4 Oct 2002 21:31:51 -0400
From: "avecfrites" <avecfrites@yahoo.com>
Subject: Re: code for loading and copying Web Pages
Message-Id: <anlepq$2k7$1@news.laserlink.net>
Use LWP to grab the page (the HTML string) and save it to a text file on
disk.
--
Read your most critical mail, from your existing accounts,
on your existing cell phone, pushed automatically by mHook.
http://www.mhook.com/
"GET NJ" <aolsz@bellatlantic.net> wrote in message
news:3D9B6C4C.64D09D8@bellatlantic.net...
> Can anybody suggest a reference to code for loading a Web Page (from a
> remote server) and copying/saving the Page?
>
> Clearly any few Pages can be saved manually within a broswer. I'm
> looking for a way to save thousands of Pages that are numbered
> sequentially. I'm figgering on nesting the code.
>
> Thank you.
>
> --
>
> GET NJ
> Free Ads -- AND LOTS MORE!
> http://www.getnj.com
>
>
------------------------------
Date: 4 Oct 2002 15:36:54 -0700
From: david_l_adams@wr.com (David L. Adams)
Subject: File::Copy from NT to Unix using UNC
Message-Id: <d508cb08.0210041436.17f08eda@posting.google.com>
Can I use File::Copy with a UNC to copy files from the local NT server
(where the script is running) to a Unix server?
I have successfully written a Perl script (running on NT) using
File::Copy to distribute updated sets of files from the local NT
development server to multiple NT production servers. I am using UNC
naming for the destinations so that I am not dependant on drive letter
mappings. I would like to also copy the files to Unix servers with
this same script. In the script, I have one array that is a list of
the files to be distributed and another array that is a list of the
destination servers. I want to be able to mix NT and Unix servers in
the list. I have tried using destination UNC syntax for the Unix
systems like //servername/user/file or //servername/~user/file or
//ipaddress/user/file but the copy command always returns the error
"No such file or directory" even though they do exist. I am only
marginally familiar with Unix.
If the final answer is NO, what is the best way for a Perl script to
copy a file from an NT system to a Unix system? I hope it's not rcp,
which I'm using now and have been told to stop using.
------------------------------
Date: Sat, 05 Oct 2002 02:32:58 GMT
From: Darin McBride <darin@naboo.to.org.no.spam.for.me>
Subject: Re: File::Copy from NT to Unix using UNC
Message-Id: <ubsn9.453208$v53.20190727@news3.calgary.shaw.ca>
David L. Adams wrote:
> Can I use File::Copy with a UNC to copy files from the local NT server
> (where the script is running) to a Unix server?
Yes, if you've set up samba (or equivalent) on the unix server.
> I have successfully written a Perl script (running on NT) using
> File::Copy to distribute updated sets of files from the local NT
> development server to multiple NT production servers. I am using UNC
> naming for the destinations so that I am not dependant on drive letter
> mappings. I would like to also copy the files to Unix servers with
> this same script. In the script, I have one array that is a list of
> the files to be distributed and another array that is a list of the
> destination servers. I want to be able to mix NT and Unix servers in
> the list. I have tried using destination UNC syntax for the Unix
> systems like //servername/user/file or //servername/~user/file or
> //ipaddress/user/file but the copy command always returns the error
> "No such file or directory" even though they do exist. I am only
> marginally familiar with Unix.
>
> If the final answer is NO, what is the best way for a Perl script to
> copy a file from an NT system to a Unix system? I hope it's not rcp,
> which I'm using now and have been told to stop using.
rcp is marginally more secure than UNCs, so I'm not sure what your
sysadmins (I'm assuming) are complaining about.
Another way is to use Net::FTP (most unixes need little work, if any,
to get their ftp daemon running). However, this requires embedding a
password in your script, or somewhere that your script can get at it.
Yet another way is to find some sort of NFS client for Windows. I'm
assuming they exist - I've only used NFS clients on Unix and OS/2.
File::Copy will work transparently here.
Perhaps you could write a CGI script to run on the Unix machine that
would receive files, and you could use one of the LWP modules to send
your files with appropriate placement information. This assumes you
have a web server running on the unix machine.
Finally, if all else fails, you may be able to write your own "special"
rcp server that you might be able to get away with. Write a perl
daemon on the unix machine that listens to requests, and can receive
files. Obviously the most work, and it isn't likely to be as good or
secure as rcp, but because it won't be rcp, your sysadmins might not
complain.
As you can see, with tcp/ip, there are many, many ways of skinning this
cat, depending on your skill, time, and requirements.
--
To reply, please remove the obvious spam filter
------------------------------
Date: 4 Oct 2002 18:31:11 -0700
From: foutuguy@yahoo.fr (pierrot)
Subject: Help please extracting data from a word document
Message-Id: <e6da095c.0210041731.2a64c0e4@posting.google.com>
Hello,
I have several big word documents i need to extract data from. First i
just want to try something simple and after, it should be easy to add
more stuff. In the word document, regularly, there is this string :
"Display Coordinate System Name:"
and then a certain amount of spaces, then a string i want to extract
that can be a mix of letters and numbers. Everything is in the same
line and the string to extract has something like 10 characters.
I almost do not know anything about perl. What should i put in my
extract.pl file?
then to execute the file, i am not sure at 100%.
Is that : extract.pl -o input.doc output.txt ????
Thanks a lot for your help
Pierrot
------------------------------
Date: Fri, 4 Oct 2002 20:32:16 -0700
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: Help please extracting data from a word document
Message-Id: <3d9e5cb9$1_2@nopics.sjc>
"pierrot" <foutuguy@yahoo.fr> wrote in message
> Hello,
>
> I have several big word documents i need to extract data from. First i
> just want to try something simple and after, it should be easy to add
> more stuff. In the word document, regularly, there is this string :
> "Display Coordinate System Name:"
> and then a certain amount of spaces, then a string i want to extract
> that can be a mix of letters and numbers. Everything is in the same
> line and the string to extract has something like 10 characters.
>
> I almost do not know anything about perl. What should i put in my
> extract.pl file?
> then to execute the file, i am not sure at 100%.
> Is that : extract.pl -o input.doc output.txt ????
>
> Thanks a lot for your help
>
> Pierrot
Do you have Perl installed on your system? What is the OS running on your
system? etc.
The untested stuff below assumes that you are running Li/Unix with Perl
executable in /usr/bin/perl
extract.pl:
#!/usr/bin/perl -w
use strict;
open(FH, $ARGV[0]) or die "cannot open $ARGV[0]: $!\n";
while (<FH>) {
chomp;
if (/Display Coordinate System Name:\s+(.*)/) {
print "Extracted string: $1\n";
}
}
close FH;
On *nices, you can kick this script: at command prompt:
$ ./extract.pl input.doc
This will print extracted strings to your screen. To redirect it to a file,
enter following:
$ ./extract.pl input.doc > output.txt
On Windows, you do something similarly
C:/>perl extract.pl input.doc
or
C:/>perl extract.pl input.doc > output.txt
PS: Pick up a Perl book.
------------------------------
Date: Sat, 5 Oct 2002 13:35:37 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Help please extracting data from a word document
Message-Id: <anlmnn$5q1$1@arachne.labyrinth.net.au>
"pierrot" <foutuguy@yahoo.fr> wrote in message news:e6da095c.0210041731.2a64c0e4@posting.google.com...
> Hello,
>
> I have several big word documents i need to extract data from. First i
Tuts 16 & 17:
http://savage.net.au/Perl-tuts-1-30.html
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
------------------------------
Date: Fri, 4 Oct 2002 20:50:47 -0700
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: Help please extracting data from a word document
Message-Id: <3d9e6110$1_2@nopics.sjc>
"Tan Nguyen" <nospam@nospam.com> wrote
>
> Do you have Perl installed on your system? What is the OS running on your
> system? etc.
>
> The untested stuff below assumes that you are running Li/Unix with Perl
> executable in /usr/bin/perl
>
> extract.pl:
>
> #!/usr/bin/perl -w
> use strict;
>
> open(FH, $ARGV[0]) or die "cannot open $ARGV[0]: $!\n";
> while (<FH>) {
> chomp;
> if (/Display Coordinate System Name:\s+(.*)/) {
> print "Extracted string: $1\n";
> }
> }
> close FH;
>
> On *nices, you can kick this script: at command prompt:
> $ ./extract.pl input.doc
>
> This will print extracted strings to your screen. To redirect it to a
file,
> enter following:
> $ ./extract.pl input.doc > output.txt
>
> On Windows, you do something similarly
> C:/>perl extract.pl input.doc
> or
> C:/>perl extract.pl input.doc > output.txt
>
> PS: Pick up a Perl book.
>
Well, I didn't catch your line "Word Documents". This doesn't work with MS
Word documents as they are compound files formatted in an object model
(Structured Storage). You might want to either check out Perl::OLE to deal
with MS structured storage or convert these MS Word documents to plain text
files, then run them the aforementioned script.
------------------------------
Date: Fri, 04 Oct 2002 23:31:04 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: help w chained "maps"
Message-Id: <3D9E5CF8.35D2C43A@earthlink.net>
Dick Penny wrote:
>
> A day or two ago, I asked for and rec'd help re multiple map
> transforms of data. Now, I am trying to break apart a long line into
> separate "maps" one per line so its easier to read, and easier to
> continue to add functionality.
> This has been advocated several places in AS and clpm.
> #1 below works fine - of course, you guys provided it.
> My #2 attempt to break #1 into two lines fails - I get all the data
> and digits OK, BUT w/o the period insertations.
> Uggh, what have I missed? I've seen examples where they just chained
> maps, sorts, greps together - isn't that what I'm doing in #2?
>
> #1
> my @numbrs = map { [ map { s/(\d{4})(\d\d)$/$1.$2/; $_ } /\d+/g ] }
> @lines;
Try this:
my @numbers = map {
[ map { s/(\d{4})(\d\d)$/$1.$2/; $_ } /\d+/g ]
} @lines;
Remember, these aren't *chained* maps here, but nested ones.
You might want to write it as a single map, rather than a pair of them:
my @numbers = map {
s/(\d{4})(\d\d)$/$1.$2/g;
[ /\d{4}\.\d\d/g ];
} @lines;
Or better yet:
for my $line (@lines) {
my @nums = grep 6 == length, $line =~ /\d+/g;
substr($_, 4, 0, ".") for @nums;
push @numbers, \@nums;
}
> #2
> my @numbrs = map { s/(\d{4})(\d\d)$/$1.$2/; $_ }
> map{[/\d+/g]} @lines;
Here, you're trying to write chained maps... the above code is like:
my @numbrs =
map { s/(\d{4})(\d\d)$/$1.$2/; $_ }
map [ /\d+/g ],
@lines;
Which first turns each line (originally a string) into an arrayref of
numbers, and then performs string substitution on the arrayref, as if
you'd had:
foreach my $line ( @lines ) {
my @bunch_of_numbers = $line =~ /\d+/g;
my $aref = \@bunch_of_numbers;
# *Think* about what this line does.
$aref =~ s/(\d{4})(\d\d)$/$1.$2/;
push @numbers, $aref;
}
[all code untested]
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Fri, 04 Oct 2002 16:24:45 -0400
From: a246456@fmr.com
Subject: How to read outlook mail???
Message-Id: <3D9DF90D.1B099B87@fmr.com>
Hi,
I am looking for status information which is in outlook mail under
subject. Is there any module to read the subject information on outlook.
Thx.
pal
------------------------------
Date: Fri, 4 Oct 2002 20:45:54 -0700
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: how to read the image content.
Message-Id: <3d9e5feb$1_6@nopics.sjc>
"James Q.L" <flying_dragon@china.com> wrote
> Sometimes i need to automate form submission. but few forms have
> confirmation code that is composed into image(gif / png etc) . althought
it
> doesn't hurt much and i can manually submit or just give it up, I am
> wondering if there is a way to do this ( i.e analyse the image and grab
the
> number out of it ) imagemagick ?
Generally, it's a big "No". Search engines have been using this to eliminate
spam submission, and so far, they have been successful (ie. no one has been
able to crack it). The way it works is similar. Once a person wants to
submit an URL to the search engine, he's given a sequence of numbers which
are put in an image file. He has to punch these numbers along with his URL
for submisson.
------------------------------
Date: Sat, 05 Oct 2002 01:46:05 GMT
From: Joel Nelson <crudmail@cox.net>
Subject: Re: IO::Select has limits? or how to use IO::Poll?
Message-Id: <3D9E460F.F662DEE4@cox.net>
Benjamin Goldberg wrote:
[snip]
> > > > > If you have a filehandle which you want to watch for
> > > > > readability, do:
> > > > > $poll->mask( $fh, POLLIN );
> > > > > If you have a filehandle which you want to watch for
> > > > > writability, do:
> > > > > $poll->mask( $fh, POLLOUT );
> > > > > To watch a handle for both reading and writing:
> > > > > $poll->mask( $fh, POLLIN|POLLOUT );
> > > > > To stop watching a handle, do:
> > > > > $poll->mask( $fh, 0 );
> > > > >
> > > > > To block until some handles are ready for reading or writing,
> > > > > and to find out what those handles are, do:
> > > > > $poll->poll( $timeout );
> > > > > my @readok = $poll->handles( POLLRDNORM );
> > > > > my @writeok = $poll->handles( POLLWRNORM );
> > > >
> > > > I did a test and set up a handle in poll with POLLIN|POLLOUT. I
> > > > tried a $poll->handles(POLLOUT) and it returned 0.
> > >
> > > Did you call $poll->poll before calling $poll->handles(POLLOUT)?
> > >
> > > Remember, when you call $poll->handles, all it's doing is showing
> > > you the results of the last call to the ->poll method.
> >
> > Yeah, I called $poll->poll. I'll do some more testing. Prolly a brain
> > fart on my part.
>
> Erm, I just noticed... if you want to find the handles ready for
> writing, you have to call ->handles with POLLWRNORM, not POLLOUT.
>
> Similarly, if you want handles ready for reading, it's POLLRDNORM, not
> POLLIN.
Hmmm, guess I'll have to learn the difference and why.
> > Benjamin, thanks for all your help. I guess I'm surprised that I
> > can't find any others that have tested the limits of sockets under
> > perl. I will try again with ideas you have suggested. I am running
> > out of time and may have to switch to java or maybe even Delphi (my
> > old favorite language). Usually I can whip things out in perl so
> > fast.....
>
> Remember that java is an interpreted language -- the interpreter is
> written in C, just like perl's is. If the underlying C runtime doesn't
> support multiplexing lots of sockets, then neither will java.
>
> Of course, since with java, you pretty much *have* to be using threads
> (one thread per socket), it's quite possible that it will using a
> different API to handle multiplexing than the C select() function, and
> that API will be able to handle more sockets.
Right, it will definately use threading. I tried to get threads to work in
perl 5.6 but it tells me that Threads is only supported under older versions
of perl and that I should use iThreads. No sight of them anywhere except
where authors are using perl 5.8.
> With Delphi... that's a descendent of Pascal, right?
Yep! Gui pascal basically. Very nice language. It's been ported to linux
as Kylix.
> Would you handle multiple sockets via threads, or via select() or
> something similar? If it's threads, then maybe it will work (or maybe
> not). If it's select(), then you'll have the same limit as in Perl.
I'm sure it will be threaded.
> PS: Have you considered upgrading perl to 5.8.0, and using threads
> instead of multiplexing?
Yes, but I have seen no sign of 5.8.0 on ActiveState's web site. Do you
know if they have it hidden somewhere? Or another Win32 port is available?
------------------------------
Date: Sat, 05 Oct 2002 11:50:47 +1000
From: Derek Thomson <derek@wedgetail.com>
To: Uri Guttman <uri@stemsystems.com>
Subject: Re: ithreads, perl 5.8 and shared objects
Message-Id: <3D9E4577.7070605@wedgetail.com>
Hi Uri,
Uri Guttman wrote:
>>>>>>"DT" == Derek Thomson <derek@wedgetail.com> writes:
>>>>>
>
> DT> Secondly, I'm working on a Perl CORBA ORB
> DT> (http://sourceforge.net/projects/perlorb), and if Perl threads aren't
> DT> working correctly then there's no way it can properly support
> DT> multithreaded servers. I'd really like to know what the story is one
> DT> way or another soon.
>
> do you have to use threads? instead try an event loop and message
> passing design based stem or poe. then data sharing is trivial and no
> mutexes are needed. in many cases the designs are much simpler than
> threads and faster since the locking is eliminated. it also means better
> scalabilty as you can distribute this design to multiple boxes while
> threads can't go beyond one box.
Sure, I can avoid using threads with an event driven model. However,
sometimes that is not sufficient - what if the server calls itself
directly or indirectly? There's also the problem that you have no chance
of exploiting potiential parallelism ie. all requests must wait until
the current request has completed - even if the request is just waiting
for a result from a database, or whatever. Other requests, that don't
require database access, could have been completed during that time.
Besides that, I get asked "does Perl support threads?" quite a bit - I'd
like to be able to say "yes" confidently, without fear that they are
going to discover that shared objects don't work.
Thanks for your answer, but I really need to know if shared objects do
in fact work.
--
Derek Thomson.
------------------------------
Date: 4 Oct 2002 17:31:44 -0700
From: lsuttles@lcsdg.com (Lew903)
Subject: Novice - Submit to different scripts
Message-Id: <1babe3be.0210041631.251dfba8@posting.google.com>
First off, let me apologize if my questions are posted in the wrong
forum, I've used the wrong terminology/jargon, etc. This is my first
endeavor with perl.
Over the last 2 weeks, with much perusing the perl, etc. groups, I've
been able to put together a website project that contains a lengthy 8
page questionnaire form. Using hidden fields to carry the previous
form user-filled-in info forward to the next html form after clicking
a Continue button, a Submit button in the final form writes the
information to a simple log. Eventually a database will replace the
log. So far I have been able to generate the new html form(s) and
write to the file successfully using perl example scripts I've found
and adapting them for this project.
Everything works beautifully... but now a at-first-glance simple
change to this project has stopped me cold. What I need to do now is
have 2 sets of radio buttons in the first html form (1st set - married
or single, 2nd set - retired or not retired) and depending on the
radio buttons selected, would call the appropriate script that
generates the appropriate html form.
For example, when the "Married" and "Retired" radio buttons are
selected and the Submit button is clicked, the generated html form
that follows would be one I've put together that has the first form
info in hidden fields and has only new questions that pertain to a
married, retired user.
The first html form contains only "common"-to-all-users questions and
when submitted, the following html form would present the next
"customized" set of questions I've put together. The appropriate html
forms 3 thru 8 would follow at each Continue button click (similar to
the scripts that generate each html form now). The rub is the split
at the first html form based on which of the four radio buttons are
selected.
I respectfully ask for your suggestions on a method for getting one
Submit (Continue) button to call different scripts based on
conditionals. I'd like to do this without using JavaScript in case
it's disabled or multiple Submit buttons on the first html form. I'd
like to avoid the alternative of using a first html page where the
user selects their status by clicking on a link to a whole set of
customized html forms.
The first thing that comes to my uneducated mind is have the submit
button call an intermediate script that calls the appropriate script
based on the radio buttons selected. Other questions, such as what to
do about responding to the browser in the intermediate script, have me
at a loss at this point.
Again, my apologies for my (hopefully temporary)ignorance, wrong group
post, and a too long/basic description of what I trying to do, etc.
I've gleaned the Perl books I've just bought, searched the news
groups, etc. before I posted, but haven't found this exact topic.
Any input much appreciated, Lewis
------------------------------
Date: Sat, 05 Oct 2002 02:04:08 GMT
From: "Mark" <stegmark@attbi.com>
Subject: Re: Novice - Submit to different scripts
Message-Id: <sMrn9.50398$dp1.140775@rwcrnsc52.ops.asp.att.net>
<Snipped for brevity>
>
> I respectfully ask for your suggestions on a method for getting one
> Submit (Continue) button to call different scripts based on
> conditionals. I'd like to do this without using JavaScript in case
> it's disabled or multiple Submit buttons on the first html form. I'd
> like to avoid the alternative of using a first html page where the
> user selects their status by clicking on a link to a whole set of
> customized html forms.
>
> The first thing that comes to my uneducated mind is have the submit
> button call an intermediate script that calls the appropriate script
> based on the radio buttons selected. Other questions, such as what to
> do about responding to the browser in the intermediate script, have me
> at a loss at this point.
>
> Again, my apologies for my (hopefully temporary)ignorance, wrong group
> post, and a too long/basic description of what I trying to do, etc.
> I've gleaned the Perl books I've just bought, searched the news
> groups, etc. before I posted, but haven't found this exact topic.
>
> Any input much appreciated, Lewis
The first page submission is delivered to script 1 which delivers whichever
second page is appropriate to the radio buttons selected and changes the
form action attribute to send all further submits to the appropriate script
to deliver pages 3-8. Since all data on page one is required by both
scripts, is returned with page two in hidden fields, and page two is
customized with the appropriate form attributes to invoke the proper script
thereafter, it should work fine. Right?
Simply, page 1 is interpreted by script one to customize the form action
attribute of all subsequent pages to run script two for married, or script 3
for retired.
HTH,
Mark
------------------------------
Date: Fri, 04 Oct 2002 22:19:22 GMT
From: parv <parv_fm@emailgroupsWhereElse.com>
Subject: Re: One line to Segfault Perl
Message-Id: <slrnaps53k.mnn.parv_fm@localhost.holy.cow>
(sorry i missed the original message to reply to.)
on freebsd/i386 4.6.2, perl 5.6.1, i get...
# perl -e 'undef tcp;'
perl in free(): warning: chunk is already free
# perl -w -e 'undef tcp;'
Unquoted string "tcp" may clash with future reserved word at -e line 1.
Name "main::tcp" used only once: possible typo at -e line 1.
perl in free(): warning: chunk is already free
# perl -Mstrict -w -e 'undef tcp;'
Name "main::tcp" used only once: possible typo at -e line 1.
# perl -c -Mstrict -w -e 'undef tcp;'
Name "main::tcp" used only once: possible typo at -e line 1.
-e syntax OK
...but no segfaults.
- parv
--
please don't send me private e-mail.
if you must, do away w/ WhereElse in the address.
------------------------------
Date: Fri, 04 Oct 2002 22:47:22 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: One line to Segfault Perl
Message-Id: <pkent77tea-335289.23472104102002@news-text.blueyonder.co.uk>
In article <3d9d9fbc.2180320565@news.cis.dfn.de>,
helgi@decode.is (Helgi Briem) wrote:
> On 4 Oct 2002 06:33:06 -0700, paul@lanifex.com (Paul
> Gillingwater) wrote:
>
> >Here's a Perl script which segfaults Perl:
> >
> >#!/usr/bin/perl
> >undef tcp;
and I get:
dev/area/tmp > ./perl-5.8.0/perl
#!/usr/bin/perl
undef tcp;
Can't modify constant item in undef operator at - line 2, near "tcp;"
Execution of - aborted due to compilation errors.
but 5.6.1 does segfault on linux-ppc.
MacPerl 5.6.1 says:
# Can't modify constant item in undef operator, near "tcp;"
File 'Untitled'; Line 2
# Execution of Untitled aborted due to compilation errors.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Fri, 4 Oct 2002 23:52:17 +0000 (UTC)
From: "David H. Adler" <dha@panix2.panix.com>
Subject: Re: One line to Segfault Perl
Message-Id: <slrnapsadh.9oh.dha@panix2.panix.com>
In article <3D9DA959.1090005@thecouch.homeip.net>, Mina Naguib wrote:
>
>
> Paul Gillingwater wrote:
>> Here's a Perl script which segfaults Perl:
>>
>> #!/usr/bin/perl
>> undef tcp;
>
>
> Just for the record, I get the same thing:
>
> [mina@blackcorner] ~ $ perl -e 'undef anything;'
> Segmentation fault
It gets odd here.
bash-2.05$ perl -v
This is perl, v5.6.1 built for i386-freebsd
[snip]
bash-2.05$ perl -le 'undef tcp'
bash-2.05$
Nothing. *however*, if I put it in a file...
bash-2.05$ cat doesitcore.pl
#!/usr/bin/perl
undef tcp;
bash-2.05$ ./doesitcore.pl
Segmentation fault (core dumped)
bash-2.05$
So... for me, on FreeBSD (4.6-STABLE), it does nothing as a one-liner,
but core dumps as a script.
/me looks at perl funny.
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
War! Huh! What is it good for? Subterranian-dwelling reptilian
humanoid aliens! - Alden Bates
------------------------------
Date: Fri, 4 Oct 2002 19:07:49 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: One line to Segfault Perl
Message-Id: <anlake$4b9$1@nntp9.atl.mindspring.net>
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:anl0vv$lu0$1@slb4.atl.mindspring.net...
> "Helgi Briem" <helgi@decode.is> wrote in message
> news:3d9d9fbc.2180320565@news.cis.dfn.de...
>
> Hi, Helgi! Here's another for your side. I haven't tested the OP's script
on
> my Linux systems, as it would likely add nothing new to the thread.
>
Well, I was certainly wrong about that.
This is what I got on a RH Linux 6.1 box, with Perl 5.005_03 built for
i386-linux, when I executed $ perl undef_tcp.pl:
Bareword "tcp" not allowed while "strict subs" in use at undef_tcp.pl line
3.
Unquoted string "tcp" may clash with future reserved word at undef_tcp.pl
line 3.
Execution of undef_tcp.pl aborted due to compilation errors.
Note: Filenames above truncated to remove private info.
Here's the script that produced the above results.
#!/usr/bin/perl -w
use strict;
undef tcp;
Same as before, except for shebang line.
Cheers.
Bill Segraves
------------------------------
Date: Fri, 4 Oct 2002 19:20:06 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: One line to Segfault Perl
Message-Id: <anlc0i$iq2$1@slb5.atl.mindspring.net>
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:anlake$4b9$1@nntp9.atl.mindspring.net...
<snip>
Oops! Sloppy mark + copy + paste and editing. Please ignore the $ in
previous post
> This is what I got on a RH Linux 6.1 box, with Perl 5.005_03 built for
> i386-linux, when I executed
perl undef_tcp.pl
Bill Segraves
------------------------------
Date: Fri, 04 Oct 2002 20:47:36 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Open a Session inside Session
Message-Id: <3D9E52C8.ABC026E1@indra.com>
john b wrote:
>
> I have an Oracle database running on a server. If I want to run my script
> from a different machine, I'll need to first open a telnet session (for
> example, Tsession) to the machine running oracle and then open another SQL
> session (Dsession) on that machine. I'm confused how I can talk to the SQL
> session using my telnet session.
>
> Can I do something like
> Tsession->("Dsession-> ....");
>
> Thanks,
Look at DBI and DBD::Oracle. If that doesn't do it for you, look at
Net::TELNET and Expect.
--
Ron Reidy
Oracle DBA
------------------------------
Date: Fri, 4 Oct 2002 22:41:30 -0400
From: "dave" <dmehler@siscom.net>
Subject: perl interface to FreeBSD user ppp
Message-Id: <3d9e5338$0$80654$9a6e19ea@news.newshosting.com>
Hello,
Does anyone have a perl cgi that interfaces to the FreeBSD/OpenBSD user
ppp facility? I don't want one for the pppd daemon.
Thanks.
Dave.
------------------------------
Date: Fri, 4 Oct 2002 22:39:15 -0400
From: "dave" <dmehler@siscom.net>
Subject: perl user interface interface to tar?
Message-Id: <3d9e52b2$0$80670$9a6e19ea@news.newshosting.com>
Hello,
Does anyone have a perl module or interface routine that acts similar to
the interface for dump/restore but which works with tar and optionally gzip?
If not, any ideas on how to make one? I'd like to make a backup program in
perl which allows one to traverse a tar file in a similar manner to dump's
interactive restore method where one can select files, then extract them all
at once.
Thanks.
Dave.
------------------------------
Date: Fri, 4 Oct 2002 20:16:30 -0700
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: perl user interface interface to tar?
Message-Id: <3d9e5906$1_1@nopics.sjc>
"dave" <dmehler@siscom.net> wrote in message
news:3d9e52b2$0$80670$9a6e19ea@news.newshosting.com...
> Hello,
> Does anyone have a perl module or interface routine that acts similar
to
> the interface for dump/restore but which works with tar and optionally
gzip?
> If not, any ideas on how to make one? I'd like to make a backup program in
> perl which allows one to traverse a tar file in a similar manner to dump's
> interactive restore method where one can select files, then extract them
all
> at once.
> Thanks.
> Dave.
>
use Archive::Tar;
------------------------------
Date: Sat, 05 Oct 2002 03:46:52 GMT
From: "JP" <NO_SPAM_pangjoe@rogers.com>
Subject: Re: Script to Change Filename
Message-Id: <Mgtn9.20894$Aiq1.19462@news04.bloor.is.net.cable.rogers.com>
Folks,
Sorry for the delay of this post. I have been away from the computer for
the whole morning. Thank you all for your assistance and enthusiasm. I am
amazed at your knowledge in RegEx. I learnt a lot too. The statement for
searching and creating new file works very well. Here is where I am up to
now:
=========================================================
#! Perl
use strict;
my $dir = 'usr/whatever';
opendir (DIR, $dir) or die "Cannot locate directory $dir:$!\n";
foreach (readdir DIR) {
s/^((?:\d){3,8})([a-zA-Z]\.dat)$/${1}-${2}/;
print $_, "\n";
}
=========================================================
The script displays a list of files with the names which are exactly what I
need. It leaves other un-related files untouched. For now, it is just
showing the new filenames. I have to figure out how to do the actual
rename.
One more thing, my apology for the top-post. I don't realize that it was so
irritating. Now I know.
Cheers,
Joe
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:anknqb$tkj$1@slb6.atl.mindspring.net...
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:3d9dce8a$1@news.microsoft.com...
> > William Alexander Segraves wrote:
> <snip>
> Thanks, Jue.
>
> None of what I wrote was in your reponse; so I hope the OP will see that
> your comments apply to his post.
>
> ATB.
>
> Bill Segraves
>
>
>
>
------------------------------
Date: Fri, 4 Oct 2002 21:58:01 -0400
From: "dave" <dmehler@siscom.net>
Subject: searching an array.
Message-Id: <3d9e4908$0$80658$9a6e19ea@news.newshosting.com>
Hello,
I'm trying to make a customized backup program, to backup a single fbsd
box to zip drive. After declaring variables the first thing the program does
is places the output from mount in to an array. Just for debugging purposes
i then
print @MountList;
which prints out the output i need. Now i need to search that array for a
specific pattern, and perform different actions based on wether or not the
pattern is found. Here's my line:
$ZipDrive = (@MountList =~ /\/dev\/da0c$/);
the error i'm getting i have perl using the -w warnings flag is:
applying pattern match (m//) to @array will act on scalar(@array)
i have no idea what i'm doing wrong.
Thanks.
Dave.
------------------------------
Date: Sat, 05 Oct 2002 02:30:55 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: searching an array.
Message-Id: <3d9e4c95.541467787@news.erols.com>
"dave" <dmehler@siscom.net> wrote:
| $ZipDrive = (@MountList =~ /\/dev\/da0c$/);
| the error i'm getting i have perl using the -w warnings flag is:
| applying pattern match (m//) to @array will act on scalar(@array)
m// operates on a scalar.
@MountList is not a scalar, so it gets beat into scalar context.
Iterate the match operation across the elements of @MountList.
(While we're at it, ditch the StudlyCaps and leaning toothpicks.)
($zipdrive = m!/dev/da0c$!) && last for @mountlist;
------------------------------
Date: Sat, 05 Oct 2002 00:35:50 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Splice function with arrays
Message-Id: <3D9E33E1.7D164C4B@acm.org>
Bart Lateur wrote:
>
> John W. Krahn wrote:
>
> ># use redo
> >for ( my $i = 0; $i <= $#array; $i++ ) {
> > if ( $array[$i] == 5 ) {
> > splice @array, $i, 1;
> > redo;
> > }
> >}
>
> Have you tried it with warnings enabled and a 5 at the end of the array?
>
> @array = (1, 2, 5);
No. :-)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 04 Oct 2002 22:06:46 GMT
From: Steve Grazzini <s_grazzini@hotmail.com>
Subject: Re: What can I do if I have not got chmop
Message-Id: <Whon9.37699$YI.7918175@twister.nyc.rr.com>
Nigel Goldsmith <nigel@bannockfarm.freeserve.co.uk> wrote:
> Wrote a little bit of code on perl 5 then took it on to an old Sun
> box and it did not like chomp, are there any alternatives? I am
> sure there are let the code flow!!!
There is *no way* to do it.
You have to upgrade. :)
[ tested only on 5.8 ]
sub chomp {
return 0 unless defined $/;
local $*;
local $ret = 0;
if (length $/) {
foreach (@_ ? @_ : $_) { $ret += s|$/$|| }
}
else {
foreach (@_ ? @_ : $_) { $ret += s|\n+$|| }
}
$ret;
}
--
Steve
perldoc -qa.j | perl -lpe '($_)=m("(.*)")'
------------------------------
Date: Fri, 4 Oct 2002 17:02:10 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: What can I do if I have not got chmop
Message-Id: <3d9e2c02$1@news.microsoft.com>
Nigel Goldsmith wrote:
> Wrote a little bit of code on perl 5 then took it on to an old Sun
> box and it did not like chomp, are there any alternatives? I am sure
> there are let the code flow!!!
Well, you could use chop instead, but it's not as convenient because it will
chop-chop any character, not just newlines.
jue
------------------------------
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 3917
***************************************