[16474] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3886 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 2 14:05:38 2000

Date: Wed, 2 Aug 2000 11:05:21 -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: <965239521-v9-i3886@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 2 Aug 2000     Volume: 9 Number: 3886

Today's topics:
    Re: A DOS box question <gellyfish@gellyfish.com>
    Re: A DOS box question <bart.lateur@skynet.be>
    Re: A DOS box question <bardicstorm@my-deja.com>
        can sprintf chop data? <david.t.liu@intel.com>
    Re: can sprintf chop data? <fauzbear@cyberramp.net>
    Re: can sprintf chop data? (Marcel Grunauer)
        connecting to oracle <g.euzet@gti-info.com>
    Re: Copying from the web: Problems with a script <rsk@lafvb.com>
    Re: Copying from the web: Problems with a script nobull@mail.com
    Re: day_of_week() and age() without using Date::Calc ? <lr@hpl.hp.com>
    Re: day_of_week() and age() without using Date::Calc ? <lr@hpl.hp.com>
    Re: day_of_week() and age() without using Date::Calc ? <lr@hpl.hp.com>
    Re: downloading a file from a remote machine <kensplace@comport.com>
    Re: formating output <bardicstorm@my-deja.com>
        Getopts - need to pass info to array. tizatron@my-deja.com
    Re: How to Post a message to a newsgroup using Perl ? (Rui Anastácio)
        HTTP::Request::Common Help <rudie@wpi.edu>
    Re: I have an idea but will it work ? <mjcarman@home.com>
    Re: I have an idea but will it work ? (Jon S.)
        make some variable johanlenglet@my-deja.com
    Re: make some variable (Andrew J. Perrin)
    Re: make some variable <jeff@yoak.com>
        Need to read a html page and save it via perl Unable to <kensplace@comport.com>
    Re: Newbie: Looking for sample http code <tfm@sei.cmu.edu>
    Re: non-blocking read from fifo <billy@arnis-bsl.com>
    Re: non-blocking read from fifo nobull@mail.com
    Re: password protected web pages <diane@dmswebsupport.com>
    Re: perl glob problem (Decklin Foster)
    Re: perl glob problem nobull@mail.com
    Re: Perl in Windows 2000 <tschilbach@aodinc.com>
    Re: Perl jobs? <reply@to.group.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 02 Aug 2000 15:12:45 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: A DOS box question
Message-Id: <NTWh5.891$82.48112@news.dircon.co.uk>

On Wed, 02 Aug 2000 15:00:48 +0200, Martin Mouritzen Wrote:
> On Wed, 02 Aug 2000 12:14:15 GMT, Jonathan Stowe
> <gellyfish@gellyfish.com> sneezed and this is what came out:
> 
>>It wont run in DOS mode if you are using ActivePerl.
> 
> Uhm, why not ? 
> I'm using ActivePerl as it is now.
> 
> 'perl script.cgi' works phine here?

After restarting in MS-DOS mode.

'Cannot run this program in DOS mode'

ActivePerl requires certain windows services.

/J\


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

Date: Wed, 02 Aug 2000 15:53:02 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A DOS box question
Message-Id: <cuggosk7n1n20bg3shg8c0klam9rtrv8c5@4ax.com>

Jason Maggard wrote:

>Two methods:
>
>1: put a sleep at the end of your script "sleep 60 ; return 0"

For example,

	END {
	    sleep 60 if -t STDERR;
	}

-- 
	Bart.


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

Date: Wed, 02 Aug 2000 17:13:57 GMT
From: BardicStorm <bardicstorm@my-deja.com>
Subject: Re: A DOS box question
Message-Id: <8m9ksf$32c$1@nnrp1.deja.com>



> After restarting in MS-DOS mode.
>
> 'Cannot run this program in DOS mode'
>
> ActivePerl requires certain windows services.
>
> /J\

Start Windows as normal..  run command.com to open dos while windows is
running, then use c:\perl <program>

