[10769] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4370 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 7 06:08:38 1998

Date: Mon, 7 Dec 98 03: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, 7 Dec 1998     Volume: 8 Number: 4370

Today's topics:
    Re: ActivePerl perlscript and IIS <matt@teamamiga.org_NOSPAM>
        Can have a package name have a period "." in it ? <yusufg@huge.net>
    Re: Can have a package name have a period "." in it ? (Sam Holden)
    Re: converting times <rick.delaney@home.com>
    Re: converting times (Larry Rosler)
    Re: converting times <jhi@alpha.hut.fi>
    Re: crypt (Mark-Jason Dominus)
        Db_File.pm - Need compiled copy for NT <iandi@gate.net>
        DBM files between Win32 Perl and Unix Perl (Fu-Keung Lai)
    Re: Finite State Auto.. <hendrik.woerdehoff@sdm.de>
        foo bar <tbsmith@viper.net>
    Re: foo bar <Tony.Curtis+usenet@vcpc.univie.ac.at>
        FTP commands in a perl script ? <brandeda@se.bel.alcatel.be>
    Re: FTP commands in a perl script ? <erikd@zip.com.au>
    Re: MySQL or PostGresSQL or ??? (follow-up question) <psmith01@mindspring.com>
        MySQL or PostGresSQL or ??? (with Linux 5.2/Apache/Perl <psmith01@mindspring.com>
        Netscape ->MailServer perl (URGENTE) <lscom@tin.it>
        Newbie <dave@midsouth.net>
    Re: Newbie (Martien Verbruggen)
    Re: Newbie <rick.delaney@home.com>
    Re: Newbie <w_mitchell@technologist.com>
    Re: newbie; How do I... (Andre L.)
    Re: Pretty Printing Perl <rmlynch@best.com>
        Simple chomp question <preble@ipass.net>
    Re: Simple chomp question <ebohlman@netcom.com>
    Re: Simple dB search results .. help .. <ebohlman@netcom.com>
    Re: Simple Help Needed: How do you get rid of return ca <brandeda@se.bel.alcatel.be>
        Socket Error  -  HELP <mriley@one.net.au>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 07 Dec 1998 10:12:24 +0000
From: Matt Sergeant <matt@teamamiga.org_NOSPAM>
Subject: Re: ActivePerl perlscript and IIS
Message-Id: <366BAA08.F5BF687@teamamiga.org_NOSPAM>

brian.parks@stn.siemens.com wrote:
> 
> I just installed ActivePerl (build 507) and want to write some ASP pages using
> PerlScript rather than VBScript.
> ActivePerl installed OK, and I can run standard perl cgi scripts, but I'm
> having problems with the following perlscript (ASP):

[snip]

> My browser returns the following error message:
> ---------------------------------------------------------------------------
> $Response->writeblock(0); $Response->write("Hello World"); error '80004005'
> 
> Can't call method "writeblock" on an undefined value.

You have an installation problem. Try re-installing ActivePerl. If that
doesn't work, reinstall IIS.

-- 
<Matt email="matt@teamamiga.org" />

| Fastnet Software Ltd              |   Perl in Active Server Pages   |
| Perl Consultancy, Web Development |   Database Design   |    XML    |
| http://come.to/fastnet            |    Information Consolidation    |


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

Date: 07 Dec 1998 15:00:21 +0800
From: Yusuf Goolamabbas <yusufg@huge.net>
Subject: Can have a package name have a period "." in it ?
Message-Id: <m3ogpg77y2.fsf@yusufg.portal2.com>

Hi, I created a simple module and named it foobar.com. The file in
which it was defined was called foobar.com.pm

In another script, I tried to invoke it via
use foobar.com

I am unable to get this to compile (get syntax error and I can't find
documentation on what are legal values for package names. Is there any 
way to get packages names to have a period '.' in them ?

Am running on RH 5.2 with perl -v output as

This is perl, version 5.004_04 built for i386-linux

TIA, Yusuf
-- 
Yusuf Goolamabbas
yusufg@huge.net


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

Date: 7 Dec 1998 09:20:29 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Can have a package name have a period "." in it ?
Message-Id: <slrn76n7et.ibu.sholden@pgrad.cs.usyd.edu.au>

On 07 Dec 1998 15:00:21 +0800, Yusuf Goolamabbas <yusufg@huge.net> wrote:
>Hi, I created a simple module and named it foobar.com. The file in
>which it was defined was called foobar.com.pm
>
>In another script, I tried to invoke it via
>use foobar.com
>
>I am unable to get this to compile (get syntax error and I can't find
>documentation on what are legal values for package names. Is there any 
>way to get packages names to have a period '.' in them ?

I would suspect that ehy have to be valid variable names (forgetting
punctuation variable names for the moment). In other words starting with
alpha or underscore, followed by alphanumeric or underscore.

I'm probably wrong but someone will correct me I'm sure. Personally I'd
restrict myself anyway for the sanity of those left to maintain the code.

-- 
Sam

People get annoyed when you try to debug them.
	--Larry Wall


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

Date: Mon, 07 Dec 1998 05:10:31 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: converting times
Message-Id: <366B64EF.54E23C12@home.com>

Nicholas H. Clark wrote:
> 
> So how do you pattern match those times and replace them with a time 
> in secs only.
> can you do the calculation in the pattern match like (i know this is 
> wrong):
>       $blah =~ s/h:m:s:ms/h*360+m*60+s+ms/
> 
> or is it more complicated approach needed

No, you can do it something like that.  You have to use pattern matching
meta-characters and proper arithmetic, but it can be done.

    $time =~ s!(\d+):(\d+):(\d+):(\d+)!$1*3600+$2*60+$3+$4/1000!e;

The 'e' at the end forces evaluation of the replacement side.

perldoc perlre
perldoc perlop

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Sun, 6 Dec 1998 21:15:05 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: converting times
Message-Id: <MPG.10d504314df90ae989943@nntp.hpl.hp.com>

In article <74fjnq$aaa@gossamer.itmel.bhp.com.au> on Mon, 7 Dec 1998 
14:57:06 +1100, Nicholas H. Clark <clark.nicholas.n@bhp.com.au.nospam> 
says...
> I have these files that contain a time in the forms:
> h:m:s.ms
> m:s.ms
> 
> Excel cannot recognise or convert these times properly.
> 
> So how do you pattern match those times and replace them with a time in secs
> only.
> can you do the calculation in the pattern match like (i know this is wrong):
> 
>       $blah =~ s/h:m:s:ms/h*360+m*60+s+ms/
                        ^      ^            ^
                        .     3600          e

$blah =~ s<(?:(\d*):)?(\d+):(\d*(?:\.\d*)?)>
          <($1 || 0) * 3600 + $2 * 60 + ($3 || 0)>e;

This allows inputs like '0:' (minutes) at a minimum, but can be adjusted 
for various other aberrations.

You need to read a chapter on regexes in an introductory text such as 
'Learning Perl'.  Then two or three readings of `perldoc perlre` might 
help you to modify the regex above to meet your needs, and to sling new 
ones of your own. 

> remove .nospam from my email add if you wish to mail me.

Do it yourself.

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


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

Date: 07 Dec 1998 12:35:50 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: converting times
Message-Id: <oeezp905jeh.fsf@alpha.hut.fi>


"Nicholas H. Clark" <clark.nicholas.n@bhp.com.au.nospam> writes:

> can you do the calculation in the pattern match like (i know this is wrong):
> 
>       $blah =~ s/h:m:s:ms/h*360+m*60+s+ms/
> 

All you need to do is to study the standard documentation of the s-operator.

	$blah =~ s/(\d\d?):(\d\d):(\d\d(\.\d+)?)/$1*3600+$2*60+$3/e

If you want to do the m:s.ms in same swath

	$blah =~ s/((?:\d\d?):)?(\d\d):(\d\d(\.\d+)?)/(defined$1?$1:0)*3600+$2*60+$3/e

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 6 Dec 1998 23:42:58 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: crypt
Message-Id: <74fmci$nd7$1@monet.op.net>

In article <365BAF3C.23D409FE@viper.net>,
Todd Smith  <tbsmith@viper.net> wrote:
>yeah, i just wanted to know how Perl's crypt worked, but in Perl instead of C.

It's basically DES.  The input password is used as a key to encrypt
the string "\0\0\0\0\0\0\0\0", and the result is packed six bits per
character.  You can do a web search to find out the details of DES.


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

Date: Mon, 7 Dec 1998 00:36:44 -0500
From: "Ariel" <iandi@gate.net>
Subject: Db_File.pm - Need compiled copy for NT
Message-Id: <74fpit$ns8$1@news.gate.net>

I just changed internet webhosting provider from a unix system to a Windows
NT system.  All of my scripts had been working fine on the unix system, but
the Windows NT system is lacking Db_File.pm.  My webhosting provider does
not allow telnet access - therefore cannot get to the command line to
install/compile Db_File.pm.

Could someone please email me a compiled Db_File.pm for a NT system or
direct me where I could find one?

My email is    iandi@gate.net

Thanks,

Ariel




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

Date: Mon, 07 Dec 1998 09:36:53 GMT
From: tfklai@hkusua.hku.hk (Fu-Keung Lai)
Subject: DBM files between Win32 Perl and Unix Perl
Message-Id: <74g7ib$22e2@hkusud.hku.hk>


Hi,

Does anyone know if there is any difference in format between a DBM file 
created by Unix's Perl and a DBM file created by Win32's Perl?

I have created a DBM file in Unix. But I can't read its content in my Windows 
95.

Any idea?

Fu


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

Date: Mon, 07 Dec 1998 10:57:07 +0100
From: Hendrik Woerdehoff <hendrik.woerdehoff@sdm.de>
Subject: Re: Finite State Auto..
Message-Id: <366BA673.47A1@sdm.de>

Tad McClellan wrote:
> 
> Tech-No (zerocool@montana.campus.mci.net) wrote:
> : I was wondering if anyone had a Perl script that would test a string to
> : see if it was a FSA???  If so please email me the source.
> 
>    A _string_ can be a _machine_?
> 
>    Whatever are you speaking of?

Maybe his string is supposed to be the tape of a Turing machine and he
wants to check if the Turing machine is simulating a FSA :-)

Yours
  Hendrik


Pursuant to US Code, Title 47, Chapter 5, Subchapter II, Sec. 227,
any and all unsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500
US (per infraction).  E-mailing denotes acceptance of these terms.

--
Hendrik W"ordehoff         |s  |d &|m  |  software design & management
                           |   |   |   |  GmbH & Co. KG                :
woerdehoff@sdm.de          |   |   |   |  Thomas-Dehler-Str. 27      >B)
Tel/Fax (089) 63812-337/515               81737 M"unchen               :


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

Date: Mon, 07 Dec 1998 01:33:20 -0600
From: Todd Smith <tbsmith@viper.net>
Subject: foo bar
Message-Id: <366B84C0.D60919D0@viper.net>

where's this foo-bar stuff come from? I heard it in that "Search for
Private Ryan" movie. What's it mean?, and what's it got to do with Perl?

--
_______________
Todd Smith
Perl Programmer
ITC^Deltacom




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

Date: 07 Dec 1998 10:33:25 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: foo bar
Message-Id: <83lnkke1p6.fsf@vcpc.univie.ac.at>

Re: foo bar, Todd <tbsmith@viper.net> said:

Todd> where's this foo-bar stuff come from? I heard
Todd> it in that "Search for Private Ryan"
                 (Saving Private Ryan)
See e.g.

    http://www.comedia.com/hot/jargon_3.0/JARGON_F/FOOBAR.HTML

Todd> movie. What's it mean?, and what's it got to
Todd> do with Perl?

Nothing per se.

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: Mon, 07 Dec 1998 08:55:21 +0100
From: David Van den Brande <brandeda@se.bel.alcatel.be>
Subject: FTP commands in a perl script ?
Message-Id: <366B89E9.FE760DBB@se.bel.alcatel.be>

Hi,

I have to search a very huge directory tree (on another computer) for
approximately 100 documents and ftp them to my computer.
For that I would like to write a perl script but I have problems to use
the FTP commands in it.
I'm working on a sparc station under Solaris and tried the following:

#!/usr/local/bin/perl5.004 -w
use Shell qw(ftp open user get ls);
system("ftp");
# till here it works (I get the FTP> prompt)
# but I would like to use the normal ftp commands like open, user, get,
 ... as well
# So I tried the following:
system("open hidec");
# But it doesn't work (hidec is the name of the other computer)

When I do it manually in an xterminal it do works ...
Any suggestions?

Thanks in advance,
KR.,
David

--
          V              David Van den Brande, Trainee at
  -----------------      Alcatel Switching VE27
 |  A L C A T E L  |     Fr. Wellesplein 1 - 2018 Antwerp - Belgium
  -----------------      mailto:brandeda@se.bel.alcatel.be





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

Date: Mon, 07 Dec 1998 19:58:41 +1100
From: Erik de Castro Lopo <erikd@zip.com.au>
Subject: Re: FTP commands in a perl script ?
Message-Id: <366B98C1.493013A2@zip.com.au>

David Van den Brande wrote:
> 
> Hi,
> 
> I have to search a very huge directory tree (on another computer) for
> approximately 100 documents and ftp them to my computer.
> For that I would like to write a perl script but I have problems to use
> the FTP commands in it.
> I'm working on a sparc station under Solaris and tried the following:
> 
> #!/usr/local/bin/perl5.004 -w
> use Shell qw(ftp open user get ls);
> system("ftp");
> # till here it works (I get the FTP> prompt)

No, no,  no,  no,  no,  no, no ......

Type "man Net::FTP" and you'll find the following:

use Net::FTP;

my $ftp = Net::FTP->new("some.host.name");
$ftp->login("anonymous","me@here.there");
$ftp->cwd("/pub");
$ftp->get("that.file");
$ftp->quit;

Erik
-- 
+-------------------------------------------------+
     Erik de Castro Lopo     erikd@zip.com.au
+-------------------------------------------------+
Windows 2000 : The Tyranosaurus Rex of the software
world. Large, ferocious and soon to be extinct.


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

Date: Mon, 07 Dec 1998 02:55:51 -0500
From: Peter Smith <psmith01@mindspring.com>
Subject: Re: MySQL or PostGresSQL or ??? (follow-up question)
Message-Id: <366B8A07.26901E47@mindspring.com>

Peter Smith wrote:
> 
> I'm about to write a web-to-database ecommerce application.  I plan on
> using Apache web server with Perl to access the database.  Which
> database is better, MySQL or PostGresSQL??  Are there others I missed??
> The cheaper the database, the better!
> 

Also, should I use the RPM-based MySQL since I'm running RedHat, or
should I just grab the latest binary??

-- 
--Peter--
psmith01@mindspring.com


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

Date: Mon, 07 Dec 1998 02:49:58 -0500
From: Peter Smith <psmith01@mindspring.com>
Subject: MySQL or PostGresSQL or ??? (with Linux 5.2/Apache/Perl/DBI)
Message-Id: <366B88A6.D1319ADC@mindspring.com>

I'm about to write a web-to-database ecommerce application.  I plan on
using Apache web server with Perl to access the database.  Which
database is better, MySQL or PostGresSQL??  Are there others I missed??
The cheaper the database, the better!

Thanks.

-- 
--Peter--
psmith01@mindspring.com


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

Date: Mon, 7 Dec 1998 08:40:13 +0100
From: "Lorenzo Cataldi" <lscom@tin.it>
Subject: Netscape ->MailServer perl (URGENTE)
Message-Id: <74g0j7$i8d$10@nslave1.tin.it>

Qualcuno mi sa dire, avendo io creato un piccolo mail server in perl in
attesa su la porta numero X (non necesariamente la 110), come possa
configurare Netscape per effetuare il login ed la ricerca di nuovi messaggi
su questo programma istallato sul suo stesso computer?
    Purtroppo io non ho mai usato Netscape, ed inutilmante ho cercato tra le
voci del barra degli strumenti (help incluso). Nulla indica come settare
questo browser, spero qualcuno sappia colmare questa mia ignoranza.
    Anticipatamente ringrazio

    Lorenzo
    E-Mail: itacom@technologist.com





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

Date: Sun, 06 Dec 1998 23:11:21 -0600
From: Dave or Sherry Searcy <dave@midsouth.net>
Subject: Newbie
Message-Id: <366B6378.1AE69461@midsouth.net>

This is a multi-part message in MIME format.
--------------940BD0F1EC66A3F5444D8697
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

OK

I know how to upload and CHMOD a Perl script to make it executeable.
Question: How do I make a link to the script in HTML?

Thanx
Dave

--------------940BD0F1EC66A3F5444D8697
Content-Type: text/x-vcard; charset=us-ascii;
 name="dave.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Dave or Sherry Searcy
Content-Disposition: attachment;
 filename="dave.vcf"

begin:vcard 
n:Searcy;Dave or Sherry
x-mozilla-html:TRUE
adr:;;;;;;
version:2.1
email;internet:dave@midsouth.net
x-mozilla-cpt:;-1
fn:Dave Searcy
end:vcard

--------------940BD0F1EC66A3F5444D8697--



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

Date: Mon, 07 Dec 1998 05:14:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Newbie
Message-Id: <2vJa2.99$g04.50@nsw.nnrp.telstra.net>

Please read the following information on how to choose a good subject
line: http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

In article <366B6378.1AE69461@midsouth.net>,
	Dave or Sherry Searcy <dave@midsouth.net> writes:
> This is a multi-part message in MIME format.

Please don't do this. Usenet is a plain text medium. Netscape's vcards
don't mean anything here but  unnecessary noise and bandwidth
pollution.

> I know how to upload and CHMOD a Perl script to make it executeable.
> Question: How do I make a link to the script in HTML?

This has nothing at all to do with perl. Please ask this sort of
questions in an appropriate group, somewhere in
comp.infosystems.www.*.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In the fight between you and the world,
Commercial Dynamics Pty. Ltd.       | back the world - Franz Kafka
NSW, Australia                      | 


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

Date: Mon, 07 Dec 1998 05:21:37 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Newbie
Message-Id: <366B6797.346D8125@home.com>

[posted & mailed]

Dave or Sherry Searcy wrote:
> 
> OK
> 
> I know how to upload and CHMOD a Perl script to make it executeable.
> Question: How do I make a link to the script in HTML?
> 

Same way you would make a link to any html page.  

    <a href="your/perl/script"></a>

or something like that.  This is not a Perl question, btw.

> --------------940BD0F1EC66A3F5444D8697
> Content-Type: text/x-vcard; charset=us-ascii;
>  name="dave.vcf"
> Content-Transfer-Encoding: 7bit
> Content-Description: Card for Dave or Sherry Searcy
> Content-Disposition: attachment;
>  filename="dave.vcf"
> 

Please don't post attachments (vcards) to usenet.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Sun, 06 Dec 1998 22:19:31 -0700
From: Will Mitchell <w_mitchell@technologist.com>
Subject: Re: Newbie
Message-Id: <366B6562.A9370689@technologist.com>

How do you make a link to anything in HTML?

(This should be in a CGI newsgroup)

Dave or Sherry Searcy wrote:

> OK
>
> I know how to upload and CHMOD a Perl script to make it executeable.
> Question: How do I make a link to the script in HTML?
>
> Thanx
> Dave
>



--
+----------------------------------------------+
| Will Mitchell                                |
| w_mitchell@technologist.com                  |
| ICQ: 11950267                                |
| Webmaster of WMIC Internet Consulting        |
+----------------------------------------------+




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

Date: Sun, 06 Dec 1998 21:41:43 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: newbie; How do I...
Message-Id: <alecler-0612982141430001@dialup-575.hip.cam.org>

In article <74edqn$im9$1@whisper.globalserve.net>, "new guy"
<shagi@globalserve.net> wrote:

> How do I make a cgi-bin Dir..?
> I understand that (so far) I make it by
> typing "mkdir cgi-bin" right?
> 
> while in my www Dir..  BUT what's my www Dir..?
> Where do I "make" the cgi-dir?

Have you tried looking in your ISP's website for this kind of info?

And is this really a Perl question? ;)

