[7779] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1404 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 2 17:15:43 1997

Date: Tue, 2 Dec 97 14:00:22 -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           Tue, 2 Dec 1997     Volume: 8 Number: 1404

Today's topics:
     Re: each() does not work?! <mortensi@idt.ntnu.no>
     eval, catch/try, and parameters <minner@chirondiag.com>
     Re: Getting rid of non-Y2K Perl4 (was Re: Pattern match (John M. Klassa)
     getting username from htaccess (Dennis Mercer)
     Re: getting username from htaccess (brian d foy)
     Re: Killing system calls from within perl <jay@rgrs.com>
     looking for script like guestbook, boards , etc. <rudedog@pld.com>
     looking for script like guestbook, boards , etc. <rudedog@pld.com>
     Re: Need to know how to limit the file sizes in file up <zenin@best.com>
     Re: open and whitespace <nobroin@esoc.esa.de>
     Re: open and whitespace (Bart Lateur)
     Re: Perl - Date Compare (Lisa Radinski)
     Perl Contractors Wanted <peterm@martech.pageactive.com>
     Perl Overhead <henry@DotRose.com>
     Re: Perl Overhead (brian d foy)
     Re: perl-cgi frames <rcooke@tivoli.*com>
     Perl-search the web quickly with Search Spaniel (Search Spaniel)
     Perlshop shipping_type <walid@bignet.net>
     problem with odd number of elements in hash table <ceh@sunspot.sce.carleton.ca>
     Scheduling the execution of a script (Lisa Radinski)
     Re: Scheduling the execution of a script (brian d foy)
     Solution: 'Perl_dowarn' error? <mhazen@franklin.uga.edu>
     SybPerl <mark@har.mrc.ac.uk>
     Re: Trimming space <barnett@houston.Geco-Prakla.slb.com>
     Re: Two way Sockets using Perl 5 (Win32) <mcwatkins@sai2000.com>
     Re: Year 2000: -M -A -C operators (I R A Aggie)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Dec 1997 19:06:25 GMT
From: Morten Simonsen <mortensi@idt.ntnu.no>
Subject: Re: each() does not work?!
Message-Id: <661m7h$1o0$1@due.unit.no>

Morten Simonsen <mortensi@stud.ntnu.no> wrote:
: On Mon, 1 Dec 1997, Tom Phoenix wrote:

: > On 1 Dec 1997, Morten Simonsen wrote:
: > 
: > > I tried the same program on a UNIX-machine, running perl 5.003 with
: > > EMBED, and the error did NOT occur there. So i guess I must have found a
: > > bug in the database code?
: > 
: > Sounds likely. If the database code is using library routines on your
: > machine, you may have found a bug in those. In that case, you'd need to
: > get replacements for those library routines, of course. Good luck! 

: I got the latest distribution of Perl for Win95 (perl5.004_02), but that
: seemed to make things even worse.:-( I tried the same program again
: this morning on another UNIX-machine too, and it is absolutly clear that
: the each() works fine on perl5.003 with EMBED (under Solaris). Anyhow, I
: cannot think of anything I could have done to produce these errors, so
: I hope somebody will take affair and find that bug.

I have posted another mail too, under the subject "size of DB", where I complained
about the size of the SBM_File databases. Then it turns out that SDBM_File
is broken under win32 distribution for certain file systems. I didn't know
that this was a well known fact, but so it is. A little strange that the aswer
I was seeking came in another thread of mine:)

Morten Simonsen


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

Date: Tue, 02 Dec 1997 14:10:14 -0500
From: Aaron Minner <minner@chirondiag.com>
Subject: eval, catch/try, and parameters
Message-Id: <34845D16.363F@chirondiag.com>

Hi there...

I get the following output when I use paramters to a subroutine
in an eval statement:


#####################################################
$ t.pl
trying to connect... step 1
step 2
step 3
step 4
step 5
Argument "mercury" isn't numeric in entersub at
/usr/local/lib/perl5/sun4-solaris/5.00393/Socket.pm line 270.
step 6
step 7
connect() failed: Connection refused
Could not connect in 1 tries
#####################################################

I'm not sure why I get the "Argument" warning when I use
paramters, because it doesn't say anything when I don't use
parameters (which should be a give away, yeah yeah, but I
want to know -why- I get those warnings).

Any insights would be greatly appreciated.

Here's the entire program that I used:


#####################################################
#! /usr/local/bin/perl -w
use strict;
use Socket;
$| = 1;


my( $connected, $connTries );

for ( $connTries = 0; $connTries < &MAXCONNTRIES; $connTries++ ) {
  print "trying to connect... ";
  #$connected = eval 'connectToServiceByName( )';
  $connected = eval 'connectToServiceByName( &SERVICEHOST, &SERVICE)';
  if ( $@ ) {
    print "\n";
    die( "Connection Error - $@" );
  }

  last if ( $connected );

  unless ( $connTries >= &MAXCONNTRIES - 1 ) {
    print "sleeping...\n";
    sleep( 5 );
  }
}

if ( $connected ) {
  print "connected\n";
} else {
  die( "Could not connect in ", &MAXCONNTRIES, " tries\n" );
}

die( "end\n" );


##################################################
# connectToServiceByName - open socket connection to server
#
##################################################

sub connectToServiceByName
{
  my( $givenHost, $givenService ) = @_;
  #my( $givenHost, $givenService );
  #$givenHost = &SERVICEHOST;
  #$givenService = &SERVICE;
#print "host <$givenHost>, serv <$givenService>\n"; return 0;

  my( $proto, $port, $addr, $comPort );

print "step 1\n";
  $port = getservbyname( $givenService, "tcp" ) or
   die( "getservbyname() failed: $!\n" );

print "step 2\n";
  $addr = gethostbyname( $givenHost ) or
   die( "gethostbyname() failed: $!\n" );

print "step 3\n";
  $comPort = sockaddr_in( $port, $addr ) or
   die( "sockaddr_in() failed: $!\n" );

print "step 4\n";
  $proto = getprotobyname( "tcp" ) or
   die( "getprotobyname() failed: $!\n" );

print "step 5\n";
# THIS SEEMS TO BE THE AREA WHERE THE PROBLEM IS...
  socket( SOCK_IN, &PF_INET, &SOCK_STREAM, $proto ) or
   die( "socket() failed: $!\n" );

print "step 6\n";
  setsockopt( SOCK_IN, &SOL_SOCKET, &SO_REUSEADDR, 1 ) or
   die( "setsockopt() failed: $!\n" );

print "step 7\n";
  unless ( connect( SOCK_IN, $comPort ) ) {
    print "connect() failed: $!\n";
    shutdown( SOCK_IN, 2 );
    close( SOCK_IN );
    return 0;
  }
  return 1;
}


##################################################
# BEGIN - define constants, initialize variables, etc.
#
##################################################

BEGIN
{
  eval 'sub SERVICE      { "myService"; }';
  eval 'sub SERVICEHOST  { "somehost";    }';

  eval 'sub MAXCONNTRIES { 1;            }';
  #eval 'sub MAXCONNTRIES { 3;            }';
}


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

Date: 2 Dec 1997 19:20:38 GMT
From: klassa@aursgh.aur.alcatel.com (John M. Klassa)
Subject: Re: Getting rid of non-Y2K Perl4 (was Re: Pattern matching (or not....))
Message-Id: <661n26$5qh$1@aurwww.aur.alcatel.com>

Falcon@darkwave.org.uk writes:
-> With Perl4 (yes I know it's not 5, but what can you do when the
-> management won't upgrade?) [...]

I've seen lots of people cite this as a reason for not upgrading... From a
management perspective, what's the point of sticking with a piece of
software (that's obsolete) when something better is available (for free,
even).  Have companies got *so* *much* invested in outdated Perl scripts
(that may or may not run 100% correctly under newer version of Perl) that
switching is out of the question?  If not, what's the reason for sticking
with the old?

Do these same managers run several-year-old version of GCC, too?

Perplexed,
John

-- 
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><

	All those who believe in psychokinesis, raise my hand...


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

Date: 2 Dec 1997 19:47:56 GMT
From: dmercer@Glue.umd.edu (Dennis Mercer)
Subject: getting username from htaccess
Message-Id: <661olc$k9u$1@hecate.umd.edu>

Is there a way that you can use Perl to get the username from htaccess?
I'm running on a Solaris machine with Perl 5.004_03.  The web server is
Apache.  Thanks for your help.

Dennis


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

Date: Tue, 02 Dec 1997 15:18:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: getting username from htaccess
Message-Id: <comdog-ya02408000R0212971518290001@news.panix.com>

In article <661olc$k9u$1@hecate.umd.edu>, dmercer@Glue.umd.edu (Dennis Mercer) wrote:

>Is there a way that you can use Perl to get the username from htaccess?
>I'm running on a Solaris machine with Perl 5.004_03.  The web server is
>Apache.  Thanks for your help.

how do you want to get it?  can't you simply parse your htaccess file?
or did you mean something else?

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 02 Dec 1997 15:37:52 -0500
From: Jay Rogers <jay@rgrs.com>
To: Alex Schajer <alex@online.emap.com>
Subject: Re: Killing system calls from within perl
Message-Id: <82pvnf1nxb.fsf@shell2.shore.net>

Alex Schajer <alex@online.emap.com> writes:
> I thought about doing `TOP` after the load is over 10. However when
> I run TOP it goes on forever until I kill it from another window. Is
> there anyway of killing TOP from within perl?

Just use the appropriate top command line options so it will exit by
itself:

   @lines = `top -b -d1`;

>From the top man page:

     -b    Use "batch" mode.  In this mode, all  input  from  the
          terminal  is ignored.  Interrupt characters (such as ^C
          and ^\) still have an effect.  This is the default on a
          dumb terminal, or when the output is not a terminal.

     -dcount
          Show only count displays, then exit.  A display is con-
          sidered  to  be  one update of the screen.  This option
          allows the user to select the  number  of  displays  he
          wants  to  see  before  top  automatically  exits.  For
          intelligent terminals, no  upper  limit  is  set.   The
          default is 1 for dumb terminals.

--
Jay Rogers
jay@rgrs.com


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

Date: Tue, 2 Dec 1997 13:41:39 -0600
From: "Matthew Wagley" <rudedog@pld.com>
Subject: looking for script like guestbook, boards , etc.
Message-Id: <661kqo$pqd@news1.pld.com>

I am looking for scripts to allow people to use them on there web pages.
Remotely hosted cgi stuff.   So i can provide that service.
Anybody know where those kind of scripts are?
Thanks in advance.
Matthew Wagley
rudedog@pld.com




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

Date: Tue, 2 Dec 1997 13:42:49 -0600
From: "Matthew Wagley" <rudedog@pld.com>
Subject: looking for script like guestbook, boards , etc.
Message-Id: <661kto$pqe@news1.pld.com>

I am looking for scripts to allow people to use them on there web pages.
Remotely hosted cgi stuff.   So I can provide that service.
Anybody know where those kind of scripts are?
Thanks in advance.
Matthew Wagley
rudedog@pld.com






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

Date: 2 Dec 1997 18:56:25 GMT
From: Zenin <zenin@best.com>
Subject: Re: Need to know how to limit the file sizes in file uploads in Perl
Message-Id: <881089156.502468@thrush.omix.com>

Bryan Jones <jonesb@wam.umd.edu> wrote:
: I'm trying to put together a perl script which will allow me to upload
: files to a Msql database.  I need to know how I might be able to limit
: the size of the files which are being uploaded to the server.  I
: understand that it might probably take uploading it first then looking
: at the file size.  BUT HOW DO YOU DO THIS IN PERL?
: I'm using HTTP/CGI transfer protocol for the file uploads.

	Are you using the CGI module?  Either way it's basicly the
	same.  Just stop writing if you hit your "limit".

	Code modified from the CGI.pm docs:

	$filename = $query->param('uploaded_file');
	# Copy a binary file to somewhere safe
	open (OUTFILE,">>/usr/local/web/users/feedback");
	$totalbytes = 0;
	$maxbytes   = 10000;
	while ($bytesread=read($filename,$buffer,1024)) {
	    $totalbytes += $bytesread;
	    print OUTFILE $buffer;
	    if ($totalbytes > $maxbytes) {
		die "File to big";
	    }
	}

-- 
-Zenin
 zenin@best.com


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

Date: Tue, 02 Dec 1997 19:36:07 +0000
From: Niall O Broin <nobroin@esoc.esa.de>
Subject: Re: open and whitespace
Message-Id: <34846327.45EE@esoc.esa.de>

John Moreno wrote:
> 
> Tom Phoenix <rootbeer@teleport.com> wrote:

> It doesn't look to me like he was talking about files generated by or
> processed by MacPerl - although it could be of course, but note that he
> is posting using a unix version of Netscape and says he a UNIX Net/Adm
> in his sig.  It looks like the files are either being generated on a Mac
> and transferred over to a unix 

Got it in one - Mac users are accessing files on a Linux box using
netatalk.

> are including spaces in the name so that they sort first when viewed on
> their machines - if it's the latter then they need to be told to stop.

What kind of facism is this ?!  A space is a perfectly legitimate
character
in a MacOS filename (and in most modern OSes BTW) and the Mac user using
a
GUI exclusively has no problems with that. The CLI bound are of course
used
to using whitespace as a word separator. Unix shells can handle these
files
too, but you must quote the names.

> A better solution would be to have some way of telling open that that
> the file name isn't a expression and have it evaluated 'as is' (say if
> the file name was quoted using 's).

That would be my preference something like

require a_version_of_open_which_doesn't_strip_spaces;

or YASV (yet another special variable - $  would be ideal, that's "$ ",
not "$" :-;)
 
> But using a full pathname (as recommended in the faq) seems to work

Yes, prepending a ./ and appending a \0 works just fine. However, it
means
checking filenames all the time. 

My solution is going to be to hack my copy of Perl to remove the
whitespace
stripping code. 

-- 
Kindest regards,


Niall  O Broin		

UNIX Network Administrator 		 	nobroin@esoc.esa.de
Ground Systems Engineering Department		Ph./Fax  +49 6151 90 3619/2179
European Space Operations Centre, Darmstadt, Germany


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

Date: Tue, 02 Dec 1997 22:00:49 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: open and whitespace
Message-Id: <34868474.7947317@news.tornado.be>

Niall O Broin <nobroin@esoc.esa.de> wrote:

>I need to process files generated by Macintosh users who quite often use
>filenames with leading spaces (deliberately because space sorts to the
>top of a Finder file list) and trailing spaces (probably accidentally).

>Does anyone know why open strips leading and trailing whitespace ?

Command lines? The commands/filenames are usually separated by spaces

Anyway, the standard "solution" on the Mac to this problem is to use the
"Filehandle" module.

HTH,
Bart.


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

Date: 2 Dec 1997 18:58:48 GMT
From: lmrad@minutezt.com (Lisa Radinski)
Subject: Re: Perl - Date Compare
Message-Id: <661lp8$rcn$0@206.230.71.51>

I've create a script called jdate.pl that can be placed in a 'require'
command in your script. 

With the script, you can use the &jdate() function to compare dates.
For example:

if (jdate(date1) > jdate(date2))
{
	....
}

If you're interested, I'd be happy to post it for you.





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

Date: Tue, 02 Dec 1997 15:34:22 -0500
From: Peter Marshall <peterm@martech.pageactive.com>
Subject: Perl Contractors Wanted
Message-Id: <348470CE.13D5FA40@martech.pageactive.com>

We are looking for Perl Contractors.

WE ARE THE CUSTOMER WE ARE NOT AN AGENCY/HEADHUNTER
AGENCIES NEED NOT RESPOND

- demonstratable experience in Perl, modules DBI CGI 
Perl/TK etc. 
- we are Perl savy, you will not have to deal Perl wannabes
- we are very comfortable with remote relationships
- we offer upfront retainers, with pay on predetermined
progress 
- you are one two types (yes there are more types) 
   a) you like to have exact specs in your hands
   b) you like to be invovled from start contribute to the