(remember to make sure you're loading the paths in your autoexec..)

-- The man who worries about what will next be
happening to him loses this moment in dread
of the next, and poisons the next in pre-judgement. --


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


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

Date: Wed, 2 Aug 2000 09:27:47 -0700
From: "David T. Liu" <david.t.liu@intel.com>
Subject: can sprintf chop data?
Message-Id: <8m9i64$qtd@news.or.intel.com>

Hey...

suppose I have the following:

$string = "abcdefgh"
$y = sprintf "%5s", $string;

Is there a way to get sprintf to cut off the data so that I only get the
first five characters of the string?




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

Date: Wed, 2 Aug 2000 11:46:06 -0500
From: "fauzbear" <fauzbear@cyberramp.net>
Subject: Re: can sprintf chop data?
Message-Id: <09FF8C08F7339056.1E58E9C7A79B9910.01CE3B32823901EC@lp.airnews.net>

try $string="abcdefgh";
$y=sprintf("%5.5s",$string);
David T. Liu <david.t.liu@intel.com> wrote in message
news:8m9i64$qtd@news.or.intel.com...
> Hey...
>
> suppose I have the following:
>
> $string = "abcdefgh"
> $y = sprintf "%5s", $string;
>
> Is there a way to get sprintf to cut off the data so that I only get the
> first five characters of the string?
>
>




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

Date: Wed, 02 Aug 2000 16:42:59 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: can sprintf chop data?
Message-Id: <slrn8ogk6u.23c.marcel@gandalf.local>

On Wed, 2 Aug 2000 09:27:47 -0700, David T. Liu <david.t.liu@intel.com> wrote:

>suppose I have the following:
>
>$string = "abcdefgh"
>$y = sprintf "%5s", $string;
>
>Is there a way to get sprintf to cut off the data so that I only get the
>first five characters of the string?


    $y = sprintf "%.5s", $string;


-- 
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


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

Date: Wed, 2 Aug 2000 17:29:11 +0200
From: "Gabriel Euzet" <g.euzet@gti-info.com>
Subject: connecting to oracle
Message-Id: <8m9f21$c3j$1@reader1.fr.uu.net>

Hi,

This question may have been answered but I haven't it ...

We've 2 PC's
* Redhat + Perl 5
* Redhat + Oracle 8

And ... I don't know what I need to connect from the
first to the second with Perl ???

I don't know :
* if I must compile Perl again,
* if a module exists
* what are the perl functiojns to use

Could you answer these questions please.

Thanks
Gabe




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

Date: Wed, 02 Aug 2000 11:47:19 -0500
From: Ryan Kinder <rsk@lafvb.com>
Subject: Re: Copying from the web: Problems with a script
Message-Id: <39885097.8482A9A6@lafvb.com>



Jason Maggard wrote:

> Howdy everybody,
>
>     I've written this script to get all the links from a web page and it
> works fine on my Linux box.  A friend asked me for a copy for his
> windoze machine, but the files get corrupted in the download process.
> Is there a workaround to this??  This is a real basic script, and I'm
> not really up on the finer details of perl, so any help would be
> appreciated.  I guess now I know what Larry said, "There's more than one
> way to do it, and that's good, because under Windows most of them don't
> work."

Someone can correct me if I'm wrong but in a network transfer characters are
added at the end
of every line (a CRLF character).  The easy way is to go ahead and zip the
file, that way it's a binary, and transfer it to
the box (the later versions of winzip will handle a tar.gz or just a .gz
file).

As an alternative, you can download a copy of Ultraedit32 for Windows and use
it to convert from a
UNIX type format to a Windows based one (Windows uses CRLF at the end of
everyline, and UNIX
based systems use a newline...I think).

Ryan Kinder

-------------------------------------------------------------------------
It might look like I'm doing nothing, but at the cellular level I'm quite busy





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

Date: 02 Aug 2000 17:39:13 +0100
From: nobull@mail.com
Subject: Re: Copying from the web: Problems with a script
Message-Id: <u9ittj8vny.fsf@wcl-l.bham.ac.uk>

Jason Maggard <jmaggard@va.mediaone.net> writes:

> Subject: Copying from the web: Problems with a script

"Problems with a script" tells us nothing.

> A friend asked me for a copy for his windoze machine, but the files
> get corrupted in the download process.

"Copying from the web" is missleading.  The script works on Unix so
"Copying from the web" is probably not the problem.

A better subject would be "Downloads get corrupted on Windoze but not Unix".

If you'd put that as the subject then 95% of the population here would
have been able to identify your problem simply by looking at the
subject line.

Files corrupted on Windoze?  Think: "binmode".

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


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

Date: Wed, 2 Aug 2000 10:37:42 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <MPG.13f1fc42444df1d498ac25@nntp.hpl.hp.com>

In article <3987e880$1@news.datev.de> on Wed, 2 Aug 2000 11:24:56 +0200, 
Guenther Degenfelder <guenther.degenfelder@datev.de> says...

 ...

> Try this, if you like to count the lines of code:
> 
> @TageBisErsten=(
>  0,
>  31,
>  31+28,
>  31+28+31,
>  31+28+31+30,
>  31+28+31+30+31,
>  31+28+31+30+31+30,
>  31+28+31+30+31+30+31,
>  31+28+31+30+31+30+31+31,
>  31+28+31+30+31+30+31+31+30,
>  31+28+31+30+31+30+31+31+30+31,
>  31+28+31+30+31+30+31+31+30+31+30,
>  31+28+31+30+31+30+31+31+30+31+30+31
> );
> 
> sub Schaltjahr
> {
>  local($jahr)=@_[0];

1.  The proper declaration is 'my', not 'local'.  See perlfaq7 for the 
reason.

2.  The use of the '-w' flag would have warned you about assigning an 
array slice to a scalar.  The way to name a scalae is with a '$' prefix:  
$_[0].

>         return($jahr%4==0 && $jahr%100!=0 || $jahr%400==0);
> }
> 
> sub TageImJahr
> {
>  local($tag,$monat,$jahr)=@_;

See #1 above.

>  return(
>   @TageBisErsten[$monat-1]

See #2 above.

>   +$tag
>   +((&Schaltjahr($jahr) && $monat>2) ? (1):(0))

3.  Using '&' to invoke a subroutine is unnecessary and anti-stylistic 
in Perl 5.

>  );
> }
> 
> sub TageSeitEins
> {
>  local($tag,$monat,$jahr)=@_;

See #1 above.

>  return(
>   &TageImJahr($tag,$monat,$jahr)

See #3 above.

>   +($jahr-1)*365
>   +int(($jahr-1)/4)
>   -int(($jahr-1)/100)
>   +int(($jahr-1)/400)
>  );
> }
> 
> sub Wochentag
> {
>  local($tag,$monat,$jahr)=@_;

See #1 above.

>  return(
>   TageSeitEins($tag,$monat,$jahr) % 7
>  );
> }
> 
> The function TageSeitEins($day,$month,$year) will tell you the number of
> days since 1.1.1.
> The function Wochentag($day,$month,$year) will tell you the weekday as a
> number (0=Sunday, 1=Monday , ...)

So would localtime(), given the correct epoch time as computed by 
timelocal().  So all this functionality is provided by standard 
functions and modules.  See Bart Lateur's post in this thread.

> Be shure to use four digits for the year (for today the right value is
> 730333)!!!

Huh?  Are we now in the 731st Century?

> Hope this helps!

Not really.

> PS:
> Sorry about the german code...    :-]