Andre


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

Date: Sun, 06 Dec 1998 21:43:29 -0800
From: Robert Lynch <rmlynch@best.com>
Subject: Re: Pretty Printing Perl
Message-Id: <366B6B01.1ABFB56F@best.com>

rdosser@my-dejanews.com wrote:
> 
> I'd like to pretty print my perl code from Red Hat Linux. I remember using
> vgrind years ago, but can only find it for Debian. I've got Tom C's
> vgrindefs.perl, but without vgrind itself it's kind of worthless.
> 
> Anybody have any thoughts?
> 
> Thanks,
> Ralph Dosser
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

A simple Altavista search turned up a lotta hits; the "vgrind" at:

http://www.linuxnow.com/docs/SYSPRINT.html

works fine on my RH 5.0 system.

Bob L.
-- 
Robert Lynch-Berkeley CA USA-rmlynch@best.com
http://www.best.com/~rmlynch/


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

Date: Mon, 7 Dec 1998 02:56:09 -0500
From: "E. Preble" <preble@ipass.net>
Subject: Simple chomp question
Message-Id: <pSLa2.909$kx1.1174@news.ipass.net>

I have a text file that get's read into an array:

This is the text file:
12345
67890
13579

This needs to be sent in an email, and also dumped to a backup
file.
When sending in the email, it prints out as shown above
(correctly).
When dumped to the backup file, it looks like this:
12345
_68790
_13579

