[13305] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 715 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 4 09:07:20 1999

Date: Sat, 4 Sep 1999 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 4 Sep 1999     Volume: 9 Number: 715

Today's topics:
    Re: "Odd number of elements in hash list" (error messag <bigsleep@dircon.co.uk>
    Re: "Use <module>" Decide at run-time? <joern@netcologne.de>
    Re: "Use <module>" Decide at run-time? (M.J.T. Guy)
    Re: "Use <module>" Decide at run-time? <rgoldber@eb.com>
        5004 install on linux <jcohen@together.net>
        _您好,这是E-Mail杂志《椰!(Cocopalm)》的确认信 (不用回 <Cocopalm@bigfoot.com>
        _您好,这是E-Mail杂志《椰!(Cocopalm)》的确认信 (不用回 <Cocopalm@bigfoot.com>
    Re: CGI in PERL (Larry Rosler)
    Re: CGI in PERL <kims@emmerce.com.au>
    Re: Creating runtime variables. <sasho@staff.mgu.bg>
    Re: Creating runtime variables. (Larry Rosler)
        Filter (Jimtaylor5)
    Re: Form2Mail without user interaction? (TomTech)
    Re: How to get Widows version? <llornkcor@earthlink.net>
    Re: How to make a split to a path filename??? <agray@infoscience.otago.ac.nz>
        HTML-to-Perl CGI converter <keithmur@mindspring.com>
    Re: Image Upload!Help!!!! (David Efflandt)
        LWP::UserAgent and inheriting methods - trying to under (Bill Moseley)
    Re: LWP::UserAgent and inheriting methods - trying to u <uri@sysarch.com>
    Re: Newbie Question... (Larry Rosler)
    Re: Padding a string with spaces? (David Efflandt)
    Re: Padding a string with spaces? <agray@infoscience.otago.ac.nz>
    Re: SEARCH and REPLACE <agray@infoscience.otago.ac.nz>
    Re: Send to ICQ with perl <streaking_pyro@my-deja.com>
    Re: Simulating Carriage Returns (Ilya Zakharevich)
    Re: tee cmd in PERL? <rgoldber@eb.com>
    Re: using the exec command. (Charles DeRykus)
        Windows NT Locked Log file (Manny)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sat, 4 Sep 1999 13:57:14 +0100
From: "Andrew Whitaker" <bigsleep@dircon.co.uk>
Subject: Re: "Odd number of elements in hash list" (error message)
Message-Id: <37d11755_1@newsread3.dircon.co.uk>

That one got me too, it comes from the behaviour of split allowing a
trailing delimiter
i.e. split( "=" ,"MyKey=" );
returns 1 value and if that value was in the middle of a list of 3 items
that gives
2 + 1 + 2 = 5 assigned to the hash. I've ditched split( /\n=/ ) in favour of
:-

while ( $Line = <CONFIG> ) {
    $Pos = index( $Line ,"=" );
    $Config{substr($Line,0,$Pos)} = substr($Line,$Pos+1) if $Pos > 0;
}

Andy Whitaker
Cimexmedia Ltd

Bill Williams wrote in message <37C1AF91.4996CDC6@cisco.com>...
>Other than turning off "-w", is there a way to resolve this error
>message?
>
>Is this informational or is it actually telling me something useful
>about my
>hash list? (There really aren't an odd number, btw; it's an even
>number).
>
>-b
>
>
>
>--
>Thanks,
>__________________________
>Bill Williams
>ERP Systems Administrator
>Cisco Systems - RTP-IS
>
>
>




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

Date: Sat, 04 Sep 1999 11:24:40 +0200
From: Joern Reder <joern@netcologne.de>
Subject: Re: "Use <module>" Decide at run-time?
Message-Id: <37D0E558.1B66657B@netcologne.de>

Robert F wrote:

> sub handleError() {
>     use $_[0];                          # <= I want to do this but can't
> because it's not known until run-time

Try this:

	require $_[0];
	$_[0]->import;

This is approximately what "use Module" does (the use statement is
implicitly put in a BEGIN{} block and calls the import method), but the
name of the module is resolved at runtime.

You'll not need the import method call if your module does not export
symbols to the callers namespace.

Joern 

-- 
Joern Reder -- joern@netcologne.de
supporting:   http://www.zyn.de/
unbelievable: http://www.netcologne.de/~nc-joernre/


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

Date: 4 Sep 1999 11:55:35 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "Use <module>" Decide at run-time?
Message-Id: <7qr1bn$keq$1@pegasus.csx.cam.ac.uk>

Joern Reder  <joern@netcologne.de> wrote:
>Robert F wrote:
>
>> sub handleError() {
>>     use $_[0];                          # <= I want to do this but can't
>> because it's not known until run-time
>
>Try this:
>
>	require $_[0];
>	$_[0]->import;
>
>This is approximately what "use Module" does (the use statement is
>implicitly put in a BEGIN{} block and calls the import method), but the
>name of the module is resolved at runtime.

Close, but not quite right.    "use Module" and "require Module" do some
extra things.   perlfaq8:"What's the difference between require and use?"
says:

    3)  require Module is like require "Module.pm", except the former:
        3.1: translates each "::" into your system's directory separator.
        3.2: primes the parser to disambiguate class Module as an indirect
             object.

The tacking on of '.pm' and translation of '::' are the important bits.
So in practice this is one of the few places where eval "" is appropriate:

      eval "use $_[0]";
      die $@ if $@;         # or other error recovery action


Mike Guy


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

Date: Sat, 4 Sep 1999 07:22:42 -0500
From: RayG <rgoldber@eb.com>
Subject: Re: "Use <module>" Decide at run-time?
Message-Id: <Pine.GSO.3.96.990904072047.17769A-100000@cliff.eb.com>

'require' is the function you want. 'use' is basically a call to require
wrapped in a BEGIN block.

On Fri, 3 Sep 1999, Robert F wrote:

> I am trying to create a general-purpose error-handling routine.  One
> feature would be that it would use caller-specific error information
> that is saved in a module.  However, the error handler won't know what
> module to use to access this information until run-time.  Is there a way
> to do this?  Here's the problem:
> 
> ##  Parameters.pm  ###
> 
> package Parameters;
> use Exporter();
> @ISA = qw( Exporter );
> @EXPORT = qw ( $errorMessage );
> $errorMessage = "some error message";
> 
> ##  Driver.pl  ###
> 
> use Parameters;                     # Parameters specific to this
> program
> use ErrorHandler;
> handleError( "Parameters" );   # Handle some error using this data from
> Parameters module
> 
> ## ErrorHandler.pm  ###
> 
> package ErrorHandler;
> use Exporter();
> @ISA = qw( Exporter );
> @EXPORT = qw ( handleError );
> 
> sub handleError() {
>     use $_[0];                          # <= I want to do this but can't
> because it's not known until run-time
>     print "errorMessage\n";      # Is there some other way to do this???
> 
> }
> 
> 
> Thank you.
> 
> 
> 
> 
> 
> 



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

Date: Fri, 03 Sep 1999 23:41:48 -0700
From: Jeff Cohen <jcohen@together.net>
Subject: 5004 install on linux
Message-Id: <37D0BF2C.A410ABCD@together.net>

I am receiving an error 2 cannot load interpreter segment error when
runing make on a linux 5.2 operating system?  How do i solve this?

make DEPEND, make minitest and all other make all perform the make
DEPEND and fail at the same part which is after the make DEPEND 251




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

Date: 4 Sep 1999 14:03:31 +0800
From: Cocopalm <Cocopalm@bigfoot.com>
To: comp.lang.perl.misc@list.bentium.net
Subject: _您好,这是E-Mail杂志《椰!(Cocopalm)》的确认信 (不用回复)
Message-Id: <199909040458.NAA10565@gznet.com>

Subject : _=C4=FA=BA=C3=A3=AC=D5=E2=CA=C7EMail=D4=D3=D6=BE=A1=B6=D2=AC=A3=A1=
(Cocopalm)=A1=B7=B5=C4=C8=B7=C8=CF=D0=C5 (=B2=BB=D3=C3=BB=D8=B8=B4)

Subject : _=C4=FA=BA=C3=A3=AC=D5=E2=CA=C7E-Mail=D4=D3=D6=BE=A1=B6=D2=AC=A3=
=A1(Cocopalm)=A1=B7=B5=C4=C8=B7=C8=CF=D0=C5 (=B2=BB=D3=C3=BB=D8=B8=B4)

=CF=C8=D0=BB=D0=BB=C4=FA=B6=A9=D4=C4=D5=E2=B7=DD=C3=E2=B7=D1=B5=C4E-Mail=D4=
=D3=D6=BE=A1=B6=D2=AC=A3=A1(Cocopalm)=A1=B7=A1=A3
=D4=D3=D6=BE=CE=AA=CA=AE=C8=D5=BF=AF=A3=AC=C3=BF=D4=C2=B7=EA10=A1=A220=A1=A2=
30=C8=D5=B3=F6=B0=E6=B2=A2=B7=A2=B3=F6=A3=AC=BE=B4=C7=EB=C1=F4=D2=E2=A1=A3

=C8=E7=B9=FB=C4=FA=B2=BB=CF=B2=BB=B6=D5=E2=B7=DD=D4=D3=D6=BE=BB=F2=D3=D0=C8=
=CB=C3=B0=C4=FA=B5=C4=C3=FB=B6=A9=D4=C4=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CF=B9=AB=BF=AA=B5=C4=A1=A3

=D4=D3=D6=BE=CD=F8=D6=B7=A3=BAhttp://www.nease.net/~cocopalm
          http://cocopalm.163.net
=D0=E9=C4=E2=CD=F8=D6=B7=A3=BAhttp://cocopalm.yeah.net
=F6=A6=C5=AE=C7=BD=D6=BD=A3=BA=D4=D3=D6=BE=D6=F7=B1=E0=B5=C4=B9=E3=B8=E6 ^=
_^
          http://ye1.163.net
          http://fly.to/ye1


                                                  Cocopalm



--
 **** Bentium Mailing List Server  --创建您自己的邮件列表 ****
              欲知详情,请见 http://www.bentium.net/ 


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

Date: 4 Sep 1999 14:03:36 +0800
From: Cocopalm <Cocopalm@bigfoot.com>
To: comp.lang.perl.misc@list.bentium.net
Subject: _您好,这是E-Mail杂志《椰!(Cocopalm)》的确认信 (不用回复)
Message-Id: <199909040458.NAA10574@gznet.com>

Subject : _=C4=FA=BA=C3=A3=AC=D5=E2=CA=C7EMail=D4=D3=D6=BE=A1=B6=D2=AC=A3=A1=
(Cocopalm)=A1=B7=B5=C4=C8=B7=C8=CF=D0=C5 (=B2=BB=D3=C3=BB=D8=B8=B4)

Subject : _=C4=FA=BA=C3=A3=AC=D5=E2=CA=C7E-Mail=D4=D3=D6=BE=A1=B6=D2=AC=A3=
=A1(Cocopalm)=A1=B7=B5=C4=C8=B7=C8=CF=D0=C5 (=B2=BB=D3=C3=BB=D8=B8=B4)

=CF=C8=D0=BB=D0=BB=C4=FA=B6=A9=D4=C4=D5=E2=B7=DD=C3=E2=B7=D1=B5=C4E-Mail=D4=
=D3=D6=BE=A1=B6=D2=AC=A3=A1(Cocopalm)=A1=B7=A1=A3
=D4=D3=D6=BE=CE=AA=CA=AE=C8=D5=BF=AF=A3=AC=C3=BF=D4=C2=B7=EA10=A1=A220=A1=A2=
30=C8=D5=B3=F6=B0=E6=B2=A2=B7=A2=B3=F6=A3=AC=BE=B4=C7=EB=C1=F4=D2=E2=A1=A3

=C8=E7=B9=FB=C4=FA=B2=BB=CF=B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=AC=C6=E4=CB=FB=D0=C5=BB=E1=
=B5=B1=B3=C9=C0=AC=BB=F8=D3=CA=BC=FE=D4=DA
=D4=D3=D6=BE=C9=CF=B9=AB=BF=AA=B5=C4=A1=A3

=D4=D3=D6=BE=CD=F8=D6=B7=A3=BAhttp://www.nease.net/~cocopalm
          http://cocopalm.163.net
=D0=E9=C4=E2=CD=F8=D6=B7=A3=BAhttp://cocopalm.yeah.net
=F6=A6=C5=AE=C7=BD=D6=BD=A3=BA=D4=D3=D6=BE=D6=F7=B1=E0=B5=C4=B9=E3=B8=E6 ^=
_^
          http://ye1.163.net
          http://fly.to/ye1


                                                  Cocopalm



--
 **** Bentium Mailing List Server  --创建您自己的邮件列表 ****
              欲知详情,请见 http://www.bentium.net/ 


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

Date: Fri, 3 Sep 1999 19:25:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: CGI in PERL
Message-Id: <MPG.123a22e48875496d989f18@nntp.hpl.hp.com>

In article <7qprpd$bli$1@nnrp1.deja.com> on Sat, 04 Sep 1999 01:14:28 
GMT, pjgratz@my-deja.com <pjgratz@my-deja.com> says...
> > And it's spelled Perl, not PERL.
> 
> 'Technically' Nate is correct PERL is an acronym
> for Practical Extraction and Reporting Language.

'Technically' not correct.

A name that starts out as a capitalized acronym often loses all but its 
initial capital (and sometimes even that, e.g. radar) if it is a 
pronounceable word.  This occurs when the name achieves a certain level 
of maturity, stability, and public acceptance.

Thus Algol, Basic, Cobol, Fortran, Lisp, ... -- and now Perl!

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


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

Date: Sat, 4 Sep 1999 22:18:33 +1000
From: "Kim Saunders" <kims@emmerce.com.au>
Subject: Re: CGI in PERL
Message-Id: <936447447.290851@draal.apex.net.au>

>Thus Algol, Basic, Cobol, Fortran, Lisp, ... -- and now Perl!


Dunno if I agree with some of those languages, esp BASIC... basic is often
spelt in caps. But the principal is right...

KimS



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

Date: Sat, 04 Sep 1999 10:20:31 +0300
From: Alexander Avtanski <sasho@staff.mgu.bg>
Subject: Re: Creating runtime variables.
Message-Id: <37D0C83F.BE5A4A2F@staff.mgu.bg>

Hi Baris,

Try this:

  ${"var$n"}=$n;

- Alex  

baris sertkaya wrote:
> 
> Hi folks..
> I am trying to create runtime variables like that:
> -----------------------------------
> for $n (0..2) {
>         $a="var$n";
>         $$a=$n;
>         print "\$$a:$$a\n";
> }
> -----------------------------------
> that works...
> My question is  : Is it possible to do the same operation without
> using that $a variable as a helper..
> I want to do this assignments(below) at one expression...
>         $a="var$n";
>         $$a=$n;
> 
>                                                 Kiss..


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

Date: Sat, 4 Sep 1999 01:23:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Creating runtime variables.
Message-Id: <MPG.123a76d49584197b989f1a@nntp.hpl.hp.com>

In article <37D0C83F.BE5A4A2F@staff.mgu.bg> on Sat, 04 Sep 1999 10:20:31 
+0300, Alexander Avtanski <sasho@staff.mgu.bg> says...

[in the wrong order, three days after the fact]

> Hi Baris,
> 
> Try this:
> 
>   ${"var$n"}=$n;

Just say no, Baris!  Others have told you why, several times. 

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


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

Date: 04 Sep 1999 12:57:53 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: Filter
Message-Id: <19990904085753.08064.00002376@ng-ce1.aol.com>

I am writing a childrens program and I need to filter out at least some
offensive words. Of course I know how to match with =~/***/ but the problem I
am having is this also filters out words like pass and assimilate. Is there a
way I can do this that it won't catch these words, and words like it for other
offensive words? Thanks!


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

Date: Sat, 04 Sep 1999 04:12:49 GMT
From: NoOne@Home.Here (TomTech)
Subject: Re: Form2Mail without user interaction?
Message-Id: <37d09b4f.451315@news.gte.net>

Sorry I'm in the wrong group....

Figured that if one is knowledgable about Perl, then they would first
have a very solid understanding of HTML and page design in general.

Guess I was wrong.

Later

Tom


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

Date: Fri, 03 Sep 1999 20:14:25 -0600
From: llornkcor <llornkcor@earthlink.net>
Subject: Re: How to get Widows version?
Message-Id: <37D08081.3F2EB665@earthlink.net>

You could find it in the registry...

--



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

Date: 04 Sep 1999 15:54:04 +1200
From: Andrew Gray <agray@infoscience.otago.ac.nz>
Subject: Re: How to make a split to a path filename???
Message-Id: <uso4ve3hf.fsf@infoscience.otago.ac.nz>

Abel =?iso-8859-1?Q?Almaz=E1n?= <abel.almazan@ogilvyinteractive.es> writes:
> I want to make a split to a path filename like that:
> $path =c:\dir1\dir2\filename.ext

First, strings must be quoted.  If you use single quotes then you can
use 'c:\'.  If you use double quotes then you must escape the
backslash, as in "c:\\".  Or use q() or qq() (see "perldoc perlop").
Use whichever you prefer.

> I tried with:
> @file2 = split (' \ ', $path);
> and:
> @file2 = split (/ \ /, $path);
> but it doesn't works, because of a syntax error.
>What can i do???

"perldoc -f split" seems like it might be a good place to start when
you have a syntax problem with split.

This short example might help.

#/usr/bin/perl -w
use strict;
my $path = 'c:\dir1\dir2\filename.ext';
my @file2 = split /\\/, $path;
foreach my $filenamebit (@file2) {
    print $filenamebit."\n";
}

Better though would be to define a variable that stores the
directory/folder/thingy separator.  This would help with porting the
script to other operating systems with different conventions.

> please answer me as quickly as possible

Sorry, the electrons were moving slowly today.

> PD: Answer to my email address please

No.

Cheers,
Andrew




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

Date: Fri, 03 Sep 1999 17:39:27 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: HTML-to-Perl CGI converter
Message-Id: <37D04E1F.8936463@mindspring.com>

I'm wanting to convert a complex HTML file with a form to Perl code
(using CGI.pm or similar) that generates the same page w/form.

I could swear I've heard of a module or script out there that
automatically does this, but damned if I can find it right now.  (Been
to CPAN, www.perl.com, all the usual suspects).

It would be convenient to me to write/maintain HTML files, but convert
them to Perl when needed.

Help, please!


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

Date: 4 Sep 1999 02:56:49 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Image Upload!Help!!!!
Message-Id: <slrn7t12rr.k0.efflandt@efflandt.xnet.com>

On Fri, 03 Sep 1999 23:37:16 GMT, lchhooong@my-deja.com
<lchhooong@my-deja.com> wrote:
>I am buliding my own homepage, and I want to have a photo upload
>function ! But I just want to upload or allow my friends to upload gif
>or jpg photo, I don't want them to take all the space in my disk, so, I
>just wondering do you know how to do it?

See the CGI module (in a shell type: perldoc CGI).  It makes file upload
easy and can tell you the Content-type so you can simply not save any
undesired files.  Questions about CGI should really be directed to the
comp.infosystems.www..authoring.cgi newsgroup.

-- 
David Efflandt   efflandt@xnet.com   http://www.xnet.com/~efflandt/
http://www.de-srv.com/   http://cgi-help.virtualave.net/


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

Date: Fri, 3 Sep 1999 21:20:23 -0700
From: moseley@best.com (Bill Moseley)
Subject: LWP::UserAgent and inheriting methods - trying to understand
Message-Id: <MPG.123a3ddec0a4c69b989701@nntp1.ba.best.com>

I have a slippery grasp on most of this stuff at best, so excuse my 
confusion with terminology:

    my $ua = new LWP::UserAgent;
    my $req = new HTTP::Request GET => $url;
    my $res = $ua->request($req);

Ok, clear enough. Let's say I want to look at the headers in the 
response object.  I see that HTTP::Headers offers a nice method called 
scan().

    $res->scan( sub { print shift,' -> ',shift,"\n" } );

This means that $res (which is a HTTP::Response object) has inherited 
methods from HTTP::Headers, correct?  It's a sub-class.

Here's where I'm confused:
    $res->as_string();	# prints the entire response

This is the HTTP::Response::as_string() method.

But in HTTP::Headers there's also a $h->as_string() method, so are there 
two as_string() methods -- one for printing the entire response 
(HTTP::Response::as_string), and another to print just the headers 
(HTTP::Headers::as_string).

How do access, via $res, the as_string method in HTTP::Headers?


Thanks,

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 04 Sep 1999 01:04:16 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: LWP::UserAgent and inheriting methods - trying to understand
Message-Id: <x7r9kfs1wv.fsf@home.sysarch.com>

>>>>> "BM" == Bill Moseley <moseley@best.com> writes:

  BM> I have a slippery grasp on most of this stuff at best, so excuse my 
  BM> confusion with terminology:

  BM>     my $ua = new LWP::UserAgent;
  BM>     my $req = new HTTP::Request GET => $url;
  BM>     my $res = $ua->request($req);

first off, use the direct object syntax. it remove a possible naming
ambiguity and looks much better

	my $ua = LWP::UserAgent->new() ;
	my $req = HTTP::Request->new( GET => $url ) ;


  BM> Here's where I'm confused:
  BM>     $res->as_string();	# prints the entire response

  BM> This is the HTTP::Response::as_string() method.

  BM> But in HTTP::Headers there's also a $h->as_string() method, so are there 
  BM> two as_string() methods -- one for printing the entire response 
  BM> (HTTP::Response::as_string), and another to print just the headers 
  BM> (HTTP::Headers::as_string).

  BM> How do access, via $res, the as_string method in HTTP::Headers?

i can see the confusion. the whole HTTP set of classes is very convoluted.

this is from the HTTP::Message documentation. HTTP::Response inherits
from there and not from HTTP::Headers. so this method should do what you
want.

	$mess->headers_as_string([$endl])
	    Call the HTTP::Headers->as_string() method for the
	    headers in the message.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Fri, 3 Sep 1999 21:19:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie Question...
Message-Id: <MPG.123a3dbd511b6aa989f19@nntp.hpl.hp.com>

In article <7qpm7m$7q0$1@nnrp1.deja.com> on Fri, 03 Sep 1999 23:39:36 
GMT, Dheera <dheera@usa.net> says...
> You want to actually include the contents into the perl script as if it
> were a piece of code? First, the file you include must be in the same
> directory as the perl script, and have an extension .pm (txt files not
> allowed)....
> 
> So if you've named it doc1.pm, just type
> use doc1;
> in your perl script...

Too restrictive.  You can keep the file anywhere and with any extension, 
and access it via its absolute or relative path.

perldoc -f do

perldoc -f require

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


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

Date: 4 Sep 1999 03:05:10 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Padding a string with spaces?
Message-Id: <slrn7t13bg.k0.efflandt@efflandt.xnet.com>

On Sat, 04 Sep 1999 01:25:54 GMT, Burt lewis <burt@ici.net> wrote:
>
>I have a text database that I need to make certain fields left justified
>so I'm assuming I need to pad them with spcaces.
>
>my database looks something like:
>
>apples:steak:12345   :juice:
>
>My goal is to get this to look like:
>apples:steak:   12345:juice:
>
>Appreciate any help with this.
>
>Burt Lewis

It really looks like you want right justified instead of left.  See
'perldoc printf' or sprintf.  One of those should do it for you.

-- 
David Efflandt   efflandt@xnet.com   http://www.xnet.com/~efflandt/
http://www.de-srv.com/   http://cgi-help.virtualave.net/


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

Date: 04 Sep 1999 23:24:53 +1200
From: Andrew Gray <agray@infoscience.otago.ac.nz>
Subject: Re: Padding a string with spaces?
Message-Id: <uwvu69awq.fsf@infoscience.otago.ac.nz>

burt@ici.net (Burt lewis) writes:
> I have a text database that I need to make certain fields left
> justified so I'm assuming I need to pad them with spcaces.

I believe that you mean right justified here, given your example
below.

> my database looks something like:
> apples:steak:12345   :juice:
> My goal is to get this to look like:
> apples:steak:   12345:juice:

From what I can see you want to be able to print numbers differently
to text strings, yes?  If so have a look at "perldoc -f sprintf".  If
you only want to print the values formatted in this way printf will do
the job in one step (guess how you can ask perldoc to tell you about
this function).

#!/usr/bin/perl -w
use strict;
my $num1 = 12345;
my $num2 = 123;
print "$num1\n$num2\n";
my $rightnum1 = sprintf "%10d",$num1;
my $rightnum2 = sprintf "%10d",$num2;
print "$rightnum1\n$rightnum2\n";

produces

12345
123
     12345
       123

which seems to me to be what you _may_ be looking for.  You will
probably will also need to use split to break up the fields.

Cheers,
Andrew


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

Date: 04 Sep 1999 14:53:54 +1200
From: Andrew Gray <agray@infoscience.otago.ac.nz>
Subject: Re: SEARCH and REPLACE
Message-Id: <uwvu7e69p.fsf@infoscience.otago.ac.nz>

tvn007@my-deja.com writes:
> I would like to change the following line from:
> sys    "a-b"  "c*a"  "(xyz+b)"
> test   "xyxx*2" "abc+2" "fcy*2"
> to
> $sys = '$a-$b'; '$c*$a'; '($xyz+$b)';
> $test = '$xyxx*2'; '$abc+2' ;'$fcy*2';

Have a look at "perldoc perlre".  If you can break down your
translation needs into simple steps you should be able to find a
working solution.  Based on your example (which I'm assuming spans two
lines of input), here's mine.

while (<DATA>) {
    tr/"/'/;                        # change quotes
    s/('[^']*')/$1;/g;              # add semi-colons 
    s/^([a-zA-Z]+)\s*/$1 = /;       # add equals sign for first 'variable'
    s/\b([a-zA-Z]+)\b/\$$1/g;       # put dollar sign before each 'variable'
    print;
}
__DATA__
sys    "a-b"  "c*a"  "(xyz+b)"
test   "xyxx*2" "abc+2" "fcy*2"

This produces

$sys = '$a-$b';  '$c*$a';  '($xyz+$b)';
$test = '$xyxx*2'; '$abc+2'; '$fcy*2';

which looks close enough to your example.  Note that I'm not assuming
that the variable names (?) can include underscores or numbers.  While
this works on your data there are no guarantees that it would also
work on other data if the assumptions I made are broken.

Cheers,
Andrew



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

Date: Sat, 04 Sep 1999 02:55:35 GMT
From: R.Joseph <streaking_pyro@my-deja.com>
Subject: Re: Send to ICQ with perl
Message-Id: <7qq1n4$fjc$1@nnrp1.deja.com>

Well, I see one possible way to do this (there may be many) but I
haven't tried this, so don't trust me :)

You could find a list of the protocalls ICQ uses (it uses UDP to talk
to the server and direct TCP to other people) and emulate that using
socket() and such...it would be tedious, but it would work.

As for the list, I know that they are out there because I have seen
them, but I am afraid I can't help you because I can't remeber, sorry!

I don't know how well this would work (it may be a stupid idea) but its
worth looking into.

P.S.  Martien Verbruggen: Yes, you we're rude.  Please try to help next
time instead of hurting.
--
R.Joseph


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 4 Sep 1999 02:32:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Simulating Carriage Returns
Message-Id: <7qq0cc$67e$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Alan Curry
<pacman@defiant.cqc.com>],
who wrote in article <DxYz3.840$r5.54918@typ11.nn.bcandid.com>:
> >> About time_t, the Standard says simply that it must be an arithmetic 
> >> type 'capable of representing times'.
> >
> >Thanks for confirming my opinion and refuting one of Alan Curry.
> 
> He didn't refute me, and I don't think he intended to. time_t does not have
> to be 32 bits. It just can't be a long long as you suggested because long
> long is not one of the "arithmetic types" defined by the standard.

This may be true.  However, the "defined by the standard" was not
literally present in what Larry posted (though this might be assumed).

Ilya


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

Date: Sat, 4 Sep 1999 07:55:46 -0500
From: RayG <rgoldber@eb.com>
Subject: Re: tee cmd in PERL?
Message-Id: <Pine.GSO.3.96.990904075503.17769B-100000@cliff.eb.com>

of all your responses you forgot IO::File::Multi

On Fri, 3 Sep 1999, Christoph Bauer wrote:

> akluyskens@my-deja.com wrote:
> > 
> > Hi,
> > 
> > I need the PERL equivalent of the unix "tee" command to redirect the
> > output of a function to <STDOUT> and a FILE(HANDLE). Can anyone help me
> > out of this problem.
> > 
> you might want to look at
> http://www.cpan.org/modules/by-module/IO/IO-Tee-0.63.readme
> 
> HTH
> Christoph
> 
> 



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

Date: Sat, 4 Sep 1999 03:13:09 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: using the exec command.
Message-Id: <FHIM9x.MGv@news.boeing.com>

In article <FHI25r.5tn@news.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <5wlz3.127$D16.7485@nsw.nnrp.telstra.net>,
>Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>>In article <FHEoIp.GM9@news.boeing.com>,
>>	ced@bcstec.ca.boeing.com (Charles DeRykus) writes:
>>
>>$user = '; rm -rf /;';
>>
>>> exec 'echo "unsubscribe nacs-announce" | /usr/lib/sendmail -f \
>>>   $user\@nacs.net majrdomo\@nacs.net';
>>> die "exec failed: $!";
>>
>
>Certainly a legitimate concern elsewhere but not here.  
>
>sendmail - not the shell - will be in control to confront  
>any wickedness: 
>
>sendmail -f ; rm -rf /;@nacs.net... 
>
>rm... User unknown
>-rf... User unknown

I hadn't noticed the backticks... they look exactly like single
quotes... indeed the backticks need to be laundered.

--
Charles DeRykus


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

Date: 4 Sep 1999 02:59:37 GMT
From: mpatel@news.fhlb.com (Manny)
Subject: Windows NT Locked Log file
Message-Id: <7qq1up$oun$1@tilde.csc.ti.com>

How do I rotate log file in Windows NT?  Condition:The log file is always locked.

Thanks!
Manny


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 715
*************************************


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