Macht's nicht.

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


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

Date: Wed, 2 Aug 2000 10:42:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <MPG.13f1fd77e21340c198ac26@nntp.hpl.hp.com>

In article <398c0877.35976047@news.newsguy.com> on Wed, 02 Aug 2000 
11:41:59 GMT, Keith Calvert Ivey <kcivey@cpcug.org> says...
> Bart Lateur <bart.lateur@skynet.be> wrote:
> 
> >	$time = timegm(0, 0, 0, 2, 8-1, 2000);
> 
> That works, but it's not documented, as far as I know.
> I'd prefer to show it as 
> 
> 	$time = timegm(0, 0, 0, 2, 8-1, 2000-1900);
> 
> to remind people of how gmtime works.

It is, unfortunately, documented, in what I consider to be a total botch 
of the Y2K adjustment.  It panders to popular expectations, not to 
logical coherence.

perldoc Time::Local

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


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

Date: Wed, 2 Aug 2000 10:44:23 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <MPG.13f1fdcfcb029cb398ac27@nntp.hpl.hp.com>

In article <398827f4$1@news.datev.de> on Wed, 2 Aug 2000 15:55:41 +0200, 
Guenther Degenfelder <guenther.degenfelder@datev.de> says...
> 
> "Keith Calvert Ivey" <kcivey@cpcug.org> schrieb im Newsbeitrag
> news:398c0877.35976047@news.newsguy.com...
> > Bart Lateur <bart.lateur@skynet.be> wrote:
> >
> > > $time = timegm(0, 0, 0, 2, 8-1, 2000);
> >
> > That works, but it's not documented, as far as I know.
> > I'd prefer to show it as
> >
> > $time = timegm(0, 0, 0, 2, 8-1, 2000-1900);
> >
> > to remind people of how gmtime works.

 ...