Where "_" is a space, not the underscore character. How do I get
rid of this leading space on the all the lines past the first?

Chomp does this:
Email comes out ok as:
12345
67890
13579
Backup still not ok as:
12345 67890 13579

I don't want the program to insert that darn space in the backup
file!

When dumping to the email, I load the array into a string, then
print it:
$string = "@array";
print MAIL "$string";  # this is OK

When dumping to the file I do the same thing
$string = "@array";
print BAK "$array";  #this is NOT OK

Any ideas?

E. Preble





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

Date: Mon, 7 Dec 1998 08:16:26 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Simple chomp question
Message-Id: <ebohlmanF3L5nE.10H@netcom.com>

E. Preble <preble@ipass.net> wrote:
: When dumped to the backup file, it looks like this:
: 12345
: _68790
: _13579

: Where "_" is a space, not the underscore character. How do I get
: rid of this leading space on the all the lines past the first?

[snip]

: When dumping to the email, I load the array into a string, then
: print it:
: $string = "@array";

You need to take a look at the perldata (man page | HTML page | POD) to 
see what happens when you interpolate an array variable into a string.  
It *will* give you those extra spaces unless you take special steps to 
prevent it.

: print MAIL "$string";  # this is OK

Your mail processor is probably doing some reformatting that strips off 
leading spaces.

