[11652] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5252 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 29 15:17:24 1999

Date: Mon, 29 Mar 99 12:00:20 -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           Mon, 29 Mar 1999     Volume: 8 Number: 5252

Today's topics:
    Re: A script <cassell@mail.cor.epa.gov>
        ANNOUNCE: Champaign-Urbana.pm Meeting Mon Mar 29 (Daniel S. Lewart)
    Re: code to search for URLs? <cassell@mail.cor.epa.gov>
        Connecting to Oracle 8 database from Perl via web serve (Bill Morgan)
    Re: Dropped TCP Connection vedin@my-dejanews.com
        emulating Expect.pm calls over an RPC call <tripix@tdi-net.freeserve.co.uk>
        flock() in java <david@kasey.umkc.edu>
        Guru help needed - Posting from perl-cgi to newsgroup gbacon@my-dejanews.com
    Re: Guru help needed - Posting from perl-cgi to newsgro <Tony.Curtis@vcpc.univie.ac.at>
    Re: Help with easy script <gellyfish@gellyfish.com>
    Re: HELP: Confused about Hash Table. (Gregory Snow)
        I need to exchange email with a good database person. (Robert Saunders)
        Identify Drive Letter (DMSbclar)
    Re: Initializing an array with STDIN (newbie) <cassell@mail.cor.epa.gov>
        Need I lock the database file, If I open it using dbmop <sergeiga@hotpop.com>
        PERL coredumps with tie but not tied <jg221597@concorde.cosd.fedex.com>
    Re: Perl Editors for WinNT? <ukar@total.net>
        Q: Net::FTP, Timeout doesn't seem to work <grayku@my-dejanews.com>
    Re: qe:operation on binary files (Larry Rosler)
    Re: Statistics for comp.lang.perl.misc <cassell@mail.cor.epa.gov>
    Re: Use of uninitialized value at ... why? <jeromeo@atrieva.com>
    Re: Use of uninitialized value at ... why? <aqumsieh@matrox.com>
        WIN32::SERVICES::GETSTATUS mclaughlinj@leaders.ccl.org
    Re: Writing isn't working, and the mode is set, Help! <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 29 Mar 1999 11:05:59 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: A script
Message-Id: <36FFCF17.90B1ACDA@mail.cor.epa.gov>

Solder182 wrote:
> I am looking for a script that, when I as an admin give a database some URL's
> visitors from my web site can search through (spidering) contents on those
> sites. I have looked everywhere for a script that does this and I know there
> out there but i don't know what to look for it as. Wether it is classified as a
> Link indexer, search engine, etc. Please let me know where I can find this
> script  (Preferably free)Thanks

Go to www.perl.com and look at the bottom of the page.  There is a link to
webreview.com on an article titled 'Agent Perl: The Polite Web Spider'.
Maybe that's what you're looking for.

> Digital Explorer
> ICQ-5989580
> AIM-DigitalEx1
> http://members.tripod.com/nzhero/
> "Knowldege Is Power"

Knowldege?  Is that anything like 'knowledge'?  I always preferred
'fortitudino per scientiam' myself.
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: 29 Mar 1999 19:53:24 GMT
From: d-lewart@uiuc.edu (Daniel S. Lewart)
Subject: ANNOUNCE: Champaign-Urbana.pm Meeting Mon Mar 29
Message-Id: <7dolnk$g51$1@vixen.cso.uiuc.edu>

Champaign-Urbana Perl Mongers,

Based on everyone's preferences, we will meet TONIGHT:
	Mon Mar 29 18:00 CST
	Papa Del's
	206 E Green St
	Champaign, IL

We will be in the non-smoking area.  I will wear my Perl t-shirt.

See y'all,
Daniel Lewart
Champaign-Urbana Perl Mongers Fearless Leader
d-lewart@uiuc.edu
http://cmi.pm.org/


------------------------------

Date: Mon, 29 Mar 1999 11:09:10 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: code to search for URLs?
Message-Id: <36FFCFD6.D7BA72C@mail.cor.epa.gov>

IndexFinger.com wrote:
> > Alternatively, which language do you think would be the easiest for
> > writing a program to do this?
> 
> Perl would be the easiest to write,

Agreed.

>                                     C++ will run faster.

In theory.  In practice, maybe not.  Take a look at Kernighan
and Pike's new book for an example.