creative solution
   
DONOT POST REPLY Email to peterm@pageactive.com or call the
number below.

   
-- 
Peter G. Marshall		   | Chief Technology Officer
peterm@martech.pageactive.com	   | PageActive, Inc.
http://www.martech.pageactive.com  | +1 416 483-1555
To get PGP Public Key: petermkey@martech.pageactive.com


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

Date: Tue, 02 Dec 1997 15:45:17 -0500
From: Henry Hartley <henry@DotRose.com>
Subject: Perl Overhead
Message-Id: <3484735C.9EADDDBB@DotRose.com>

Our company looks like they are moving towards using Cold Fusion for
Intranet database applications.  I've just spent a fair amount of time
learning Perl and expect (hope?) to be asked why we should not dump Perl
completely and use CF.  One of the arguments used to recomment CF is
that there is one CF process running on the server that handles all the
requests while Perl starts a new process for each script that runs.  (in
case it matters, we are running both on NT servers).

Questions:
1 - Is this true (the one process for each instance bit)?
2 - How much additional overhead does each of these processes use?
3 - How many concurrent processes would it take to make a significant
impact on a 200 MHz Pentium Pro w/ 128MB RAM?
4 - What can I do with Perl that they can't do with Cold Fusion?

So basically, what I want is a "Why would you want to use Perl?"  I've
got another server at home running Linux/Apache and I will continue to
use Perl there anyway so all is not lost.  CF looks like a nice product
and I already use Alaire's Homesite for just about all my editing.  I
just don't want to limit my experience to one proprietary package if I
can help it.