: When dumping to the file I do the same thing
: $string = "@array";
: print BAK "$array";  #this is NOT OK

But your filesystem certainly isn't doing any reformatting.


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

Date: Mon, 7 Dec 1998 07:40:50 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Simple dB search results .. help ..
Message-Id: <ebohlmanF3L402.MEJ@netcom.com>

Darren <darrensweeney@eswap.co.uk> wrote:
: I am trying to conduct a simple search on a MySQL dB from a form, and then
: print the results.

: The code I am using is as follows but does not work .... help ...

:   my $dbh;
:   $search = $form{'SEARCH'};
:   $dbh = DBI->connect("DBI:mysql:$dbname", $dbuser, $dbpasswd) or die print
: "Content-type: text/html\n\n Error Mysql $!\n";

1) Where did $dbname, $dbuser and $dbpasswd come from?

2) die() takes a literal string as its argument, not a function like 
print.  It also outputs to STDERR rather than STDOUT, so the error 
message won't get sent to the user.  The CGI.pm module has some routines 
for handling cases like this; that's a good reason to use it if you're 
not already doing so.

:   $searchit = "select * from test WHERE(name LIKE\"$search\")ORDER BY
: name;";
:   @searchres = $dbh->do($searchit);

The documentation for DBI specifically says that the "do" method is not 
appropriate for SELECT statements.  It does *not* return a list of rows!  
You'd do well to read (and perhaps re-read) the documentation for DBI.  
Your solution will almost certainly involve a combination of the 
"prepare," "execute," and "fetchrow" methods, but don't take my word for it.