"The difference between theory and practice is that in theory
there isn't any difference."

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 29 Mar 1999 18:34:02 GMT
From: wmorgan@nswc.navy.mil (Bill Morgan)
Subject: Connecting to Oracle 8 database from Perl via web server
Message-Id: <7dogl5$qj1$1@oanews.nswc.navy.mil>

I am running Netscape Enterprise Server 3.6 under 
NT 4.0 with service pack 4.  I am using Active 
State Perl to connect to an Oracle 8 database via 
ODBC.  Is there a better way to connect to Oracle 
from Perl under NT such as using native Oracle 
drivers?  Please email any responses as well as posting to this group.
Thanks very much!

---------------------------------------------------------------------------
William E. Morgan       NAVAL SURFACE WARFARE CENTER
Code N84                     email: wmorgan@nswc.navy.mil
17320 Dahlgren Rd.     phone: (540)653-6088
Dahlgren, VA  22448   fax: (540)653-1810



------------------------------

Date: Mon, 29 Mar 1999 18:52:37 GMT
From: vedin@my-dejanews.com
Subject: Re: Dropped TCP Connection
Message-Id: <7doi5h$la5$1@nnrp1.dejanews.com>

In article <36F6ED25.F96D04ED@yahoo.com>,
  Leo Chang <lchang2@yahoo.com> wrote:
> I'm writing an http server in perl using non-blocking sockets.  To make
> the
> socket non-blocking, I used fcntl and bitwise-ORed the existing
> socket_flags
> with O_NONBLOCKING.  I'm looping through and (using IO::Select) checking
> for
> can_read and accepting connections if $sel->can_read(0) returns true.
> The
> socket is an IO::Socket::INET.
>
> When I stress-test the server using a Windows tool called Socrates, I'm
> seeing some dropped connections.  (The server is on a Linux box, kernel
> 2.0.36, perl version 5.005_02, dual-Pentium Xeon machine.)  Socrates
> sees no
> dropped connections when it hits Apache.
>
> My first suspicion was the listen queue size, but I set that to be
> larger
> than the number of clients being simulated (20) by Socrates, and it
> didn't
> solve the problem.  I had some suspicion that it might be a SO_LINGER or
> a
> TCP_NODELAY problem, but I'm not sure those will help.  Also, I haven't
> seen
> any perl examples of a proper call to setsockopt to set those options.
>
> Can anyone help or direct me to help?
>
> Thanks.
>
> -Leo
>
> ----
> Leo Chang
> Lchang@jumpsmart.com
>

Try
 ...
@proto = getprotobyname('TCP');
setsockopt($sock, $proto[2], 1, 1) || die "Failed to set TCP_NODELAY\n";

or, if you mangled netinet/tcp.h with h2ph

require "usr/include/netinet/tcp.ph";
 ...
setsockopt($sock, $proto[2], &TCP_NODELAY, 1) || die "Failed ...


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 29 Mar 1999 19:22:13 +0100
From: "Wayne Keenan" <tripix@tdi-net.freeserve.co.uk>
Subject: emulating Expect.pm calls over an RPC call
Message-Id: <7dogpv$acr$1@news8.svr.pol.co.uk>

Im using the RPC.pm (found in the Camel book)
Im also using Expect.pm (1.07)

I have built a client/server module that can expose to a client script any
number of serial ports
located on any machine(s) with an IP address and running the server side of
the module.

I currenlty pass calls via the RPC module to the server(s) and can execute a
handful of the Expect.pm
member functions.  (for those who want to know, the Server Side cuaX
'wrapper object' does not inherit from Expect, it has a few dedicated
functions that call the embedded Expect object)


I have this question:
Is it possible to send some form of object which represents a local
File Descriptor or PID over a RPC call and use it at the reciving side
transparently?
for example:  being able to redirect STDOUT of a server side spawed proccess
(vie Expect) and have
it received at a client STDIN  (etc.)

Im thinking tie, but that doesn't look quite possible, and I wondered about
inheriting Expect.

Does anyne have any suggestions?

Thanks again.

Wayne




------------------------------

Date: Mon, 29 Mar 1999 19:45:45 +0000
From: "David L. Nicol" <david@kasey.umkc.edu>
To: Byron Brummer <byron@omix.com>
Subject: flock() in java
Message-Id: <36FFD869.FF7B555A@kasey.umkc.edu>



Byron:

In order to get a proper answer to your question, since you apparently
want to have a flock() style locking semantics from within a Java
program,
I am crossposting this reponse to you to two comp.lang.java newsgroups.


Before you read what I have written below and get angry, please know 
that I am not a Java expert, although I am very impressed with that
language's easy semantics for writing multithreaded server applications.

Also I have read some materials about alternate operating systems such
as Jonothan Shapiro's "Extremely Reliable Operating System" project
which
do not offer file system services at all, using other paradigms of data
persistence. (on which traditional hierarchical file systems tend to
get built anyway, but in that context we know they're an abstraction,
instead
of accepting them as divinely granted.















Byron Brummer wrote:
> 
> "David L. Nicol" <david@kasey.umkc.edu> wrote:
> > Zenin wrote:
> > >
> > >         And people wonder why Java has no locking semantics what so ever.
> > >         :-)
> > >
> > > -Zenin (zenin@archive.rhps.org)
> >
> > The abstraction of connections and streams could be considered a locking
> > semantics
> 
>         Please, enlighten me as to how.


Server opens a serial socket, allowing one client at a time
to connect to it.  The simplest servers work this way, dealing
with a single client at a time.  That client has exclusive
access to the service during the life of the socket.

That's a locking semantics.


 
> > > -- what need has java for files at all?
> 
>         Maybe, to store data?
> 
>         Just a thought, I could be wrong, but that's what I've always used
>         files for myself.


But why are you trying to store data _with_Java_?  

What I think I'm trying to say to you is that if you want to use a file
abstraction maybe java isn't the right language.

In the fully java-enabled universe, data is stored on data servers,
which run some non-java program but have a well defined client
interface for the programs that use that data to connect to.

Like, SQL servers.  Which aren't written in Java, because they
aren't cross-platform clients.

Java is still "THE language for cross-platform network clients" is
it not, or did I miss a meeting?

