[6906] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 531 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 28 10:09:21 1997

Date: Wed, 28 May 97 07:00:28 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 28 May 1997     Volume: 8 Number: 531

Today's topics:
     Re: ATTENTION -- NEED A SCRIPT <dorman@s3i.com>
     Re: comp.lang.perl.web (Grant Miller)
     Re: extract character from string array and use as inte <flg@vhojd.skovde.se>
     Re: extracting columns (Mark Mills)
     Re: extracting columns (Bob Wilkinson)
     Font for programming <martin.lonnar@edt.ericsson.se>
     Re: Font for programming (Nathan V. Patwardhan)
     Re: Linux issues with 5.004. (Rachel Polanskis)
     Re: listing of Filenames under a directory (Cornelius Griffin)
     Re: LWP and SIG traps not playing well together! <aas@bergen.sn.no>
     Mailto Perl script for NT <jgarner@knowlogy.com>
     make test fails for 5.004 on WIN-NT4 SP3 at lib/timeloc <kuehn@zv.fhg.de>
     Mysterious behavior with FileHandles, zero byte files c (FURNERNER)
     needed: perl guru rroberts@gowebway.com
     Re: needed: perl guru (A. Deckers)
     Re: nslookup's in perl <flg@vhojd.skovde.se>
     Re: nslookup's in perl <news@alf.impaq.com.pl>
     Re: Open and print HTML file insside CGI script (Eric Bohlman)
     Perl 5.004 on HP-UX 10.20 <lingnau@tm.informatik.uni-frankfurt.de>
     Re: Perl online manuals/tutorials <dorman@s3i.com>
     Re: problem with perl, ODBC.pm  and CGI.pm (Grant Miller)
     Re: PURE PERL .gif creating library needed; not in @#$  <paf@fbit.msk.su>
     Re: PURE PERL .gif creating library needed; not in @#$  <paf@fbit.msk.su>
     Question: Pattern Matching and Counter Variables <sheptonp@oup.co.uk>
     Receiving POST reponse in chunks? rlopes@securid.com
     Re: Receiving POST reponse in chunks? <aas@bergen.sn.no>
     Same problem on Dec Alpha ! <jfarcis@ifhamy.insa-lyon.fr>
     Re: Status of Perl Compiler (Malcolm Beattie)
     Re: Using hash, appending and dbm (Chris Nandor)
     Re: Using perl and rlogin (Paul Vermette [NiD/BiM])
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 28 May 1997 08:31:45 -0400
From: Clark Dorman <dorman@s3i.com>
Subject: Re: ATTENTION -- NEED A SCRIPT
Message-Id: <dyb8z22xa.fsf@s3i.com>


n1graphics@aol.com (N1Graphics) writes:
> Hi There!
> 
> I need a Perl script for Perl 5.003 that is able to take some submitted 
> data and repost it as a confirmation. I would also like if you would 
> leave a place for me to add in some HTML that will be displayed on the the
> confirmation page. Then the submit button should activate mail.pl. E-mail
> me at ABergs@juno.com if you need more info. I need this fast.
> 
> E-mail me at ABergs@juno.com

Excellent.  That sound like exactly what I am qualified to do.  I charge
$350/hour and I guarantee fast service.  Please email me if you are
interested. 

(For $350/hour, I'll do almost anything, including working for people like
this. :-)

-- 
Clark


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

Date: 28 May 1997 08:53:25 GMT
From: grant@statler.cc.wwu.edu (Grant Miller)
Subject: Re: comp.lang.perl.web
Message-Id: <5mgrq5$3s7$1@ra.cc.wwu.edu>

In article <5mbit9$2l9$1@news.xmission.com>,
Aaron M. Scarisbrick  <aaron@xmission.xmission.com> wrote:
>
>I've been following this newsgroup loosely for the past few years, and I
>can't help but think I'm not the only one that's thought of this:
>
>comp.lang.perl.web
>

Someone allready has (sort of).  It's called 
comp.infosystems.www.authoring.cgi.  



-- Grant Miller  grant@cc.wwu.edu  http://www.wcug.wwu.edu/~grant/
-- Western Washington University  Bellingham, Washington USA


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

Date: 28 May 97 08:16:29 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: extract character from string array and use as integer
Message-Id: <01bc6b3f$76b33920$e20f10c2@odens.di.vhojd.skovde.se>