:   foreach $searchres ( @searchres ) {
:    print "Table: $searchres\n";
:   }


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

Date: Mon, 07 Dec 1998 09:18:05 +0100
From: David Van den Brande <brandeda@se.bel.alcatel.be>
Subject: Re: Simple Help Needed: How do you get rid of return carriges?
Message-Id: <366B8F3D.EC320DEF@se.bel.alcatel.be>

The chop Library Function may perhaps help you:

This function assumes that a line of text is stored in the variable passed to
it; chop's job is to delete the character at the right end of the line of text.
Consider this example:

$line = "This is my line";
chop ($line);

After chop is called, the value of $line becomes "This is my lin"
The statement  $originaldist = <STDIN>; assigns a line of input from the
standard input file to the variable $originaldist.
When you type 10 and press Enter, the line of input assigned to $originaldist
consists of three characters: the 1, the 0, and a newline character.
When chop is called, the newline character is removed, and $originaldist now
contains the value 10, which can be used in arithmetic operations.

So Call allways chop after reading a number from the standard input file.
$originaldist = <STDIN>;
chop ($originaldist);

KR,
David

Ala Qumsieh wrote:

> [posted and mailed]
>
> hcatre@aw.sgi.com (hector catre) writes:
>
> >
> > Hey everyone,
> >         I'm trying to get rid of return carriages in the value of a defined
> > string. ....<CUT>...
>
>