Why is a cross-platform client application needing to use a file system,
(that isn't abstracted to it as virtual memory?)  Java may be the wrong
language for applications that require use of files.



Please cc any response to
Byron Brummer <byron@omix.com>

________________________________________________________________________
  David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
    "At truth, the media can be as bad as lawyers." -- Jason Czerak


------------------------------

Date: Mon, 29 Mar 1999 17:56:36 GMT
From: gbacon@my-dejanews.com
Subject: Guru help needed - Posting from perl-cgi to newsgroup
Message-Id: <7doesf$i7d$1@nnrp1.dejanews.com>

Please help me Mr. Guru (whoever you are)

I want to find a way
to post data directly
into certain newsgroups straight from our cgi

My programmer has never done this type of thing before
and we cannot find anything in the perl books
or out on the internet on how to interface a cgi
with a news server (just for posting)

We just
basically want to know how to pass information
(subject line, reply to address, and message body)
to my web hoster's news server (nntp.best.com)
from a cgi program running on commerce1.ba.best.com>

I would really appreciate an explanation or snippet
of code that illustrates how to get this done.  Be as
technical as you want in any help you can give because
we are halfway knowledgeable in cgi

Thanks a lot in advance,

Grant

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 29 Mar 1999 20:23:54 +0200
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: Guru help needed - Posting from perl-cgi to newsgroup
Message-Id: <834sn4w3wl.fsf@vcpc.univie.ac.at>

Re: Guru help needed - Posting from perl-cgi to
newsgroup, gbacon <gbacon@my-dejanews.com> said:

gbacon> Please help me Mr. Guru (whoever you are) I
gbacon> want to find a way to post data directly
gbacon> into certain newsgroups straight from our
gbacon> cgi

I would be sure to test this only on local "test"
groups first before hitting USENET in toto with
it...

gbacon> My programmer has never done this type of
gbacon> thing before and we cannot find anything in
gbacon> the perl books or out on the internet on how
gbacon> to interface a cgi with a news server (just
gbacon> for posting)

Interaction with a news server has nothing to do
with CGI, which is just the interface between the
WWW server and the code dealing with the HTTP
request (here: your perl program).

To talk to a news server via NNTP in perl, use the
Net::NTTP module, more info:

    perldoc Net::NNTP

If you don't have it, go to http://www.cpan.org/ and
get it there.

gbacon> We just basically want to know how to pass
gbacon> information (subject line, reply to address,
gbacon> and message body) to my web hoster's news
gbacon> server (nntp.best.com) from a cgi program
gbacon> running on commerce1.ba.best.com>

To handle the CGI interface you should use

    CGI.pm     (cunningly named eh?)

"perldoc CGI" for more info, it's a standard module
in perl distributions.


hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


------------------------------

Date: 28 Mar 1999 16:35:40 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help with easy script
Message-Id: <7dllos$9l$1@gellyfish.btinternet.com>

On Sun, 28 Mar 1999 16:24:19 +0200 Ophir Marko wrote:
> Does anyone have a script that opens a text file, searches it for a line
> in which the string 'x' appears, then copy's the whole line in which the
> string appeared to a new file? I'm having trouble making one, and I'm
> not the worlds most patient person.
> 

 No but I have always used grep for this *whatever platform I might be on*

like:

grep x somefile >somenewfile

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 29 Mar 1999 19:02:17 GMT
From: snow@biostat.washington.edu (Gregory Snow)
Subject: Re: HELP: Confused about Hash Table.
Message-Id: <7doinp$15fc$1@nntp6.u.washington.edu>

In article <MPG.116412f291d30286989797@nntpd.bb.dec.com>,
KEhlar <KEhlarQUASH@SPAMMERtheglobe.com> wrote:

>
>That was my mistake, I should have had the second hash shown as below:
>
> %hash1 = ('1,element1', '2,element2'....so on);
>
>Then I can split it:
>
> foreach (@hash1) {
>    ($num,$ele)=split /,/;
>        print "$num has $ele\n";
> }
>
>Is it more clear what I mean now?

I think I see what you are getting at (but you should probably read up
more on hashes).

try the following (various options included as examples):

#!/usr/local/bin/perl -w

use strict;

# using '-w' and 'use strict' are good habits to get into

my %example_hash=('cat','meow',  'dog' => 'woof' );
# declare and intialize hash

@example_hash{ ('cow',"sheep") } = ("moo",'baa');
# add to hash using slice method

$example_hash{'pig'} = 'oink';
# add single pair

# print all the keys
print(join(":",keys %example_hash),"\n");

# print all values
print(join(':', values %example_hash),"\n");

# print key value pairs
while ( my ($key,$value) = each %example_hash ) {
  print "$key:\t$value\n"
}

print "\n\n\n";

# print sorted pairs
for my $key ( sort keys %example_hash ) {
  printf "%10s:  %10s\n", $key, $example_hash{$key};
}



This gives me:

pig:cat:cow:dog:sheep
oink:meow:moo:woof:baa
pig:    oink
cat:    meow
cow:    moo
dog:    woof
sheep:  baa



       cat:        meow
       cow:         moo
       dog:        woof
       pig:        oink
     sheep:         baa


Is any of that what you were trying for?

>
>My question is basically WHAT would I use (if I can at all) to split the hash 
>table created with the first method the way I did with the one created with the 
>second method.
>

I think the problem is that you are trying to do something by hand
that perl does for you, look in perlfunc at "keys", "values", and "each".

>>    Are you processing Perl source code or something?
>
>I don't understand your question. 

The only commas in your example told Perl how to create the hash and
never made it into the internal representation of the hash.  The only
way your question as originally written made sence is if you wanted to
write a script that would read in another script and do something with
the hash definitions (possible, but probably done easier with an eval,
at least for us non-gurus).


>
>Novey Chou
>-- 
>remove QUASH SPAMMER from email address.


-- 
-------------------------------------------------------------------------------
     Gregory L. Snow         |   The trouble with doing something right the
     (Greg)                  | first time is that nobody appreciates how
snow@biostat.washington.edu  | difficult it was.


------------------------------

Date: Mon, 29 Mar 1999 18:07:41 GMT
From: robert@iminet.com (Robert Saunders)
Subject: I need to exchange email with a good database person.
Message-Id: <8CE83CD04F2C2362.3A48541F455B3964.3A328F73766EAFFA@library-proxy.airnews.net>

I have some questions on a project coming up and I would like to
exchange some emails with a good database person.. 

robert@iminet.com


------------------------------

Date: 29 Mar 1999 19:31:02 GMT
From: dmsbclar@aol.comnospam (DMSbclar)
Subject: Identify Drive Letter
Message-Id: <19990329143102.23511.00003734@ng-ch1.aol.com>

I need to be able to identify the CD-ROM drive letter of a client's PC from a
web page that is housed on a HPUX server.  I wrote a beautiful function in
VBScript, but it cannot be processed on a UNIX server.  I have noted a few
things that may work (GetCwd() or Path_Translated), but alas I do not know
anything about PERL yet.  

Is there hope?


------------------------------

Date: Mon, 29 Mar 1999 10:33:54 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Initializing an array with STDIN (newbie)
Message-Id: <36FFC792.315122D4@mail.cor.epa.gov>

Sender wrote:
> [big snip here]
> OK.....here's two ways I tried:
> 
> #!/usr/bin/perl -w

That's good.  What errors did Perl give you?  Did you
look them up in perldiag to get the long version of the
error messages, so you would know what they meant?
 
> open (INFILE, "/home/bb/docs/list/book");

Always check whether your open() worked, or your
program will someday die mysteriously, leaving you with
a mystery you'll need Columbo to solve.

  open (INFILE, "/home/bb/docs/list/book") or die "open failed: $!\n";

> @order = INFILE;

Oops.  Here's the biggie.  -w told you about this, but you might
not have understood the error message.  And the close() might
as well go up here, once you're done with the file.

  @order = <INFILE>;

> split(/^$/, INFILE);

Oops again.  You don't need to do any split().  And a pattern
like /^$/ wouldn't help you split single lines anyway.  @order
is now an array with one line of your file in each element.
 
> print "\n", $order[442];

BTW, this will give you the 443rd line of your file.  Is your
file that long?  But you got the '$' in front correct.  You're
using a scalar - one element of the array - so you use the
'$' instead of '@'.
 
> close (INFILE);

I like to check the close() too.

> 
> [more stuff snipped]

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 29 Mar 1999 14:26:21 -0500
From: Sergei Gnezdov <sergeiga@hotpop.com>
Subject: Need I lock the database file, If I open it using dbmopen?
Message-Id: <36FFD3DD.AA57BED5@hotpop.com>

I'm using dbmopen to do changes in database file like this:
dbmopen (%db, $db_name, oct (0666));
If two users will try to change the same file will it be corrupted or
not?  If yes, then how can I lock it, because I do not have filehandle
to lock the file using flock.

Thank you.



------------------------------

Date: Mon, 29 Mar 1999 12:23:26 -0700
From: "James L. Gordon" <jg221597@concorde.cosd.fedex.com>
Subject: PERL coredumps with tie but not tied
Message-Id: <36FFD32E.7453FA15@concorde.cosd.fedex.com>

	Hmm... probably needs a better subject.

	I'm inheriting from a module that's implementing a hash tie and it
works quite wonderfully.  If I create a new instance of my module (or
just use the value returned from tie or tied), then I can call FETCH and
STORE and all the rest and it all works wonderfully.  If I use the tied
hash however, it gets a bus error and dumps core.  I'm using perl -w and
use strict (of course).

my(%assoc);
my($obj) = tie %assoc, 'MyDir::MyClass';

These work all day long:
$obj->FETCH($key);
$obj->STORE($key,$value);

But these will crash:
$assoc{$key};
$assoc{$key} = $value;

	The value returned by the first tie is another tie, but even if it's
just a string, it still crashes.  In fact, even if I remove everything
and only overload the FETCH it crashes (if I overload nothing, it
works).  I know we can inherit from tie classes, because that's what
Tie::Hash and Tie::StdHash are for, right?  Besides, if I use it in an
OO way instead of as a tie it works perfectly.
	The only thing my subclass does is change the keys using Date::Manip. 
So I wondered if there was some rule against doing that, but I couldn't
see anyway that would be important and I've never read anything like
that.
	Maybe one of the gurus can explain this while I'm having lunch. :-)  If
you need more info, feel free to ask.  I don't know that it's important,
but I'm inheriting from AsciiDB::TagFile and it's for a
scheduling/calendar type object (hence the use of Date::Manip).

--
	James L. Gordon


------------------------------

Date: Mon, 29 Mar 1999 14:21:59 -0400
From: "Ulrich Karthaus" <ukar@total.net>
Subject: Re: Perl Editors for WinNT?
Message-Id: <7xPL2.48$i%5.2920@news15.ispnews.com>

Check out  vim  at  www.vim.org.  Has a nice feature to colour code syntax
(seperate perl syntax file is there as well.).  ...and it's free
----------
In article <36f0ab08.199787@news.muenster.de>, buffy@muenster.de (Karina
Smit) wrote:


>Hey!
>
>
>>Is this something specific for NT?  Because I've been using UltraEdit and
>>EditPad (it's a bit smaller) for some time with no problems and nothing but
>>praise.
>Check GTE at www.iridis.com/gwd. It's pretty cool.
>
>


------------------------------

Date: Mon, 29 Mar 1999 18:48:55 GMT
From: Kurt Gray <grayku@my-dejanews.com>
Subject: Q: Net::FTP, Timeout doesn't seem to work
Message-Id: <7dohuk$l5l$1@nnrp1.dejanews.com>

I've written a simple perl FTP script that runs from Apache as a CGI.
It uses the Net::FTP module to transfer files to a remote host.

I have this problem: If the remote host does not respond
to the FTP login request then the CGI script waits
and waits then eventually dies.

I've tried setting Timeout => 20 and even smaller values
when calling Net:FTP->new(), but still the script waits
forever if the remote host is not listening to the FTP port.

I've also tried using Net::Ping() to check if the remote
host is alive before attempting FTP, but even if the
remote host responds to a ping doesn't mean it will
respond to FTP, and again the script may hang.

I guess my only option is enclose the call to
Net::FTP->new() in some sort of timer/interupt
function???

Any ideas?

Thanks,
Kurt


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 29 Mar 1999 10:49:02 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: qe:operation on binary files
Message-Id: <MPG.11696afd7309aa4f9897ec@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36FFB6AC.9A6099DE@ltt.ntua.gr> on Mon, 29 Mar 1999 20:21:48 
+0300, Costis Angelis <loulou@ltt.ntua.gr> says...
> Nir Leshem wrote:
> >  i need to bitswap each word in a binary file
> > (i.e 0000_0000_0000_0001 becomes 1000_0000_0000_0000)
> > how can i do that on  a binary file without the trivial solution of
> > translating  it into ASCII?????
> 
> I am not very experienced, almost not at all, but having faced a similar
> situation recently, check reverse in a scalar context. I could be all
> wrong of course.

You might have looked at the documentation for the reverse() function 
before posting a conjecture about it.  It very explicitly reverses the 
order of the bytes in a string, not the order of bits.

"In scalar context, concatenates the elements of LIST, and returns a 
string value consisting of those bytes, but in the opposite order."

As Jonathan Feinberg responded, unpack() and pack() have the needed 
capabilities ('b' and 'B' formats).

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Mon, 29 Mar 1999 11:54:08 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <36FFDA60.40D637B3@mail.cor.epa.gov>

Greg Bacon wrote:
> [snip]
> 
> Top 10 Posters by Number of Posts
> =================================
> 
>          (kb)   (kb)  (kb)  (kb)
> Posts  Volume (  hdr/ body/ orig)  Address
> -----  --------------------------  -------
> 
>    58   123.5 ( 47.2/ 69.5/ 31.5)  "David L. Cassell" <cassell@mail.cor.epa.gov>
>    [rest snipped...]
>
> Top 10 Posters by Volume
> ========================
> 
>   (kb)   (kb)  (kb)  (kb)
> Volume (  hdr/ body/ orig)  Posts  Address
> --------------------------  -----  -------
> 
>  123.5 ( 47.2/ 69.5/ 31.5)     58  "David L. Cassell" <cassell@mail.cor.epa.gov>
>  [rest snipped...]
>
> These posters accounted for 26.9% of the total volume.
> 
> [another snip]
>
> Bottom 10 Posters by OCR (minimum of five posts)
> =================================================
> 
>          (kb)    (kb)
> OCR      orig /  body  Posts  Address
> -----  --------------  -----  -------
> 
> 0.460  (  3.9 /  8.4)     13  sowmaster@juicepigs.com (Bob Trieger)
> 0.455  (  1.9 /  4.2)      5  Eric The Read <eric.schwartz@acm.org>
> 0.454  ( 31.5 / 69.5)     58  "David L. Cassell" <cassell@mail.cor.epa.gov>
> [more snipped]

Brother.  I've got to get a life or something.  Well, at least I didn't
make the top 10 crossposters...

David


------------------------------

Date: Mon, 29 Mar 1999 10:01:11 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Use of uninitialized value at ... why?
Message-Id: <36FFBFE7.5058A115@atrieva.com>

Matthew Amster-Burton wrote:
 
> Why waste the magical $_?
> 
> while( <iFhandle> ) {
>    if( /^>/ ) { ... }
> }


Or you could even save yourself an indent.

while(<iFileHandle>){
	next unless /^>/;
	...
}

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


------------------------------

Date: Mon, 29 Mar 1999 13:17:14 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Use of uninitialized value at ... why?
Message-Id: <x3yww00qhxx.fsf@tigre.matrox.com>


Federico Abascal <fabascal@gredos.cnb.uam.es> writes:

>     my($buffer) = "";
>     my($someVariable) = "";
>     my($inputFile)=$ARGV[0];
>     local(*iFhandle);
>     open(iFhandle, $inputFile);

check to see if your open() succeeded or not:

	open iFhandle, $inputFile or die "Couldn't open $inputFile: $!\n";

also, try to stick to the convention that filehandles should have
CAPITALIZED names.

>     $someVariable=<iFhandle>;

You are disposing of the first line in $inputFile here.

>     while(<iFhandle>) {
>         $buffer = $_;

You don't need the above done separately in two steps. You can either
go ahead and use $_ everywhere, or read directly into $buffer:

	while(defined($buffer = <iFhandle>)) {

or, if you have Perl 5.005 or later:

	while ($buffer = <iFhandle>) {

>         if($buffer =~ /^>/ || eof(iFhandle)) { ......

Depending on your application, you might not have to test for eof
here. $buffer is guaranteed to contain data from $inputFile since the
while loop condition was satisfied. The eof() tests whether or not
there is more data to be read from the filehandle.

>             .......
>             .......
>         }
>     }
> 
> 
> "perl -w" says "Use of uninitialized value at iss.pl line xxxx (the one
> of eof()), <iFhandle> chunk 2."??

What is inside the if() block? The reported line number might not be
the actual line where the error occured. Most probably the warning is
generated by something within your if() block. Can you post that?

> I would like to understand it, so thanks for your answers,

Show us some more code.

HTH,
Ala



------------------------------

Date: Mon, 29 Mar 1999 18:56:46 GMT
From: mclaughlinj@leaders.ccl.org
Subject: WIN32::SERVICES::GETSTATUS
Message-Id: <7doid9$lfb$1@nnrp1.dejanews.com>

Okay,

How do I pass a service name to WIN32::SERVICES::GETSTATUS that has
whitespace? The following works fine for services that are one word
(EventLog) but dies on multiple words i.e., Net Logon or Microsoft Exchange
System Attendant.  How do I pass a multi-word service to the GetStatus
routine?  I've tried every combination of quotes and ticks as well as
searching the docs, yup - I don't get it.  thanks, in advance - jeff

use Win32::Service;
$service = ("Net Logon");
$server = "\\\\myserver";
print "$server and $service \n";
Win32::Service::GetStatus($server, $service, \%status) || die $!;
print "  $service okay " if ($status{CurrentState} == 4);

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 29 Mar 1999 10:59:19 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Writing isn't working, and the mode is set, Help!
Message-Id: <36FFCD87.96E0189F@mail.cor.epa.gov>

Eric Bohlman wrote:
> William Flanagan <wflanagan@msn.com> wrote:
> : The program is to convert a Lotus Notes structured text file into a comma
> : delimited file,

Oh.  Lotus Notes.  You have my sympathies.

>:                  not knowing the fieldnames and fully expecting that the
> : fieldnames will increase over time.  So, that's why all the jumping about.
> : I learned a lot from this, and here's the program as it stands now.  Now,
> : it's completing and printing, but I'm looking for optimization.
> 
> [some nice support by Eric rudely snipped]
>
> : if ($#ARGV !=1) {
> :     die "Structured Text to Comma Delimiter, 1999 William Flanagan\n Usage:
> : $0 inputfile outputfile\n";
> :     }
> : ($infile,$outfile) = @ARGV;
> :    if (! -r $infile) {
> :       die "Can't read input $infile\n";
> :    }
> :    if (! -f $infile) {
> :        die "Input $infile is not a plain text, please use a structured plain
> : text file\n";
> :    }

Don't you want to check that your file is a 'text' file, instead of merely
a 'plain' file?  Try:
      unless (-f $infile && -T _) {
above.  Otherwise you may someday get a binary file that your code won't like.

> [More nice help snipped, since this morning I don't seem to have
   Eric's patience.  And he has already covered the bases...]

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 5252
**************************************

home help back first fref pref prev next nref lref last post