[14049] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1459 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 22 14:05:38 1999

Date: Mon, 22 Nov 1999 11:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943297511-v9-i1459@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 22 Nov 1999     Volume: 9 Number: 1459

Today's topics:
    Re: Binary scanning. (Abigail)
    Re: FTP in PERL, cmd line args etc. <Wm.Blasius@ks.sel.alcatel.de>
    Re: FTP in PERL, cmd line args etc. <rhomberg@ife.ee.ethz.ch>
    Re: FTP in PERL, cmd line args etc. (Tad McClellan)
    Re: Generating pi (Csaba Raduly)
    Re: Help w/ DBI <jeff@vpservices.com>
    Re: Help With CyberCash.... (Effie Rover)
    Re: How to Capitalize the first letter of a word an or  <nandu@cimedia.com>
        HTTP::Request and LWP::UserAgent <brucep@msn.com>
    Re: Macintosh specifc perl syntax? (Rich Morin)
    Re: mailto:Idon'tThinkSo <tony_curtis32@yahoo.com>
    Re: mailto:Idon'tThinkSo <mrmustard45@hotmail.com>
    Re: mailto:Idon'tThinkSo <mrmustard45@hotmail.com>
    Re: New dialect of perl: xperl (or reinventing perl, or excalibor@my-deja.com
    Re: Passing a parameter does not work when it came from <dont.email@post.responses>
        passing arrays by reference <caitchison@hotmail.com>
    Re: passing arrays by reference (Mark-Jason Dominus)
    Re: passing arrays by reference (Andrew Johnson)
        perl-mode xemacs vs emacs <ghersh@bbn.com>
    Re: Recursion Problem using my() <jegglest@my-deja.com>
    Re: removing eol characters <rhomberg@ife.ee.ethz.ch>
    Re: removing eol characters <lr@hpl.hp.com>
        Shareable.pm: "make test" fails kov@mit.edu
    Re: Simple s#this string#that string# doesn't work? <rhomberg@ife.ee.ethz.ch>
    Re: timelocal - strange result (Sergei Gnezdov)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 22 Nov 1999 11:46:57 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Binary scanning.
Message-Id: <slrn83j0io.m2v.abigail@alexandra.delanet.com>

X (epovazan@bc.sympatico.ca) wrote on MMCCLXXIV September MCMXCIII in
<URL:news:avb_3.5$jf7.82333@news.bctel.net>:
%% Hello All,
%% 
%% I am very new to Perl, and finally have a handle on regex stuff. What
%% pleasure.
%% I need to import a lot of binary data (specifically parse 3d file formats to
%% my own format) and I was wondering if Perl can apply regex to binary data? I

Perl doesn't divide the world in "binary data" and "non-binary data".
You apply a regex on a string - which is nothing more than a sequence
characters. (And unless you use UTF8, those characters are just bytes).

%% don't see why it shouldn't since many of the formats have "magic numbers"
%% associated with chunks of coordinates etc.

You could of course have tried it out....

%% So I would need to make Perl ignore whitespace and newlines, and then scan
%% as normal ??

You would preprocess your data with a substitution that replaces newlines
and whitespace (a newline is whitespace) with nothing.

    s/\s+//g;

Or a tr/// expression, if you can remember what's included in \s.
(Does anyone know whether the definition of \s changes when using UTF8?)

%%              Does perl do any magic internally that would give me surprises,
%% e.g. PCs newline is different to unix (13 10 as opposed to 10 I think ...
%% can't remember but newline and linefeed).

PC newlines are only different when files aren't opened in binmode. With
"binary" data, the concept of a newline shouldn't be used. After all,
having lines is what makes the difference between "binary" and "non-binary"
data.


Abigail
-- 
$" = "/"; split $, => eval join "+" => 1 .. 7;
*{"@_"} = sub  {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 22 Nov 1999 18:06:44 +0100
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
To: Linda Minnich <lin.minnich@usa.net>
Subject: Re: FTP in PERL, cmd line args etc.
Message-Id: <38397824.51D4@ks.sel.alcatel.de>

Linda Minnich wrote:
> 
> Before implementing any code, I want to visualize how I am going to do
> this:
> 
> the problem:  Called from another piece of code - written in a
> different language - this perl script should ftp a file to a server.
> 
> the solution:  I plan on having the Perl code accept a list of
> arguments.. that being the servername to FTP to, a login name, passwd,
> and the filename to be uploaded.  Then the Perl code will put this
> file into a different server.
> 
> Is this even possible? I found a perl module that does NET::FTP where
> you can use FTP.  But I cannot figure out how to pass a parameter from
> my code to the Perl code.  I was thinking of just calling a system
> call in unix but : Can you accept command line arguments into Perl
> like you can with C code?  par example in C:
>                     main(int argc, char **argv){ }

Sure - see @ARGV in perldoc perlvar

perldoc FTP begins with an example of the basics, substitute put
instead of get in the method call and supply your own hostid and
filename. You can get pretty arcane with NET::FTP if you already
know how ftp works, otherwise a little time with the debugger is
likely to be instructive.

> I tried looking on all FAQS and I searched the www.perl.com
> documentation but I can't find any good examples.  All I need is some
> sample code of implementing this. If you can help I'll be a super
> happy girl!!!!

> Thanx a bunch,

A pleasure, I'm sure - hth.

> Linda

Wm Blasius
Stuttgart
-- 
---

-- 
* I am Pentium of Borg. Division is futile. You will be approximated. *
 ...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!


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

Date: Mon, 22 Nov 1999 18:19:44 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: FTP in PERL, cmd line args etc.
Message-Id: <38397B30.A091549E@ife.ee.ethz.ch>

Linda Minnich wrote:

> the solution:  I plan on having the Perl code accept a list of
> arguments.. that being the servername to FTP to, a login name, passwd,
> and the filename to be uploaded.  Then the Perl code will put this
> file into a different server.
> 
> Is this even possible? I found a perl module that does NET::FTP where
> you can use FTP.  But I cannot figure out how to pass a parameter from
> my code to the Perl code.  I was thinking of just calling a system
> call in unix but : Can you accept command line arguments into Perl
> like you can with C code?  par example in C:

You can certainly use command line arguments. Otherwise, Perl wouldn't
be very useful...
look at the documentation of @ARGV in the perlvar manpage.

#!/usr/bin/perl -w
use strict;      #use strict and -w help you find errors
use Net::FTP;

check_for_valid_arguments(@ARGV);
my ($server, $login, $passwd, $file) = @ARGV;
upload_to_ftp_server($server, $login, $passwd, $file);

__END__

you have to figure out yourself how the two functions in there should
look.

- Alex


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

Date: Mon, 22 Nov 1999 07:29:18 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: FTP in PERL, cmd line args etc.
Message-Id: <slrn83idou.8gu.tadmc@magna.metronet.com>

On Mon, 22 Nov 1999 16:23:55 GMT, Linda Minnich <lin.minnich@usa.net> wrote:

>But I cannot figure out how to pass a parameter from
>my code to the Perl code.  I was thinking of just calling a system
>call in unix 


   That should work fine.


> but : Can you accept command line arguments into Perl
>like you can with C code?  par example in C: 
>                    main(int argc, char **argv){ }


   Yes, but the array is named @ARGV in Perl.

   (and $ARGV[0] is not what C programmers expect it to be)


   Look it up in perlvar.pod.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 22 Nov 1999 13:02:15 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: Generating pi
Message-Id: <8E86873BFquuxi@10.1.2.158>

jarrowwx@NOSPAM.home.com (John Arrowwood) wrote in 
<38351AE2.D557CF32@NOSPAM.home.com>:

>Matt Dale wrote:
>
>> revjack <revjack@radix.net> wrote:
>>
>> >revjack explains it all:
>> >:Anybody ever tool up an algorithm in perl to generate the
>> >:digits of pi?
>>
>> >Um, I mean, an algorithm that will crank out the digits one
>> >after another, ad infinitum, without cheating like Abigail.
>>
>> Try this
>>
>> 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11....................and so on.
>>
>> I leave you to work out the perl, this may take a while.
>
>Cool, and easy (took less than 5 minutes to code), but not very
>accurate.  I wanted to do a similar thing once, but to one million
>decimal places.  This only works to about 3 decimal places, then loses
>out due to rounding errors (most likely).  Any other suggestions?
>
[code snipped]

Here's one I adapted from a C program:
-------------------------pi.pl-------------------------------
#!perl -w
use strict;
use diagnostics;

#void

my ($cnt, $n, $temp, $nd);
my ($col, $col1);
my $loc = 0;
my @mf;
my @ms;
my @stor = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

sub shift_em
{
   #(long FAR *l1, long FAR *l2, long lp, long lmod)
   #long k;
   #( $l1, $l2, $lp, $lmod ) = ???
   my $l1   = \$_[0];
   my $l2   = \$_[1];
   my $lp= $_[2];
   my $lmod = $_[3];

   my $k = int($$l2 > 0 ? ($$l2 / $lmod) : -(-$$l2 / $lmod) - 1);
   $$l2 -= $k * $lmod;
   $$l1 += $k * $lp;
}

sub yprint #(long m)
{
   my $z = shift;
   if ($cnt<$n)
   {
      if (++$col == 11)
      {
         $col = 1;
         if (++$col1 == 6)
         {
            $col1 = 0;
            #printf("\n");
            printf("\n%4ld",$z%10);
         }
         else{
            printf("%3ld",$z%10);
         }
      }
      else{
         printf("%ld",$z);
      }
      $cnt++;
   }
}

sub xprint #(long $z)
{
   my $z = shift;
   my ( $ii, $wk, $wk1 );

   if ($z < 8)
   {
      for ($ii = 1; $ii <= $loc; ){
         yprint( $stor[$ii++] );
      }
      $loc = 0;
   }
   else
   {
      if ($z > 9)
      {
         $wk = $z / 10;
         $z %= 10;
         for ($wk1 = $loc; $wk1 >= 1; $wk1--)
         {
            $wk += $stor[$wk1];
            $stor[$wk1] = $wk % 10;
            $wk /= 10;
         }
      }
   }
   $stor[++$loc] = $z;
}

#int main(int argc, char *argv[])
{
   my $i=0;
   #char *endp;
   
   $stor[$i++] = 0;
   #n = strtol(argv[1], &endp, 10);
   $n = shift
      or die "Usage : PI <number_of_digits>";
   
   printf("\nApproximation of PI to %ld digits\n", $n);
   $cnt = 0;
   my $kf = 25;
   my $ks = 57121;
   $mf[1] = 1;
   
   for ($i = 2; $i <= $n; $i += 2)
   {
      $mf[$i] = -16;
      $mf[$i+1] = 16;
   }
   
   for ($i = 1; $i <= $n; $i += 2)
   {
      $ms[$i] = -4;
      $ms[$i+1] = 4;
   }
   
   printf("\n 3.");
   while ($cnt < $n)
   {
      for ($i = 0; ++$i <= $n - $cnt; )
      {
         $mf[$i] *= 10;
         $ms[$i] *= 10;
      }
      for ($i = $n - $cnt + 1; --$i >= 2; )
      {
         $temp = 2 * $i - 1;
         shift_em($mf[$i - 1], $mf[$i], $temp - 2, $temp * $kf);
         shift_em($ms[$i - 1], $ms[$i], $temp - 2, $temp * $ks);
      }
      $nd = 0;
      shift_em( $nd, $mf[1], 1, 5);
      shift_em( $nd, $ms[1], 1, 239);
      xprint($nd);
   } # wend
   printf("\n\nCalculations Completed!\n");
}
-------------------------pi.pl-------------------------------

Calculating 1000 digits in C took 0.61 sec ( gcc -O5 )
Calculating 1000 digits in Perl: 24.68 sec

-- 
-----BEGIN GEEK CODE BLOCK----- 
Version 3.1
GCS/MU d- s:- a30 C++$ UL+ P+>+++ L++ E- W+ N++ o? K? w++>$ O++$ M-
V- PS PE Y PGP- t+ 5 X++ R* tv++ b++ DI+++ D++ G- e+++ h-- r-- !y+
-----END GEEK CODE BLOCK----- 

Csaba Raduly,    Software Developer (OS/2),    Sophos Anti-Virus
mailto:csaba.raduly@sophos.com            http://www.sophos.com/
US Support +1 888 SOPHOS 9            UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: 22 Nov 1999 16:38:36 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Help w/ DBI
Message-Id: <3839713A.6C7627A6@vpservices.com>

Adam Levenstein wrote:
> 
> #/usr/bin/perl -wT

No ! 

> use DBI

No ;

-- 
Jeff


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

Date: Mon, 22 Nov 1999 18:29:31 GMT
From: null@effierover.com (Effie Rover)
Subject: Re: Help With CyberCash....
Message-Id: <383d8aeb.20119181@news.iinc.com>

On Sun, 21 Nov 1999 16:19:46 -0500, brian@smithrenaud.com (brian d
foy) did scribe:

>In article <3836B6D8.BC30CC93@voxel.net>, Raj Dutt <rdutt@voxel.net> wrote:
>
>>> extensively with CyberCash about this and they indicate it is not
>>> their policy to help with stuff like this. I have modified the script
>>
>>This has absolutely nothing to do with Cybercash. And I don't see what it has to
>>do with perl either.
>
>well, they have a Perl API, so dealing with them is about Perl.  the
>original poster is not complaining about Cybercash not working, just that
>they don't provide technical support.

Sorry to jump in below, but I missed the original post. I have had
experience dealing with the Cybercash API and also modifying their
libraries. It's all written in or can be interfaced to with Perl. IMX,
it's a royal pain. The way they construct packages is beyond me and
half the time you can't get the information out that you want because
their variables are scoped so bizarrely and routinely re-used with
equally goofy scoping elsewhere.

If you just want the transaction status, there's a standard call that
is well-documented on their web site. Those calls work great. If you
need to modify their code to get it working, don't. Just my $0.02

  -- Loy

The email address in the From: field goes straight to /dev/null :-)
Loy Ellen Gross AKA Effie Rover -- effie @ effierover . com
Effie Rover's Fantasy RPG Library -- http://www.effierover.com
------------------------------------------------------------------
Dwoemers sent in the vile tongue of Redmond may be given as ritual
sacrifice to the void faerie. (Don't send me HTML formatted email)



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

Date: 22 Nov 1999 11:11:52 -0500
From: Nandu Shah <nandu@cimedia.com>
Subject: Re: How to Capitalize the first letter of a word an or whole word
Message-Id: <m3vh6u5wvr.fsf@budgie.cimedia.com>

Use ucfirst() to capitalize the first letter, or uc() for the whole
string.  

Nandu


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

Date: Mon, 22 Nov 1999 13:15:56 -0500
From: "Bruce Pennypacker" <brucep@msn.com>
Subject: HTTP::Request and LWP::UserAgent
Message-Id: <#SbAYWRN$GA.251@cpmsnbbsa03>

I'm writing a perl script to test some web based services.  In order to be
as thorough as possible I want to be able to generate both HTTP/1.0 and
HTTP/1.1 requests.  Can this be done using HTTP::Request and LWP::UserAgent?
If I try to add the HTTP version to the HTTTP:Request constructor it fails
in various ways...

-Bruce





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

Date: 22 Nov 1999 12:47:50 EST
From: rdm@cfcl.com (Rich Morin)
Subject: Re: Macintosh specifc perl syntax?
Message-Id: <rdm-2211990941090001@w205.z205158144.scl-ca.dsl.cnc.net>

In article <spamfree-2111990127190001@192.168.1.2>,
spamfree@metropolis.net.au (Henry Penninkilampi) wrote:
>You might also want to cruise by <http://www.macperl.org/> and check out
>the resources available.  Signing up for one (or more) of the many MacPerl
>mailing lists would probably be a good idea as well.

Actually, folks who are interested in MacPerl should visit the MacPerl Pages
(<http://www.macperl.com>); http://www.macperl.org is mostly a placeholder,
in case there is need for a _strictly_ non-commercial MacPerl site.

More generally, if you are trying to program in MacPerl, I recommend (all
modesty aside :-) Prime Time Freeware's book on the subject:

    MacPerl: Power and Ease
    Vicki Brown and Chris Nandor
    Prime Time Freeware, 1998        Suggested Retail Price: $40
    ISBN 1-881957-32-2               400 pp., paper; HFS format CD-ROM

-r

-- 
Rich Morin:          rdm@cfcl.com, +1 650-873-7841, www.ptf.com/rdm
Prime Time Freeware: info@ptf.com, +1 408-433-9662, www.ptf.com
MacPerl: www.macperl.com
MkLinux: www.mklinux.org


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

Date: 22 Nov 1999 17:55:40 +0000
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: mailto:Idon'tThinkSo
Message-Id: <wkemdiqulf.fsf@yahoo.com>

"styxx" <mrmustard45@hotmail.com> writes:

> Thank you John,
> Indeed escaping the @ sign is necessary, however while the program displays
> with no problem, the link is not hot. I am wondering If I have to go withone
> of the standard Mail forms.
> 
> > > I try and include a \<a \href="mailto:me@mysite.com\> (without the

unclosed " ??                                           ^^^^

(no need to \ the href either of course)

Don't forget this will deliver you the escaped form
of the form (this being a Pune or Play on Wordes).


hth
tony



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

Date: Mon, 22 Nov 1999 18:19:57 GMT
From: "styxx" <mrmustard45@hotmail.com>
Subject: Re: mailto:Idon'tThinkSo
Message-Id: <hPf_3.2776$qC1.193841@typhoon1.rdc-detw.rr.com>

John Arrowwood <jarrowwx@home.com> wrote in message
news:Pine.LNX.4.10.9911220817170.5333-100000@c42753-a.potlnd1.or.home.com...
> Hmmm...  Then it sounds like the HTML is malformed.  Or there is another
> possibility...perhaps the browser you are using doesn't know what to do
> with (or isn't configured for) mailto: links.  Try just creating a
> straight HTML file with the desired link, then see if it works in your
> browser.  If not, then the problem wasn't in your Perl script.  If it
> does, then post the script so we can take a look at it.
>


#!/usr/local/bin/perl
$time=localtime(time);
$input=$ENV{'QUERY_STRING'};
($url,$email,$userName,$password,$varify,$text)= split/&/,$input;
($url1,$url)=split/=/,$url;($email1,$email)=split/=/,$email;
($userName1,$userName)=split/=/,$userName;
($password1,$password)=split/=/,$password;
($varify1,$varify)=split/=/,$varify;($text1,$text)=split/=/,$text;
$text=~s/\+/ /ig ;

open (GROUPINFO,">>groupInfo.txt") or print "Can't open : $!";
print GROUPINFO "$userName $password $email\n $text\n\n";
close (GROUPINFO);
print<<__END__;
Content-type: text/html\n\n


<html><head><title>test time</title></head>
<body bgColor="#001500" text="#0088FF" ><font face='arial'>
<BLOCKQUOTE>
Thank you $userName for participating.<br>
Your password is $password<br>
You have described your site as:<br> $text<p>
Your user name and password may come in handy in the future.<br>
You will be receiving an email.<br>
Please attach a small graphic that may be used to link to your site.<br>
Check back to see how your site is displayed.<br>
Your Suggestions within the email are Welcome<br>
<a href="mailto:abroder@worldwidewing.com"><font color="red">WebMaster</a>
</font></a>
<font color="red">WebMaster</a>
</font>
</BLOCKQUOTE>
</font>
</body>
</html>
__END__

> On Mon, 22 Nov 1999, styxx wrote:
>
> > Thank you John,
> > Indeed escaping the @ sign is necessary, however while the program
displays
> > with no problem, the link is not hot. I am wondering If I have to go
withone
> > of the standard Mail forms.
> >
> > John Arrowwood <jarrowwx@NOSPAM.home.com> wrote in message
> > news:3838D543.C423FB9F@NOSPAM.home.com...
> > > styxx wrote:
> > >
> > > > So I am writing a reply perl script. And in the perlscript I want my
> > > > recipients to send me suggestions, if they please. But when I write
the
> > HTML
> > > > contents in the
> > > > content-type: text/html\n\n;
> > > > print<<__end;
> > > > <html>so on and so forth
> > > >
> > > > __end
> > > >
> > > > I try and include a \<a \href="mailto:me@mysite.com\> (without the
> > escape
> > > > characters, of course). however the perl script will not accept the
> > mailto.
> > > > Even if I create form and set the "Action" equal to the
mailto:address,
> > the
> > > > script will not accept it. Any suggestions?
> > >
>
>




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

Date: Mon, 22 Nov 1999 18:25:49 GMT
From: "styxx" <mrmustard45@hotmail.com>
Subject: Re: mailto:Idon'tThinkSo
Message-Id: <NUf_3.2777$qC1.193686@typhoon1.rdc-detw.rr.com>

Oops: sent you the text version: Here is the real version with the escape
character:

John Arrowwood <jarrowwx@home.com> wrote in message
news:Pine.LNX.4.10.9911220817170.5333-100000@c42753-a.potlnd1.or.home.com...
> Hmmm...  Then it sounds like the HTML is malformed.  Or there is another
> possibility...perhaps the browser you are using doesn't know what to do
> with (or isn't configured for) mailto: links.  Try just creating a
> straight HTML file with the desired link, then see if it works in your
> browser.  If not, then the problem wasn't in your Perl script.  If it
> does, then post the script so we can take a look at it.
>
#!/usr/local/bin/perl

$time=localtime(time);
$input=$ENV{'QUERY_STRING'};
($url,$email,$userName,$password,$varify,$text)= split/&/,$input;
($url1,$url)=split/=/,$url;($email1,$email)=split/=/,$email;
($userName1,$userName)=split/=/,$userName;
($password1,$password)=split/=/,$password;
($varify1,$varify)=split/=/,$varify;($text1,$text)=split/=/,$text;
$text=~s/\+/ /ig ;

open (GROUPINFO,">>groupInfo.txt") or print "Can't open : $!";
print GROUPINFO "$userName $password $email\n $text\n\n";
close (GROUPINFO);
print<<__END__;
Content-type: text/html\n\n


<html><head><title>test time</title></head>
<body bgColor="#001500" text="#0088FF" ><font face='arial'>
<BLOCKQUOTE>
Thank you $userName for participating.<br>
Your password is $password<br>
You have described your site as:<br> $text<p>
Your user name and password may come in handy in the future.<br>
You will be receiving an email.<br>
Please attach a small graphic that may be used to link to your site.<br>
Check back to see how your site is displayed.<br>
Your Suggestions within the email are Welcome<br>
<a href="mailto:abroder\@worldwidewing.com"><font color="red">WebMaster</a>
</font></a>
<font color="red">WebMaster</a>
</font>
</BLOCKQUOTE>
</font>
</body>
</html>
__END__






> On Mon, 22 Nov 1999, styxx wrote:
>
> > Thank you John,
> > Indeed escaping the @ sign is necessary, however while the program
displays
> > with no problem, the link is not hot. I am wondering If I have to go
withone
> > of the standard Mail forms.
> >
> > John Arrowwood <jarrowwx@NOSPAM.home.com> wrote in message
> > news:3838D543.C423FB9F@NOSPAM.home.com...
> > > styxx wrote:
> > >
> > > > So I am writing a reply perl script. And in the perlscript I want my
> > > > recipients to send me suggestions, if they please. But when I write
the
> > HTML
> > > > contents in the
> > > > content-type: text/html\n\n;
> > > > print<<__end;
> > > > <html>so on and so forth
> > > >
> > > > __end
> > > >
> > > > I try and include a \<a \href="mailto:me@mysite.com\> (without the
> > escape
> > > > characters, of course). however the perl script will not accept the
> > mailto.
> > > > Even if I create form and set the "Action" equal to the
mailto:address,
> > the
> > > > script will not accept it. Any suggestions?
> > >
>




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

Date: Mon, 22 Nov 1999 18:11:45 GMT
From: excalibor@my-deja.com
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <81c10s$ain$1@nnrp1.deja.com>

In article <slrn83g07d.m2v.abigail@alexandra.delanet.com>,
  abigail@delanet.com wrote:
> Conrad Schneiker (schneiker@jump.net) wrote on MMCCLXXIII September
> MCMXCIII in <URL:news:818od1$34p$1@news.jump.net>:
> \\ Has anyone (in recent times) given any serious thought to what a
new
> \\ dialect/species of perl ought to look like if (full) backwards
compatibility
> \\ were not required?
>
> Two things: first class filehandles, and usuable OO.

I am curious: regarding OO, what do you consider usable OO? I am a
recent happy(? :-) user of your OO::Closures module (I am actually
thinking about some improvements I'd comment with you privately if I
can put some shape into them) and I may see where you are aiming, but
not too far...

>
> I kind of fail to see the benefits of any perl-to-java bytecode
compiler.
> What are those platforms that have been running perl for eons, but for
> which no Java VM is available going to do?

I actually would rather have a pvm ready to digest perl-bytecoded
programs (eg. CGI scripts would start/generally work, (much?) faster
without the hassle of compiling them to native C, as this would create
lots of trouble with some proprietary platform that don't follow
standards). In some ways, perl is both, but being able to do so in two
separeate steps (creating, dunno, .plc files) could be cool in some
cases (not all, btw)

> Furthermore, Perl is considered to be "slow", and it often is compared
> to C (depending on the program).

I don't think Perl it's slow... considering the hassle you'd have doing
things in C (which, after all, are already done... it's most of Perl :)
I don't think regex stuff or things that don't involve complex
structures like hashes, &c... (that can be implemented just for the
problem in C and will go much faster than the general purpose,
can-eat-anything Perl hashes)...

I think part of the 'slowness' of perl can be due to the previous
compiling step... in those cases a pure bytecode interpreter would
probably offer better psychological response (and, besides, the code
could be really optimized...)

well,...

best regards,
d@

--
David S de Lis

$ cat > mail.file
Write me a 'Just another Perl hacker' nifty script to put on my .sig
The boss
^D
$ mail -s "URGENT" employee < mail.file


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 22 Nov 1999 12:07:55 -0500
From: "Steve Poulsen" <dont.email@post.responses>
Subject: Re: Passing a parameter does not work when it came from a list.
Message-Id: <81bsve$h3p$1@nnrp02.primenet.com>

Ok, I did the couple of things suggested earlier and although good
practices, they did not help.  I then did the following just before the
rename (which prints out the ascii values).  However if I set the $to to
exactly what prints out (double-checking the ascii) I get the same ascii,
but it then renames properly.  If I use the string replaced version, it
prints out the same ASCII but halts at the rename (no error code because
this is CGI).  It may be relevant that $to comes from the
$cgi_data{'form_label'}  from cgi-bin.  I have tried to get it from just a
standard edit box.

SUMMARY:

I print the data and its right.  I print the ASCII and its right, but rename
hangs.  If I fix the $to to the same exact string that I got from
$cgi_data{'form_label'} then everything works.


THIS DOESN'T WORK: $to = $cgi_data{'form_var'}; # even though it prints
right.

THIS DOES WORK:  $to = "new_file.zip"; # new_file.zip is what the form_var
holds anyway (for my test case)

Here is my ASCII dump and rename.  Thanks again...


Steve

  print "Renaming from $from to $to \n";

  print "ASCII:";
  $i = 0;
  while ($i < length($to))
  {
    print ord(substr($to,$i,1));
    print " ";
    $i++;
  }

  print "\n";

Larry Rosler wrote in message ...
>In article <Wq6_3.7109$MZ.54831@ozemail.com.au> on Mon, 22 Nov 1999
>18:34:20 +1100, Ron Savage <ron@savage.net.au> says...
>
>...
>
>> >   $newfile = $cgi_cfn{'upfile'};
>> >   $newfile =~ s/^.*\\([^\\]*)$/symbols\/$1/;
>> > # at this point, $newfile is symbols/grep.zip as the following line
prints
>> > out.
>> >
>> >   print "Renaming from $cgi_sfn{'upfile'} to $newfile \n";
>> >
>> > # If I hardcode the file name, the following rename works.  Otherwise,
>> > something goes wrong
>> > #  $newfile = "symbols/grep.zip";
>> >
>> >   rename $cgi_sfn{'upfile'},$newfile or
>> >       print("Unable to rename file $cgi_sfn{'upfile'} to $newfile\n");
>>
>> I suggest "rename ($cgi_sfn{'upfile'},$newfile) or ...". That way, you'll
>> never get caught by confusion over the relative precedence of 'comma' and
>> 'or'.
>
>The code is correct as written, and the compiler isn't "caught by
>confusion over the relative precedence of 'comma' and 'or'".  So this
>isn't the problem.
>
>I would suggest including $! in the diagnostic, so the OS can tell you
>what is wrong with the rename.  I would also examine the contents of
>$cgi_sfn{upfile} and $newfile after the substitution very carefully --
>using length() and perhaps a hex dump, and putting delimiting characters
>in the printout. Perhaps there is whitespace at the end of the input
>parameter, so it doesn't match the real name of the file.
>
>--
>(Just Another Larry) Rosler
>Hewlett-Packard Laboratories
>http://www.hpl.hp.com/personal/Larry_Rosler/
>lr@hpl.hp.com




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

Date: Mon, 22 Nov 1999 11:20:31 -0700
From: "Cory Aitchison" <caitchison@hotmail.com>
Subject: passing arrays by reference
Message-Id: <38398995.0@news.provo.novell.com>

I would like to be able to pass an array by reference to a function, assign
an array reference to the passed reference and be able to manipulate the
array.  Is this possible.  Belo is some code that attemps to clarify my
problem.

use strict;

my @array = qw (0 1 2 3 4 5 6);

modify (\@array);

sub modify {

   my $tempArrayAddress = $_[0];
   my @tempArray;

   \@tempArray = $tempArrayAddress;

   print \@tempArray . " " . $tempArrayAddress . "\n";

   $tempArray[1] = 9999999;

}

print @array;

When the last print @array executes the array is unchanged.  Any insights?

Thanks in advance.

Cory Aitchison




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

Date: Mon, 22 Nov 1999 18:36:46 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: passing arrays by reference
Message-Id: <81c2dt$fa2$1@monet.op.net>

In article <38398995.0@news.provo.novell.com>,
Cory Aitchison <caitchison@hotmail.com> wrote:
>   \@tempArray = $tempArrayAddress;

This doesn't mean what you think, and at present it's basically useless.

There are two ways to get what you want:

1. In modify(), access the array by reference:

	$temparrayaddress->[1] = 9999999;

2. Use a glob:

	local *tempArray = $temparrayaddress;
	$tempArray[1] = 9999999;

I recommend the first one.



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

Date: Mon, 22 Nov 1999 18:53:53 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: passing arrays by reference
Message-Id: <5jg_3.16$f5.720@news1.rdc1.mb.home.com>

In article <38398995.0@news.provo.novell.com>,
 Cory Aitchison <caitchison@hotmail.com> wrote:
! I would like to be able to pass an array by reference to a function, assign
! an array reference to the passed reference and be able to manipulate the
! array.  Is this possible.  Belo is some code that attemps to clarify my
! problem.
! 
! use strict;
! 
! my @array = qw (0 1 2 3 4 5 6);
! 
! modify (\@array);
! 
! sub modify {
! 
!    my $tempArrayAddress = $_[0];
!    my @tempArray;
! 
!    \@tempArray = $tempArrayAddress;
[snip]

I think you are trying to hard. You can pass a reference to the array
and then modify the original array through that reference:

#!/usr/bin/perl -w
use strict;
my @array = (0,1,2,3,4,5,6);
modify(\@array);
print "@array\n";

sub modify {
    my $a_ref = shift;
    $a_ref->[1] = 42;
}
__END__

For more information see:
perldoc perlreftut
perldoc perlref
perldoc perlsub

regards
andrew

-- 
Andrew L. Johnson   http://www.manning.com/Johnson/
      Perl can certainly be used as a first computer language, but 
      it was really designed to be a *last* computer language.
          -- Larry Wall
      


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

Date: Mon, 22 Nov 1999 18:06:26 GMT
From: Greg Hersh <ghersh@bbn.com>
Subject: perl-mode xemacs vs emacs
Message-Id: <383985BD.3ACF@bbn.com>

I've been using emacs for many years, mostly for C and Perl. Was
(and is) very happy with the way perl-mode works on emacs. Recently
decided to take a look at xemacs. Downloaded and compiled the latest
version (21.1.8 I believe). Seems like perl-mode under xemacs behaves
in a different way, and I like it less. For instance, in expression
$a = $b;
in emacs both variables are highlited (with a different color) as
 scalars. In xemacs only $a is highlighted. I also
couldn't use faces to indicate the special highlighting for arrays and
hashes (seems like it did create the lisp statements in .emacs profile
but it didn't make any difference in the display) - in emacs it just
does it. 

Runing on Solaris 2.5, X11R5, Sparcstation. 

TIA,


-- 
Greg


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

Date: Mon, 22 Nov 1999 16:55:40 GMT
From: Jason Eggleston <jegglest@my-deja.com>
Subject: Re: Recursion Problem using my()
Message-Id: <81bsi2$6tc$1@nnrp1.deja.com>

Samuel,

Thank you for clearing that up :)

By the way, the function takes a range of IP addresses and a maximum
boundary range.  It is supposed to describe the range of ip addresses
in CIDR notation without going outside the maximum range passed in.

Of course, it doesn't work yet.

Thanks again,
 -Jason Eggleston

In article <81b8a1$1kijq$1@fu-berlin.de>,
  "Samuel Kilchenmann" <skilchen@swissonline.ch> wrote:
> First i have to admit that i don't understand your code.
> But the differences in the $localmin values have nothing to due with
> the wile loop but with different recursion levels at the moment when
> you print the value and "address" of $localmin.
> The second time you call GetRange the subroutine immediately returns
> after printing the a-case because the condition of the while loop is
> false ($localmin is equal to $min and $localmax is not greater than
> $max). So when the b- and c-cases are printed what happens, is exactly
> what you described above: the values are from the previous function
> call because the context after the return from the second call to
> GetRange is indeed the one from the previous call to GetRange.
>
> Singlestepping using the debugger helps a lot in such cases.
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 22 Nov 1999 18:23:30 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: removing eol characters
Message-Id: <38397C12.36DC0B7F@ife.ee.ethz.ch>

Lloyd Goodman wrote:
> I have a tab delineated file from which I am need to remove keyfields.  One
> of them is a long description which, for reasons out of my control, often
> contain unwanted end of line characters.  How can I remove just the ones
> that appear in the middle of the text?

You have to figure out which newlines you want to remove and which (if
any) you want to keep.
You can then look at the manpages for chomp, s/// and tr///, all of
which can be used to remove eol characters, then choose the operator
which best fits your needs

- Alex


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

Date: Mon, 22 Nov 1999 09:35:51 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: removing eol characters
Message-Id: <MPG.12a31ed29baa3fea98a250@nntp.hpl.hp.com>

In article <38396f0c@ferret.highwayone.net> on Mon, 22 Nov 1999 16:24:14 
-0800, Lloyd Goodman <l.goodman@edisoninteractive.com> says...
> Apologies in advance for posting such a basic question.

Not so basic -- I haven't seen it before.

> I have a tab delineated file from which I am need to remove keyfields.  One
> of them is a long description which, for reasons out of my control, often
> contain unwanted end of line characters.  How can I remove just the ones
> that appear in the middle of the text?

    s/\n(?=.)//g

Explanation:  Delete every newline that is followed by a non-newline.  A 
terminating newline is left alone.

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


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

Date: Mon, 22 Nov 1999 17:24:36 GMT
From: kov@mit.edu
Subject: Shareable.pm: "make test" fails
Message-Id: <81bu85$89a$1@nnrp1.deja.com>

I succesfully made, tested, installed the Storable module under our
system, but "make test" on Shareable gives an interesting error at the
end of its tests. Also, the error is different for my user and for
superuser.

Some details:

	% uname -a
	SunOS myhost.mydom.com 5.7 Generic sun4u sparc SUNW,Ultra-5_10

	% perl -v
	This is perl, version 5.005_02 built for sun4-solaris ...

If anyone can shed some light on the following errors I'd be very
appreciative.

-- kov

The error I get when running as myself:

% make test
PERL_DL_NONLAZY=1 /bin/perl -Iblib/arch -Iblib/lib
-I/usr/local/lib/perl5/5.00502/sun4-solaris
-I/usr/local/lib/perl5/5.00502 test.pl
1..14
ok 1
[SNIP]
ok 13
IPC::Shareable::FETCH: semctl returned false: Permission denied at
test.pl line
231
make: *** [test_dynamic] Error 13


And the error as superuser:

# make test
PERL_DL_NONLAZY=1 /bin/perl -Iblib/arch -Iblib/lib
-I/usr/local/lib/perl5/5.00502/sun4-solaris
-I/usr/local/lib/perl5/5.00502
test.pl
1..14
ok 1
[SNIP]
ok 13
IPC::Shareable::read_shm_header: shmread returned false: Invalid
argument at test.pl line 231
make: *** [test_dynamic] Error 22



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 22 Nov 1999 18:12:31 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Simple s#this string#that string# doesn't work?
Message-Id: <3839797F.D16825A3@ife.ee.ethz.ch>

Reg Smith wrote:
> 
> I can certainly remove the vcard, but as for the choice of newreader, at the
> moment my company has just moved everyone over to using Netscape, so by default
> that's why I'm using it, not out of malicious disregard for newgroup postings.

After removing the vcard, it looks good - almost.
You now need to read the regularly posted Jeopardy articly by TomC to
find out why it is better to add your comment *after* to quoted text and
why one should not quote sigs.

- Alex


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

Date: 22 Nov 1999 18:44:09 GMT
From: sergeiga@hotpop.com (Sergei Gnezdov)
Subject: Re: timelocal - strange result
Message-Id: <8E5696864sergeigahotpopcom@news.mindspring.com>

>The assumption that every day has 86400 seconds, that's what's wrong.
>On certain places, twice a year, a day doesn't have 86400 seconds,
>but 3600 more, or less.
Ok.  Assumption that every day has 86400 seconds is a bad idea.  How can it 
be done better?

Or, may be a better question: how can I generate sequence of days in epoch 
seconds?


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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


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