> But I don't need timegm() or gmtime()!
> ;-)

They are part of the standard distribution for recent versions of Perl.

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


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

Date: Wed, 2 Aug 2000 18:20:30 +0100
From: "ken" <kensplace@comport.com>
Subject: Re: downloading a file from a remote machine
Message-Id: <8m9l62$f2q$1@news8.svr.pol.co.uk>

Im on virtual ave they dont have LWP installed (shame, i got the script
working locally using it)
I need to do the same thing but without using any of LWP module,

does any one have any suggestions (other than looking for another provider!)

thanks for any help


whitetigercat wrote in message ...
>Hi.
>I want to receive a html document from another machine (like my browser
does)
>and save this file in my own cgi directory for parsing. This apparently
isn't as simple
>as opening the file, reading its lines into an array, and saving them to a
file.
>Any help appreciated,
>Shane
>
>




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

Date: Wed, 02 Aug 2000 17:09:03 GMT
From: BardicStorm <bardicstorm@my-deja.com>
Subject: Re: formating output
Message-Id: <8m9kj9$2q6$1@nnrp1.deja.com>


> þ======================
> ^^
>
> Where does this come from ?????

Not real sure if it's the same problem, but when I used this code to
pack something:
@a = qw(123123 456456 789789);
$c = pack(p3, @a);
$d = pack(p25, $c);
$e = unpack(p25, $d);
@f = unpack(p3,$e);
print "@f\n"

the resulting print =
þ123123 456456 789789
(only I think it might have been a different character.  No idea where
it came from.. if you find out let me know..  :)

P.S. - please exuse the simplicity and perhaps extreme wrongness of the
code, I'm new to perl and was just playing with pack and unpack  =)



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


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

Date: Wed, 02 Aug 2000 17:26:44 GMT
From: tizatron@my-deja.com
Subject: Getopts - need to pass info to array.
Message-Id: <8m9lkb$3l6$1@nnrp1.deja.com>

Hello,

Kinda new to perl - but after looking over the perldoc I have found no
leads to my getopts problem.

I have a small perl program that looks at an array of filesystems, does
a find on each one and returns information via an email message.  It
basically looks for RCS changes for the day and is quite handy.

Something like

foreach $fsystem (@FileSystems) {

     find $fsystem ......;
}

So I wanted to add some getopts functionality to be able to pass in the
filesystems that I want to work on so I don't have to edit the file and
I could call this script from other programs.

#  I start off with this

require 'getopts.pl';
use diagnostics;
&Getopts('hrmf:v:');
#  h for help, r for revision parameter passed to rlog
# m for the mail recipient and f for file system
# v for verbose
use vars qw(
	$opt_h
	$opt_r
	$opt_m
	$opt_f
	$opt_v
);

#  I setup a subrouting to process the varibles and fix up the switches
#  And here is where things fall apart.

