[16959] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4371 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 19 06:05:31 2000

Date: Tue, 19 Sep 2000 03:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <969357907-v9-i4371@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 19 Sep 2000     Volume: 9 Number: 4371

Today's topics:
    Re: $0 not working under Solaris 2.7 (Villy Kruse)
    Re: 2 Questions <KBH@nomail.com>
        combining file handles <Avi.Mintz@nsc.com>
    Re: combining file handles <uri@sysarch.com>
        Form to Email with FILE UPLOAD HELP!!! <jbonzo@home.com>
        Gratuitous incompatibilities (Was: Re: Range operator w <lr@hpl.hp.com>
        Help with Date <Keat@beal.org.uk>
    Re: Help with Date (Logan Shaw)
    Re: Help with Date nobull@mail.com
    Re: How to parse HTML, extract stuff based on rules and (Eric Bohlman)
        How to Use strict with Find::File <FX@hasnomail.com>
    Re: How To? Setting External Subroutine as Method of Pe <philipg@atl.mediaone.net>
    Re: How To? Setting External Subroutine as Method of Pe <design@raincloud-studios.com>
    Re: newbie having problem with system command <undergronk@my-deja.com>
    Re: popup_menu problems (Eric Bohlman)
    Re: Pure perl encrypt/decryption? (Tony L. Svanstrom)
    Re: Range operator with "... /^$/" <bcaligari@my-deja.com>
        rounding error problem <mecks@ust.hk>
    Re: Substring Golf? <wyzelli@yahoo.com>
    Re: Substring Golf? <uri@sysarch.com>
        using perl to email attachments <hugo@fractalgraphics.com.au>
    Re: using perl to email attachments (Villy Kruse)
    Re: Using range operator <aqumsieh@hyperchip.com>
    Re: Using range operator <uri@sysarch.com>
        Willing to pay for this split job petka1@yahoo.com
    Re: Win32::ODBC and CGI Help needed peterhi@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 19 Sep 2000 09:07:15 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: $0 not working under Solaris 2.7
Message-Id: <slrn8seb4q.anr.vek@pharmnl.ohout.pharmapartners.nl>

On 18 Sep 2000 20:31:33 -0500, Tony Curtis <tony_curtis32@yahoo.com> wrote:

>
>$ perldoc perlvar
>
>       $0      Contains the name of the program being executed.
>               On some operating systems assigning to `$0'
>               modifies the argument area that the ps program
>               sees.
>
>"On *some* operating systems".
>
>Solaris obviously ain't one of 'em.
>

On some systems the ps command extracts the command and args from
some saved string deep inside the kernel, and no matter how you
modify these strings in your program it won't modify the copy in
the kernel that ps is looking at.


Villy


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

Date: Tue, 19 Sep 2000 02:30:41 -0400
From: "KBH" <KBH@nomail.com>
Subject: Re: 2 Questions
Message-Id: <8q717j$7kcm$1@newssvr05-en0.news.prodigy.com>


Well with this Delphi everywhere on this (multi-posted) forum I just took a
quick look at Delphi. And it works very much like VB except for the
application language differences. The Inprise web site says that it is a
rapid-application-development tool but then also claims to be a
high-performance compiler. So here is the question: Is Delphi a large slow
runtime like VB?


>
> For those who aren't aware of it there are three editions of Delphi.
> Standard sells for around $99USD but doesn't include any database support
> components (lots of 3rd party stuff available, some of it freeware).
> Professional sells for around $800USD ($300 competitive upg). It includes
> database and other useful components as well as the source code for the
> Visual Component Library. The Enterprise edition is the pricey one and has
> all the bells & whistles, or so I'm told.
>
> Borland also has the habit of letting magazines include older versions of
> the Standard edition in inserts with "private use only" licenses. A search
> of some of the Delphi NG should turn up details on these publications.
>
> In addition to Delphi there are also a number of free Pascal compilers
> generally available, including I believe an edition of Borland's Turbo
> Pascal.
>
>
>




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

Date: Tue, 19 Sep 2000 09:13:59 +0300
From: Avi Mintz <Avi.Mintz@nsc.com>
Subject: combining file handles
Message-Id: <39C70427.57C53374@nsc.com>

is there a way to use 2 file handles together (to read from the first
until the end of it and then from the second ?)

I was thinking of something like :  
  while (<ARGV,STDIN>) so a program can work from a file in the argument
list and also from standard input...

any suggestions ??


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

Date: Tue, 19 Sep 2000 06:19:19 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: combining file handles
Message-Id: <x766nsewev.fsf@home.sysarch.com>

>>>>> "AM" == Avi Mintz <Avi.Mintz@nsc.com> writes:

  AM> is there a way to use 2 file handles together (to read from the first
  AM> until the end of it and then from the second ?)

  AM> I was thinking of something like :  
  AM>   while (<ARGV,STDIN>) so a program can work from a file in the argument
  AM> list and also from standard input...

tied handles

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 19 Sep 2000 05:23:51 GMT
From: "Justin M. Bonzo" <jbonzo@home.com>
Subject: Form to Email with FILE UPLOAD HELP!!!
Message-Id: <39C6F867.E60EE34E@home.com>

I'm Very, VERY NEW to CGI scripting and perl.  I have a form (to email)
on my website that I would like to ad a file upload to.  I've been
unsucessful up till now.  All that I want is for the information that
people submit to arrive with the file that they upload.
--
-------------------------------------------------------------
Justin M. Bonzo        : webmaster@jmbprod.com
Location               : Vancouver, B.C., Canada

Webmaster              : JMB Productions
-------------------------------------------------------------

My CGI is located below.  Can anyone help me?



#!/usr/local/bin/perl5
push (@INC, '/cgi-bin');
require ('cgi-lib.pl');

# This should match the mail program on your system.
$mailprog = '/usr/lib/sendmail';

# This should be set to the username or alias that processes the
# requests


#------ Change 1 ----- Replace the login with your actual login name


$recipient = "webmaster\@jmbprod.com";


# Print out a content-type for HTTP/1.0 compatibility
print "Content-type: text/html\n\n";

# Print a title and initial heading
print "<Head><Title>FORM2EMAIL WITH FILE UPLOAD</Title></Head>";

&ReadParse;

#------ Change 2 ----- Replace the login with your actual login name

open (MAIL, "|$mailprog $recipient") || die "Unable to send
request\nPlease send e-mail to webmaster\@jmbprod.com, Thank you\n";
#open (MAIL, ">test") || die "Cannot open STDOUT: $!\n";
print MAIL "Reply-to: $in{'email'}\n";
print MAIL "Subject: FILE UPLOAD\n";
print MAIL "\n\n";
#print "*$#in_key\n";
foreach $i (0 .. $#in_key){
#print "$in_key[$i] = $in_val[$i], i = $i <p>";
print MAIL "$in_key[$i] = $in_val[$i]\n";
}
print MAIL "-----------------------------------------------\n";
close (MAIL);

And the cgi-lib  looks like:

#!/usr/local/bin/perl -- -*- C -*-

# Perl Routines to Manipulate CGI input
# S.E.Brenner@bioc.cam.ac.uk
# $Header: /cys/people/seb1005/http/cgi-bin/RCS/cgi-lib.pl,v 1.6
1994/07/13 15:00:50 seb1005 Exp $
#
# Copyright 1994 Steven E. Brenner
# Unpublished work.
# Permission granted to use and modify this library so long as the
# copyright above is maintained, modifications are documented, and
# credit is given for any use of the library.
#
# Thanks are due to many people for reporting bugs and suggestions
# especially Meng Weng Wong, Maki Watanabe, Bo Frese Rasmussen,
# Andrew Dalke, Mark-Jason Dominus.

# see http://www.seas.upenn.edu/~mengwong/forms/   or
#     http://www.bio.cam.ac.uk/web/                for more information

# Minimalist http form and script
(http://www.bio.cam.ac.uk/web/minimal.cgi):
# if (&MethGet) {
#   print &PrintHeader,
#       '<form method=POST><input type="submit">Data: <input
name="myfield">';
# } else {
#   &ReadParse(*input);
#   print &PrintHeader, &PrintVariables(%input);
# }


# MethGet
# Return true if this cgi call was using the GET request, false
otherwise
# Now that cgi scripts can be put in the normal file space, it is useful

# to combine both the form and the script in one place with GET used to
# retrieve the form, and POST used to get the result.

sub MethGet {
  return ($ENV{'REQUEST_METHOD'} eq "GET");
}

# ReadParse
# Reads in GET or POST data, converts it to unescaped text, and puts
# one key=value in each member of the list "@in"
# Also creates key/value pairs in %in, using '\0' to separate multiple
# selections

# If a variable-glob parameter (e.g., *cgi_input) is passed to
ReadParse,
# information is stored there, rather than in $in, @in, and %in.

sub ReadParse {
    local (*in) = @_ if @_;


  local ($i, $loc, $key, $val);
  # Read in text
  if ($ENV{'REQUEST_METHOD'} eq "GET") {
    $in = $ENV{'QUERY_STRING'};
  } elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
    read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
  }

  @in = split(/&/,$in);

  foreach $i (0 .. $#in) {
    # Convert plus's to spaces
    $in[$i] =~ s/\+/ /g;

    # Split into key and value.
    ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.

    # Convert %XX from hex numbers to alphanumeric
    $key =~ s/%(..)/pack("c",hex($1))/ge;
    $val =~ s/%(..)/pack("c",hex($1))/ge;
    $in_key[$i] = $key;
    $in_val[$i] = $val;
    # Associate key and value
    $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple
separator
    $in{$key} .= $val;
  }

  return 1; # just for fun
}

# PrintHeader
# Returns the magic line which tells WWW that we're an HTML document

sub PrintHeader {
  return "Content-type: text/html\n\n";
}

# Note: Neither of the PrintVariables functions deals with multiple
#       occurences of keys

# PrintVariables
# Nicely formats variables in an associative array passed as a parameter

# And returns the HTML string.

sub PrintVariables {
  local (%in) = @_;
  local ($old, $out, $output);
  $old = $*;  $* =1;
  $output .=  "<DL COMPACT>";
  foreach $key (sort keys(%in)) {
    ($out = $in{$key}) =~ s/\n/<BR>/g;
    $output .=  "<DT><B>$key</B><DD><I>$out</I><BR>";
  }
  $output .=  "</DL>";
  $* = $old;

  return $output;
}

# PrintVariablesShort
# Nicely formats variables in an associative array passed as a parameter

# Using one line per pair (unless value is multiline)
# And returns the HTML string.


sub PrintVariablesShort {
  local (%in) = @_;
  local ($old, $out, $output);
  $old = $*;  $* =1;
  foreach $key (sort keys(%in)) {
    if (($out = $in{$key}) =~ s/\n/<BR>/g) {
      $output .= "<DL COMPACT><DT><B>$key</B> is <DD><I>$out</I></DL>";
    } else {
      $output .= "<B>$key</B> is <I>$out</I><BR>";
    }
  }
  $* = $old;

  return $output;
}

1; #return true





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

Date: Tue, 19 Sep 2000 00:24:14 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Gratuitous incompatibilities (Was: Re: Range operator with "... /^$/")
Message-Id: <MPG.1430b47af67004c198ad8e@nntp.hpl.hp.com>

In article <8q6ui9$gla$1@nnrp1.deja.com>, bcaligari@my-deja.com says...

 ...

> I always wondered why the people who came up with dos years
> ago wanted 2 characters to mark an end of line.

It made it trivial to generate the two motions needed to reposition a 
teletypewriter (Carriage Return plus Line Feed) directly from the data 
stream (from a file, say), without needing a device driver (shudder!) to 
interpret the two characters from a single-character logical 
representation of New Line.  Think 'raw' mode.

The Unix use of a single character to represent New Line was clever; the 
use of the character literally implementing Line Feed ("\12") instead of 
an otherwise unused control character led to confusion.  Apple's choice 
of Carriage Return ("\15") for the same logical function compounded the 
confusion.

Data interchangeability or program portability or programmer 
interoperability never entered into any of these willfully obtuse 
decisions (such as file-path separators '/', '\\', or ':').  
Differentiation on these trivia seemed a commercial virtue, not an evil.  
We are still paying the price for these sins.

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


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

Date: Tue, 19 Sep 2000 09:32:48 +0100
From: "Keat" <Keat@beal.org.uk>
Subject: Help with Date
Message-Id: <8q783u$f06$1@gxsn.com>

I am having problems with links.pl. I am trying to get it to display the
correct date, but no matter what I try it still thinks this year is year
19100,  Does anyone have any Ideas. Below is the section I believe controls
the date.

   if ($line =~ /<!--time-->/) {
      @months = ('January','February','March','April','May','June',
   'July','August','September','October','November','December');

      @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday',
        'Friday','Saturday');

      ($sec,$min,$hour,$mday,$mon,$year,$wday) =
(localtime(time))[0,1,2,3,4,5,6];
      if ($sec < 10) { $sec = "0$sec"; }
      if ($min < 10) { $min = "0$min"; }
      if ($hour < 10) { $hour = "0$hour"; }
      if ($mday < 10) { $mday = "0$mday"; }
      $date = "on $days[$wday], $months[$mon] $mday, 19$year at
$hour:$min:$sec";
      print FILE "<!--time--><b>Last use was added $date</b><hr>\n";

Ive tried adding  $year = -100; but this just displays 19100-100, Ive also
tried adding a line
if ($year< 99) { $year= "20$year"; -100}, but this doesnt work either.


As accomplished perl scripters will have noticed, I know nothing about Perl,
any info would be greatly appreciated.

Keaton Roebuck
please reply via email

Keat@beal.org.uk






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

Date: 19 Sep 2000 04:06:01 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Help with Date
Message-Id: <8q7a9p$36e$1@provolone.cs.utexas.edu>

In article <8q783u$f06$1@gxsn.com>, Keat <Keat@beal.org.uk> wrote:
>I am having problems with links.pl. I am trying to get it to display the
>correct date, but no matter what I try it still thinks this year is year
>19100,  Does anyone have any Ideas. Below is the section I believe controls
>the date.
>
>   if ($line =~ /<!--time-->/) {
>      @months = ('January','February','March','April','May','June',
>   'July','August','September','October','November','December');
>
>      @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday',
>        'Friday','Saturday');
>
>      ($sec,$min,$hour,$mday,$mon,$year,$wday) =
>(localtime(time))[0,1,2,3,4,5,6];
>      if ($sec < 10) { $sec = "0$sec"; }
>      if ($min < 10) { $min = "0$min"; }
>      if ($hour < 10) { $hour = "0$hour"; }
>      if ($mday < 10) { $mday = "0$mday"; }
>      $date = "on $days[$wday], $months[$mon] $mday, 19$year at
>$hour:$min:$sec";
>      print FILE "<!--time--><b>Last use was added $date</b><hr>\n";
>
>Ive tried adding  $year = -100; but this just displays 19100-100, Ive also
>tried adding a line
>if ($year< 99) { $year= "20$year"; -100}, but this doesnt work either.

Read the documentation.  (Do a "perldoc -f localtime".)

localtime() doesn't return the last two digits of the year.  It returns
the number of years since 1900.  Right now, it's 100 years since 1900,
so it returns 100.  Next year, it will have been 101 years, so it will
return 101 then.  Last year, it was 99, so it returned 99.

I'm sure if you think about it for a while, you can think of a nice
(hint: arithmetic) operator that will do what you want.

Also, that code that adds leading zeros is not the greatest.
There's a built-in function that does just that for you
called sprintf.  So, you can replace

	if ($sec < 10) { $sec = "0$sec"; }

with just

	$sec = sprintf ("%02d", $sec);

Hope that helps.

  - Logan


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

Date: 19 Sep 2000 08:46:13 +0100
From: nobull@mail.com
Subject: Re: Help with Date
Message-Id: <u9lmwohie3.fsf@wcl-l.bham.ac.uk>

"Keat" <Keat@beal.org.uk> crossposts wildly:

> Newsgroups: alt.comp.lang.superlang,alt.comp.perlcgi.freelance,
>             comp.lang.perl.misc,comp.lang.perl.modules,
>             comp.lang.perl.tk,eug.comp.lang.perl

> I am trying to get it to display the correct date, but no matter
> what I try it still thinks this year is year 19100,

perldoc -f localtime

Note what value is returned in the year field.

And your CGI question is....?
And your modules question is....?
And your TK question is....?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 19 Sep 2000 04:37:43 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: How to parse HTML, extract stuff based on rules and spit out reformatted HTML?
Message-Id: <8q6qin$kk5$2@slb7.atl.mindspring.net>

cpraber@yahoo.com wrote:
: * Warning: Newbie alert *
: 
: This is probably way too ambitious for this newbie to consider taking
: on, but I would like to build a utility that would parse and extract
: data from HTML documents and spit out newly formed HTML based
: on "rules". Don't ask me what these rules look like yet, I haven;t the
: foggiest!
: 
: The idea: this utility would operate in "real-time" for morphing
: existing HTML and re-purposing it for delivery to diffent browsers than
: were intended by the design of the original HTML (e.g. going from
: browser rendering to WAP/WML, etc).
: 
: I have read some of the posts on this forum about HTML Parsing, but I
: am wondering what are the existing perl modules or techniques I should
: study with this goal in mind? Or, if there is work out there along
: these lines already underway, I would appreciate a pointer on where to
: furher my inquiry.

You'll need the HTML::Parser module, available from CPAN (or ActiveState 
if you're using ActivePerl).  If you're a newbie, I'd suggest also 
getting Matt Sergeant's XML::PYX module, which includes a little script 
called pyxhtml.  This takes an HTML file (it doesn't have to be XHTML, 
despite the script being part of an XML::* module) and outputs it in PYX 
format: one line for each start tag, attribute, end tag, run of text, or 
processing instruction (if you need to preserve, or worse, act on, 
comments in the HTML, then PYX format is inappropriate) with the first 
character of each line indicating what type it is.  You can simply open a 
pipe from pyxhtml, or call it using backticks, and then read each line 
with a standard while loop.

The next step up in complexity is HTML::TokeParser, which comes with 
HTML::Parser.  Finally, you can use HTML::Parser itself; most newbies 
would find this a lot more complicated because you use it in an 
event-driven rather than procedural fashion.

Finally, take a look at the other HTML::* modules on CPAN; for example, 
if you need to extract data from tables, HTML::TableExtract is probably a 
good choice.

Definitely resist the temptation to "parse" HTML with regular expressions 
unless you're only dealing with HTML that you've generated yourself.  
Most attempts to "hack parse" HTML are easily tripped up by minor lexical 
variations in the incoming HTML.
 


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

Date: Tue, 19 Sep 2000 11:02:40 +0200
From: "FX" <FX@hasnomail.com>
Subject: How to Use strict with Find::File
Message-Id: <8q7a10$psk$1@front5.grolier.fr>

Hi,

As I'm new to perl and want to learn things... I would like to use strict
(as many of you recommended).

But I'm using the File::Find function.
I found in a book a sample, it look something like this :

sub main{
    find(\&FileTraitment,@directoryList);
    foreach $element (@FileList){
        print "$element";
    }
}
FileTraitment {
    if (-d){
      print "\nScanning Directoy : $File::Find::name";
    }
    else{
        my @splitFileName = split('/',$File::Find::name);
        push(@FileList,@splitFileName[$#splitFileName]);
    }
}

It's working alright but when using strict it won't. Obviously
@FileList is global so this must be the problem. But I can't find
the right syntax ... to return the List to the Main function

Any Idea ?

Thx

FX

PS: by the way does any one know a good, simple, clear, and free
Perl Paper that don't assume you know UNIX.




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

Date: Tue, 19 Sep 2000 04:10:26 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: How To? Setting External Subroutine as Method of Perl Module and passing arguments
Message-Id: <SGBx5.16029$g35.2867488@typhoon.southeast.rr.com>

RainCloud Studios <design@raincloud-studios.com> wrote in message
news:UVAx5.4129$Ao3.25493@news1.atl...
[snip]
> # in my calling script
> sub error_handler{
>   my $error = shift;
>   &print_header;
>   &print_custom_html_header;
>   print $error;
>   &print_custom_html_footer;
>   exit;
> }
>
> Now.. in the script I call my module.
>
> use THINGY::MYTHING;
> my $newthingy = MYTHING->new();
> $newthingy->error_handler(\&error_handler);
> $newthingy->dosomething();
[snip]

For more info on how to use subroutine refs, see perldoc perlref.  There are
examples of how to pass arguments under "Using References"

sub dosomething {
    my ($self) = @_;

    if ($insert_your_error_condition_here) {
        &{$self->error_handler}("error text goes here");
        exit;
    }
}

hth,
p




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

Date: Tue, 19 Sep 2000 02:10:00 -0400
From: "RainCloud Studios" <design@raincloud-studios.com>
Subject: Re: How To? Setting External Subroutine as Method of Perl Module and passing arguments
Message-Id: <SqDx5.4712$Ku3.26144@news4.atl>

Ahh.. that makes sense. More reading to do. I appreciate the example
snippet. Helps get me going while I'm still learning.

CT

"Philip Garrett" <philipg@atl.mediaone.net> wrote in message
news:SGBx5.16029$g35.2867488@typhoon.southeast.rr.com...
> RainCloud Studios <design@raincloud-studios.com> wrote in message
> news:UVAx5.4129$Ao3.25493@news1.atl...
> [snip]
> > # in my calling script
> > sub error_handler{
> >   my $error = shift;
> >   &print_header;
> >   &print_custom_html_header;
> >   print $error;
> >   &print_custom_html_footer;
> >   exit;
> > }
> >
> > Now.. in the script I call my module.
> >
> > use THINGY::MYTHING;
> > my $newthingy = MYTHING->new();
> > $newthingy->error_handler(\&error_handler);
> > $newthingy->dosomething();
> [snip]
>
> For more info on how to use subroutine refs, see perldoc perlref.  There
are
> examples of how to pass arguments under "Using References"
>
> sub dosomething {
>     my ($self) = @_;
>
>     if ($insert_your_error_condition_here) {
>         &{$self->error_handler}("error text goes here");
>         exit;
>     }
> }
>
> hth,
> p
>
>




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

Date: Tue, 19 Sep 2000 08:44:28 GMT
From: Scott Kirk <undergronk@my-deja.com>
Subject: Re: newbie having problem with system command
Message-Id: <8q7919$si5$1@nnrp1.deja.com>

In article <Rzzx5.10708$%h6.2705164@typhoon.nyroc.rr.com>,
  "orassilv" <ssilv@rochester.rr.com> wrote:

> Any ideas why I can't run a batch file using the system command?

I _can_ run batch files using the system command.  I suspect you might
have a path problem.

Does your perl script know which directory the batch file is in?

You could try a test with the perl script and the batch file in the
same directory.

HTH

--
Scott Kirk
My deja.com mailbox is full of spam. Use this instead:
perl -e '$_ = "znvygb: haqretebax\@lnubb.pbz";
tr/A-Za-z/N-ZA-Mn-za-m/; print;'


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


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

Date: 19 Sep 2000 04:10:05 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: popup_menu problems
Message-Id: <8q6out$kk5$1@slb7.atl.mindspring.net>

arthur (star@sonic.net) wrote:
: 
: 
: Good day,
: 
: I am trying to get a popup_menu to work
: When I run the following:

Let's try re-indenting it to make it clearer

 #!/usr/bin/perl -w
 use strict;
 use CGI qw(:standard);
 
 print header,start_html("popup"),h1("popup_menu");
 if (param() {
     my $pages = param("name");
     print "OK the name of your game is $pages";
 }
 else {
     print hr();
     print start_form();
     p("name the game, textfield('name'));

This doesn't output anything.
 
     print p("Here are the games made all ready: " popup_memu("pop",
                                                 {'mint',"cherry",'mocha']));

There's a typo here; that ] should be a }.  Also, there's a missing comma 
after the first quoted string.

         print p(submit("send"), reset('clear"));
         print end_form(), hr();
 }
 print end_html;    

: ----------------------
: I get:
: 
: # syntax error, near "print"
: File 'StarMax HD:Desktop Folder:popup.cgi'; Line 8
: # Global symbol "pages" requires explicit package name.
: File 'StarMax HD:Desktop Folder:popup.cgi'; Line 8

There don't seem to be any problems at line 8, and there don't seem to be 
any problems *before* line 8 that could cause spurious errors later on.  
However, given the typos I mentioned, I'm not confident that what you 
posted is your actual code.  Please make sure to cut and paste any code 
that you have questions about rather than retyping it; retyping can 
introduce errors that weren't in the original code, and can hide errors 
that were there.



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

Date: Tue, 19 Sep 2000 06:26:31 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Pure perl encrypt/decryption?
Message-Id: <1eh70is.1js85xnx7hi9pN%tony@svanstrom.com>

<grymoire@my-deja.com> wrote:

> Is there a pure perl encryption/decryption routine someplace?

Here's RSA; you might end up learning a lot by trying to figure out how to use
it. ;)

#!/usr/local/bin/perl -s
do 'bigint.pl';($_,$n)=@ARGV;s/^.(..)*$/0$&/;($k=unpack('B*',pack('H*',$_)))=~
s/^0*//;$x=0;$z=$n=~s/./$x=&badd(&bmul($x,16),hex$&)/ge;while(read(STDIN,$_,$w
=((2*$d-1+$z)&~1)/2)){$r=1;$_=substr($_."\0"x$w,$c=0,$w);s/.|\n/$c=&badd(&bmul
($c,256),ord$&)/ge;$_=$k;s/./$r=&bmod(&bmul($r,$r),$x),$&?$r=&bmod(&bmul($r,$c
),$x):0,""/ge;($r,$t)=&bdiv($r,256),$_=pack(C,$t).$_ while$w--+1-2*$d;print}


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Tue, 19 Sep 2000 05:45:49 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Range operator with "... /^$/"
Message-Id: <8q6ui9$gla$1@nnrp1.deja.com>

In article <8q67th$n6u$1@nnrp1.deja.com>,
  ollie_spencer@my-deja.com wrote:
> Yep, I run binmode() after opening and before using the file.

Perl provides a transparent translation between an end of
line marker (\n) and (\r\n) when reading/writing text files
on a Win system.  Using binmode you are overriding all that.

If you want to insist on using a binmode()d file, you can use
2 chop() instead of 1 chomp() or a (slower) regex substitution.

    s/\r\n$//;
or
    s/\s*$//;
to rid yourself of all trailing white space.

I always wondered why the people who came up with dos years
ago wanted 2 characters to mark an end of line.  sorry for not
having been more complete in my attempt to answer your post
earlier on but that was at an hour way past my bedtime :)

cheers

Brendon
++++


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


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

Date: Tue, 19 Sep 2000 11:50:42 +0800
From: Jim Chim <mecks@ust.hk>
Subject: rounding error problem
Message-Id: <39C6E292.13A95BAF@ust.hk>

Dear friend,
    I have wrote a script for data analysis. The result is not
reasonable.
After inspection of the script, it might due to the rounding error of
the data.
My typical data attain values of 99999999, did perl are using double
precision
just like FORTRAN did or is there any function to handle this problem

Thanks
Jim



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

Date: Tue, 19 Sep 2000 13:47:03 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Substring Golf?
Message-Id: <DLBx5.25$Q62.3163@vic.nntp.telstra.net>


"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:hBew5.16$eI1.3742@vic.nntp.telstra.net...

> my $num = shift;
> $num =~ s/ file://g;
>
> my $numa = substr $num,0,4;
> my $numb = substr $num,4,4;
> my $numc = substr $num,8,4;
> my $numd = substr $num,12,4;
>
> Any ideas? One liners?
>

Thanks to all who replied.  I gleaned a few interesting and useful ideas
from all.

I will also try to be a bit more explicit about the data next time uri
:)


--
Wyzelli
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




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

Date: Tue, 19 Sep 2000 04:34:44 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Substring Golf?
Message-Id: <x7aed5dmoq.fsf@home.sysarch.com>

>>>>> "W" == Wyzelli  <wyzelli@yahoo.com> writes:


  W> I will also try to be a bit more explicit about the data next time
  W> uri :)

specifying input data formats accurately will always lead to better
munging code. always include examples and clearly describe the field
separations. cover boundary conditions as well.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 19 Sep 2000 15:47:25 +0800
From: Hugo Bouckaert <hugo@fractalgraphics.com.au>
Subject: using perl to email attachments
Message-Id: <39C71A0D.354AD87@fractalgraphics.com.au>

Hi 

I have perfected a perl script to send email, but attachments still do
not work. The scrips does send an email, and when I fill in the forms on
the html page, everything arrives in the email except the attachment.

Can anyone help me with this? What am I doing wrong so attachments are
not sent? Do I need another module apart from Email.pm? 

The script is included below. Any help whatsoever will be greatly
appreciated. 

Thanks

Hugo 

****

#!/usr/sbin/perl

#----------------------------------------------------------------------------
# User variables
#----------------------------------------------------------------------------


$emailaddress='hugo@fractalgraphics.com.au';
$thankyoupage='http://www.fractalgraphics.com.au/fracviewer/thanks.html';

use Email;
use CGI qw(:standard);
require Exporter;

#----------------------------------------------------------------------------
#
# Email response to someone
#
$name= param('Name');
$prod = param('Product');
$attach = param('mdata');

$body  = <<MESSAGE_TO_USER;

----------------------------------------------------------------------
          These details were submitted using the WWW Form
            on the Fractal Graphics FracViewer webpage
----------------------------------------------------------------------

Please send information about the requested product to the client's
email address:

Name:          $name
Product:       $prod	
Attachment:    $attach

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

MESSAGE_TO_USER

Email::send(
                  To=>'"Hugo Bouckaert" <hugo@fractalgraphics.com.au>',
                  From=>'"Info" <info@fractalgraphics.com.au>',
                  Subject=>'"File Upload Procedure"',
                  Body=>$body,
                  Attachment=>$attach
		);

#----------------------------------------------------------------------------
#
# Generate reply for user
#

# Send the thankyou page to the submitter ...

print "Location: $thankyoupage\n\n";
 

**** 
-- 
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics 
39 Fairway, Nedlands Western Australia 6009
Tel: 9284 8442
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au


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

Date: 19 Sep 2000 09:18:09 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: using perl to email attachments
Message-Id: <slrn8sebqh.anr.vek@pharmnl.ohout.pharmapartners.nl>

On Tue, 19 Sep 2000 15:47:25 +0800,
           Hugo Bouckaert <hugo@fractalgraphics.com.au> wrote:


>Hi 
>
>I have perfected a perl script to send email, but attachments still do
>not work. The scrips does send an email, and when I fill in the forms on
>the html page, everything arrives in the email except the attachment.
>
>Can anyone help me with this? What am I doing wrong so attachments are
>not sent? Do I need another module apart from Email.pm? 
>


Go to your nearest CPAN mirror site and get MIME::Lite.  Then it should
be real easy.  If you also need to handle incomming MIME messages you
might need the full blown MIME::Tools package.



Villy





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

Date: Tue, 19 Sep 2000 04:30:12 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Using range operator
Message-Id: <m3pum1xauj.fsf@linux.local>


Larry Rosler <lr@hpl.hp.com> writes:

> People with a mathematical bent might find the following more 
> comfortable, as it looks more like the mathematical range notation:
> 
>  	print "In range" if 1 <= $num && $num <= 20;

I agree. I also recall seeing a Perl6 RFC to allow the following (a la
Python):

	print "In range" if 1<= $num <= 20;

What's the status on this? It would be a cool feature, IMHO.

--Ala


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

Date: Tue, 19 Sep 2000 04:32:26 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Using range operator
Message-Id: <x7d7i1dmsl.fsf@home.sysarch.com>

>>>>> "AQ" == Ala Qumsieh <aqumsieh@hyperchip.com> writes:


  AQ> I agree. I also recall seeing a Perl6 RFC to allow the following (a la
  AQ> Python):

  AQ> 	print "In range" if 1<= $num <= 20;

  AQ> What's the status on this? It would be a cool feature, IMHO.

wait 2 years and find out. :)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 19 Sep 2000 02:12:46 -0400
From: petka1@yahoo.com
Subject: Willing to pay for this split job
Message-Id: <39C703DE.DE2DCCAC@yahoo.com>

I'm willing to pay someone to create a script for me.
E-mail me(petka1@yahoo.com) with your price for this job.
This script will get an input of an HTML source code from a single
<textarea> feild.

########################sample input data
<TABLE width=100% cellspacing=0 cellpadding=10 border=0>
<TR><TD valign=top><BR>
<TABLE width=100% cellspacing=4 cellpadding=4 border=0>
<TR><TD colspan=2 bgcolor="#99aa66" class="menu">
<A name="file">Stock Analysis v1.2</TD></TR>
<TR><TD valign=top width=58% class="serif">
<B>1: <A href="http://www.site.dot/analys_1_2tar.gz">Download Now</A> -
</B>
UNIX only  ( 20k )<BR>
<B>2: <A href="http://www.site.dot/analys_1_2.zip">Download Now</A> -
</B>
Win95/98 or NT  ( 4k )
<BR><BR><B>Made by:</B> <A href="http://www.site.dot/something">John
Doe</A>
<BR><BR><B>Released on:</B> April 4, 2000</TD>
<TD valign=top width=42%><FONT class="serif">
<B>Lisence:</B> Freeware Version
<BR><BR><B>Price:</B> $0  (U.S dollars)
<BR><BR><FONT color=#99cc99><B>Rating:</B></FONT> Not
Available</TD></TR>
<TR><TD colspan=2 class=serif>Stock anylisis is a powerful tool for blah
blah blah...
long description here.</TD></TR></TABLE>

<HR width=98% noshade size=1><BR>

<TABLE width=100% cellspacing=4 cellpadding=4 border=0>
<TR><TD colspan=2 bgcolor="#99aa66" class="menu">
<A name=file>Commerce v1.1</TD></TR>
<TR><TD valign=top width=58% class="serif">
<B>1: <A href="http://www.anothersite.dot/some.zip">Download Now</A> -
</B>
UNIX or MacOS  ( n/a )
<BR><BR><B>Made by:</B> <A href="http://www.anothersite.dot">Jane
Doe</A>
<BR><BR><B>Released on:</B> August 1, 1999</TD>
<TD valign=top width=42%><FONT class="serif">
<B>Lisence:</B> Shareware Version
<BR><BR><B>Price:</B> $15  (U.S dollars)
<BR><BR><FONT color=#99cc99><B>Rating:</B></FONT> Not
Available</TD></TR>
<TR><TD colspan=2 class="serif">Commerse v1.1 is one of the leading
super functional
and easy to learn packages.</TD></TR></TABLE>

<HR width=98% noshade size=1><BR>

</TD></TR></TABLE>
</TD></TR></table>
############################end input#########################

Now you should split the characters into useful data so that the output
could be something like this:

a[0]=="Stock Analysis v1.2";
b[0]=="UNIX, Win95/98 or NT";
c[0]=="http://www.site.dot/something";
d[0]=="John Doe";
e[0]=="April 4, 2000";
f[0]=="Freeware Version";
g[0]=="0";
h[0]=="Stock anylisis is a powerful tool for blah blah blah... long
description here.";

a[1]=="Commerce v1.1";
b[1]=="UNIX or MacOS";
c[1]=="http://www.anothersite.dot";
d[1]=="Jane Doe";
e[1]=="August 1, 1999";
f[1]=="Shareware Version";
g[1]=="15";
h[1]=="Commerse v1.1 is one of the leading super functional & easy to
learn packages.";

This sample contained only 2 products, please make sure that the script
will make a loop and handle as many products as there will be in the
HTML source code.

If you have more questions e-mail me:  petka1@yahoo.com



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

Date: Tue, 19 Sep 2000 08:01:03 GMT
From: peterhi@my-deja.com
Subject: Re: Win32::ODBC and CGI Help needed
Message-Id: <8q76fn$q1l$1@nnrp1.deja.com>

To be honest a database that requires a new column added on a regular
basis is somewhat badly designed. You should really redesign your
database making the columns rows. The reason there is no easy way to do
what you want is that you are doing something wrong.

Sorry I cant be more positive.

As an aside just do...

  %data = $db->DataHash();

and then pick up the fields like this...

  $data{'StudentName'}

or even...

  foreach(keys(%data)) {
    if(m/^Grade/) {
      print "$_ : $data{$_}\n";
    }
  }


In article <8q6brv$n04$1@dagger.ab.videon.ca>,
  "Stephane Zanoni" <quest@powersurfr.com> wrote:
> I have an access database, and about 4-6 times a week a colum is added
to my
> database of about 45 rows, is their a way to to select all the colums
in a
> row and numbering them by themselves because currently i have:
>
> $db->Sql("SELECT * FROM Travail1");
>  while ($db->FetchRow()) {
>       ($StudentName, $G00, $G01, $G02, $G03, $G04, $G05, $G06, $G07,
$G08,
> $G09) = $db->Data("StudentName", "Grade0", "Grade1", "Grade2",
"Grade3",
> "Grade4", "Grade5", "Grade6", "Grade7", "Grade8", "Grade9");
>  &HTML_Table_Body();
>  }
>
> sub HTML_Table_Body {
> print qq!
>     <tr>
>       <td width="150" bgcolor="#FFFFCC" valign="middle" align="right"
> height="19"><b>$StudentName</b></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G00</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G01</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G02</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G03</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G04</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G05</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G06</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G07</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G08</font></td>
>       <td width="25" bgcolor="#FFFFCC" valign="middle" align="center"
nowrap
> height="19"><font face="Verdana" size="2">$G09</font></td>
>     </tr>
>
> !;
> }
>
> Is their a way to have only it automaticly increment?
>
> Thanks
>
>


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


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

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


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