473,325 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Error: Global symbol "" requires explicit package name at

2
there is a lot of errors in this perl. what causes and how can i fix them

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use File::Path qw(make_path);
  5. use LWP::UserAgent;
  6. use File::Temp qw(tempfile tempdir);
  7. use Compress::Zlib qw(uncompress);
  8.  
  9. sub readtime
  10. {
  11.    my ($handle, $hashref) = @_;
  12.  
  13.    read $handle, my $rawtime, 8;
  14.  
  15.    ( $hashref->{'lsb32'},
  16.      $hashref->{'nsec'} ) = unpack "NN", $rawtime;
  17.  
  18.    return $hashref;
  19. }
  20.  
  21. sub readindex
  22. {
  23.    my ($infile) = @_;
  24.    my $packindex;
  25.  
  26.    # read the header
  27.    read $infile, my $rawheader, 12;
  28.    my $header = {};
  29.    ($header->{'ident'}, $header->{'version'}, $header->{'entries'})
  30.       = unpack("a4NN", $rawheader);
  31.  
  32.    die "Not a git index file" if ($header->{'ident'} ne "DIRC");
  33.    die "Unsupported version of git index" if ($header->{'version'} != 2);
  34.  
  35.    my @index_entries = ();
  36.  
  37.    for (my $i=0; $i{'entries'}; $i++)
  38.    {
  39.       my $statinfo = {};
  40.       my $entry = {};
  41.       my $rawdata;
  42.       my %ctime = ();
  43.       my %mtime = ();
  44.  
  45.       $statinfo->{'ctime'}=readtime($infile, \%ctime);
  46.       $statinfo->{'mtime'}=readtime($infile, \%ctime);
  47.  
  48.       # read the non-time fields
  49.       read $infile, $rawdata, 24; 
  50.       ( $statinfo->{'dev'}.
  51.         $statinfo->{'inode'}.
  52.         $statinfo->{'mode'}.
  53.         $statinfo->{'uid'}.
  54.         $statinfo->{'gid'}.
  55.         $statinfo->{'size'} ) = unpack "NNNNNN", $rawdata;
  56.  
  57.       $entry->{'statinfo'}=$statinfo;
  58.       read $infile, $rawdata, 20; 
  59.       ( $entry->{'id'} ) = unpack "H*", $rawdata;
  60.       $packindex.=$rawdata;
  61.       read $infile, $rawdata, 2; 
  62.       ( $entry->{'flags'} ) = unpack "n", $rawdata;
  63.  
  64.       # Finally read name - it's length is the lower 11 bits of flags
  65.       my $namelength=($entry->{'flags'} & 0x7ff)+1;
  66.  
  67.       # Pad it up to a multiple of 4
  68.       read $infile, $rawdata, $namelength + (8 - (($namelength + 62) % 8)) %8; 
  69.       ($entry->{'name'}) = unpack "a" . ($namelength-1), $rawdata;
  70.  
  71.       push(@index_entries, $entry);
  72.    }
  73.    return @index_entries;
  74. }
  75.  
  76. # First grab the database file
  77. my $target=$ARGV[0];
  78. my $giturl="http://$ARGV[0]/.git/index";
  79. my $ua=LWP::UserAgent->new;
  80. print "Target is: $giturl\n";
  81. $ua->agent("All Your Files Are Belong To Us/1.0");
  82. my $request=HTTP::Request->new(GET => $giturl);
  83. my $result=$ua->request($request);
  84.  
  85. if ($result->status_line !~ /^200/)
  86. {
  87.    die "Could not find Git index file";
  88. }
  89.  
  90. my ($dbfileh, $dbfilen) = tempfile();
  91. print $dbfileh $result->content;
  92. close $dbfileh;
  93.  
  94. open(my $infile, "{'id'},0,2);
  95.    my $resthash=substr($entry->{'id'},2);
  96.  
  97.    my $file=".git/objects/" . $firsttwo . "/" . $resthash;
  98.    my $rawdata;
  99.    my $decompressed;
  100.    my $oh;
  101.  
  102.    print "Extracting " . $entry->{'name'} . "\n";
  103.  
  104.    my $giturl="http://$server/$file";
  105.    my $frequest=HTTP::Request->new(GET => $giturl);
  106.    my $fresult=$ua->request($frequest);
  107.    $rawdata=$fresult->content;
  108.  
  109.    # Make sure the path is there for the output
  110.    my $outputpath="output/" . $entry->{'name'};
  111.    $outputpath =~ s#/[^/]*$##g;
  112.  
  113.    make_path($outputpath);
  114.    open $oh, ">", "output/$entry->{'name'}";
  115.  
  116.    # Now decompress the data
  117.    $decompressed=uncompress($rawdata);
  118.    my $gitfile={};
  119.  
  120.    ($gitfile->{'type'}) = substr($decompressed,0,5);
  121.    if ($gitfile->{'type'} ne "blob ")
  122.    {
  123.       print "Unknown git file type: $gitfile->{'type'}. Skipping\n";
  124.       next;
  125.    }
  126.    ($gitfile->{'size'}) = unpack "Z*", substr($decompressed,5);
  127.    ($gitfile->{'data'}) = substr($decompressed,length($gitfile->{'size'})+6);
  128.  
  129.    # And write it
  130.    print $oh $gitfile->{'data'};
  131.    close($oh);
  132. }
Oct 20 '14 #1
1 2949
gbox26
2
i rewrote this code with my preferred language
Oct 22 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: xxx | last post by:
Hello, I get an error message: Global symbol "%Config" requires explicit package name at /usr/lib/perl5/5.8.3/i386-linux-thread-multi/Errno.pm line 11. What does this mean?
3
by: Petterson Mikael | last post by:
Hi, I have the following package names ( in an xml) that I will transform to html. I need to sort them. <package name="se.company.product.subproduct.boam.fpx.testsignals"> <package...
4
by: r.nikhilk | last post by:
Hi, We are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by including the...
2
by: ygao | last post by:
when a function or method is called,how can get the module global symbol table from which it is called,not the module where it is defined(this is easy). thanks!
1
by: seberino | last post by:
PyList_Append requires explicit Py_INCREF after? (I didn't see in docs where it said if appends a new reference or a borrowed reference like other APIs.) thanks! Chris
3
by: sdeathstar | last post by:
I am working on IBM AIX machine and using XLC C++ complier version 8.0. 1) Able to compile the objects on AIX from C and C++ source code. 2) Able to create the libraries (combination of C & C++,...
1
by: rockdc1981 | last post by:
I dont get it lately the code is working andnow i get the error message...the code below is on a list where i can select the reports from a table source and enables user to preview and export it..any...
2
by: Bennett Haselton | last post by:
How do I find the mapping between a PHP package name like HTTP_Request, and the "yum" command to install it on CentOS 4.4? For example when I needed to use LWP::UserAgent to use in Perl, the...
12
by: Abhishek Mishra | last post by:
Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 I've recently started a project for an...
1
by: KBSethna | last post by:
Linker Error:Undefined Symbol ATM_c::run() in module Project.cpp Linker Error:Undefined Symbol ATM_c::ATM_c() in module Project.cpp ATM_c is a class having a function run() and a constructor....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.