Henry Hartley




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

Date: Tue, 02 Dec 1997 16:34:34 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl Overhead
Message-Id: <comdog-ya02408000R0212971634340001@news.panix.com>

In article <3484735C.9EADDDBB@DotRose.com>, Henry Hartley <henry@DotRose.com> wrote:

[CF == Cold Fusion]

>One of the arguments used to recomment CF is
>that there is one CF process running on the server that handles all the
>requests while Perl starts a new process for each script that runs.

you could do that with Perl using mod_perl and the Apache-like servers
or FastCGI.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 02 Dec 1997 13:18:41 -0600
From: Robert Cooke <rcooke@tivoli.*com>
Subject: Re: perl-cgi frames
Message-Id: <661n03$44h$1@tivoli.tivoli.com>

Check the args for that button and display a new page. It's just like
jumping to
any other page.

Robert

Sameer Shroff wrote:

> I need help using frames in cgi-perl. I have created a page with two
> frames with a form on one side and information on the other. When the
> user clicks on a button I would like the user to go to a new page
> without any frames. This is where I need help, I do not know how to
> delete the frames and show the user a new page.
> If it is possible I would like a response in english.
>
> Thank you,
> Sameer Shroff
> ss492@columbia.edu

--
Robert Cooke   Tivoli Systems  rcooke@tivoli.*com
http://ourworld.compuserve.com/homepages/rwcooke