David Dougal <ddougal@concentric.net> wrote in article
<5mfpmt$pch$1@news8.gte.net>...
>  
> @array = ("w0123456789","l0123456787","w0134265879", "t0123456789",
>           "w0123456789", "w0123456789");   
> 
> How can I extract the third character from one of the string elements and
then 
> use the character as an integer?

Hi, Maybe like this:

$Digit = substr($array[$n], 2, 1)  # Take the nth array element and third
character.

Now $Digit contains the number and I can use it in arithmetic expressions
if I want to. 

As an example, here is a program that loops over the array and counts the
total sum of all numbers in the third position of each element:

#!/usr/bin/perl
#
@array = ("w0123456789","l0123456787","w0134265879", "t0123456789",
                "w0123456789", "w0123456789");

print "Sum of third character in array: ";

#
foreach $item (@array) {
   $sum += substr($item, 2, 1);   # Pick out third character, and use it as
an integer.
}

print $sum, "\n";

__END__

Hope this helps

/Fredrik

 


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

Date: Wed, 28 May 1997 06:58:32 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: extracting columns
Message-Id: <338fd09f.5649843@news.ntr.net>

On Wed, 28 May 1997 02:00:41 GMT, tcyang@netcom.com (Tung-chiang Yang)
wrote:

>(untested)
  ^ works fine :}
>You use the structure
>
>   @foo = split(/\s/, $_);
>
>to decompose a line into an array, then $foo[i] will be the (i+1)th
>column you are looking for.
>
>If you are handling data from the other people, perhaps you need to
>check whether i exceeds the index range of @foo or not.

>Vijay Telang (vijay.telang@citicorp.com) wrote:
>: Can someone give me some idea about how to cut/change  a column from a
>: ascii file. I extarct an ASCII file from one of my systems and need to
>: change dat in specific columns, such as a date field etc.
>
>: In shell script I would be using cut to do the job. SO what would be
>: equevelent to cut.

I'd use split (as above) if you mean columns in the sense of the third
item on each line...

hello goodbye what
hi bye uh
greetings farewell interrogative

but if you mean data like

asdfasdfLSDFD3456345ASDFADSF
qwerqweeHFGRT3456553JSDFGSFF
ityhrrtyYUIUU8473566DFGSFHFF

I'd use unpack (ugly, but it works) or substr (beautiful, yet ugly)

substr ($_,13,7)="";

cuts the numbers out of the above example.  Basically when you use
substr as an lvalue (on the left of assignment, can take a value...)
it does sets the 7 chars from 13 to 19 and sets them equal to ""
(nothing).  If substr were on the other sire it would return ONLY the
numbers.

Some people find unpack easier but I don't recommend you use it unless
you are actually gonna need the data 'unpacked' from some format.

Also, if you are gonna CHANGE a column, say reverse the order of those
digits and then put them back this would work nicely:

substr ($_,13,7)= reverse substr ($_,13,7);

HTH
--
Mark <mark@ntr.net>
All I can say about this is that if you create a show for kids where the
hero is a demon from Hell, you're just asking for trouble. That's not a
moral judgement. That's just pure horse sense.
from http://us.imdb.com/washed-update.html - Greg Bulmash - 21 may 1997


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

Date: Wed, 28 May 1997 14:38:57 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: extracting columns
Message-Id: <b.wilkinson-2805971438570001@ip57-york.pindar.co.uk>

In article <338B7E45.59C8@citicorp.com>, Vijay Telang
<vijay.telang@citicorp.com> wrote:

> Hi all
> 
> Can someone give me some idea about how to cut/change  a column from a
> ascii file. I extarct an ASCII file from one of my systems and need to
> change dat in specific columns, such as a date field etc.
> 
> In shell script I would be using cut to do the job. SO what would be
> equevelent to cut.
> 
> Thanks in advance
> 
> Aswinee
> 
> -- 
> ---------*---------*---------*---------*---------*---------*---------
>      vijay.telang@citicorp.com           Do not wish to be anything
>      UNIX Systems Manager                but what you are , and try
>      Citibank, Sydney, Australia         to   be   that   perfectly
> ---------*---------*---------*---------*---------*---------*---------

Hello,

      You could use 

1. system("cut","arg1","arg2"); # since you're familiar with cut
2. substr # see perldoc perlfunc


Bob

