[31151] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2396 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 6 09:09:46 2009

Date: Wed, 6 May 2009 06:09:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 6 May 2009     Volume: 11 Number: 2396

Today's topics:
    Re: Boggled - just what is subrouteen ($$$$) all about <someone@example.com>
        Computers and Laptops m.irfan.n84@gmail.com
    Re: HELP - Spreadsheet::ParseExce - Can't call method " <Ansher.M@gmail.com>
    Re: HELP - Spreadsheet::ParseExce - Can't call method " <jmcnamara13@gmail.com>
    Re: Help using Spreadsheet::ParseExcel Module - Can't c <Ansher.M@gmail.com>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <ben@morrow.me.uk>
    Re: Help with Net::ftp not downloading <RedGrittyBrick@spamweary.invalid>
    Re: Help with Net::ftp not downloading <RedGrittyBrick@spamweary.invalid>
    Re: Help with Net::ftp not downloading <RedGrittyBrick@spamweary.invalid>
    Re: Help with Net::ftp not downloading <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 06 May 2009 02:00:04 -0700
From: "John W. Krahn" <someone@example.com>
Subject: Re: Boggled - just what is subrouteen ($$$$) all about
Message-Id: <pkcMl.37586$3k7.9235@newsfe17.iad>

kids wrote:
> Can some kind soul explain to me (or point me to and explanation) that 
> will clarify this for me;
> 
> 
> sub subname1 ( $$ );
> sub subname2 ( $$$$ );
> sub subname3 ( $$ );
> sub subname4 ( $ );
> 
> My assumption is they are some kind of scalar placeholder/argument but I 
> am not entirely clear :-(
> 
> part googled, part rtm - not jumping out at me

Those are called "forward" declarations with prototypes.  You declare 
the subroutines first so you can use them without the need to use 
parentheses.

Also, the prototypes are not really needed.  See: 
http://groups.google.com/group/comp.lang.perl.modules/msg/84484de5eb01085b 
for an explaination about why they are not needed.


John
-- 
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov


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

Date: Wed, 6 May 2009 00:49:03 -0700 (PDT)
From: m.irfan.n84@gmail.com
Subject: Computers and Laptops
Message-Id: <25c19e1e-bac1-4e30-b827-206ec273ad6f@t10g2000vbg.googlegroups.com>

Information about Computers and Laptops for more info visit (in-
computersandlaptops.blogspot.com)


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

Date: Wed, 6 May 2009 02:31:39 -0700 (PDT)
From: perl Newbie <Ansher.M@gmail.com>
Subject: Re: HELP - Spreadsheet::ParseExce - Can't call method "value" on an  undefined value
Message-Id: <eb245b5a-2781-43cd-ab90-67166d7b92a3@z7g2000vbh.googlegroups.com>

On May 6, 2:35=A0am, smallpond <smallp...@juno.com> wrote:
> On May 5, 5:04=A0pm, perl Newbie <Anshe...@gmail.com> wrote:
>
>
>
>
>
> > On May 6, 1:21=A0am, smallpond <smallp...@juno.com> wrote:
>
> > > On May 5, 2:45=A0pm, perl Newbie <Anshe...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I am getting an error message Can't call method "value" on an
> > > > undefined value at ....
>
> > > Is this a troll? =A0You call value 5 times in your program.
> > > Are we supposed to guess which call is the failing one?
> > > Do you not know that the error includes the line number?
>
> > Sorry about that ...
>
> > Can't call method "value" on an undefined value at F:\Perl\excel
> > \test.pl line 25.
>
> ... and which call to value is that? =A0Do I have to count the lines in
> your file for you?

if you cannot help, better leave the post unanswered


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

Date: Wed, 6 May 2009 02:44:47 -0700 (PDT)
From: jmcnamara <jmcnamara13@gmail.com>
Subject: Re: HELP - Spreadsheet::ParseExce - Can't call method "value" on an  undefined value
Message-Id: <db74d396-bd5e-4856-9869-06ad0e5275e3@m24g2000vbp.googlegroups.com>

On May 5, 7:45=A0pm, perl Newbie <Anshe...@gmail.com> wrote:
> Hi,
>
> I am getting an error message Can't call method "value" on an
> undefined value at ....
>
> I have used a print stmt print "RowL: $rowL ", $worksheet->get_cell
> ($rowL,6)->value(), "\n";


Hi,

If a cell doesn't contain a value then get_cell() will return undef
instead of a Cell object. In which case it isn't valid to call value()
on the undefined object.

Break your chained method calls into separate statements instead and
put in some error checking. For example:

    my $cell =3D $worksheet->get_cell( $row, $col );

    next unless $cell; # Or some other error check/response.

    print "Value       =3D ", $cell->value(),       "\n";

Or do something like this:

    print $cell->value() if $cell;

P.S. There is a dedicated Spreadsheet::ParseExcel Google Group:
http://groups.google.com/group/spreadsheet-parseexcel

John.
--


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

Date: Wed, 6 May 2009 02:43:38 -0700 (PDT)
From: perl Newbie <Ansher.M@gmail.com>
Subject: Re: Help using Spreadsheet::ParseExcel Module - Can't call method  "value" on an undefined value
Message-Id: <b49910e0-21e7-452b-8694-700745e622a5@h23g2000vbc.googlegroups.com>

On May 5, 11:25=A0pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> perl Newbie wrote:
> > Hi,
>
> > Please help me understand why I am getting error { Can't call method
> > "value" on an undefined value excelRead.pl line 34. }
>
> > Line 34 in my script is $qval =3D $qcell->value();
>
> > When I checked the excel file, there are no blank rows in column 1,
> > then how come it is throwing an error -undefined value?
> [...]
> > =A0 =A0 =A0 =A0 my $row;
> > =A0 =A0 =A0 =A0 my $cell;
> > =A0 =A0 =A0 =A0 my $cell_value;
>
> > =A0 =A0 =A0 =A0 my $qcell;
> > =A0 =A0 =A0 =A0 my $qval;
> > =A0 =A0 =A0 =A0 my @qids;
>
> Define the variable in the smallest possible scope.
>
>
>
> > =A0 =A0 =A0 =A0 for $row ($row_min .. $row_max) {
>
> for my $row ( $row_min .. $row_max) {> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $c=
ell =3D $worksheet->get_cell($row,3);
>
> my $cell =3D $worksheet->get_cell($row,3);
>
> etc.
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $cell_value =3D $cell->value();
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ($cell_value =3D~/single choice/i) {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $qcell =3D $worksheet->=
get_cell($row+1,0);
>
> What happens when $row equals $row_max.. e.g. what's in ($row_max+1, 0)?
>
> You could use another for loop, which would make your code much cleaner.
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for my $next_row ( $row+1=
 .. $row_max ) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # get the=
 values you're after..
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 last if $=
qval =3D~ /question/;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>
> =A0> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $row++;
>
> Be careful modifying a variable you use in your for loop. In
> this case perl saves you, but you should avoid doing it.
>
> FYI: You can add print statements to your code, to help you debug things
> on your own.


>You could use another for loop, which would make your code much cleaner.

>for my $next_row ( $row+1 .. $row_max ) {
>                                # get the values you're after..
>                                last if $qval =3D~ /question/;
>                        }

Thanks for the help, using another loop solved the problem.

Why I am getting error if I loop using until?

__CODE__
use strict;
use warnings;
use Spreadsheet::ParseExcel;

my $excelfilename=3D"data.xls";
my $datasheet=3D"data";

my $parser        =3D Spreadsheet::ParseExcel->new();
my $workbook      =3D $parser->Parse($excelfilename);
my $worksheet     =3D $workbook->Worksheet($datasheet);
my ( $row_min, $row_max ) =3D $worksheet->row_range();
my $row;
my $rowL;
my @qids;

for $row ($row_min .. $row_max) {
        if ($worksheet->get_cell($row,3)->value() =3D~/single choice/i)
{
                ##print "Row: $row ", $worksheet->get_cell($row,3)-
>value(), "\n";
                $rowL=3D$row+1;
                for $rowL ($rowL .. $row_max ) {
                        last if ($worksheet->get_cell($rowL,0)->value()
=3D~/question/);
                ##until ($worksheet->get_cell($rowL,0)->value()=3D~/
question/) {
                        if ($worksheet->get_cell($rowL,0)->value()=3D~/
column/) {
                                ##print "RowL: $rowL ", $worksheet-
>get_cell($rowL,6)->value(), "\n";
                                push @qids, $worksheet->get_cell($rowL,
6)->value();
                        }
                        $rowL++;
                }
        }
        next;
}

foreach my $l (@qids) {
        print $l, "\n";
}











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

Date: Wed, 06 May 2009 01:00:25 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <1pg2059ubkp1f0bcv477g7c12kvhr8dfm2@4ax.com>

Uri Guttman wrote:

>>>>>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:
>
>  >>>> >my $localDir = 'C:/somedir';  #change that to the appropriate location
>
>  EJ> Yes, you are correct, and that also crossed my mind, so I created
>  EJ> two directories named C, one above cgi-bin and one a subdirectory
>  EJ> of cgi-bin.  No go...same error.
>
>wow again.
>
>  EJ> Perhaps you'd care to make another wild guess at the answer to my dilemma.
>  EJ> I cannot find the answer elsewhere, and I have done my due diligence.
>
>he pointed out the very problem you are having. and i smacked my head in
>a wow already. do you want another forehead smack?
>
>  EJ> Should this be done under the scenario of transferring files from one
>  EJ> remote to another remote with no local client?
>
>huh??? you don't seem to get it. UNIX DOESN'T HAVE : as SPECIAL IN FILE
>NAMES!!!!!  it is a regular character. you can't have absolute paths
>that work on both unix and winfuckingblows. simple. 

Never thought of it. Mea maxima culpa.

>now you can smack
>yourself a dozen times and learn something about writing portable
>code. 

Nah. I never smack myself when I learn something through a mistake. 

>and the File::Path module on cpan will ease your pains.
>
Thanks.

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


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

Date: Wed, 06 May 2009 01:29:33 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <vsg205pgvjj3p1in30qqaqtt4pvsfa0u5r@4ax.com>

Ben Morrow wrote:

>
>Quoth Ed Jay <edMbj@aes-intl.com>:
>> Ed Jay wrote:
>> >Ben Morrow wrote:
>> >>
>> >>Let me make a wild guess. You are executing this script as a CGI on your
>> >>webhost, which is a Unix machine and doesn't have a C: drive.
>> >>
>> >Correct, except that I created a 'C' folder both above and below the
>> >folder (cgi-bin), so there would be a C folder.
>> 
>> Accidentally hit Return.
>> 
>> Yes, you are correct, and that also crossed my mind, so I created two
>> directories named C, one above cgi-bin and one a subdirectory of cgi-bin.
>> No go...same error. 
>
>I'm struggling to understand here: what thought process made you think
>that might help? I'm not (just) being sarcastic: you clearly have some
>fundamental misunderstanding here, and until you resolve it there's no
>way you're going to make this work.

The thought process was that if the script is looking for a C folder on
the server, I'd provide it.
>
>> Perhaps you'd care to make another wild guess at the answer to my dilemma.
>> I cannot find the answer elsewhere, and I have done my due diligence.
>
>Sure... you don't understand the difference between running a program
>locally and requesting a webpage that happens to run a CGI the results
>of which happen to be displayed on your machine.

Actually, I do understand that, but I've become so accustomed to running a
web app from my browser that I didn't stop to think of the consequences
when I decided to try NET::ftp.
>
>There is *no* *way* a CGI program can access the filesystem on the
>machine the browser is running on (in the general case). Otherwise any
>random website could trash all your files. If you have provided some way
>we don't know about, you need to say so.

Of course, but my situation is not the general case. 
>
>> Should this be done under the scenario of transferring files from one
>> remote to another remote with no local client?
>
>No. That would require you to be running an FTP server on your local
>machine, and for that FTP server to be accessible to the machine running
>the CGI. I seriously doubt this is the case.
>
>As I asked upthread: please explain what you are trying to achieve.
>Which machine is running the CGI? Which machine is the file coming from?
>Which machine is the file going to? What channels of communication exist
>between these machines?
>
My purpose: A customer uploads 3 - 5 images to a specific folder on the
server. We know how many images, their (sequentially numbered) filenames,
and where they are located on the server. With a click of the mouse on my
desktop machine, I want to download the images to a specific folder on my
desktop, and when the last image has successfully finished downloading, I
want to launch a specific application to view the images. 

Similarly, I want my customers to capture the images to a specific folder
on their machine, and with a single click, upload all the images to the
specific folder on the server along with data pertaining to image
filenames and quantity.
>
>Is there some terribly good reason you can't run this program on the
>machine the file is going to? It would make things much easier.

Yes, there is an important reason. Too lengthy to get in to.
>
>Note that none of this (yet) has anything to do with Perl. The answers
>would be the same if your CGI was written in any other language.
>
If you'd care to direct me to a different, more appropriate group, please
do. I thought that NET::ftp was a Perl module I'm having difficulty with,
and therefore on-topic.

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


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

Date: Wed, 06 May 2009 01:49:33 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <glj205l94hndrhjuqr3tvnij25jpjr0rai@4ax.com>

Nathan Keel wrote:

>Ed Jay wrote:
>
>> Ed Jay wrote:
>> 
>>>Ben Morrow wrote:
>>>
>>>>
>>>>Quoth Ed Jay <edMbj@aes-intl.com>:
>>>>> J. Gleixner wrote:
>>>>> 
>>>>> >use CGI qw(:standard);
>>>>> ># without the next line, die output will be found in your
>>>>> ># server's error log. Use this only when debugging.
>>>>> >use CGI::Carp qw(fatalsToBrowser);
>>>>> >use strict;
>>>>> >
>>>>> >my $localDir = 'C:/somedir';  #change that to the appropriate
>>>>> >location
>>>>> >
>>>>> >print header,
>>>>> >"Changing directory to $localDir.<br>";
>>>>> >
>>>>> >chdir( $localDir ) or die "Can't cd to $localDir: $!";
>>>>> >
>>>>> >print "Change to $localDir successful.<br>";
>>>>> 
>>>>> The above represents the entire script I used. Got the same message
>>>>> (Can't cd to C:/: No such file or directory at brca_download.pl),
>>>>> and there is nothing showing in the server's error log.
>>>>
>>>>Let me make a wild guess. You are executing this script as a CGI on
>>>>your webhost, which is a Unix machine and doesn't have a C: drive.
>>>>
>>>Correct, except that I created a 'C' folder both above and below the
>>>folder (cgi-bin), so there would be a C folder.
>> 
>> Accidentally hit Return.
>> 
>> Yes, you are correct, and that also crossed my mind, so I created two
>> directories named C, one above cgi-bin and one a subdirectory of
>> cgi-bin. No go...same error.
>> 
>> Perhaps you'd care to make another wild guess at the answer to my
>> dilemma. I cannot find the answer elsewhere, and I have done my due
>> diligence.
>> 
>> Should this be done under the scenario of transferring files from one
>> remote to another remote with no local client?
>> 
>
>I the CGI script is running on the Unix system where it's downloading
>to, then the path doesn't use the drive letter and colon.  It's
>literally the /path/to/the/directory/ where to store it.  This is why
>myself and others suggested testing it as a stripped down version and
>if the manual FTP download to that directory worked.  This is just
>confusing at this point.

What was confusing to me was that my file manager wasn't refreshing its
cache, so I never saw that the file was actually being sent to the
script's folder. 

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


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

Date: Wed, 06 May 2009 01:49:59 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <7pj205h90l2vh3tu6lufthfdrqvevha8mm@4ax.com>

Tad J McClellan wrote:

>Dr.Ruud <rvtol+usenet@xs4all.nl> wrote:
>> Ed Jay wrote:
>>
>>> cd to C:/:
>>
>> With 2 colons?
>
>
>It helps with digestion.  :-)

No it doesn't. It makes you nyuk.

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


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

Date: Wed, 6 May 2009 10:40:31 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <fh28d6-r94.ln1@osiris.mauzo.dyndns.org>


Quoth Ed Jay <edMbj@aes-intl.com>:
> Ben Morrow wrote:
> >Quoth Ed Jay <edMbj@aes-intl.com>:
> >> 
> >> Yes, you are correct, and that also crossed my mind, so I created two
> >> directories named C, one above cgi-bin and one a subdirectory of cgi-bin.
> >> No go...same error. 
> >
> >I'm struggling to understand here: what thought process made you think
> >that might help? I'm not (just) being sarcastic: you clearly have some
> >fundamental misunderstanding here, and until you resolve it there's no
> >way you're going to make this work.
> 
> The thought process was that if the script is looking for a C folder on
> the server, I'd provide it.

Yes, but... 

Even setting aside the fact the script was looking for a directory
called "C:", not "C", *how* *exactly* did you think the files were going
to get from the "C" directory on the server into the "C:\" directory on
your local machine? Magic?

> >> Perhaps you'd care to make another wild guess at the answer to my dilemma.
> >> I cannot find the answer elsewhere, and I have done my due diligence.
> >
> >Sure... you don't understand the difference between running a program
> >locally and requesting a webpage that happens to run a CGI the results
> >of which happen to be displayed on your machine.
> 
> Actually, I do understand that, but I've become so accustomed to running a
> web app from my browser that I didn't stop to think of the consequences
> when I decided to try NET::ftp.

(It's called Net::FTP. Case is important in Perl.)

You posted to Usenet before stopping to think? Around here that's
considered rather rude.

Now you have stopped to think, what have you thunk? Can you see yet that
Net::FTP can't possibly help you here?

> >There is *no* *way* a CGI program can access the filesystem on the
> >machine the browser is running on (in the general case). Otherwise any
> >random website could trash all your files. If you have provided some way
> >we don't know about, you need to say so.
> 
> Of course, but my situation is not the general case. 

In what way is your situation different from the general case? Be
specific. That is, what means have you provided, that you haven't told
us about yet, for a process running on the webserver to get at your
local filesystem?

> >> Should this be done under the scenario of transferring files from one
> >> remote to another remote with no local client?
> >
> >No. That would require you to be running an FTP server on your local
> >machine, and for that FTP server to be accessible to the machine running
> >the CGI. I seriously doubt this is the case.
> >
> >As I asked upthread: please explain what you are trying to achieve.
> >Which machine is running the CGI? Which machine is the file coming from?
> >Which machine is the file going to? What channels of communication exist
> >between these machines?
> >
> My purpose: A customer uploads 3 - 5 images to a specific folder on the
> server.

'The' server. *Which* server? (Machines have names for a reason.) In
particular, is this the same machine as is running the CGI, or not? If
it is, then Net::FTP is not going to help you one bit.

> We know how many images, their (sequentially numbered) filenames,
> and where they are located on the server. With a click of the mouse on my
> desktop machine, I want to download the images to a specific folder on my
> desktop, and when the last image has successfully finished downloading, I
> want to launch a specific application to view the images. 
>
> Similarly, I want my customers to capture the images to a specific folder
> on their machine, and with a single click, upload all the images to the
> specific folder on the server along with data pertaining to image
> filenames and quantity.

OK. Unless there is something going on you haven't told us about, you
*simply* *cannot* do this with a CGI script. If you want to write to
files and run programs on the local machine, your program needs to be
running on the local machine.

It may be possible to do something involving JavaScript and lowering
your browser's security settings to dangerous levels. I don't know
anything about that, and it certainly has nothing to do with Perl.

> >Is there some terribly good reason you can't run this program on the
> >machine the file is going to? It would make things much easier.
> 
> Yes, there is an important reason. Too lengthy to get in to.

Well, you're going to have to rethink something, since under the
constraints you've set no solution is possible.

> >Note that none of this (yet) has anything to do with Perl. The answers
> >would be the same if your CGI was written in any other language.
> >
> If you'd care to direct me to a different, more appropriate group, please
> do. I thought that NET::ftp was a Perl module I'm having difficulty with,
> and therefore on-topic.

If it was Net::FTP you were having difficulty with, that would indeed be
on-topic here. However, your problems started long before you tried to
use Net::FTP: they started when you said to yourself 'I want to go to a
web page and have it write random files on my local filesystem', which
has nothing to do with Perl (or Net::FTP, or ftp in general).

Ben



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

Date: Wed, 06 May 2009 11:24:05 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <4a016545$0$2535$da0feed9@news.zen.co.uk>


Ed Jay wrote:
> Uri Guttman wrote:
> 
>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:
>>  EJ> Ben Morrow wrote:
>>  >> 
>>  >> Quoth Ed Jay <edMbj@aes-intl.com>:
>>
>>  >>> >my $localDir = 'C:/somedir';  #change that to the appropriate location
>>
>>  >>> The above represents the entire script I used. Got the same message (Can't
>>  >>> cd to C:/: No such file or directory at brca_download.pl), and there is
>>  >>> nothing showing in the server's error log.
>>  >> 
>>  >> Let me make a wild guess. You are executing this script as a CGI on your
>>  >> webhost, which is a Unix machine and doesn't have a C: drive.
>>  >> 
>>  EJ> Correct, except that I created a 'C' folder both above and below the
>>  EJ> folder (cgi-bin), so there would be a C folder.
>>
>> wow. and what do you think unix does with the : char in a filename? i
>> can't even start to answer this or i will smack my forehead too many
>> times.
>>
>> wow.
>>
> :-)  Don't smack yourself. I've been doing that all day, and it's only
> given me a bigger headache. That said, the answer to how do I target a
> directory my desktop machine is probably trivial and obvious, and I'll
> smack my head even more when the light finally goes on.
> 

Perhaps I have completely misunderstood. The server, on which your CGI 
script is running, doesn't normally have access to the C: drive of any 
desktop PC involved in a web connection (HTTP).

-- 
RGB


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

Date: Wed, 06 May 2009 11:33:03 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <4a016760$0$2535$da0feed9@news.zen.co.uk>


Ed Jay wrote:

> 
> What was confusing to me was that my file manager wasn't refreshing its
> cache, so I never saw that the file was actually being sent to the
> script's folder. 
> 

It is usually a bad thing (tm) to allow the public to upload files to 
your web-servers folders in which scripts reside.

There's enough ambiguity in your sentence that this may not be what is 
actually happening, but I thought it worth mentioning.

-- 
RGB


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

Date: Wed, 06 May 2009 11:47:34 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <4a016ac6$0$2548$da0feed9@news.zen.co.uk>


Ed Jay wrote:
> My purpose: A customer uploads 3 - 5 images to a specific folder on the
> server. We know how many images, their (sequentially numbered) filenames,
> and where they are located on the server. With a click of the mouse on my
> desktop machine, I want to download the images to a specific folder on my
> desktop, and when the last image has successfully finished downloading, I
> want to launch a specific application to view the images. 

The only way I can think to do it "with a [single] click of the mouse" 
is to use that click to invoke a Perl program on your desktop (not the 
CGI server) which uses something like Net::FTP or WWW::Mechanize to 
retrieve the list of images, then the images and which finally uses 
system() to invoke your "specific application".

> Similarly, I want my customers to capture the images to a specific folder
> on their machine, and with a single click, upload all the images to the
> specific folder on the server along with data pertaining to image
> filenames and quantity.

If you are struggling with `perldoc CGI` try something like 
http://www.sitepoint.com/article/uploading-files-cgi-perl/ which 
explains how to use the CGI module to upload images. It isn't a single 
click.

To make it a single click, one way would be to write and deploy a custom 
"image uploader" application to their desktop.

-- 
RGB


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

Date: Wed, 06 May 2009 12:23:48 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <Xns9C0355698514Casu1cornelledu@127.0.0.1>

Ben Morrow <ben@morrow.me.uk> wrote in
news:fh28d6-r94.ln1@osiris.mauzo.dyndns.org: 
> 
> Quoth Ed Jay <edMbj@aes-intl.com>:

>> My purpose: A customer uploads 3 - 5 images to a specific folder on
>> the server.
> 
> 'The' server. *Which* server? (Machines have names for a reason.) In
> particular, is this the same machine as is running the CGI, or not? If
> it is, then Net::FTP is not going to help you one bit.

Let's assume for the moment that the customer uploads the photos to the 
web server via another CGI script. Let's also assume that the images are 
stored in a directory that is not publically accessible. Finally, let's 
assume that the CGI script Ed Jay wants to write will also reside on 
this particular server and has read access to the images.

>> We know how many images, their (sequentially numbered) filenames,
>> and where they are located on the server. With a click of the mouse
>> on my desktop machine, I want to download the images to a specific
>> folder on my desktop, 

Write a script which, when invoked, will ZIP up all the image files and 
stream back that archive to the client. The user can then save the ZIP 
file containing the images in any folder on his computer.

>> and when the last image has successfully finished downloading, I want
>> to launch a specific application to view the images. 

Not possible. However, you can extract the images from the ZIP file.

On the other hand, if the directory containing the images is publically 
accessible and you use automatic index generation by the web server 
software, you can write a batch file (to be run on the client computer) 
to download all the images to a specific folder and then invoke whatever 
image editor you want.

>> Similarly, I want my customers to capture the images to a specific
>> folder on their machine, and with a single click, upload all the
>> images to the specific folder on the server along with data
>> pertaining to image filenames and quantity.
> 
> OK. Unless there is something going on you haven't told us about, you
> *simply* *cannot* do this with a CGI script. If you want to write to
> files and run programs on the local machine, your program needs to be
> running on the local machine.

Ditto. That just is not possible with CGI. If it were, surely online 
photo sites would have already started it. There is a reason you must 
either select each image to be uploaded individually or use a helper 
application with those sites.

> It may be possible to do something involving JavaScript and lowering
> your browser's security settings to dangerous levels. I don't know
> anything about that, and it certainly has nothing to do with Perl.
> 
>> >Is there some terribly good reason you can't run this program on the
>> >machine the file is going to? It would make things much easier.
>> 
>> Yes, there is an important reason. 

See, important and good are not the same things.

>> If you'd care to direct me to a different, more appropriate group,
>> please do. I thought that NET::ftp was a Perl module I'm having
>> difficulty with, and therefore on-topic.

No, you are not having difficulty with Net::FTP. You simply do not 
understand how things work. Your problem is not about, say, fixing a 
couple of bugs in the guidance system of a rocket you are building. No, 
it is about why it is hard and not a good idea to launch the rocket in 
your living room.

There is a reason you are in my killfile. You are clueless when it comes 
to the basic concepts involving computers and you are resistant to 
learning.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 2396
***************************************


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