Note: Remove the * to reply




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

Date: Tue, 02 Dec 97 18:50:21 GMT
From: smith@umes07.avl.co.at (Search Spaniel)
Subject: Perl-search the web quickly with Search Spaniel
Message-Id: <250027119@searchspaniel.com>

To Perl-search the most search engines
in the shortest time, use the internet's newest
search engine - Search Spaniel at:
http://www.searchspaniel.com/


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

Date: Tue, 02 Dec 1997 14:08:23 -0500
From: Walid Ezzedine <walid@bignet.net>
Subject: Perlshop shipping_type
Message-Id: <34845CA6.5944761B@bignet.net>

I'm trying to install the perlshop for the first time.
Everything seems to be working except when I try
to set the shipping_type for price ($shipping_type =  'price'; ).

Each time I try to checkout, it says "Document contain no Data".
If I put the original file ($shipping_type =  'quantity';), it works.

This is how i fill up the shipping rate when I use $shipping_type =
'price'

@Shipping_Rates = (
[$catalog_country, 'UPS Ground', 0, 19.99, '+', 4.95],   ### Index must
start at 0 in case $shipping_type='weight'
[$catalog_country, 'UPS Ground', 20, 34.99, '+', 5.95],  ### Min. should
be .01 more that prev max. if based on price
[$catalog_country, 'UPS Ground', 35, 99999999,'+', 6.95],
 ...
);