sub setSwitches {

   #
   # this seems like a bad way to do this, diagnostics gacks
   # and values never seem to get into the array.  How do I pass
   # multiple filsystems into the array?????
   #
   @FileSystems = $opt_f if defined ($opt_f);

   #
   # Specifiy the Mail recipients for the mailing
   # This does not seem right as well, could I use undefine?
   # Since I do not use the option for testing it hasn't been and
   # issue.
   if ($opt_m)
   {
     	#specific the mail recipients
       	$recipients = $opt_m;
   }
   else {
       	$recipients = "me\@host.com";
   }
   #
   # This is like FileSytem, I would like to pass in muliple
   # RCS label requests to a full report
   # However, no matter what I specify on the command line for -r
   # the value is always 1???
   @RevisionList = $opt_r if defined ($opt_r);

}


Summary -

Q1 - How do you use getopts to pass values into an array??

Q2 - Why does my getopts string values default to 1 even when I have
     values specified in the switches.

Many Thanks,
-Dean


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


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

Date: Wed, 02 Aug 2000 14:44:59 GMT
From: ranastacio@mail.telepac.pt (Rui Anastácio)
Subject: Re: How to Post a message to a newsgroup using Perl ?
Message-Id: <3988334d.682166005@news.telepac.pt>


 OK ! 
 
 I have seen a previous post in this newsgroup. Don't need to answer. 
 
 Rui



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

Date: Wed, 2 Aug 2000 13:25:48 -0400
From: Brian Murphy <rudie@wpi.edu>
Subject: HTTP::Request::Common Help
Message-Id: <Pine.OSF.4.21.0008021319270.18010-100000@grover.WPI.EDU>

Hello,

I'm trying to create a very simple client that will post to a webboard,
but I want to do it locally.  Here is what I have so far, but there is a
problem with it (minus the "anonymoused" ip address).

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#!/usr/local/bin/perl
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use CGI qw(:standard);
use strict;

my($ua, $req, $content, $weblocal);
my $weblocal = "http://xxx.xxx.xxx.xxx/scripts/board.cgi";

$ua = LWP::UserAgent->new();
$req = HTTP::Request->new(POST "$weblocal",
        [ user    => 'standpipe',
          name    => 'Brian',
          email   => '',
          subject => 'Boring',
          message => 'Yawn. Start saying funny things now.' ]);


$content = $ua->request($req)->as_string;

print "Content-type: text/html\n\n";
print $content;
exit(0);

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


It prints out the following:

Content-type: text/html

400 (Bad Request) URL missing


This made no sense to me.  So I then tried to use only a GET statement,
and it printed out the normal html for the situation (you need to enter a
name, blah, blah).  Can anyone tell me what I'm doing wrong here?  Thanks.
 (Please don't say, "Go check CPAN for the module man file", I already
have done that, and had no luck getting what I wanted to work.) 

Brian



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

Date: Wed, 02 Aug 2000 09:39:39 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: I have an idea but will it work ?
Message-Id: <398832AB.6AC36DF0@home.com>

Phil Latio wrote:
> 
> What is confusing me is this part below.
> 
> > # This data would come from your form
> > my $number = 1000;
> > my $weight = '80gsm';
> > my $sides  = 's/sided';
> > my $color  = 'white';

That's because my example was a quick, command-line one, not CGI. The
above are the pieces of data that need to come from the HTML form when
someone clicks the "Submit" button. I just hardcoded values for
illustration. You should be using the CGI.pm module to get these values,
as well as for generating the output. (That raw printf() won't cut it
for CGI.) I'm afraid I can't help you more with this -- I don't do CGI
programming. You'll need to consult the documentation for CGI.pm. If you
have command line access to a computer with Perl on it, use perldoc.
Type

    perldoc CGI

at the prompt. Otherwise, go to www.perl.com and search for "CGI.pm"

-mjc


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

Date: Wed, 02 Aug 2000 17:48:31 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Re: I have an idea but will it work ?
Message-Id: <3988518f.13667716@news.earthlink.net>

On Tue, 1 Aug 2000 23:31:16 +0100, "Phil Latio"
<globalcon2@myhouse.com> wrote:

>I have a number
>of ideas for websites but have very little programming experience so I am
>considering learning Perl. Do you have any suggestions to online documention
>for beginners ?

