[19827] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2022 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 27 11:05:33 2001

Date: Sat, 27 Oct 2001 08:05:11 -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: <1004195111-v10-i2022@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 27 Oct 2001     Volume: 10 Number: 2022

Today's topics:
    Re: $ENV not defined <bernie@fantasyfarm.com>
    Re: [OT] Re: $ENV not defined <joe+usenet@sunstarsys.com>
    Re: Automated html index ? <gellyfish@gellyfish.com>
    Re: Can perl fill-in a web form without submitting it? <gellyfish@gellyfish.com>
        Emacs modules for Perl programming (Jari Aalto+mail.perl)
        How to delete the last link <adustipujo1@mediaone.net>
    Re: How to delete the last link <Laocoon@eudoramail.com>
    Re: How to delete the last link <usenet@diefenba.ch>
    Re: How to delete the last link <Laocoon@eudoramail.com>
    Re: HOW to generate graph on MS-Excel using PERL <djberg96@hotmail.com>
    Re: Local/CGI help please <gellyfish@gellyfish.com>
    Re: Need help with modules (Tad McClellan)
        need help <mto@kabelfoon.nl>
    Re: need help <tony_curtis32@yahoo.com>
    Re: need help (Tad McClellan)
    Re: Newbie. <jurgenex@hotmail.com>
    Re: Newbie. <stuart@otenet.gr>
    Re: Newbie. (Eric Bohlman)
    Re: Perl expression to delete delimited bits of text in (wb0gaz)
        perl loozer <dp@co.ru>
    Re: perl loozer (Tad McClellan)
    Re: Perl Newbie question : How can I open an internet c <gellyfish@gellyfish.com>
    Re: Ping Script Help Needed <gellyfish@gellyfish.com>
    Re: regular expression for url <gellyfish@gellyfish.com>
        uppercase with <mto@kabelfoon.nl>
    Re: uppercase with <usenet@diefenba.ch>
    Re: variable replacement (Tad McClellan)
    Re: Web image tables <not@home.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 27 Oct 2001 10:43:23 -0400
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: Re: $ENV not defined
Message-Id: <3uhlttgu9s54a5l2chv943ha4j7f37bath@4ax.com>

On Fri, 26 Oct 2001 14:03:28 +0200, Lars Snith
<lars.snith@inpactmicro.com> wrote:

>OK, OK!
>
>Thanks for the help on the matter, off-topic or not.
>The records are truly not in the %ENV hash.

The thing to do to get a handle on this is to try whipping up a simple
web page that does nothing more than displays keys(%ENV).  Maybe it
has a different name with this web server, maybe it isn't there at
all..  a peek at the key/value pairs you *actually* get via %ENV ought
to reveal all.

   /Bernie\

-- 
Bernie Cosell                Fantasy Farm Fibers
bernie@fantasyfarm.com       Pearisburg, VA


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

Date: 27 Oct 2001 07:06:48 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: [OT] Re: $ENV not defined
Message-Id: <m3wv1hnxyv.fsf@mumonkan.sunstarsys.com>

"D L Fleetwood" <dlorraine@bbc.net> writes:

> C) Pathetic: both the state of the customs of clp.misc, and your
> pretentiousness (sublime ignorance: HAHAHAHAHA)
> D) I fear no kill-file

So be it.

-- 
Joe Schaefer    "Some cause happiness wherever they go; others, whenever they
                                             go."
                                               -- Oscar Wilde



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

Date: 27 Oct 2001 13:30:42 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Automated html index ?
Message-Id: <9recu2$cub$4@neptunium.btinternet.com>

Bart Lateur <bart.lateur@skynet.be> wrote:
> 
> Also, have you seen Jonathan Stowe's sample code?
> <http://www.gellyfish.com/htexamples/>
> 

I must update that sometime but I have a profound lack of tuits at the
moment.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 27 Oct 2001 13:38:01 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Can perl fill-in a web form without submitting it?
Message-Id: <9redbp$cub$5@neptunium.btinternet.com>

Qunfeng Dong <qfdong@iastate.edu> wrote:
> Hi there, 
> 
> How can perl be used to automatically fill in a web form??
> 
> Say there is a web site with form for users to input, can a perl script 
> be used to fill in that form (without submitting it?) Thanks!
> 