Can someone help me ?

Thank you.

walid@bignet.net



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

Date: 02 Dec 1997 15:13:38 -0500
From: Curtis Hrischuk <ceh@sunspot.sce.carleton.ca>
Subject: problem with odd number of elements in hash table
Message-Id: <wkdra7v33m5.fsf@sunspot.sce.carleton.ca>

Hi.  I am having a terrible time trying to uncover why I have an odd
number of elements in a hash table.  The error message I get is shown
below:
	Odd number of elements in hash list at
	/home/ceh/ObjecTime/src/ObjectimeBridge.pm line 118 (#1)
    
    (S) You specified an odd number of elements to a hash list, which is odd,
    because hash lists come in key/value pairs.

The Code that does this is:
================================================================
	my %actor = ();
	my( $default_actor ) = ObjectimeTimer::actor_name(); # A string value
	my( $fn ) =  \&ResFnTimerActor; # Valid function
	$actor{ $default_actor } = $fn;  # Only entry made in hash

	print "DEFAULT ACTOR IS $default_actor with value ", 
	    $actor{ $default_actor }, "\n"; # <<<<< no error message

	sub activity_to_res_fn
	{
	  my $self = shift;
	  my($rsub, $ractivity) = @_;
	  my( $task_name ) = $$ractivity->task_name(); 
	  if ( exists( $actor{ $task_name } ) ) {   <<<<<<<<<< Error message is given here
	    . . . 
	  }
	  . . . 

================================================================

I have tried to find out what the additional element is to no avail.
How can I find out what elements are in the hash?  What is a good
strategy for debugging this?

Thanks

Curtis

-- 
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Curtis Hrischuk (PhD Cand)  "in reality that comes from above      _/
_/ ceh @ sce . carleton . ca    God is calling                        _/
_/ Carleton University          there's no bigger love                _/
_/ Ottawa, On., Canada, K1S-5B6 It's his reality that welcomes us back_/
_/ Ph  (613) 520-2600 x1762     Trust and obey                        _/
_/ FAX (613) 520-5727           there is no other way..." the newsboys_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


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

Date: 2 Dec 1997 19:37:48 GMT
From: lmrad@minutezt.com (Lisa Radinski)
Subject: Scheduling the execution of a script
Message-Id: <661o2c$1um$0@206.230.71.51>

I have a script that sends mail to a number of e-mail addresses.
Specifically, I have several students in a course I'm teaching and
want to send them automated letters throught the session at given
dates.

I don't want to have to remember to run the script that sends the
letters; therefore, I need to know if there's a way to schedule a job
that will run the script at a particular time of the month.

Is this possible?

Thanks.



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

Date: Tue, 02 Dec 1997 15:11:15 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Scheduling the execution of a script
Message-Id: <comdog-ya02408000R0212971511150001@news.panix.com>

In article <661o2c$1um$0@206.230.71.51>, lmrad@minutezt.com (Lisa Radinski) wrote:

>I don't want to have to remember to run the script that sends the
>letters; therefore, I need to know if there's a way to schedule a job
>that will run the script at a particular time of the month.

sorta depends which OS you intend to use.  how about the Unix cron
facility?  there are variants of it for alien platforms as well.

not really a perl topic though.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 02 Dec 1997 15:55:15 -0500
From: Mark Hazen <mhazen@franklin.uga.edu>
Subject: Solution: 'Perl_dowarn' error?
Message-Id: <348475B3.D0ED4DBA@franklin.uga.edu>

Mark Hazen wrote:

> Ever since updating my CPAN this weekend, i keep getting errors in about
> 70% of the things I try to do in Perl (CPAN, LWP, etc.) The message is:
>
>    Error: can't resolve symbol 'Perl_dowarn'

Found the problem during my recompile. I'd already removed everything Perl
from the box to a backup directory, but I needed the experioence recompiling

5.004 anyhow. :)

So, my problem was this: When asked if I wanted to pass any flags to the
compiler, stupid little me FORGOT that if I wanted to just ADD to the
options already given, I needed to INCLUDE the previously suggested flags.
Ergo, I was entering "-DDEBUGGING" instead of "$* -DDEBUGGING". Oops.

It's these little things in life I love the struggles with. :)

-mh.

----
   . _+m"m+_"+_   Mark Hazen    Network Administrator, Dean's Office
 d' Jp     qh qh             The Franklin College of Arts & Sciences
Jp  O       O  O             The University of Georgia (706)542-1546
Yb  Yb     dY dY
 O   "Y5m2Y"  "     even the mightiest wave starts out as a ripple.
  "Y_           why make waves when it's easier to nurture ripples?




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

Date: Tue, 02 Dec 1997 18:12:58 +0000
From: Mark Strivens <mark@har.mrc.ac.uk>
Subject: SybPerl
Message-Id: <34844FAA.E6B1A432@har.mrc.ac.uk>

I'm trying to compile SybPerl 2.08 on a Sun Solaris 2.5.1 machine
using gcc 2.7.2.3 and CTlib version 11.1.

After running 'perl Makefile.PL;make' I get many errors, in the first
compile step:

gcc -c -I/sybase/include -I/usr/local/include -I/opt/local/include -O
-DVERSION=\"2.07\"  -DXS_VERSION=\"2.07\"  -fpic -I/opt/local/lib/perl5
/sun4-solaris/5.00301/CORE -DCTLIBVS=100 -DSYBPLVER='"2.07"' -DDO_TIE 
CTlib.c

I get errors such as:

In file included from
/opt/local/lib/perl5/sun4-solaris/5.00301/CORE/perl.h:104,
                 from CTlib.c:26:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:71:
parse error before `fpos_t'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:71:
warning: data definition has no type or storage class
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:286:
parse error before `fpos_t'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:288:
parse error before `*'
In file included from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/param.h:37,
                 from
/opt/local/lib/perl5/sun4-solaris/5.00301/CORE/perl.h:132,
                 from CTlib.c:26:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:166:
parse error before `off_t'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:166:
warning: no semicolon at end of struct or union
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:166:
warning: no semicolon at end of struct or union
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:167:
warning: data definition has no type or storage class
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:168:
parse error before `}'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:168:
warning: data definition has no type or storage class


Does anybody have any idea why this might be? Any suggestions
gratefully received!!

Mark

--------------------------------------------------------------------
Mark Strivens              Telephone : 01235-824 536 (direct line)
Informatics Group,                     01235-834 393 (switchboard)
MRC,                       Fax       : 01235-824 540
Harwell,                   
Oxfordshire, OX11 0RD.     email     : mark@har.mrc.ac.uk
United Kingdom.            URL       : http://www.mgc.har.mrc.ac.uk/
====================================================================


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

Date: Tue, 02 Dec 1997 13:10:57 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Trimming space
Message-Id: <34845D40.153B20F5@houston.Geco-Prakla.slb.com>

Bart Lateur wrote:

> 97Eyin@uxmail.ust.hk (Ho Chiu Yin) wrote:
>
> >I want to ask how to trimming left and right space of a string.
> >For example : $str = "   this is a test.      " to "this is a test."
>
> Easy, but it's a two step process.
>
>         $str =~ s/^\s+//;       #trim leading blanks
>         $str =~s/\s+$//;        #trim trailing blanks
>
> Note that will not only remove dangling spaces, but also tabs and
> newlines.
>

It can be done in one line:$str=~ s/^\s+|\s+$//g;    #trim leading and
trailing space characters (spaces, tabs & newlines)

Dave

--
"Security through obscurity is no security at all."
                -comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------





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

Date: 2 Dec 1997 20:41:44 GMT
From: Mark Watkins <mcwatkins@sai2000.com>
Subject: Re: Two way Sockets using Perl 5 (Win32)
Message-Id: <661rq8$5ij$1@news2.digex.net>

In article 347d98ff.0@news.cranfield.ac.uk,
	"A Farrow" <a.n.farrow@cranfield.ac.uk> said:
>
>Hi,
>
>I've been using the win32 version of Perl5 for some time now and I
>am
>having some great success with socket programming. However, I
>fail to see how I can get two way commnication down one socket
>using Perl. I am sure it must be possible but I only seem to be
>able to send
>the one way.
>
>For example, if I have a server listening which basically displays
>inputs
>from connections thus  (code fragment, assume socket has already
>been set
>up):
>
>for ( ; $paddr = accept (CLIENT, SERVER); CLOSE (CLIENT))
>
>{
>while ($data = <SOCKET>)
>    {
>    print $data;
>    }
>
>}
>
>and a client thus :
>
>#use TCP
>$proto = getprotobyname("tcp");
>socket(SOCKET, $PF_INET, $SOCK_STREAM, $proto) || die "Can't create
>socket :
>$!";
>bind(SOCKET, $this_addr) || die "Can't bind: $!";
>connect(SOCKET, $serv_addr) || die "Can't connect : $!";
>print  SOCKET "Any Old Rubbish";
>close (SOCKET);
>
>
>So, how would I go about sending an acknowledgement back to the
>client so
>it knows it has received it okay, or long term some complex data
>from the
>server process?
>
>Thanks in advance,
>
>
>    Anthony Farrow
>
>
>a.n.farrow@cranfield.ac.uk
>Systems Programmer, Cranfield University
>
>
>
>

You have to make the server listen to the socket so that it knows
when the client connects.
Then you have to read from the socket.
Then you have to write back to the socket and read from the client.

Example: (This is for UNIX, but it is the same principal)

SERVER PART:
#!/usr/bin/perl -Tw
require 5.000;

use strict;
use Socket;
use FileHandle;

my($Buffer, $this_address, $now, $Buf, $pid);
my $port = 6001;
$SIG{HUP} = close(SOCKET);
$SIG{INT} = close(SOCKET);
$SIG{TERM} = close(SOCKET);
$SIG{CHLD} = 'IGNORE';

sub readcli {
  while(1) {
    read(COMM_SOCKET, $Buffer, 1);
    $Buf .= $Buffer;
    last if ($Buffer eq "\n");
  }
  chomp $Buf;
}
$this_address = pack('Sna4x8', AF_INET, $port, "\0\0\0\0");

print "Port = $port\n";
my $prototype = getprotobyname('tcp');
socket(SOCKET, PF_INET, SOCK_STREAM, $prototype) or die "socket:
$!\n";
print "socket ok\n";

bind(SOCKET, $this_address) or die "bind: $!\n";

listen(SOCKET, SOMAXCONN) or die "listen: $!\n"; #Enabled 5 requests.
print "listening\n";

COMM_SOCKET->autoflush;
SOCKET->autoflush;

while(1) {
  accept(COMM_SOCKET, SOCKET) or die "accept: $!\n";
  print "Accept O.K.\n";
  $pid=fork;
  if ($pid==0) {
      close(SOCKET);
      readcli();
      print "$Buf received from client\n";
      print COMM_SOCKET "I hear You CLIENT!\n";
      exit(0);
  }
  else {
    close(COMM_SOCKET);
  }
}

CLIENT PART:
#!/usr/bin/perl
require 5.003;
use Socket;
use FileHandle;
use strict;
my($Buf, $Buffer, $port, $LogName, $remote, $proto);
my($servertime, $packed_address, @now);

$port = 6001;
$LogName = getlogin;
$remote = "pw99db";
my @addr = gethostbyname($port, $remote);

sub readcli {
  while(1) {
    read(CLIENT, $Buffer, 1);
    $Buf .= $Buffer;
    last if ($Buffer eq "\n");
    chomp $Buf;
  }

}

print "@addr\n";
$packed_address = pack('Sna4x8', AF_INET, $port, $addr[4]);
$proto = getprotobyname('tcp');

if (socket(CLIENT, PF_INET, SOCK_STREAM, $proto)) {
  print "socket ok\n";
}
else { die $!;}

if (connect(CLIENT, $packed_address)) {
  print "connect ok\n";
}
else { die $!;}

CLIENT->autoflush;

print CLIENT "STUFF\n";
readcli();
print "Received from server: $Buf";
if ($Buf > 0 );
print CLIENT "MORE STUFF\n";
readcli();
print "Received from server: $Buf";
close(CLIENT);


You can get a good idea from these scripts.  They have been tested
and do work.

Good Luck,
Mark Watkins




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

Date: Tue, 02 Dec 1997 15:52:40 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Year 2000: -M -A -C operators
Message-Id: <-0212971552400001@aggie.coaps.fsu.edu>

In article <661h4g$3ji$2@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:

+ But in this case, you're just being paranoid: the number of seconds
+ in each day in not apt to change with the millenium.

I'm hoping for 12 hour days, myself. That way, I can't be called upon
to work 16 hour days...

James

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

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

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