Try also comp.infosystems.www.authoring.cgi for a newsgroup that deals
specifically with CGI.

Some of the texts that have helped me (also a newbie) are Learning
Perl and Programming the Perl DBI.  There's also a book dedicated to
CGI programmming.  Check out www.oreilly.com for these titles.

Using these and web resources in my spare time (2 to 3 hours a week)
has gotten me to my first buggy script in a month or so.

Stein's CGI.pm book is also supposed to be really good (since he wrote
CGI.pm, a module for easy HTML coding in Perl).  

For web resources, check out www.perl.com and read through some of the
documents there.  www.mysql.com has a great tutorial, and the sample
chapter for the MySQL and mSQL book at o'reilly is on using CGI.pm
with the MySQL DBI.  Also, I've copied the list of references from
Nick's FAQ posted to the cgi group now and then.

Best of luck,

Jon

Subject: SECTION 5 -   FURTHER READING


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

Subject: 5.1 Other FAQs/collections


****	Lincoln Stein's FAQ is probably the most	****
****	important WWW document you will ever read.	****

Web Authoring FAQs
http://www.htmlhelp.org/faq/wdgfaq.htm

For general WWW issues, the World Wide Web FAQ by Thomas Boutell
http://www.boutell.com/faq/

Perl/CGI programming FAQ, by Shishir Gundavaram and Tom Christiansen
http://www.perl.com/perl/faq/perl-cgi-faq.html

The Idiot's Guide to solving Perl/CGI problems by Tom Christiansen
http://www.perl.com/perl/faq/idiots-guide.html

The WWW Security FAQ by Lincoln Stein
http://www.w3.org/Security/Faq/www-security-faq.html

CGI Resources Library
http://www.cgi-resources.com/

The WWW Virtual Library
http://WWW.Stars.com/Vlib/


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

Subject: 5.2 Reference Pages


CGI Internet Draft - the official spec
http://www.golux.com/coar/cgi/

The Common Gateway Interface (CGI)	- old de facto spec
http://hoohoo.ncsa.uiuc.edu/cgi/interface.html

HyperText Transfer Protocol (HTTP)
http://www.w3.org/pub/WWW/Protocols/HTTP/

HyperText Markup Language (HTML)
http://www.w3.org/pub/WWW/MarkUp/



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

Date: Wed, 02 Aug 2000 16:26:14 GMT
From: johanlenglet@my-deja.com
Subject: make some variable
Message-Id: <8m9i2u$ju$1@nnrp1.deja.com>

I want to create some variables from 1 à 50 like : $number_1,
$number_2, ..., $number_50

I tryed that but I don't work !

for( $i=1 ; $i=50 ; $i++)
{
  $tmp = "number_".'$i' ;
  $number_.'$i' = $field{$tmp} ;
}


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


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

Date: 02 Aug 2000 13:08:50 -0500
From: aperrin@demog.berkeley.edu (Andrew J. Perrin)
Subject: Re: make some variable
Message-Id: <87zomva631.fsf@achebe.perrins>

johanlenglet@my-deja.com writes:

> I want to create some variables from 1 =E0 50 like : $number_1,
> $number_2, ..., $number_50

Why? It's called an array:
for ($i =3D 1 ; $i =3D 50 ; $i++) {
   $numbers[$i] =3D $field{"number_$i"};
}

or, even more simply:

map { $numbers[$_] =3D $field{"number_$_"} } 1..50;

> 
> I tryed that but I don't work !
> 
> for( $i=3D1 ; $i=3D50 ; $i++)
> {
>   $tmp =3D "number_".'$i' ;
>   $number_.'$i' =3D $field{$tmp} ;
> }

Using symbolic references (which you unsuccessfully attempt here) is
generally considered a Very Bad Idea.  Don't do it.  However, for the
sake of completeness, you can accomplish what you think you want as
follows:

for ($i=3D1;$i<=3D50;$i++) {
  ${"number_$i"} =3D $field{"number_$i"};
}