If you mean can a Perl program supply the parameters to a CGI program
using HTTP then yes - in the first instance you should look at the
module LWP::UserAgent which is available from CPAN.  This module has a
document called lwpcook that has examples of doing exactly this.

/J\   
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 27 Oct 2001 10:46:26 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1004179515@rtfm.mit.edu>

Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/
Maintainer: Jari Aalto <jari.aalto@poboxes.com>

Announcement: "What Emacs lisp modules can help with programming Perl"

    Preface

        Emacs is your friend if you have to do anything comcerning software
        development: It offers plug-in modules, written in Emacs lisp
        (elisp) language, that makes all your programmings wishes come
        true. Please introduce yourself to Emacs and your programming era
        will get a new light.

    Where to find Emacs/XEmacs

        o   Unix:
            http://www.gnu.org/software/emacs/emacs.html
            http://www.xemacs.org/

        o   Windows
            http://www.gnu.org/software/emacs/windows/ntemacs.html
	    ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe

	o   More Emacs resources at 
	    http://tiny-tools.sourceforge.net/emacs-elisp.html


Emacs Perl Modules

    Cperl -- Perl programming mode

        .ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
        .<olson@mcs.anl.gov>           Bob Olson (started 1991)
        .<ilya@math.ohio-state.edu>    Ilya Zakharevich

        Major mode for editing perl files. Forget the default
        `perl-mode' that comes with Emacs, this is much better. Comes
        standard in newest Emacs.

    TinyPerl -- Perl related utilities

	.http://tiny-tools.sourceforge.net/

        If you ever wonder how to deal with Perl POD pages or how to find
        documentation from all perl manpages, this package is for you.
        Couple of keystrokes and all the documentaion is in your hands.

        o   Instant function help: See documentation of `shift', `pop'...
        o   Show Perl manual pages in *pod* buffer
        o   Load source code into Emacs, like Devel::DProf.pm
        o   Grep through all Perl manpages (.pod)
        o   Follow POD manpage references to next pod page with TinyUrl
        o   Coloured pod pages with `font-lock'
        o   Separate `tiperl-pod-view-mode' for jumping topics and pages
            forward and backward in *pod* buffer.
        o   TinyUrl is used to jump to URLs (other pod pages, man pages etc)
            mentioned in POD pages. (It's a general URL minor mode)

    TinyIgrep -- Perl Code browsing and easy grepping

        [TinyIgrep is included in the Kit]

        To grep from all installed Perl modules, define database to
        TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
        how to set up datatbases for Perl5, Perl4 whatever you have
        installed

        TinyIgrep calls Igrep.el to run the find for you, You can adjust
        recursive grep options, ignored case, add user grep options.

        You can get `igrep.el' module from <kevinr@ihs.com>. Ask for copy.
	Check also ftp://ftp.ihs.com/pub/kevinr/

    TinyCompile -- Browsing grep results in Emacs *compile* buffer

        TinyCompile is minor mode for *compile* buffer from where
        you can collapse unwanted lines, shorten the file URLs

            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT

            -->
            cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
            file1:NNN: MATCHED TEXT
            file1:NNN: MATCHED TEXT

End



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

Date: Sat, 27 Oct 2001 12:27:09 GMT
From: "Pujo C A" <adustipujo1@mediaone.net>
Subject: How to delete the last link
Message-Id: <xKxC7.38340$bK.456205@typhoon.mw.mediaone.net>


Does any body know how to do this?
I want to delete the character from the last / occurence until html
ex: http://www.yahoo.com/shopping.html
I want to delete only shopping.html( I mean any number of word after the
last /)
I tried this one:
$url =~s/\w{8}\.html//i;
but this is too rigid, I want something more flexible.

I appreciate the help so much. Thank you

Pujo C Agustiyanto
http://www.geocities.com/pujoca
<!-- The richest person in this universe is the person who appreciate what
she/he has-->




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

Date: Sat, 27 Oct 2001 15:14:17 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: How to delete the last link
Message-Id: <Xns91479B06AD1CCLaocooneudoramailcom@62.153.159.134>

$url =~ s#/.+?html$##i;

Hope this helps you..


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

Date: 27 Oct 2001 17:36:12 +0200
From: Kai Diefenbach <usenet@diefenba.ch>
Subject: Re: How to delete the last link
Message-Id: <7f4rolw0wj.fsf@diefenba.ch>

Hi, 
>>>>> "Pujo" == Pujo C A <adustipujo1@mediaone.net> writes:

 Pujo> ex: http://www.yahoo.com/shopping.html
 Pujo> I want to delete only shopping.html( I mean any number of word after the
 Pujo> last /)
	
	s~[^/]+$~~;	
	
Regards Kai


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

Date: Sat, 27 Oct 2001 16:15:16 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: How to delete the last link
Message-Id: <Xns9147A55E6C23DLaocooneudoramailcom@62.153.159.134>

> $url =~ s#/.+?html$##i;

$url =~ s#/.+?$#/#i;

Lao


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

Date: Sat, 27 Oct 2001 13:26:46 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: HOW to generate graph on MS-Excel using PERL
Message-Id: <qCyC7.18397$CN5.1322985@typhoon.mn.mediaone.net>


"Jason Kohles" <usenet@jasonkohles.com> wrote in message
news:slrn9tk9rl.dp5.usenet@poseidon.mediabang.com...
> On 26 Oct 2001 17:13:43 -0700, Tim wrote:
> >If I would like to automatic generate
> >some graphs using MS-Excel by writing PERL script .
> >
> >COuld someone please show/tell me what do I need ?
> >
> Check the documentation for the Spreadsheet::WriteExcel module.
>

Spreadsheet::WriteExcel doesn't support graphs (yet), afaik.  That leaves
Win32::OLE.

Regards,

Dan




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

Date: 27 Oct 2001 12:16:56 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Local/CGI help please
Message-Id: <9re8jo$evh$1@uranium.btinternet.com>

Stefan <sjoris@rocketmail.com> wrote:
> I use win32::driveinfo::drivespace to check used/available disk space
> on a bunch of server volumes.
> 
> Following script works perfectly from command prompt and displays
> drivespace info array; ex 3709337600104857600003709337600.
> 
> #!c:/perl/bin/perl
> use win32::DriveInfo;
> use CGI qw(:all);
> print "Content-type: text/plain\r\n\r\n";
> $ServerName="myserver";
> print Win32::DriveInfo::DriveSpace("\\\\$ServerName\\data");
> 
> However, in web browser nothing is displayed.
> 

It is almost certain that the user that your web server is running as has
no permission to the network object \\$serverName\Data - you can change this
through the user administrator.  If you do not know how to do this you
should ask your local administrator or ask in a newsgroup that discusses
the administration of Windows servers.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Sat, 27 Oct 2001 14:34:06 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Need help with modules
Message-Id: <slrn9tle9l.at4.tadmc@tadmc26.august.net>


[ posted and emailed ]


Colin Coe <coec@iinet.net.au> wrote:

>What I want to do is use write a Perl program which uses Net::FTP


>The following code:
>#!/usr/bin/perl -w
>use strict;
>use Net::FTP;
>
>Causes the following error:


Just so you know, all of the messages that perl might issue are
documented in the perldiag.pod standard Perl doc. Looking up
the message there often helps with troubleshooting. You can
look it up using the perldoc program:

   perldoc perldiag

You can even ask perl to go look up messages _for_ you by adding:

   use diagnostics;


>Can't locate Net/FTP.pm in @INC (@INC contains:
>/usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0
>/usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0
>/usr/lib/perl5/site_perl .) at ./ftp.pl line 3.
>BEGIN failed--compilation aborted at ./ftp.pl line 3.


For your message perldiag says:

-----------------------------------------------------
=item Can't locate %s

(F) You said to C<do> (or C<require>, or C<use>) a file that couldn't be
found. Perl looks for the file in all the locations mentioned in @INC,
unless the file name included the full path to the file.  Perhaps you need
to set the PERL5LIB or PERL5OPT environment variable to say where the extra
library is, or maybe the script needs to add the library name to @INC.  Or
maybe you just misspelled the name of the file.  See L<perlfunc/require>
and L<lib>.
-----------------------------------------------------


So the Net::FTP module is not in one of the 6 directories listed
in the message.


>I have run "perl -MCPAN -e shell" and done "install Net::FTP" and even
>"force install Net::FTP" and CPAN tells me that Net::FTP is up to date.
>This happens with all modules I try and include.
>
>I'm guessing that I am doing something really stupid here but I can't figure
>out what.


The CPAN module should have installed them in the right place
(ie. one of those six) if you have in configured correctly.

Anyway, the first step is to find out where it _did_ get installed.

Then set the env var mentioned above or "use lib" to get
the actual directory into your @INC.


>PS: Please CC any responces to my email address.  Thanks.


OK.


>PPS: Apologies for the cross-post, but I really need some help with this.


This article was not crossposted. What do you mean?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 27 Oct 2001 16:30:40 +0200
From: "MAGiC MANiAC^mTo" <mto@kabelfoon.nl>
Subject: need help
Message-Id: <9regt8$1glp$1@news.kabelfoon.nl>



===code
# Get parameter commands from url...
@command=split(/&/,$ENV{'QUERY_STRING'});
$lencommand=@command;
for($tmp1=0;$tmp1<$lencommand;$tmp1++){
  @param=split(/=/,$command[$tmp1]);
  for ($param[0]){s/^\s+//;s/\s+$//} # trim $param[0]
  if(uc $param[0] eq "SHW"){$param_show=$param[1]}
}
===code

Query String is:    id=2&text=hello

it gives an error:

Use of uninitialized value in string eq at C:\WINDOWS\TEMP\perltemp.pl line
168.

how can I correct this code?...





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

Date: Sat, 27 Oct 2001 09:39:50 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: need help
Message-Id: <87bsittadl.fsf@limey.hpcc.uh.edu>

>> On Sat, 27 Oct 2001 16:30:40 +0200,
>> "MAGiC MANiAC^mTo" <mto@kabelfoon.nl> said:

> ===code # Get parameter commands from url...
> @command=split(/&/,$ENV{'QUERY_STRING'});
> ...
> ===code

> Query String is: id=2&text=hello

> it gives an error:

> Use of uninitialized value in string eq at
> C:\WINDOWS\TEMP\perltemp.pl line 168.

> how can I correct this code?...

Don't try to parse the CGI stuff yourself, let the
standard module do it for you (properly):

    perldoc CGI

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


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

Date: Sat, 27 Oct 2001 14:49:27 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: need help
Message-Id: <slrn9tlfp3.b4n.tadmc@tadmc26.august.net>

MAGiC MANiAC^mTo <mto@kabelfoon.nl> wrote:
>
>
>===code
># Get parameter commands from url...
>@command=split(/&/,$ENV{'QUERY_STRING'});

[snip]

   perldoc -q CGI

      "How do I decode a CGI form?"


>how can I correct this code?...


Delete it and:

   use CGI;

instead.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 27 Oct 2001 04:04:09 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Newbie.
Message-Id: <3bda94b0@news.microsoft.com>

"Exodus" <exodus@thisaintreal.com> wrote in message
news:RmuC7.1733$GA.145900@news2-win.server.ntlworld.com...
> Is it OK to post newbie questions to this group?
>
> Even if they are really obivious to some of you more experience
programmers?
>
> I've just started learning Perl, and rely on some of our friendly tech's
at
> work for the majority of problems I hit (which are quite a few - but I do
> learn from them.)

It is ok to ask 'newbie questions' if you made a reasonable effort to find a
solution yourself, e.g in particular
- consulted the available documentation for the functions in question
- consulted the FAQ
- searched e.g. google for older NG articles which answered your question
already

If you don't show that you made an effort to help yourself, then you can
expect some serious flaming. But otherwise people will answer even the
apparently most stupid questions.

jue






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

Date: Sat, 27 Oct 2001 14:31:45 +0300
From: "Stuart Gall" <stuart@otenet.gr>
Subject: Re: Newbie.
Message-Id: <9re73s$44q$1@usenet.otenet.gr>

> As a starting point, I wondered whether anyone could recommend some sites
> for looking for help - preferably sites that have lots of practical
examples
> (I'm a visual learner.)
>

I found that the perl FAQ is full of useful tips.
You either marvel at the simplicity of some solutions, or it looks like
gobbledegook in which case you spend time reading the manuals to figure it
out.
Either way you pick up lots of good perl.

Activeperl has the man pages nicely set out in html. I don't know if it is
possible to download the docs like this separately, but it is a convenient
form when you are starting out and reading the manual while you code.
Even if you have to D/L Active perl and delete the rest I would recommend
having the docs in this form.

--

Stuart Gall
------------------------------------------------
This message is not provable.



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

Date: 27 Oct 2001 11:56:15 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Newbie.
Message-Id: <9re7cv$i4r$1@bob.news.rcn.net>

Stuart Gall <stuart@otenet.gr> wrote:
> Activeperl has the man pages nicely set out in html. I don't know if it is
> possible to download the docs like this separately, but it is a convenient
> form when you are starting out and reading the manual while you code.
> Even if you have to D/L Active perl and delete the rest I would recommend
> having the docs in this form.

You can use pod2html to convert the docs into HTML if you so desire.



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

Date: 27 Oct 2001 07:41:34 -0700
From: wb0gaz@hotmail.com (wb0gaz)
Subject: Re: Perl expression to delete delimited bits of text in a line (help)
Message-Id: <7670fd52.0110270641.428d6cf2@posting.google.com>

Thank you both; I had almost randomly opened the perl book onto the
page and stumbled on the non-greedy option (I just didn't find it
before in all of the forest of details.)

As for the fragility of my approach, I fully agree, however, my
project (a little web-mail server) is for learning, not production,
so in some way the "bugs" are invited as part of my learning curve.

"case closed"

Dave

Michael Budash <mbudash@sonic.net> wrote in message news:<mbudash-27247B.15351126102001@news.sonic.net>...
> In article <7670fd52.0110261356.64898a61@posting.google.com>, 
> wb0gaz@hotmail.com (wb0gaz) wrote:
> 
> > Given the string  ABC<DEF>GHI<JKL>MNO I want to eliminate
> > the <DEF> and <JKL> leaving the rest intact. My attempt has
> > produced unwanted results of ABCMNO (basically the < and >
> > given below as the "ends" of my pattern work out-to-in rather
> > than left-to-right, in my layman's terms.)
> > 
> > What am I doing wrong?
> > 
> > (FYI it's part of a routine to partially clean out HTML
> > tags, which I'm sure is a common thing to do, but I also would
> > like to learn from this misfortune...)
> > 
> > Tnx,
> > 
> > Dave
> > 
> > MY ATTEMPT:
> > 
> > $try =~ s/<.*>//g;
> 
> the short answer is:
> 
> s/<.*?>//gs;
> 
> the '?' enables non-greedy matching (or disables greedy matching, 
> depending on your point of view). i'm sure you already witnessed the 
> effects of greedy matching (it matched a '>').
> 
> the longer answer is, don't try to remove html tags this way unless 
> you're sure the tags can *never* contain '>'s or '<'s themselves, and 
> even then, this method is fraught with problems. use one of the modules 
> such as HTML::Parser.
> 
> perldoc -q "How do I remove HTML from a string?"
> 
> hth-


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

Date: Sat, 27 Oct 2001 16:21:43 +0400
From: "Godhead" <dp@co.ru>
Subject: perl loozer
Message-Id: <9re8o5$ogp$1@octopus.co.ru>

sory huys - i'm lozzer in perl...
what does it mean
sub print_content{
 print <<EOF;

EOF
}
explane me pleace...



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

Date: Sat, 27 Oct 2001 14:34:07 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl loozer
Message-Id: <slrn9tlej3.at4.tadmc@tadmc26.august.net>

Godhead <dp@co.ru> wrote:

>what does it mean
>sub print_content{
> print <<EOF;
>
>EOF
>}


It means the same as:

sub print_content{
   print "

";
}


It uses a "here-doc", which is just an alternative way of
quoting a string.


>explane me pleace...

   perldoc perldata

----------------------------------------------------
    A line-oriented form of quoting is based on the shell "here-document"
    syntax. Following a "<<" you specify a string to terminate the quoted
    material, and all lines following the current line down to the
    terminating string are the value of the item. The terminating string may
    be either an identifier (a word), or some quoted text. If quoted, the
    type of quotes you use determines the treatment of the text, just as in
    regular quoting. An unquoted identifier works like double quotes. There
    must be no space between the "<<" and the identifier. (If you put a
    space it will be treated as a null identifier, which is valid, and
    matches the first empty line.) The terminating string must appear by
    itself (unquoted and with no surrounding whitespace) on the terminating
    line.
----------------------------------------------------


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 27 Oct 2001 12:28:37 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Newbie question : How can I open an internet connetion from Perl ?
Message-Id: <9re99l$evh$2@uranium.btinternet.com>

Tony Curtis <tony_curtis32@yahoo.com> wrote:
>>> On Fri, 26 Oct 2001 23:48:16 +0100,
>>> "John Smith" <john@smithIndustries.com> said:
> 
>> Hello, I'm writing a Perl script to grab some data from
>> the web. The problem is that my phone line is not always
>> connected (it's a home phone line, so I don't have a
>> perpetual connection to the web !). I seems that all the
>> scripts I've seen so far, assume that you have a leased
>> line or something.  Does anyone know of how I can
>> "force" a connection, i.e. dial my ISP and make a
>> connection, if i am not connected to the internet ?
> 
> That's way outside the realm of what perl (or any other
> programming language) should be doing.
> 

Well, not necessarily if you consider the question to be 'how can I cause
the Perl program to initiate a dial connection'.  Of course the OP doesnt
indicate which OS this will be on so it would be difficult to frame an
answer.

However I do recall in the dim and distant past that this subject has been
discussed here.  Infact I am sure that I presented some code that would
initiate a pppd connection on linux - however that could be a false memory
as I can't find the code anywhere.

It would probably useful for the OP to search this group on google groups
and possibly the WIn32-Users mailling list at Activestate if they are using
Windows.

> It's off-topic but have a look around somewhere like
> http://freshmeat.net/ for PPP autodialing configurations.
> 
> You might want to follow up to a group like
> comp.os.linux.misc (or whatever OS you're using).
> 

Of course if I have taken the intent of the question wrongly then yes that
would be the right thing to do.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 27 Oct 2001 12:56:43 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Ping Script Help Needed
Message-Id: <9reaub$cub$1@neptunium.btinternet.com>

Alex Davidson <alexd@nospamsynergycsi.com> wrote:
> "speakeasy" <nospam_artd@speakeasy.net> wrote in message
> news:tth73b3944o78b@corp.supernews.com...
>> "Alex Davidson" <alexd@NOSPAMsynergycsi.com> wrote in message
>> news:9r9bh6$id3@dispatch.concentric.net...
>> > I have the following script in a page in order for me to determine an IP
>> > being available so I can use an alternate site if necessary:
>> >
>> > <SCRIPT LANGUAGE="PerlScript" RUNAT="Server">
>> >    use Net::Ping;
>> >    $host = "216.98.200.32";
>> >    $p = Net::Ping->new();
>> >    $retval = $p->ping($host,1);
>> >    $p->close();
>> >    if ($retval = 0) {
>> >      $Response->Redirect("pingresult.asp?Error=Yes");
>> >    } else {
>> >      $Response->Redirect("pingresult.asp?Error=No");
>> >    }
>> > </SCRIPT>
>> >
>> > 216.98.200.32 comes back as "Destination specified is invalid" when I PING
>> > it yet this script returns no error.
>> >
>> > I have tried:
>> > if ($retval = "0") {
>> > if ($retval == "0") {
>> > if ($retval == 0) {
>> >
>> > with similar results (bad and good IPs both show either good or bad) - I
>> > can't find the syntax to discriminate correctly between reachable and
>> > unreachable IPs.
>> >
>> > As you can tell I am a complete neophyte and not sure of the syntax to use.
>> >
>>
>> I'm no expert, and I'm sure this snippet will get criticized by all the Perl
>> Gods, but here:
>>
>>         my $p = Net::Ping->new("icmp");
>>         if ($p->ping($ip)) {
>>             # code here
>>         };
>>
>>
> 

There are two issues here that probably need explaining - firstly on Unix
this will need to be run by the superuser in order to be able to use ICMP
and secondly I am not entirely sure that ICMP is available to use code
on Windows at all (although I only vaguely remember that so I might be wrong).

> 
> With this:
> <SCRIPT LANGUAGE="PerlScript" RUNAT="Server">
>  use Net::Ping;
>    $ip = "216.115.108.245";
>    my $p = Net::Ping->new("icmp");
>    if ($p->ping($ip,2)) {
>      $Response->Redirect("pingresult.asp?Error=No");
>    } else {
>      $Response->Redirect("pingresult.asp?Error=Yes");
>    }
> </SCRIPT>
> I get:
> 
> $ip = "216.115.108.245"; my $p = Net::Ping->new("icmp"); error '80004005'
> icmp socket error - Unknown error
> /smi/test.asp, line 4
> 
> 
> If I take out the "icmp" on the "my $p..." line I get taken to page
> "pingresult.asp?Error=No" regardless:
> 

It is obvious you are writing this as a Window ASP thingy so you are probably
running into privilege problems in two places - firstly it is almost certain
that the user that the web server runs as does not have any permissions to
access the network and secondly as noted above the ICMP is not available
to user programs on Windows.  The first of these when sorted should allow
your original code to work - you will need to ask your local administrator
or a windows newsgroup about how to change the permissions on the user.  The
second I am not sure how to fix but you would probably want to ask on a
windows group about that as well.

However there is another problem (which is entirely un perl related ) that
you are going to run into if the machines you are trying to ping are all
windows and you cannot use ICMP ping, which is that Windows machines do
not generally run a TCP or UDP echo service which is what Net::Ping uses
if it cannot use ICMP - this will cause false negatives indicating a server
is down when infact it isnt.  You certainly will want to ask on a Windows
group how to address this problem.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 27 Oct 2001 12:36:27 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: regular expression for url
Message-Id: <9re9ob$evh$3@uranium.btinternet.com>

Aditya <isaditya@yahoo.com> wrote:
> In article <9rdk93$3f6$1@charity.cs.utexas.edu>, "Logan Shaw"
> <logan@cs.utexas.edu> wrote:
> 
>> Look at the URI and URI::Heuristic modules from CPAN.  They should do
>> most of what you want.  See http://search.cpan.org/search?module=URI .
>> 
> Thanks for your reply. Now i have another question. I read the manpage
> for the module and came across URL_GUESS_PATTERN. I could not find how to
> actually use it. The way it is given in the manpage doesn't help me. Any
> suggestions?
> 

Hmm it seemed quite clear to me, but that happens :)  If you only want
'foo' to 'www.foo.com' then you needn't use the environment variable at
all, if however you want to expand it to say 'server.foo.co.uk' then you
would set URL_GUESS_PATTERN to 'server.ACME.co.uk' and so forth.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Sat, 27 Oct 2001 15:32:53 +0200
From: "MAGiC MANiAC^mTo" <mto@kabelfoon.nl>
Subject: uppercase with
Message-Id: <9redaa$1ckb$1@news.kabelfoon.nl>



  if($param[0] eq "SHOW"){$param_show=$param[1]}

     ^^^^^^^^ how can I change $param[0]  into uppercase and trim the
string?...





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

Date: 27 Oct 2001 17:39:54 +0200
From: Kai Diefenbach <usenet@diefenba.ch>
Subject: Re: uppercase with
Message-Id: <sz1yjpw0qd.fsf@diefenba.ch>

Hi,
>>>>> "MAGiC" == MAGiC MANiAC^mTo <mto@kabelfoon.nl> writes:

 MAGiC>   if($param[0] eq "SHOW"){$param_show=$param[1]}
 MAGiC>      ^^^^^^^^ how can I change $param[0]  into uppercase and trim the
 MAGiC> string?...

	perldoc -f uc	
	perldoc -q  "strip blank" 

Regards Kai


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

Date: Sat, 27 Oct 2001 14:34:05 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: variable replacement
Message-Id: <slrn9tlbvc.at4.tadmc@tadmc26.august.net>

Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
>
><rearranged for logical reasons>
>
>  TM> (my other followup OTOH has 2 evals and 1 interpolation, 'cause


That was referring to the commented-out alternative I gave
in my followup, ie:  $b = q/"$1$1"/;

Has no bearing on this sub-thread, but I'll correct it now anyway.


>  TM> the code for the 2nd eval is a double quoted string.)
>
>  TM> Uri Guttman <uri@sysarch.com> wrote:
>
>  >> s/foo/$b/ is the same as s/foo/"$b"/e.
>
>  TM> Yes, because the _code_ happens to use quotes in the
>  TM> code-to-be-evaluated.
>
>so that implies that $b in the former case IS interpolated.


Yes, and I don't see where I ever said otherwise.


>  >> ilya has pointed out that the replacement side of s/// is
>  TM>                                                     ^^^
>  TM>                                                     ^^^ note no 'e'
>
>
>that is the point of the above. a plain s/// does
>interpolate. internally it really is s//""/e. the replacement is a
>double quotish string which always means interpolation. in fact the
>regex side also interpolates which you already know.


I already knew that the replacement part was double quotish too.


>  TM> s///e treats the replacement as code, not as a double-quotish string.
>
>  TM> Right?
>
>yes.


So let me just say this clearly for those playing along at home
and hoping to find something of at least limited value in
this sub-thread  :-)


   The replacement part of a substitution is double-quotish
   unless there is an 'e' option.


>  TM> With an 'e', there is no "string", there is only "code" in
>  TM> the replacement part. (and the result of evaluating the code
>  TM> is taken as the string to use.)
>
>  >> >> s/$a/$b/eegs; # double the 'e' !
>  >> 
>  TM> Two evals, zero interpolations.
>
>  TM> I stand by the "2 evals, 0 interpolations" statement.
>
>that makes sense now. 


Good, but I think I made sense in what you followed up to also.
That leaves me wondering why you followed up, I must have
missed something, so I'm looking for what I missed.

But I think you saw some problem that wasn't there. Is that
what happened?

To recount:

:   >>> $b = q/$1$1/;
: 
:   >>> s/$a/$b/egs;
: 
:   >> Yes : $b is interpolated,
: 
: 
:   TM> No, $b is _evaluated_, not interpolated.
: 
: debatable. 


But it is not debatable.

That s/// _does_ have an 'e', so there is no interpolation in
the replacement part.

I had it right but you (erroneously?) thought I had it wrong?

Maybe you just missed the 'e'?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 27 Oct 2001 11:43:03 +0100
From: "Ben Addis" <not@home.com>
Subject: Re: Web image tables
Message-Id: <9re31s$mii$1@plutonium.btinternet.com>

Init a variable as zero before you go into the foreach loop. Then inside the
loop incremnt it over each iteration. When it reaches 7, print "</tr><tr>"
and reset it back to zero.

When outside the foreach, print "</tr>"

Ben

"Brian D. Green" <greenbd@u.washington.edu> wrote in message
news:Pine.A41.4.33.0110261427180.20858-100000@dante35.u.washington.edu...
> Hello,
>
> I'm trying to simplify my online photo galleries by writing a Perl script
> to generate the tables of thumbnails.  How would I make the script begin a
> new row after every seventh cell?  My script is below.
>
> ###
> #!/usr/local/bin/perl
>
> use CGI ':standard';
> print "Content-type:text/html\n\n";
>
> $id = param('id');
> $id++;
>
> open (IN, "foxfield.dat"); # simple db file w/ filenames & alt tags
>
> @lines = <IN>;
> close (IN);
>
> foreach $i (@lines) {
> chomp($i);
> ($name,$alt) = split (/\|/,$i);
>
> $pic = $id++;
>
> print<<thumbnail;
> <td class="img3">
> <a href="gallery.cgi?id=$pic">
> <img src="s/$name.jpg" alt="$alt">
> </a>
> </td>
> thumbnail
> }
>
> ###
>
> I've tried things such as sticking
>
> for ($pic = 5){
> print "\n</tr>\n\n<tr>\n";
> }
>
> inside the foreach loop, but that just makes a new row for each image.
> I'd appreciate any help!
>
> Thanks,
> Brian Green http://www.briangreen.org/
>
> O-----------------------------------------------------------------------O
> |"I am not ashamed of the gospel, because it is the power of God for the|
> |  salvation of everyone who believes: first for the Jew, then for the  |
> |    Gentile." --Romans 1:16, NIV     |
> O-----------------------------------------------------------------------O
>




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 V10 Issue 2022
***************************************


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