--
          V              David Van den Brande, Trainee at
  -----------------      Alcatel Switching VE27
 |  A L C A T E L  |     Fr. Wellesplein 1 - 2018 Antwerp - Belgium
  -----------------      mailto:brandeda@se.bel.alcatel.be





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

Date: Mon, 07 Dec 1998 19:17:05 +1000
From: Michael Riley <mriley@one.net.au>
Subject: Socket Error  -  HELP
Message-Id: <366B9D11.900CB0F1@one.net.au>

HELP!!!!

We are using a perl script to communicate between machines.  One system
takes in data from an IVR system where the user presses a telephone key
pad and the data is forwarded to my system for processing.  The system
seemed to be working fine until we moved over to a SUN platform and
increased traffic to about 10 - 200 byte messages per second.  The
script is pretty simple.  We check the port to see if it's valid and
then we accept and send data down the pipe.  Any help would be
appreciated.

THE SOCKET ERROR:
===================
Use of uninitialized value at
/usr/local/lib/perl5/sun4-solaris/5.00404/Socket.pm line 249, <GEN6161>
chunk 1.
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16
at /usr/local/lib/perl5/sun4-solaris/5.00404/Socket.pm line 249,
<GEN6161> chunk 1.

THE PERL SCRIPT
================
use IO::Socket;
use IO::Select;