Random notes:
- The for loop you set up will run forever, since $i=3D50 always returns
  true.  Also, for the same reason, $i will always be 50.  Use =3D=3D to
  test equality, and in this case use <=3D since it's when the second
  argument is false that the loop breaks.

- It looks like you've already got your data in nice useable form in
  the %field hash.  Why change?

Andy Perrin


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

Date: Wed, 02 Aug 2000 12:12:49 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: make some variable
Message-Id: <8m9ksd03od@news1.newsguy.com>

In article <8m9i2u$ju$1@nnrp1.deja.com>, johanlenglet@my-deja.com wrote:
> I want to create some variables from 1 à 50 like : $number_1,
> $number_2, ..., $number_50
> 
> I tryed that but I don't work !
> 
> for( $i=1 ; $i=50 ; $i++)
> {
>   $tmp = "number_".'$i' ;
>   $number_.'$i' = $field{$tmp} ;
> }

This is a very unusual thing to want.  Please consider whether there might
be a better way to do it.  But just for fun:

no strict 'refs';
foreach my $num (1..50){
        *{'number_'.$num}=\$num;
}

would set $number_1 to 1, etc.




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

Date: Wed, 2 Aug 2000 18:45:49 +0100
From: "ken" <kensplace@comport.com>
Subject: Need to read a html page and save it via perl Unable to Use LWP
Message-Id: <8m9mlh$ga8$1@news8.svr.pol.co.uk>

any suggestions on how to read a url, and save the page to a file
can be accomplished without the use of the lwp module (virtualave have not
installed that)
?

Thanks for any help




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

Date: Wed, 02 Aug 2000 11:23:54 -0400
From: Ted Marz <tfm@sei.cmu.edu>
Subject: Re: Newbie: Looking for sample http code
Message-Id: <39883D0A.D3CE1DDF@sei.cmu.edu>

Check the perl documentation that comes with LWP..

for example
perldoc lwpcook
perldoc LWP

Ted Marz

Joe DiAdamo wrote:
> 
> Can someone point me to (or send me) sample code to send an http request and
> receive the response?
> 
> Thanks ... joe
> 
> jdiadamo@cisco.com


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

Date: Wed, 02 Aug 2000 10:19:15 -0500
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: non-blocking read from fifo
Message-Id: <39883BF3.AE9DC4C7@arnis-bsl.com>

Kenny Saltiel 5744 wrote:
> 
> Hi.
> 
> I'm trying to obtain the output of three external programs which I
> start-up from within a perl script
> using the Proc::simple module. The external programs write to 3
> named-pipes which I open filehandles for.
> The problem is that since the read from a filehandle blocks while
> waiting for input, I can not read the other fifo's until something comes
> in on the fifo I am waitng on.
> 
> Is there anyway I can check the fifo before reading from it? Should I
> have the external programs send data in a
> different way. I'm using the Proc::Simple module since I need to run the
> external programs in the background
> while monitoring if they are alive, in addition to other things the perl
> script needs to do.
> 

IMHO, you do not need non-blocking read().
I/O multiplexing as per your problem is usually
solved using select system call, which is available
from Perl via 4-argument select() function.

Check 'perldoc -f select' and look in perlipc, perlfaq5, perlfaq8.
See also 'man select' for your system.

Hope this helps.
Ilja.


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

Date: 02 Aug 2000 17:39:32 +0100
From: nobull@mail.com
Subject: Re: non-blocking read from fifo
Message-Id: <u9hf938vnf.fsf@wcl-l.bham.ac.uk>

Kenny Saltiel 5744 <kenny_saltiel@icomverse.com> writes:

> Is there anyway I can check the fifo before reading from it?

perldoc -f select
perldoc IO::Select

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


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

Date: Wed, 2 Aug 2000 12:43:31 -0400
From: "Diane" <diane@dmswebsupport.com>
Subject: Re: password protected web pages
Message-Id: <sogjls50dbm99@corp.supernews.com>


Jonathan Stowe wrote in message <8m7nbk$4u9$1@orpheus.gellyfish.com>...
>On Mon, 31 Jul 2000 15:50:14 -0400 Diane wrote:
>>                                                        I've used the
>> authenticate program from  Matt Wright & Craig Patchett's "CGI/Perl
>> Cookbook"
>>
>
>Well don't do that.
>
Why not? Any better suggestions would be greatly appreciated.