-- 
I have become death, destroyer of the worlds.


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

Date: Wed, 28 May 1997 14:02:08 +0200
From: Martin Lvnnar <martin.lonnar@edt.ericsson.se>
Subject: Font for programming
Message-Id: <338C1EC0.2FF3@edt.ericsson.se>

Hi!

I'm doing programming on the windows platform and I'm looking for a good
monospaced font for programming. If it looks like the Monaco font on the
Mac platform it's nice.

/martin lonnar, Ericsson Data


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

Date: 28 May 1997 13:36:56 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Font for programming
Message-Id: <5mhcdo$9dm@fridge-nf0.shore.net>

Martin Lvnnar (martin.lonnar@edt.ericsson.se) wrote:

: I'm doing programming on the windows platform and I'm looking for a good
: monospaced font for programming. If it looks like the Monaco font on the
: Mac platform it's nice.

This has nothing to do with Perl.  Please post on-topic materials to
this newsgroup.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 27 May 1997 10:06:40 GMT
From: rachel@virago.org.au (Rachel Polanskis)
Subject: Re: Linux issues with 5.004.
Message-Id: <5mebng$pq9@janis.virago.org.au>

I also noted some issues with Linux and perl 5.004

I tried building a heavily optimised version of 5.004 on a linux 
box, with kernel 1.2.13, and gcc 2.7.0
I used the following optimisations:

-O3 -m486 -fomit-frame-pointer -fstrength-reduce -funroll-loops

Although the compile went perfectly, the tests failed on 
all the DBM, SDBM, GDBM, and NDBM modules, and some of the op* ones.

A closer look with "perl harness" and running the test individually 
indicated that these modules collapsed with Bus Errors, and segfaults.

I rebuilt perl with the standard optimisations, and all tests passed
100%...

Works fine anyway, and that 12kb perl binary plus the nice shared 
library is a wonderful thing, since my system runs many perl processes
simultaneously...

I love it!

rachel


                 defghijklmnopqrstuvwxyz:  What? No ABC?
--
Rachel Polanskis                 Kingswood, Greater Western Sydney, Australia 
grove@zeta.org.au                http://www.zeta.org.au/~grove/grove.html
r.polanskis@nepean.uws.edu.au    http://www.nepean.uws.edu.au/ccd/
                Witty comment revoked due to funding cuts


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

Date: Wed, 28 May 1997 09:17:06 -0400
From: EScrubb@worldnet.att.net (Cornelius Griffin)
Subject: Re: listing of Filenames under a directory
Message-Id: <MPG.df5fa5b33bacaeb989692@netnews.worldnet.att.net>

In article <Pine.SOL.3.91.970528143210.2751A-100000@hercules.iti.gov.sg>, 
chchee@iti.gov.sg says...
> Just wondering if there are any modules
> 	that list the all the filenames in a
> 	directory?
> 
> 
Not sure if you really need a module for this. Would readdir() combined 
with opendir() accomplish what you are trying to do. E.g.

untested script---imported from Camel book>>>>>>>

open(SOMEDIR, "c:/whatever/dir/") or die("Could not open dir $!");
@allfiles = grep /^\.ls/, readdir SOMEDIR;
close(SOMEDIR);

end script>>>>>>

If it doesn't work or if it doesn't help, let me know.

Cornelius 


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

Date: 28 May 1997 09:59:49 +0200
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: LWP and SIG traps not playing well together!
Message-Id: <hhgfof2mi.fsf@bergen.sn.no>

Chris Schoenfeld <chris@ixlabs.com> writes:

> Posted this earlier, we have narrowed down the problem to this:
> 
> When we catch 'die' sigs, LWP gives us a warning, here's the nice and
> tight test script - try it before and after commenting out the $SIG trap
> line:
> 
> #!/usr/local/bin/perl5 -Tw
> 
> _trap_die ('eek!');
> 
> sub	_trap_die {
> 	my	$msg = shift;
> 	print $msg;
> }
> 
> use	LWP::UserAgent;
> use strict;
> 
> $SIG{'__DIE__'} = \&_trap_die;
> 
> my	$ua = new LWP::UserAgent;

The following patch to perl's AutoLoader fixes the problem:

--- AutoLoader.pm.5.004 Wed May 28 09:46:57 1997
+++ AutoLoader.pm       Wed May 28 09:48:44 1997
@@ -11,6 +11,7 @@
 
 AUTOLOAD {
     my $name;
+    local($SIG{__DIE__});
     # Braces used to preserve $1 et al.
     {
      my ($pkg,$func) = $AUTOLOAD =~ /(.*)::([^:]+)$/;

-- 
Gisle Aas <aas@sn.no>


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

Date: Tue, 27 May 1997 09:20:20 -0400
From: Jeff Garner <jgarner@knowlogy.com>
Subject: Mailto Perl script for NT
Message-Id: <338ADF94.D97529A9@knowlogy.com>

I'm looking for a Perl Mailto script for NT.  Are there any mailto
scripts for NT.  I know about them for Unix boxes but haven't found a
ported one for NT.

Thanks in advance for the help
Jeff



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

Date: Wed, 28 May 1997 11:06:30 +0200
From: Peter K|hn <kuehn@zv.fhg.de>
Subject: make test fails for 5.004 on WIN-NT4 SP3 at lib/timelocal
Message-Id: <338BF595.6462@zv.fhg.de>

Hi,

I use the german version of Windows-NT 4.0 with SP3. I compiled
Perl 5.004 (for WIN32) with VC5 successfully so far. The only problem
I have is the failed localtime function which seems to return empty
values :-

 ...
lib/symbol..........ok
lib/texttabs........ok
lib/textwrap........ok
lib/timelocal.......FAILED test 1
        Failed 1/17 tests, 94.12% okay
lib/trig............ok
Failed Test  Status Wstat Total Fail  Failed  List of failed
------------------------------------------------------------------------------
lib/timelocal.t              17    1   5,88%  1
Failed 1/152 test scripts, 99.34% okay. 1/4015 subtests failed, 99.98%
okay.
NMAKE : fatal error U1077: '..\perl.exe' : return code '0xff'
Stop.

anyone can help? - Thanks in advance.

-- 
+-----------------------------------------------------------+
| Peter Kuehn * Fraunhofer Gesellschaft * <kuehn@zv.fhg.de> |
| Tel. +49-89-1205-614                                      |
+-----------------------------------------------------------+


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

Date: 28 May 1997 13:44:53 GMT
From: furnerner@aol.com (FURNERNER)
Subject: Mysterious behavior with FileHandles, zero byte files created.
Message-Id: <19970528134400.JAA12684@ladder02.news.aol.com>

I have been seeing some "mysterious" behavior when executing a "system"
call as follows:
    -->  system("copy", "file1", "file2", ">NUL", "2>NUL");
I am trying to keep STDOUT and STDERR from being painted on the screen my
script is being executed.   By executing the command as listed above, file
2 is created as a "zero" byte file.  If I remove the redirection of STDOUT
and STDERR, file2 gets created correctly.  The problem does not always
occur, which makes this problem "mysterious" to me.  Has anyone else had
any problems with FileHandles or with redirection of STDOUT or STDERR?


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

Date: Wed, 28 May 1997 13:30:54 GMT
From: rroberts@gowebway.com
Subject: needed: perl guru
Message-Id: <338c328b.2762580@news.interserv.com>

I need someone who is willing to help me learn by answering my silly
questions.
like why can't i get this simple program to work when i took it word
for word from the book.
email me if you can answer my questions.
rroberts@gowebway.com


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

Date: 28 May 1997 13:36:25 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: needed: perl guru
Message-Id: <slrn5ood6p.9o5.I-hate-cyber-promo@news.rediris.es>

In comp.lang.perl.misc,
	rroberts@gowebway.com wrote:
>I need someone who is willing to help me learn by answering my silly
>questions.

You don't want a guru, you want a teachers.

>like why can't i get this simple program to work when i took it word
                      ++++
>for word from the book.

Is this one of those hidden code tricks?

>email me if you can answer my questions.
>rroberts@gowebway.com

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
        Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<


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

Date: 28 May 97 06:49:41 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: nslookup's in perl
Message-Id: <01bc6b33$5655d0e0$e20f10c2@odens.di.vhojd.skovde.se>

JPR <jon@vcnet.TAKE-OUT-TO-REPLY.com> wrote in article
<jon-ya023480002705971632550001@news.vcnet.com>...
> After spending hours trying to get gethostbyaddr to return a hostname
from
> an IP address, I surrender. I've looked through the 2nd edition camel,
the
> perl.org pages, CPAN, etc. Can somebody give me an example of how to take
> 
> 192.68.68.1 and get whatever.domain.com

Hi. Here is a small program that lets you enter either an ip address, or a
domain
name. It uses the Socket module shipped with Perl.

The call you are interesting for you are

(gethostbyaddr(inet_aton($IpAddress), AF_INET))[0]

which will return the DNS Name for the given Ip Address. Notice that
gethostbyaddr
returns a list and my call will take one array element out if it (the 0th
element).

Anyway, here is the code

#!/usr/bin/perl -w
#
use Socket;

$arg = shift;

if ($arg eq "") {
    print ("Usage: nslook ipaddress|name\n");
    exit(0);
}

# Is it an IP adress?
if ($arg =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
    print "DNS Name: ", (gethostbyaddr(inet_aton($arg), AF_INET))[0], "\n";
} else {
    $ip = (gethostbyname($arg))[4];
    print "IP Address: ",  join(".", unpack("C4", $ip)), "\n";
} 
__END__

Hope this helps

/Fredrik


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

Date: Wed, 28 May 1997 10:25:43 +0200
From: Andrew Filip <news@alf.impaq.com.pl>
To: JPR <jon@vcnet.TAKE-OUT-TO-REPLY.com>
Subject: Re: nslookup's in perl
Message-Id: <338BEC06.921E6E83@alf.impaq.com.pl>

JPR wrote:

> After spending hours trying to get gethostbyaddr to return a hostname
> from an IP address, I surrender. I've looked through the 2nd edition
> camel,
> the perl.org pages, CPAN, etc. Can somebody give me an example of how
> to
> take
> 192.68.68.1
> and get
> whatever.domain.com

to get PTR record (ip addr->name)
nslookup 192.68.68.1

to get A record (name->ip addr)
nslookup whatever.domain.com

to get MX record
nslookup -type=mx whatever.domain.com

--
common sense is uncommon



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

Date: Wed, 28 May 1997 08:13:44 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Open and print HTML file insside CGI script
Message-Id: <ebohlmanEAvtIw.B7o@netcom.com>

Miran Sepic (miran.sepic4@mss.tel.hr) wrote:

: $login_page = "/user/download.html";
: open (FILE, "$login_page");
: @filein = <FILE>;
: print "Content-type: text/html\n\n";
: print @filein;

: The response is:

: Internet explorer cannot open the Internet site .....
: The operation completed successfully.

: When I put HTML directly inside script,  everything is OK.

You aren't checking to see if your open() was successful.  How do you 
know that you were actually sending *anything* out?




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

Date: 28 May 1997 12:27:42 GMT
From: Anselm Lingnau <lingnau@tm.informatik.uni-frankfurt.de>
Subject: Perl 5.004 on HP-UX 10.20
Message-Id: <5mh8bu$mv4$1@grapool30.rz.uni-frankfurt.de>

I'm trying to compile Perl 5.004 on a HP 9000/C160 running HP-UX 10.20.
When I do a `sh Configure -Dprefix=/local/pkg/perl/5.004 -des' on a
fresh copy of the distribution tree, the configuration script runs
through, but then what happens is

  Extracting writemain (with variable substitutions)
  Extracting x2p/Makefile (with variable substitutions)
  Extracting x2p/cflags (with variable substitutions)
  Run make depend now? [y]  
        sh ./makedepend
        make depend MAKEDEPEND=
        sh ./makedepend
        make depend MAKEDEPEND=
        sh ./makedepend
        make depend MAKEDEPEND=
        sh ./makedepend
        make depend MAKEDEPEND=
        sh ./makedepend
        make depend MAKEDEPEND=
        sh ./makedepend
        make depend MAKEDEPEND=
        sh ./makedepend

until the system runs out of processes. It works fine when I try it
on a DEC Alpha.

Has anybody had the same experience, or any idea about what to do?

Anselm
-- 
Anselm Lingnau ......................... lingnau@tm.informatik.uni-frankfurt.de
A society that will trade a little liberty for a little order will lose both,
and deserve neither.                                       --- Thomas Jefferson


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

Date: 28 May 1997 08:54:13 -0400
From: Clark Dorman <dorman@s3i.com>
Subject: Re: Perl online manuals/tutorials
Message-Id: <dwwoj21vu.fsf@s3i.com>


Ighon <ighon@infostrada.it> writes:
> Where I can find Perl online manuals/tutorials ?
> 
> I would learn this language.

The manuals come with perl.  Even if you don't install perl, you can
still look at the manuals (in pod format).  Go to a perl site near you
to get it.

However, I personally learn easiest by example.  Therefore, I like

http://www.planet.net/pmedined/books/books.htm

which is "Perl 5 by Example" by David Medinets.  Can anyone comment on
the technical contents of the book?  

More complete examples of code are useful for me as well.  Look at: 

http://www.metronet.com/perlinfo/scripts/

I've never really understood sockets.  However, I was completely lost
until I found the site:

http://www.cs.uno.edu/~golden/teach.html

which contains client / server code commented to a ridiculous degree
for someone who understands whats going on, but perfect for someone
who does not.

Personally, I really miss the sections titled "Common Tasks with Perl"
that was in the 1st edition of the Camel book, but not in the 2nd.
The "Real Programs in Perl" was also useful.  As it turns out, I have
the 2nd edition, but use it for "reference".  For most common
questions that I have, I use "Learning Perl" since I know it well
enough to just flip to the correct section / page.  The 1st Camel has
the sections I like.  The 2nd Camel is useful but not as much as the
other two.


-- 
Clark Dorman				"Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick


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

Date: 28 May 1997 09:00:24 GMT
From: grant@statler.cc.wwu.edu (Grant Miller)
Subject: Re: problem with perl, ODBC.pm  and CGI.pm
Message-Id: <5mgs78$411$1@ra.cc.wwu.edu>

In article <01bc6a92$4577a650$43c019c4@bwele>,
William Evans <williame@leisureplan.com> wrote:
>Get the latest version of perl (306), and use OLE and DAO, then you don't
>even need the ODBC perl module.  I have tried it, and it is very easy.
>

Could you give a nice little example of how to do this?  Thanks.


-- Grant Miller  grant@cc.wwu.edu  http://www.wcug.wwu.edu/~grant/
-- Western Washington University  Bellingham, Washington USA




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

Date: 28 May 1997 08:30:42 GMT
From: "Alexander Petrosyan" <paf@fbit.msk.su>
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules.  PERL!
Message-Id: <01bc6b3e$ce80c060$32c8c8c8@paf>

Abigail <abigail@fnx.com> ZAPISANO W STATX@ <EAvDMK.BtA@nonexistent.com>...
> ++ Wanna write count.pl, which outputs "content-type: image/gif".
> ++ For now, I only found
> ++ http://www.eecs.ukans.edu/~skang/programs/ksl-count.txt counter which
> ++ outputs image/x-xbitmap.
> ++ But I want multicolored image, which is impossible with x-xitmap
content
> ++ type.
> Output a PPM format then.
YYEESS!  Think it's what I'm looking for. Thanks a lot, Abigail.

> I don't understand what's against using existing (C) modules.
I't not me - it's... speaking perl terms:

sub MyActions {
	local($WhatLanguageToUse) = @_;
	...
}

sub MyBossAndISP {
	MyAction('Only PERL')
}

:( :)

-- 
Alexander Petrosyan, Moscow.
email: paf@fbit.msk.su
phone: +7(095)535-2222


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

Date: 28 May 1997 09:02:31 GMT
From: "Alexander Petrosyan" <paf@fbit.msk.su>
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules.  PERL!
Message-Id: <01bc6b44$77494550$32c8c8c8@paf>

Alexander Petrosyan <paf@fbit.msk.su> ZAPISANO W STATX@
<01bc6b3e$ce80c060$32c8c8c8@paf>...
> > ++ http://www.eecs.ukans.edu/~skang/programs/ksl-count.txt counter
which
> > ++ outputs image/x-xbitmap.
> > ++ But I want multicolored image, which is impossible with x-xitmap
> > Output a PPM format then.
> YYEESS!  Think it's what I'm looking for. Thanks a lot, Abigail.
To my great regret that PPM's NOT what I need.
>From the first sight I decided that it's like x-xbitmap and browser will
show it but... 
Browser said "what to do with it? I don't know"...

And in some counter.pl I've came across:
	open(OUT,"|/opt/pbmplus/bin/ppmtogif 2>/dev/null");
:(

But I need PURE PERL program producing multicolored image.

-- 
Alexander Petrosyan, Moscow.
email: paf@fbit.msk.su
phone: +7(095)535-2222


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

Date: Wed, 28 May 1997 12:43:22 +0100
From: Bal Grewal <sheptonp@oup.co.uk>
Subject: Question: Pattern Matching and Counter Variables
Message-Id: <338C1A5A.41C67EA6@oup.co.uk>

Hi,

I was wondering if anyone could offer me some help.

I'm trying to write a script to mark-up a bibliographic section into
SGML.

The individual references consist of:

<bb>Author name, blah, blah, blah ...</bb>

What I want to do is - where I find an instance of <bb>, I want to
replace it with <bb ID="$counter">, where $counter is the ID number of
the bibliographic reference in relation to other references already
matched, counted and number ID inserted. 
$counter is incremented after each match and substitution is made

Any suggestions?


Thanks,

Pete


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

Date: Wed, 28 May 1997 07:01:41 -0600
From: rlopes@securid.com
Subject: Receiving POST reponse in chunks?
Message-Id: <864766172.6018@dejanews.com>

I'm trying to recv a POST response in chunks using some sample code found
in an earlier post along the same lines.  I'm using Perl and LWP.  I have
written a perl script that mimics a browser to test a server app of ours.
I need to recv in chunks because sometimes the server responds with a
redirect, and when I recv normally the script hangs/waits approx. 2
minutes, I guess til it times out.

I had this:

    $doc = "";
    $res = $ua->request($req);
    $doc = $res->as_string;

I replaced it with:

    $doc = "";
    $expected_length;
    $bytes_received = 0;
    $ua->request($req,
        sub {
            print STDERR "...in the sub...";
            ($chunk, $res) = @_;
            $bytes_received += length($chunk);
            unless (defined $expected_length)
            {
                $expected_length = $res->content_length || 0;
            }
            if ($expected_length)
            {
                printf STDERR "%d%% - ", 100 * $bytes_received /
$expected_length;
            }
            print STDERR "$bytes_received bytes received\n";
            $doc = $doc.$chunk;
        });

When I run this I enter the sub when the server responds with anything
but a redirect.  When the server responds with a redirect Perl totally
"bypasses" the sub.  How come?  I'm not an experienced Perl programmer,
so I'm having a problem with the sub part.  I think that's where the
problem is.  At one point I rem'd out the unless piece, the if piece,
and both the unless and if pieces and still I wouldn't even see the
"...in the sub..." message.

Any help would be appreciated.
Thanks,
Bob
rlopes@securid.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 28 May 1997 14:39:35 +0200
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: Receiving POST reponse in chunks?
Message-Id: <hg1v7g48o.fsf@bergen.sn.no>

rlopes@securid.com writes:

> I'm trying to recv a POST response in chunks using some sample code found
> in an earlier post along the same lines.  I'm using Perl and LWP.  I have
> written a perl script that mimics a browser to test a server app of ours.
> I need to recv in chunks because sometimes the server responds with a
> redirect, and when I recv normally the script hangs/waits approx. 2
> minutes, I guess til it times out.

Perhaps this has anything to do with the following code from
LWP::UserAgent.  You might have to override redirect_ok() if you want
POST redirects to be handled transparently.

   sub redirect_ok
   {
       # draft-ietf-http-v10-spec-02.ps from www.ics.uci.edu, specify:
       #
       # If the 30[12] status code is received in response to a request using
       # the POST method, the user agent must not automatically redirect the
       # request unless it can be confirmed by the user, since this might change
       # the conditions under which the request was issued.

       my($self, $request) = @_;
       return 0 if $request->method eq "POST";
       1;
   }

This does not explains why it hangs.  How does does the redirect
response from the server look like?  Perhaps you can get a clue if you
turn on maximal debugging:

   use LWP::Debug '+';

> When I run this I enter the sub when the server responds with anything
> but a redirect.  When the server responds with a redirect Perl totally
> "bypasses" the sub.  How come?

That's how it is designed.  The callback is only invoked for
successful responses.  It's less confusing that way.

>                                 I'm not an experienced Perl programmer,
> so I'm having a problem with the sub part.  I think that's where the
> problem is.  At one point I rem'd out the unless piece, the if piece,
> and both the unless and if pieces and still I wouldn't even see the
> "...in the sub..." message.

-- 
Gisle Aas <aas@sn.no>


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

Date: Wed, 28 May 1997 09:42:28 +0200
From: Jeremie FARCIS <jfarcis@ifhamy.insa-lyon.fr>
Subject: Same problem on Dec Alpha !
Message-Id: <338BE1E4.38A7@ifhamy.insa-lyon.fr>

Hi !

	I also try to access a SQL server database under NT 4.0 with
perl, but on a Dec Alpha platform. Is it possible ? I would like to
make an interface between a web server (IIS 3) an my SQL server
database.

	Do you have any solution ?

	Jeremie

	jfarcis@ifhamy.insa-lyon.fr


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

Date: 28 May 1997 09:14:50 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Status of Perl Compiler
Message-Id: <5mgt2a$2gj@news.ox.ac.uk>

In article <5bhgfog2uj.fsf@smokey.prismnet.com>,
Mark A. Lehmann <mlehmann@prismnet.com> wrote:
>I've been using the Perl Compiler for about a week, but I've found that this
>awesome tool croaks on most of my code.  I see that the Perl Compiler at CPAN
>is near to a year old.  I have also seen information indicating that 
>Malcom Beatie is the project lead for Perl 5.005 so that the perl Compiler

Close, it's Malcolm Beattie.

>will be a working part of the Perl language.  Probably like most of the perl
>giants he is doing this with outrageous spare time that exists in the minds
>of the perl non-contributing user community.
>
>So, I'm curious, what is the scoop on the Compiler?  

I'm in the process of setting up a perl source repository for the
developers and integrating the two development trees I had
(threaded perl and pseudo-hashses+strong typing+RESTART{}) with
the changes made between 5.003 and 5.004. Once I have snapshots
based on 5.004 I can tweak the compiler extension to work with
both 5.003 and 5.004 and make another release. The current version
handles extension modules rather better (and is faster and less
memory hungry).

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"Widget. It's got a widget. A lovely widget. A widget it has got." --Jack Dee


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

Date: Wed, 28 May 1997 08:32:41 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Using hash, appending and dbm
Message-Id: <pudge-ya02408000R2805970832410001@news.idt.net>

In article <5mfr84$cok$1@news10.gte.net>, jbharvey@gte.net wrote:

#        $var  .= join "#", $date,$status, $user, $sess, $time, $clid;
#                $hash{$ip} = $var;
#
#But it reports this:
#
#        ndbm store returned -1, errno 28, key "199.180.3.29" at roto
#line 17, <DETAIL> chunk 118.

I could be wrong, so don't shoot me, but it seems I remember a similar
error that resulted from the value being too big.  I think for NBDM the
maximum size of key + value can be 1K.  Perhaps that is your problem.

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])
#=============================================================================
I will not sell school property.
                --Bart Simpson
#=============================================================================


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

Date: 28 May 1997 10:59:17 GMT
From: e5ir@jupiter.sun.csd.unb.ca (Paul Vermette [NiD/BiM])
Subject: Re: Using perl and rlogin
Message-Id: <5mh365$ui@sol.sun.csd.unb.ca>

Kyzer (junkmail@sysa.abdn.ac.uk) wrote:
: Paul Vermette [NiD/BiM], while smelling of fish, wrote:
: : I am not using the password anymore because I found out about the .rhosts
: : file.. which makes things somewhat more secure.. the big problem now is
: : still waiting to see when the forked process can start taking commands..

: Ahh... so what you want, in reality, is rsh (remote shell)

: #!/usr/local/bin/perl -w
: my @hosts=('dixie','vortex','murphy');

: foreach (@hosts) {
:   print "On $_\n", `/usr/bin/rsh $_ who`, "\n";
: }
: __END__

: or alternatively,
:   print `finger \@$_`, "\n";

The problem is, I need to issue commands, and leave the user at the user
prompt on the connect machine.. and I need to set up environment variables
(I have already looked at rsh - I thought it might have been my answer as
well unfortunanlty it is not.) I was going to use the .cshrc file, but
then need to pass parameters to the login..

Do you understand the problem better now ?




--
                   '''
                  (o o)
  .---------oOOO---(_)------------------.
  |       Paul Vermette [NiD/BiM]       |
  |             e5ir@unb.ca             |
  |    B O D i E S  i N  M o T i O N    |
  `----------------------oOOO-----------'
                 |__|__|
                  || ||
                 ooO Ooo



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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 531
*************************************

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