$host = shift || die "No host specified";
$port = shift || die "No port specified";

$mainsock = new IO::Socket::INET (LocalHost => $host,
      LocalPort => $port,
      Listen => 5,
      Proto => 'tcp',
      Reuse => 1,
     );
die "Could not create listener socket because: $!" unless ($mainsock);

#STDERR->autoflush(1);
STDOUT->autoflush(1);

$readset = new IO::Select;
$writeset = new IO::Select;

$readset->add(*STDIN,$mainsock);
$writeset->add(*STDOUT,$mainsock);

while (1) {
  ($readme) = IO::Select->select($readset, undef, undef, 9999);

  foreach $sock (@$readme) {
    if ($sock eq $mainsock) {
      $newsock = $sock->accept();
      $newsock->autoflush(1);
      print STDERR "New Socket: $newsock\n";
      print STDERR "Host: ", $newsock->peerhost(), "\n";
      print STDERR "Opened socket: ", $newsock->peerport(), " at ",
scalar localtime, "\n";
      $readset->add($newsock);
      $peers{$newsock->peerport()} = $newsock;
    } elsif ($sock eq *STDIN) {
      $line = <$sock>;
      $text = $line;
      $text =~ s/\n/\\n/;
      $text =~ s/\r/\\r/;
     #print STDERR "STDIN <$text> received at ", scalar localtime, "\n";

      $cmd = $line;
      chomp $cmd;

      if ($cmd eq "" || $cmd eq "<>") { next; }

     #print STDERR "Command <$cmd>\n";

      if ($cmd eq "list") {
        @keylist = keys (%peers);
        print $#keylist+1, "\n";
        foreach $key (@keylist) {
          print "$key\n";
        }
      } elsif ($cmd eq "count") {
        @keylist = keys (%peers);
        print $#keylist+1, "\n";
      } elsif ($cmd eq "readall") {
        @keylist = keys (%indata);
        print $#keylist+1, "\n";
        foreach $key (@keylist) {
          print "$key\n$indata{$key}";
          delete $indata{$key};
        }
      } elsif ($cmd eq "send") {
        $peernum = <STDIN>;
        $peersnd = <STDIN>;
        chomp $peernum;
        $pport = $peers{$peernum};
        if ($pport) {
          print STDERR "Sending to port $peernum...";
          print $pport $peersnd;
          print STDERR " done\n";
        } else {
          print STDERR "Can't send to port $peernum\n";
        }
      } else {
        print STDERR "ERROR: Unrecognised command\n";
      }
    } else {
      $line = <$sock>;
      if ($line) {
        $text = $line;
        $text =~ s/\n/\\n/;
        $text =~ s/\r/\\r/;
        print STDERR "Socket ", $sock->peerport(), ": <$text> received
at ", scalar localtime, "\n";
        $indata{$sock->peerport()} = $line;
      } else {
        $readset->remove($sock);
        delete $peers{$sock->peerport()};
        print STDERR "Closed socket ", $sock->peerport(), " at ", scalar
localtime, "\n";
        close($sock);
      }
    }
  }
}



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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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