Diane




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

Date: Wed, 02 Aug 2000 16:42:17 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: perl glob problem
Message-Id: <JbYh5.9695$f_5.50213@news1.rdc1.ct.home.com>

alan <alan@taz1.com> writes:

> The following script works fine but it only globs files in the root
> directory. It still writes the .dat file in the specified directory.

perldoc -f chdir

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: 02 Aug 2000 17:43:35 +0100
From: nobull@mail.com
Subject: Re: perl glob problem
Message-Id: <u9em478vgo.fsf@wcl-l.bham.ac.uk>

"alan" <alan@taz1.com> writes:

> What I need is to force the glob to work on the directory I specify using
> $dirnow

chdir($dirnow) || die "Could not change directory to $dirnow: $!";

> Anybody know what I am doing wrong ?

Confusing opendir() and chdir().  Or maybe confusing glob() and
readdir().
 
perldoc -f opendir
perldoc -f chdir
perldoc -f glob
perldoc -f readdir.

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


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

Date: Wed, 2 Aug 2000 10:49:20 -0500
From: "Timothy H. Schilbach" <tschilbach@aodinc.com>
Subject: Re: Perl in Windows 2000
Message-Id: <8m9g1c$990$1@news.chatlink.com>

Brian,

If you instal activestate's activeperl, you will have no problems. You can
continue to write programs in windows just like unix. Microsoft even makes a
sendmail unix port for windows to make things even easier. You can obtain
the activeperl free from http://www.activestate.com I suggest you learn win
API and use win32 modules for script/machine integration. The power of NT
and the stability of PERL is a great compliment to eachother.

--
Timothy H. Schilbach
Alpha Omega Design Inc.
tschilbach@aodinc.com
1-877-263-7094
Visit our website at www.aodinc.com

Web server hosting and dialup access for the future.


Brian <bmacdonaldNObmSPAM@netstone.com.invalid> wrote in message
news:075a8b6f.6fa6bde3@usw-ex0103-086.remarq.com...
> Hello, I have used Perl with unix. But in my current job they
> run all windows. And i am not sure how to run Perl scripts. Do i
> have to change my coding at all for windows. And What about a
> perl intrperter? Cheers... Brian
>
>
> -----------------------------------------------------------
>
> Got questions?  Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
>




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

Date: Wed, 2 Aug 2000 13:34:35 -0400
From: "blah" <reply@to.group.org>
Subject: Re: Perl jobs?
Message-Id: <8m9mil$ikd$1@rupert.unet.maine.edu>

for a good programmer it shouldn't be too hard to move from one language to
another.  The logic is the same, its just different syntax.  As one of my
professors once said "As computer science students you should be able to
pick up a book and learn a new lanugage in a day."  He didn't mean become an
expert in a day, but learn enough to write a few working programs withing
that ammount of time.

Learn both.  I had done mainly C++ programming until I took a job as web
administrator for the Department of Computer Science at the University of
Maine. www.cs.umaine.edu  then I found myself learning perl so I could
create an online searchable database of publications with a backend of MySQL
on a Unix Ultra1 server and front end via the web.  Now I'm doing an Alumni
database
so I had done about 3 hours of perl before I took the job and now I've spent
weeks working on projects


Ben Addis <ben@baddis.plus.com> wrote in message
news:pmAg5.409$N5.30493@stones...
> There are jobs for most programming languages. It just depends on what you
> want to do.
>
> If your that worried, why not just learn both?
>
> Ben
> "peter" <peterp100@hotmail.com> wrote in message
> news:kre4os899d2g278fl1i22bfeoj59ipmg0h@4ax.com...
> > I'm teaching myself perl and I'm taking a Java class this fall. But,
> > I'm thinking about dropping the Java class and concentrating on Perl.
> > Are there any jobs out there for perl programmers?  When I look in the
> > paper everything says "Java and C ++" ???
>
>




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

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


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